]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/i2c/busses/i2c-designware-platdrv.c
i2c: designware: Default to fast mode in case of ACPI
[mirror_ubuntu-artful-kernel.git] / drivers / i2c / busses / i2c-designware-platdrv.c
index 8193e8eea7641b8dcc6df15e5fdacd60ec502119..353adc4dc5831b839eefe8358bcc29fbcdba38f0 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/io.h>
 #include <linux/slab.h>
 #include <linux/acpi.h>
+#include <linux/platform_data/i2c-designware.h>
 #include "i2c-designware-core.h"
 
 static struct i2c_algorithm i2c_dw_algo = {
@@ -79,7 +80,6 @@ static void dw_i2c_acpi_params(struct platform_device *pdev, char method[],
 static int dw_i2c_acpi_configure(struct platform_device *pdev)
 {
        struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
-       bool fs_mode = dev->master_cfg & DW_IC_CON_SPEED_FAST;
 
        if (!ACPI_HANDLE(&pdev->dev))
                return -ENODEV;
@@ -92,10 +92,9 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev)
         * Try to get SDA hold time and *CNT values from an ACPI method if
         * it exists for both supported speed modes.
         */
-       dw_i2c_acpi_params(pdev, "SSCN", &dev->ss_hcnt, &dev->ss_lcnt,
-                          fs_mode ? NULL : &dev->sda_hold_time);
+       dw_i2c_acpi_params(pdev, "SSCN", &dev->ss_hcnt, &dev->ss_lcnt, NULL);
        dw_i2c_acpi_params(pdev, "FMCN", &dev->fs_hcnt, &dev->fs_lcnt,
-                          fs_mode ? &dev->sda_hold_time : NULL);
+                          &dev->sda_hold_time);
 
        return 0;
 }
@@ -122,6 +121,7 @@ static int dw_i2c_probe(struct platform_device *pdev)
        struct dw_i2c_dev *dev;
        struct i2c_adapter *adap;
        struct resource *mem;
+       struct dw_i2c_platform_data *pdata;
        int irq, r;
        u32 clk_freq;
 
@@ -182,6 +182,10 @@ static int dw_i2c_probe(struct platform_device *pdev)
                        dev_err(&pdev->dev, "Only 100kHz and 400kHz supported");
                        return -EINVAL;
                }
+       } else {
+               pdata = dev_get_platdata(&pdev->dev);
+               if (pdata)
+                       clk_freq = pdata->i2c_scl_freq;
        }
 
        dev->functionality =