[media] mt9t001: 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>
This commit is contained in:
parent
71006fb22b
commit
0bc77f3f06
|
@ -691,7 +691,7 @@ static int mt9t001_video_probe(struct i2c_client *client)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* Configure the pixel clock polarity */
|
/* Configure the pixel clock polarity */
|
||||||
if (pdata && pdata->clk_pol) {
|
if (pdata->clk_pol) {
|
||||||
ret = mt9t001_write(client, MT9T001_PIXEL_CLOCK,
|
ret = mt9t001_write(client, MT9T001_PIXEL_CLOCK,
|
||||||
MT9T001_PIXEL_CLOCK_INVERT);
|
MT9T001_PIXEL_CLOCK_INVERT);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -715,10 +715,16 @@ static int mt9t001_video_probe(struct i2c_client *client)
|
||||||
static int mt9t001_probe(struct i2c_client *client,
|
static int mt9t001_probe(struct i2c_client *client,
|
||||||
const struct i2c_device_id *did)
|
const struct i2c_device_id *did)
|
||||||
{
|
{
|
||||||
|
struct mt9t001_platform_data *pdata = client->dev.platform_data;
|
||||||
struct mt9t001 *mt9t001;
|
struct mt9t001 *mt9t001;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (pdata == NULL) {
|
||||||
|
dev_err(&client->dev, "No platform data\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!i2c_check_functionality(client->adapter,
|
if (!i2c_check_functionality(client->adapter,
|
||||||
I2C_FUNC_SMBUS_WORD_DATA)) {
|
I2C_FUNC_SMBUS_WORD_DATA)) {
|
||||||
dev_warn(&client->adapter->dev,
|
dev_warn(&client->adapter->dev,
|
||||||
|
@ -735,7 +741,7 @@ static int mt9t001_probe(struct i2c_client *client,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
v4l2_ctrl_handler_init(&mt9t001->ctrls, ARRAY_SIZE(mt9t001_ctrls) +
|
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_ctrl_new_std(&mt9t001->ctrls, &mt9t001_ctrl_ops,
|
||||||
V4L2_CID_EXPOSURE, MT9T001_SHUTTER_WIDTH_MIN,
|
V4L2_CID_EXPOSURE, MT9T001_SHUTTER_WIDTH_MIN,
|
||||||
|
@ -743,6 +749,9 @@ static int mt9t001_probe(struct i2c_client *client,
|
||||||
MT9T001_SHUTTER_WIDTH_DEF);
|
MT9T001_SHUTTER_WIDTH_DEF);
|
||||||
v4l2_ctrl_new_std(&mt9t001->ctrls, &mt9t001_ctrl_ops,
|
v4l2_ctrl_new_std(&mt9t001->ctrls, &mt9t001_ctrl_ops,
|
||||||
V4L2_CID_BLACK_LEVEL, 1, 1, 1, 1);
|
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)
|
for (i = 0; i < ARRAY_SIZE(mt9t001_ctrls); ++i)
|
||||||
v4l2_ctrl_new_custom(&mt9t001->ctrls, &mt9t001_ctrls[i], NULL);
|
v4l2_ctrl_new_custom(&mt9t001->ctrls, &mt9t001_ctrls[i], NULL);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
struct mt9t001_platform_data {
|
struct mt9t001_platform_data {
|
||||||
unsigned int clk_pol:1;
|
unsigned int clk_pol:1;
|
||||||
|
unsigned int ext_clk;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue