[libcamera-devel,0/5] Enumerate CameraLens by following sensor's ancillary links
mbox series

Message ID 20211126003118.42356-1-djrscally@gmail.com
Headers show
Series
  • Enumerate CameraLens by following sensor's ancillary links
Related show

Message

Daniel Scally Nov. 26, 2021, 12:31 a.m. UTC
Hello All

This series is an attempt at making the incoming VCM support a little more
agnostic, by following the new style of media links described in my series to
linux-media [0] to find VCMs connected to Sensors in libcamera. It's based on
top of a series from Han-Lin [1] and another from Kate Hsuan [2] (both of which
series are pretty neat, by the way)

The general principle of the new links is an entity to entity link which will
be connected by the kernel between a sensor's entity and an entity for a VCM
device, where those entities have a fwnode match based on the "lens-focus"
property against the sensor. These links are then discovered by libcamera and
followed to create an instance of the CameraLens class, replacing the matching
on driver/device names in Han-Lin's original series.

With the CameraLens available to carry out the controlling of the VCM, I have
pushed the controls to the pipeline handler and removed both all of that
functionality (including the open()/close() of the VCM subdev) from Kate's
work instead.

Thanks
Dan

[0] https://patchwork.linuxtv.org/project/linux-media/list/?series=6792
[1] https://patchwork.libcamera.org/project/libcamera/list/?series=2743
[2] https://patchwork.libcamera.org/project/libcamera/list/?series=2750

Daniel Scally (5):
  libcamera: Add support for ancillary links to MediaLink
  libcamera: media_device: Handle ancillary links in populateLinks()
  libcamera: ipu3-cio2: Discover VCMs through ancillary links
  ipa: ipu3: Send lens controls to pipeline handler
  ipa: ipu3: af: Remove v4l2 interaction from AF algorithm

 include/libcamera/internal/media_object.h | 10 +++++
 include/linux/media.h                     |  1 +
 src/ipa/ipu3/algorithms/af.cpp            | 29 +------------
 src/ipa/ipu3/algorithms/af.h              |  3 --
 src/ipa/ipu3/ipu3.cpp                     |  4 ++
 src/libcamera/media_device.cpp            | 52 ++++++++++++++++-------
 src/libcamera/media_object.cpp            | 24 ++++++++++-
 src/libcamera/pipeline/ipu3/cio2.cpp      | 45 +++++++++++---------
 8 files changed, 101 insertions(+), 67 deletions(-)

Comments

Jean-Michel Hautbois Nov. 26, 2021, 6:43 a.m. UTC | #1
Hi Dan,

On 26/11/2021 01:31, Daniel Scally wrote:
> Hello All
> 
> This series is an attempt at making the incoming VCM support a little more
> agnostic, by following the new style of media links described in my series to
> linux-media [0] to find VCMs connected to Sensors in libcamera. It's based on
> top of a series from Han-Lin [1] and another from Kate Hsuan [2] (both of which
> series are pretty neat, by the way)

Thanks to all three of you for this great work !

How can I test it ? Which kernel for SGo2 is usable (A branch would be 
great) ?

> 
> The general principle of the new links is an entity to entity link which will
> be connected by the kernel between a sensor's entity and an entity for a VCM
> device, where those entities have a fwnode match based on the "lens-focus"
> property against the sensor. These links are then discovered by libcamera and
> followed to create an instance of the CameraLens class, replacing the matching
> on driver/device names in Han-Lin's original series.
> 
> With the CameraLens available to carry out the controlling of the VCM, I have
> pushed the controls to the pipeline handler and removed both all of that
> functionality (including the open()/close() of the VCM subdev) from Kate's
> work instead.
> 
> Thanks
> Dan
> 
> [0] https://patchwork.linuxtv.org/project/linux-media/list/?series=6792
> [1] https://patchwork.libcamera.org/project/libcamera/list/?series=2743
> [2] https://patchwork.libcamera.org/project/libcamera/list/?series=2750
> 
> Daniel Scally (5):
>    libcamera: Add support for ancillary links to MediaLink
>    libcamera: media_device: Handle ancillary links in populateLinks()
>    libcamera: ipu3-cio2: Discover VCMs through ancillary links
>    ipa: ipu3: Send lens controls to pipeline handler
>    ipa: ipu3: af: Remove v4l2 interaction from AF algorithm
> 
>   include/libcamera/internal/media_object.h | 10 +++++
>   include/linux/media.h                     |  1 +
>   src/ipa/ipu3/algorithms/af.cpp            | 29 +------------
>   src/ipa/ipu3/algorithms/af.h              |  3 --
>   src/ipa/ipu3/ipu3.cpp                     |  4 ++
>   src/libcamera/media_device.cpp            | 52 ++++++++++++++++-------
>   src/libcamera/media_object.cpp            | 24 ++++++++++-
>   src/libcamera/pipeline/ipu3/cio2.cpp      | 45 +++++++++++---------
>   8 files changed, 101 insertions(+), 67 deletions(-)
>
Hanlin Chen Nov. 26, 2021, 11:32 a.m. UTC | #2
On Fri, Nov 26, 2021 at 2:44 PM Jean-Michel Hautbois
<jeanmichel.hautbois@ideasonboard.com> wrote:
>
> Hi Dan,
>
> On 26/11/2021 01:31, Daniel Scally wrote:
> > Hello All
> >
> > This series is an attempt at making the incoming VCM support a little more
> > agnostic, by following the new style of media links described in my series to
> > linux-media [0] to find VCMs connected to Sensors in libcamera. It's based on
> > top of a series from Han-Lin [1] and another from Kate Hsuan [2] (both of which
> > series are pretty neat, by the way)
>
> Thanks to all three of you for this great work !
>
> How can I test it ? Which kernel for SGo2 is usable (A branch would be
> great) ?
>
Many thanks for the great work, Daniel!
I just tested it on Chromebook with kernel v5.4, and it works perfectly.
> >
> > The general principle of the new links is an entity to entity link which will
> > be connected by the kernel between a sensor's entity and an entity for a VCM
> > device, where those entities have a fwnode match based on the "lens-focus"
> > property against the sensor. These links are then discovered by libcamera and
> > followed to create an instance of the CameraLens class, replacing the matching
> > on driver/device names in Han-Lin's original series.
> >
> > With the CameraLens available to carry out the controlling of the VCM, I have
> > pushed the controls to the pipeline handler and removed both all of that
> > functionality (including the open()/close() of the VCM subdev) from Kate's
> > work instead.
> >
> > Thanks
> > Dan
> >
> > [0] https://patchwork.linuxtv.org/project/linux-media/list/?series=6792
> > [1] https://patchwork.libcamera.org/project/libcamera/list/?series=2743
> > [2] https://patchwork.libcamera.org/project/libcamera/list/?series=2750
> >
> > Daniel Scally (5):
> >    libcamera: Add support for ancillary links to MediaLink
> >    libcamera: media_device: Handle ancillary links in populateLinks()
> >    libcamera: ipu3-cio2: Discover VCMs through ancillary links
> >    ipa: ipu3: Send lens controls to pipeline handler
> >    ipa: ipu3: af: Remove v4l2 interaction from AF algorithm
> >
> >   include/libcamera/internal/media_object.h | 10 +++++
> >   include/linux/media.h                     |  1 +
> >   src/ipa/ipu3/algorithms/af.cpp            | 29 +------------
> >   src/ipa/ipu3/algorithms/af.h              |  3 --
> >   src/ipa/ipu3/ipu3.cpp                     |  4 ++
> >   src/libcamera/media_device.cpp            | 52 ++++++++++++++++-------
> >   src/libcamera/media_object.cpp            | 24 ++++++++++-
> >   src/libcamera/pipeline/ipu3/cio2.cpp      | 45 +++++++++++---------
> >   8 files changed, 101 insertions(+), 67 deletions(-)
> >
Laurent Pinchart Nov. 26, 2021, 12:48 p.m. UTC | #3
Hi Han-lin,

On Fri, Nov 26, 2021 at 07:32:51PM +0800, Hanlin Chen wrote:
> On Fri, Nov 26, 2021 at 2:44 PM Jean-Michel Hautbois wrote:
> > On 26/11/2021 01:31, Daniel Scally wrote:
> > > Hello All
> > >
> > > This series is an attempt at making the incoming VCM support a little more
> > > agnostic, by following the new style of media links described in my series to
> > > linux-media [0] to find VCMs connected to Sensors in libcamera. It's based on
> > > top of a series from Han-Lin [1] and another from Kate Hsuan [2] (both of which
> > > series are pretty neat, by the way)
> >
> > Thanks to all three of you for this great work !
> >
> > How can I test it ? Which kernel for SGo2 is usable (A branch would be
> > great) ?
>
> Many thanks for the great work, Daniel!
> I just tested it on Chromebook with kernel v5.4, and it works perfectly.

Does it work out of the box, without a need for any kernel or firmware
change ? That would be great, it would certainly facilitate adoption.

> > > The general principle of the new links is an entity to entity link which will
> > > be connected by the kernel between a sensor's entity and an entity for a VCM
> > > device, where those entities have a fwnode match based on the "lens-focus"
> > > property against the sensor. These links are then discovered by libcamera and
> > > followed to create an instance of the CameraLens class, replacing the matching
> > > on driver/device names in Han-Lin's original series.
> > >
> > > With the CameraLens available to carry out the controlling of the VCM, I have
> > > pushed the controls to the pipeline handler and removed both all of that
> > > functionality (including the open()/close() of the VCM subdev) from Kate's
> > > work instead.
> > >
> > > Thanks
> > > Dan
> > >
> > > [0] https://patchwork.linuxtv.org/project/linux-media/list/?series=6792
> > > [1] https://patchwork.libcamera.org/project/libcamera/list/?series=2743
> > > [2] https://patchwork.libcamera.org/project/libcamera/list/?series=2750
> > >
> > > Daniel Scally (5):
> > >    libcamera: Add support for ancillary links to MediaLink
> > >    libcamera: media_device: Handle ancillary links in populateLinks()
> > >    libcamera: ipu3-cio2: Discover VCMs through ancillary links
> > >    ipa: ipu3: Send lens controls to pipeline handler
> > >    ipa: ipu3: af: Remove v4l2 interaction from AF algorithm
> > >
> > >   include/libcamera/internal/media_object.h | 10 +++++
> > >   include/linux/media.h                     |  1 +
> > >   src/ipa/ipu3/algorithms/af.cpp            | 29 +------------
> > >   src/ipa/ipu3/algorithms/af.h              |  3 --
> > >   src/ipa/ipu3/ipu3.cpp                     |  4 ++
> > >   src/libcamera/media_device.cpp            | 52 ++++++++++++++++-------
> > >   src/libcamera/media_object.cpp            | 24 ++++++++++-
> > >   src/libcamera/pipeline/ipu3/cio2.cpp      | 45 +++++++++++---------
> > >   8 files changed, 101 insertions(+), 67 deletions(-)
> > >
Hanlin Chen Nov. 29, 2021, 11:42 a.m. UTC | #4
On Fri, Nov 26, 2021 at 8:48 PM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Hi Han-lin,
>
> On Fri, Nov 26, 2021 at 07:32:51PM +0800, Hanlin Chen wrote:
> > On Fri, Nov 26, 2021 at 2:44 PM Jean-Michel Hautbois wrote:
> > > On 26/11/2021 01:31, Daniel Scally wrote:
> > > > Hello All
> > > >
> > > > This series is an attempt at making the incoming VCM support a little more
> > > > agnostic, by following the new style of media links described in my series to
> > > > linux-media [0] to find VCMs connected to Sensors in libcamera. It's based on
> > > > top of a series from Han-Lin [1] and another from Kate Hsuan [2] (both of which
> > > > series are pretty neat, by the way)
> > >
> > > Thanks to all three of you for this great work !
> > >
> > > How can I test it ? Which kernel for SGo2 is usable (A branch would be
> > > great) ?
> >
> > Many thanks for the great work, Daniel!
> > I just tested it on Chromebook with kernel v5.4, and it works perfectly.
>
> Does it work out of the box, without a need for any kernel or firmware
> change ? That would be great, it would certainly facilitate adoption.
>
I didn't change anything in the firmware or kernel, except for
Daniel's patches ;-).

> > > > The general principle of the new links is an entity to entity link which will
> > > > be connected by the kernel between a sensor's entity and an entity for a VCM
> > > > device, where those entities have a fwnode match based on the "lens-focus"
> > > > property against the sensor. These links are then discovered by libcamera and
> > > > followed to create an instance of the CameraLens class, replacing the matching
> > > > on driver/device names in Han-Lin's original series.
> > > >
> > > > With the CameraLens available to carry out the controlling of the VCM, I have
> > > > pushed the controls to the pipeline handler and removed both all of that
> > > > functionality (including the open()/close() of the VCM subdev) from Kate's
> > > > work instead.
> > > >
> > > > Thanks
> > > > Dan
> > > >
> > > > [0] https://patchwork.linuxtv.org/project/linux-media/list/?series=6792
> > > > [1] https://patchwork.libcamera.org/project/libcamera/list/?series=2743
> > > > [2] https://patchwork.libcamera.org/project/libcamera/list/?series=2750
> > > >
> > > > Daniel Scally (5):
> > > >    libcamera: Add support for ancillary links to MediaLink
> > > >    libcamera: media_device: Handle ancillary links in populateLinks()
> > > >    libcamera: ipu3-cio2: Discover VCMs through ancillary links
> > > >    ipa: ipu3: Send lens controls to pipeline handler
> > > >    ipa: ipu3: af: Remove v4l2 interaction from AF algorithm
> > > >
> > > >   include/libcamera/internal/media_object.h | 10 +++++
> > > >   include/linux/media.h                     |  1 +
> > > >   src/ipa/ipu3/algorithms/af.cpp            | 29 +------------
> > > >   src/ipa/ipu3/algorithms/af.h              |  3 --
> > > >   src/ipa/ipu3/ipu3.cpp                     |  4 ++
> > > >   src/libcamera/media_device.cpp            | 52 ++++++++++++++++-------
> > > >   src/libcamera/media_object.cpp            | 24 ++++++++++-
> > > >   src/libcamera/pipeline/ipu3/cio2.cpp      | 45 +++++++++++---------
> > > >   8 files changed, 101 insertions(+), 67 deletions(-)
> > > >
>
> --
> Regards,
>
> Laurent Pinchart
Daniel Scally Nov. 29, 2021, 11:03 p.m. UTC | #5
Hey Hanlin

On 29/11/2021 11:42, Hanlin Chen wrote:
> On Fri, Nov 26, 2021 at 8:48 PM Laurent Pinchart
> <laurent.pinchart@ideasonboard.com> wrote:
>> Hi Han-lin,
>>
>> On Fri, Nov 26, 2021 at 07:32:51PM +0800, Hanlin Chen wrote:
>>> On Fri, Nov 26, 2021 at 2:44 PM Jean-Michel Hautbois wrote:
>>>> On 26/11/2021 01:31, Daniel Scally wrote:
>>>>> Hello All
>>>>>
>>>>> This series is an attempt at making the incoming VCM support a little more
>>>>> agnostic, by following the new style of media links described in my series to
>>>>> linux-media [0] to find VCMs connected to Sensors in libcamera. It's based on
>>>>> top of a series from Han-Lin [1] and another from Kate Hsuan [2] (both of which
>>>>> series are pretty neat, by the way)
>>>> Thanks to all three of you for this great work !
>>>>
>>>> How can I test it ? Which kernel for SGo2 is usable (A branch would be
>>>> great) ?
>>> Many thanks for the great work, Daniel!
>>> I just tested it on Chromebook with kernel v5.4, and it works perfectly.
>> Does it work out of the box, without a need for any kernel or firmware
>> change ? That would be great, it would certainly facilitate adoption.
>>
> I didn't change anything in the firmware or kernel, except for
> Daniel's patches ;-).


Excellent; glad it's working for you. Does that mean you guys are
including some reference between the sensor and vcm device in your ACPI
design then?

>
>>>>> The general principle of the new links is an entity to entity link which will
>>>>> be connected by the kernel between a sensor's entity and an entity for a VCM
>>>>> device, where those entities have a fwnode match based on the "lens-focus"
>>>>> property against the sensor. These links are then discovered by libcamera and
>>>>> followed to create an instance of the CameraLens class, replacing the matching
>>>>> on driver/device names in Han-Lin's original series.
>>>>>
>>>>> With the CameraLens available to carry out the controlling of the VCM, I have
>>>>> pushed the controls to the pipeline handler and removed both all of that
>>>>> functionality (including the open()/close() of the VCM subdev) from Kate's
>>>>> work instead.
>>>>>
>>>>> Thanks
>>>>> Dan
>>>>>
>>>>> [0] https://patchwork.linuxtv.org/project/linux-media/list/?series=6792
>>>>> [1] https://patchwork.libcamera.org/project/libcamera/list/?series=2743
>>>>> [2] https://patchwork.libcamera.org/project/libcamera/list/?series=2750
>>>>>
>>>>> Daniel Scally (5):
>>>>>    libcamera: Add support for ancillary links to MediaLink
>>>>>    libcamera: media_device: Handle ancillary links in populateLinks()
>>>>>    libcamera: ipu3-cio2: Discover VCMs through ancillary links
>>>>>    ipa: ipu3: Send lens controls to pipeline handler
>>>>>    ipa: ipu3: af: Remove v4l2 interaction from AF algorithm
>>>>>
>>>>>   include/libcamera/internal/media_object.h | 10 +++++
>>>>>   include/linux/media.h                     |  1 +
>>>>>   src/ipa/ipu3/algorithms/af.cpp            | 29 +------------
>>>>>   src/ipa/ipu3/algorithms/af.h              |  3 --
>>>>>   src/ipa/ipu3/ipu3.cpp                     |  4 ++
>>>>>   src/libcamera/media_device.cpp            | 52 ++++++++++++++++-------
>>>>>   src/libcamera/media_object.cpp            | 24 ++++++++++-
>>>>>   src/libcamera/pipeline/ipu3/cio2.cpp      | 45 +++++++++++---------
>>>>>   8 files changed, 101 insertions(+), 67 deletions(-)
>>>>>
>> --
>> Regards,
>>
>> Laurent Pinchart
Hanlin Chen Nov. 30, 2021, 9:47 a.m. UTC | #6
Hi Daniel,

On Tue, Nov 30, 2021 at 7:03 AM Daniel Scally <djrscally@gmail.com> wrote:
>
> Hey Hanlin
>
> On 29/11/2021 11:42, Hanlin Chen wrote:
> > On Fri, Nov 26, 2021 at 8:48 PM Laurent Pinchart
> > <laurent.pinchart@ideasonboard.com> wrote:
> >> Hi Han-lin,
> >>
> >> On Fri, Nov 26, 2021 at 07:32:51PM +0800, Hanlin Chen wrote:
> >>> On Fri, Nov 26, 2021 at 2:44 PM Jean-Michel Hautbois wrote:
> >>>> On 26/11/2021 01:31, Daniel Scally wrote:
> >>>>> Hello All
> >>>>>
> >>>>> This series is an attempt at making the incoming VCM support a little more
> >>>>> agnostic, by following the new style of media links described in my series to
> >>>>> linux-media [0] to find VCMs connected to Sensors in libcamera. It's based on
> >>>>> top of a series from Han-Lin [1] and another from Kate Hsuan [2] (both of which
> >>>>> series are pretty neat, by the way)
> >>>> Thanks to all three of you for this great work !
> >>>>
> >>>> How can I test it ? Which kernel for SGo2 is usable (A branch would be
> >>>> great) ?
> >>> Many thanks for the great work, Daniel!
> >>> I just tested it on Chromebook with kernel v5.4, and it works perfectly.
> >> Does it work out of the box, without a need for any kernel or firmware
> >> change ? That would be great, it would certainly facilitate adoption.
> >>
> > I didn't change anything in the firmware or kernel, except for
> > Daniel's patches ;-).
>
>
> Excellent; glad it's working for you. Does that mean you guys are
> including some reference between the sensor and vcm device in your ACPI
> design then?
>
I guess so ;-|. It needs some time for the experts on our side to
confirm this and see how we should merge them to ChromeOS.
> >
> >>>>> The general principle of the new links is an entity to entity link which will
> >>>>> be connected by the kernel between a sensor's entity and an entity for a VCM
> >>>>> device, where those entities have a fwnode match based on the "lens-focus"
> >>>>> property against the sensor. These links are then discovered by libcamera and
> >>>>> followed to create an instance of the CameraLens class, replacing the matching
> >>>>> on driver/device names in Han-Lin's original series.
> >>>>>
> >>>>> With the CameraLens available to carry out the controlling of the VCM, I have
> >>>>> pushed the controls to the pipeline handler and removed both all of that
> >>>>> functionality (including the open()/close() of the VCM subdev) from Kate's
> >>>>> work instead.
> >>>>>
> >>>>> Thanks
> >>>>> Dan
> >>>>>
> >>>>> [0] https://patchwork.linuxtv.org/project/linux-media/list/?series=6792
> >>>>> [1] https://patchwork.libcamera.org/project/libcamera/list/?series=2743
> >>>>> [2] https://patchwork.libcamera.org/project/libcamera/list/?series=2750
> >>>>>
> >>>>> Daniel Scally (5):
> >>>>>    libcamera: Add support for ancillary links to MediaLink
> >>>>>    libcamera: media_device: Handle ancillary links in populateLinks()
> >>>>>    libcamera: ipu3-cio2: Discover VCMs through ancillary links
> >>>>>    ipa: ipu3: Send lens controls to pipeline handler
> >>>>>    ipa: ipu3: af: Remove v4l2 interaction from AF algorithm
> >>>>>
> >>>>>   include/libcamera/internal/media_object.h | 10 +++++
> >>>>>   include/linux/media.h                     |  1 +
> >>>>>   src/ipa/ipu3/algorithms/af.cpp            | 29 +------------
> >>>>>   src/ipa/ipu3/algorithms/af.h              |  3 --
> >>>>>   src/ipa/ipu3/ipu3.cpp                     |  4 ++
> >>>>>   src/libcamera/media_device.cpp            | 52 ++++++++++++++++-------
> >>>>>   src/libcamera/media_object.cpp            | 24 ++++++++++-
> >>>>>   src/libcamera/pipeline/ipu3/cio2.cpp      | 45 +++++++++++---------
> >>>>>   8 files changed, 101 insertions(+), 67 deletions(-)
> >>>>>
> >> --
> >> Regards,
> >>
> >> Laurent Pinchart
Tomasz Figa Nov. 30, 2021, 11:03 a.m. UTC | #7
On Tue, Nov 30, 2021 at 6:47 PM Hanlin Chen <hanlinchen@chromium.org> wrote:
>
> Hi Daniel,
>
> On Tue, Nov 30, 2021 at 7:03 AM Daniel Scally <djrscally@gmail.com> wrote:
> >
> > Hey Hanlin
> >
> > On 29/11/2021 11:42, Hanlin Chen wrote:
> > > On Fri, Nov 26, 2021 at 8:48 PM Laurent Pinchart
> > > <laurent.pinchart@ideasonboard.com> wrote:
> > >> Hi Han-lin,
> > >>
> > >> On Fri, Nov 26, 2021 at 07:32:51PM +0800, Hanlin Chen wrote:
> > >>> On Fri, Nov 26, 2021 at 2:44 PM Jean-Michel Hautbois wrote:
> > >>>> On 26/11/2021 01:31, Daniel Scally wrote:
> > >>>>> Hello All
> > >>>>>
> > >>>>> This series is an attempt at making the incoming VCM support a little more
> > >>>>> agnostic, by following the new style of media links described in my series to
> > >>>>> linux-media [0] to find VCMs connected to Sensors in libcamera. It's based on
> > >>>>> top of a series from Han-Lin [1] and another from Kate Hsuan [2] (both of which
> > >>>>> series are pretty neat, by the way)
> > >>>> Thanks to all three of you for this great work !
> > >>>>
> > >>>> How can I test it ? Which kernel for SGo2 is usable (A branch would be
> > >>>> great) ?
> > >>> Many thanks for the great work, Daniel!
> > >>> I just tested it on Chromebook with kernel v5.4, and it works perfectly.
> > >> Does it work out of the box, without a need for any kernel or firmware
> > >> change ? That would be great, it would certainly facilitate adoption.
> > >>
> > > I didn't change anything in the firmware or kernel, except for
> > > Daniel's patches ;-).
> >
> >
> > Excellent; glad it's working for you. Does that mean you guys are
> > including some reference between the sensor and vcm device in your ACPI
> > design then?
> >
> I guess so ;-|. It needs some time for the experts on our side to
> confirm this and see how we should merge them to ChromeOS.

Yes, we have the standard lens-focus DT property in the _DSD package:
https://review.coreboot.org/plugins/gitiles/coreboot/+/refs/heads/master/src/mainboard/google/poppy/variants/baseboard/include/baseboard/acpi/cam0.asl#38

> > >
> > >>>>> The general principle of the new links is an entity to entity link which will
> > >>>>> be connected by the kernel between a sensor's entity and an entity for a VCM
> > >>>>> device, where those entities have a fwnode match based on the "lens-focus"
> > >>>>> property against the sensor. These links are then discovered by libcamera and
> > >>>>> followed to create an instance of the CameraLens class, replacing the matching
> > >>>>> on driver/device names in Han-Lin's original series.
> > >>>>>
> > >>>>> With the CameraLens available to carry out the controlling of the VCM, I have
> > >>>>> pushed the controls to the pipeline handler and removed both all of that
> > >>>>> functionality (including the open()/close() of the VCM subdev) from Kate's
> > >>>>> work instead.
> > >>>>>
> > >>>>> Thanks
> > >>>>> Dan
> > >>>>>
> > >>>>> [0] https://patchwork.linuxtv.org/project/linux-media/list/?series=6792
> > >>>>> [1] https://patchwork.libcamera.org/project/libcamera/list/?series=2743
> > >>>>> [2] https://patchwork.libcamera.org/project/libcamera/list/?series=2750
> > >>>>>
> > >>>>> Daniel Scally (5):
> > >>>>>    libcamera: Add support for ancillary links to MediaLink
> > >>>>>    libcamera: media_device: Handle ancillary links in populateLinks()
> > >>>>>    libcamera: ipu3-cio2: Discover VCMs through ancillary links
> > >>>>>    ipa: ipu3: Send lens controls to pipeline handler
> > >>>>>    ipa: ipu3: af: Remove v4l2 interaction from AF algorithm
> > >>>>>
> > >>>>>   include/libcamera/internal/media_object.h | 10 +++++
> > >>>>>   include/linux/media.h                     |  1 +
> > >>>>>   src/ipa/ipu3/algorithms/af.cpp            | 29 +------------
> > >>>>>   src/ipa/ipu3/algorithms/af.h              |  3 --
> > >>>>>   src/ipa/ipu3/ipu3.cpp                     |  4 ++
> > >>>>>   src/libcamera/media_device.cpp            | 52 ++++++++++++++++-------
> > >>>>>   src/libcamera/media_object.cpp            | 24 ++++++++++-
> > >>>>>   src/libcamera/pipeline/ipu3/cio2.cpp      | 45 +++++++++++---------
> > >>>>>   8 files changed, 101 insertions(+), 67 deletions(-)
> > >>>>>
> > >> --
> > >> Regards,
> > >>
> > >> Laurent Pinchart
Daniel Scally Nov. 30, 2021, 11:12 a.m. UTC | #8
Hi Tomasz

On 30/11/2021 11:03, Tomasz Figa wrote:
> On Tue, Nov 30, 2021 at 6:47 PM Hanlin Chen <hanlinchen@chromium.org> wrote:
>> Hi Daniel,
>>
>> On Tue, Nov 30, 2021 at 7:03 AM Daniel Scally <djrscally@gmail.com> wrote:
>>> Hey Hanlin
>>>
>>> On 29/11/2021 11:42, Hanlin Chen wrote:
>>>> On Fri, Nov 26, 2021 at 8:48 PM Laurent Pinchart
>>>> <laurent.pinchart@ideasonboard.com> wrote:
>>>>> Hi Han-lin,
>>>>>
>>>>> On Fri, Nov 26, 2021 at 07:32:51PM +0800, Hanlin Chen wrote:
>>>>>> On Fri, Nov 26, 2021 at 2:44 PM Jean-Michel Hautbois wrote:
>>>>>>> On 26/11/2021 01:31, Daniel Scally wrote:
>>>>>>>> Hello All
>>>>>>>>
>>>>>>>> This series is an attempt at making the incoming VCM support a little more
>>>>>>>> agnostic, by following the new style of media links described in my series to
>>>>>>>> linux-media [0] to find VCMs connected to Sensors in libcamera. It's based on
>>>>>>>> top of a series from Han-Lin [1] and another from Kate Hsuan [2] (both of which
>>>>>>>> series are pretty neat, by the way)
>>>>>>> Thanks to all three of you for this great work !
>>>>>>>
>>>>>>> How can I test it ? Which kernel for SGo2 is usable (A branch would be
>>>>>>> great) ?
>>>>>> Many thanks for the great work, Daniel!
>>>>>> I just tested it on Chromebook with kernel v5.4, and it works perfectly.
>>>>> Does it work out of the box, without a need for any kernel or firmware
>>>>> change ? That would be great, it would certainly facilitate adoption.
>>>>>
>>>> I didn't change anything in the firmware or kernel, except for
>>>> Daniel's patches ;-).
>>>
>>> Excellent; glad it's working for you. Does that mean you guys are
>>> including some reference between the sensor and vcm device in your ACPI
>>> design then?
>>>
>> I guess so ;-|. It needs some time for the experts on our side to
>> confirm this and see how we should merge them to ChromeOS.
> Yes, we have the standard lens-focus DT property in the _DSD package:
> https://review.coreboot.org/plugins/gitiles/coreboot/+/refs/heads/master/src/mainboard/google/poppy/variants/baseboard/include/baseboard/acpi/cam0.asl#38


Well didn't that all work out nice and conveniently! Thanks for
confirming, appreciate it :)

>
>>>>>>>> The general principle of the new links is an entity to entity link which will
>>>>>>>> be connected by the kernel between a sensor's entity and an entity for a VCM
>>>>>>>> device, where those entities have a fwnode match based on the "lens-focus"
>>>>>>>> property against the sensor. These links are then discovered by libcamera and
>>>>>>>> followed to create an instance of the CameraLens class, replacing the matching
>>>>>>>> on driver/device names in Han-Lin's original series.
>>>>>>>>
>>>>>>>> With the CameraLens available to carry out the controlling of the VCM, I have
>>>>>>>> pushed the controls to the pipeline handler and removed both all of that
>>>>>>>> functionality (including the open()/close() of the VCM subdev) from Kate's
>>>>>>>> work instead.
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>> Dan
>>>>>>>>
>>>>>>>> [0] https://patchwork.linuxtv.org/project/linux-media/list/?series=6792
>>>>>>>> [1] https://patchwork.libcamera.org/project/libcamera/list/?series=2743
>>>>>>>> [2] https://patchwork.libcamera.org/project/libcamera/list/?series=2750
>>>>>>>>
>>>>>>>> Daniel Scally (5):
>>>>>>>>    libcamera: Add support for ancillary links to MediaLink
>>>>>>>>    libcamera: media_device: Handle ancillary links in populateLinks()
>>>>>>>>    libcamera: ipu3-cio2: Discover VCMs through ancillary links
>>>>>>>>    ipa: ipu3: Send lens controls to pipeline handler
>>>>>>>>    ipa: ipu3: af: Remove v4l2 interaction from AF algorithm
>>>>>>>>
>>>>>>>>   include/libcamera/internal/media_object.h | 10 +++++
>>>>>>>>   include/linux/media.h                     |  1 +
>>>>>>>>   src/ipa/ipu3/algorithms/af.cpp            | 29 +------------
>>>>>>>>   src/ipa/ipu3/algorithms/af.h              |  3 --
>>>>>>>>   src/ipa/ipu3/ipu3.cpp                     |  4 ++
>>>>>>>>   src/libcamera/media_device.cpp            | 52 ++++++++++++++++-------
>>>>>>>>   src/libcamera/media_object.cpp            | 24 ++++++++++-
>>>>>>>>   src/libcamera/pipeline/ipu3/cio2.cpp      | 45 +++++++++++---------
>>>>>>>>   8 files changed, 101 insertions(+), 67 deletions(-)
>>>>>>>>
>>>>> --
>>>>> Regards,
>>>>>
>>>>> Laurent Pinchart
Tomasz Figa Nov. 30, 2021, 11:13 a.m. UTC | #9
On Tue, Nov 30, 2021 at 8:12 PM Daniel Scally <djrscally@gmail.com> wrote:
>
> Hi Tomasz
>
> On 30/11/2021 11:03, Tomasz Figa wrote:
> > On Tue, Nov 30, 2021 at 6:47 PM Hanlin Chen <hanlinchen@chromium.org> wrote:
> >> Hi Daniel,
> >>
> >> On Tue, Nov 30, 2021 at 7:03 AM Daniel Scally <djrscally@gmail.com> wrote:
> >>> Hey Hanlin
> >>>
> >>> On 29/11/2021 11:42, Hanlin Chen wrote:
> >>>> On Fri, Nov 26, 2021 at 8:48 PM Laurent Pinchart
> >>>> <laurent.pinchart@ideasonboard.com> wrote:
> >>>>> Hi Han-lin,
> >>>>>
> >>>>> On Fri, Nov 26, 2021 at 07:32:51PM +0800, Hanlin Chen wrote:
> >>>>>> On Fri, Nov 26, 2021 at 2:44 PM Jean-Michel Hautbois wrote:
> >>>>>>> On 26/11/2021 01:31, Daniel Scally wrote:
> >>>>>>>> Hello All
> >>>>>>>>
> >>>>>>>> This series is an attempt at making the incoming VCM support a little more
> >>>>>>>> agnostic, by following the new style of media links described in my series to
> >>>>>>>> linux-media [0] to find VCMs connected to Sensors in libcamera. It's based on
> >>>>>>>> top of a series from Han-Lin [1] and another from Kate Hsuan [2] (both of which
> >>>>>>>> series are pretty neat, by the way)
> >>>>>>> Thanks to all three of you for this great work !
> >>>>>>>
> >>>>>>> How can I test it ? Which kernel for SGo2 is usable (A branch would be
> >>>>>>> great) ?
> >>>>>> Many thanks for the great work, Daniel!
> >>>>>> I just tested it on Chromebook with kernel v5.4, and it works perfectly.
> >>>>> Does it work out of the box, without a need for any kernel or firmware
> >>>>> change ? That would be great, it would certainly facilitate adoption.
> >>>>>
> >>>> I didn't change anything in the firmware or kernel, except for
> >>>> Daniel's patches ;-).
> >>>
> >>> Excellent; glad it's working for you. Does that mean you guys are
> >>> including some reference between the sensor and vcm device in your ACPI
> >>> design then?
> >>>
> >> I guess so ;-|. It needs some time for the experts on our side to
> >> confirm this and see how we should merge them to ChromeOS.
> > Yes, we have the standard lens-focus DT property in the _DSD package:
> > https://review.coreboot.org/plugins/gitiles/coreboot/+/refs/heads/master/src/mainboard/google/poppy/variants/baseboard/include/baseboard/acpi/cam0.asl#38
>
>
> Well didn't that all work out nice and conveniently! Thanks for
> confirming, appreciate it :)

Yep, thanks a lot for working on this. :)

Best regards,
Tomasz

>
> >
> >>>>>>>> The general principle of the new links is an entity to entity link which will
> >>>>>>>> be connected by the kernel between a sensor's entity and an entity for a VCM
> >>>>>>>> device, where those entities have a fwnode match based on the "lens-focus"
> >>>>>>>> property against the sensor. These links are then discovered by libcamera and
> >>>>>>>> followed to create an instance of the CameraLens class, replacing the matching
> >>>>>>>> on driver/device names in Han-Lin's original series.
> >>>>>>>>
> >>>>>>>> With the CameraLens available to carry out the controlling of the VCM, I have
> >>>>>>>> pushed the controls to the pipeline handler and removed both all of that
> >>>>>>>> functionality (including the open()/close() of the VCM subdev) from Kate's
> >>>>>>>> work instead.
> >>>>>>>>
> >>>>>>>> Thanks
> >>>>>>>> Dan
> >>>>>>>>
> >>>>>>>> [0] https://patchwork.linuxtv.org/project/linux-media/list/?series=6792
> >>>>>>>> [1] https://patchwork.libcamera.org/project/libcamera/list/?series=2743
> >>>>>>>> [2] https://patchwork.libcamera.org/project/libcamera/list/?series=2750
> >>>>>>>>
> >>>>>>>> Daniel Scally (5):
> >>>>>>>>    libcamera: Add support for ancillary links to MediaLink
> >>>>>>>>    libcamera: media_device: Handle ancillary links in populateLinks()
> >>>>>>>>    libcamera: ipu3-cio2: Discover VCMs through ancillary links
> >>>>>>>>    ipa: ipu3: Send lens controls to pipeline handler
> >>>>>>>>    ipa: ipu3: af: Remove v4l2 interaction from AF algorithm
> >>>>>>>>
> >>>>>>>>   include/libcamera/internal/media_object.h | 10 +++++
> >>>>>>>>   include/linux/media.h                     |  1 +
> >>>>>>>>   src/ipa/ipu3/algorithms/af.cpp            | 29 +------------
> >>>>>>>>   src/ipa/ipu3/algorithms/af.h              |  3 --
> >>>>>>>>   src/ipa/ipu3/ipu3.cpp                     |  4 ++
> >>>>>>>>   src/libcamera/media_device.cpp            | 52 ++++++++++++++++-------
> >>>>>>>>   src/libcamera/media_object.cpp            | 24 ++++++++++-
> >>>>>>>>   src/libcamera/pipeline/ipu3/cio2.cpp      | 45 +++++++++++---------
> >>>>>>>>   8 files changed, 101 insertions(+), 67 deletions(-)
> >>>>>>>>
> >>>>> --
> >>>>> Regards,
> >>>>>
> >>>>> Laurent Pinchart