input: himax_v2_mmi: add compatibility for different panels

himax_v2_mmi:
Use /chosen/mmi,panel_name to support compatibility for different
panels, use different touch firmware and test csv.

Change-Id: Id60f9af95e075e83a8d1121cda22f5c98a8a7132
Signed-off-by: wangyq13 <wangyq13@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1422872
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wei Deng <dengwei1@motorola.com>
Reviewed-by: Jun Weng <wengjun1@motorola.com>
Reviewed-by: Jialei Hao <haojl2@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
wangyq13 2019-09-17 19:30:56 +08:00 • committed by Yeqing Wang
commit 7b9296be2a
4 changed files with 46 additions and 3 deletions

View file

@ -94,6 +94,8 @@ struct firmware g_embedded_fw = {
};
#endif
#define HIMAX_FILE_NAME_LENGTH 128
#if defined(HX_AUTO_UPDATE_FW) || defined(HX_ZERO_FLASH)
#if defined(HX_EN_DYNAMIC_NAME)
char *i_CTPM_firmware_name;
@ -3389,6 +3391,17 @@ int himax_chip_common_init(void)
#endif
i_CTPM_firmware_name = kzalloc(HIMAX_FILE_NAME_LENGTH, GFP_KERNEL);
if (!i_CTPM_firmware_name) {
E("%s: alloc i_CTPM_firmware_name failed\n", __func__);
goto firmware_name_alloc_failed;
}
if (pdata->panel_supplier)
snprintf(i_CTPM_firmware_name, HIMAX_FILE_NAME_LENGTH, "%s_Himax_firmware.bin",
pdata->panel_supplier);
else
snprintf(i_CTPM_firmware_name, HIMAX_FILE_NAME_LENGTH, "Himax_firmware.bin");
g_hx_chip_inited = 0;
idx = himax_get_ksym_idx();
if (idx >= 0) {
@ -3630,6 +3643,7 @@ err_register_charger_notify_failed:
#endif
error_ic_detect_failed:
himax_gpio_power_deconfig(pdata);
firmware_name_alloc_failed:
#ifndef CONFIG_OF
err_power_failed:
#endif

View file

@ -1674,8 +1674,11 @@ static int himax_parse_criteria_file(void)
if (hx_self_test_file_name == NULL) {
E("file name is NULL\n");
hx_self_test_file_name = kzalloc(80, GFP_KERNEL);
snprintf(hx_self_test_file_name, 16, "hx_criteria.csv");
I("%s: Use default name\n", __func__);
if (private_ts->pdata->panel_supplier)
snprintf(hx_self_test_file_name, 60, "%s_hx_criteria.csv", private_ts->pdata->panel_supplier);
else
snprintf(hx_self_test_file_name, 16, "hx_criteria.csv");
I("%s: Use name %s\n", __func__, hx_self_test_file_name);
}
I("file name = %s\n", hx_self_test_file_name);

View file

@ -108,7 +108,7 @@ int himax_parse_dt(struct himax_ts_data *ts,
uint32_t coords[4] = {0};
uint32_t touch_info[8] = {0};
struct property *prop;
struct device_node *dt = ts->dev->of_node;
struct device_node *chosen, *dt = ts->dev->of_node;
u32 data = 0;
prop = of_find_property(dt, "himax,panel-coords", NULL);
@ -202,6 +202,31 @@ int himax_parse_dt(struct himax_ts_data *ts,
}
himax_vk_parser(dt, pdata);
chosen = of_find_node_by_name(NULL, "chosen");
if (chosen) {
const char *supplier;
char *s, *d;
int rc;
rc = of_property_read_string(chosen, "mmi,panel_name",
(const char **)&supplier);
if (rc) {
I("%s: cannot read mmi,panel_name %d\n",
__func__, rc);
} else {
I( "%s: mmi,panel_name %s\n", __func__, supplier);
/* skip dsi_ part */
s = (char *)supplier;
d = pdata->panel_supplier;
while (*s != '_') *d++ = *s++;
I("%s: panel-supplier %s\n", __func__, pdata->panel_supplier);
}
of_node_put(chosen);
}
return 0;
}
EXPORT_SYMBOL(himax_parse_dt);

View file

@ -92,6 +92,7 @@ struct himax_i2c_platform_data {
int gpio_irq;
int gpio_reset;
int gpio_3v3_en;
char panel_supplier[16];
int (*power)(int on);
void (*reset)(void);
struct himax_virtual_key *virtual_key;