Hi Hans,

Thank you for the patch.

On Wednesday 17 Aug 2016 08:29:37 Hans Verkuil wrote:
> From: Hans Verkuil <hans.verk...@cisco.com>
> 
> Add media controller support.
> 
> Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>
> ---
>  drivers/media/i2c/ov7670.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
> index 56cfb5c..25f46c7 100644
> --- a/drivers/media/i2c/ov7670.c
> +++ b/drivers/media/i2c/ov7670.c
> @@ -210,6 +210,7 @@ struct ov7670_devtype {
>  struct ov7670_format_struct;  /* coming later */
>  struct ov7670_info {
>       struct v4l2_subdev sd;
> +     struct media_pad pad;

You could guard this with #if defined(CONFIG_MEDIA_CONTROLLER) as well. I'm 
wondering, however, whether we shouldn't start making CONFIG_MEDIA_CONTROLLER 
mandatory for I2C sensors.

>       struct v4l2_ctrl_handler hdl;
>       struct {
>               /* gain cluster */
> @@ -1641,6 +1642,16 @@ static int ov7670_probe(struct i2c_client *client,
>               v4l2_ctrl_handler_free(&info->hdl);
>               return err;
>       }
> +
> +#if defined(CONFIG_MEDIA_CONTROLLER)
> +     info->pad.flags = MEDIA_PAD_FL_SOURCE;
> +     info->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
> +     ret = media_entity_pads_init(&info->sd.entity, 1, &info->pad);
> +     if (ret < 0) {
> +             v4l2_ctrl_handler_free(&info->hdl);
> +             return ret;
> +     }
> +#endif
>       /*
>        * We have checked empirically that hw allows to read back the gain
>        * value chosen by auto gain but that's not the case for auto 
exposure.
> @@ -1662,6 +1673,9 @@ static int ov7670_remove(struct i2c_client *client)
> 
>       v4l2_device_unregister_subdev(sd);
>       v4l2_ctrl_handler_free(&info->hdl);
> +#if defined(CONFIG_MEDIA_CONTROLLER)
> +     media_entity_cleanup(&sd->entity);
> +#endif
>       return 0;
>  }

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to