From e6a8143d8b47a1f8bf490825f62ed7203835aec1 Mon Sep 17 00:00:00 2001 From: Cliff Huang Date: Tue, 16 Sep 2025 10:24:22 -0700 Subject: [PATCH] drivers/intel/touch: Add support for new Intel touch I2C _DSD entries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This update enhances the Intel touch driver by incorporating support for newly added _DSD entries specific to I2C devices. The enhancements include: - Adding new entries in the I2C _DSD to enable configurations for maximum frame size and interrupt delay settings. - Introducing device-specific interrupt delay settings tailored for Hynitron devices. These changes ensure improved configurability and performance tuning for supported devices. It is crucial to use this update with an operating system that includes corresponding changes for this new support. ATTENTION: This change requires a THC driver fix. If the OS does not have the driver fix, please use LPSS I2C or disable the touchscreen and touchpad. For instance, on the Google Fatcat board, use the following CBI fw_config options: TOUCHSCREEN field: TOUCHSCREEN_LPSS_I2C or TOUCHSCREEN_NONE TOUCHPAD field: TOUCHPAD_LPSS_I2C or TOUCHPAD_NONE BUG=none Signed-off-by: Cliff Huang Change-Id: Iaab8329c97247161395d203a5efa92c053acb3a1 Reviewed-on: https://review.coreboot.org/c/coreboot/+/89214 Reviewed-by: Jérémy Compostella Reviewed-by: Kim, Kyoung Il Tested-by: build bot (Jenkins) --- src/drivers/intel/touch/chip.h | 4 ++++ src/drivers/intel/touch/hynitron.h | 2 ++ src/drivers/intel/touch/touch.c | 23 +++++++++++++++++++++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/drivers/intel/touch/chip.h b/src/drivers/intel/touch/chip.h index 69b58f83aa..83b5cd7d37 100644 --- a/src/drivers/intel/touch/chip.h +++ b/src/drivers/intel/touch/chip.h @@ -20,6 +20,10 @@ struct intel_thc_hidi2c_dev_info { * Otherwise, if not specified, use the speed setting from the platform. */ enum i2c_speed connection_speed; + /* Maximum Frame Size Value: FSVL; FSEN will be set if FSVL has non-zero value */ + uint64_t max_frame_size_value; + /* Interrupt delay value: INDV; INDE will be set if INDV has non-zero value */ + uint64_t interrupt_delay_value; }; struct intel_thc_hidspi_dev_info { diff --git a/src/drivers/intel/touch/hynitron.h b/src/drivers/intel/touch/hynitron.h index 9932bbeb65..8ad065fe9b 100644 --- a/src/drivers/intel/touch/hynitron.h +++ b/src/drivers/intel/touch/hynitron.h @@ -13,6 +13,8 @@ static const struct drivers_intel_touch_config hynitron_touch_config = { .intf.hidi2c.addr = 0x2c, .intf.hidi2c.descriptor_address = 0x20, .intf.hidi2c.connection_speed = I2C_SPEED_FAST, /* fast mode */ + .intf.hidi2c.interrupt_delay_value = 4, /* unit: 10 usec */ + .intf.hidi2c.max_frame_size_value = 50, /* bytes */ }, }; diff --git a/src/drivers/intel/touch/touch.c b/src/drivers/intel/touch/touch.c index 5bca4173c6..85dd7f9159 100644 --- a/src/drivers/intel/touch/touch.c +++ b/src/drivers/intel/touch/touch.c @@ -237,7 +237,7 @@ static void touch_generate_acpi_i2cdev_dsd(const struct device *dev) acpigen_write_name("ICRS"); acpigen_emit_byte(BUFFER_OP); acpigen_write_len_f(); - acpigen_write_integer(12); /* total size of ICRS + 1 */ + acpigen_write_integer(2 + 8 + 1 + 1); /* total size of ICRS + 1 */ acpigen_pop_len(); /* Name */ acpigen_write_create_buffer_word_field("ICRS", 0x00, "DADR"); acpigen_write_create_buffer_qword_field("ICRS", 0x02, "DSPD"); @@ -246,7 +246,7 @@ static void touch_generate_acpi_i2cdev_dsd(const struct device *dev) acpigen_write_name("ISUB"); acpigen_emit_byte(BUFFER_OP); acpigen_write_len_f(); - acpigen_write_integer(145); /* total size of ISUB + 1 */ + acpigen_write_integer(22 * 8 + 1); /* total size of ISUB + 1 */ acpigen_pop_len(); acpigen_write_create_buffer_qword_field("ISUB", 0x00, "SMHX"); acpigen_write_create_buffer_qword_field("ISUB", 0x08, "SMLX"); @@ -266,6 +266,10 @@ static void touch_generate_acpi_i2cdev_dsd(const struct device *dev) acpigen_write_create_buffer_qword_field("ISUB", 0x78, "HMTD"); acpigen_write_create_buffer_qword_field("ISUB", 0x80, "HMRD"); acpigen_write_create_buffer_qword_field("ISUB", 0x88, "HMSL"); + acpigen_write_create_buffer_qword_field("ISUB", 0x90, "FSEN"); + acpigen_write_create_buffer_qword_field("ISUB", 0x98, "FSVL"); + acpigen_write_create_buffer_qword_field("ISUB", 0xa0, "INDE"); + acpigen_write_create_buffer_qword_field("ISUB", 0xa8, "INDV"); acpigen_write_store_int_to_namestr(touch_get(dev, dev_hidi2c.intf.hidi2c.addr), "DADR"); @@ -305,6 +309,21 @@ static void touch_generate_acpi_i2cdev_dsd(const struct device *dev) acpigen_write_store_int_to_namestr(touch_soc_get(dev, hidi2c, hm_sda_hold_rx_period), "HMRD"); acpigen_write_store_int_to_namestr(touch_soc_get(dev, hidi2c, suppressed_spikes_h_fp), "HMSL"); + if (get_driver_config(dev)->dev_hidi2c.intf.hidi2c.max_frame_size_value) { + acpigen_write_store_int_to_namestr(1, "FSEN"); + acpigen_write_store_int_to_namestr(touch_get(dev, dev_hidi2c.intf.hidi2c.max_frame_size_value), "FSVL"); + } else { + acpigen_write_store_int_to_namestr(0, "FSEN"); + acpigen_write_store_int_to_namestr(0, "FSVL"); + } + if (get_driver_config(dev)->dev_hidi2c.intf.hidi2c.interrupt_delay_value) { + acpigen_write_store_int_to_namestr(1, "INDE"); + acpigen_write_store_int_to_namestr(touch_get(dev, dev_hidi2c.intf.hidi2c.interrupt_delay_value), "INDV"); + } else { + acpigen_write_store_int_to_namestr(0, "INDE"); + acpigen_write_store_int_to_namestr(0, "INDV"); + } + dsd_pkg_cnt = 4; if (touch_get(dev, add_acpi_dma_property)) dsd_pkg_cnt += 2;