diff options
author | Álvaro Fernández Rojas <noltari@gmail.com> | 2022-05-16 23:40:32 +0200 |
---|---|---|
committer | Álvaro Fernández Rojas <noltari@gmail.com> | 2022-05-17 15:11:22 +0200 |
commit | 20ea6adbf199097c4f5f591ffee088340630dae4 (patch) | |
tree | d6719d95e136611a1c25bbf7789652d6d402779d /target/linux/bcm27xx/patches-5.15/950-0240-media-irs1125-Using-i2c_transfer-for-ic2-reads.patch | |
parent | bca05bd072180dc38ef740b37ded9572a6db1981 (diff) | |
download | upstream-20ea6adbf199097c4f5f591ffee088340630dae4.tar.gz upstream-20ea6adbf199097c4f5f591ffee088340630dae4.tar.bz2 upstream-20ea6adbf199097c4f5f591ffee088340630dae4.zip |
bcm27xx: add support for linux v5.15
Build system: x86_64
Build-tested: bcm2708, bcm2709, bcm2710, bcm2711
Run-tested: bcm2708/RPiB+, bcm2709/RPi3B, bcm2710/RPi3B, bcm2711/RPi4B
Signed-off-by: Marty Jones <mj8263788@gmail.com>
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/bcm27xx/patches-5.15/950-0240-media-irs1125-Using-i2c_transfer-for-ic2-reads.patch')
-rw-r--r-- | target/linux/bcm27xx/patches-5.15/950-0240-media-irs1125-Using-i2c_transfer-for-ic2-reads.patch | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.15/950-0240-media-irs1125-Using-i2c_transfer-for-ic2-reads.patch b/target/linux/bcm27xx/patches-5.15/950-0240-media-irs1125-Using-i2c_transfer-for-ic2-reads.patch new file mode 100644 index 0000000000..9b6aec454f --- /dev/null +++ b/target/linux/bcm27xx/patches-5.15/950-0240-media-irs1125-Using-i2c_transfer-for-ic2-reads.patch @@ -0,0 +1,65 @@ +From 26c02ccf6302ec39a6fb344de0fe2d6cbda5d655 Mon Sep 17 00:00:00 2001 +From: Markus Proeller <markus.proeller@pieye.org> +Date: Tue, 16 Jun 2020 13:24:31 +0200 +Subject: [PATCH] media: irs1125: Using i2c_transfer for ic2 reads + +Reading data over i2c is done by using i2c_transfer to ensure that this +operation can't be interrupted. + +Signed-off-by: Markus Proeller <markus.proeller@pieye.org> +--- + drivers/media/i2c/irs1125.c | 37 ++++++++++++++++++++++--------------- + 1 file changed, 22 insertions(+), 15 deletions(-) + +--- a/drivers/media/i2c/irs1125.c ++++ b/drivers/media/i2c/irs1125.c +@@ -248,27 +248,34 @@ static int irs1125_write(struct v4l2_sub + + static int irs1125_read(struct v4l2_subdev *sd, u16 reg, u16 *val) + { +- int ret; +- unsigned char data_w[2] = { reg >> 8, reg & 0xff }; +- char rdval[2]; +- + struct i2c_client *client = v4l2_get_subdevdata(sd); ++ struct i2c_msg msgs[2]; ++ u8 addr_buf[2] = { reg >> 8, reg & 0xff }; ++ u8 data_buf[2] = { 0, }; ++ int ret; + +- ret = i2c_master_send(client, data_w, 2); +- if (ret < 0) { +- dev_dbg(&client->dev, "%s: i2c write error, reg: %x\n", +- __func__, reg); ++ /* Write register address */ ++ msgs[0].addr = client->addr; ++ msgs[0].flags = 0; ++ msgs[0].len = ARRAY_SIZE(addr_buf); ++ msgs[0].buf = addr_buf; ++ ++ /* Read data from register */ ++ msgs[1].addr = client->addr; ++ msgs[1].flags = I2C_M_RD; ++ msgs[1].len = 2; ++ msgs[1].buf = data_buf; ++ ++ ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); ++ if (ret != ARRAY_SIZE(msgs)) { ++ if (ret >= 0) ++ ret = -EIO; + return ret; + } + +- ret = i2c_master_recv(client, rdval, 2); +- if (ret < 0) +- dev_err(&client->dev, "%s: i2c read error, reg: %x\n", +- __func__, reg); +- +- *val = rdval[1] | (rdval[0] << 8); ++ *val = data_buf[1] | (data_buf[0] << 8); + +- return ret; ++ return 0; + } + + static int irs1125_write_array(struct v4l2_subdev *sd, |