diff options
| -rw-r--r-- | drivers/media/i2c/soc_camera/mt9m111.c | 12 |
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 | } |
| 1024 | static const struct of_device_id mt9m111_of_match[] = { | ||
| 1025 | { .compatible = "micron,mt9m111", }, | ||
| 1026 | {}, | ||
| 1027 | }; | ||
| 1028 | MODULE_DEVICE_TABLE(of, mt9m111_of_match); | ||
| 1018 | 1029 | ||
| 1019 | static const struct i2c_device_id mt9m111_id[] = { | 1030 | static const struct i2c_device_id mt9m111_id[] = { |
| 1020 | { "mt9m111", 0 }, | 1031 | { "mt9m111", 0 }, |
| @@ -1025,6 +1036,7 @@ MODULE_DEVICE_TABLE(i2c, mt9m111_id); | |||
| 1025 | static struct i2c_driver mt9m111_i2c_driver = { | 1036 | static 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, |
