]> err.no Git - linux-2.6/commitdiff
V4L/DVB (5355): Add VIDIOC_G_CHIP_IDENT to various i2c modules
authorHans Verkuil <hverkuil@xs4all.nl>
Fri, 27 Apr 2007 15:31:26 +0000 (12:31 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 27 Apr 2007 18:43:50 +0000 (15:43 -0300)
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/cs53l32a.c
drivers/media/video/msp3400-driver.c
drivers/media/video/msp3400-driver.h
drivers/media/video/tvaudio.c
drivers/media/video/upd64031a.c
drivers/media/video/upd64083.c
drivers/media/video/wm8739.c
drivers/media/video/wm8775.c
include/media/v4l2-chip-ident.h

index de87247c74ee95138b78fa9f7d1eabd62700b8d3..a73e285af7305c5429c9f51898b7593ebeccdd67 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/i2c-id.h>
 #include <linux/videodev.h>
 #include <media/v4l2-common.h>
+#include <media/v4l2-chip-ident.h>
 
 MODULE_DESCRIPTION("i2c device driver for cs53l32a Audio ADC");
 MODULE_AUTHOR("Martin Vaughan");
@@ -103,6 +104,9 @@ static int cs53l32a_command(struct i2c_client *client, unsigned int cmd,
                cs53l32a_write(client, 0x05, (u8) ctrl->value);
                break;
 
+       case VIDIOC_G_CHIP_IDENT:
+               return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_CS53l32A, 0);
+
        case VIDIOC_LOG_STATUS:
                {
                        u8 v = cs53l32a_read(client, 0x01);
index ba1af3c8525e196fa3c6457b7b05ec9aacccf0f0..3bb7d6634862be289f789b810a7b1d73c7fd3ac7 100644 (file)
@@ -773,6 +773,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
                break;
        }
 
+       case VIDIOC_G_CHIP_IDENT:
+               return v4l2_chip_ident_i2c_client(client, arg, state->ident, (state->rev1 << 16) | state->rev2);
+
        default:
                /* unknown */
                return -EINVAL;
@@ -872,6 +875,8 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
        snprintf(client->name, sizeof(client->name), "MSP%d4%02d%c-%c%d",
                        msp_family, msp_product,
                        msp_revision, msp_hard, msp_rom);
+       /* Rev B=2, C=3, D=4, G=7 */
+       state->ident = msp_family * 10000 + 4000 + msp_product * 10 + msp_revision - '@';
 
        /* Has NICAM support: all mspx41x and mspx45x products have NICAM */
        state->has_nicam = msp_prod_hi == 1 || msp_prod_hi == 5;
index 7531efa1615e726d57ece12fbe11cb35e0fa3bf5..ab69a290e5dc7ecde1a71ab79cb33a171d776d93 100644 (file)
@@ -50,6 +50,7 @@ extern int msp_stereo_thresh;
 
 struct msp_state {
        int rev1, rev2;
+       int ident;
        u8 has_nicam;
        u8 has_radio;
        u8 has_headphones;
index d506dfaa45a991c4c895d23625c68ef7281b0778..426083c08986c971f36e7875015a42e75aa095ab 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <media/tvaudio.h>
 #include <media/v4l2-common.h>
+#include <media/v4l2-chip-ident.h>
 
 #include <media/i2c-addr.h>
 
@@ -1775,6 +1776,9 @@ static int chip_command(struct i2c_client *client,
                        /* the thread will call checkmode() later */
                }
                break;
+
+       case VIDIOC_G_CHIP_IDENT:
+               return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_TVAUDIO, 0);
        }
        return 0;
 }
index 28d1133a3b7a6f770b427991a9e2441a59224dab..0b2a961efd2215100863ee7a01b48c801b000dd6 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-common.h>
+#include <media/v4l2-chip-ident.h>
 #include <media/upd64031a.h>
 
 // --------------------- read registers functions define -----------------------
@@ -179,6 +180,9 @@ static int upd64031a_command(struct i2c_client *client, unsigned int cmd, void *
        }
 #endif
 
+       case VIDIOC_G_CHIP_IDENT:
+               return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_UPD64031A, 0);
+
        default:
                break;
        }
index fe38224150d8ae0abd116953ec09c6f92721ee23..401bd21f46ebdc817432715e258119211caed9c4 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/i2c.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-common.h>
+#include <media/v4l2-chip-ident.h>
 #include <media/upd64083.h>
 
 MODULE_DESCRIPTION("uPD64083 driver");
@@ -155,6 +156,10 @@ static int upd64083_command(struct i2c_client *client, unsigned int cmd, void *a
                break;
        }
 #endif
+
+       case VIDIOC_G_CHIP_IDENT:
+               return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_UPD64083, 0);
+
        default:
                break;
        }
index a9b59c35cd67e202799a86b09816adcd6fc49ab6..8f6741a28a4768455628733013fd41f51cd02895 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/i2c-id.h>
 #include <linux/videodev.h>
 #include <media/v4l2-common.h>
+#include <media/v4l2-chip-ident.h>
 
 MODULE_DESCRIPTION("wm8739 driver");
 MODULE_AUTHOR("T. Adachi, Hans Verkuil");
@@ -236,6 +237,9 @@ static int wm8739_command(struct i2c_client *client, unsigned int cmd, void *arg
                return -EINVAL;
        }
 
+       case VIDIOC_G_CHIP_IDENT:
+               return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_WM8739, 0);
+
        case VIDIOC_LOG_STATUS:
                v4l_info(client, "Frequency: %u Hz\n", state->clock_freq);
                v4l_info(client, "Volume L:  %02x%s\n", state->vol_l & 0x1f,
index d81a88bbe43d02a8aac3f61a575facb07153615a..4df5d30d4d09bf7a00a3a795d0a0880e6e511933 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/i2c-id.h>
 #include <linux/videodev.h>
 #include <media/v4l2-common.h>
+#include <media/v4l2-chip-ident.h>
 
 MODULE_DESCRIPTION("wm8775 driver");
 MODULE_AUTHOR("Ulf Eklund, Hans Verkuil");
@@ -124,6 +125,9 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd,
                        wm8775_write(client, R21, 0x100 + state->input);
                break;
 
+       case VIDIOC_G_CHIP_IDENT:
+               return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_WM8775, 0);
+
        case VIDIOC_LOG_STATUS:
                v4l_info(client, "Input: %d%s\n", state->input,
                            state->muted ? " (muted)" : "");
index 7d0c654139812c1b5db255b2a1e07ec9a7a6bdc2..09d16c4f00f7a55ecb6bb37bb0fdf034643209ac 100644 (file)
@@ -31,10 +31,13 @@ enum {
        V4L2_IDENT_AMBIGUOUS = 1,       /* Match too general, multiple chips matched */
        V4L2_IDENT_UNKNOWN   = 2,       /* Chip found, but cannot identify */
 
-       /* module saa7110: just ident= 100 */
+       /* module tvaudio: reserved range 50-99 */
+       V4L2_IDENT_TVAUDIO = 50,        /* A tvaudio chip, unknown which it is exactly */
+
+       /* module saa7110: just ident 100 */
        V4L2_IDENT_SAA7110 = 100,
 
-       /* module saa7111: just ident= 101 */
+       /* module saa7111: just ident 101 */
        V4L2_IDENT_SAA7111 = 101,
 
        /* module saa7115: reserved range 102-149 */
@@ -55,12 +58,92 @@ enum {
        V4L2_IDENT_CX25842 = 242,
        V4L2_IDENT_CX25843 = 243,
 
-       /* OmniVision sensors - range 250-299 */
+       /* OmniVision sensors: reserved range 250-299 */
        V4L2_IDENT_OV7670 = 250,
 
-       /* Conexant MPEG encoder/decoders: range 410-420 */
+       /* Conexant MPEG encoder/decoders: reserved range 410-420 */
        V4L2_IDENT_CX23415 = 415,
        V4L2_IDENT_CX23416 = 416,
+
+       /* module wm8739: just ident 8739 */
+       V4L2_IDENT_WM8739 = 8739,
+
+       /* module wm8775: just ident 8775 */
+       V4L2_IDENT_WM8775 = 8775,
+
+       /* module cs53132a: just ident 53132 */
+       V4L2_IDENT_CS53l32A = 53132,
+
+       /* module upd64031a: just ident 64031 */
+       V4L2_IDENT_UPD64031A = 64031,
+
+       /* module upd64083: just ident 64083 */
+       V4L2_IDENT_UPD64083 = 64083,
+
+       /* module msp34xx: reserved range 34000-34999 */
+       V4L2_IDENT_MSP3400B = 34002,
+       V4L2_IDENT_MSP3410B = 34102,
+
+       V4L2_IDENT_MSP3400C = 34003,
+       V4L2_IDENT_MSP3410C = 34103,
+
+       V4L2_IDENT_MSP3400D = 34004,
+       V4L2_IDENT_MSP3410D = 34104,
+       V4L2_IDENT_MSP3405D = 34054,
+       V4L2_IDENT_MSP3415D = 34154,
+       V4L2_IDENT_MSP3407D = 34074,
+       V4L2_IDENT_MSP3417D = 34174,
+
+       V4L2_IDENT_MSP3400G = 34007,
+       V4L2_IDENT_MSP3410G = 34107,
+       V4L2_IDENT_MSP3420G = 34207,
+       V4L2_IDENT_MSP3430G = 34307,
+       V4L2_IDENT_MSP3440G = 34407,
+       V4L2_IDENT_MSP3450G = 34507,
+       V4L2_IDENT_MSP3460G = 34607,
+
+       V4L2_IDENT_MSP3401G = 34017,
+       V4L2_IDENT_MSP3411G = 34117,
+       V4L2_IDENT_MSP3421G = 34217,
+       V4L2_IDENT_MSP3431G = 34317,
+       V4L2_IDENT_MSP3441G = 34417,
+       V4L2_IDENT_MSP3451G = 34517,
+       V4L2_IDENT_MSP3461G = 34617,
+
+       V4L2_IDENT_MSP3402G = 34027,
+       V4L2_IDENT_MSP3412G = 34127,
+       V4L2_IDENT_MSP3422G = 34227,
+       V4L2_IDENT_MSP3442G = 34427,
+       V4L2_IDENT_MSP3452G = 34527,
+
+       V4L2_IDENT_MSP3405G = 34057,
+       V4L2_IDENT_MSP3415G = 34157,
+       V4L2_IDENT_MSP3425G = 34257,
+       V4L2_IDENT_MSP3435G = 34357,
+       V4L2_IDENT_MSP3445G = 34457,
+       V4L2_IDENT_MSP3455G = 34557,
+       V4L2_IDENT_MSP3465G = 34657,
+
+       V4L2_IDENT_MSP3407G = 34077,
+       V4L2_IDENT_MSP3417G = 34177,
+       V4L2_IDENT_MSP3427G = 34277,
+       V4L2_IDENT_MSP3437G = 34377,
+       V4L2_IDENT_MSP3447G = 34477,
+       V4L2_IDENT_MSP3457G = 34577,
+       V4L2_IDENT_MSP3467G = 34677,
+
+       /* module msp44xx: reserved range 44000-44999 */
+       V4L2_IDENT_MSP4400G = 44007,
+       V4L2_IDENT_MSP4410G = 44107,
+       V4L2_IDENT_MSP4420G = 44207,
+       V4L2_IDENT_MSP4440G = 44407,
+       V4L2_IDENT_MSP4450G = 44507,
+
+       V4L2_IDENT_MSP4408G = 44087,
+       V4L2_IDENT_MSP4418G = 44187,
+       V4L2_IDENT_MSP4428G = 44287,
+       V4L2_IDENT_MSP4448G = 44487,
+       V4L2_IDENT_MSP4458G = 44587,
 };
 
 #endif