linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: saa7115: Support CJC7113 detection
@ 2016-03-23  4:23 Ezequiel Garcia
  2016-04-25 18:02 ` Ezequiel Garcia
  0 siblings, 1 reply; 2+ messages in thread
From: Ezequiel Garcia @ 2016-03-23  4:23 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil, Kevin Fitch, Ezequiel Garcia

From: Kevin Fitch <kfitch42@gmail.com>

It's been reported that CJC7113 devices are returning
all 1s when reading register 0:

  "1111111111111111" found @ 0x4a (stk1160)

This new device is apparently compatible with SA7113, so let's
add a quirk to allow its autodetection. Given there isn't
any known differences with SAA7113, this commit does not
introduces a new saa711x_model value.

Reported-by: Philippe Desrochers <desrochers.philippe@gmail.com>
Signed-off-by: Kevin Fitch <kfitch42@gmail.com>
Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
---
 drivers/media/i2c/saa7115.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index 24d2b76dbe97..04f266d0a1ef 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -1794,6 +1794,21 @@ static int saa711x_detect_chip(struct i2c_client *client,
 		return GM7113C;
 	}
 
+	/* Check if it is a CJC7113 */
+	if (!memcmp(name, "1111111111111111", CHIP_VER_SIZE)) {
+		strlcpy(name, "cjc7113", CHIP_VER_SIZE);
+
+		if (!autodetect && strcmp(name, id->name))
+			return -EINVAL;
+
+		v4l_dbg(1, debug, client,
+			"It seems to be a %s chip (%*ph) @ 0x%x.\n",
+			name, 16, chip_ver, client->addr << 1);
+
+		/* CJC7113 seems to be SAA7113-compatible */
+		return SAA7113;
+	}
+
 	/* Chip was not discovered. Return its ID and don't bind */
 	v4l_dbg(1, debug, client, "chip %*ph @ 0x%x is unknown.\n",
 		16, chip_ver, client->addr << 1);
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] i2c: saa7115: Support CJC7113 detection
  2016-03-23  4:23 [PATCH] i2c: saa7115: Support CJC7113 detection Ezequiel Garcia
@ 2016-04-25 18:02 ` Ezequiel Garcia
  0 siblings, 0 replies; 2+ messages in thread
From: Ezequiel Garcia @ 2016-04-25 18:02 UTC (permalink / raw)
  To: linux-media, mchehab; +Cc: Hans Verkuil, Kevin Fitch, Ezequiel Garcia

On 23 March 2016 at 01:23, Ezequiel Garcia
<ezequiel@vanguardiasur.com.ar> wrote:
> From: Kevin Fitch <kfitch42@gmail.com>
>
> It's been reported that CJC7113 devices are returning
> all 1s when reading register 0:
>
>   "1111111111111111" found @ 0x4a (stk1160)
>
> This new device is apparently compatible with SA7113, so let's
> add a quirk to allow its autodetection. Given there isn't
> any known differences with SAA7113, this commit does not
> introduces a new saa711x_model value.
>
> Reported-by: Philippe Desrochers <desrochers.philippe@gmail.com>
> Signed-off-by: Kevin Fitch <kfitch42@gmail.com>
> Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
> ---
>  drivers/media/i2c/saa7115.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
> index 24d2b76dbe97..04f266d0a1ef 100644
> --- a/drivers/media/i2c/saa7115.c
> +++ b/drivers/media/i2c/saa7115.c
> @@ -1794,6 +1794,21 @@ static int saa711x_detect_chip(struct i2c_client *client,
>                 return GM7113C;
>         }
>
> +       /* Check if it is a CJC7113 */
> +       if (!memcmp(name, "1111111111111111", CHIP_VER_SIZE)) {
> +               strlcpy(name, "cjc7113", CHIP_VER_SIZE);
> +
> +               if (!autodetect && strcmp(name, id->name))
> +                       return -EINVAL;
> +
> +               v4l_dbg(1, debug, client,
> +                       "It seems to be a %s chip (%*ph) @ 0x%x.\n",
> +                       name, 16, chip_ver, client->addr << 1);
> +
> +               /* CJC7113 seems to be SAA7113-compatible */
> +               return SAA7113;
> +       }
> +
>         /* Chip was not discovered. Return its ID and don't bind */
>         v4l_dbg(1, debug, client, "chip %*ph @ 0x%x is unknown.\n",
>                 16, chip_ver, client->addr << 1);
> --
> 2.7.0
>

Any feedback on this one?
-- 
Ezequiel García, VanguardiaSur
www.vanguardiasur.com.ar

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-04-25 18:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-23  4:23 [PATCH] i2c: saa7115: Support CJC7113 detection Ezequiel Garcia
2016-04-25 18:02 ` Ezequiel Garcia

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).