mbox series

[00/12] media: intel-cio2-bridge: Add shared intel-cio2-bridge code, rework VCM instantiation

Message ID 20230627175643.114778-1-hdegoede@redhat.com (mailing list archive)
Headers show
Series media: intel-cio2-bridge: Add shared intel-cio2-bridge code, rework VCM instantiation | expand

Message

Hans de Goede June 27, 2023, 5:56 p.m. UTC
Hi All,

While working on adding (proper) VCM support to the atomisp code
I found myself copying yet more code from
drivers/media/pci/intel/ipu3/cio2-bridge.c into the atomisp code.

So I decided that it really was time to factor out the common code
(most of the code) from intel/ipu3/cio2-bridge.c into its own
helper library and then share it between the atomisp and IPU3 code.

This will hopefully also be useful for the ongoing work to upstream
IPU6 input system support which also needs this functionality and
currently contains a 3th copy of this code in the out of tree driver.

This set consists of the following parts:

Patch 1     A bugfix for a recent change to the cio2-bridge code
Patches 2-8 Cleanup / preparation patches
Patch 9     Move the main body of the cio2-bridge.c code into
            a new shared intel-cio2-bridge module
Patch 10    Drop cio2-bridge code copy from atomisp, switching to
            the shared intel-cio2-bridge module
Patch 11    Rework how VCM client instantiation is done so that
            a device-link can be added from VCM to sensor to
            fix issues with the VCM power-state being tied to
            the sensor power state
Patch 12    Example patch to show how patch 11 avoids the need
            for hacks in VCM drivers caused by the shared power state
            (not intended for merging)

Regards,

Hans


Hans de Goede (12):
  media: ipu3-cio2: Do not use on stack memory for software_node.name
    field
  media: ipu3-cio2: Move initialization of node_names.vcm to
    cio2_bridge_init_swnode_names()
  media: ipu3-cio2: Make cio2_bridge_init() take a regular struct device
    as argument
  media: ipu3-cio2: Store dev pointer in struct cio2_bridge
  media: ipu3-cio2: Only keep PLD around while parsing
  media: ipu3-cio2: Add a cio2_bridge_parse_sensor_fwnode() helper
    function
  media: ipu3-cio2: Add a parse_sensor_fwnode callback to
    cio2_bridge_init()
  media: ipu3-cio2: Add supported_sensors parameter to
    cio2_bridge_init()
  media: ipu3-cio2: Move cio2_bridge_init() code into a new shared
    intel-cio2-bridge.ko
  media: atomisp: csi2-bridge: Switch to new common cio2_bridge_init()
  media: intel-cio2-bridge: Add a runtime-pm device-link between VCM and
    sensor
  [RFC] media: dw9719: Drop hack to enable "vsio" regulator

 MAINTAINERS                                   |   9 +
 drivers/media/common/Kconfig                  |   4 +
 drivers/media/common/Makefile                 |   1 +
 drivers/media/common/intel-cio2-bridge.c      | 464 ++++++++++++++++++
 drivers/media/i2c/dw9719.c                    |  27 +-
 drivers/media/pci/intel/ipu3/Kconfig          |   1 +
 drivers/media/pci/intel/ipu3/cio2-bridge.c    | 464 +++---------------
 drivers/media/pci/intel/ipu3/cio2-bridge.h    | 146 ------
 drivers/media/pci/intel/ipu3/ipu3-cio2-main.c |   7 +-
 drivers/media/pci/intel/ipu3/ipu3-cio2.h      |   7 +-
 drivers/staging/media/atomisp/Kconfig         |   2 +
 .../staging/media/atomisp/pci/atomisp_csi2.h  |  67 ---
 .../media/atomisp/pci/atomisp_csi2_bridge.c   | 307 ++----------
 include/media/intel-cio2-bridge.h             | 105 ++++
 14 files changed, 723 insertions(+), 888 deletions(-)
 create mode 100644 drivers/media/common/intel-cio2-bridge.c
 delete mode 100644 drivers/media/pci/intel/ipu3/cio2-bridge.h
 create mode 100644 include/media/intel-cio2-bridge.h

Comments

Andy Shevchenko June 27, 2023, 9:04 p.m. UTC | #1
On Tue, Jun 27, 2023 at 07:56:30PM +0200, Hans de Goede wrote:
> Hi All,
> 
> While working on adding (proper) VCM support to the atomisp code
> I found myself copying yet more code from
> drivers/media/pci/intel/ipu3/cio2-bridge.c into the atomisp code.
> 
> So I decided that it really was time to factor out the common code
> (most of the code) from intel/ipu3/cio2-bridge.c into its own
> helper library and then share it between the atomisp and IPU3 code.
> 
> This will hopefully also be useful for the ongoing work to upstream
> IPU6 input system support which also needs this functionality and
> currently contains a 3th copy of this code in the out of tree driver.

I like the idea.
Some nit-picks here and there, but in general
Reviewed-by: Andy Shevchenko <andy@kernel.org>

> This set consists of the following parts:
> 
> Patch 1     A bugfix for a recent change to the cio2-bridge code
> Patches 2-8 Cleanup / preparation patches
> Patch 9     Move the main body of the cio2-bridge.c code into
>             a new shared intel-cio2-bridge module
> Patch 10    Drop cio2-bridge code copy from atomisp, switching to
>             the shared intel-cio2-bridge module
> Patch 11    Rework how VCM client instantiation is done so that
>             a device-link can be added from VCM to sensor to
>             fix issues with the VCM power-state being tied to
>             the sensor power state
> Patch 12    Example patch to show how patch 11 avoids the need
>             for hacks in VCM drivers caused by the shared power state
>             (not intended for merging)
> 
> Regards,
> 
> Hans
> 
> 
> Hans de Goede (12):
>   media: ipu3-cio2: Do not use on stack memory for software_node.name
>     field
>   media: ipu3-cio2: Move initialization of node_names.vcm to
>     cio2_bridge_init_swnode_names()
>   media: ipu3-cio2: Make cio2_bridge_init() take a regular struct device
>     as argument
>   media: ipu3-cio2: Store dev pointer in struct cio2_bridge
>   media: ipu3-cio2: Only keep PLD around while parsing
>   media: ipu3-cio2: Add a cio2_bridge_parse_sensor_fwnode() helper
>     function
>   media: ipu3-cio2: Add a parse_sensor_fwnode callback to
>     cio2_bridge_init()
>   media: ipu3-cio2: Add supported_sensors parameter to
>     cio2_bridge_init()
>   media: ipu3-cio2: Move cio2_bridge_init() code into a new shared
>     intel-cio2-bridge.ko
>   media: atomisp: csi2-bridge: Switch to new common cio2_bridge_init()
>   media: intel-cio2-bridge: Add a runtime-pm device-link between VCM and
>     sensor
>   [RFC] media: dw9719: Drop hack to enable "vsio" regulator
> 
>  MAINTAINERS                                   |   9 +
>  drivers/media/common/Kconfig                  |   4 +
>  drivers/media/common/Makefile                 |   1 +
>  drivers/media/common/intel-cio2-bridge.c      | 464 ++++++++++++++++++
>  drivers/media/i2c/dw9719.c                    |  27 +-
>  drivers/media/pci/intel/ipu3/Kconfig          |   1 +
>  drivers/media/pci/intel/ipu3/cio2-bridge.c    | 464 +++---------------
>  drivers/media/pci/intel/ipu3/cio2-bridge.h    | 146 ------
>  drivers/media/pci/intel/ipu3/ipu3-cio2-main.c |   7 +-
>  drivers/media/pci/intel/ipu3/ipu3-cio2.h      |   7 +-
>  drivers/staging/media/atomisp/Kconfig         |   2 +
>  .../staging/media/atomisp/pci/atomisp_csi2.h  |  67 ---
>  .../media/atomisp/pci/atomisp_csi2_bridge.c   | 307 ++----------
>  include/media/intel-cio2-bridge.h             | 105 ++++
>  14 files changed, 723 insertions(+), 888 deletions(-)
>  create mode 100644 drivers/media/common/intel-cio2-bridge.c
>  delete mode 100644 drivers/media/pci/intel/ipu3/cio2-bridge.h
>  create mode 100644 include/media/intel-cio2-bridge.h
> 
> -- 
> 2.41.0
>
Bingbu Cao June 28, 2023, 1:19 a.m. UTC | #2
Hans,

Thanks for your patch.

------------------------------------------------------------------------
BRs,  
Bingbu Cao 

>-----Original Message-----
>From: Hans de Goede <hdegoede@redhat.com>
>Sent: Wednesday, June 28, 2023 01:57
>To: Sakari Ailus <sakari.ailus@linux.intel.com>; Laurent Pinchart
><laurent.pinchart@ideasonboard.com>; Daniel Scally
><dan.scally@ideasonboard.com>
>Cc: Hans de Goede <hdegoede@redhat.com>; Mauro Carvalho Chehab
><mchehab@kernel.org>; Andy Shevchenko <andy@kernel.org>; Kate Hsuan
><hpa@redhat.com>; Yao, Hao <hao.yao@intel.com>; Cao, Bingbu
><bingbu.cao@intel.com>; linux-media@vger.kernel.org
>Subject: [PATCH 00/12] media: intel-cio2-bridge: Add shared intel-cio2-
>bridge code, rework VCM instantiation
>
>Hi All,
>
>While working on adding (proper) VCM support to the atomisp code I found
>myself copying yet more code from drivers/media/pci/intel/ipu3/cio2-
>bridge.c into the atomisp code.
>
>So I decided that it really was time to factor out the common code (most of
>the code) from intel/ipu3/cio2-bridge.c into its own helper library and
>then share it between the atomisp and IPU3 code.
>
>This will hopefully also be useful for the ongoing work to upstream
>IPU6 input system support which also needs this functionality and currently
>contains a 3th copy of this code in the out of tree driver.
>
>This set consists of the following parts:
>
>Patch 1     A bugfix for a recent change to the cio2-bridge code
>Patches 2-8 Cleanup / preparation patches
>Patch 9     Move the main body of the cio2-bridge.c code into
>            a new shared intel-cio2-bridge module

Another cio2-bridge patch - https://patchwork.kernel.org/project/linux-media/patch/20230517103004.724264-1-bingbu.cao@intel.com/
I remember Sakari include it in the latest pull request. 

>Patch 10    Drop cio2-bridge code copy from atomisp, switching to
>            the shared intel-cio2-bridge module
>Patch 11    Rework how VCM client instantiation is done so that
>            a device-link can be added from VCM to sensor to
>            fix issues with the VCM power-state being tied to
>            the sensor power state
>Patch 12    Example patch to show how patch 11 avoids the need
>            for hacks in VCM drivers caused by the shared power state
>            (not intended for merging)
>
>Regards,
>
>Hans
>
>
>Hans de Goede (12):
>  media: ipu3-cio2: Do not use on stack memory for software_node.name
>    field
>  media: ipu3-cio2: Move initialization of node_names.vcm to
>    cio2_bridge_init_swnode_names()
>  media: ipu3-cio2: Make cio2_bridge_init() take a regular struct device
>    as argument
>  media: ipu3-cio2: Store dev pointer in struct cio2_bridge
>  media: ipu3-cio2: Only keep PLD around while parsing
>  media: ipu3-cio2: Add a cio2_bridge_parse_sensor_fwnode() helper
>    function
>  media: ipu3-cio2: Add a parse_sensor_fwnode callback to
>    cio2_bridge_init()
>  media: ipu3-cio2: Add supported_sensors parameter to
>    cio2_bridge_init()
>  media: ipu3-cio2: Move cio2_bridge_init() code into a new shared
>    intel-cio2-bridge.ko
>  media: atomisp: csi2-bridge: Switch to new common cio2_bridge_init()
>  media: intel-cio2-bridge: Add a runtime-pm device-link between VCM and
>    sensor
>  [RFC] media: dw9719: Drop hack to enable "vsio" regulator
>
> MAINTAINERS                                   |   9 +
> drivers/media/common/Kconfig                  |   4 +
> drivers/media/common/Makefile                 |   1 +
> drivers/media/common/intel-cio2-bridge.c      | 464 ++++++++++++++++++
> drivers/media/i2c/dw9719.c                    |  27 +-
> drivers/media/pci/intel/ipu3/Kconfig          |   1 +
> drivers/media/pci/intel/ipu3/cio2-bridge.c    | 464 +++---------------
> drivers/media/pci/intel/ipu3/cio2-bridge.h    | 146 ------
> drivers/media/pci/intel/ipu3/ipu3-cio2-main.c |   7 +-
> drivers/media/pci/intel/ipu3/ipu3-cio2.h      |   7 +-
> drivers/staging/media/atomisp/Kconfig         |   2 +
> .../staging/media/atomisp/pci/atomisp_csi2.h  |  67 ---
> .../media/atomisp/pci/atomisp_csi2_bridge.c   | 307 ++----------
> include/media/intel-cio2-bridge.h             | 105 ++++
> 14 files changed, 723 insertions(+), 888 deletions(-)  create mode 100644
>drivers/media/common/intel-cio2-bridge.c
> delete mode 100644 drivers/media/pci/intel/ipu3/cio2-bridge.h
> create mode 100644 include/media/intel-cio2-bridge.h
>
>--
>2.41.0
Hans de Goede June 28, 2023, 1:57 p.m. UTC | #3
Hi Bingbu,

On 6/28/23 03:19, Cao, Bingbu wrote:
> Hans,
> 
> Thanks for your patch.
> 
> ------------------------------------------------------------------------
> BRs,  
> Bingbu Cao 
> 
>> -----Original Message-----
>> From: Hans de Goede <hdegoede@redhat.com>
>> Sent: Wednesday, June 28, 2023 01:57
>> To: Sakari Ailus <sakari.ailus@linux.intel.com>; Laurent Pinchart
>> <laurent.pinchart@ideasonboard.com>; Daniel Scally
>> <dan.scally@ideasonboard.com>
>> Cc: Hans de Goede <hdegoede@redhat.com>; Mauro Carvalho Chehab
>> <mchehab@kernel.org>; Andy Shevchenko <andy@kernel.org>; Kate Hsuan
>> <hpa@redhat.com>; Yao, Hao <hao.yao@intel.com>; Cao, Bingbu
>> <bingbu.cao@intel.com>; linux-media@vger.kernel.org
>> Subject: [PATCH 00/12] media: intel-cio2-bridge: Add shared intel-cio2-
>> bridge code, rework VCM instantiation
>>
>> Hi All,
>>
>> While working on adding (proper) VCM support to the atomisp code I found
>> myself copying yet more code from drivers/media/pci/intel/ipu3/cio2-
>> bridge.c into the atomisp code.
>>
>> So I decided that it really was time to factor out the common code (most of
>> the code) from intel/ipu3/cio2-bridge.c into its own helper library and
>> then share it between the atomisp and IPU3 code.
>>
>> This will hopefully also be useful for the ongoing work to upstream
>> IPU6 input system support which also needs this functionality and currently
>> contains a 3th copy of this code in the out of tree driver.
>>
>> This set consists of the following parts:
>>
>> Patch 1     A bugfix for a recent change to the cio2-bridge code
>> Patches 2-8 Cleanup / preparation patches
>> Patch 9     Move the main body of the cio2-bridge.c code into
>>            a new shared intel-cio2-bridge module
> 
> Another cio2-bridge patch - https://patchwork.kernel.org/project/linux-media/patch/20230517103004.724264-1-bingbu.cao@intel.com/
> I remember Sakari include it in the latest pull request. 

Ah, yes looks like I need to rebase this on top of that patch,
as Dan also mentioned in another reply.

But I don't see this patch in media-staging yet:
https://git.linuxtv.org/media_stage.git/log/

Is there a branch for the pull-request on which I can rebase this
available somewhere ?

Regards,

Hans




> 
>> Patch 10    Drop cio2-bridge code copy from atomisp, switching to
>>            the shared intel-cio2-bridge module
>> Patch 11    Rework how VCM client instantiation is done so that
>>            a device-link can be added from VCM to sensor to
>>            fix issues with the VCM power-state being tied to
>>            the sensor power state
>> Patch 12    Example patch to show how patch 11 avoids the need
>>            for hacks in VCM drivers caused by the shared power state
>>            (not intended for merging)
>>
>> Regards,
>>
>> Hans
>>
>>
>> Hans de Goede (12):
>>  media: ipu3-cio2: Do not use on stack memory for software_node.name
>>    field
>>  media: ipu3-cio2: Move initialization of node_names.vcm to
>>    cio2_bridge_init_swnode_names()
>>  media: ipu3-cio2: Make cio2_bridge_init() take a regular struct device
>>    as argument
>>  media: ipu3-cio2: Store dev pointer in struct cio2_bridge
>>  media: ipu3-cio2: Only keep PLD around while parsing
>>  media: ipu3-cio2: Add a cio2_bridge_parse_sensor_fwnode() helper
>>    function
>>  media: ipu3-cio2: Add a parse_sensor_fwnode callback to
>>    cio2_bridge_init()
>>  media: ipu3-cio2: Add supported_sensors parameter to
>>    cio2_bridge_init()
>>  media: ipu3-cio2: Move cio2_bridge_init() code into a new shared
>>    intel-cio2-bridge.ko
>>  media: atomisp: csi2-bridge: Switch to new common cio2_bridge_init()
>>  media: intel-cio2-bridge: Add a runtime-pm device-link between VCM and
>>    sensor
>>  [RFC] media: dw9719: Drop hack to enable "vsio" regulator
>>
>> MAINTAINERS                                   |   9 +
>> drivers/media/common/Kconfig                  |   4 +
>> drivers/media/common/Makefile                 |   1 +
>> drivers/media/common/intel-cio2-bridge.c      | 464 ++++++++++++++++++
>> drivers/media/i2c/dw9719.c                    |  27 +-
>> drivers/media/pci/intel/ipu3/Kconfig          |   1 +
>> drivers/media/pci/intel/ipu3/cio2-bridge.c    | 464 +++---------------
>> drivers/media/pci/intel/ipu3/cio2-bridge.h    | 146 ------
>> drivers/media/pci/intel/ipu3/ipu3-cio2-main.c |   7 +-
>> drivers/media/pci/intel/ipu3/ipu3-cio2.h      |   7 +-
>> drivers/staging/media/atomisp/Kconfig         |   2 +
>> .../staging/media/atomisp/pci/atomisp_csi2.h  |  67 ---
>> .../media/atomisp/pci/atomisp_csi2_bridge.c   | 307 ++----------
>> include/media/intel-cio2-bridge.h             | 105 ++++
>> 14 files changed, 723 insertions(+), 888 deletions(-)  create mode 100644
>> drivers/media/common/intel-cio2-bridge.c
>> delete mode 100644 drivers/media/pci/intel/ipu3/cio2-bridge.h
>> create mode 100644 include/media/intel-cio2-bridge.h
>>
>> --
>> 2.41.0
>
Bingbu Cao June 29, 2023, 8:22 a.m. UTC | #4
Hans,


------------------------------------------------------------------------
BRs,  
Bingbu Cao 

>-----Original Message-----
>From: Hans de Goede <hdegoede@redhat.com>
>Sent: Wednesday, June 28, 2023 21:57
>To: Cao, Bingbu <bingbu.cao@intel.com>; Sakari Ailus
><sakari.ailus@linux.intel.com>; Laurent Pinchart
><laurent.pinchart@ideasonboard.com>; Daniel Scally
><dan.scally@ideasonboard.com>
>Cc: Mauro Carvalho Chehab <mchehab@kernel.org>; Andy Shevchenko
><andy@kernel.org>; Kate Hsuan <hpa@redhat.com>; Yao, Hao
><hao.yao@intel.com>; linux-media@vger.kernel.org
>Subject: Re: [PATCH 00/12] media: intel-cio2-bridge: Add shared intel-cio2-
>bridge code, rework VCM instantiation
>
>Hi Bingbu,
>
>On 6/28/23 03:19, Cao, Bingbu wrote:
>> Hans,
>>
>> Thanks for your patch.
>>
>> ----------------------------------------------------------------------
>> --
>> BRs,
>> Bingbu Cao
>>
>>> -----Original Message-----
>>> From: Hans de Goede <hdegoede@redhat.com>
>>> Sent: Wednesday, June 28, 2023 01:57
>>> To: Sakari Ailus <sakari.ailus@linux.intel.com>; Laurent Pinchart
>>> <laurent.pinchart@ideasonboard.com>; Daniel Scally
>>> <dan.scally@ideasonboard.com>
>>> Cc: Hans de Goede <hdegoede@redhat.com>; Mauro Carvalho Chehab
>>> <mchehab@kernel.org>; Andy Shevchenko <andy@kernel.org>; Kate Hsuan
>>> <hpa@redhat.com>; Yao, Hao <hao.yao@intel.com>; Cao, Bingbu
>>> <bingbu.cao@intel.com>; linux-media@vger.kernel.org
>>> Subject: [PATCH 00/12] media: intel-cio2-bridge: Add shared
>>> intel-cio2- bridge code, rework VCM instantiation
>>>
>>> Hi All,
>>>
>>> While working on adding (proper) VCM support to the atomisp code I
>>> found myself copying yet more code from
>>> drivers/media/pci/intel/ipu3/cio2-
>>> bridge.c into the atomisp code.
>>>
>>> So I decided that it really was time to factor out the common code
>>> (most of the code) from intel/ipu3/cio2-bridge.c into its own helper
>>> library and then share it between the atomisp and IPU3 code.
>>>
>>> This will hopefully also be useful for the ongoing work to upstream
>>> IPU6 input system support which also needs this functionality and
>>> currently contains a 3th copy of this code in the out of tree driver.
>>>
>>> This set consists of the following parts:
>>>
>>> Patch 1     A bugfix for a recent change to the cio2-bridge code
>>> Patches 2-8 Cleanup / preparation patches
>>> Patch 9     Move the main body of the cio2-bridge.c code into
>>>            a new shared intel-cio2-bridge module
>>
>> Another cio2-bridge patch -
>> https://patchwork.kernel.org/project/linux-media/patch/20230517103004.
>> 724264-1-bingbu.cao@intel.com/ I remember Sakari include it in the
>> latest pull request.
>
>Ah, yes looks like I need to rebase this on top of that patch, as Dan also
>mentioned in another reply.
>
>But I don't see this patch in media-staging yet:
>https://git.linuxtv.org/media_stage.git/log/
>
>Is there a branch for the pull-request on which I can rebase this available
>somewhere ?

I see they are in Sakari's repo -
https://git.linuxtv.org/sailus/media_tree.git/log/?h=for-6.6-1.4-signed


>
>Regards,
>
>Hans
>
>
>
>
>>
>>> Patch 10    Drop cio2-bridge code copy from atomisp, switching to
>>>            the shared intel-cio2-bridge module
>>> Patch 11    Rework how VCM client instantiation is done so that
>>>            a device-link can be added from VCM to sensor to
>>>            fix issues with the VCM power-state being tied to
>>>            the sensor power state
>>> Patch 12    Example patch to show how patch 11 avoids the need
>>>            for hacks in VCM drivers caused by the shared power state
>>>            (not intended for merging)
>>>
>>> Regards,
>>>
>>> Hans
>>>
>>>
>>> Hans de Goede (12):
>>>  media: ipu3-cio2: Do not use on stack memory for software_node.name
>>>    field
>>>  media: ipu3-cio2: Move initialization of node_names.vcm to
>>>    cio2_bridge_init_swnode_names()
>>>  media: ipu3-cio2: Make cio2_bridge_init() take a regular struct device
>>>    as argument
>>>  media: ipu3-cio2: Store dev pointer in struct cio2_bridge
>>>  media: ipu3-cio2: Only keep PLD around while parsing
>>>  media: ipu3-cio2: Add a cio2_bridge_parse_sensor_fwnode() helper
>>>    function
>>>  media: ipu3-cio2: Add a parse_sensor_fwnode callback to
>>>    cio2_bridge_init()
>>>  media: ipu3-cio2: Add supported_sensors parameter to
>>>    cio2_bridge_init()
>>>  media: ipu3-cio2: Move cio2_bridge_init() code into a new shared
>>>    intel-cio2-bridge.ko
>>>  media: atomisp: csi2-bridge: Switch to new common cio2_bridge_init()
>>>  media: intel-cio2-bridge: Add a runtime-pm device-link between VCM and
>>>    sensor
>>>  [RFC] media: dw9719: Drop hack to enable "vsio" regulator
>>>
>>> MAINTAINERS                                   |   9 +
>>> drivers/media/common/Kconfig                  |   4 +
>>> drivers/media/common/Makefile                 |   1 +
>>> drivers/media/common/intel-cio2-bridge.c      | 464 ++++++++++++++++++
>>> drivers/media/i2c/dw9719.c                    |  27 +-
>>> drivers/media/pci/intel/ipu3/Kconfig          |   1 +
>>> drivers/media/pci/intel/ipu3/cio2-bridge.c    | 464 +++---------------
>>> drivers/media/pci/intel/ipu3/cio2-bridge.h    | 146 ------
>>> drivers/media/pci/intel/ipu3/ipu3-cio2-main.c |   7 +-
>>> drivers/media/pci/intel/ipu3/ipu3-cio2.h      |   7 +-
>>> drivers/staging/media/atomisp/Kconfig         |   2 +
>>> .../staging/media/atomisp/pci/atomisp_csi2.h  |  67 ---
>>> .../media/atomisp/pci/atomisp_csi2_bridge.c   | 307 ++----------
>>> include/media/intel-cio2-bridge.h             | 105 ++++
>>> 14 files changed, 723 insertions(+), 888 deletions(-)  create mode
>>> 100644 drivers/media/common/intel-cio2-bridge.c
>>> delete mode 100644 drivers/media/pci/intel/ipu3/cio2-bridge.h
>>> create mode 100644 include/media/intel-cio2-bridge.h
>>>
>>> --
>>> 2.41.0
>>
Hans de Goede June 29, 2023, 8:45 p.m. UTC | #5
Hi,

On 6/29/23 10:22, Cao, Bingbu wrote:
> Hans,
> 
> 
> ------------------------------------------------------------------------
> BRs,  
> Bingbu Cao 
> 
>> -----Original Message-----
>> From: Hans de Goede <hdegoede@redhat.com>
>> Sent: Wednesday, June 28, 2023 21:57
>> To: Cao, Bingbu <bingbu.cao@intel.com>; Sakari Ailus
>> <sakari.ailus@linux.intel.com>; Laurent Pinchart
>> <laurent.pinchart@ideasonboard.com>; Daniel Scally
>> <dan.scally@ideasonboard.com>
>> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>; Andy Shevchenko
>> <andy@kernel.org>; Kate Hsuan <hpa@redhat.com>; Yao, Hao
>> <hao.yao@intel.com>; linux-media@vger.kernel.org
>> Subject: Re: [PATCH 00/12] media: intel-cio2-bridge: Add shared intel-cio2-
>> bridge code, rework VCM instantiation
>>
>> Hi Bingbu,
>>
>> On 6/28/23 03:19, Cao, Bingbu wrote:
>>> Hans,
>>>
>>> Thanks for your patch.
>>>
>>> ----------------------------------------------------------------------
>>> --
>>> BRs,
>>> Bingbu Cao
>>>
>>>> -----Original Message-----
>>>> From: Hans de Goede <hdegoede@redhat.com>
>>>> Sent: Wednesday, June 28, 2023 01:57
>>>> To: Sakari Ailus <sakari.ailus@linux.intel.com>; Laurent Pinchart
>>>> <laurent.pinchart@ideasonboard.com>; Daniel Scally
>>>> <dan.scally@ideasonboard.com>
>>>> Cc: Hans de Goede <hdegoede@redhat.com>; Mauro Carvalho Chehab
>>>> <mchehab@kernel.org>; Andy Shevchenko <andy@kernel.org>; Kate Hsuan
>>>> <hpa@redhat.com>; Yao, Hao <hao.yao@intel.com>; Cao, Bingbu
>>>> <bingbu.cao@intel.com>; linux-media@vger.kernel.org
>>>> Subject: [PATCH 00/12] media: intel-cio2-bridge: Add shared
>>>> intel-cio2- bridge code, rework VCM instantiation
>>>>
>>>> Hi All,
>>>>
>>>> While working on adding (proper) VCM support to the atomisp code I
>>>> found myself copying yet more code from
>>>> drivers/media/pci/intel/ipu3/cio2-
>>>> bridge.c into the atomisp code.
>>>>
>>>> So I decided that it really was time to factor out the common code
>>>> (most of the code) from intel/ipu3/cio2-bridge.c into its own helper
>>>> library and then share it between the atomisp and IPU3 code.
>>>>
>>>> This will hopefully also be useful for the ongoing work to upstream
>>>> IPU6 input system support which also needs this functionality and
>>>> currently contains a 3th copy of this code in the out of tree driver.
>>>>
>>>> This set consists of the following parts:
>>>>
>>>> Patch 1     A bugfix for a recent change to the cio2-bridge code
>>>> Patches 2-8 Cleanup / preparation patches
>>>> Patch 9     Move the main body of the cio2-bridge.c code into
>>>>            a new shared intel-cio2-bridge module
>>>
>>> Another cio2-bridge patch -
>>> https://patchwork.kernel.org/project/linux-media/patch/20230517103004.
>>> 724264-1-bingbu.cao@intel.com/ I remember Sakari include it in the
>>> latest pull request.
>>
>> Ah, yes looks like I need to rebase this on top of that patch, as Dan also
>> mentioned in another reply.
>>
>> But I don't see this patch in media-staging yet:
>> https://git.linuxtv.org/media_stage.git/log/
>>
>> Is there a branch for the pull-request on which I can rebase this available
>> somewhere ?
> 
> I see they are in Sakari's repo -
> https://git.linuxtv.org/sailus/media_tree.git/log/?h=for-6.6-1.4-signed

Thank you.

I'll rebase and send out a new version.

Regards,

Hans




>>>> Patch 10    Drop cio2-bridge code copy from atomisp, switching to
>>>>            the shared intel-cio2-bridge module
>>>> Patch 11    Rework how VCM client instantiation is done so that
>>>>            a device-link can be added from VCM to sensor to
>>>>            fix issues with the VCM power-state being tied to
>>>>            the sensor power state
>>>> Patch 12    Example patch to show how patch 11 avoids the need
>>>>            for hacks in VCM drivers caused by the shared power state
>>>>            (not intended for merging)
>>>>
>>>> Regards,
>>>>
>>>> Hans
>>>>
>>>>
>>>> Hans de Goede (12):
>>>>  media: ipu3-cio2: Do not use on stack memory for software_node.name
>>>>    field
>>>>  media: ipu3-cio2: Move initialization of node_names.vcm to
>>>>    cio2_bridge_init_swnode_names()
>>>>  media: ipu3-cio2: Make cio2_bridge_init() take a regular struct device
>>>>    as argument
>>>>  media: ipu3-cio2: Store dev pointer in struct cio2_bridge
>>>>  media: ipu3-cio2: Only keep PLD around while parsing
>>>>  media: ipu3-cio2: Add a cio2_bridge_parse_sensor_fwnode() helper
>>>>    function
>>>>  media: ipu3-cio2: Add a parse_sensor_fwnode callback to
>>>>    cio2_bridge_init()
>>>>  media: ipu3-cio2: Add supported_sensors parameter to
>>>>    cio2_bridge_init()
>>>>  media: ipu3-cio2: Move cio2_bridge_init() code into a new shared
>>>>    intel-cio2-bridge.ko
>>>>  media: atomisp: csi2-bridge: Switch to new common cio2_bridge_init()
>>>>  media: intel-cio2-bridge: Add a runtime-pm device-link between VCM and
>>>>    sensor
>>>>  [RFC] media: dw9719: Drop hack to enable "vsio" regulator
>>>>
>>>> MAINTAINERS                                   |   9 +
>>>> drivers/media/common/Kconfig                  |   4 +
>>>> drivers/media/common/Makefile                 |   1 +
>>>> drivers/media/common/intel-cio2-bridge.c      | 464 ++++++++++++++++++
>>>> drivers/media/i2c/dw9719.c                    |  27 +-
>>>> drivers/media/pci/intel/ipu3/Kconfig          |   1 +
>>>> drivers/media/pci/intel/ipu3/cio2-bridge.c    | 464 +++---------------
>>>> drivers/media/pci/intel/ipu3/cio2-bridge.h    | 146 ------
>>>> drivers/media/pci/intel/ipu3/ipu3-cio2-main.c |   7 +-
>>>> drivers/media/pci/intel/ipu3/ipu3-cio2.h      |   7 +-
>>>> drivers/staging/media/atomisp/Kconfig         |   2 +
>>>> .../staging/media/atomisp/pci/atomisp_csi2.h  |  67 ---
>>>> .../media/atomisp/pci/atomisp_csi2_bridge.c   | 307 ++----------
>>>> include/media/intel-cio2-bridge.h             | 105 ++++
>>>> 14 files changed, 723 insertions(+), 888 deletions(-)  create mode
>>>> 100644 drivers/media/common/intel-cio2-bridge.c
>>>> delete mode 100644 drivers/media/pci/intel/ipu3/cio2-bridge.h
>>>> create mode 100644 include/media/intel-cio2-bridge.h
>>>>
>>>> --
>>>> 2.41.0
>>>
>
Sakari Ailus June 30, 2023, 9:07 a.m. UTC | #6
Hi Hans,

On Tue, Jun 27, 2023 at 07:56:30PM +0200, Hans de Goede wrote:
> Hi All,
> 
> While working on adding (proper) VCM support to the atomisp code
> I found myself copying yet more code from
> drivers/media/pci/intel/ipu3/cio2-bridge.c into the atomisp code.
> 
> So I decided that it really was time to factor out the common code
> (most of the code) from intel/ipu3/cio2-bridge.c into its own
> helper library and then share it between the atomisp and IPU3 code.
> 
> This will hopefully also be useful for the ongoing work to upstream
> IPU6 input system support which also needs this functionality and
> currently contains a 3th copy of this code in the out of tree driver.
> 
> This set consists of the following parts:

Thanks for the set.

It's indeed being renamed. Wentong wrote a patch to add IVSC support, it
should go in after these.