diff --git a/src/drivers/intel/touch/chip.h b/src/drivers/intel/touch/chip.h index 90bee4a814..9f3ad3f525 100644 --- a/src/drivers/intel/touch/chip.h +++ b/src/drivers/intel/touch/chip.h @@ -62,10 +62,10 @@ struct intel_thc_hidi2c_info { /* Device connection speed in Hz */ enum i2c_speed connection_speed; /* - * This maps SoC specific function for converting speed in Hz to the actual + * This maps SoC specific function for converting speed enum to the actual * value for the configuration register. */ - uint64_t (*get_soc_i2c_bus_speed_val_func)(uint32_t speed); + uint64_t (*get_soc_i2c_bus_speed_val_func)(enum i2c_speed speed); /* Device address mode */ uint64_t addr_mode; /* Standard Mode (100 kbit/s) Serial Clock Line HIGH Period */ diff --git a/src/drivers/intel/touch/touch.c b/src/drivers/intel/touch/touch.c index 7697ffb149..b070c47d7f 100644 --- a/src/drivers/intel/touch/touch.c +++ b/src/drivers/intel/touch/touch.c @@ -270,8 +270,17 @@ static void touch_generate_acpi_i2cdev_dsd(const struct device *dev) acpigen_write_store_int_to_namestr(touch_get(dev, dev_hidi2c.intf.hidi2c.addr), "DADR"); if (_soc_hidi2c_info->get_soc_i2c_bus_speed_val_func) { + enum i2c_speed connection_speed; + + connection_speed = touch_dev_soc_get(dev, hidi2c, connection_speed); + /* + * If the recommended speed is not specified in the device tree, SoC, and device, + * standard speed is used. + */ + if (!connection_speed) + connection_speed = I2C_SPEED_STANDARD; connection_speed_val = _soc_hidi2c_info->get_soc_i2c_bus_speed_val_func( - touch_dev_soc_get(dev, hidi2c, connection_speed)); + connection_speed); } else { die("Missing SoC function to map I2C speed to its register value!\n"); } diff --git a/src/soc/intel/pantherlake/touch.c b/src/soc/intel/pantherlake/touch.c index f09bd43187..1dab19cabb 100644 --- a/src/soc/intel/pantherlake/touch.c +++ b/src/soc/intel/pantherlake/touch.c @@ -4,7 +4,7 @@ #include /* Convert I2C speed into value for the register in SoC */ -static uint64_t get_soc_thc_i2c_bus_freq_val(uint32_t speed) +static uint64_t get_soc_thc_i2c_bus_freq_val(enum i2c_speed speed) { switch (speed) { case I2C_SPEED_FAST_PLUS: @@ -13,8 +13,6 @@ static uint64_t get_soc_thc_i2c_bus_freq_val(uint32_t speed) return SOC_PTL_THC_I2C_CONNECTION_SPEED_FM; case I2C_SPEED_STANDARD: return SOC_PTL_THC_I2C_CONNECTION_SPEED_SM; - case 0: /* If not specified in the device tree, SoC, and device, standard speed is used */ - return SOC_PTL_THC_I2C_CONNECTION_SPEED_SM; default: die("Fail to map %d Hz to proper I2C speed.\n", speed); }