Commit 13509c3a authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c changes from Wolfram Sang:
 - new drivers for exynos5, bcm kona, and st micro
 - bigger overhauls for drivers mxs and rcar
 - typical driver bugfixes, cleanups, improvements
 - got rid of the superfluous 'driver' member in i2c_client struct This
   touches a few drivers in other subsystems.  All acked.

* 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (38 commits)
  i2c: bcm-kona: fix error return code in bcm_kona_i2c_probe()
  i2c: i2c-eg20t: do not print error message in syslog if no ACK received
  i2c: bcm-kona: Introduce Broadcom I2C Driver
  i2c: cbus-gpio: Fix device tree binding
  i2c: wmt: add missing clk_disable_unprepare() on error
  i2c: designware: add new ACPI IDs
  i2c: i801: Add Device IDs for Intel Wildcat Point-LP PCH
  i2c: exynos5: Remove incorrect clk_disable_unprepare
  i2c: i2c-st: Add ST I2C controller
  i2c: exynos5: add High Speed I2C controller driver
  i2c: rcar: fixup rcar type naming
  i2c: scmi: remove some bogus NULL checks
  i2c: sh_mobile & rcar: Enable the driver on all ARM platforms
  i2c: sh_mobile: Convert to clk_prepare/unprepare
  i2c: mux: gpio: use reg value for i2c_add_mux_adapter
  i2c: mux: gpio: use gpio_set_value_cansleep()
  i2c: Include linux/of.h header
  i2c: mxs: Fix PIO mode on i.MX23
  i2c: mxs: Rework the PIO mode operation
  i2c: mxs: distinguish i.MX23 and i.MX28 based I2C controller
  ...
parents 1ea406c0 cfff1f4a
Broadcom Kona Family I2C
=========================
This I2C controller is used in the following Broadcom SoCs:
BCM11130
BCM11140
BCM11351
BCM28145
BCM28155
Required Properties
-------------------
- compatible: "brcm,bcm11351-i2c", "brcm,kona-i2c"
- reg: Physical base address and length of controller registers
- interrupts: The interrupt number used by the controller
- clocks: clock specifier for the kona i2c external clock
- clock-frequency: The I2C bus frequency in Hz
- #address-cells: Should be <1>
- #size-cells: Should be <0>
Refer to clocks/clock-bindings.txt for generic clock consumer
properties.
Example:
i2c@3e016000 {
compatible = "brcm,bcm11351-i2c","brcm,kona-i2c";
reg = <0x3e016000 0x80>;
interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&bsc1_clk>;
clock-frequency = <400000>;
#address-cells = <1>;
#size-cells = <0>;
};
* Samsung's High Speed I2C controller
The Samsung's High Speed I2C controller is used to interface with I2C devices
at various speeds ranging from 100khz to 3.4Mhz.
Required properties:
- compatible: value should be.
-> "samsung,exynos5-hsi2c", for i2c compatible with exynos5 hsi2c.
- reg: physical base address of the controller and length of memory mapped
region.
- interrupts: interrupt number to the cpu.
- #address-cells: always 1 (for i2c addresses)
- #size-cells: always 0
- Pinctrl:
- pinctrl-0: Pin control group to be used for this controller.
- pinctrl-names: Should contain only one value - "default".
Optional properties:
- clock-frequency: Desired operating frequency in Hz of the bus.
-> If not specified, the bus operates in fast-speed mode at
at 100khz.
-> If specified, the bus operates in high-speed mode only if the
clock-frequency is >= 1Mhz.
Example:
hsi2c@12ca0000 {
compatible = "samsung,exynos5-hsi2c";
reg = <0x12ca0000 0x100>;
interrupts = <56>;
clock-frequency = <100000>;
pinctrl-0 = <&i2c4_bus>;
pinctrl-names = "default";
#address-cells = <1>;
#size-cells = <0>;
s2mps11_pmic@66 {
compatible = "samsung,s2mps11-pmic";
reg = <0x66>;
};
};
I2C for R-Car platforms
Required properties:
- compatible: Must be one of
"renesas,i2c-rcar"
"renesas,i2c-r8a7778"
"renesas,i2c-r8a7779"
"renesas,i2c-r8a7790"
- reg: physical base address of the controller and length of memory mapped
region.
- interrupts: interrupt specifier.
Optional properties:
- clock-frequency: desired I2C bus clock frequency in Hz. The absence of this
propoerty indicates the default frequency 100 kHz.
Examples :
i2c0: i2c@e6500000 {
compatible = "renesas,i2c-rcar-h2";
reg = <0 0xe6500000 0 0x428>;
interrupts = <0 174 0x4>;
};
ST SSC binding, for I2C mode operation
Required properties :
- compatible : Must be "st,comms-ssc-i2c" or "st,comms-ssc4-i2c"
- reg : Offset and length of the register set for the device
- interrupts : the interrupt specifier
- clock-names: Must contain "ssc".
- clocks: Must contain an entry for each name in clock-names. See the common
clock bindings.
- A pinctrl state named "default" must be defined to set pins in mode of
operation for I2C transfer.
Optional properties :
- clock-frequency : Desired I2C bus clock frequency in Hz. If not specified,
the default 100 kHz frequency will be used. As only Normal and Fast modes
are supported, possible values are 100000 and 400000.
- st,i2c-min-scl-pulse-width-us : The minimum valid SCL pulse width that is
allowed through the deglitch circuit. In units of us.
- st,i2c-min-sda-pulse-width-us : The minimum valid SDA pulse width that is
allowed through the deglitch circuit. In units of us.
- A pinctrl state named "idle" could be defined to set pins in idle state
when I2C instance is not performing a transfer.
- A pinctrl state named "sleep" could be defined to set pins in sleep state
when driver enters in suspend.
Example :
i2c0: i2c@fed40000 {
compatible = "st,comms-ssc4-i2c";
reg = <0xfed40000 0x110>;
interrupts = <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&CLK_S_ICN_REG_0>;
clock-names = "ssc";
clock-frequency = <400000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c0_default>;
st,i2c-min-scl-pulse-width-us = <0>;
st,i2c-min-sda-pulse-width-us = <5>;
};
...@@ -25,6 +25,7 @@ Supported adapters: ...@@ -25,6 +25,7 @@ Supported adapters:
* Intel Avoton (SOC) * Intel Avoton (SOC)
* Intel Wellsburg (PCH) * Intel Wellsburg (PCH)
* Intel Coleto Creek (PCH) * Intel Coleto Creek (PCH)
* Intel Wildcat Point-LP (PCH)
Datasheets: Publicly available at the Intel website Datasheets: Publicly available at the Intel website
On Intel Patsburg and later chipsets, both the normal host SMBus controller On Intel Patsburg and later chipsets, both the normal host SMBus controller
......
...@@ -1425,7 +1425,7 @@ M: Wolfram Sang <wsa@the-dreams.de> ...@@ -1425,7 +1425,7 @@ M: Wolfram Sang <wsa@the-dreams.de>
L: linux-i2c@vger.kernel.org L: linux-i2c@vger.kernel.org
S: Maintained S: Maintained
F: drivers/misc/eeprom/at24.c F: drivers/misc/eeprom/at24.c
F: include/linux/i2c/at24.h F: include/linux/platform_data/at24.h
ATA OVER ETHERNET (AOE) DRIVER ATA OVER ETHERNET (AOE) DRIVER
M: "Ed L. Cashin" <ecashin@coraid.com> M: "Ed L. Cashin" <ecashin@coraid.com>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/at73c213.h> #include <linux/spi/at73c213.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/gpio_keys.h> #include <linux/gpio_keys.h>
#include <linux/input.h> #include <linux/input.h>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/ads7846.h> #include <linux/spi/ads7846.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/gpio_keys.h> #include <linux/gpio_keys.h>
#include <linux/input.h> #include <linux/input.h>
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/pcf857x.h> #include <linux/i2c/pcf857x.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/platform_data/pca953x.h> #include <linux/platform_data/pca953x.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/input/tps6507x-ts.h> #include <linux/input/tps6507x-ts.h>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/pcf857x.h> #include <linux/i2c/pcf857x.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h> #include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/i2c/pcf857x.h> #include <linux/i2c/pcf857x.h>
#include <media/tvp514x.h> #include <media/tvp514x.h>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/flash.h> #include <linux/spi/flash.h>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h> #include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/eeprom.h> #include <linux/spi/eeprom.h>
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <linux/smsc911x.h> #include <linux/smsc911x.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/irq.h> #include <linux/irq.h>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
*/ */
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/mtd/plat-ram.h> #include <linux/mtd/plat-ram.h>
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/usb/otg.h> #include <linux/usb/otg.h>
#include <linux/usb/ulpi.h> #include <linux/usb/ulpi.h>
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <asm/mach/time.h> #include <asm/mach/time.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/mfd/mc13xxx.h> #include <linux/mfd/mc13xxx.h>
#include "common.h" #include "common.h"
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <linux/spi/flash.h> #include <linux/spi/flash.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
#include <mach/kirkwood.h> #include <mach/kirkwood.h>
......
...@@ -300,7 +300,7 @@ static struct omap_lcd_config osk_lcd_config __initdata = { ...@@ -300,7 +300,7 @@ static struct omap_lcd_config osk_lcd_config __initdata = {
#ifdef CONFIG_OMAP_OSK_MISTRAL #ifdef CONFIG_OMAP_OSK_MISTRAL
#include <linux/input.h> #include <linux/input.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/ads7846.h> #include <linux/spi/ads7846.h>
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/platform_data/gpio-omap.h> #include <linux/platform_data/gpio-omap.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/i2c/twl.h> #include <linux/i2c/twl.h>
#include <linux/regulator/fixed.h> #include <linux/regulator/fixed.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/clk.h> #include <linux/clk.h>
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/smsc911x.h> #include <linux/smsc911x.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/usb/phy.h> #include <linux/usb/phy.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <linux/i2c/pxa-i2c.h> #include <linux/i2c/pxa-i2c.h>
#include <linux/i2c/pcf857x.h> #include <linux/i2c/pcf857x.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/smc91x.h> #include <linux/smc91x.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/leds.h> #include <linux/leds.h>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/dm9000.h> #include <linux/dm9000.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/gpio_keys.h> #include <linux/gpio_keys.h>
#include <linux/i2c.h> #include <linux/i2c.h>
......
...@@ -67,12 +67,12 @@ int drm_i2c_encoder_init(struct drm_device *dev, ...@@ -67,12 +67,12 @@ int drm_i2c_encoder_init(struct drm_device *dev,
goto fail; goto fail;
} }
if (!client->driver) { if (!client->dev.driver) {
err = -ENODEV; err = -ENODEV;
goto fail_unregister; goto fail_unregister;
} }
module = client->driver->driver.owner; module = client->dev.driver->owner;
if (!try_module_get(module)) { if (!try_module_get(module)) {
err = -ENODEV; err = -ENODEV;
goto fail_unregister; goto fail_unregister;
...@@ -80,7 +80,7 @@ int drm_i2c_encoder_init(struct drm_device *dev, ...@@ -80,7 +80,7 @@ int drm_i2c_encoder_init(struct drm_device *dev,
encoder->bus_priv = client; encoder->bus_priv = client;
encoder_drv = to_drm_i2c_encoder_driver(client->driver); encoder_drv = to_drm_i2c_encoder_driver(to_i2c_driver(client->dev.driver));
err = encoder_drv->encoder_init(client, dev, encoder); err = encoder_drv->encoder_init(client, dev, encoder);
if (err) if (err)
...@@ -111,7 +111,7 @@ void drm_i2c_encoder_destroy(struct drm_encoder *drm_encoder) ...@@ -111,7 +111,7 @@ void drm_i2c_encoder_destroy(struct drm_encoder *drm_encoder)
{ {
struct drm_encoder_slave *encoder = to_encoder_slave(drm_encoder); struct drm_encoder_slave *encoder = to_encoder_slave(drm_encoder);
struct i2c_client *client = drm_i2c_encoder_get_client(drm_encoder); struct i2c_client *client = drm_i2c_encoder_get_client(drm_encoder);
struct module *module = client->driver->driver.owner; struct module *module = client->dev.driver->owner;
i2c_unregister_device(client); i2c_unregister_device(client);
encoder->bus_priv = NULL; encoder->bus_priv = NULL;
......
...@@ -41,7 +41,8 @@ probe_monitoring_device(struct nouveau_i2c_port *i2c, ...@@ -41,7 +41,8 @@ probe_monitoring_device(struct nouveau_i2c_port *i2c,
if (!client) if (!client)
return false; return false;
if (!client->driver || client->driver->detect(client, info)) { if (!client->dev.driver ||
to_i2c_driver(client->dev.driver)->detect(client, info)) {
i2c_unregister_device(client); i2c_unregister_device(client);
return false; return false;
} }
......
...@@ -109,6 +109,7 @@ config I2C_I801 ...@@ -109,6 +109,7 @@ config I2C_I801
Avoton (SOC) Avoton (SOC)
Wellsburg (PCH) Wellsburg (PCH)
Coleto Creek (PCH) Coleto Creek (PCH)
Wildcat Point-LP (PCH)
This driver can also be built as a module. If so, the module This driver can also be built as a module. If so, the module
will be called i2c-i801. will be called i2c-i801.
...@@ -345,6 +346,16 @@ config I2C_BCM2835 ...@@ -345,6 +346,16 @@ config I2C_BCM2835
This support is also available as a module. If so, the module This support is also available as a module. If so, the module
will be called i2c-bcm2835. will be called i2c-bcm2835.
config I2C_BCM_KONA
tristate "BCM Kona I2C adapter"
depends on ARCH_BCM_MOBILE
default y
help
If you say yes to this option, support will be included for the
I2C interface on the Broadcom Kona family of processors.
If you do not need KONA I2C inteface, say N.
config I2C_BLACKFIN_TWI config I2C_BLACKFIN_TWI
tristate "Blackfin TWI I2C support" tristate "Blackfin TWI I2C support"
depends on BLACKFIN depends on BLACKFIN
...@@ -436,6 +447,13 @@ config I2C_EG20T ...@@ -436,6 +447,13 @@ config I2C_EG20T
ML7213/ML7223/ML7831 is companion chip for Intel Atom E6xx series. ML7213/ML7223/ML7831 is companion chip for Intel Atom E6xx series.
ML7213/ML7223/ML7831 is completely compatible for Intel EG20T PCH. ML7213/ML7223/ML7831 is completely compatible for Intel EG20T PCH.
config I2C_EXYNOS5
tristate "Exynos5 high-speed I2C driver"
depends on ARCH_EXYNOS5 && OF
help
Say Y here to include support for high-speed I2C controller in the
Exynos5 based Samsung SoCs.
config I2C_GPIO config I2C_GPIO
tristate "GPIO-based bitbanging I2C" tristate "GPIO-based bitbanging I2C"
depends on GPIOLIB depends on GPIOLIB
...@@ -665,7 +683,7 @@ config I2C_SH7760 ...@@ -665,7 +683,7 @@ config I2C_SH7760
config I2C_SH_MOBILE config I2C_SH_MOBILE
tristate "SuperH Mobile I2C Controller" tristate "SuperH Mobile I2C Controller"
depends on SUPERH || ARCH_SHMOBILE depends on SUPERH || ARM || COMPILE_TEST
help help
If you say yes to this option, support will be included for the If you say yes to this option, support will be included for the
built-in I2C interface on the Renesas SH-Mobile processor. built-in I2C interface on the Renesas SH-Mobile processor.
...@@ -695,6 +713,16 @@ config I2C_SIRF ...@@ -695,6 +713,16 @@ config I2C_SIRF
This driver can also be built as a module. If so, the module This driver can also be built as a module. If so, the module
will be called i2c-sirf. will be called i2c-sirf.
config I2C_ST
tristate "STMicroelectronics SSC I2C support"
depends on ARCH_STI
help
Enable this option to add support for STMicroelectronics SoCs
hardware SSC (Synchronous Serial Controller) as an I2C controller.
This driver can also be built as module. If so, the module
will be called i2c-st.
config I2C_STU300 config I2C_STU300
tristate "ST Microelectronics DDC I2C interface" tristate "ST Microelectronics DDC I2C interface"
depends on MACH_U300 depends on MACH_U300
...@@ -768,7 +796,7 @@ config I2C_XLR ...@@ -768,7 +796,7 @@ config I2C_XLR
config I2C_RCAR config I2C_RCAR
tristate "Renesas R-Car I2C Controller" tristate "Renesas R-Car I2C Controller"
depends on ARCH_SHMOBILE && I2C depends on ARM || COMPILE_TEST
help help
If you say yes to this option, support will be included for the If you say yes to this option, support will be included for the
R-Car I2C controller. R-Car I2C controller.
......
...@@ -42,6 +42,7 @@ i2c-designware-platform-objs := i2c-designware-platdrv.o ...@@ -42,6 +42,7 @@ i2c-designware-platform-objs := i2c-designware-platdrv.o
obj-$(CONFIG_I2C_DESIGNWARE_PCI) += i2c-designware-pci.o obj-$(CONFIG_I2C_DESIGNWARE_PCI) += i2c-designware-pci.o
i2c-designware-pci-objs := i2c-designware-pcidrv.o i2c-designware-pci-objs := i2c-designware-pcidrv.o
obj-$(CONFIG_I2C_EG20T) += i2c-eg20t.o obj-$(CONFIG_I2C_EG20T) += i2c-eg20t.o
obj-$(CONFIG_I2C_EXYNOS5) += i2c-exynos5.o
obj-$(CONFIG_I2C_GPIO) += i2c-gpio.o obj-$(CONFIG_I2C_GPIO) += i2c-gpio.o
obj-$(CONFIG_I2C_HIGHLANDER) += i2c-highlander.o obj-$(CONFIG_I2C_HIGHLANDER) += i2c-highlander.o
obj-$(CONFIG_I2C_IBM_IIC) += i2c-ibm_iic.o obj-$(CONFIG_I2C_IBM_IIC) += i2c-ibm_iic.o
...@@ -68,6 +69,7 @@ obj-$(CONFIG_I2C_SH7760) += i2c-sh7760.o ...@@ -68,6 +69,7 @@ obj-$(CONFIG_I2C_SH7760) += i2c-sh7760.o
obj-$(CONFIG_I2C_SH_MOBILE) += i2c-sh_mobile.o obj-$(CONFIG_I2C_SH_MOBILE) += i2c-sh_mobile.o
obj-$(CONFIG_I2C_SIMTEC) += i2c-simtec.o obj-$(CONFIG_I2C_SIMTEC) += i2c-simtec.o
obj-$(CONFIG_I2C_SIRF) += i2c-sirf.o obj-$(CONFIG_I2C_SIRF) += i2c-sirf.o
obj-$(CONFIG_I2C_ST) += i2c-st.o
obj-$(CONFIG_I2C_STU300) += i2c-stu300.o obj-$(CONFIG_I2C_STU300) += i2c-stu300.o
obj-$(CONFIG_I2C_TEGRA) += i2c-tegra.o obj-$(CONFIG_I2C_TEGRA) += i2c-tegra.o
obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o
...@@ -87,6 +89,7 @@ obj-$(CONFIG_I2C_VIPERBOARD) += i2c-viperboard.o ...@@ -87,6 +89,7 @@ obj-$(CONFIG_I2C_VIPERBOARD) += i2c-viperboard.o
# Other I2C/SMBus bus drivers # Other I2C/SMBus bus drivers
obj-$(CONFIG_I2C_ACORN) += i2c-acorn.o obj-$(CONFIG_I2C_ACORN) += i2c-acorn.o
obj-$(CONFIG_I2C_BCM_KONA) += i2c-bcm-kona.o
obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o
obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o
obj-$(CONFIG_I2C_SIBYTE) += i2c-sibyte.o obj-$(CONFIG_I2C_SIBYTE) += i2c-sibyte.o
......
This diff is collapsed.
...@@ -675,7 +675,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev) ...@@ -675,7 +675,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
p_adap->retries = 3; p_adap->retries = 3;
rc = peripheral_request_list( rc = peripheral_request_list(
(unsigned short *)dev_get_platdata(&pdev->dev), dev_get_platdata(&pdev->dev),
"i2c-bfin-twi"); "i2c-bfin-twi");
if (rc) { if (rc) {
dev_err(&pdev->dev, "Can't setup pin mux!\n"); dev_err(&pdev->dev, "Can't setup pin mux!\n");
...@@ -723,7 +723,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev) ...@@ -723,7 +723,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
free_irq(iface->irq, iface); free_irq(iface->irq, iface);
out_error_req_irq: out_error_req_irq:
out_error_no_irq: out_error_no_irq:
peripheral_free_list((unsigned short *)dev_get_platdata(&pdev->dev)); peripheral_free_list(dev_get_platdata(&pdev->dev));
out_error_pin_mux: out_error_pin_mux:
iounmap(iface->regs_base); iounmap(iface->regs_base);
out_error_ioremap: out_error_ioremap:
...@@ -739,7 +739,7 @@ static int i2c_bfin_twi_remove(struct platform_device *pdev) ...@@ -739,7 +739,7 @@ static int i2c_bfin_twi_remove(struct platform_device *pdev)
i2c_del_adapter(&(iface->adap)); i2c_del_adapter(&(iface->adap));
free_irq(iface->irq, iface); free_irq(iface->irq, iface);
peripheral_free_list((unsigned short *)dev_get_platdata(&pdev->dev)); peripheral_free_list(dev_get_platdata(&pdev->dev));
iounmap(iface->regs_base); iounmap(iface->regs_base);
kfree(iface); kfree(iface);
......
...@@ -246,6 +246,7 @@ static int cbus_i2c_probe(struct platform_device *pdev) ...@@ -246,6 +246,7 @@ static int cbus_i2c_probe(struct platform_device *pdev)
adapter->owner = THIS_MODULE; adapter->owner = THIS_MODULE;
adapter->class = I2C_CLASS_HWMON; adapter->class = I2C_CLASS_HWMON;
adapter->dev.parent = &pdev->dev; adapter->dev.parent = &pdev->dev;
adapter->dev.of_node = pdev->dev.of_node;
adapter->nr = pdev->id; adapter->nr = pdev->id;
adapter->timeout = HZ; adapter->timeout = HZ;
adapter->algo = &cbus_i2c_algo; adapter->algo = &cbus_i2c_algo;
...@@ -289,6 +290,7 @@ static struct platform_driver cbus_i2c_driver = { ...@@ -289,6 +290,7 @@ static struct platform_driver cbus_i2c_driver = {
.driver = { .driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "i2c-cbus-gpio", .name = "i2c-cbus-gpio",
.of_match_table = of_match_ptr(i2c_cbus_dt_ids),
}, },
}; };
module_platform_driver(cbus_i2c_driver); module_platform_driver(cbus_i2c_driver);
......
...@@ -795,7 +795,7 @@ static struct platform_driver davinci_i2c_driver = { ...@@ -795,7 +795,7 @@ static struct platform_driver davinci_i2c_driver = {
.name = "i2c_davinci", .name = "i2c_davinci",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = davinci_i2c_pm_ops, .pm = davinci_i2c_pm_ops,
.of_match_table = of_match_ptr(davinci_i2c_of_match), .of_match_table = davinci_i2c_of_match,
}, },
}; };
......
...@@ -103,6 +103,8 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev) ...@@ -103,6 +103,8 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev)
static const struct acpi_device_id dw_i2c_acpi_match[] = { static const struct acpi_device_id dw_i2c_acpi_match[] = {
{ "INT33C2", 0 }, { "INT33C2", 0 },
{ "INT33C3", 0 }, { "INT33C3", 0 },
{ "INT3432", 0 },
{ "INT3433", 0 },
{ "80860F41", 0 }, { "80860F41", 0 },
{ } { }
}; };
......
...@@ -311,24 +311,6 @@ static void pch_i2c_start(struct i2c_algo_pch_data *adap) ...@@ -311,24 +311,6 @@ static void pch_i2c_start(struct i2c_algo_pch_data *adap)
pch_setbit(adap->pch_base_address, PCH_I2CCTL, PCH_START); pch_setbit(adap->pch_base_address, PCH_I2CCTL, PCH_START);
} }
/**
* pch_i2c_getack() - to confirm ACK/NACK
* @adap: Pointer to struct i2c_algo_pch_data.
*/
static s32 pch_i2c_getack(struct i2c_algo_pch_data *adap)
{
u32 reg_val;
void __iomem *p = adap->pch_base_address;
reg_val = ioread32(p + PCH_I2CSR) & PCH_GETACK;
if (reg_val != 0) {
pch_err(adap, "return%d\n", -EPROTO);
return -EPROTO;
}
return 0;
}
/** /**
* pch_i2c_stop() - generate stop condition in normal mode. * pch_i2c_stop() - generate stop condition in normal mode.
* @adap: Pointer to struct i2c_algo_pch_data. * @adap: Pointer to struct i2c_algo_pch_data.
...@@ -344,6 +326,7 @@ static void pch_i2c_stop(struct i2c_algo_pch_data *adap) ...@@ -344,6 +326,7 @@ static void pch_i2c_stop(struct i2c_algo_pch_data *adap)
static int pch_i2c_wait_for_check_xfer(struct i2c_algo_pch_data *adap) static int pch_i2c_wait_for_check_xfer(struct i2c_algo_pch_data *adap)
{ {
long ret; long ret;
void __iomem *p = adap->pch_base_address;
ret = wait_event_timeout(pch_event, ret = wait_event_timeout(pch_event,
(adap->pch_event_flag != 0), msecs_to_jiffies(1000)); (adap->pch_event_flag != 0), msecs_to_jiffies(1000));
...@@ -366,10 +349,9 @@ static int pch_i2c_wait_for_check_xfer(struct i2c_algo_pch_data *adap) ...@@ -366,10 +349,9 @@ static int pch_i2c_wait_for_check_xfer(struct i2c_algo_pch_data *adap)
adap->pch_event_flag = 0; adap->pch_event_flag = 0;
if (pch_i2c_getack(adap)) { if (ioread32(p + PCH_I2CSR) & PCH_GETACK) {
pch_dbg(adap, "Receive NACK for slave address" pch_dbg(adap, "Receive NACK for slave address setting\n");
"setting\n"); return -ENXIO;
return -EIO;
} }
return 0; return 0;
......
This diff is collapsed.
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/of.h>
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
struct i2c_gpio_private_data { struct i2c_gpio_private_data {
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
Wellsburg (PCH) MS 0x8d7e 32 hard yes yes yes Wellsburg (PCH) MS 0x8d7e 32 hard yes yes yes
Wellsburg (PCH) MS 0x8d7f 32 hard yes yes yes Wellsburg (PCH) MS 0x8d7f 32 hard yes yes yes
Coleto Creek (PCH) 0x23b0 32 hard yes yes yes Coleto Creek (PCH) 0x23b0 32 hard yes yes yes
Wildcat Point-LP (PCH) 0x9ca2 32 hard yes yes yes
Features supported by this driver: Features supported by this driver:
Software PEC no Software PEC no
...@@ -177,6 +178,7 @@ ...@@ -177,6 +178,7 @@
#define PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS_MS1 0x8d7e #define PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS_MS1 0x8d7e
#define PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS_MS2 0x8d7f #define PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS_MS2 0x8d7f
#define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_SMBUS 0x9c22 #define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_SMBUS 0x9c22
#define PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_SMBUS 0x9ca2
struct i801_mux_config { struct i801_mux_config {
char *gpio_chip; char *gpio_chip;
...@@ -819,6 +821,7 @@ static DEFINE_PCI_DEVICE_TABLE(i801_ids) = { ...@@ -819,6 +821,7 @@ static DEFINE_PCI_DEVICE_TABLE(i801_ids) = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS_MS1) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS_MS1) },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS_MS2) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WELLSBURG_SMBUS_MS2) },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_COLETOCREEK_SMBUS) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_COLETOCREEK_SMBUS) },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_SMBUS) },
{ 0, } { 0, }
}; };
......
...@@ -911,7 +911,7 @@ static struct platform_driver mv64xxx_i2c_driver = { ...@@ -911,7 +911,7 @@ static struct platform_driver mv64xxx_i2c_driver = {
.driver = { .driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = MV64XXX_I2C_CTLR_NAME, .name = MV64XXX_I2C_CTLR_NAME,
.of_match_table = of_match_ptr(mv64xxx_i2c_of_match_table), .of_match_table = mv64xxx_i2c_of_match_table,
}, },
}; };
......
This diff is collapsed.
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/of.h>
#define I2C_PNX_TIMEOUT_DEFAULT 10 /* msec */ #define I2C_PNX_TIMEOUT_DEFAULT 10 /* msec */
#define I2C_PNX_SPEED_KHZ_DEFAULT 100 #define I2C_PNX_SPEED_KHZ_DEFAULT 100
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/i2c/i2c-rcar.h> #include <linux/i2c/i2c-rcar.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_device.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -102,8 +103,8 @@ enum { ...@@ -102,8 +103,8 @@ enum {
#define ID_NACK (1 << 4) #define ID_NACK (1 << 4)
enum rcar_i2c_type { enum rcar_i2c_type {
I2C_RCAR_H1, I2C_RCAR_GEN1,
I2C_RCAR_H2, I2C_RCAR_GEN2,
}; };
struct rcar_i2c_priv { struct rcar_i2c_priv {
...@@ -226,22 +227,23 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv, ...@@ -226,22 +227,23 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv,
u32 bus_speed, u32 bus_speed,
struct device *dev) struct device *dev)
{ {
struct clk *clkp = clk_get(NULL, "peripheral_clk"); struct clk *clkp = clk_get(dev, NULL);
u32 scgd, cdf; u32 scgd, cdf;
u32 round, ick; u32 round, ick;
u32 scl; u32 scl;
u32 cdf_width; u32 cdf_width;
unsigned long rate;
if (!clkp) { if (IS_ERR(clkp)) {
dev_err(dev, "there is no peripheral_clk\n"); dev_err(dev, "couldn't get clock\n");
return -EIO; return PTR_ERR(clkp);
} }
switch (priv->devtype) { switch (priv->devtype) {
case I2C_RCAR_H1: case I2C_RCAR_GEN1:
cdf_width = 2; cdf_width = 2;
break; break;
case I2C_RCAR_H2: case I2C_RCAR_GEN2:
cdf_width = 3; cdf_width = 3;
break; break;
default: default:
...@@ -264,15 +266,14 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv, ...@@ -264,15 +266,14 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv,
* clkp : peripheral_clk * clkp : peripheral_clk
* F[] : integer up-valuation * F[] : integer up-valuation
*/ */
for (cdf = 0; cdf < (1 << cdf_width); cdf++) { rate = clk_get_rate(clkp);
ick = clk_get_rate(clkp) / (1 + cdf); cdf = rate / 20000000;
if (ick < 20000000) if (cdf >= 1 << cdf_width) {
goto ick_find; dev_err(dev, "Input clock %lu too high\n", rate);
return -EIO;
} }
dev_err(dev, "there is no best CDF\n"); ick = rate / (cdf + 1);
return -EIO;
ick_find:
/* /*
* it is impossible to calculate large scale * it is impossible to calculate large scale
* number on u32. separate it * number on u32. separate it
...@@ -290,6 +291,12 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv, ...@@ -290,6 +291,12 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv,
* *
* Calculation result (= SCL) should be less than * Calculation result (= SCL) should be less than
* bus_speed for hardware safety * bus_speed for hardware safety
*
* We could use something along the lines of
* div = ick / (bus_speed + 1) + 1;
* scgd = (div - 20 - round + 7) / 8;
* scl = ick / (20 + (scgd * 8) + round);
* (not fully verified) but that would get pretty involved
*/ */
for (scgd = 0; scgd < 0x40; scgd++) { for (scgd = 0; scgd < 0x40; scgd++) {
scl = ick / (20 + (scgd * 8) + round); scl = ick / (20 + (scgd * 8) + round);
...@@ -306,7 +313,7 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv, ...@@ -306,7 +313,7 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv,
/* /*
* keep icccr value * keep icccr value
*/ */
priv->icccr = (scgd << (cdf_width) | cdf); priv->icccr = scgd << cdf_width | cdf;
return 0; return 0;
} }
...@@ -632,6 +639,15 @@ static const struct i2c_algorithm rcar_i2c_algo = { ...@@ -632,6 +639,15 @@ static const struct i2c_algorithm rcar_i2c_algo = {
.functionality = rcar_i2c_func, .functionality = rcar_i2c_func,
}; };
static const struct of_device_id rcar_i2c_dt_ids[] = {
{ .compatible = "renesas,i2c-rcar", .data = (void *)I2C_RCAR_GEN1 },
{ .compatible = "renesas,i2c-r8a7778", .data = (void *)I2C_RCAR_GEN1 },
{ .compatible = "renesas,i2c-r8a7779", .data = (void *)I2C_RCAR_GEN1 },
{ .compatible = "renesas,i2c-r8a7790", .data = (void *)I2C_RCAR_GEN2 },
{},
};
MODULE_DEVICE_TABLE(of, rcar_i2c_dt_ids);
static int rcar_i2c_probe(struct platform_device *pdev) static int rcar_i2c_probe(struct platform_device *pdev)
{ {
struct i2c_rcar_platform_data *pdata = dev_get_platdata(&pdev->dev); struct i2c_rcar_platform_data *pdata = dev_get_platdata(&pdev->dev);
...@@ -649,10 +665,15 @@ static int rcar_i2c_probe(struct platform_device *pdev) ...@@ -649,10 +665,15 @@ static int rcar_i2c_probe(struct platform_device *pdev)
} }
bus_speed = 100000; /* default 100 kHz */ bus_speed = 100000; /* default 100 kHz */
if (pdata && pdata->bus_speed) ret = of_property_read_u32(dev->of_node, "clock-frequency", &bus_speed);
if (ret < 0 && pdata && pdata->bus_speed)
bus_speed = pdata->bus_speed; bus_speed = pdata->bus_speed;
priv->devtype = platform_get_device_id(pdev)->driver_data; if (pdev->dev.of_node)
priv->devtype = (long)of_match_device(rcar_i2c_dt_ids,
dev)->data;
else
priv->devtype = platform_get_device_id(pdev)->driver_data;
ret = rcar_i2c_clock_calculate(priv, bus_speed, dev); ret = rcar_i2c_clock_calculate(priv, bus_speed, dev);
if (ret < 0) if (ret < 0)
...@@ -673,6 +694,7 @@ static int rcar_i2c_probe(struct platform_device *pdev) ...@@ -673,6 +694,7 @@ static int rcar_i2c_probe(struct platform_device *pdev)
adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
adap->retries = 3; adap->retries = 3;
adap->dev.parent = dev; adap->dev.parent = dev;
adap->dev.of_node = dev->of_node;
i2c_set_adapdata(adap, priv); i2c_set_adapdata(adap, priv);
strlcpy(adap->name, pdev->name, sizeof(adap->name)); strlcpy(adap->name, pdev->name, sizeof(adap->name));
...@@ -709,9 +731,9 @@ static int rcar_i2c_remove(struct platform_device *pdev) ...@@ -709,9 +731,9 @@ static int rcar_i2c_remove(struct platform_device *pdev)
} }
static struct platform_device_id rcar_i2c_id_table[] = { static struct platform_device_id rcar_i2c_id_table[] = {
{ "i2c-rcar", I2C_RCAR_H1 }, { "i2c-rcar", I2C_RCAR_GEN1 },
{ "i2c-rcar_h1", I2C_RCAR_H1 }, { "i2c-rcar_gen1", I2C_RCAR_GEN1 },
{ "i2c-rcar_h2", I2C_RCAR_H2 }, { "i2c-rcar_gen2", I2C_RCAR_GEN2 },
{}, {},
}; };
MODULE_DEVICE_TABLE(platform, rcar_i2c_id_table); MODULE_DEVICE_TABLE(platform, rcar_i2c_id_table);
...@@ -720,6 +742,7 @@ static struct platform_driver rcar_i2c_driver = { ...@@ -720,6 +742,7 @@ static struct platform_driver rcar_i2c_driver = {
.driver = { .driver = {
.name = "i2c-rcar", .name = "i2c-rcar",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = rcar_i2c_dt_ids,
}, },
.probe = rcar_i2c_probe, .probe = rcar_i2c_probe,
.remove = rcar_i2c_remove, .remove = rcar_i2c_remove,
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/cpufreq.h> #include <linux/cpufreq.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/of.h>
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
......
...@@ -223,7 +223,7 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags, ...@@ -223,7 +223,7 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
goto out; goto out;
obj = pkg->package.elements + 1; obj = pkg->package.elements + 1;
if (obj == NULL || obj->type != ACPI_TYPE_INTEGER) { if (obj->type != ACPI_TYPE_INTEGER) {
ACPI_ERROR((AE_INFO, "Invalid argument type")); ACPI_ERROR((AE_INFO, "Invalid argument type"));
result = -EIO; result = -EIO;
goto out; goto out;
...@@ -235,7 +235,7 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags, ...@@ -235,7 +235,7 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
case I2C_SMBUS_BYTE: case I2C_SMBUS_BYTE:
case I2C_SMBUS_BYTE_DATA: case I2C_SMBUS_BYTE_DATA:
case I2C_SMBUS_WORD_DATA: case I2C_SMBUS_WORD_DATA:
if (obj == NULL || obj->type != ACPI_TYPE_INTEGER) { if (obj->type != ACPI_TYPE_INTEGER) {
ACPI_ERROR((AE_INFO, "Invalid argument type")); ACPI_ERROR((AE_INFO, "Invalid argument type"));
result = -EIO; result = -EIO;
goto out; goto out;
...@@ -246,7 +246,7 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags, ...@@ -246,7 +246,7 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
data->byte = obj->integer.value; data->byte = obj->integer.value;
break; break;
case I2C_SMBUS_BLOCK_DATA: case I2C_SMBUS_BLOCK_DATA:
if (obj == NULL || obj->type != ACPI_TYPE_BUFFER) { if (obj->type != ACPI_TYPE_BUFFER) {
ACPI_ERROR((AE_INFO, "Invalid argument type")); ACPI_ERROR((AE_INFO, "Invalid argument type"));
result = -EIO; result = -EIO;
goto out; goto out;
......
...@@ -235,7 +235,7 @@ static void sh_mobile_i2c_init(struct sh_mobile_i2c_data *pd) ...@@ -235,7 +235,7 @@ static void sh_mobile_i2c_init(struct sh_mobile_i2c_data *pd)
int offset; int offset;
/* Get clock rate after clock is enabled */ /* Get clock rate after clock is enabled */
clk_enable(pd->clk); clk_prepare_enable(pd->clk);
i2c_clk_khz = clk_get_rate(pd->clk) / 1000; i2c_clk_khz = clk_get_rate(pd->clk) / 1000;
i2c_clk_khz /= pd->clks_per_count; i2c_clk_khz /= pd->clks_per_count;
...@@ -270,14 +270,14 @@ static void sh_mobile_i2c_init(struct sh_mobile_i2c_data *pd) ...@@ -270,14 +270,14 @@ static void sh_mobile_i2c_init(struct sh_mobile_i2c_data *pd)
pd->icic &= ~ICIC_ICCHB8; pd->icic &= ~ICIC_ICCHB8;
out: out:
clk_disable(pd->clk); clk_disable_unprepare(pd->clk);
} }
static void activate_ch(struct sh_mobile_i2c_data *pd) static void activate_ch(struct sh_mobile_i2c_data *pd)
{ {
/* Wake up device and enable clock */ /* Wake up device and enable clock */
pm_runtime_get_sync(pd->dev); pm_runtime_get_sync(pd->dev);
clk_enable(pd->clk); clk_prepare_enable(pd->clk);
/* Enable channel and configure rx ack */ /* Enable channel and configure rx ack */
iic_set_clr(pd, ICCR, ICCR_ICE, 0); iic_set_clr(pd, ICCR, ICCR_ICE, 0);
...@@ -300,7 +300,7 @@ static void deactivate_ch(struct sh_mobile_i2c_data *pd) ...@@ -300,7 +300,7 @@ static void deactivate_ch(struct sh_mobile_i2c_data *pd)
iic_set_clr(pd, ICCR, 0, ICCR_ICE); iic_set_clr(pd, ICCR, 0, ICCR_ICE);
/* Disable clock and mark device as idle */ /* Disable clock and mark device as idle */
clk_disable(pd->clk); clk_disable_unprepare(pd->clk);
pm_runtime_put_sync(pd->dev); pm_runtime_put_sync(pd->dev);
} }
......
This diff is collapsed.
...@@ -349,6 +349,7 @@ static int wmt_i2c_reset_hardware(struct wmt_i2c_dev *i2c_dev) ...@@ -349,6 +349,7 @@ static int wmt_i2c_reset_hardware(struct wmt_i2c_dev *i2c_dev)
err = clk_set_rate(i2c_dev->clk, 20000000); err = clk_set_rate(i2c_dev->clk, 20000000);
if (err) { if (err) {
dev_err(i2c_dev->dev, "failed to set clock = 20Mhz\n"); dev_err(i2c_dev->dev, "failed to set clock = 20Mhz\n");
clk_disable_unprepare(i2c_dev->clk);
return err; return err;
} }
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <linux/i2c-xiic.h> #include <linux/i2c-xiic.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/of.h>
#define DRIVER_NAME "xiic-i2c" #define DRIVER_NAME "xiic-i2c"
...@@ -702,7 +703,7 @@ static int xiic_i2c_probe(struct platform_device *pdev) ...@@ -702,7 +703,7 @@ static int xiic_i2c_probe(struct platform_device *pdev)
if (irq < 0) if (irq < 0)
goto resource_missing; goto resource_missing;
pdata = (struct xiic_i2c_platform_data *)dev_get_platdata(&pdev->dev); pdata = dev_get_platdata(&pdev->dev);
i2c = kzalloc(sizeof(*i2c), GFP_KERNEL); i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
if (!i2c) if (!i2c)
......
...@@ -248,7 +248,7 @@ static int i2c_device_probe(struct device *dev) ...@@ -248,7 +248,7 @@ static int i2c_device_probe(struct device *dev)
driver = to_i2c_driver(dev->driver); driver = to_i2c_driver(dev->driver);
if (!driver->probe || !driver->id_table) if (!driver->probe || !driver->id_table)
return -ENODEV; return -ENODEV;
client->driver = driver;
if (!device_can_wakeup(&client->dev)) if (!device_can_wakeup(&client->dev))
device_init_wakeup(&client->dev, device_init_wakeup(&client->dev,
client->flags & I2C_CLIENT_WAKE); client->flags & I2C_CLIENT_WAKE);
...@@ -257,7 +257,6 @@ static int i2c_device_probe(struct device *dev) ...@@ -257,7 +257,6 @@ static int i2c_device_probe(struct device *dev)
acpi_dev_pm_attach(&client->dev, true); acpi_dev_pm_attach(&client->dev, true);
status = driver->probe(client, i2c_match_id(driver->id_table, client)); status = driver->probe(client, i2c_match_id(driver->id_table, client));
if (status) { if (status) {
client->driver = NULL;
i2c_set_clientdata(client, NULL); i2c_set_clientdata(client, NULL);
acpi_dev_pm_detach(&client->dev, true); acpi_dev_pm_detach(&client->dev, true);
} }
...@@ -281,10 +280,8 @@ static int i2c_device_remove(struct device *dev) ...@@ -281,10 +280,8 @@ static int i2c_device_remove(struct device *dev)
dev->driver = NULL; dev->driver = NULL;
status = 0; status = 0;
} }
if (status == 0) { if (status == 0)
client->driver = NULL;
i2c_set_clientdata(client, NULL); i2c_set_clientdata(client, NULL);
}
acpi_dev_pm_detach(&client->dev, true); acpi_dev_pm_detach(&client->dev, true);
return status; return status;
} }
...@@ -1614,9 +1611,14 @@ static int i2c_cmd(struct device *dev, void *_arg) ...@@ -1614,9 +1611,14 @@ static int i2c_cmd(struct device *dev, void *_arg)
{ {
struct i2c_client *client = i2c_verify_client(dev); struct i2c_client *client = i2c_verify_client(dev);
struct i2c_cmd_arg *arg = _arg; struct i2c_cmd_arg *arg = _arg;
struct i2c_driver *driver;
if (!client || !client->dev.driver)
return 0;
if (client && client->driver && client->driver->command) driver = to_i2c_driver(client->dev.driver);
client->driver->command(client, arg->cmd, arg->arg); if (driver->command)
driver->command(client, arg->cmd, arg->arg);
return 0; return 0;
} }
......
...@@ -102,8 +102,8 @@ static void return_i2c_dev(struct i2c_dev *i2c_dev) ...@@ -102,8 +102,8 @@ static void return_i2c_dev(struct i2c_dev *i2c_dev)
kfree(i2c_dev); kfree(i2c_dev);
} }
static ssize_t show_adapter_name(struct device *dev, static ssize_t name_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct i2c_dev *i2c_dev = i2c_dev_get_by_minor(MINOR(dev->devt)); struct i2c_dev *i2c_dev = i2c_dev_get_by_minor(MINOR(dev->devt));
...@@ -111,7 +111,13 @@ static ssize_t show_adapter_name(struct device *dev, ...@@ -111,7 +111,13 @@ static ssize_t show_adapter_name(struct device *dev,
return -ENODEV; return -ENODEV;
return sprintf(buf, "%s\n", i2c_dev->adap->name); return sprintf(buf, "%s\n", i2c_dev->adap->name);
} }
static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); static DEVICE_ATTR_RO(name);
static struct attribute *i2c_attrs[] = {
&dev_attr_name.attr,
NULL,
};
ATTRIBUTE_GROUPS(i2c);
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
...@@ -562,15 +568,10 @@ static int i2cdev_attach_adapter(struct device *dev, void *dummy) ...@@ -562,15 +568,10 @@ static int i2cdev_attach_adapter(struct device *dev, void *dummy)
res = PTR_ERR(i2c_dev->dev); res = PTR_ERR(i2c_dev->dev);
goto error; goto error;
} }
res = device_create_file(i2c_dev->dev, &dev_attr_name);
if (res)
goto error_destroy;
pr_debug("i2c-dev: adapter [%s] registered as minor %d\n", pr_debug("i2c-dev: adapter [%s] registered as minor %d\n",
adap->name, adap->nr); adap->name, adap->nr);
return 0; return 0;
error_destroy:
device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr));
error: error:
return_i2c_dev(i2c_dev); return_i2c_dev(i2c_dev);
return res; return res;
...@@ -589,7 +590,6 @@ static int i2cdev_detach_adapter(struct device *dev, void *dummy) ...@@ -589,7 +590,6 @@ static int i2cdev_detach_adapter(struct device *dev, void *dummy)
if (!i2c_dev) /* attach_adapter must have failed */ if (!i2c_dev) /* attach_adapter must have failed */
return 0; return 0;
device_remove_file(i2c_dev->dev, &dev_attr_name);
return_i2c_dev(i2c_dev); return_i2c_dev(i2c_dev);
device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr)); device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr));
...@@ -637,6 +637,7 @@ static int __init i2c_dev_init(void) ...@@ -637,6 +637,7 @@ static int __init i2c_dev_init(void)
res = PTR_ERR(i2c_dev_class); res = PTR_ERR(i2c_dev_class);
goto out_unreg_chrdev; goto out_unreg_chrdev;
} }
i2c_dev_class->dev_groups = i2c_groups;
/* Keep track of adapters which will be added or removed later */ /* Keep track of adapters which will be added or removed later */
res = bus_register_notifier(&i2c_bus_type, &i2cdev_notifier); res = bus_register_notifier(&i2c_bus_type, &i2cdev_notifier);
......
...@@ -46,6 +46,7 @@ static int smbus_do_alert(struct device *dev, void *addrp) ...@@ -46,6 +46,7 @@ static int smbus_do_alert(struct device *dev, void *addrp)
{ {
struct i2c_client *client = i2c_verify_client(dev); struct i2c_client *client = i2c_verify_client(dev);
struct alert_data *data = addrp; struct alert_data *data = addrp;
struct i2c_driver *driver;
if (!client || client->addr != data->addr) if (!client || client->addr != data->addr)
return 0; return 0;
...@@ -54,12 +55,13 @@ static int smbus_do_alert(struct device *dev, void *addrp) ...@@ -54,12 +55,13 @@ static int smbus_do_alert(struct device *dev, void *addrp)
/* /*
* Drivers should either disable alerts, or provide at least * Drivers should either disable alerts, or provide at least
* a minimal handler. Lock so client->driver won't change. * a minimal handler. Lock so the driver won't change.
*/ */
device_lock(dev); device_lock(dev);
if (client->driver) { if (client->dev.driver) {
if (client->driver->alert) driver = to_i2c_driver(client->dev.driver);
client->driver->alert(client, data->flag); if (driver->alert)
driver->alert(client, data->flag);
else else
dev_warn(&client->dev, "no driver alert()!\n"); dev_warn(&client->dev, "no driver alert()!\n");
} else } else
......
...@@ -238,7 +238,7 @@ static struct platform_driver i2c_arbitrator_driver = { ...@@ -238,7 +238,7 @@ static struct platform_driver i2c_arbitrator_driver = {
.driver = { .driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "i2c-arb-gpio-challenge", .name = "i2c-arb-gpio-challenge",
.of_match_table = of_match_ptr(i2c_arbitrator_of_match), .of_match_table = i2c_arbitrator_of_match,
}, },
}; };
......
...@@ -30,15 +30,15 @@ static void i2c_mux_gpio_set(const struct gpiomux *mux, unsigned val) ...@@ -30,15 +30,15 @@ static void i2c_mux_gpio_set(const struct gpiomux *mux, unsigned val)
int i; int i;
for (i = 0; i < mux->data.n_gpios; i++) for (i = 0; i < mux->data.n_gpios; i++)
gpio_set_value(mux->gpio_base + mux->data.gpios[i], gpio_set_value_cansleep(mux->gpio_base + mux->data.gpios[i],
val & (1 << i)); val & (1 << i));
} }
static int i2c_mux_gpio_select(struct i2c_adapter *adap, void *data, u32 chan) static int i2c_mux_gpio_select(struct i2c_adapter *adap, void *data, u32 chan)
{ {
struct gpiomux *mux = data; struct gpiomux *mux = data;
i2c_mux_gpio_set(mux, mux->data.values[chan]); i2c_mux_gpio_set(mux, chan);
return 0; return 0;
} }
...@@ -228,7 +228,7 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev) ...@@ -228,7 +228,7 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev)
unsigned int class = mux->data.classes ? mux->data.classes[i] : 0; unsigned int class = mux->data.classes ? mux->data.classes[i] : 0;
mux->adap[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, nr, mux->adap[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, nr,
i, class, mux->data.values[i], class,
i2c_mux_gpio_select, deselect); i2c_mux_gpio_select, deselect);
if (!mux->adap[i]) { if (!mux->adap[i]) {
ret = -ENODEV; ret = -ENODEV;
...@@ -283,7 +283,7 @@ static struct platform_driver i2c_mux_gpio_driver = { ...@@ -283,7 +283,7 @@ static struct platform_driver i2c_mux_gpio_driver = {
.driver = { .driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "i2c-mux-gpio", .name = "i2c-mux-gpio",
.of_match_table = of_match_ptr(i2c_mux_gpio_of_match), .of_match_table = i2c_mux_gpio_of_match,
}, },
}; };
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/i2c-mux-pinctrl.h> #include <linux/i2c-mux-pinctrl.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/of.h>
struct i2c_mux_pinctrl { struct i2c_mux_pinctrl {
struct device *dev; struct device *dev;
......
...@@ -1581,7 +1581,7 @@ static int s5c73m3_probe(struct i2c_client *client, ...@@ -1581,7 +1581,7 @@ static int s5c73m3_probe(struct i2c_client *client,
oif_sd = &state->oif_sd; oif_sd = &state->oif_sd;
v4l2_subdev_init(sd, &s5c73m3_subdev_ops); v4l2_subdev_init(sd, &s5c73m3_subdev_ops);
sd->owner = client->driver->driver.owner; sd->owner = client->dev.driver->owner;
v4l2_set_subdevdata(sd, state); v4l2_set_subdevdata(sd, state);
strlcpy(sd->name, "S5C73M3", sizeof(sd->name)); strlcpy(sd->name, "S5C73M3", sizeof(sd->name));
......
...@@ -411,8 +411,8 @@ static int fimc_md_of_add_sensor(struct fimc_md *fmd, ...@@ -411,8 +411,8 @@ static int fimc_md_of_add_sensor(struct fimc_md *fmd,
device_lock(&client->dev); device_lock(&client->dev);
if (!client->driver || if (!client->dev.driver ||
!try_module_get(client->driver->driver.owner)) { !try_module_get(client->dev.driver->owner)) {
ret = -EPROBE_DEFER; ret = -EPROBE_DEFER;
v4l2_info(&fmd->v4l2_dev, "No driver found for %s\n", v4l2_info(&fmd->v4l2_dev, "No driver found for %s\n",
node->full_name); node->full_name);
...@@ -442,7 +442,7 @@ static int fimc_md_of_add_sensor(struct fimc_md *fmd, ...@@ -442,7 +442,7 @@ static int fimc_md_of_add_sensor(struct fimc_md *fmd,
fmd->num_sensors++; fmd->num_sensors++;
mod_put: mod_put:
module_put(client->driver->driver.owner); module_put(client->dev.driver->owner);
dev_put: dev_put:
device_unlock(&client->dev); device_unlock(&client->dev);
put_device(&client->dev); put_device(&client->dev);
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#define UNSET (-1U) #define UNSET (-1U)
#define PREFIX (t->i2c->driver->driver.name) #define PREFIX (t->i2c->dev.driver->name)
/* /*
* Driver modprobe parameters * Driver modprobe parameters
...@@ -452,7 +452,7 @@ static void set_type(struct i2c_client *c, unsigned int type, ...@@ -452,7 +452,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
} }
tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n", tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n",
c->adapter->name, c->driver->driver.name, c->addr << 1, type, c->adapter->name, c->dev.driver->name, c->addr << 1, type,
t->mode_mask); t->mode_mask);
return; return;
...@@ -556,7 +556,7 @@ static void tuner_lookup(struct i2c_adapter *adap, ...@@ -556,7 +556,7 @@ static void tuner_lookup(struct i2c_adapter *adap,
int mode_mask; int mode_mask;
if (pos->i2c->adapter != adap || if (pos->i2c->adapter != adap ||
strcmp(pos->i2c->driver->driver.name, "tuner")) strcmp(pos->i2c->dev.driver->name, "tuner"))
continue; continue;
mode_mask = pos->mode_mask; mode_mask = pos->mode_mask;
......
...@@ -236,14 +236,14 @@ void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client, ...@@ -236,14 +236,14 @@ void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client,
v4l2_subdev_init(sd, ops); v4l2_subdev_init(sd, ops);
sd->flags |= V4L2_SUBDEV_FL_IS_I2C; sd->flags |= V4L2_SUBDEV_FL_IS_I2C;
/* the owner is the same as the i2c_client's driver owner */ /* the owner is the same as the i2c_client's driver owner */
sd->owner = client->driver->driver.owner; sd->owner = client->dev.driver->owner;
sd->dev = &client->dev; sd->dev = &client->dev;
/* i2c_client and v4l2_subdev point to one another */ /* i2c_client and v4l2_subdev point to one another */
v4l2_set_subdevdata(sd, client); v4l2_set_subdevdata(sd, client);
i2c_set_clientdata(client, sd); i2c_set_clientdata(client, sd);
/* initialize name */ /* initialize name */
snprintf(sd->name, sizeof(sd->name), "%s %d-%04x", snprintf(sd->name, sizeof(sd->name), "%s %d-%04x",
client->driver->driver.name, i2c_adapter_id(client->adapter), client->dev.driver->name, i2c_adapter_id(client->adapter),
client->addr); client->addr);
} }
EXPORT_SYMBOL_GPL(v4l2_i2c_subdev_init); EXPORT_SYMBOL_GPL(v4l2_i2c_subdev_init);
...@@ -274,11 +274,11 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev, ...@@ -274,11 +274,11 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev,
loaded. This delay-load mechanism doesn't work if other drivers loaded. This delay-load mechanism doesn't work if other drivers
want to use the i2c device, so explicitly loading the module want to use the i2c device, so explicitly loading the module
is the best alternative. */ is the best alternative. */
if (client == NULL || client->driver == NULL) if (client == NULL || client->dev.driver == NULL)
goto error; goto error;
/* Lock the module so we can safely get the v4l2_subdev pointer */ /* Lock the module so we can safely get the v4l2_subdev pointer */
if (!try_module_get(client->driver->driver.owner)) if (!try_module_get(client->dev.driver->owner))
goto error; goto error;
sd = i2c_get_clientdata(client); sd = i2c_get_clientdata(client);
...@@ -287,7 +287,7 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev, ...@@ -287,7 +287,7 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev,
if (v4l2_device_register_subdev(v4l2_dev, sd)) if (v4l2_device_register_subdev(v4l2_dev, sd))
sd = NULL; sd = NULL;
/* Decrease the module use count to match the first try_module_get. */ /* Decrease the module use count to match the first try_module_get. */
module_put(client->driver->driver.owner); module_put(client->dev.driver->owner);
error: error:
/* If we have a client but no subdev, then something went wrong and /* If we have a client but no subdev, then something went wrong and
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/at24.h> #include <linux/platform_data/at24.h>
/* /*
* I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable.
......
...@@ -205,7 +205,6 @@ struct i2c_driver { ...@@ -205,7 +205,6 @@ struct i2c_driver {
* @name: Indicates the type of the device, usually a chip name that's * @name: Indicates the type of the device, usually a chip name that's
* generic enough to hide second-sourcing and compatible revisions. * generic enough to hide second-sourcing and compatible revisions.
* @adapter: manages the bus segment hosting this I2C device * @adapter: manages the bus segment hosting this I2C device
* @driver: device's driver, hence pointer to access routines
* @dev: Driver model device node for the slave. * @dev: Driver model device node for the slave.
* @irq: indicates the IRQ generated by this device (if any) * @irq: indicates the IRQ generated by this device (if any)
* @detected: member of an i2c_driver.clients list or i2c-core's * @detected: member of an i2c_driver.clients list or i2c-core's
...@@ -222,7 +221,6 @@ struct i2c_client { ...@@ -222,7 +221,6 @@ struct i2c_client {
/* _LOWER_ 7 bits */ /* _LOWER_ 7 bits */
char name[I2C_NAME_SIZE]; char name[I2C_NAME_SIZE];
struct i2c_adapter *adapter; /* the adapter we sit on */ struct i2c_adapter *adapter; /* the adapter we sit on */
struct i2c_driver *driver; /* and our access routines */
struct device dev; /* the device structure */ struct device dev; /* the device structure */
int irq; /* irq issued by device */ int irq; /* irq issued by device */
struct list_head detected; struct list_head detected;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* *
* void get_mac_addr(struct memory_accessor *mem_acc, void *context) * void get_mac_addr(struct memory_accessor *mem_acc, void *context)
* { * {
* u8 *mac_addr = ethernet_pdata->mac_addr; * u8 *mac_addr = ethernet_pdata->mac_addr;
* off_t offset = context; * off_t offset = context;
* *
* // Read MAC addr from EEPROM * // Read MAC addr from EEPROM
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
printk(level "%s %d-%04x: " fmt, name, i2c_adapter_id(adapter), addr , ## arg) printk(level "%s %d-%04x: " fmt, name, i2c_adapter_id(adapter), addr , ## arg)
#define v4l_client_printk(level, client, fmt, arg...) \ #define v4l_client_printk(level, client, fmt, arg...) \
v4l_printk(level, (client)->driver->driver.name, (client)->adapter, \ v4l_printk(level, (client)->dev.driver->name, (client)->adapter, \
(client)->addr, fmt , ## arg) (client)->addr, fmt , ## arg)
#define v4l_err(client, fmt, arg...) \ #define v4l_err(client, fmt, arg...) \
......
...@@ -65,7 +65,7 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter) ...@@ -65,7 +65,7 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter)
* already bound. If not it means binding failed, and then there * already bound. If not it means binding failed, and then there
* is no point in keeping the device instantiated. * is no point in keeping the device instantiated.
*/ */
if (!keywest_ctx->client->driver) { if (!keywest_ctx->client->dev.driver) {
i2c_unregister_device(keywest_ctx->client); i2c_unregister_device(keywest_ctx->client);
keywest_ctx->client = NULL; keywest_ctx->client = NULL;
return -ENODEV; return -ENODEV;
...@@ -76,7 +76,7 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter) ...@@ -76,7 +76,7 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter)
* This is safe because i2c-core holds the core_lock mutex for us. * This is safe because i2c-core holds the core_lock mutex for us.
*/ */
list_add_tail(&keywest_ctx->client->detected, list_add_tail(&keywest_ctx->client->detected,
&keywest_ctx->client->driver->clients); &to_i2c_driver(keywest_ctx->client->dev.driver)->clients);
return 0; return 0;
} }
......
...@@ -215,7 +215,7 @@ static int imx_wm8962_probe(struct platform_device *pdev) ...@@ -215,7 +215,7 @@ static int imx_wm8962_probe(struct platform_device *pdev)
goto fail; goto fail;
} }
codec_dev = of_find_i2c_device_by_node(codec_np); codec_dev = of_find_i2c_device_by_node(codec_np);
if (!codec_dev || !codec_dev->driver) { if (!codec_dev || !codec_dev->dev.driver) {
dev_err(&pdev->dev, "failed to find codec platform device\n"); dev_err(&pdev->dev, "failed to find codec platform device\n");
ret = -EINVAL; ret = -EINVAL;
goto fail; goto fail;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment