mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-13 09:20:17 +00:00
V4L/DVB (10068): Change device ID selection method on ov772x driver
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
2d425131d2
commit
aeabc882a3
@ -345,6 +345,12 @@
|
|||||||
#define OP_UV 0x00000001
|
#define OP_UV 0x00000001
|
||||||
#define OP_SWAP_RGB 0x00000002
|
#define OP_SWAP_RGB 0x00000002
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
#define OV7720 0x7720
|
||||||
|
#define VERSION(pid, ver) ((pid<<8)|(ver&0xFF))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* struct
|
* struct
|
||||||
*/
|
*/
|
||||||
@ -374,6 +380,7 @@ struct ov772x_priv {
|
|||||||
struct soc_camera_device icd;
|
struct soc_camera_device icd;
|
||||||
const struct ov772x_color_format *fmt;
|
const struct ov772x_color_format *fmt;
|
||||||
const struct ov772x_win_size *win;
|
const struct ov772x_win_size *win;
|
||||||
|
int model;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ENDMARKER { 0xff, 0xff }
|
#define ENDMARKER { 0xff, 0xff }
|
||||||
@ -702,7 +709,9 @@ static unsigned long ov772x_query_bus_param(struct soc_camera_device *icd)
|
|||||||
static int ov772x_get_chip_id(struct soc_camera_device *icd,
|
static int ov772x_get_chip_id(struct soc_camera_device *icd,
|
||||||
struct v4l2_chip_ident *id)
|
struct v4l2_chip_ident *id)
|
||||||
{
|
{
|
||||||
id->ident = V4L2_IDENT_OV772X;
|
struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
|
||||||
|
|
||||||
|
id->ident = priv->model;
|
||||||
id->revision = 0;
|
id->revision = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -796,6 +805,7 @@ static int ov772x_video_probe(struct soc_camera_device *icd)
|
|||||||
{
|
{
|
||||||
struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
|
struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
|
||||||
u8 pid, ver;
|
u8 pid, ver;
|
||||||
|
const char *devname;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We must have a parent by now. And it cannot be a wrong one.
|
* We must have a parent by now. And it cannot be a wrong one.
|
||||||
@ -822,15 +832,21 @@ static int ov772x_video_probe(struct soc_camera_device *icd)
|
|||||||
*/
|
*/
|
||||||
pid = i2c_smbus_read_byte_data(priv->client, PID);
|
pid = i2c_smbus_read_byte_data(priv->client, PID);
|
||||||
ver = i2c_smbus_read_byte_data(priv->client, VER);
|
ver = i2c_smbus_read_byte_data(priv->client, VER);
|
||||||
if (pid != 0x77 ||
|
|
||||||
ver != 0x21) {
|
switch (VERSION(pid, ver)) {
|
||||||
|
case OV7720:
|
||||||
|
devname = "ov7720";
|
||||||
|
priv->model = V4L2_IDENT_OV7720;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
dev_err(&icd->dev,
|
dev_err(&icd->dev,
|
||||||
"Product ID error %x:%x\n", pid, ver);
|
"Product ID error %x:%x\n", pid, ver);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_info(&icd->dev,
|
dev_info(&icd->dev,
|
||||||
"ov772x Product ID %0x:%0x Manufacturer ID %x:%x\n",
|
"%s Product ID %0x:%0x Manufacturer ID %x:%x\n",
|
||||||
|
devname,
|
||||||
pid,
|
pid,
|
||||||
ver,
|
ver,
|
||||||
i2c_smbus_read_byte_data(priv->client, MIDH),
|
i2c_smbus_read_byte_data(priv->client, MIDH),
|
||||||
@ -921,7 +937,7 @@ static int ov772x_remove(struct i2c_client *client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct i2c_device_id ov772x_id[] = {
|
static const struct i2c_device_id ov772x_id[] = {
|
||||||
{"ov772x", 0},
|
{ "ov772x", 0 },
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(i2c, ov772x_id);
|
MODULE_DEVICE_TABLE(i2c, ov772x_id);
|
||||||
@ -941,7 +957,6 @@ static struct i2c_driver ov772x_i2c_driver = {
|
|||||||
|
|
||||||
static int __init ov772x_module_init(void)
|
static int __init ov772x_module_init(void)
|
||||||
{
|
{
|
||||||
printk(KERN_INFO "ov772x driver\n");
|
|
||||||
return i2c_add_driver(&ov772x_i2c_driver);
|
return i2c_add_driver(&ov772x_i2c_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ enum {
|
|||||||
|
|
||||||
/* OmniVision sensors: reserved range 250-299 */
|
/* OmniVision sensors: reserved range 250-299 */
|
||||||
V4L2_IDENT_OV7670 = 250,
|
V4L2_IDENT_OV7670 = 250,
|
||||||
V4L2_IDENT_OV772X = 251,
|
V4L2_IDENT_OV7720 = 251,
|
||||||
|
|
||||||
/* Conexant MPEG encoder/decoders: reserved range 410-420 */
|
/* Conexant MPEG encoder/decoders: reserved range 410-420 */
|
||||||
V4L2_IDENT_CX23415 = 415,
|
V4L2_IDENT_CX23415 = 415,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user