aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorMike Rapoport <mike@compulab.co.il>2008-12-18 09:44:15 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:40:20 -0500
commitd7f83a5106f2da9eb59bf49e7b48414e27d6618a (patch)
tree7f43ebfd9a58d5dcbbbc2d7d6a39625fc4e53d42 /drivers/media/video
parent9b9fd6c71fb46a4a710040c8ef28f1e84b88a830 (diff)
V4L/DVB (10077): mt9m111: add support for mt9m112 since sensors seem identical
Signed-off-by: Mike Rapoport <mike@compulab.co.il> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/Kconfig4
-rw-r--r--drivers/media/video/mt9m111.c28
2 files changed, 18 insertions, 14 deletions
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index eb9ff7e107d6..da538d9ca303 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -736,10 +736,10 @@ config MT9M001_PCA9536_SWITCH
736 extender to switch between 8 and 10 bit datawidth modes 736 extender to switch between 8 and 10 bit datawidth modes
737 737
738config SOC_CAMERA_MT9M111 738config SOC_CAMERA_MT9M111
739 tristate "mt9m111 support" 739 tristate "mt9m111 and mt9m112 support"
740 depends on SOC_CAMERA && I2C 740 depends on SOC_CAMERA && I2C
741 help 741 help
742 This driver supports MT9M111 cameras from Micron 742 This driver supports MT9M111 and MT9M112 cameras from Micron
743 743
744config SOC_CAMERA_MT9V022 744config SOC_CAMERA_MT9V022
745 tristate "mt9v022 support" 745 tristate "mt9v022 support"
diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c
index 2ab1e0f4925d..3dfeea4e94b1 100644
--- a/drivers/media/video/mt9m111.c
+++ b/drivers/media/video/mt9m111.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Driver for MT9M111 CMOS Image Sensor from Micron 2 * Driver for MT9M111/MT9M112 CMOS Image Sensor from Micron
3 * 3 *
4 * Copyright (C) 2008, Robert Jarzmik <robert.jarzmik@free.fr> 4 * Copyright (C) 2008, Robert Jarzmik <robert.jarzmik@free.fr>
5 * 5 *
@@ -19,7 +19,7 @@
19#include <media/soc_camera.h> 19#include <media/soc_camera.h>
20 20
21/* 21/*
22 * mt9m111 i2c address is 0x5d or 0x48 (depending on SAddr pin) 22 * mt9m111 and mt9m112 i2c address is 0x5d or 0x48 (depending on SAddr pin)
23 * The platform has to define i2c_board_info and call i2c_register_board_info() 23 * The platform has to define i2c_board_info and call i2c_register_board_info()
24 */ 24 */
25 25
@@ -150,7 +150,7 @@ enum mt9m111_context {
150struct mt9m111 { 150struct mt9m111 {
151 struct i2c_client *client; 151 struct i2c_client *client;
152 struct soc_camera_device icd; 152 struct soc_camera_device icd;
153 int model; /* V4L2_IDENT_MT9M111* codes from v4l2-chip-ident.h */ 153 int model; /* V4L2_IDENT_MT9M11x* codes from v4l2-chip-ident.h */
154 enum mt9m111_context context; 154 enum mt9m111_context context;
155 unsigned int left, top, width, height; 155 unsigned int left, top, width, height;
156 u32 pixfmt; 156 u32 pixfmt;
@@ -846,7 +846,7 @@ static int mt9m111_init(struct soc_camera_device *icd)
846 if (!ret) 846 if (!ret)
847 ret = mt9m111_set_autoexposure(icd, mt9m111->autoexposure); 847 ret = mt9m111_set_autoexposure(icd, mt9m111->autoexposure);
848 if (ret) 848 if (ret)
849 dev_err(&icd->dev, "mt9m111 init failed: %d\n", ret); 849 dev_err(&icd->dev, "mt9m11x init failed: %d\n", ret);
850 return ret; 850 return ret;
851} 851}
852 852
@@ -856,7 +856,7 @@ static int mt9m111_release(struct soc_camera_device *icd)
856 856
857 ret = mt9m111_disable(icd); 857 ret = mt9m111_disable(icd);
858 if (ret < 0) 858 if (ret < 0)
859 dev_err(&icd->dev, "mt9m111 release failed: %d\n", ret); 859 dev_err(&icd->dev, "mt9m11x release failed: %d\n", ret);
860 860
861 return ret; 861 return ret;
862} 862}
@@ -889,19 +889,23 @@ static int mt9m111_video_probe(struct soc_camera_device *icd)
889 data = reg_read(CHIP_VERSION); 889 data = reg_read(CHIP_VERSION);
890 890
891 switch (data) { 891 switch (data) {
892 case 0x143a: 892 case 0x143a: /* MT9M111 */
893 mt9m111->model = V4L2_IDENT_MT9M111; 893 mt9m111->model = V4L2_IDENT_MT9M111;
894 icd->formats = mt9m111_colour_formats; 894 break;
895 icd->num_formats = ARRAY_SIZE(mt9m111_colour_formats); 895 case 0x148c: /* MT9M112 */
896 mt9m111->model = V4L2_IDENT_MT9M112;
896 break; 897 break;
897 default: 898 default:
898 ret = -ENODEV; 899 ret = -ENODEV;
899 dev_err(&icd->dev, 900 dev_err(&icd->dev,
900 "No MT9M111 chip detected, register read %x\n", data); 901 "No MT9M11x chip detected, register read %x\n", data);
901 goto ei2c; 902 goto ei2c;
902 } 903 }
903 904
904 dev_info(&icd->dev, "Detected a MT9M111 chip ID 0x143a\n"); 905 icd->formats = mt9m111_colour_formats;
906 icd->num_formats = ARRAY_SIZE(mt9m111_colour_formats);
907
908 dev_info(&icd->dev, "Detected a MT9M11x chip ID %x\n", data);
905 909
906 ret = soc_camera_video_start(icd); 910 ret = soc_camera_video_start(icd);
907 if (ret) 911 if (ret)
@@ -938,7 +942,7 @@ static int mt9m111_probe(struct i2c_client *client,
938 int ret; 942 int ret;
939 943
940 if (!icl) { 944 if (!icl) {
941 dev_err(&client->dev, "MT9M111 driver needs platform data\n"); 945 dev_err(&client->dev, "MT9M11x driver needs platform data\n");
942 return -EINVAL; 946 return -EINVAL;
943 } 947 }
944 948
@@ -1017,6 +1021,6 @@ static void __exit mt9m111_mod_exit(void)
1017module_init(mt9m111_mod_init); 1021module_init(mt9m111_mod_init);
1018module_exit(mt9m111_mod_exit); 1022module_exit(mt9m111_mod_exit);
1019 1023
1020MODULE_DESCRIPTION("Micron MT9M111 Camera driver"); 1024MODULE_DESCRIPTION("Micron MT9M111/MT9M112 Camera driver");
1021MODULE_AUTHOR("Robert Jarzmik"); 1025MODULE_AUTHOR("Robert Jarzmik");
1022MODULE_LICENSE("GPL"); 1026MODULE_LICENSE("GPL");