aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/mt9m032.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-05-09 08:55:59 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-24 08:27:24 -0400
commit5472d3f17845c4398c6a510b46855820920c2181 (patch)
treed26fa76695b9de8b785d19e597757cc8b0b4c469 /drivers/media/video/mt9m032.c
parent8d690c4a4e88297451edd027d37291676bc5b9c4 (diff)
[media] mt9m032: Implement V4L2_CID_PIXEL_RATE control
The pixel rate control is required by the OMAP3 ISP driver and should be implemented by all media controller-compatible sensor drivers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/mt9m032.c')
-rw-r--r--drivers/media/video/mt9m032.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/media/video/mt9m032.c b/drivers/media/video/mt9m032.c
index 3c1e626139b7..445359c96113 100644
--- a/drivers/media/video/mt9m032.c
+++ b/drivers/media/video/mt9m032.c
@@ -688,11 +688,17 @@ static const struct v4l2_subdev_ops mt9m032_ops = {
688static int mt9m032_probe(struct i2c_client *client, 688static int mt9m032_probe(struct i2c_client *client,
689 const struct i2c_device_id *devid) 689 const struct i2c_device_id *devid)
690{ 690{
691 struct mt9m032_platform_data *pdata = client->dev.platform_data;
691 struct i2c_adapter *adapter = client->adapter; 692 struct i2c_adapter *adapter = client->adapter;
692 struct mt9m032 *sensor; 693 struct mt9m032 *sensor;
693 int chip_version; 694 int chip_version;
694 int ret; 695 int ret;
695 696
697 if (pdata == NULL) {
698 dev_err(&client->dev, "No platform data\n");
699 return -EINVAL;
700 }
701
696 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) { 702 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) {
697 dev_warn(&client->dev, 703 dev_warn(&client->dev,
698 "I2C-Adapter doesn't support I2C_FUNC_SMBUS_WORD\n"); 704 "I2C-Adapter doesn't support I2C_FUNC_SMBUS_WORD\n");
@@ -708,7 +714,7 @@ static int mt9m032_probe(struct i2c_client *client,
708 714
709 mutex_init(&sensor->lock); 715 mutex_init(&sensor->lock);
710 716
711 sensor->pdata = client->dev.platform_data; 717 sensor->pdata = pdata;
712 718
713 v4l2_i2c_subdev_init(&sensor->subdev, client, &mt9m032_ops); 719 v4l2_i2c_subdev_init(&sensor->subdev, client, &mt9m032_ops);
714 sensor->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 720 sensor->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
@@ -738,7 +744,7 @@ static int mt9m032_probe(struct i2c_client *client,
738 sensor->format.field = V4L2_FIELD_NONE; 744 sensor->format.field = V4L2_FIELD_NONE;
739 sensor->format.colorspace = V4L2_COLORSPACE_SRGB; 745 sensor->format.colorspace = V4L2_COLORSPACE_SRGB;
740 746
741 v4l2_ctrl_handler_init(&sensor->ctrls, 4); 747 v4l2_ctrl_handler_init(&sensor->ctrls, 5);
742 748
743 v4l2_ctrl_new_std(&sensor->ctrls, &mt9m032_ctrl_ops, 749 v4l2_ctrl_new_std(&sensor->ctrls, &mt9m032_ctrl_ops,
744 V4L2_CID_GAIN, 0, 127, 1, 64); 750 V4L2_CID_GAIN, 0, 127, 1, 64);
@@ -754,6 +760,9 @@ static int mt9m032_probe(struct i2c_client *client,
754 V4L2_CID_EXPOSURE, MT9M032_SHUTTER_WIDTH_MIN, 760 V4L2_CID_EXPOSURE, MT9M032_SHUTTER_WIDTH_MIN,
755 MT9M032_SHUTTER_WIDTH_MAX, 1, 761 MT9M032_SHUTTER_WIDTH_MAX, 1,
756 MT9M032_SHUTTER_WIDTH_DEF); 762 MT9M032_SHUTTER_WIDTH_DEF);
763 v4l2_ctrl_new_std(&sensor->ctrls, &mt9m032_ctrl_ops,
764 V4L2_CID_PIXEL_RATE, pdata->pix_clock,
765 pdata->pix_clock, 1, pdata->pix_clock);
757 766
758 if (sensor->ctrls.error) { 767 if (sensor->ctrls.error) {
759 ret = sensor->ctrls.error; 768 ret = sensor->ctrls.error;