diff options
author | Daniel Scheller <d.scheller@gmx.net> | 2017-03-29 13:43:12 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-06-20 09:28:26 -0300 |
commit | 6b1256b7becbf737cf220d011b0f732136ef63a5 (patch) | |
tree | 12055667b37d1ce413062f0607c0de1a3cc194a2 /drivers/media | |
parent | dbbac11e1de1250ad39bbc15490c8614ac7f9def (diff) | |
download | linux-rt-6b1256b7becbf737cf220d011b0f732136ef63a5.tar.gz |
[media] ddbridge: add i2c_read_regs()
Adds new i2c_read_regs() function and make i2c_read_reg() wrap into this
with len=1. Required for the tuner_tda18212_ping() and XO2 handling
functions (part of the Sony CXD28xx support patch series).
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/pci/ddbridge/ddbridge-core.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 09b5338f4f8b..f2ec7a9e976c 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -54,15 +54,21 @@ static int i2c_read(struct i2c_adapter *adapter, u8 adr, u8 *val) return (i2c_transfer(adapter, msgs, 1) == 1) ? 0 : -1; } -static int i2c_read_reg(struct i2c_adapter *adapter, u8 adr, u8 reg, u8 *val) +static int i2c_read_regs(struct i2c_adapter *adapter, + u8 adr, u8 reg, u8 *val, u8 len) { struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0, .buf = ®, .len = 1 }, {.addr = adr, .flags = I2C_M_RD, - .buf = val, .len = 1 } }; + .buf = val, .len = len } }; return (i2c_transfer(adapter, msgs, 2) == 2) ? 0 : -1; } +static int i2c_read_reg(struct i2c_adapter *adapter, u8 adr, u8 reg, u8 *val) +{ + return i2c_read_regs(adapter, adr, reg, val, 1); +} + static int i2c_read_reg16(struct i2c_adapter *adapter, u8 adr, u16 reg, u8 *val) { |