diff mbox series

[v10,7/9] media: intel/ipu6: Obtain link frequency from the remote subdev pad

Message ID 20250120110157.152732-8-sakari.ailus@linux.intel.com (mailing list archive)
State New
Headers show
Series Use V4L2 mbus config for conveying link frequency | expand

Commit Message

Sakari Ailus Jan. 20, 2025, 11:01 a.m. UTC
Obtain the link frequency from the sub-device's pad instead of a control
handler. This allows obtaining it using the get_mbus_config() sub-device
pad op which is the only method supported by the IVSC driver.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

Comments

Tomi Valkeinen Jan. 31, 2025, 4:24 p.m. UTC | #1
Hi,

On 20/01/2025 13:01, Sakari Ailus wrote:
> Obtain the link frequency from the sub-device's pad instead of a control
> handler. This allows obtaining it using the get_mbus_config() sub-device
> pad op which is the only method supported by the IVSC driver.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>   drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c | 12 +++---------
>   1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
> index 051898ce53f4..da8581a37e22 100644
> --- a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
> +++ b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
> @@ -80,25 +80,19 @@ static const struct ipu6_csi2_error dphy_rx_errors[] = {
>   s64 ipu6_isys_csi2_get_link_freq(struct ipu6_isys_csi2 *csi2)
>   {
>   	struct media_pad *src_pad;
> -	struct v4l2_subdev *ext_sd;
> -	struct device *dev;
>   
>   	if (!csi2)
>   		return -EINVAL;
>   
> -	dev = &csi2->isys->adev->auxdev.dev;
>   	src_pad = media_entity_remote_source_pad_unique(&csi2->asd.sd.entity);
>   	if (IS_ERR(src_pad)) {
> -		dev_err(dev, "can't get source pad of %s (%ld)\n",
> +		dev_err(&csi2->isys->adev->auxdev.dev,

This looks like an extra change. I would have kept the "dev", but up to you.

> +			"can't get source pad of %s (%ld)\n",
>   			csi2->asd.sd.name, PTR_ERR(src_pad));
>   		return PTR_ERR(src_pad);
>   	}
>   
> -	ext_sd = media_entity_to_v4l2_subdev(src_pad->entity);
> -	if (WARN(!ext_sd, "Failed to get subdev for %s\n", csi2->asd.sd.name))
> -		return -ENODEV;
> -
> -	return v4l2_get_link_freq(ext_sd->ctrl_handler, 0, 0);
> +	return v4l2_get_link_freq(src_pad, 0, 0);
>   }
>   
>   static int csi2_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>


  Tomi
Sakari Ailus Feb. 3, 2025, 9:12 a.m. UTC | #2
Moi,

On Fri, Jan 31, 2025 at 06:24:44PM +0200, Tomi Valkeinen wrote:
> Hi,
> 
> On 20/01/2025 13:01, Sakari Ailus wrote:
> > Obtain the link frequency from the sub-device's pad instead of a control
> > handler. This allows obtaining it using the get_mbus_config() sub-device
> > pad op which is the only method supported by the IVSC driver.
> > 
> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > ---
> >   drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c | 12 +++---------
> >   1 file changed, 3 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
> > index 051898ce53f4..da8581a37e22 100644
> > --- a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
> > +++ b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
> > @@ -80,25 +80,19 @@ static const struct ipu6_csi2_error dphy_rx_errors[] = {
> >   s64 ipu6_isys_csi2_get_link_freq(struct ipu6_isys_csi2 *csi2)
> >   {
> >   	struct media_pad *src_pad;
> > -	struct v4l2_subdev *ext_sd;
> > -	struct device *dev;
> >   	if (!csi2)
> >   		return -EINVAL;
> > -	dev = &csi2->isys->adev->auxdev.dev;
> >   	src_pad = media_entity_remote_source_pad_unique(&csi2->asd.sd.entity);
> >   	if (IS_ERR(src_pad)) {
> > -		dev_err(dev, "can't get source pad of %s (%ld)\n",
> > +		dev_err(&csi2->isys->adev->auxdev.dev,
> 
> This looks like an extra change. I would have kept the "dev", but up to you.

I thought putting that into a local variable isn't worth it as there is
just a single user left.

> 
> > +			"can't get source pad of %s (%ld)\n",
> >   			csi2->asd.sd.name, PTR_ERR(src_pad));
> >   		return PTR_ERR(src_pad);
> >   	}
> > -	ext_sd = media_entity_to_v4l2_subdev(src_pad->entity);
> > -	if (WARN(!ext_sd, "Failed to get subdev for %s\n", csi2->asd.sd.name))
> > -		return -ENODEV;
> > -
> > -	return v4l2_get_link_freq(ext_sd->ctrl_handler, 0, 0);
> > +	return v4l2_get_link_freq(src_pad, 0, 0);
> >   }
> >   static int csi2_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
> 
> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

Kiitos!
diff mbox series

Patch

diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
index 051898ce53f4..da8581a37e22 100644
--- a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
+++ b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
@@ -80,25 +80,19 @@  static const struct ipu6_csi2_error dphy_rx_errors[] = {
 s64 ipu6_isys_csi2_get_link_freq(struct ipu6_isys_csi2 *csi2)
 {
 	struct media_pad *src_pad;
-	struct v4l2_subdev *ext_sd;
-	struct device *dev;
 
 	if (!csi2)
 		return -EINVAL;
 
-	dev = &csi2->isys->adev->auxdev.dev;
 	src_pad = media_entity_remote_source_pad_unique(&csi2->asd.sd.entity);
 	if (IS_ERR(src_pad)) {
-		dev_err(dev, "can't get source pad of %s (%ld)\n",
+		dev_err(&csi2->isys->adev->auxdev.dev,
+			"can't get source pad of %s (%ld)\n",
 			csi2->asd.sd.name, PTR_ERR(src_pad));
 		return PTR_ERR(src_pad);
 	}
 
-	ext_sd = media_entity_to_v4l2_subdev(src_pad->entity);
-	if (WARN(!ext_sd, "Failed to get subdev for %s\n", csi2->asd.sd.name))
-		return -ENODEV;
-
-	return v4l2_get_link_freq(ext_sd->ctrl_handler, 0, 0);
+	return v4l2_get_link_freq(src_pad, 0, 0);
 }
 
 static int csi2_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,