[02/19] media: adv748x: Add flags to adv748x_subdev_init()
Commit Message
Add a flags parameter to the adv748x_subdev_init() function that
allows to pass additional flags to the v4l2_subdevice.
This will be used to identify the CSI-2 subdevices as multiplexed.
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
---
drivers/media/i2c/adv748x/adv748x-afe.c | 2 +-
drivers/media/i2c/adv748x/adv748x-core.c | 4 ++--
drivers/media/i2c/adv748x/adv748x-csi2.c | 2 +-
drivers/media/i2c/adv748x/adv748x-hdmi.c | 2 +-
drivers/media/i2c/adv748x/adv748x.h | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
Comments
Hi Jacopo,
Thank you for the patch.
On Tue, Apr 30, 2024 at 12:39:38PM +0200, Jacopo Mondi wrote:
> Add a flags parameter to the adv748x_subdev_init() function that
> allows to pass additional flags to the v4l2_subdevice.
>
> This will be used to identify the CSI-2 subdevices as multiplexed.
"as supporting streams" ?
>
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> ---
> drivers/media/i2c/adv748x/adv748x-afe.c | 2 +-
> drivers/media/i2c/adv748x/adv748x-core.c | 4 ++--
> drivers/media/i2c/adv748x/adv748x-csi2.c | 2 +-
> drivers/media/i2c/adv748x/adv748x-hdmi.c | 2 +-
> drivers/media/i2c/adv748x/adv748x.h | 2 +-
> 5 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/i2c/adv748x/adv748x-afe.c b/drivers/media/i2c/adv748x/adv748x-afe.c
> index 50d9fbadbe38..5951ddebc59d 100644
> --- a/drivers/media/i2c/adv748x/adv748x-afe.c
> +++ b/drivers/media/i2c/adv748x/adv748x-afe.c
> @@ -510,7 +510,7 @@ int adv748x_afe_init(struct adv748x_afe *afe)
> afe->curr_norm = V4L2_STD_NTSC_M;
>
> adv748x_subdev_init(&afe->sd, state, &adv748x_afe_ops,
> - MEDIA_ENT_F_ATV_DECODER, "afe");
> + MEDIA_ENT_F_ATV_DECODER, 0, "afe");
>
> /* Identify the first connector found as a default input if set */
> for (i = ADV748X_PORT_AIN0; i <= ADV748X_PORT_AIN7; i++) {
> diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c
> index 3eb6d5e8f082..3abc73ea8ccb 100644
> --- a/drivers/media/i2c/adv748x/adv748x-core.c
> +++ b/drivers/media/i2c/adv748x/adv748x-core.c
> @@ -583,10 +583,10 @@ static int __maybe_unused adv748x_resume_early(struct device *dev)
>
> void adv748x_subdev_init(struct v4l2_subdev *sd, struct adv748x_state *state,
> const struct v4l2_subdev_ops *ops, u32 function,
> - const char *ident)
> + u32 flags, const char *ident)
I'd name the argument sd_flags to make it clearer. Apart from that,
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> {
> v4l2_subdev_init(sd, ops);
> - sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> + sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | flags;
>
> /* the owner is the same as the i2c_client's driver owner */
> sd->owner = state->dev->driver->owner;
> diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c
> index 435b0909bbef..60bf1dc0f58b 100644
> --- a/drivers/media/i2c/adv748x/adv748x-csi2.c
> +++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
> @@ -245,7 +245,7 @@ int adv748x_csi2_init(struct adv748x_state *state, struct adv748x_csi2 *tx)
> return 0;
>
> adv748x_subdev_init(&tx->sd, state, &adv748x_csi2_ops,
> - MEDIA_ENT_F_VID_IF_BRIDGE,
> + MEDIA_ENT_F_VID_IF_BRIDGE, 0,
> is_txa(tx) ? "txa" : "txb");
>
> /* Register internal ops for incremental subdev registration */
> diff --git a/drivers/media/i2c/adv748x/adv748x-hdmi.c b/drivers/media/i2c/adv748x/adv748x-hdmi.c
> index a4db9bae5f79..9e4a5aa4ed55 100644
> --- a/drivers/media/i2c/adv748x/adv748x-hdmi.c
> +++ b/drivers/media/i2c/adv748x/adv748x-hdmi.c
> @@ -741,7 +741,7 @@ int adv748x_hdmi_init(struct adv748x_hdmi *hdmi)
> hdmi->aspect_ratio.denominator = 9;
>
> adv748x_subdev_init(&hdmi->sd, state, &adv748x_ops_hdmi,
> - MEDIA_ENT_F_IO_DTV, "hdmi");
> + MEDIA_ENT_F_IO_DTV, 0, "hdmi");
>
> hdmi->pads[ADV748X_HDMI_SINK].flags = MEDIA_PAD_FL_SINK;
> hdmi->pads[ADV748X_HDMI_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
> diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h
> index 9bc0121d0eff..be24bc57767c 100644
> --- a/drivers/media/i2c/adv748x/adv748x.h
> +++ b/drivers/media/i2c/adv748x/adv748x.h
> @@ -424,7 +424,7 @@ static inline struct v4l2_subdev *adv748x_get_remote_sd(struct media_pad *pad)
>
> void adv748x_subdev_init(struct v4l2_subdev *sd, struct adv748x_state *state,
> const struct v4l2_subdev_ops *ops, u32 function,
> - const char *ident);
> + u32 flags, const char *ident);
>
> int adv748x_tx_power(struct adv748x_csi2 *tx, bool on);
>
@@ -510,7 +510,7 @@ int adv748x_afe_init(struct adv748x_afe *afe)
afe->curr_norm = V4L2_STD_NTSC_M;
adv748x_subdev_init(&afe->sd, state, &adv748x_afe_ops,
- MEDIA_ENT_F_ATV_DECODER, "afe");
+ MEDIA_ENT_F_ATV_DECODER, 0, "afe");
/* Identify the first connector found as a default input if set */
for (i = ADV748X_PORT_AIN0; i <= ADV748X_PORT_AIN7; i++) {
@@ -583,10 +583,10 @@ static int __maybe_unused adv748x_resume_early(struct device *dev)
void adv748x_subdev_init(struct v4l2_subdev *sd, struct adv748x_state *state,
const struct v4l2_subdev_ops *ops, u32 function,
- const char *ident)
+ u32 flags, const char *ident)
{
v4l2_subdev_init(sd, ops);
- sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+ sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | flags;
/* the owner is the same as the i2c_client's driver owner */
sd->owner = state->dev->driver->owner;
@@ -245,7 +245,7 @@ int adv748x_csi2_init(struct adv748x_state *state, struct adv748x_csi2 *tx)
return 0;
adv748x_subdev_init(&tx->sd, state, &adv748x_csi2_ops,
- MEDIA_ENT_F_VID_IF_BRIDGE,
+ MEDIA_ENT_F_VID_IF_BRIDGE, 0,
is_txa(tx) ? "txa" : "txb");
/* Register internal ops for incremental subdev registration */
@@ -741,7 +741,7 @@ int adv748x_hdmi_init(struct adv748x_hdmi *hdmi)
hdmi->aspect_ratio.denominator = 9;
adv748x_subdev_init(&hdmi->sd, state, &adv748x_ops_hdmi,
- MEDIA_ENT_F_IO_DTV, "hdmi");
+ MEDIA_ENT_F_IO_DTV, 0, "hdmi");
hdmi->pads[ADV748X_HDMI_SINK].flags = MEDIA_PAD_FL_SINK;
hdmi->pads[ADV748X_HDMI_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
@@ -424,7 +424,7 @@ static inline struct v4l2_subdev *adv748x_get_remote_sd(struct media_pad *pad)
void adv748x_subdev_init(struct v4l2_subdev *sd, struct adv748x_state *state,
const struct v4l2_subdev_ops *ops, u32 function,
- const char *ident);
+ u32 flags, const char *ident);
int adv748x_tx_power(struct adv748x_csi2 *tx, bool on);