OSDN Git Service

Merge branch 'i2c/for-3.20' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 21 Feb 2015 20:41:50 +0000 (12:41 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 21 Feb 2015 20:41:50 +0000 (12:41 -0800)
Pull i2c updates from Wolfram Sang:
 "Summary:

   - legacy PM code removed from the core, there were no users anymore
     (thanks to Lars-Peter Clausen)

   - new driver for Broadcom iProc

   - bigger driver updates for designware, rk3x, cadence, ocores

   - a bunch of smaller updates and bugfixes"

* 'i2c/for-3.20' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (31 commits)
  i2c: ocores: rework clk code to handle NULL cookie
  i2c: designware-baytrail: another fixup for proper Kconfig dependencies
  i2c: fix reference to functionality constants definition
  i2c: iproc: Add Broadcom iProc I2C Driver
  i2c: designware-pci: update Intel copyright line
  i2c: ocores: add common clock support
  i2c: hix5hd2: add COMPILE_TEST
  i2c: clarify comments about the dev_released completion
  i2c: ocores: fix clock-frequency binding usage
  i2c: tegra: Maintain CPU endianness
  i2c: designware-baytrail: use proper Kconfig dependencies
  i2c: designware: Do not calculate SCL timing parameters needlessly
  i2c: do not try to load modules for of-registered devices
  i2c: designware: Add Intel Baytrail PMIC I2C bus support
  i2c: designware: Add i2c bus locking support
  of: i2c: Add i2c-mux-idle-disconnect DT property to PCA954x mux driver
  i2c: designware: use {readl|writel}_relaxed instead of readl/writel
  i2c: designware-pci: no need to provide clk_khz
  i2c: designware-pci: remove Moorestown support
  i2c: imx: whitespace and checkpatch cleanup
  ...

1  2 
Documentation/devicetree/bindings/i2c/trivial-devices.txt
drivers/i2c/busses/Kconfig
drivers/i2c/i2c-core.c
include/linux/i2c.h

@@@ -9,7 -9,6 +9,7 @@@ document for it just like any other dev
  
  Compatible            Vendor / Chip
  ==========            =============
 +abracon,abb5zes3              AB-RTCMC-32.768kHz-B5ZE-S3: Real Time Clock/Calendar Module with I2C Interface
  ad,ad7414             SMBus/I2C Digital Temperature Sensor in 6-Pin SOT with SMBus Alert and Over Temperature Pin
  ad,adm9240            ADM9240:  Complete System Hardware Monitor for uProcessor-Based Systems
  adi,adt7461           +/-1C TDM Extended Temp Range I.C
@@@ -35,7 -34,6 +35,7 @@@ atmel,24c512          i2c serial eeprom  (24cxx
  atmel,24c1024         i2c serial eeprom  (24cxx)
  atmel,at97sc3204t     i2c trusted platform module (TPM)
  capella,cm32181               CM32181: Ambient Light Sensor
 +capella,cm3232                CM3232: Ambient Light Sensor
  catalyst,24c32                i2c serial eeprom
  cirrus,cs42l51                Cirrus Logic CS42L51 audio codec
  dallas,ds1307         64 x 8, Serial, I2C Real-Time Clock
@@@ -49,7 -47,6 +49,7 @@@ dallas,ds3232         Extremely Accurate I²C 
  dallas,ds4510         CPU Supervisor with Nonvolatile Memory and Programmable I/O
  dallas,ds75           Digital Thermometer and Thermostat
  dlg,da9053            DA9053: flexible system level PMIC with multicore support
 +dlg,da9063            DA9063: system PMIC for quad-core application processors
  epson,rx8025          High-Stability. I2C-Bus INTERFACE REAL TIME CLOCK MODULE
  epson,rx8581          I2C-BUS INTERFACE REAL TIME CLOCK MODULE
  fsl,mag3110           MAG3110: Xtrinsic High Accuracy, 3D Magnetometer
@@@ -61,9 -58,8 +61,8 @@@ fsl,sgtl5000          SGTL5000: Ultra Low-Powe
  gmt,g751              G751: Digital Temperature Sensor and Thermal Watchdog with Two-Wire Interface
  infineon,slb9635tt    Infineon SLB9635 (Soft-) I2C TPM (old protocol, max 100khz)
  infineon,slb9645tt    Infineon SLB9645 I2C TPM (new protocol, max 400khz)
- isl,isl12057          Intersil ISL12057 I2C RTC Chip
- isil,isl29028           (deprecated, use isl)
- isl,isl29028            Intersil ISL29028 Ambient Light and Proximity Sensor
+ isil,isl12057         Intersil ISL12057 I2C RTC Chip
+ isil,isl29028         Intersil ISL29028 Ambient Light and Proximity Sensor
  maxim,ds1050          5 Bit Programmable, Pulse-Width Modulator
  maxim,max1237         Low-Power, 4-/12-Channel, 2-Wire Serial, 12-Bit ADCs
  maxim,max6625         9-Bit/12-Bit Temperature Sensors with I²C-Compatible Serial Interface
@@@ -79,7 -79,7 +79,7 @@@ config I2C_AMD811
  
  config I2C_HIX5HD2
        tristate "Hix5hd2 high-speed I2C driver"
-       depends on ARCH_HIX5HD2
+       depends on ARCH_HIX5HD2 || COMPILE_TEST
        help
          Say Y here to include support for high-speed I2C controller in the
          Hisilicon based hix5hd2 SoCs.
@@@ -372,6 -372,16 +372,16 @@@ config I2C_BCM283
          This support is also available as a module.  If so, the module
          will be called i2c-bcm2835.
  
+ config I2C_BCM_IPROC
+       tristate "Broadcom iProc I2C controller"
+       depends on ARCH_BCM_IPROC || COMPILE_TEST
+       default ARCH_BCM_IPROC
+       help
+         If you say yes to this option, support will be included for the
+         Broadcom iProc I2C controller.
+         If you don't know what to do here, say N.
  config I2C_BCM_KONA
        tristate "BCM Kona I2C adapter"
        depends on ARCH_BCM_MOBILE
@@@ -465,6 -475,16 +475,16 @@@ config I2C_DESIGNWARE_PC
          This driver can also be built as a module.  If so, the module
          will be called i2c-designware-pci.
  
+ config I2C_DESIGNWARE_BAYTRAIL
+       bool "Intel Baytrail I2C semaphore support"
+       depends on I2C_DESIGNWARE_PLATFORM && IOSF_MBI=y && ACPI
+       help
+         This driver enables managed host access to the PMIC I2C bus on select
+         Intel BayTrail platforms using the X-Powers AXP288 PMIC. It allows
+         the host to request uninterrupted access to the PMIC's I2C bus from
+         the platform firmware controlling it. You should say Y if running on
+         a BayTrail system using the AXP288.
  config I2C_EFM32
        tristate "EFM32 I2C controller"
        depends on ARCH_EFM32 || COMPILE_TEST
@@@ -881,7 -901,6 +901,7 @@@ config I2C_XL
  config I2C_RCAR
        tristate "Renesas R-Car I2C Controller"
        depends on ARCH_SHMOBILE || COMPILE_TEST
 +      select I2C_SLAVE
        help
          If you say yes to this option, support will be included for the
          R-Car I2C controller.
diff --combined drivers/i2c/i2c-core.c
@@@ -102,7 -102,7 +102,7 @@@ static int acpi_i2c_add_resource(struc
                struct acpi_resource_i2c_serialbus *sb;
  
                sb = &ares->data.i2c_serial_bus;
-               if (sb->type == ACPI_RESOURCE_SERIAL_TYPE_I2C) {
+               if (!info->addr && sb->type == ACPI_RESOURCE_SERIAL_TYPE_I2C) {
                        info->addr = sb->slave_address;
                        if (sb->access_mode == ACPI_I2C_10BIT_MODE)
                                info->flags |= I2C_CLIENT_TEN;
@@@ -698,101 -698,6 +698,6 @@@ static void i2c_device_shutdown(struct 
                driver->shutdown(client);
  }
  
- #ifdef CONFIG_PM_SLEEP
- static int i2c_legacy_suspend(struct device *dev, pm_message_t mesg)
- {
-       struct i2c_client *client = i2c_verify_client(dev);
-       struct i2c_driver *driver;
-       if (!client || !dev->driver)
-               return 0;
-       driver = to_i2c_driver(dev->driver);
-       if (!driver->suspend)
-               return 0;
-       return driver->suspend(client, mesg);
- }
- static int i2c_legacy_resume(struct device *dev)
- {
-       struct i2c_client *client = i2c_verify_client(dev);
-       struct i2c_driver *driver;
-       if (!client || !dev->driver)
-               return 0;
-       driver = to_i2c_driver(dev->driver);
-       if (!driver->resume)
-               return 0;
-       return driver->resume(client);
- }
- static int i2c_device_pm_suspend(struct device *dev)
- {
-       const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
-       if (pm)
-               return pm_generic_suspend(dev);
-       else
-               return i2c_legacy_suspend(dev, PMSG_SUSPEND);
- }
- static int i2c_device_pm_resume(struct device *dev)
- {
-       const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
-       if (pm)
-               return pm_generic_resume(dev);
-       else
-               return i2c_legacy_resume(dev);
- }
- static int i2c_device_pm_freeze(struct device *dev)
- {
-       const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
-       if (pm)
-               return pm_generic_freeze(dev);
-       else
-               return i2c_legacy_suspend(dev, PMSG_FREEZE);
- }
- static int i2c_device_pm_thaw(struct device *dev)
- {
-       const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
-       if (pm)
-               return pm_generic_thaw(dev);
-       else
-               return i2c_legacy_resume(dev);
- }
- static int i2c_device_pm_poweroff(struct device *dev)
- {
-       const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
-       if (pm)
-               return pm_generic_poweroff(dev);
-       else
-               return i2c_legacy_suspend(dev, PMSG_HIBERNATE);
- }
- static int i2c_device_pm_restore(struct device *dev)
- {
-       const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
-       if (pm)
-               return pm_generic_restore(dev);
-       else
-               return i2c_legacy_resume(dev);
- }
- #else /* !CONFIG_PM_SLEEP */
- #define i2c_device_pm_suspend NULL
- #define i2c_device_pm_resume  NULL
- #define i2c_device_pm_freeze  NULL
- #define i2c_device_pm_thaw    NULL
- #define i2c_device_pm_poweroff        NULL
- #define i2c_device_pm_restore NULL
- #endif /* !CONFIG_PM_SLEEP */
  static void i2c_client_dev_release(struct device *dev)
  {
        kfree(to_i2c_client(dev));
@@@ -804,6 -709,7 +709,7 @@@ show_name(struct device *dev, struct de
        return sprintf(buf, "%s\n", dev->type == &i2c_client_type ?
                       to_i2c_client(dev)->name : to_i2c_adapter(dev)->name);
  }
+ static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
  
  static ssize_t
  show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
  
        return sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name);
  }
- static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
  static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL);
  
  static struct attribute *i2c_dev_attrs[] = {
        &dev_attr_modalias.attr,
        NULL
  };
- static struct attribute_group i2c_dev_attr_group = {
-       .attrs          = i2c_dev_attrs,
- };
- static const struct attribute_group *i2c_dev_attr_groups[] = {
-       &i2c_dev_attr_group,
-       NULL
- };
- static const struct dev_pm_ops i2c_device_pm_ops = {
-       .suspend = i2c_device_pm_suspend,
-       .resume = i2c_device_pm_resume,
-       .freeze = i2c_device_pm_freeze,
-       .thaw = i2c_device_pm_thaw,
-       .poweroff = i2c_device_pm_poweroff,
-       .restore = i2c_device_pm_restore,
-       SET_RUNTIME_PM_OPS(
-               pm_generic_runtime_suspend,
-               pm_generic_runtime_resume,
-               NULL
-       )
- };
+ ATTRIBUTE_GROUPS(i2c_dev);
  
  struct bus_type i2c_bus_type = {
        .name           = "i2c",
        .probe          = i2c_device_probe,
        .remove         = i2c_device_remove,
        .shutdown       = i2c_device_shutdown,
-       .pm             = &i2c_device_pm_ops,
  };
  EXPORT_SYMBOL_GPL(i2c_bus_type);
  
  static struct device_type i2c_client_type = {
-       .groups         = i2c_dev_attr_groups,
+       .groups         = i2c_dev_groups,
        .uevent         = i2c_device_uevent,
        .release        = i2c_client_dev_release,
  };
@@@ -1261,6 -1142,7 +1142,7 @@@ i2c_sysfs_new_device(struct device *dev
  
        return count;
  }
+ static DEVICE_ATTR(new_device, S_IWUSR, NULL, i2c_sysfs_new_device);
  
  /*
   * And of course let the users delete the devices they instantiated, if
@@@ -1315,8 -1197,6 +1197,6 @@@ i2c_sysfs_delete_device(struct device *
                        "delete_device");
        return res;
  }
- static DEVICE_ATTR(new_device, S_IWUSR, NULL, i2c_sysfs_new_device);
  static DEVICE_ATTR_IGNORE_LOCKDEP(delete_device, S_IWUSR, NULL,
                                   i2c_sysfs_delete_device);
  
@@@ -1326,18 -1206,10 +1206,10 @@@ static struct attribute *i2c_adapter_at
        &dev_attr_delete_device.attr,
        NULL
  };
- static struct attribute_group i2c_adapter_attr_group = {
-       .attrs          = i2c_adapter_attrs,
- };
- static const struct attribute_group *i2c_adapter_attr_groups[] = {
-       &i2c_adapter_attr_group,
-       NULL
- };
+ ATTRIBUTE_GROUPS(i2c_adapter);
  
  struct device_type i2c_adapter_type = {
-       .groups         = i2c_adapter_attr_groups,
+       .groups         = i2c_adapter_groups,
        .release        = i2c_adapter_dev_release,
  };
  EXPORT_SYMBOL_GPL(i2c_adapter_type);
@@@ -1419,8 -1291,6 +1291,6 @@@ static struct i2c_client *of_i2c_regist
        if (of_get_property(node, "wakeup-source", NULL))
                info.flags |= I2C_CLIENT_WAKE;
  
-       request_module("%s%s", I2C_MODULE_PREFIX, info.type);
        result = i2c_new_device(adap, &info);
        if (result == NULL) {
                dev_err(&adap->dev, "of_i2c: Failure registering %s\n",
@@@ -1796,11 -1666,15 +1666,15 @@@ void i2c_del_adapter(struct i2c_adapte
        /* device name is gone after device_unregister */
        dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);
  
-       /* clean up the sysfs representation */
+       /* wait until all references to the device are gone
+        *
+        * FIXME: This is old code and should ideally be replaced by an
+        * alternative which results in decoupling the lifetime of the struct
+        * device from the i2c_adapter, like spi or netdev do. Any solution
+        * should be throughly tested with DEBUG_KOBJECT_RELEASE enabled!
+        */
        init_completion(&adap->dev_released);
        device_unregister(&adap->dev);
-       /* wait for sysfs to drop all references */
        wait_for_completion(&adap->dev_released);
  
        /* free bus id */
@@@ -1859,14 -1733,6 +1733,6 @@@ int i2c_register_driver(struct module *
        if (res)
                return res;
  
-       /* Drivers should switch to dev_pm_ops instead. */
-       if (driver->suspend)
-               pr_warn("i2c-core: driver [%s] using legacy suspend method\n",
-                       driver->driver.name);
-       if (driver->resume)
-               pr_warn("i2c-core: driver [%s] using legacy resume method\n",
-                       driver->driver.name);
        pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name);
  
        INIT_LIST_HEAD(&driver->clients);
@@@ -2972,7 -2838,6 +2838,7 @@@ trace
  }
  EXPORT_SYMBOL(i2c_smbus_xfer);
  
 +#if IS_ENABLED(CONFIG_I2C_SLAVE)
  int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb)
  {
        int ret;
@@@ -3020,7 -2885,6 +2886,7 @@@ int i2c_slave_unregister(struct i2c_cli
        return ret;
  }
  EXPORT_SYMBOL_GPL(i2c_slave_unregister);
 +#endif
  
  MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>");
  MODULE_DESCRIPTION("I2C-Bus main module");
diff --combined include/linux/i2c.h
@@@ -130,8 -130,6 +130,6 @@@ extern s32 i2c_smbus_write_i2c_block_da
   * @probe: Callback for device binding
   * @remove: Callback for device unbinding
   * @shutdown: Callback for device shutdown
-  * @suspend: Callback for device suspend
-  * @resume: Callback for device resume
   * @alert: Alert callback, for example for the SMBus alert protocol
   * @command: Callback for bus-wide signaling (optional)
   * @driver: Device driver model driver
@@@ -174,8 -172,6 +172,6 @@@ struct i2c_driver 
  
        /* driver model interfaces that don't relate to enumeration  */
        void (*shutdown)(struct i2c_client *);
-       int (*suspend)(struct i2c_client *, pm_message_t mesg);
-       int (*resume)(struct i2c_client *);
  
        /* Alert callback, for example for the SMBus alert protocol.
         * The format and meaning of the data value depends on the protocol.
@@@ -228,9 -224,7 +224,9 @@@ struct i2c_client 
        struct device dev;              /* the device structure         */
        int irq;                        /* irq issued by device         */
        struct list_head detected;
 +#if IS_ENABLED(CONFIG_I2C_SLAVE)
        i2c_slave_cb_t slave_cb;        /* callback for slave mode      */
 +#endif
  };
  #define to_i2c_client(d) container_of(d, struct i2c_client, dev)
  
@@@ -255,7 -249,6 +251,7 @@@ static inline void i2c_set_clientdata(s
  
  /* I2C slave support */
  
 +#if IS_ENABLED(CONFIG_I2C_SLAVE)
  enum i2c_slave_event {
        I2C_SLAVE_REQ_READ_START,
        I2C_SLAVE_REQ_READ_END,
@@@ -272,7 -265,6 +268,7 @@@ static inline int i2c_slave_event(struc
  {
        return client->slave_cb(client, event, val);
  }
 +#endif
  
  /**
   * struct i2c_board_info - template for device creation
@@@ -408,10 -400,8 +404,10 @@@ struct i2c_algorithm 
        /* To determine what the adapter supports */
        u32 (*functionality) (struct i2c_adapter *);
  
 +#if IS_ENABLED(CONFIG_I2C_SLAVE)
        int (*reg_slave)(struct i2c_client *client);
        int (*unreg_slave)(struct i2c_client *client);
 +#endif
  };
  
  /**