f5919b65d4
Patch generation process: - rebase rpi/rpi-4.14.y on v4.14.89 from linux-stable - git format-patch v4.14.89 Patches skipped during rebase: - lan78xx: Read MAC address from DT if present - lan78xx: Enable LEDs and auto-negotiation - Revert "softirq: Let ksoftirqd do its job" - sc16is7xx: Fix for multi-channel stall - lan78xx: Ignore DT MAC address if already valid - lan78xx: Simple patch to prevent some crashes - tcp_write_queue_purge clears all the SKBs in the write queue - Revert "lan78xx: Simple patch to prevent some crashes" - lan78xx: Connect phy early - Arm: mm: ftrace: Only set text back to ro after kernel has been marked ro - Revert "Revert "softirq: Let ksoftirqd do its job"" - ASoC: cs4265: SOC_SINGLE register value error fix - Revert "ASoC: cs4265: SOC_SINGLE register value error fix" - Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends" - Revert "Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends"" Patches dropped after rebase: - net: Add non-mainline source for rtl8192cu wlan - net: Fix rtl8192cu build errors on other platforms - brcm: adds support for BCM43341 wifi - brcmfmac: Mute expected startup 'errors' - ARM64: Fix build break for RTL8187/RTL8192CU wifi - ARM64: Enable RTL8187/RTL8192CU wifi in build config - This is the driver for Sony CXD2880 DVB-T2/T tuner + demodulator - brcmfmac: add CLM download support - brcmfmac: request_firmware_direct is quieter - Sets the BCDC priority to constant 0 - brcmfmac: Disable ARP offloading when promiscuous - brcmfmac: Avoid possible out-of-bounds read - brcmfmac: Delete redundant length check - net: rtl8192cu: Normalize indentation - net: rtl8192cu: Fix implicit fallthrough warnings - Revert "Sets the BCDC priority to constant 0" - media: cxd2880: Bump to match 4.18.y version - media: cxd2880-spi: Bump to match 4.18.y version - Revert "mm: alloc_contig: re-allow CMA to compact FS pages" - Revert "Revert "mm: alloc_contig: re-allow CMA to compact FS pages"" - cxd2880: CXD2880_SPI_DRV should select DVB_CXD2880 with MEDIA_SUBDRV_AUTOSELECT - 950-0421-HID-hid-bigbenff-driver-for-BigBen-Interactive-PS3OF.patch - 950-0453-Add-hid-bigbenff-to-list-of-have_special_driver-for-.patch Make I2C built-in instead of modular as in upstream defconfig; also the easiest way to get MFD_ARIZONA enabled, which is required by kmod-sound-soc-rpi-cirrus. Add missing compatible strings from 4.9/960-add-rasbperrypi-compatible.patch, using upstream names for compute modules. Add extra patch to enable the LEDs on lan78xx. Compile-tested: bcm2708, bcm2709, bcm2710 (with CONFIG_ALL_KMODS=y) Runtime-tested: bcm2708, bcm2710 Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
99 lines
3.1 KiB
Diff
99 lines
3.1 KiB
Diff
From bce8f86dec02feb9865a6c72e450a1256b33ae2f Mon Sep 17 00:00:00 2001
|
|
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
|
Date: Tue, 28 Nov 2017 10:07:29 +0000
|
|
Subject: [PATCH 328/454] media: tc358743: Check I2C succeeded during probe.
|
|
|
|
The probe for the TC358743 reads the CHIPID register from
|
|
the device and compares it to the expected value of 0.
|
|
If the I2C request fails then that also returns 0, so
|
|
the driver loads thinking that the device is there.
|
|
|
|
Generally I2C communications are reliable so there is
|
|
limited need to check the return value on every transfer,
|
|
therefore only amend the one read during probe to check
|
|
for I2C errors.
|
|
|
|
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
|
---
|
|
drivers/media/i2c/tc358743.c | 27 +++++++++++++++++++++++----
|
|
1 file changed, 23 insertions(+), 4 deletions(-)
|
|
|
|
--- a/drivers/media/i2c/tc358743.c
|
|
+++ b/drivers/media/i2c/tc358743.c
|
|
@@ -119,7 +119,7 @@ static inline struct tc358743_state *to_
|
|
|
|
/* --------------- I2C --------------- */
|
|
|
|
-static void i2c_rd(struct v4l2_subdev *sd, u16 reg, u8 *values, u32 n)
|
|
+static int i2c_rd(struct v4l2_subdev *sd, u16 reg, u8 *values, u32 n)
|
|
{
|
|
struct tc358743_state *state = to_state(sd);
|
|
struct i2c_client *client = state->i2c_client;
|
|
@@ -145,6 +145,7 @@ static void i2c_rd(struct v4l2_subdev *s
|
|
v4l2_err(sd, "%s: reading register 0x%x from 0x%x failed\n",
|
|
__func__, reg, client->addr);
|
|
}
|
|
+ return err != ARRAY_SIZE(msgs);
|
|
}
|
|
|
|
static void i2c_wr(struct v4l2_subdev *sd, u16 reg, u8 *values, u32 n)
|
|
@@ -201,15 +202,24 @@ static void i2c_wr(struct v4l2_subdev *s
|
|
}
|
|
}
|
|
|
|
-static noinline u32 i2c_rdreg(struct v4l2_subdev *sd, u16 reg, u32 n)
|
|
+static noinline u32 i2c_rdreg_err(struct v4l2_subdev *sd, u16 reg, u32 n,
|
|
+ int *err)
|
|
{
|
|
+ int error;
|
|
__le32 val = 0;
|
|
|
|
- i2c_rd(sd, reg, (u8 __force *)&val, n);
|
|
+ error = i2c_rd(sd, reg, (u8 __force *)&val, n);
|
|
+ if (err)
|
|
+ *err = error;
|
|
|
|
return le32_to_cpu(val);
|
|
}
|
|
|
|
+static inline u32 i2c_rdreg(struct v4l2_subdev *sd, u16 reg, u32 n)
|
|
+{
|
|
+ return i2c_rdreg_err(sd, reg, n, NULL);
|
|
+}
|
|
+
|
|
static noinline void i2c_wrreg(struct v4l2_subdev *sd, u16 reg, u32 val, u32 n)
|
|
{
|
|
__le32 raw = cpu_to_le32(val);
|
|
@@ -238,6 +248,13 @@ static u16 i2c_rd16(struct v4l2_subdev *
|
|
return i2c_rdreg(sd, reg, 2);
|
|
}
|
|
|
|
+static int i2c_rd16_err(struct v4l2_subdev *sd, u16 reg, u16 *value)
|
|
+{
|
|
+ int err;
|
|
+ *value = i2c_rdreg_err(sd, reg, 2, &err);
|
|
+ return err;
|
|
+}
|
|
+
|
|
static void i2c_wr16(struct v4l2_subdev *sd, u16 reg, u16 val)
|
|
{
|
|
i2c_wrreg(sd, reg, val, 2);
|
|
@@ -1887,6 +1904,7 @@ static int tc358743_probe(struct i2c_cli
|
|
struct tc358743_state *state;
|
|
struct tc358743_platform_data *pdata = client->dev.platform_data;
|
|
struct v4l2_subdev *sd;
|
|
+ u16 chipid;
|
|
int err;
|
|
|
|
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
|
@@ -1919,7 +1937,8 @@ static int tc358743_probe(struct i2c_cli
|
|
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
|
|
|
|
/* i2c access */
|
|
- if ((i2c_rd16(sd, CHIPID) & MASK_CHIPID) != 0) {
|
|
+ if (i2c_rd16_err(sd, CHIPID, &chipid) ||
|
|
+ (chipid & MASK_CHIPID) != 0) {
|
|
v4l2_info(sd, "not a TC358743 on address 0x%x\n",
|
|
client->addr << 1);
|
|
return -ENODEV;
|