提交 74cab31c 编写于 作者: H Hans Verkuil 提交者: Mauro Carvalho Chehab

V4L/DVB (5355): Add VIDIOC_G_CHIP_IDENT to various i2c modules

Signed-off-by: NHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: NMauro Carvalho Chehab <mchehab@infradead.org>
上级 1a0adaf3
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/i2c-id.h> #include <linux/i2c-id.h>
#include <linux/videodev.h> #include <linux/videodev.h>
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
#include <media/v4l2-chip-ident.h>
MODULE_DESCRIPTION("i2c device driver for cs53l32a Audio ADC"); MODULE_DESCRIPTION("i2c device driver for cs53l32a Audio ADC");
MODULE_AUTHOR("Martin Vaughan"); MODULE_AUTHOR("Martin Vaughan");
...@@ -103,6 +104,9 @@ static int cs53l32a_command(struct i2c_client *client, unsigned int cmd, ...@@ -103,6 +104,9 @@ static int cs53l32a_command(struct i2c_client *client, unsigned int cmd,
cs53l32a_write(client, 0x05, (u8) ctrl->value); cs53l32a_write(client, 0x05, (u8) ctrl->value);
break; break;
case VIDIOC_G_CHIP_IDENT:
return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_CS53l32A, 0);
case VIDIOC_LOG_STATUS: case VIDIOC_LOG_STATUS:
{ {
u8 v = cs53l32a_read(client, 0x01); u8 v = cs53l32a_read(client, 0x01);
......
...@@ -773,6 +773,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -773,6 +773,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
break; break;
} }
case VIDIOC_G_CHIP_IDENT:
return v4l2_chip_ident_i2c_client(client, arg, state->ident, (state->rev1 << 16) | state->rev2);
default: default:
/* unknown */ /* unknown */
return -EINVAL; return -EINVAL;
...@@ -872,6 +875,8 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) ...@@ -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", snprintf(client->name, sizeof(client->name), "MSP%d4%02d%c-%c%d",
msp_family, msp_product, msp_family, msp_product,
msp_revision, msp_hard, msp_rom); 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 */ /* Has NICAM support: all mspx41x and mspx45x products have NICAM */
state->has_nicam = msp_prod_hi == 1 || msp_prod_hi == 5; state->has_nicam = msp_prod_hi == 1 || msp_prod_hi == 5;
......
...@@ -50,6 +50,7 @@ extern int msp_stereo_thresh; ...@@ -50,6 +50,7 @@ extern int msp_stereo_thresh;
struct msp_state { struct msp_state {
int rev1, rev2; int rev1, rev2;
int ident;
u8 has_nicam; u8 has_nicam;
u8 has_radio; u8 has_radio;
u8 has_headphones; u8 has_headphones;
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <media/tvaudio.h> #include <media/tvaudio.h>
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
#include <media/v4l2-chip-ident.h>
#include <media/i2c-addr.h> #include <media/i2c-addr.h>
...@@ -1775,6 +1776,9 @@ static int chip_command(struct i2c_client *client, ...@@ -1775,6 +1776,9 @@ static int chip_command(struct i2c_client *client,
/* the thread will call checkmode() later */ /* the thread will call checkmode() later */
} }
break; break;
case VIDIOC_G_CHIP_IDENT:
return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_TVAUDIO, 0);
} }
return 0; return 0;
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/videodev2.h> #include <linux/videodev2.h>
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
#include <media/v4l2-chip-ident.h>
#include <media/upd64031a.h> #include <media/upd64031a.h>
// --------------------- read registers functions define ----------------------- // --------------------- read registers functions define -----------------------
...@@ -179,6 +180,9 @@ static int upd64031a_command(struct i2c_client *client, unsigned int cmd, void * ...@@ -179,6 +180,9 @@ static int upd64031a_command(struct i2c_client *client, unsigned int cmd, void *
} }
#endif #endif
case VIDIOC_G_CHIP_IDENT:
return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_UPD64031A, 0);
default: default:
break; break;
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/videodev2.h> #include <linux/videodev2.h>
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
#include <media/v4l2-chip-ident.h>
#include <media/upd64083.h> #include <media/upd64083.h>
MODULE_DESCRIPTION("uPD64083 driver"); MODULE_DESCRIPTION("uPD64083 driver");
...@@ -155,6 +156,10 @@ static int upd64083_command(struct i2c_client *client, unsigned int cmd, void *a ...@@ -155,6 +156,10 @@ static int upd64083_command(struct i2c_client *client, unsigned int cmd, void *a
break; break;
} }
#endif #endif
case VIDIOC_G_CHIP_IDENT:
return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_UPD64083, 0);
default: default:
break; break;
} }
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/i2c-id.h> #include <linux/i2c-id.h>
#include <linux/videodev.h> #include <linux/videodev.h>
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
#include <media/v4l2-chip-ident.h>
MODULE_DESCRIPTION("wm8739 driver"); MODULE_DESCRIPTION("wm8739 driver");
MODULE_AUTHOR("T. Adachi, Hans Verkuil"); MODULE_AUTHOR("T. Adachi, Hans Verkuil");
...@@ -236,6 +237,9 @@ static int wm8739_command(struct i2c_client *client, unsigned int cmd, void *arg ...@@ -236,6 +237,9 @@ static int wm8739_command(struct i2c_client *client, unsigned int cmd, void *arg
return -EINVAL; return -EINVAL;
} }
case VIDIOC_G_CHIP_IDENT:
return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_WM8739, 0);
case VIDIOC_LOG_STATUS: case VIDIOC_LOG_STATUS:
v4l_info(client, "Frequency: %u Hz\n", state->clock_freq); v4l_info(client, "Frequency: %u Hz\n", state->clock_freq);
v4l_info(client, "Volume L: %02x%s\n", state->vol_l & 0x1f, v4l_info(client, "Volume L: %02x%s\n", state->vol_l & 0x1f,
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/i2c-id.h> #include <linux/i2c-id.h>
#include <linux/videodev.h> #include <linux/videodev.h>
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
#include <media/v4l2-chip-ident.h>
MODULE_DESCRIPTION("wm8775 driver"); MODULE_DESCRIPTION("wm8775 driver");
MODULE_AUTHOR("Ulf Eklund, Hans Verkuil"); MODULE_AUTHOR("Ulf Eklund, Hans Verkuil");
...@@ -124,6 +125,9 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd, ...@@ -124,6 +125,9 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd,
wm8775_write(client, R21, 0x100 + state->input); wm8775_write(client, R21, 0x100 + state->input);
break; break;
case VIDIOC_G_CHIP_IDENT:
return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_WM8775, 0);
case VIDIOC_LOG_STATUS: case VIDIOC_LOG_STATUS:
v4l_info(client, "Input: %d%s\n", state->input, v4l_info(client, "Input: %d%s\n", state->input,
state->muted ? " (muted)" : ""); state->muted ? " (muted)" : "");
......
...@@ -31,10 +31,13 @@ enum { ...@@ -31,10 +31,13 @@ enum {
V4L2_IDENT_AMBIGUOUS = 1, /* Match too general, multiple chips matched */ V4L2_IDENT_AMBIGUOUS = 1, /* Match too general, multiple chips matched */
V4L2_IDENT_UNKNOWN = 2, /* Chip found, but cannot identify */ 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, V4L2_IDENT_SAA7110 = 100,
/* module saa7111: just ident= 101 */ /* module saa7111: just ident 101 */
V4L2_IDENT_SAA7111 = 101, V4L2_IDENT_SAA7111 = 101,
/* module saa7115: reserved range 102-149 */ /* module saa7115: reserved range 102-149 */
...@@ -55,12 +58,92 @@ enum { ...@@ -55,12 +58,92 @@ enum {
V4L2_IDENT_CX25842 = 242, V4L2_IDENT_CX25842 = 242,
V4L2_IDENT_CX25843 = 243, V4L2_IDENT_CX25843 = 243,
/* OmniVision sensors - range 250-299 */ /* OmniVision sensors: reserved range 250-299 */
V4L2_IDENT_OV7670 = 250, 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_CX23415 = 415,
V4L2_IDENT_CX23416 = 416, 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 #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册