The patch number 8379 was added via Hans Verkuil <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [EMAIL PROTECTED]

------

From: Jean Delvare  <[EMAIL PROTECTED]>
saa7127: Make device detection optional


The saa7127 driver supports all of SAA7126, SAA7127, SAA7128 and
SAA1729 devices. Declare all these devices, so that board drivers can
tell which device is present, instead of always relying on
auto-detection (which needs to write to the chip, eek!).

We still need the detection for ivtv, so a special device name
"saa7127_auto" can be used when the caller doesn't know exactly which
device is present.

Signed-off-by: Jean Delvare <[EMAIL PROTECTED]>
Signed-off-by: Hans Verkuil <[EMAIL PROTECTED]>


---

 linux/drivers/media/video/ivtv/ivtv-i2c.c |    2 -
 linux/drivers/media/video/saa7127.c       |   42 ++++++++++++++--------
 2 files changed, 28 insertions(+), 16 deletions(-)

diff -r 3e7571e9fb09 -r 0fa04038d93f linux/drivers/media/video/ivtv/ivtv-i2c.c
--- a/linux/drivers/media/video/ivtv/ivtv-i2c.c Thu Jul 17 14:33:08 2008 +0200
+++ b/linux/drivers/media/video/ivtv/ivtv-i2c.c Thu Jul 17 15:18:31 2008 +0200
@@ -135,7 +135,7 @@ static const char * const hw_devicenames
 static const char * const hw_devicenames[] = {
        "cx25840",
        "saa7115",
-       "saa7127",
+       "saa7127_auto", /* saa7127 or saa7129 */
        "msp3400",
        "tuner",
        "wm8775",
diff -r 3e7571e9fb09 -r 0fa04038d93f linux/drivers/media/video/saa7127.c
--- a/linux/drivers/media/video/saa7127.c       Thu Jul 17 14:33:08 2008 +0200
+++ b/linux/drivers/media/video/saa7127.c       Thu Jul 17 15:18:31 2008 +0200
@@ -672,7 +672,6 @@ static int saa7127_probe(struct i2c_clie
 {
        struct saa7127_state *state;
        struct v4l2_sliced_vbi_data vbi = { 0, 0, 0, 0 };  /* set to disabled */
-       int read_result = 0;
 
        /* Check if the adapter supports the needed features */
        if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
@@ -720,20 +719,29 @@ static int saa7127_probe(struct i2c_clie
                saa7127_set_input_type(client, SAA7127_INPUT_TYPE_NORMAL);
        saa7127_set_video_enable(client, 1);
 
-       /* Detect if it's an saa7129 */
-       read_result = saa7127_read(client, SAA7129_REG_FADE_KEY_COL2);
-       saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, 0xaa);
-       if (saa7127_read(client, SAA7129_REG_FADE_KEY_COL2) == 0xaa) {
-               v4l_info(client, "saa7129 found @ 0x%x (%s)\n",
-                               client->addr << 1, client->adapter->name);
-               saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, read_result);
+       if (id->driver_data) {  /* Chip type is already known */
+               state->ident = id->driver_data;
+       } else {                /* Needs detection */
+               int read_result;
+
+               /* Detect if it's an saa7129 */
+               read_result = saa7127_read(client, SAA7129_REG_FADE_KEY_COL2);
+               saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, 0xaa);
+               if (saa7127_read(client, SAA7129_REG_FADE_KEY_COL2) == 0xaa) {
+                       saa7127_write(client, SAA7129_REG_FADE_KEY_COL2,
+                                       read_result);
+                       state->ident = V4L2_IDENT_SAA7129;
+                       strlcpy(client->name, "saa7129", I2C_NAME_SIZE);
+               } else {
+                       state->ident = V4L2_IDENT_SAA7127;
+                       strlcpy(client->name, "saa7127", I2C_NAME_SIZE);
+               }
+       }
+
+       v4l_info(client, "%s found @ 0x%x (%s)\n", client->name,
+                       client->addr << 1, client->adapter->name);
+       if (state->ident == V4L2_IDENT_SAA7129)
                saa7127_write_inittab(client, saa7129_init_config_extra);
-               state->ident = V4L2_IDENT_SAA7129;
-       } else {
-               v4l_info(client, "saa7127 found @ 0x%x (%s)\n",
-                               client->addr << 1, client->adapter->name);
-               state->ident = V4L2_IDENT_SAA7127;
-       }
        return 0;
 }
 
@@ -751,7 +759,11 @@ static int saa7127_remove(struct i2c_cli
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
 static struct i2c_device_id saa7127_id[] = {
-       { "saa7127", 0 },
+       { "saa7127_auto", 0 },  /* auto-detection */
+       { "saa7126", V4L2_IDENT_SAA7127 },
+       { "saa7127", V4L2_IDENT_SAA7127 },
+       { "saa7128", V4L2_IDENT_SAA7129 },
+       { "saa7129", V4L2_IDENT_SAA7129 },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, saa7127_id);


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/0fa04038d93fbd3ef4f29e31820ef350552e1f61

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to