diff options
author | Matthias Schwarzott <zzam@gentoo.org> | 2014-10-02 09:20:59 +0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-10-30 22:18:22 +0300 |
commit | c3c3f1ae8bab74c99fa211c76b035a41523e83dd (patch) | |
tree | 3acfa168d161401c8004de2767fa52711380c1f9 /drivers/media/usb/cx231xx/cx231xx-i2c.c | |
parent | d032ca1283b68446df0adbec4561463b3f0aa147 (diff) | |
download | linux-c3c3f1ae8bab74c99fa211c76b035a41523e83dd.tar.xz |
[media] cx231xx: add wrapper to get the i2c_adapter pointer
This is a preparation for mapping I2C_1_MUX_1 and I2C_1_MUX_3 later to the seperate
muxed i2c adapters.
Map mux adapters to I2C_1 for now.
Add local variables for i2c_adapters in dvb_init to get line lengths
shorter.
Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/usb/cx231xx/cx231xx-i2c.c')
-rw-r--r-- | drivers/media/usb/cx231xx/cx231xx-i2c.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c index 45057167227c..af9180f3bf30 100644 --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c @@ -483,7 +483,7 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port) struct i2c_client client; memset(&client, 0, sizeof(client)); - client.adapter = &dev->i2c_bus[i2c_port].i2c_adap; + client.adapter = cx231xx_get_i2c_adap(dev, i2c_port); cx231xx_info(": Checking for I2C devices on port=%d ..\n", i2c_port); for (i = 0; i < 128; i++) { @@ -537,3 +537,21 @@ int cx231xx_i2c_unregister(struct cx231xx_i2c *bus) i2c_del_adapter(&bus->i2c_adap); return 0; } + +struct i2c_adapter *cx231xx_get_i2c_adap(struct cx231xx *dev, int i2c_port) +{ + switch (i2c_port) { + case I2C_0: + return &dev->i2c_bus[0].i2c_adap; + case I2C_1: + return &dev->i2c_bus[1].i2c_adap; + case I2C_2: + return &dev->i2c_bus[2].i2c_adap; + case I2C_1_MUX_1: + case I2C_1_MUX_3: + return &dev->i2c_bus[1].i2c_adap; + default: + return NULL; + } +} +EXPORT_SYMBOL_GPL(cx231xx_get_i2c_adap); |