[PATCH v2 04/12] media: ipu-bridge: Use v4l2_fwnode_device_parse helper

Ricardo Ribalda posted 12 patches 6 months, 2 weeks ago
There is a newer version of this series
[PATCH v2 04/12] media: ipu-bridge: Use v4l2_fwnode_device_parse helper
Posted by Ricardo Ribalda 6 months, 2 weeks ago
v4l2_fwnode_device_parse now supports acpi devices as well. Use the
helper instead of re-implement the logic.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/pci/intel/ipu-bridge.c | 32 ++++++--------------------------
 1 file changed, 6 insertions(+), 26 deletions(-)

diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c
index 83e682e1a4b77d9d97b2988750732d0b7c9087b3..020aa52f590d66b6d333adc56ebfb9ab0561db51 100644
--- a/drivers/media/pci/intel/ipu-bridge.c
+++ b/drivers/media/pci/intel/ipu-bridge.c
@@ -253,36 +253,16 @@ static u32 ipu_bridge_parse_rotation(struct acpi_device *adev,
 
 static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct acpi_device *adev)
 {
-	enum v4l2_fwnode_orientation orientation;
-	struct acpi_pld_info *pld = NULL;
+	struct v4l2_fwnode_device_properties props;
+	int ret;
 
-	if (!acpi_get_physical_device_location(ACPI_PTR(adev->handle), &pld)) {
-		dev_warn(ADEV_DEV(adev), "_PLD call failed, using default orientation\n");
+	ret = v4l2_fwnode_device_parse(ADEV_DEV(adev), &props);
+	if (!ret || props.rotation == V4L2_FWNODE_PROPERTY_UNSET) {
+		dev_warn(ADEV_DEV(adev), "Using default orientation\n");
 		return V4L2_FWNODE_ORIENTATION_EXTERNAL;
 	}
 
-	switch (pld->panel) {
-	case ACPI_PLD_PANEL_FRONT:
-		orientation = V4L2_FWNODE_ORIENTATION_FRONT;
-		break;
-	case ACPI_PLD_PANEL_BACK:
-		orientation = V4L2_FWNODE_ORIENTATION_BACK;
-		break;
-	case ACPI_PLD_PANEL_TOP:
-	case ACPI_PLD_PANEL_LEFT:
-	case ACPI_PLD_PANEL_RIGHT:
-	case ACPI_PLD_PANEL_UNKNOWN:
-		orientation = V4L2_FWNODE_ORIENTATION_EXTERNAL;
-		break;
-	default:
-		dev_warn(ADEV_DEV(adev), "Unknown _PLD panel val %d\n",
-			 pld->panel);
-		orientation = V4L2_FWNODE_ORIENTATION_EXTERNAL;
-		break;
-	}
-
-	ACPI_FREE(pld);
-	return orientation;
+	return props.orientation;
 }
 
 int ipu_bridge_parse_ssdb(struct acpi_device *adev, struct ipu_sensor *sensor)

-- 
2.50.0.rc0.642.g800a2b2222-goog
Re: [PATCH v2 04/12] media: ipu-bridge: Use v4l2_fwnode_device_parse helper
Posted by Hans de Goede 5 months, 1 week ago
Hi,

On 5-Jun-25 19:52, Ricardo Ribalda wrote:
> v4l2_fwnode_device_parse now supports acpi devices as well. Use the
> helper instead of re-implement the logic.
> 
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
>  drivers/media/pci/intel/ipu-bridge.c | 32 ++++++--------------------------
>  1 file changed, 6 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c
> index 83e682e1a4b77d9d97b2988750732d0b7c9087b3..020aa52f590d66b6d333adc56ebfb9ab0561db51 100644
> --- a/drivers/media/pci/intel/ipu-bridge.c
> +++ b/drivers/media/pci/intel/ipu-bridge.c
> @@ -253,36 +253,16 @@ static u32 ipu_bridge_parse_rotation(struct acpi_device *adev,
>  
>  static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct acpi_device *adev)
>  {

In patch 5/12 you add a "struct v4l2_fwnode_device_properties *props" parameter
to this function and move the calling of v4l2_fwnode_device_parse() to
ipu_bridge_parse_ssdb().

You might just as well do this here so that there is a bit less churn in
the series.

Regards,

Hans


> -	enum v4l2_fwnode_orientation orientation;
> -	struct acpi_pld_info *pld = NULL;
> +	struct v4l2_fwnode_device_properties props;
> +	int ret;
>  
> -	if (!acpi_get_physical_device_location(ACPI_PTR(adev->handle), &pld)) {
> -		dev_warn(ADEV_DEV(adev), "_PLD call failed, using default orientation\n");
> +	ret = v4l2_fwnode_device_parse(ADEV_DEV(adev), &props);
> +	if (!ret || props.rotation == V4L2_FWNODE_PROPERTY_UNSET) {
> +		dev_warn(ADEV_DEV(adev), "Using default orientation\n");
>  		return V4L2_FWNODE_ORIENTATION_EXTERNAL;
>  	}
>  
> -	switch (pld->panel) {
> -	case ACPI_PLD_PANEL_FRONT:
> -		orientation = V4L2_FWNODE_ORIENTATION_FRONT;
> -		break;
> -	case ACPI_PLD_PANEL_BACK:
> -		orientation = V4L2_FWNODE_ORIENTATION_BACK;
> -		break;
> -	case ACPI_PLD_PANEL_TOP:
> -	case ACPI_PLD_PANEL_LEFT:
> -	case ACPI_PLD_PANEL_RIGHT:
> -	case ACPI_PLD_PANEL_UNKNOWN:
> -		orientation = V4L2_FWNODE_ORIENTATION_EXTERNAL;
> -		break;
> -	default:
> -		dev_warn(ADEV_DEV(adev), "Unknown _PLD panel val %d\n",
> -			 pld->panel);
> -		orientation = V4L2_FWNODE_ORIENTATION_EXTERNAL;
> -		break;
> -	}
> -
> -	ACPI_FREE(pld);
> -	return orientation;
> +	return props.orientation;
>  }
>  
>  int ipu_bridge_parse_ssdb(struct acpi_device *adev, struct ipu_sensor *sensor)
>
Re: [PATCH v2 04/12] media: ipu-bridge: Use v4l2_fwnode_device_parse helper
Posted by kernel test robot 6 months, 2 weeks ago
Hi Ricardo,

kernel test robot noticed the following build errors:

[auto build test ERROR on 5e1ff2314797bf53636468a97719a8222deca9ae]

url:    https://github.com/intel-lab-lkp/linux/commits/Ricardo-Ribalda/media-uvcvideo-Always-set-default_value/20250606-015643
base:   5e1ff2314797bf53636468a97719a8222deca9ae
patch link:    https://lore.kernel.org/r/20250605-uvc-orientation-v2-4-5710f9d030aa%40chromium.org
patch subject: [PATCH v2 04/12] media: ipu-bridge: Use v4l2_fwnode_device_parse helper
config: riscv-randconfig-002-20250606 (https://download.01.org/0day-ci/archive/20250606/202506061223.m9fBRBFN-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250606/202506061223.m9fBRBFN-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506061223.m9fBRBFN-lkp@intel.com/

All errors (new ones prefixed by >>, old ones prefixed by <<):

WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/fpga/tests/fpga-mgr-test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/fpga/tests/fpga-bridge-test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/fpga/tests/fpga-region-test.o
>> ERROR: modpost: "v4l2_fwnode_device_parse" [drivers/media/pci/intel/ipu-bridge.ko] undefined!

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki