public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
	Dan Scally <djrscally@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Andy Shevchenko <andy@kernel.org>, Kate Hsuan <hpa@redhat.com>,
	Tsuchiya Yuto <kitakar@gmail.com>,
	Yury Luneff <yury.lunev@gmail.com>,
	Nable <nable.maininbox@googlemail.com>,
	andrey.i.trufanov@gmail.com, Fabio Aiuto <fabioaiuto83@gmail.com>,
	linux-media@vger.kernel.org, linux-staging@lists.linux.dev
Subject: Re: [PATCH 1/9] media: v4l: Add v4l2_acpi_parse_sensor_gpios() helper function
Date: Fri, 19 May 2023 15:08:02 +0200	[thread overview]
Message-ID: <1bd06502-d1f5-1ba2-600a-aec6cdf49a27@redhat.com> (raw)
In-Reply-To: <ZGdohJQSY3GiNLSy@kekkonen.localdomain>

Hi Sakari,

On 5/19/23 14:16, Sakari Ailus wrote:
> Hi Hans,
> 
> On Fri, May 19, 2023 at 01:55:04PM +0200, Hans de Goede wrote:
>> Hi Sakari,
>>
>> On 5/19/23 12:58, Sakari Ailus wrote:
>>> Hi Hans,
>>>
>>> On Fri, May 19, 2023 at 10:55:42AM +0200, Hans de Goede wrote:
>>
>> <snip>
>>
>>>>> Although if the number of those drivers would be small, this could be just
>>>>> undesirable but still somehow acceptable. And I wouldn't expect new sensors
>>>>> to be paired with the IPU2 anymore. How many drivers there would be
>>>>> roughly? I think I've seen ten-ish sensor drivers with the atomisp driver.
>>>>
>>>> About ten-ish drivers sounds right.
>>>>
>>>>> Isn't it possible to create a device for this purpose and use software
>>>>> nodes for the GPIOs? I guess that would be a hack as well and you'd somehow
>>>>> have to initialise this via other route than driver probe.
>>>>
>>>> This creates unsolvable probe-ordering problems. At a minimum we would
>>>> need some check inside sensor drivers for them to return -EPROBE_DEFER
>>>> until the GPIO mappings are added through some other means. Note that
>>>> without the mappings gpiod_get will return -ENOENT, so we cannot just
>>>> use its return value.
>>>
>>> They probably will already need this in order to make sure the atomisp
>>> bridge has been initialized.
>>
>> The instantiation of the sensor i2c_clients and of the atomisp PCI device
>> is independent of each other. In my other patch series I'm moving sensor
>> registration for atomisp over to the v4l2-async framework like all other
>> bridge/ISP drivers use so that atomisp no longer needs special sensor
>> drivers.
>>
>> And AFAIK one of the reasons for having the v4l2-async framework is
>> to avoid needing to have a specific probe order between bridge vs
>> sensor drivers.
>>
>>> Could this code live in the atomisp bridge instead?
>>
>> That does not solve the probe ordering problem the sensor drivers
>> need the GPIOs to enable the sensor and they all enable the sensor
>> in their probe() to check the hw-id. The sensor's probe() function
>> runs without any ordering guarantees vs the ISP/brige's probe()
>> function. This is not an issue because at least during probe()
>> the sensor drivers don't have any interactions with the bridge
>> and any further access to the sensor-drivers is delayed until
>> the v4l2-async notifier completion callback has run.
>>
>> The only way to work around the probe-ordering problem would
>> be to delay checking the hw-id until the sensor gets linked
>> to the bridge. Which would mean registering an async notifier
>> from the sensors to catch binding from the sensor drivers
>> and allowing the binding to fail.
>>
>> Delaying the hw-id check like this would be much more involved
>> then the currently proposed solution and will likely cause
>> other issues like the wrong driver binding when hw-vendors
>> get the ACPI hw-id wrong (this is a known issue with audio-codecs,
>> so chances are we will see this with sensors too).
> 
> A simple question: how do you solve the probe ordering issue when it comes
> to the atomisp bridge creating the graph endpoints needed by sensor
> drivers?
> 
> Or do you assume the sensor drivers will always use some static
> configuration?

This is all modeled after the IPU3 work done by Dan Scally and
ATM the involved sensor drivers assume a static configuration
wrt number of lanes + link frequency.

If / when we want to start supporting say both single + dual
lane modes (with e.g. reduced framerate for high res in single lane)
then AFAICT this will only influence things like e.g. subdev calls
to get supported framerates and of course turning on streaming,
all of which only ever happen after the async subdev registration
of all involved subdevs is complete.

So (again AFAICT) unlike the GPIOs there is no need to need
to know the endpoint configuration at probe() time. But since
we do want to turn the sensor on to check it is actually there
and if it is the type of sensor we expect during probe() we
do need the GPIOs beforehand.

Regards,

Hans




  reply	other threads:[~2023-05-19 13:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-18 15:32 [PATCH 0/9] media: v4l: Add v4l2_acpi_parse_sensor_gpios() helper + gc0310 sensor driver Hans de Goede
2023-05-18 15:32 ` [PATCH 1/9] media: v4l: Add v4l2_acpi_parse_sensor_gpios() helper function Hans de Goede
2023-05-18 16:36   ` Andy Shevchenko
2023-05-18 16:57     ` Hans de Goede
2023-05-19 10:19       ` Andy Shevchenko
2023-05-18 19:48   ` kernel test robot
2023-05-19  7:31   ` Sakari Ailus
2023-05-19  8:55     ` Hans de Goede
2023-05-19 10:21       ` Andy Shevchenko
2023-05-19 10:58       ` Sakari Ailus
2023-05-19 11:55         ` Hans de Goede
2023-05-19 12:16           ` Sakari Ailus
2023-05-19 13:08             ` Hans de Goede [this message]
2023-05-19 14:01               ` Sakari Ailus
2023-05-19 14:39                 ` Hans de Goede
2023-05-24 12:16                   ` Sakari Ailus
2023-05-18 15:32 ` [PATCH 2/9] media: atomisp: Switch to v4l2_acpi_parse_sensor_gpios() Hans de Goede
2023-05-18 15:32 ` [PATCH 3/9] media: atomisp: gc0310: Turn into standard v4l2 sensor driver Hans de Goede
2023-05-18 15:32 ` [PATCH 4/9] media: atomisp: gc0310: Drop XXGC0310 ACPI hardware-id Hans de Goede
2023-05-19 10:24   ` Andy Shevchenko
2023-05-18 15:32 ` [PATCH 5/9] media: atomisp: gc0310: Fix double free in gc0310_remove() Hans de Goede
2023-05-18 15:32 ` [PATCH 6/9] media: atomisp: gc0310: Cleanup includes Hans de Goede
2023-05-18 15:32 ` [PATCH 7/9] media: atomisp: gc0310: Remove gc0310_s_config() function Hans de Goede
2023-05-19 10:32   ` Andy Shevchenko
2023-05-19 10:35     ` Hans de Goede
2023-05-18 15:32 ` [PATCH 8/9] media: atomisp: gc0310: Remove gc0310.h Hans de Goede
2023-05-18 15:32 ` [PATCH 9/9] media: Move gc0310 sensor drivers to drivers/media/i2c/ Hans de Goede
2023-05-21  1:13   ` kernel test robot
2023-05-18 16:02 ` [PATCH 0/9] media: v4l: Add v4l2_acpi_parse_sensor_gpios() helper + gc0310 sensor driver Andy Shevchenko
2023-05-18 16:49   ` Hans de Goede
2023-05-19 12:14 ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1bd06502-d1f5-1ba2-600a-aec6cdf49a27@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andrey.i.trufanov@gmail.com \
    --cc=andy@kernel.org \
    --cc=djrscally@gmail.com \
    --cc=fabioaiuto83@gmail.com \
    --cc=hpa@redhat.com \
    --cc=kitakar@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=nable.maininbox@googlemail.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=yury.lunev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox