init: Set DPI property based on platform subtype ID

There is a need to support panels of different resolutions
on msm8926. In such scenarios, the platform subtype
ID is used to uniquely identify such panels. Use this ID to
correctly configure the device property for the DPI setting.

Change-Id: If2d7c3cb2a528e9fe6780116ea1ceb278eba138d
This commit is contained in:
Aravind Venkateswaran 2014-02-04 12:35:02 -08:00
parent 328e975516
commit 1d6fc81ca3
3 changed files with 30 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2013, The Linux Foundation. All rights reserved.
Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@ -71,7 +71,7 @@ void init_msm_properties(unsigned long soc, unsigned long socrev, char *board)
UNUSED(board);
}
static int read_file2(const char *fname, char *data, int max_size)
int read_file2(const char *fname, char *data, int max_size)
{
int fd, rc;

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2013, The Linux Foundation. All rights reserved.
Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@ -42,5 +42,6 @@
#define ISMATCH(a,b) (!strncmp(a,b,PROP_VALUE_MAX))
void init_msm_properties(unsigned long msm_id, unsigned long msm_ver, char *board_type);
int read_file2(const char *fname, char *data, int max_size);
#endif /* __INIT_MSM__H__ */

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2013, The Linux Foundation. All rights reserved.
Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@ -36,10 +36,23 @@
#include "init_msm.h"
#define SUBTYPE_ID_PATH1 "/sys/devices/soc0/platform_subtype_id"
#define SUBTYPE_ID_PATH2 "/sys/devices/system/soc/soc0/platform_subtype_id"
#define BUF_SIZE 64
enum {
PLATFORM_SUBTYPE_720p = 0x0,
PLATFORM_SUBTYPE_1080p = 0x2,
PLATFORM_SUBTYPE_1080p_EXT_BUCK = 0x3,
PLATFORM_SUBTYPE_INVALID,
};
void init_msm_properties(unsigned long msm_id, unsigned long msm_ver, char *board_type)
{
char platform[PROP_VALUE_MAX];
int rc;
unsigned long subtype = PLATFORM_SUBTYPE_720p;
char tmp[BUF_SIZE];
UNUSED(msm_id);
UNUSED(msm_ver);
@ -49,5 +62,16 @@ void init_msm_properties(unsigned long msm_id, unsigned long msm_ver, char *boar
if (!rc || !ISMATCH(platform, ANDROID_TARGET))
return;
rc = read_file2(SUBTYPE_ID_PATH1, tmp, sizeof(tmp));
if (!rc) {
rc = read_file2(SUBTYPE_ID_PATH2, tmp, sizeof(tmp));
}
if (rc) {
subtype = strtoul(tmp, NULL, 0);
}
if ((subtype == PLATFORM_SUBTYPE_1080p) || (subtype == PLATFORM_SUBTYPE_1080p_EXT_BUCK))
property_set(PROP_LCDDENSITY, "480");
else
property_set(PROP_LCDDENSITY, "320");
}