mbox series

[v3,0/5] Add multiple-consumer support to int3472-tps68470 driver

Message ID 20220921230439.768185-1-djrscally@gmail.com (mailing list archive)
Headers show
Series Add multiple-consumer support to int3472-tps68470 driver | expand

Message

Daniel Scally Sept. 21, 2022, 11:04 p.m. UTC
Hello all

At the moment there are a few places in the int3472-tps68470 driver that are
limited to just working with a single consuming device dependent on the PMIC.
There are systems where multiple camera sensors share a single TPS68470, so
we need to extend the driver to support them. This requires a couple of tweaks
to the ACPI functions to fetch dependent devices, which also assumes that only
a single dependent will be found.

The v2 for this series was some time ago...it's kept falling to the back of my
to-do list so I've only just gotten round to it; sorry about that. v2 here:

https://lore.kernel.org/linux-acpi/20220327161344.50477-1-djrscally@gmail.com/

Thanks
Dan

Daniel Scally (5):
  ACPI: scan: Add acpi_dev_get_next_consumer_dev()
  ACPI: bus: Add iterator for dependent devices
  platform/x86: int3472: Support multiple clock consumers
  platform/x86: int3472: Support multiple gpio lookups in board data
  platform/x86: int3472: Add board data for Surface Go2 IR camera

 drivers/acpi/scan.c                           | 40 +++++++---
 drivers/clk/clk-tps68470.c                    | 13 +++-
 drivers/platform/x86/intel/int3472/common.c   |  2 +-
 drivers/platform/x86/intel/int3472/tps68470.c | 76 ++++++++++++++++---
 drivers/platform/x86/intel/int3472/tps68470.h |  3 +-
 .../x86/intel/int3472/tps68470_board_data.c   | 54 ++++++++++++-
 include/acpi/acpi_bus.h                       | 15 +++-
 include/linux/platform_data/tps68470.h        |  7 +-
 8 files changed, 177 insertions(+), 33 deletions(-)

Comments

Hans de Goede Sept. 22, 2022, 8:55 a.m. UTC | #1
Hi All,

On 9/22/22 01:04, Daniel Scally wrote:
> Hello all
> 
> At the moment there are a few places in the int3472-tps68470 driver that are
> limited to just working with a single consuming device dependent on the PMIC.
> There are systems where multiple camera sensors share a single TPS68470, so
> we need to extend the driver to support them. This requires a couple of tweaks
> to the ACPI functions to fetch dependent devices, which also assumes that only
> a single dependent will be found.
> 
> The v2 for this series was some time ago...it's kept falling to the back of my
> to-do list so I've only just gotten round to it; sorry about that. v2 here:
> 
> https://lore.kernel.org/linux-acpi/20220327161344.50477-1-djrscally@gmail.com/

Rafael, I would like to merge this through the pdx86 tree may I have your
ack for patches 1 + 2 for this. As a reminder (since it has been a while)
here are your review remarks to v2 of patch 1:

https://lore.kernel.org/platform-driver-x86/CAJZ5v0i2ciLHP-=8eQcZc0v0xCzhKHKpxLC=Kgv6W5E_5=HQJA@mail.gmail.com/

(which both seem to have been addressed)

AFAICT you did not have any remarks for v2 of patch 2.

Regards,

Hans

p.s.

Dan, if I want to give the IR cam a test run on my own Surface Go (version 1)
I guess I may need a sensor driver? Where can I find that sensor driver and
what do I need in userspace to test this ?



> Daniel Scally (5):
>   ACPI: scan: Add acpi_dev_get_next_consumer_dev()
>   ACPI: bus: Add iterator for dependent devices
>   platform/x86: int3472: Support multiple clock consumers
>   platform/x86: int3472: Support multiple gpio lookups in board data
>   platform/x86: int3472: Add board data for Surface Go2 IR camera
> 
>  drivers/acpi/scan.c                           | 40 +++++++---
>  drivers/clk/clk-tps68470.c                    | 13 +++-
>  drivers/platform/x86/intel/int3472/common.c   |  2 +-
>  drivers/platform/x86/intel/int3472/tps68470.c | 76 ++++++++++++++++---
>  drivers/platform/x86/intel/int3472/tps68470.h |  3 +-
>  .../x86/intel/int3472/tps68470_board_data.c   | 54 ++++++++++++-
>  include/acpi/acpi_bus.h                       | 15 +++-
>  include/linux/platform_data/tps68470.h        |  7 +-
>  8 files changed, 177 insertions(+), 33 deletions(-)
>
Daniel Scally Sept. 22, 2022, 9:07 a.m. UTC | #2
Hi Hans

On 22/09/2022 09:55, Hans de Goede wrote:
> Hi All,
>
> On 9/22/22 01:04, Daniel Scally wrote:
>> Hello all
>>
>> At the moment there are a few places in the int3472-tps68470 driver that are
>> limited to just working with a single consuming device dependent on the PMIC.
>> There are systems where multiple camera sensors share a single TPS68470, so
>> we need to extend the driver to support them. This requires a couple of tweaks
>> to the ACPI functions to fetch dependent devices, which also assumes that only
>> a single dependent will be found.
>>
>> The v2 for this series was some time ago...it's kept falling to the back of my
>> to-do list so I've only just gotten round to it; sorry about that. v2 here:
>>
>> https://lore.kernel.org/linux-acpi/20220327161344.50477-1-djrscally@gmail.com/
> Rafael, I would like to merge this through the pdx86 tree may I have your
> ack for patches 1 + 2 for this. As a reminder (since it has been a while)
> here are your review remarks to v2 of patch 1:
>
> https://lore.kernel.org/platform-driver-x86/CAJZ5v0i2ciLHP-=8eQcZc0v0xCzhKHKpxLC=Kgv6W5E_5=HQJA@mail.gmail.com/
>
> (which both seem to have been addressed)
>
> AFAICT you did not have any remarks for v2 of patch 2.
>
> Regards,
>
> Hans
>
> p.s.
>
> Dan, if I want to give the IR cam a test run on my own Surface Go (version 1)
> I guess I may need a sensor driver? Where can I find that sensor driver and
> what do I need in userspace to test this ?


It's the ov7251 sensor driver - the required changes are in mainline now
actually so you should be good there. The format of the data is a bit
unconventional; it's Y10 but passed through Intel's CIO2 CSI receiver
which packs it into a different format [1]. I'm probably just going to
add support for that format to Howdy [2] which is what people want to
use this camera for, but for now you can just test by using the
ipu3-unpack utility in libcamera [3] to convert back to proper Y10 and
then raw2rgbpnm [4] to turn it into a ppm. I use this script for now:
https://paste.debian.net/1254629. Be warned that unless you are in
sunlight the image is basically just grey - the IR LED on the front of
the surface needs driving to give a clear image otherwise. I have an led
driver for the tps68470 which can do that, I'm just working on getting
it all tied in so it triggers when streaming starts.



[1]
https://www.linuxtv.org/downloads/v4l-dvb-apis-new/userspace-api/v4l/pixfmt-yuv-luma.html

[2] https://github.com/boltgolt/howdy

[3] https://git.libcamera.org/libcamera/libcamera.git/tree/utils/ipu3

[4] https://paste.debian.net/1254629

>
>
>> Daniel Scally (5):
>>   ACPI: scan: Add acpi_dev_get_next_consumer_dev()
>>   ACPI: bus: Add iterator for dependent devices
>>   platform/x86: int3472: Support multiple clock consumers
>>   platform/x86: int3472: Support multiple gpio lookups in board data
>>   platform/x86: int3472: Add board data for Surface Go2 IR camera
>>
>>  drivers/acpi/scan.c                           | 40 +++++++---
>>  drivers/clk/clk-tps68470.c                    | 13 +++-
>>  drivers/platform/x86/intel/int3472/common.c   |  2 +-
>>  drivers/platform/x86/intel/int3472/tps68470.c | 76 ++++++++++++++++---
>>  drivers/platform/x86/intel/int3472/tps68470.h |  3 +-
>>  .../x86/intel/int3472/tps68470_board_data.c   | 54 ++++++++++++-
>>  include/acpi/acpi_bus.h                       | 15 +++-
>>  include/linux/platform_data/tps68470.h        |  7 +-
>>  8 files changed, 177 insertions(+), 33 deletions(-)
>>
Rafael J. Wysocki Sept. 24, 2022, 5:15 p.m. UTC | #3
On Thu, Sep 22, 2022 at 10:55 AM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi All,
>
> On 9/22/22 01:04, Daniel Scally wrote:
> > Hello all
> >
> > At the moment there are a few places in the int3472-tps68470 driver that are
> > limited to just working with a single consuming device dependent on the PMIC.
> > There are systems where multiple camera sensors share a single TPS68470, so
> > we need to extend the driver to support them. This requires a couple of tweaks
> > to the ACPI functions to fetch dependent devices, which also assumes that only
> > a single dependent will be found.
> >
> > The v2 for this series was some time ago...it's kept falling to the back of my
> > to-do list so I've only just gotten round to it; sorry about that. v2 here:
> >
> > https://lore.kernel.org/linux-acpi/20220327161344.50477-1-djrscally@gmail.com/
>
> Rafael, I would like to merge this through the pdx86 tree may I have your
> ack for patches 1 + 2 for this. As a reminder (since it has been a while)
> here are your review remarks to v2 of patch 1:
>
> https://lore.kernel.org/platform-driver-x86/CAJZ5v0i2ciLHP-=8eQcZc0v0xCzhKHKpxLC=Kgv6W5E_5=HQJA@mail.gmail.com/
>
> (which both seem to have been addressed)
>
> AFAICT you did not have any remarks for v2 of patch 2.

No, I didn't.

However, because acpi_bus_get_acpi_device() becomes
acpi_get_acpi_dev() in my tree, I think it's better to route this
material through it, if that's not a problem.

I've tentatively queued it up for 6.1.

Thanks!

> p.s.
>
> Dan, if I want to give the IR cam a test run on my own Surface Go (version 1)
> I guess I may need a sensor driver? Where can I find that sensor driver and
> what do I need in userspace to test this ?
>
>
>
> > Daniel Scally (5):
> >   ACPI: scan: Add acpi_dev_get_next_consumer_dev()
> >   ACPI: bus: Add iterator for dependent devices
> >   platform/x86: int3472: Support multiple clock consumers
> >   platform/x86: int3472: Support multiple gpio lookups in board data
> >   platform/x86: int3472: Add board data for Surface Go2 IR camera
> >
> >  drivers/acpi/scan.c                           | 40 +++++++---
> >  drivers/clk/clk-tps68470.c                    | 13 +++-
> >  drivers/platform/x86/intel/int3472/common.c   |  2 +-
> >  drivers/platform/x86/intel/int3472/tps68470.c | 76 ++++++++++++++++---
> >  drivers/platform/x86/intel/int3472/tps68470.h |  3 +-
> >  .../x86/intel/int3472/tps68470_board_data.c   | 54 ++++++++++++-
> >  include/acpi/acpi_bus.h                       | 15 +++-
> >  include/linux/platform_data/tps68470.h        |  7 +-
> >  8 files changed, 177 insertions(+), 33 deletions(-)
> >
>
Hans de Goede Sept. 25, 2022, 9:23 a.m. UTC | #4
Hi,

On 9/24/22 19:15, Rafael J. Wysocki wrote:
> On Thu, Sep 22, 2022 at 10:55 AM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> Hi All,
>>
>> On 9/22/22 01:04, Daniel Scally wrote:
>>> Hello all
>>>
>>> At the moment there are a few places in the int3472-tps68470 driver that are
>>> limited to just working with a single consuming device dependent on the PMIC.
>>> There are systems where multiple camera sensors share a single TPS68470, so
>>> we need to extend the driver to support them. This requires a couple of tweaks
>>> to the ACPI functions to fetch dependent devices, which also assumes that only
>>> a single dependent will be found.
>>>
>>> The v2 for this series was some time ago...it's kept falling to the back of my
>>> to-do list so I've only just gotten round to it; sorry about that. v2 here:
>>>
>>> https://lore.kernel.org/linux-acpi/20220327161344.50477-1-djrscally@gmail.com/
>>
>> Rafael, I would like to merge this through the pdx86 tree may I have your
>> ack for patches 1 + 2 for this. As a reminder (since it has been a while)
>> here are your review remarks to v2 of patch 1:
>>
>> https://lore.kernel.org/platform-driver-x86/CAJZ5v0i2ciLHP-=8eQcZc0v0xCzhKHKpxLC=Kgv6W5E_5=HQJA@mail.gmail.com/
>>
>> (which both seem to have been addressed)
>>
>> AFAICT you did not have any remarks for v2 of patch 2.
> 
> No, I didn't.
> 
> However, because acpi_bus_get_acpi_device() becomes
> acpi_get_acpi_dev() in my tree, I think it's better to route this
> material through it, if that's not a problem.

Routing it to your tree is fine.

> I've tentatively queued it up for 6.1.

Great, thank you!

Regards,

Hans



>> p.s.
>>
>> Dan, if I want to give the IR cam a test run on my own Surface Go (version 1)
>> I guess I may need a sensor driver? Where can I find that sensor driver and
>> what do I need in userspace to test this ?
>>
>>
>>
>>> Daniel Scally (5):
>>>   ACPI: scan: Add acpi_dev_get_next_consumer_dev()
>>>   ACPI: bus: Add iterator for dependent devices
>>>   platform/x86: int3472: Support multiple clock consumers
>>>   platform/x86: int3472: Support multiple gpio lookups in board data
>>>   platform/x86: int3472: Add board data for Surface Go2 IR camera
>>>
>>>  drivers/acpi/scan.c                           | 40 +++++++---
>>>  drivers/clk/clk-tps68470.c                    | 13 +++-
>>>  drivers/platform/x86/intel/int3472/common.c   |  2 +-
>>>  drivers/platform/x86/intel/int3472/tps68470.c | 76 ++++++++++++++++---
>>>  drivers/platform/x86/intel/int3472/tps68470.h |  3 +-
>>>  .../x86/intel/int3472/tps68470_board_data.c   | 54 ++++++++++++-
>>>  include/acpi/acpi_bus.h                       | 15 +++-
>>>  include/linux/platform_data/tps68470.h        |  7 +-
>>>  8 files changed, 177 insertions(+), 33 deletions(-)
>>>
>>
>