summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/mt9m001.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2019-01-08 12:51:46 -0200
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-01-25 10:54:51 -0200
commit12d85c3e275be6b72fb815eb03d15cab31ee10c1 (patch)
tree326c0c048a890d262eae0afaffb1a4999ab2af3b /drivers/media/i2c/mt9m001.c
parent74021329a76b049d8f411828867d80fc288d2e5a (diff)
downloadlwn-12d85c3e275be6b72fb815eb03d15cab31ee10c1.tar.gz
lwn-12d85c3e275be6b72fb815eb03d15cab31ee10c1.zip
media: mt9m001: add media controller support
Create a source pad and set the media controller type to the sensor. Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/i2c/mt9m001.c')
-rw-r--r--drivers/media/i2c/mt9m001.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/media/i2c/mt9m001.c b/drivers/media/i2c/mt9m001.c
index 5a3b61238fca..0a648e2df00d 100644
--- a/drivers/media/i2c/mt9m001.c
+++ b/drivers/media/i2c/mt9m001.c
@@ -103,6 +103,7 @@ struct mt9m001 {
int num_fmts;
unsigned int total_h;
unsigned short y_skip_top; /* Lines to skip at the top */
+ struct media_pad pad;
};
static struct mt9m001 *to_mt9m001(const struct i2c_client *client)
@@ -761,6 +762,12 @@ static int mt9m001_probe(struct i2c_client *client,
if (ret)
goto error_power_off;
+ mt9m001->pad.flags = MEDIA_PAD_FL_SOURCE;
+ mt9m001->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR;
+ ret = media_entity_pads_init(&mt9m001->subdev.entity, 1, &mt9m001->pad);
+ if (ret)
+ goto error_power_off;
+
pm_runtime_idle(&client->dev);
return 0;
@@ -784,6 +791,8 @@ static int mt9m001_remove(struct i2c_client *client)
v4l2_device_unregister_subdev(&mt9m001->subdev);
pm_runtime_get_sync(&client->dev);
+ media_entity_cleanup(&mt9m001->subdev.entity);
+
pm_runtime_disable(&client->dev);
pm_runtime_set_suspended(&client->dev);
pm_runtime_put_noidle(&client->dev);