aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorKuninori Morimoto <morimoto.kuninori@renesas.com>2008-12-18 09:05:49 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:40:15 -0500
commitaeabc882a3ad9a320783815e0446b12526fd2102 (patch)
treec4152a91aebf18985c7f0e1fb9ab769fd086ac86 /drivers/media
parent2d425131d2c44228c4390d2d48d302f3e122bc49 (diff)
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>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/ov772x.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index a2d51e27e48d..305befab8943 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -346,6 +346,12 @@
346#define OP_SWAP_RGB 0x00000002 346#define OP_SWAP_RGB 0x00000002
347 347
348/* 348/*
349 * ID
350 */
351#define OV7720 0x7720
352#define VERSION(pid, ver) ((pid<<8)|(ver&0xFF))
353
354/*
349 * struct 355 * struct
350 */ 356 */
351struct regval_list { 357struct regval_list {
@@ -374,6 +380,7 @@ struct ov772x_priv {
374 struct soc_camera_device icd; 380 struct soc_camera_device icd;
375 const struct ov772x_color_format *fmt; 381 const struct ov772x_color_format *fmt;
376 const struct ov772x_win_size *win; 382 const struct ov772x_win_size *win;
383 int model;
377}; 384};
378 385
379#define ENDMARKER { 0xff, 0xff } 386#define ENDMARKER { 0xff, 0xff }
@@ -702,7 +709,9 @@ static unsigned long ov772x_query_bus_param(struct soc_camera_device *icd)
702static int ov772x_get_chip_id(struct soc_camera_device *icd, 709static int ov772x_get_chip_id(struct soc_camera_device *icd,
703 struct v4l2_chip_ident *id) 710 struct v4l2_chip_ident *id)
704{ 711{
705 id->ident = V4L2_IDENT_OV772X; 712 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
713
714 id->ident = priv->model;
706 id->revision = 0; 715 id->revision = 0;
707 716
708 return 0; 717 return 0;
@@ -796,6 +805,7 @@ static int ov772x_video_probe(struct soc_camera_device *icd)
796{ 805{
797 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd); 806 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
798 u8 pid, ver; 807 u8 pid, ver;
808 const char *devname;
799 809
800 /* 810 /*
801 * We must have a parent by now. And it cannot be a wrong one. 811 * 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)
822 */ 832 */
823 pid = i2c_smbus_read_byte_data(priv->client, PID); 833 pid = i2c_smbus_read_byte_data(priv->client, PID);
824 ver = i2c_smbus_read_byte_data(priv->client, VER); 834 ver = i2c_smbus_read_byte_data(priv->client, VER);
825 if (pid != 0x77 || 835
826 ver != 0x21) { 836 switch (VERSION(pid, ver)) {
837 case OV7720:
838 devname = "ov7720";
839 priv->model = V4L2_IDENT_OV7720;
840 break;
841 default:
827 dev_err(&icd->dev, 842 dev_err(&icd->dev,
828 "Product ID error %x:%x\n", pid, ver); 843 "Product ID error %x:%x\n", pid, ver);
829 return -ENODEV; 844 return -ENODEV;
830 } 845 }
831 846
832 dev_info(&icd->dev, 847 dev_info(&icd->dev,
833 "ov772x Product ID %0x:%0x Manufacturer ID %x:%x\n", 848 "%s Product ID %0x:%0x Manufacturer ID %x:%x\n",
849 devname,
834 pid, 850 pid,
835 ver, 851 ver,
836 i2c_smbus_read_byte_data(priv->client, MIDH), 852 i2c_smbus_read_byte_data(priv->client, MIDH),
@@ -921,7 +937,7 @@ static int ov772x_remove(struct i2c_client *client)
921} 937}
922 938
923static const struct i2c_device_id ov772x_id[] = { 939static const struct i2c_device_id ov772x_id[] = {
924 {"ov772x", 0}, 940 { "ov772x", 0 },
925 { } 941 { }
926}; 942};
927MODULE_DEVICE_TABLE(i2c, ov772x_id); 943MODULE_DEVICE_TABLE(i2c, ov772x_id);
@@ -941,7 +957,6 @@ static struct i2c_driver ov772x_i2c_driver = {
941 957
942static int __init ov772x_module_init(void) 958static int __init ov772x_module_init(void)
943{ 959{
944 printk(KERN_INFO "ov772x driver\n");
945 return i2c_add_driver(&ov772x_i2c_driver); 960 return i2c_add_driver(&ov772x_i2c_driver);
946} 961}
947 962