Skip to content

Commit

Permalink
[media] mt9t001: Implement V4L2_CID_PIXEL_RATE control
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Laurent Pinchart authored and Mauro Carvalho Chehab committed May 24, 2012
1 parent 71006fb commit 0bc77f3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions drivers/media/video/mt9t001.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ static int mt9t001_video_probe(struct i2c_client *client)
return ret;

/* Configure the pixel clock polarity */
if (pdata && pdata->clk_pol) {
if (pdata->clk_pol) {
ret = mt9t001_write(client, MT9T001_PIXEL_CLOCK,
MT9T001_PIXEL_CLOCK_INVERT);
if (ret < 0)
Expand All @@ -715,10 +715,16 @@ static int mt9t001_video_probe(struct i2c_client *client)
static int mt9t001_probe(struct i2c_client *client,
const struct i2c_device_id *did)
{
struct mt9t001_platform_data *pdata = client->dev.platform_data;
struct mt9t001 *mt9t001;
unsigned int i;
int ret;

if (pdata == NULL) {
dev_err(&client->dev, "No platform data\n");
return -EINVAL;
}

if (!i2c_check_functionality(client->adapter,
I2C_FUNC_SMBUS_WORD_DATA)) {
dev_warn(&client->adapter->dev,
Expand All @@ -735,14 +741,17 @@ static int mt9t001_probe(struct i2c_client *client,
return -ENOMEM;

v4l2_ctrl_handler_init(&mt9t001->ctrls, ARRAY_SIZE(mt9t001_ctrls) +
ARRAY_SIZE(mt9t001_gains) + 2);
ARRAY_SIZE(mt9t001_gains) + 3);

v4l2_ctrl_new_std(&mt9t001->ctrls, &mt9t001_ctrl_ops,
V4L2_CID_EXPOSURE, MT9T001_SHUTTER_WIDTH_MIN,
MT9T001_SHUTTER_WIDTH_MAX, 1,
MT9T001_SHUTTER_WIDTH_DEF);
v4l2_ctrl_new_std(&mt9t001->ctrls, &mt9t001_ctrl_ops,
V4L2_CID_BLACK_LEVEL, 1, 1, 1, 1);
v4l2_ctrl_new_std(&mt9t001->ctrls, &mt9t001_ctrl_ops,
V4L2_CID_PIXEL_RATE, pdata->ext_clk, pdata->ext_clk,
1, pdata->ext_clk);

for (i = 0; i < ARRAY_SIZE(mt9t001_ctrls); ++i)
v4l2_ctrl_new_custom(&mt9t001->ctrls, &mt9t001_ctrls[i], NULL);
Expand Down
1 change: 1 addition & 0 deletions include/media/mt9t001.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

struct mt9t001_platform_data {
unsigned int clk_pol:1;
unsigned int ext_clk;
};

#endif

0 comments on commit 0bc77f3

Please sign in to comment.