platform/x86: x86-android-tablets: Add touchscreen support for Lenovo Yoga Tab 3 Pro YT3-X90F
PATCH 1/2 platform/x86: x86-android-tablets: Add touchscreen support for Lenovo Yoga Tab 3 Pro YT3-X90F
Add the necessaty info to instantiate the I2C device for the touchscreen on Lenovo Yoga Tab 3 Pro YT3-X90F tablets.
--- .../platform/x86/x86-android-tablets/lenovo.c | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+)
drivers/platform/x86/x86-android-tablets/lenovo.c +46 -0
@@ -11,6 +11,7 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/efi.h> +#include <linux/mfd/intel_soc_pmic.h> #include <linux/pinctrl/consumer.h> #include <linux/pinctrl/machine.h> #include <linux/platform_data/lp855x.h>
@@ -332,6 +333,17 @@ static const struct software_node lenovo_yt3_bq25892_0_node = { .properties = lenovo_yt3_bq25892_0_props, }; +static const struct property_entry lenovo_yt3_hideep_ts_props[] = { +PROPERTY_ENTRY_U32 ("touchscreen-size-x" ,1600 ), +PROPERTY_ENTRY_U32 ("touchscreen-size-y" ,2560 ), +PROPERTY_ENTRY_U32 ("touchscreen-max-pressure" ,255 ), + { } +}; + +static const struct software_node lenovo_yt3_hideep_ts_node = { + .properties = lenovo_yt3_hideep_ts_props, +}; +static const struct x86_i2c_client_info lenovo_yt3_i2c_clients[]__initconst = { {/* bq27500 fuel-gauge for the flat lipo battery behind the screen */
@@ -367,6 +379,22 @@ static const struct x86_i2c_client_info lenovo_yt3_i2c_clients[] __initconst = { .swnode = &fg_bq25890_1_supply_node, }, .adapter_path = "\\_SB_.PCI0.I2C2", + }, { +/* HiDeep Touchscreen */ + .board_info = { + .type = "hideep_ts", + .addr = 0x6c, + .dev_name = "hideep_ts", + .swnode = &lenovo_yt3_hideep_ts_node, + }, + .adapter_path = "\\_SB_.PCI0.I2C6", + .irq_data = { + .type = X86_ACPI_IRQ_TYPE_GPIOINT, + .chip = "INT33FF:03", + .index = 77, + .trigger = ACPI_LEVEL_SENSITIVE, + .polarity = ACPI_ACTIVE_LOW, + }, } };
@@ -407,11 +435,29 @@ static int __init lenovo_yt3_init(void)gpiod_set_value (gpiod,0 ); +/* Enable the regulators used by the touchscreen */ +intel_soc_pmic_exec_mipi_pmic_seq_element (0x6e ,0x9b ,0x02 ,0xff ); +intel_soc_pmic_exec_mipi_pmic_seq_element (0x6e ,0xa0 ,0x02 ,0xff ); +return 0 ; } +static struct gpiod_lookup_table lenovo_yt3_hideep_gpios = { + .dev_id ="i2c-hideep_ts" , + .table = { +GPIO_LOOKUP ("INT33FF:00" ,7 ,"reset" ,GPIO_ACTIVE_LOW ), + { } + }, +}; + +static struct gpiod_lookup_table *const lenovo_yt3_gpios[] = { + &lenovo_yt3_hideep_gpios, +NULL +}; +const struct x86_dev_info lenovo_yt3_info__initconst = { .i2c_client_info = lenovo_yt3_i2c_clients, .i2c_client_count =ARRAY_SIZE (lenovo_yt3_i2c_clients), + .gpiod_lookup_tables = lenovo_yt3_gpios, .init = lenovo_yt3_init, };
Signature · 1 line
2.39.1
PATCH 2/2 platform/x86: x86-android-tablets: Add backlight ctrl for Lenovo Yoga Tab 3 Pro YT3-X90F
The YT3 uses an TI LP8557 LED backlight controller, the LP8557's PWM input is connected to a PWM output coming from the LCD panel's controller.
The Android kernel has a hack in the i915 driver to write the non-standard DSI reg 0x51 with the desired level to set the duty-cycle of the LCD's PWM.
To avoid having to have a similar hack in the mainline kernel program instantiate an i2c-client for the LP8557 with platform-data to have the LP8557 to directly set the level (ignoring its PWM input), this allows backlight brightness control through a backlight device registered by the lp855x_bl driver.
--- .../platform/x86/x86-android-tablets/lenovo.c | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/platform/x86/x86-android-tablets/lenovo.c +23 -0
@@ -344,6 +344,20 @@ static const struct software_node lenovo_yt3_hideep_ts_node = { .properties = lenovo_yt3_hideep_ts_props, }; +/* +* The YT3 uses an TI LP8557 LED backlight controller, the LP8557's PWM input is +* connected to a PWM output coming from the LCD panel's controller. The Android +* kernel has a hack in the i915 driver to write the non-standard DSI reg 0x51 +* with the desired level to set the duty-cycle of the LCD's PWM output. +* +* To avoid having to have a similar hack in the mainline kernel program the +* LP8557 to directly set the level and use the lp855x_bl driver for control. +*/ +static struct lp855x_platform_data lenovo_yt3_lp8557_pdata = { + .device_control =0x86 , + .initial_brightness =128 , +}; +static const struct x86_i2c_client_info lenovo_yt3_i2c_clients[]__initconst = { {/* bq27500 fuel-gauge for the flat lipo battery behind the screen */
@@ -395,6 +409,15 @@ static const struct x86_i2c_client_info lenovo_yt3_i2c_clients[] __initconst = { .trigger = ACPI_LEVEL_SENSITIVE, .polarity = ACPI_ACTIVE_LOW, }, + }, { +/* LP8557 Backlight controller */ + .board_info = { + .type = "lp8557", + .addr = 0x2c, + .dev_name = "lp8557", + .platform_data = &lenovo_yt3_lp8557_pdata, + }, + .adapter_path = "\\_SB_.PCI0.I2C1", } };
Signature · 1 line
2.39.1