mirror of
https://github.com/CTCaer/hekate
synced 2024-12-22 11:21:23 +00:00
touch: report gpio info in case of unknown panel
This commit is contained in:
parent
513f77a2ad
commit
dbe431095a
2 changed files with 25 additions and 6 deletions
|
@ -206,6 +206,7 @@ touch_panel_info_t *touch_get_panel_vendor()
|
||||||
{
|
{
|
||||||
u8 buf[5] = {0};
|
u8 buf[5] = {0};
|
||||||
u8 cmd = STMFTS_VENDOR_GPIO_STATE;
|
u8 cmd = STMFTS_VENDOR_GPIO_STATE;
|
||||||
|
static touch_panel_info_t panel_info = { -2, 0, 0, 0, ""};
|
||||||
|
|
||||||
if (touch_command(STMFTS_VENDOR, &cmd, 1))
|
if (touch_command(STMFTS_VENDOR, &cmd, 1))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -220,13 +221,20 @@ touch_panel_info_t *touch_get_panel_vendor()
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
// Touch panel not found, return current gpios.
|
||||||
|
panel_info.gpio0 = buf[0];
|
||||||
|
panel_info.gpio1 = buf[1];
|
||||||
|
panel_info.gpio2 = buf[2];
|
||||||
|
|
||||||
|
return &panel_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
int touch_get_fw_info(touch_fw_info_t *fw)
|
int touch_get_fw_info(touch_fw_info_t *fw)
|
||||||
{
|
{
|
||||||
u8 buf[8] = {0};
|
u8 buf[8] = {0};
|
||||||
|
|
||||||
|
memset(fw, 0, sizeof(touch_fw_info_t));
|
||||||
|
|
||||||
// Get fw address info.
|
// Get fw address info.
|
||||||
u8 cmd[3] = { STMFTS_RW_FRAMEBUFFER_REG, 0, 0x60 };
|
u8 cmd[3] = { STMFTS_RW_FRAMEBUFFER_REG, 0, 0x60 };
|
||||||
int res = touch_read_reg(cmd, 3, buf, 3);
|
int res = touch_read_reg(cmd, 3, buf, 3);
|
||||||
|
@ -318,7 +326,7 @@ int touch_get_fb_info(u8 *buf)
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
|
|
||||||
for (u32 i = 0; i < 0x10000; i+=4)
|
for (u32 i = 0; i < 0x10000; i += 4)
|
||||||
{
|
{
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
|
@ -392,11 +400,11 @@ static int touch_init()
|
||||||
|
|
||||||
int touch_power_on()
|
int touch_power_on()
|
||||||
{
|
{
|
||||||
// Enable LDO6 for touchscreen VDD/AVDD supply.
|
// Enable LDO6 for touchscreen AVDD supply.
|
||||||
max7762x_regulator_set_voltage(REGULATOR_LDO6, 2900000);
|
max7762x_regulator_set_voltage(REGULATOR_LDO6, 2900000);
|
||||||
max7762x_regulator_enable(REGULATOR_LDO6, true);
|
max7762x_regulator_enable(REGULATOR_LDO6, true);
|
||||||
|
|
||||||
// Configure touchscreen GPIO.
|
// Configure touchscreen VDD GPIO.
|
||||||
PINMUX_AUX(PINMUX_AUX_DAP4_SCLK) = PINMUX_PULL_DOWN | 1;
|
PINMUX_AUX(PINMUX_AUX_DAP4_SCLK) = PINMUX_PULL_DOWN | 1;
|
||||||
gpio_config(GPIO_PORT_J, GPIO_PIN_7, GPIO_MODE_GPIO);
|
gpio_config(GPIO_PORT_J, GPIO_PIN_7, GPIO_MODE_GPIO);
|
||||||
gpio_output_enable(GPIO_PORT_J, GPIO_PIN_7, GPIO_OUTPUT_ENABLE);
|
gpio_output_enable(GPIO_PORT_J, GPIO_PIN_7, GPIO_OUTPUT_ENABLE);
|
||||||
|
@ -410,7 +418,7 @@ int touch_power_on()
|
||||||
// Configure Touscreen and GCAsic shared GPIO.
|
// Configure Touscreen and GCAsic shared GPIO.
|
||||||
PINMUX_AUX(PINMUX_AUX_CAM_I2C_SDA) = PINMUX_LPDR | PINMUX_INPUT_ENABLE | PINMUX_TRISTATE | PINMUX_PULL_UP | 2;
|
PINMUX_AUX(PINMUX_AUX_CAM_I2C_SDA) = PINMUX_LPDR | PINMUX_INPUT_ENABLE | PINMUX_TRISTATE | PINMUX_PULL_UP | 2;
|
||||||
PINMUX_AUX(PINMUX_AUX_CAM_I2C_SCL) = PINMUX_IO_HV | PINMUX_LPDR | PINMUX_TRISTATE | PINMUX_PULL_DOWN | 2;
|
PINMUX_AUX(PINMUX_AUX_CAM_I2C_SCL) = PINMUX_IO_HV | PINMUX_LPDR | PINMUX_TRISTATE | PINMUX_PULL_DOWN | 2;
|
||||||
gpio_config(GPIO_PORT_S, GPIO_PIN_3, GPIO_MODE_GPIO);
|
gpio_config(GPIO_PORT_S, GPIO_PIN_3, GPIO_MODE_GPIO); // GC detect.
|
||||||
|
|
||||||
// Initialize I2C3.
|
// Initialize I2C3.
|
||||||
pinmux_config_i2c(I2C_3);
|
pinmux_config_i2c(I2C_3);
|
||||||
|
|
|
@ -943,7 +943,16 @@ static lv_res_t _create_window_fuses_info_status(lv_obj_t *btn)
|
||||||
|
|
||||||
touch_panel = touch_get_panel_vendor();
|
touch_panel = touch_get_panel_vendor();
|
||||||
if (touch_panel)
|
if (touch_panel)
|
||||||
strcat(txt_buf, touch_panel->vendor);
|
{
|
||||||
|
if (touch_panel->idx == -2) // Touch panel not found, print gpios.
|
||||||
|
{
|
||||||
|
s_printf(txt_buf + strlen(txt_buf), "%2X%2X%2X #FFDD00 Contact me!#",
|
||||||
|
touch_panel->gpio0, touch_panel->gpio1, touch_panel->gpio2);
|
||||||
|
touch_panel = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
strcat(txt_buf, touch_panel->vendor);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
strcat(txt_buf, "Unknown #FFDD00 Contact me!#");
|
strcat(txt_buf, "Unknown #FFDD00 Contact me!#");
|
||||||
|
|
||||||
|
@ -994,6 +1003,8 @@ static lv_res_t _create_window_fuses_info_status(lv_obj_t *btn)
|
||||||
s_printf(txt_buf + strlen(txt_buf), " - %s)\n#FF8000 FTB ver:# %04X\n#FF8000 FW rev:# %04X",
|
s_printf(txt_buf + strlen(txt_buf), " - %s)\n#FF8000 FTB ver:# %04X\n#FF8000 FW rev:# %04X",
|
||||||
panel_ic_paired ? "Paired" : "#FFDD00 Error#", touch_fw.ftb_ver, touch_fw.fw_rev);
|
panel_ic_paired ? "Paired" : "#FFDD00 Error#", touch_fw.ftb_ver, touch_fw.fw_rev);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
strcat(txt_buf, "\n\n#FFDD00 Failed to get touch info!#");
|
||||||
|
|
||||||
// Check if patched unit.
|
// Check if patched unit.
|
||||||
if (!fuse_check_patched_rcm())
|
if (!fuse_check_patched_rcm())
|
||||||
|
|
Loading…
Reference in a new issue