]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
HID: cp2112: Configure I2C bus speed from firmware
authorDanny Kaehn <danny.kaehn@plexus.com>
Wed, 20 May 2026 16:13:07 +0000 (11:13 -0500)
committerJiri Kosina <jkosina@suse.com>
Wed, 10 Jun 2026 15:34:39 +0000 (17:34 +0200)
Now that the I2C adapter on the CP2112 can have an associated firmware
node, set the bus speed based on firmware configuration

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Danny Kaehn <danny.kaehn@plexus.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
drivers/hid/hid-cp2112.c

index e960fc988058f945a8f0ca735a6e55fa7f906f89..04379db93571bddc54fd5d2832c8db06b6e544e1 100644 (file)
@@ -1223,6 +1223,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
        struct fwnode_handle *cp2112_fwnode;
        struct fwnode_handle *child;
        struct gpio_irq_chip *girq;
+       struct i2c_timings timings;
        u32 addr;
        int ret;
 
@@ -1308,6 +1309,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),