aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorRobert Jarzmik <robert.jarzmik@free.fr>2014-06-21 18:19:54 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-07-30 18:30:35 -0400
commitc5f176dc19870a424d6089317030f7b59ea1bafc (patch)
treec6fd8a5c4db6a10c323f72539aa8961ebb35cebb /drivers/media
parent1ddc6a6caa94e1e19e8c657a9a6cbbecd39e63bd (diff)
[media] media: mt9m111: add device-tree suppport
Add device-tree support for mt9m111 camera sensor. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/i2c/soc_camera/mt9m111.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/media/i2c/soc_camera/mt9m111.c b/drivers/media/i2c/soc_camera/mt9m111.c
index ccf59406a172..b51e8562e775 100644
--- a/drivers/media/i2c/soc_camera/mt9m111.c
+++ b/drivers/media/i2c/soc_camera/mt9m111.c
@@ -931,6 +931,12 @@ static int mt9m111_probe(struct i2c_client *client,
931 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); 931 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
932 int ret; 932 int ret;
933 933
934 if (client->dev.of_node) {
935 ssdd = devm_kzalloc(&client->dev, sizeof(*ssdd), GFP_KERNEL);
936 if (!ssdd)
937 return -ENOMEM;
938 client->dev.platform_data = ssdd;
939 }
934 if (!ssdd) { 940 if (!ssdd) {
935 dev_err(&client->dev, "mt9m111: driver needs platform data\n"); 941 dev_err(&client->dev, "mt9m111: driver needs platform data\n");
936 return -EINVAL; 942 return -EINVAL;
@@ -1015,6 +1021,11 @@ static int mt9m111_remove(struct i2c_client *client)
1015 1021
1016 return 0; 1022 return 0;
1017} 1023}
1024static const struct of_device_id mt9m111_of_match[] = {
1025 { .compatible = "micron,mt9m111", },
1026 {},
1027};
1028MODULE_DEVICE_TABLE(of, mt9m111_of_match);
1018 1029
1019static const struct i2c_device_id mt9m111_id[] = { 1030static const struct i2c_device_id mt9m111_id[] = {
1020 { "mt9m111", 0 }, 1031 { "mt9m111", 0 },
@@ -1025,6 +1036,7 @@ MODULE_DEVICE_TABLE(i2c, mt9m111_id);
1025static struct i2c_driver mt9m111_i2c_driver = { 1036static struct i2c_driver mt9m111_i2c_driver = {
1026 .driver = { 1037 .driver = {
1027 .name = "mt9m111", 1038 .name = "mt9m111",
1039 .of_match_table = of_match_ptr(mt9m111_of_match),
1028 }, 1040 },
1029 .probe = mt9m111_probe, 1041 .probe = mt9m111_probe,
1030 .remove = mt9m111_remove, 1042 .remove = mt9m111_remove,