[v2,04/15] media: ipu-bridge: Allow building as module

Message ID 20230630110643.209761-5-hdegoede@redhat.com (mailing list archive)
State Superseded
Headers
Series media: ipu-bridge: Shared with atomisp, rework VCM instantiation |

Commit Message

Hans de Goede June 30, 2023, 11:06 a.m. UTC
  After commit f54eb0ac7c1a ("media: ipu3-cio2: rename cio2 bridge to ipu
bridge and move out of ipu3") the ipu-bridge code is always builtin
even if all (its only) consumers are build as module.

Fix this by turning "config IPU_BRIDGE" into a pure library Kconfig
option (not user selectable, must be selected by consumers) and
re-introducing the CIO2_BRIDGE Kconfig bits in .../pci/intel/ipu3/Kconfig
which were dropped to still allow building ipu3-cio2 without ipu-bridge
support.

Fixes: f54eb0ac7c1a ("media: ipu3-cio2: rename cio2 bridge to ipu bridge and move out of ipu3")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/media/pci/intel/Kconfig      | 19 ++-----------------
 drivers/media/pci/intel/ipu-bridge.c |  4 ++++
 drivers/media/pci/intel/ipu3/Kconfig | 20 ++++++++++++++++++++
 3 files changed, 26 insertions(+), 17 deletions(-)
  

Comments

Andy Shevchenko June 30, 2023, 2:08 p.m. UTC | #1
On Fri, Jun 30, 2023 at 2:07 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> After commit f54eb0ac7c1a ("media: ipu3-cio2: rename cio2 bridge to ipu
> bridge and move out of ipu3") the ipu-bridge code is always builtin

built in

> even if all (its only) consumers are build as modules.

I'm not sure I understood the remark in parentheses correctly. All of
its consumers are the only consumers of this module?

> Fix this by turning "config IPU_BRIDGE" into a pure library Kconfig
> option (not user selectable, must be selected by consumers) and
> re-introducing the CIO2_BRIDGE Kconfig bits in .../pci/intel/ipu3/Kconfig
> which were dropped to still allow building ipu3-cio2 without ipu-bridge
> support.

...

>  config IPU_BRIDGE
> -       bool "Intel IPU Sensors Bridge"
> -       depends on VIDEO_IPU3_CIO2 && ACPI
> -       depends on I2C
> -       help
> -         This extension provides an API for the Intel IPU driver to create
> -         connections to cameras that are hidden in the SSDB buffer in ACPI.
> -         It can be used to enable support for cameras in detachable / hybrid
> -         devices that ship with Windows.
> -
> -         Say Y here if your device is a detachable / hybrid laptop that comes
> -         with Windows installed by the OEM, for example:
> -
> -               - Microsoft Surface models (except Surface Pro 3)
> -               - The Lenovo Miix line (for example the 510, 520, 710 and 720)
> -               - Dell 7285
> -
> -         If in doubt, say N here.
> +       tristate
> +       depends on ACPI && I2C

Can we leave

  depends on I2C

line untouched?
  
Hans de Goede July 4, 2023, 11:19 a.m. UTC | #2
Hi,

On 6/30/23 16:08, Andy Shevchenko wrote:
> On Fri, Jun 30, 2023 at 2:07 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> After commit f54eb0ac7c1a ("media: ipu3-cio2: rename cio2 bridge to ipu
>> bridge and move out of ipu3") the ipu-bridge code is always builtin
> 
> built in
> 
>> even if all (its only) consumers are build as modules.
> 
> I'm not sure I understood the remark in parentheses correctly. All of
> its consumers are the only consumers of this module?

There is only 1 consumer so both all of its consumers and its only
consumer, I'll drop the confusing "(its only)" part.

> 
>> Fix this by turning "config IPU_BRIDGE" into a pure library Kconfig
>> option (not user selectable, must be selected by consumers) and
>> re-introducing the CIO2_BRIDGE Kconfig bits in .../pci/intel/ipu3/Kconfig
>> which were dropped to still allow building ipu3-cio2 without ipu-bridge
>> support.
> 
> ...
> 
>>  config IPU_BRIDGE
>> -       bool "Intel IPU Sensors Bridge"
>> -       depends on VIDEO_IPU3_CIO2 && ACPI
>> -       depends on I2C
>> -       help
>> -         This extension provides an API for the Intel IPU driver to create
>> -         connections to cameras that are hidden in the SSDB buffer in ACPI.
>> -         It can be used to enable support for cameras in detachable / hybrid
>> -         devices that ship with Windows.
>> -
>> -         Say Y here if your device is a detachable / hybrid laptop that comes
>> -         with Windows installed by the OEM, for example:
>> -
>> -               - Microsoft Surface models (except Surface Pro 3)
>> -               - The Lenovo Miix line (for example the 510, 520, 710 and 720)
>> -               - Dell 7285
>> -
>> -         If in doubt, say N here.
>> +       tristate
>> +       depends on ACPI && I2C
> 
> Can we leave
> 
>   depends on I2C
> 
> line untouched?

Sure, I'll change that for v3.

Regards,

Hans
  

Patch

diff --git a/drivers/media/pci/intel/Kconfig b/drivers/media/pci/intel/Kconfig
index 64a29b0b7033..d4d723591475 100644
--- a/drivers/media/pci/intel/Kconfig
+++ b/drivers/media/pci/intel/Kconfig
@@ -1,21 +1,6 @@ 
 # SPDX-License-Identifier: GPL-2.0-only
 config IPU_BRIDGE
-	bool "Intel IPU Sensors Bridge"
-	depends on VIDEO_IPU3_CIO2 && ACPI
-	depends on I2C
-	help
-	  This extension provides an API for the Intel IPU driver to create
-	  connections to cameras that are hidden in the SSDB buffer in ACPI.
-	  It can be used to enable support for cameras in detachable / hybrid
-	  devices that ship with Windows.
-
-	  Say Y here if your device is a detachable / hybrid laptop that comes
-	  with Windows installed by the OEM, for example:
-
-		- Microsoft Surface models (except Surface Pro 3)
-		- The Lenovo Miix line (for example the 510, 520, 710 and 720)
-		- Dell 7285
-
-	  If in doubt, say N here.
+	tristate
+	depends on ACPI && I2C
 
 source "drivers/media/pci/intel/ipu3/Kconfig"
diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c
index 1c88fd925a8b..97b544736af2 100644
--- a/drivers/media/pci/intel/ipu-bridge.c
+++ b/drivers/media/pci/intel/ipu-bridge.c
@@ -497,3 +497,7 @@  int ipu_bridge_init(struct pci_dev *ipu)
 	return ret;
 }
 EXPORT_SYMBOL_NS_GPL(ipu_bridge_init, INTEL_IPU_BRIDGE);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Dan Scally <djrscally@gmail.com>");
+MODULE_DESCRIPTION("Intel IPU ACPI Sensors Bridge");
diff --git a/drivers/media/pci/intel/ipu3/Kconfig b/drivers/media/pci/intel/ipu3/Kconfig
index 9be06ee81ff0..0951545eab21 100644
--- a/drivers/media/pci/intel/ipu3/Kconfig
+++ b/drivers/media/pci/intel/ipu3/Kconfig
@@ -8,6 +8,7 @@  config VIDEO_IPU3_CIO2
 	select VIDEO_V4L2_SUBDEV_API
 	select V4L2_FWNODE
 	select VIDEOBUF2_DMA_SG
+	select IPU_BRIDGE if CIO2_BRIDGE
 
 	help
 	  This is the Intel IPU3 CIO2 CSI-2 receiver unit, found in Intel
@@ -17,3 +18,22 @@  config VIDEO_IPU3_CIO2
 	  Say Y or M here if you have a Skylake/Kaby Lake SoC with MIPI CSI-2
 	  connected camera.
 	  The module will be called ipu3-cio2.
+
+config CIO2_BRIDGE
+	bool "IPU3 CIO2 Sensors Bridge"
+	depends on VIDEO_IPU3_CIO2 && ACPI
+	depends on I2C
+	help
+	  This extension provides an API for the ipu3-cio2 driver to create
+	  connections to cameras that are hidden in the SSDB buffer in ACPI.
+	  It can be used to enable support for cameras in detachable / hybrid
+	  devices that ship with Windows.
+
+	  Say Y here if your device is a detachable / hybrid laptop that comes
+	  with Windows installed by the OEM, for example:
+
+		- Microsoft Surface models (except Surface Pro 3)
+		- The Lenovo Miix line (for example the 510, 520, 710 and 720)
+		- Dell 7285
+
+	  If in doubt, say N here.