X86 platform drivers
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mark Gross <markgross@kernel.org>,
	Andy Shevchenko <andy@kernel.org>,
	Daniel Scally <djrscally@gmail.com>,
	platform-driver-x86@vger.kernel.org, Kate Hsuan <hpa@redhat.com>,
	Mark Pearson <markpearson@lenovo.com>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH 1/6] media: ov5693: Add support for a privacy-led GPIO
Date: Wed, 30 Nov 2022 17:29:31 +0100	[thread overview]
Message-ID: <da97e941-d08a-6c9e-d526-2629668d502c@redhat.com> (raw)
In-Reply-To: <Y4d0q08KXoUBD+t6@pendragon.ideasonboard.com>

Hi,

On 11/30/22 16:20, Laurent Pinchart wrote:
> On Wed, Nov 30, 2022 at 02:52:50PM +0000, Sakari Ailus wrote:
>> On Wed, Nov 30, 2022 at 02:56:46PM +0100, Hans de Goede wrote:
>>> On 11/30/22 14:41, Sakari Ailus wrote:
>>>> On Wed, Nov 30, 2022 at 12:11:44AM +0100, Hans de Goede wrote:
>>>>> Add support for a privacy-led GPIO.
>>>>>
>>>>> Making the privacy LED to controlable from userspace, as using the LED
>>>>> class subsystem would do, would make it too easy for spy-ware to disable
>>>>> the LED.
>>>>>
>>>>> To avoid this have the sensor driver directly control the LED.
>>>>>
>>>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>>>> ---
>>>>> Note an additional advantage of directly controlling the GPIO is that
>>>>> GPIOs are tied directly to consumer devices. Where as with a LED class
>>>>> device, there would need to be some mechanism to tie the right LED
>>>>> (e.g front or back) to the right sensor.
>>>>
>>>> Thanks for the patch.
>>>>
>>>> This approach has the drawback that support needs to be added for each
>>>> sensor separately. Any idea how many sensor drivers might need this?
>>>
>>> Quite a few probably. But as discussed here I plan to write a generic
>>> sensor_power helper library since many sensor drivers have a lot of
>>> boilerplate code to get clks + regulators + enable/reset gpios. The plan
>>> is to add support for a "privacy-led" to this library so that all sensors
>>> which use this get support for free.
>>
>> I'm not sure how well this could be generalised. While most sensors do
>> something similar there are subtle differences. If those can be taken into
>> account I guess it should be doable. But would it simplify things or reduce
>> the number of lines of code as a whole?
> 
> While I think we need a camera sensor helper, I also doubt managing the
> power sequence in the helper would help much. The privacy LED, however,
> could be handled there.

From a quick peek most of the sensor drivers I've looked at
(which is only a few) do:

-bulk-enable-regulators
-enable 1 clk
-set bunch of gpios
-sleep a bit

Since this requires to first get all the resources for this, which
needs error checking + reporting and then requires also error
checking the actual enabling + rollback on failure this is quite
a bit of code duplicated against many sensor drivers.

I agree that if a sensor does not fit in this model, that it then
should not use the helper and just open code the sequence but
I believe that for a bunch of sensor drivers with a simple
power-on sequence this can remove a bunch of code duplication.

Anways this is a clear case of the proof is in the tasting of
the pudding. So when I can make some time for this I'll submit
a patch series with the helper + converting a couple of sensors
(those which I can test) and then we can see from there.

>> The privacy LED is separate from sensor, including its power on/off
>> sequences which suggests it could be at least as well be handled
>> separately.
> 
> And if the privacy LED is controllable through a GPIO, I think it should
> be turned on at stream on time, not at power on time. That would allow
> things like reading the OTP data from the sensor without flashing the
> privacy LED.

Agreed.

Regards,

Hans



  parent reply	other threads:[~2022-11-30 16:30 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29 23:11 [PATCH 0/6] ov5693/int3472: Privacy LED handling changes + IPU6 compatibility Hans de Goede
2022-11-29 23:11 ` [PATCH 1/6] media: ov5693: Add support for a privacy-led GPIO Hans de Goede
2022-11-30 13:41   ` Sakari Ailus
2022-11-30 13:56     ` Hans de Goede
2022-11-30 14:52       ` Sakari Ailus
2022-11-30 15:20         ` Laurent Pinchart
2022-11-30 16:07           ` Andy Shevchenko
2022-11-30 16:23             ` Laurent Pinchart
2022-11-30 16:29           ` Hans de Goede [this message]
2022-11-30 16:34         ` Hans de Goede
2022-12-02 10:54           ` Laurent Pinchart
2022-12-02 11:21             ` Hans de Goede
2022-12-02 11:49               ` Laurent Pinchart
2022-12-02 11:53                 ` Andy Shevchenko
2022-12-02 12:14                   ` Laurent Pinchart
2022-12-02 12:23                     ` Andy Shevchenko
2022-12-02 13:46                     ` Sakari Ailus
2022-12-02 15:55                 ` Hans de Goede
2022-12-02 13:49           ` Sakari Ailus
2022-11-29 23:11 ` [PATCH 2/6] platform/x86: int3472/discrete: Refactor GPIO to sensor mapping Hans de Goede
2022-11-30  9:49   ` Andy Shevchenko
2022-11-30 10:37     ` Hans de Goede
2022-11-29 23:11 ` [PATCH 3/6] platform/x86: int3472/discrete: Treat privacy LED as regular GPIO Hans de Goede
2022-11-30  9:54   ` Andy Shevchenko
2022-11-30 10:34     ` Hans de Goede
2022-11-30 11:04       ` Andy Shevchenko
2022-11-29 23:11 ` [PATCH 4/6] platform/x86: int3472/discrete: Move GPIO request to skl_int3472_register_clock() Hans de Goede
2022-11-29 23:11 ` [PATCH 5/6] platform/x86: int3472/discrete: Ensure the clk/power enable pins are in output mode Hans de Goede
2022-11-30  9:59   ` Andy Shevchenko
2022-11-30 10:37     ` Hans de Goede
2022-11-29 23:11 ` [PATCH 6/6] platform/x86: int3472/discrete: Get the polarity from the _DSM entry Hans de Goede
2022-11-30 10:01   ` Andy Shevchenko
2022-11-30 10:39     ` Hans de Goede
2022-11-30 11:06       ` Andy Shevchenko
2022-11-30 11:10         ` Andy Shevchenko
2022-12-02 23:51         ` Hans de Goede
2022-11-30 10:03 ` [PATCH 0/6] ov5693/int3472: Privacy LED handling changes + IPU6 compatibility Andy Shevchenko
2022-11-30 10:40   ` Hans de Goede
2022-11-30 11:07 ` Andy Shevchenko
2022-12-02 13:50 ` Sakari Ailus
2022-12-07 17:34 ` Hans de Goede
2022-12-07 17:36   ` 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=da97e941-d08a-6c9e-d526-2629668d502c@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andy@kernel.org \
    --cc=djrscally@gmail.com \
    --cc=hpa@redhat.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=markpearson@lenovo.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.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