Skip to content

Commit

Permalink
i2c: designware: Find bus speed from ACPI
Browse files Browse the repository at this point in the history
Fast mode is the default speed of i2c-designware which can be overridden
by platform data or by "clock-frequency" device property. Even though
the ACPI 5.1 can pass device properties via _DSD method, shipping systems
define the connection speed between I2C host and each slave in their
I2cSerialBus resources. Which means speed is not defined per bus but per
slave.

As there is now support in i2c-core to find the bus speed from ACPI use
that to set up the bus speed prior registering the I2C adapter.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
  • Loading branch information
jhnikula authored and Wolfram Sang committed Aug 25, 2016
1 parent 5853b22 commit 10f8e7f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/i2c/busses/i2c-designware-platdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
struct i2c_adapter *adap;
struct resource *mem;
int irq, r;
u32 ht = 0;
u32 acpi_speed, ht = 0;

irq = platform_get_irq(pdev, 0);
if (irq < 0)
Expand Down Expand Up @@ -192,6 +192,10 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
&dev->clk_freq);
}

acpi_speed = i2c_acpi_find_bus_speed(&pdev->dev);
if (acpi_speed)
dev->clk_freq = acpi_speed;

if (has_acpi_companion(&pdev->dev))
dw_i2c_acpi_configure(pdev);

Expand Down

0 comments on commit 10f8e7f

Please sign in to comment.