All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] saa7115: add detection code for gm7113c
@ 2013-04-26 12:49 Mauro Carvalho Chehab
  2013-04-26 12:49 ` [PATCH 1/2] saa7115: move the autodetection code out of the probe function Mauro Carvalho Chehab
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2013-04-26 12:49 UTC (permalink / raw)
  To: Jon Arne Jørgensen
  Cc: Ezequiel Garcia, Mauro Carvalho Chehab, Linux Media Mailing List

Hi Jen,

Ezequiel pinged me today on IRC warning me that, at least on his
stk1160 device with gm1113c, the analog demod, labeled as GM1113C 1145,
returns 0x10 on all reads (e. g. version 0).

So, I decided to write a patch with the ideas I exposed on my last
emails, plus a code that would allow saa7115 to work with both
auto-detection and manual binding.

I didn't add there the part of your code with the gm7113c specifics,
as I prefer if you can rebase your patch on the top of those two,
of course assuming that they'll work.

Patches weren't test yet.

Jen/Ezequiel,

Could you please test them?

Mauro Carvalho Chehab (2):
  saa7115: move the autodetection code out of the probe function
  saa7115: add detection code for gm7113c

 drivers/media/i2c/saa7115.c     | 165 ++++++++++++++++++++++++++++------------
 include/media/v4l2-chip-ident.h |   2 +
 2 files changed, 119 insertions(+), 48 deletions(-)

-- 
1.8.1.4


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

* [PATCH 1/2] saa7115: move the autodetection code out of the probe function
  2013-04-26 12:49 [PATCH 0/2] saa7115: add detection code for gm7113c Mauro Carvalho Chehab
@ 2013-04-26 12:49 ` Mauro Carvalho Chehab
  2013-04-26 13:41   ` Ezequiel Garcia
  2013-04-26 12:49 ` [PATCH 2/2] saa7115: add detection code for gm7113c Mauro Carvalho Chehab
  2013-04-26 13:46 ` [PATCH 0/2] " Ezequiel Garcia
  2 siblings, 1 reply; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2013-04-26 12:49 UTC (permalink / raw)
  To: Jon Arne Jørgensen
  Cc: Ezequiel Garcia, Mauro Carvalho Chehab, Linux Media Mailing List

As we're now seeing other variants from chinese clones, like
gm1113c, we'll need to add more bits at the detection code.

So, move it into a separate function.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
---
 drivers/media/i2c/saa7115.c | 133 +++++++++++++++++++++++++++-----------------
 1 file changed, 83 insertions(+), 50 deletions(-)

diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index 52c717d..2bc8b72 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -1573,46 +1573,103 @@ static const struct v4l2_subdev_ops saa711x_ops = {
 
 /* ----------------------------------------------------------------------- */
 
+/**
+ * saa711x_detect_chip - Detects the saa711x (or clone) variant
+ * @client:		I2C client structure;
+ * @id:			I2C device ID structure;
+ * @name:		Name of the device to be filled.
+ * @size:		Size of the name var.
+ *
+ * Detects the Philips/NXP saa711x chip, or some clone of it.
+ * if 'id' is NULL or id->driver_data is equal to 1, it auto-probes
+ * the analog demod.
+ * If the tuner is not found, it returns -ENODEV.
+ * If auto-detection is disabled and the tuner doesn't match what it was
+ *	requred, it returns -EINVAL and fills 'name'.
+ * If the chip is found, it returns the chip ID and fills 'name'.
+ */
+static int saa711x_detect_chip(struct i2c_client *client,
+			       const struct i2c_device_id *id,
+			       char *name, unsigned size)
+{
+	char chip_ver[size - 1];
+	char chip_id;
+	int i;
+	int autodetect;
+
+	autodetect = !id || id->driver_data == 1;
+
+	/* Read the chip version register */
+	for (i = 0; i < size - 1; i++) {
+		i2c_smbus_write_byte_data(client, 0, i);
+		chip_ver[i] = i2c_smbus_read_byte_data(client, 0);
+		name[i] = (chip_ver[i] & 0x0f) + '0';
+		if (name[i] > '9')
+			name[i] += 'a' - '9' - 1;
+	}
+	name[i] = '\0';
+
+	/* Check if it is a Philips/NXP chip */
+	if (!memcmp(name + 1, "f711", 4)) {
+		chip_id = name[5];
+		snprintf(name, size, "saa711%c", chip_id);
+
+		if (!autodetect && strcmp(name, id->name))
+			return -EINVAL;
+
+		switch (chip_id) {
+		case '1':
+			if (chip_ver[0] & 0xf0) {
+				snprintf(name, size, "saa711%ca", chip_id);
+				v4l_info(client, "saa7111a variant found\n");
+				return V4L2_IDENT_SAA7111A;
+			}
+			return V4L2_IDENT_SAA7111;
+		case '3':
+			return V4L2_IDENT_SAA7113;
+		case '4':
+			return V4L2_IDENT_SAA7114;
+		case '5':
+			return V4L2_IDENT_SAA7115;
+		case '8':
+			return V4L2_IDENT_SAA7118;
+		default:
+			v4l2_info(client,
+				  "WARNING: Philips/NXP chip unknown - Falling back to saa7111\n");
+			return V4L2_IDENT_SAA7111;
+		}
+	}
+
+	/* 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);
+	return -ENODEV;
+}
+
 static int saa711x_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
 	struct saa711x_state *state;
 	struct v4l2_subdev *sd;
 	struct v4l2_ctrl_handler *hdl;
-	int i;
+	int ident;
 	char name[17];
-	char chip_id;
-	int autodetect = !id || id->driver_data == 1;
 
 	/* Check if the adapter supports the needed features */
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
 		return -EIO;
 
-	for (i = 0; i < 0x0f; i++) {
-		i2c_smbus_write_byte_data(client, 0, i);
-		name[i] = (i2c_smbus_read_byte_data(client, 0) & 0x0f) + '0';
-		if (name[i] > '9')
-			name[i] += 'a' - '9' - 1;
-	}
-	name[i] = '\0';
-
-	chip_id = name[5];
-
-	/* Check whether this chip is part of the saa711x series */
-	if (memcmp(name + 1, "f711", 4)) {
-		v4l_dbg(1, debug, client, "chip found @ 0x%x (ID %s) does not match a known saa711x chip.\n",
-			client->addr << 1, name);
+	ident = saa711x_detect_chip(client, id, name, sizeof(name));
+	if (ident == -EINVAL) {
+		/* Chip exists, but doesn't match */
+		v4l_warn(client, "found %s while %s was expected\n",
+			 name, id->name);
 		return -ENODEV;
 	}
+	if (ident < 0)
+		return ident;
 
-	/* Safety check */
-	if (!autodetect && id->name[6] != chip_id) {
-		v4l_warn(client, "found saa711%c while %s was expected\n",
-			 chip_id, id->name);
-	}
-	snprintf(client->name, sizeof(client->name), "saa711%c", chip_id);
-	v4l_info(client, "saa711%c found (%s) @ 0x%x (%s)\n", chip_id, name,
-		 client->addr << 1, client->adapter->name);
+	strlcpy(client->name, name, sizeof(client->name));
 
 	state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL);
 	if (state == NULL)
@@ -1649,31 +1706,7 @@ static int saa711x_probe(struct i2c_client *client,
 	state->output = SAA7115_IPORT_ON;
 	state->enable = 1;
 	state->radio = 0;
-	switch (chip_id) {
-	case '1':
-		state->ident = V4L2_IDENT_SAA7111;
-		if (saa711x_read(sd, R_00_CHIP_VERSION) & 0xf0) {
-			v4l_info(client, "saa7111a variant found\n");
-			state->ident = V4L2_IDENT_SAA7111A;
-		}
-		break;
-	case '3':
-		state->ident = V4L2_IDENT_SAA7113;
-		break;
-	case '4':
-		state->ident = V4L2_IDENT_SAA7114;
-		break;
-	case '5':
-		state->ident = V4L2_IDENT_SAA7115;
-		break;
-	case '8':
-		state->ident = V4L2_IDENT_SAA7118;
-		break;
-	default:
-		state->ident = V4L2_IDENT_SAA7111;
-		v4l2_info(sd, "WARNING: Chip is not known - Falling back to saa7111\n");
-		break;
-	}
+	state->ident = ident;
 
 	state->audclk_freq = 48000;
 
-- 
1.8.1.4


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

* [PATCH 2/2] saa7115: add detection code for gm7113c
  2013-04-26 12:49 [PATCH 0/2] saa7115: add detection code for gm7113c Mauro Carvalho Chehab
  2013-04-26 12:49 ` [PATCH 1/2] saa7115: move the autodetection code out of the probe function Mauro Carvalho Chehab
@ 2013-04-26 12:49 ` Mauro Carvalho Chehab
  2013-04-26 13:39   ` Ezequiel Garcia
  2013-04-26 13:46 ` [PATCH 0/2] " Ezequiel Garcia
  2 siblings, 1 reply; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2013-04-26 12:49 UTC (permalink / raw)
  To: Jon Arne Jørgensen
  Cc: Ezequiel Garcia, Mauro Carvalho Chehab, Linux Media Mailing List

Adds a code that (auto)detects gm7113c clones. The auto-detection
here is not perfect, as, on contrary to what it would be expected
by looking into its datasheets some devices would return, instead:

	saa7115 0-0025: chip 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 @ 0x4a is unknown

(found on a device labeled as GM7113C 1145 by Ezequiel Garcia)

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
---
 drivers/media/i2c/saa7115.c     | 36 ++++++++++++++++++++++++++++++++++++
 include/media/v4l2-chip-ident.h |  2 ++
 2 files changed, 38 insertions(+)

diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index 2bc8b72..24672a7 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -1640,6 +1640,36 @@ static int saa711x_detect_chip(struct i2c_client *client,
 		}
 	}
 
+	/* Check if it is a gm1113c */
+	if (!memcmp(name, "0000", 4)) {
+		chip_id = 0;
+		for (i = 0; i < 4; i++) {
+			chip_id = chip_id << 1;
+			chip_id |= (chip_ver[i] & 0x80) ? 1 : 0;
+		}
+
+		/*
+		 * Note: From the datasheet, only versions 1 and 2
+		 * exists. However, tests on a device labeled as:
+		 *	"GM7113C 1145" returned "10" on all 16 chip
+		 *	version (reg 0x00) reads. So, we need to also
+		 *	accept at least verion 0. For now, let's just
+		 *	assume that a device that returns "0000" for
+		 *	the lower nibble is a gm1113c.
+		 */
+
+		snprintf(name, size, "gm1113c");
+
+		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);
+
+		return V4L2_IDENT_GM7113C;
+	}
+
 	/* 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);
@@ -1669,6 +1699,11 @@ static int saa711x_probe(struct i2c_client *client,
 	if (ident < 0)
 		return ident;
 
+	if (ident == V4L2_IDENT_GM7113C) {
+		v4l_warn(client, "%s not yet supported\n", name);
+		return -ENODEV;
+	}
+
 	strlcpy(client->name, name, sizeof(client->name));
 
 	state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL);
@@ -1756,6 +1791,7 @@ static const struct i2c_device_id saa711x_id[] = {
 	{ "saa7114", 0 },
 	{ "saa7115", 0 },
 	{ "saa7118", 0 },
+	{ "gm7113c", 0 },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, saa711x_id);
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index c259b36..543f89c 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -52,6 +52,8 @@ enum {
 	V4L2_IDENT_SAA7115 = 105,
 	V4L2_IDENT_SAA7118 = 108,
 
+	V4L2_IDENT_GM7113C = 140,
+
 	/* module saa7127: reserved range 150-199 */
 	V4L2_IDENT_SAA7127 = 157,
 	V4L2_IDENT_SAA7129 = 159,
-- 
1.8.1.4


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

* Re: [PATCH 2/2] saa7115: add detection code for gm7113c
  2013-04-26 12:49 ` [PATCH 2/2] saa7115: add detection code for gm7113c Mauro Carvalho Chehab
@ 2013-04-26 13:39   ` Ezequiel Garcia
  0 siblings, 0 replies; 7+ messages in thread
From: Ezequiel Garcia @ 2013-04-26 13:39 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Jon Arne Jørgensen, Linux Media Mailing List

On Fri, Apr 26, 2013 at 09:49:17AM -0300, Mauro Carvalho Chehab wrote:
> Adds a code that (auto)detects gm7113c clones. The auto-detection
> here is not perfect, as, on contrary to what it would be expected
> by looking into its datasheets some devices would return, instead:
> 
> 	saa7115 0-0025: chip 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 @ 0x4a is unknown
> 
> (found on a device labeled as GM7113C 1145 by Ezequiel Garcia)
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
> ---
>  drivers/media/i2c/saa7115.c     | 36 ++++++++++++++++++++++++++++++++++++
>  include/media/v4l2-chip-ident.h |  2 ++
>  2 files changed, 38 insertions(+)
> 
> diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
> index 2bc8b72..24672a7 100644
> --- a/drivers/media/i2c/saa7115.c
> +++ b/drivers/media/i2c/saa7115.c
> @@ -1640,6 +1640,36 @@ static int saa711x_detect_chip(struct i2c_client *client,
>  		}
>  	}
>  
> +	/* Check if it is a gm1113c */

s/1113/7113

> +	if (!memcmp(name, "0000", 4)) {
> +		chip_id = 0;
> +		for (i = 0; i < 4; i++) {
> +			chip_id = chip_id << 1;
> +			chip_id |= (chip_ver[i] & 0x80) ? 1 : 0;
> +		}
> +
> +		/*
> +		 * Note: From the datasheet, only versions 1 and 2
> +		 * exists. However, tests on a device labeled as:
> +		 *	"GM7113C 1145" returned "10" on all 16 chip
> +		 *	version (reg 0x00) reads. So, we need to also
> +		 *	accept at least verion 0. For now, let's just
> +		 *	assume that a device that returns "0000" for
> +		 *	the lower nibble is a gm1113c.

Is this weird comment indentation correct?

And also:
s/1113/7113

> +		 */
> +
> +		snprintf(name, size, "gm1113c");

Ditto.

> +
> +		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);
> +
> +		return V4L2_IDENT_GM7113C;
> +	}
> +
>  	/* 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);
> @@ -1669,6 +1699,11 @@ static int saa711x_probe(struct i2c_client *client,
>  	if (ident < 0)
>  		return ident;
>  
> +	if (ident == V4L2_IDENT_GM7113C) {
> +		v4l_warn(client, "%s not yet supported\n", name);
> +		return -ENODEV;
> +	}
> +
>  	strlcpy(client->name, name, sizeof(client->name));
>  
>  	state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL);
> @@ -1756,6 +1791,7 @@ static const struct i2c_device_id saa711x_id[] = {
>  	{ "saa7114", 0 },
>  	{ "saa7115", 0 },
>  	{ "saa7118", 0 },
> +	{ "gm7113c", 0 },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(i2c, saa711x_id);
> diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
> index c259b36..543f89c 100644
> --- a/include/media/v4l2-chip-ident.h
> +++ b/include/media/v4l2-chip-ident.h
> @@ -52,6 +52,8 @@ enum {
>  	V4L2_IDENT_SAA7115 = 105,
>  	V4L2_IDENT_SAA7118 = 108,
>  
> +	V4L2_IDENT_GM7113C = 140,
> +
>  	/* module saa7127: reserved range 150-199 */
>  	V4L2_IDENT_SAA7127 = 157,
>  	V4L2_IDENT_SAA7129 = 159,
> -- 
> 1.8.1.4
> 

-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

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

* Re: [PATCH 1/2] saa7115: move the autodetection code out of the probe function
  2013-04-26 12:49 ` [PATCH 1/2] saa7115: move the autodetection code out of the probe function Mauro Carvalho Chehab
@ 2013-04-26 13:41   ` Ezequiel Garcia
  0 siblings, 0 replies; 7+ messages in thread
From: Ezequiel Garcia @ 2013-04-26 13:41 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Jon Arne Jørgensen, Linux Media Mailing List

On Fri, Apr 26, 2013 at 09:49:16AM -0300, Mauro Carvalho Chehab wrote:
> As we're now seeing other variants from chinese clones, like
> gm1113c, we'll need to add more bits at the detection code.
> 
> So, move it into a separate function.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
> ---
>  drivers/media/i2c/saa7115.c | 133 +++++++++++++++++++++++++++-----------------
>  1 file changed, 83 insertions(+), 50 deletions(-)
> 
> diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
> index 52c717d..2bc8b72 100644
> --- a/drivers/media/i2c/saa7115.c
> +++ b/drivers/media/i2c/saa7115.c
> @@ -1573,46 +1573,103 @@ static const struct v4l2_subdev_ops saa711x_ops = {
>  
>  /* ----------------------------------------------------------------------- */
>  
> +/**
> + * saa711x_detect_chip - Detects the saa711x (or clone) variant
> + * @client:		I2C client structure;
> + * @id:			I2C device ID structure;

Tiny nitpick: weird indentation and inconsistent
format ";" vs. "." trailing char.

> + * @name:		Name of the device to be filled.
> + * @size:		Size of the name var.
> + *
> + * Detects the Philips/NXP saa711x chip, or some clone of it.
> + * if 'id' is NULL or id->driver_data is equal to 1, it auto-probes
> + * the analog demod.
> + * If the tuner is not found, it returns -ENODEV.
> + * If auto-detection is disabled and the tuner doesn't match what it was
> + *	requred, it returns -EINVAL and fills 'name'.
> + * If the chip is found, it returns the chip ID and fills 'name'.
> + */
> +static int saa711x_detect_chip(struct i2c_client *client,
> +			       const struct i2c_device_id *id,
> +			       char *name, unsigned size)
> +{
> +	char chip_ver[size - 1];
> +	char chip_id;
> +	int i;
> +	int autodetect;
> +
> +	autodetect = !id || id->driver_data == 1;
> +
> +	/* Read the chip version register */
> +	for (i = 0; i < size - 1; i++) {
> +		i2c_smbus_write_byte_data(client, 0, i);
> +		chip_ver[i] = i2c_smbus_read_byte_data(client, 0);
> +		name[i] = (chip_ver[i] & 0x0f) + '0';
> +		if (name[i] > '9')
> +			name[i] += 'a' - '9' - 1;
> +	}
> +	name[i] = '\0';
> +
> +	/* Check if it is a Philips/NXP chip */
> +	if (!memcmp(name + 1, "f711", 4)) {
> +		chip_id = name[5];
> +		snprintf(name, size, "saa711%c", chip_id);
> +
> +		if (!autodetect && strcmp(name, id->name))
> +			return -EINVAL;
> +
> +		switch (chip_id) {
> +		case '1':
> +			if (chip_ver[0] & 0xf0) {
> +				snprintf(name, size, "saa711%ca", chip_id);
> +				v4l_info(client, "saa7111a variant found\n");
> +				return V4L2_IDENT_SAA7111A;
> +			}
> +			return V4L2_IDENT_SAA7111;
> +		case '3':
> +			return V4L2_IDENT_SAA7113;
> +		case '4':
> +			return V4L2_IDENT_SAA7114;
> +		case '5':
> +			return V4L2_IDENT_SAA7115;
> +		case '8':
> +			return V4L2_IDENT_SAA7118;
> +		default:
> +			v4l2_info(client,
> +				  "WARNING: Philips/NXP chip unknown - Falling back to saa7111\n");
> +			return V4L2_IDENT_SAA7111;
> +		}
> +	}
> +
> +	/* 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);
> +	return -ENODEV;
> +}
> +
>  static int saa711x_probe(struct i2c_client *client,
>  			 const struct i2c_device_id *id)
>  {
>  	struct saa711x_state *state;
>  	struct v4l2_subdev *sd;
>  	struct v4l2_ctrl_handler *hdl;
> -	int i;
> +	int ident;
>  	char name[17];
> -	char chip_id;
> -	int autodetect = !id || id->driver_data == 1;
>  
>  	/* Check if the adapter supports the needed features */
>  	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
>  		return -EIO;
>  
> -	for (i = 0; i < 0x0f; i++) {
> -		i2c_smbus_write_byte_data(client, 0, i);
> -		name[i] = (i2c_smbus_read_byte_data(client, 0) & 0x0f) + '0';
> -		if (name[i] > '9')
> -			name[i] += 'a' - '9' - 1;
> -	}
> -	name[i] = '\0';
> -
> -	chip_id = name[5];
> -
> -	/* Check whether this chip is part of the saa711x series */
> -	if (memcmp(name + 1, "f711", 4)) {
> -		v4l_dbg(1, debug, client, "chip found @ 0x%x (ID %s) does not match a known saa711x chip.\n",
> -			client->addr << 1, name);
> +	ident = saa711x_detect_chip(client, id, name, sizeof(name));
> +	if (ident == -EINVAL) {
> +		/* Chip exists, but doesn't match */
> +		v4l_warn(client, "found %s while %s was expected\n",
> +			 name, id->name);
>  		return -ENODEV;
>  	}
> +	if (ident < 0)
> +		return ident;
>  
> -	/* Safety check */
> -	if (!autodetect && id->name[6] != chip_id) {
> -		v4l_warn(client, "found saa711%c while %s was expected\n",
> -			 chip_id, id->name);
> -	}
> -	snprintf(client->name, sizeof(client->name), "saa711%c", chip_id);
> -	v4l_info(client, "saa711%c found (%s) @ 0x%x (%s)\n", chip_id, name,
> -		 client->addr << 1, client->adapter->name);
> +	strlcpy(client->name, name, sizeof(client->name));
>  
>  	state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL);
>  	if (state == NULL)
> @@ -1649,31 +1706,7 @@ static int saa711x_probe(struct i2c_client *client,
>  	state->output = SAA7115_IPORT_ON;
>  	state->enable = 1;
>  	state->radio = 0;
> -	switch (chip_id) {
> -	case '1':
> -		state->ident = V4L2_IDENT_SAA7111;
> -		if (saa711x_read(sd, R_00_CHIP_VERSION) & 0xf0) {
> -			v4l_info(client, "saa7111a variant found\n");
> -			state->ident = V4L2_IDENT_SAA7111A;
> -		}
> -		break;
> -	case '3':
> -		state->ident = V4L2_IDENT_SAA7113;
> -		break;
> -	case '4':
> -		state->ident = V4L2_IDENT_SAA7114;
> -		break;
> -	case '5':
> -		state->ident = V4L2_IDENT_SAA7115;
> -		break;
> -	case '8':
> -		state->ident = V4L2_IDENT_SAA7118;
> -		break;
> -	default:
> -		state->ident = V4L2_IDENT_SAA7111;
> -		v4l2_info(sd, "WARNING: Chip is not known - Falling back to saa7111\n");
> -		break;
> -	}
> +	state->ident = ident;
>  
>  	state->audclk_freq = 48000;
>  
> -- 
> 1.8.1.4
> 

-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

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

* Re: [PATCH 0/2] saa7115: add detection code for gm7113c
  2013-04-26 12:49 [PATCH 0/2] saa7115: add detection code for gm7113c Mauro Carvalho Chehab
  2013-04-26 12:49 ` [PATCH 1/2] saa7115: move the autodetection code out of the probe function Mauro Carvalho Chehab
  2013-04-26 12:49 ` [PATCH 2/2] saa7115: add detection code for gm7113c Mauro Carvalho Chehab
@ 2013-04-26 13:46 ` Ezequiel Garcia
  2013-04-26 14:25   ` Mauro Carvalho Chehab
  2 siblings, 1 reply; 7+ messages in thread
From: Ezequiel Garcia @ 2013-04-26 13:46 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Jon Arne Jørgensen, Linux Media Mailing List

Hi Mauro,

Thanks for the patch!

On Fri, Apr 26, 2013 at 09:49:15AM -0300, Mauro Carvalho Chehab wrote:
> 
> I didn't add there the part of your code with the gm7113c specifics,
> as I prefer if you can rebase your patch on the top of those two,
> of course assuming that they'll work.
> 
> Patches weren't test yet.
> 
> Jen/Ezequiel,
> 
> Could you please test them?
> 

I've done some quick testing on stk1160+saa7113 and also stk1160+gm7113c,
everything looks OK (except from the minor misname comment, see the patch 2/2).

Let me do some more testing just to be sure.

@Jon: Do you mind sending the standard fix for gm7113c? We need those
to make stk1160+gm7113c work. I'll put my Tested-by so we can merge it!

FWIW, some user reported he didn't need those quirks to capture a PAL (?)
source. But in my experience, I *do* need them, otherwise I get a noisy
PAL-Nc output and no video capture at all on NTSC/PAL-M.

Thanks a lot for the good work!
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

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

* Re: [PATCH 0/2] saa7115: add detection code for gm7113c
  2013-04-26 13:46 ` [PATCH 0/2] " Ezequiel Garcia
@ 2013-04-26 14:25   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2013-04-26 14:25 UTC (permalink / raw)
  To: Ezequiel Garcia; +Cc: Jon Arne Jørgensen, Linux Media Mailing List

Em Fri, 26 Apr 2013 10:46:22 -0300
Ezequiel Garcia <ezequiel.garcia@free-electrons.com> escreveu:

> Hi Mauro,
> 
> Thanks for the patch!
> 
> On Fri, Apr 26, 2013 at 09:49:15AM -0300, Mauro Carvalho Chehab wrote:
> > 
> > I didn't add there the part of your code with the gm7113c specifics,
> > as I prefer if you can rebase your patch on the top of those two,
> > of course assuming that they'll work.
> > 
> > Patches weren't test yet.
> > 
> > Jen/Ezequiel,
> > 
> > Could you please test them?
> > 
> 
> I've done some quick testing on stk1160+saa7113 and also stk1160+gm7113c,
> everything looks OK (except from the minor misname comment, see the patch 2/2).

Thanks for testing and for the comments.

Just respin a v2 fixing the pointed minor pitnicks.

> Let me do some more testing just to be sure.

Ok. I don't intend to merge it without Jon's patches.

> @Jon: Do you mind sending the standard fix for gm7113c? We need those
> to make stk1160+gm7113c work. I'll put my Tested-by so we can merge it!
> 
> FWIW, some user reported he didn't need those quirks to capture a PAL (?)
> source. But in my experience, I *do* need them, otherwise I get a noisy
> PAL-Nc output and no video capture at all on NTSC/PAL-M.
> 
> Thanks a lot for the good work!

Regards,
Mauro

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

end of thread, other threads:[~2013-04-26 14:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-26 12:49 [PATCH 0/2] saa7115: add detection code for gm7113c Mauro Carvalho Chehab
2013-04-26 12:49 ` [PATCH 1/2] saa7115: move the autodetection code out of the probe function Mauro Carvalho Chehab
2013-04-26 13:41   ` Ezequiel Garcia
2013-04-26 12:49 ` [PATCH 2/2] saa7115: add detection code for gm7113c Mauro Carvalho Chehab
2013-04-26 13:39   ` Ezequiel Garcia
2013-04-26 13:46 ` [PATCH 0/2] " Ezequiel Garcia
2013-04-26 14:25   ` Mauro Carvalho Chehab

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.