From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org,
"Maciej S. Szmigiero" <mail@maciej.szmigiero.name>,
Mauro Carvalho Chehab <mchehab@s-opensource.com>,
Oliver Hartkopp <socketcan@hartkopp.net>
Subject: [PATCH 3.18 22/22] [media] saa7134: fix warm Medion 7134 EEPROM read
Date: Thu, 13 Jul 2017 17:43:02 +0200 [thread overview]
Message-ID: <20170713153935.032162351@linuxfoundation.org> (raw)
In-Reply-To: <20170713153934.089183081@linuxfoundation.org>
3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
commit 5a91206ff0d0548939f3e85a65fb76b400fb0e89 upstream.
When saa7134 module driving a Medion 7134 card is reloaded reads of this
card EEPROM (required for automatic detection of tuner model) will be
corrupted due to I2C gate in DVB-T demod being left closed.
This sometimes also happens on first saa7134 module load after a warm
reboot.
Fix this by opening this I2C gate before doing EEPROM read during i2c
initialization.
Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/media/pci/saa7134/saa7134-i2c.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
--- a/drivers/media/pci/saa7134/saa7134-i2c.c
+++ b/drivers/media/pci/saa7134/saa7134-i2c.c
@@ -350,12 +350,43 @@ static struct i2c_client saa7134_client_
/* ----------------------------------------------------------- */
+/* On Medion 7134 reading EEPROM needs DVB-T demod i2c gate open */
+static void saa7134_i2c_eeprom_md7134_gate(struct saa7134_dev *dev)
+{
+ u8 subaddr = 0x7, dmdregval;
+ u8 data[2];
+ int ret;
+ struct i2c_msg i2cgatemsg_r[] = { {.addr = 0x08, .flags = 0,
+ .buf = &subaddr, .len = 1},
+ {.addr = 0x08,
+ .flags = I2C_M_RD,
+ .buf = &dmdregval, .len = 1}
+ };
+ struct i2c_msg i2cgatemsg_w[] = { {.addr = 0x08, .flags = 0,
+ .buf = data, .len = 2} };
+
+ ret = i2c_transfer(&dev->i2c_adap, i2cgatemsg_r, 2);
+ if ((ret == 2) && (dmdregval & 0x2)) {
+ pr_debug("%s: DVB-T demod i2c gate was left closed\n",
+ dev->name);
+
+ data[0] = subaddr;
+ data[1] = (dmdregval & ~0x2);
+ if (i2c_transfer(&dev->i2c_adap, i2cgatemsg_w, 1) != 1)
+ pr_err("%s: EEPROM i2c gate open failure\n",
+ dev->name);
+ }
+}
+
static int
saa7134_i2c_eeprom(struct saa7134_dev *dev, unsigned char *eedata, int len)
{
unsigned char buf;
int i,err;
+ if (dev->board == SAA7134_BOARD_MD7134)
+ saa7134_i2c_eeprom_md7134_gate(dev);
+
dev->i2c_client.addr = 0xa0 >> 1;
buf = 0;
if (1 != (err = i2c_master_send(&dev->i2c_client,&buf,1))) {
next prev parent reply other threads:[~2017-07-13 15:44 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-13 15:42 [PATCH 3.18 00/22] 3.18.61-stable review Greg Kroah-Hartman
2017-07-13 15:42 ` [PATCH 3.18 01/22] driver core: platform: fix race condition with driver_override Greg Kroah-Hartman
2017-07-13 15:42 ` [PATCH 3.18 02/22] MIPS: UAPI: Ignore __arch_swab{16,32,64} when using MIPS16 Greg Kroah-Hartman
2017-07-13 15:42 ` [PATCH 3.18 04/22] bgmac: add check for oversized packets Greg Kroah-Hartman
2017-07-13 15:42 ` [PATCH 3.18 06/22] usb: ehci-orion: fix probe for !GENERIC_PHY Greg Kroah-Hartman
2017-07-13 15:42 ` [PATCH 3.18 07/22] tracing/kprobes: Allow to create probe with a module name starting with a digit Greg Kroah-Hartman
2017-07-13 15:42 ` [PATCH 3.18 08/22] usb: dwc3: replace %p with %pK Greg Kroah-Hartman
2017-07-13 15:42 ` [PATCH 3.18 09/22] USB: serial: cp210x: add ID for CEL EM3588 USB ZigBee stick Greg Kroah-Hartman
2017-07-13 15:42 ` [PATCH 3.18 10/22] Add USB quirk for HVR-950q to avoid intermittent device resets Greg Kroah-Hartman
2017-07-13 15:42 ` [PATCH 3.18 11/22] usb: usbip: set buffer pointers to NULL after free Greg Kroah-Hartman
2017-07-13 15:42 ` [PATCH 3.18 12/22] usb: Fix typo in the definition of Endpoint[out]Request Greg Kroah-Hartman
2017-07-13 15:42 ` [PATCH 3.18 14/22] pinctrl: sh-pfc: Update info pointer after SoC-specific init Greg Kroah-Hartman
2017-07-13 15:42 ` [PATCH 3.18 17/22] KEYS: Fix an error code in request_master_key() Greg Kroah-Hartman
2017-07-13 15:42 ` [PATCH 3.18 18/22] mqueue: fix a use-after-free in sys_mq_notify() Greg Kroah-Hartman
2017-07-13 15:42 ` [PATCH 3.18 19/22] md: fix super_offset endianness in super_1_rdev_size_change Greg Kroah-Hartman
2017-07-13 15:43 ` [PATCH 3.18 20/22] staging: vt6556: vnt_start Fix missing call to vnt_key_init_table Greg Kroah-Hartman
2017-07-13 15:43 ` [PATCH 3.18 21/22] staging: comedi: fix clean-up of comedi_class in comedi_init() Greg Kroah-Hartman
2017-07-13 15:43 ` Greg Kroah-Hartman [this message]
2017-07-14 1:26 ` [PATCH 3.18 00/22] 3.18.61-stable review Guenter Roeck
2017-07-14 9:31 ` Greg Kroah-Hartman
2017-07-14 11:43 ` Amit Pundir
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170713153935.032162351@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mail@maciej.szmigiero.name \
--cc=mchehab@s-opensource.com \
--cc=socketcan@hartkopp.net \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).