blob: a8c61b9f4c67b928042a731880356fa1816638ed [file]
From a1a466eaa5627b89097a3f7f08479788e728cb4c Mon Sep 17 00:00:00 2001
From: Danny Kaehn <danny.kaehn@plexus.com>
Date: Wed, 5 Jun 2024 18:12:47 -0500
Subject: [PATCH] HID: cp2112: Configure I2C Bus Speed from Firmware
Now that the I2C adapter on the CP2112 can have an associated firmware
node, set the bus speed based on firmware configuration
Signed-off-by: Danny Kaehn <danny.kaehn@plexus.com>
---
drivers/hid/hid-cp2112.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c
index ff86fece2064..4900aa03ef47 100644
--- a/drivers/hid/hid-cp2112.c
+++ b/drivers/hid/hid-cp2112.c
@@ -1210,6 +1210,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
struct cp2112_smbus_config_report config;
struct fwnode_handle *child;
struct gpio_irq_chip *girq;
+ struct i2c_timings timings;
const char *name;
u32 addr;
int ret;
@@ -1290,6 +1291,9 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
goto err_power_normal;
}
+ i2c_parse_fw_timings(&dev->adap.dev, &timings, true);
+
+ config.clock_speed = cpu_to_be32(timings.bus_freq_hz);
config.retry_time = cpu_to_be16(1);
ret = cp2112_hid_output(hdev, (u8 *)&config, sizeof(config),
--
2.52.0.313.g674ac2bdf7-goog