mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: Benjamin Bara <bbara93@gmail.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Alexander Stein <alexander.stein@ew.tq-group.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Benjamin Bara <benjamin.bara@skidata.com>
Subject: Re: [PATCH v2 1/2] media: i2c: imx290: Check for availability in probe()
Date: Sat, 31 Aug 2024 03:53:42 +0300	[thread overview]
Message-ID: <20240831005342.GA27958@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20240830122529.6dcqamcxk6crfpvb@thinkpad>

On Fri, Aug 30, 2024 at 05:55:29PM +0530, Manivannan Sadhasivam wrote:
> On Fri, Aug 30, 2024 at 12:25:26PM +0300, Laurent Pinchart wrote:
> > On Fri, Aug 30, 2024 at 02:01:07PM +0530, Manivannan Sadhasivam wrote:
> > > On Thu, Aug 29, 2024 at 07:48:43PM +0300, Laurent Pinchart wrote:
> > > > On Thu, Aug 29, 2024 at 10:02:47PM +0530, Manivannan Sadhasivam wrote:
> > > > > On Thu, Aug 29, 2024 at 04:19:09PM +0300, Laurent Pinchart wrote:
> > > > > 
> > > > > Hi Laurent,
> > > > > 
> > > > > [...]
> > > > > 
> > > > > > > +		dev_err(dev, "Sensor is not in standby mode\n");
> > > > > > > +		ret = -ENODEV;
> > > > > > > +		goto err_pm;
> > > > > > > +	}
> > > > > > > +
> > > > > > 
> > > > > > My last concern is about accessing hardware at probe time. There are
> > > > > > known cases where this is problematic. They can be split in two
> > > > > > categories, systems that exhibit unwanted side effects when powering the
> > > > > > sensor up, and systems where the sensor can't be accessed at probe time.
> > > > > > 
> > > > > > The two issues I can think of in the first category is devices that have
> > > > > > a camera privacy light that could cause worries among users if it
> > > > > > flashes at boot time, and devices that agressively optimize boot time.
> > > > > > 
> > > > > > In the second category, I know that some people use camera serdes
> > > > > > (FPD-Link, GMSL, ...) that are controlled by userspace. As they should
> > > > > > instead use kernel drivers for those components, upstream may not care
> > > > > > too much about this use case. Another issue I was told about was a
> > > > > > device booting in temperatures that were too low for the camera to
> > > > > > operate, which then needed half an hour to heat the device enclosure
> > > > > > before the sensor and serdes could be accessed. That's a bit extreme,
> > > > > > but it sounds like a valid use case to me.
> > > > > > 
> > > > > > What do we do with those cases ? Detecting devices at probe time does
> > > > > > have value, so I think it should be a policy decision. We may want to
> > > > > > convey some of that information through DT properties (I'm not sure what
> > > > > > would be acceptable there though). In any case, that's quite a bit of
> > > > > > yak shaving, so I'm inclined to accept this series (or rather its next
> > > > > > version), given that quite a few other camera sensor drivers detect the
> > > > > > device at probe time. I would however like feedback on the problem to
> > > > > > try and find a good solution.
> > > > > 
> > > > > Most of the issues you mentioned applies to other hardware peripherals also IMO.
> > > > > And it is common for the drivers to read registers and make sure the device is
> > > > > detected on the bus during probe().
> > > > 
> > > > That's true. I think the problem affects different device types
> > > > differently though, and this may (or may not) call for different
> > > > solutions.
> > > > 
> > > > > If an usecase doesn't want to read the
> > > > > registers during probe time, then they _should_not_ build the driver as built-in
> > > > > rather make it as a loadable module and load it whenever necessary. This applies
> > > > > to boot time optimization as well.
> > > > 
> > > > For most of the use cases I listed I agree with you. One exception is
> > > > the privacy light issue. Regardless of when the camera sensor driver is
> > > > loaded, powering the device at probe time will flash the privacy light.
> > > > Doing so later than boot time would probably make the issue even worse,
> > > > I would worry more if I saw my webcam privacy light flashing at a random
> > > > point after boot time.
> > > 
> > > I'm not familiar with the privacy light feature in camera sensors, but is there
> > > no way to prevent it from enabling by default? If that's not possible, it makes
> > > sense to disable it using a DT property as it is a hardware feature.
> > 
> > The whole point of the privacy light is that it shouldn't be possible to
> > disable it by software. Otherwise malicious software could try to work
> > around it. On many devices it is hardwired to one of the camera sensor's
> > power supplies.
> 
> Ah okay, please forgive my ignorance here. But still I'm not sure about the DT
> usage. Maybe it is best to send out a bindings patch and see what the
> maintainers have to say?

Yes, that's a good path forward. I don't think it should block this
patch though.

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2024-08-31  0:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-28 18:13 [PATCH v2 0/2] media: i2c: imx290: check " Benjamin Bara
2024-08-28 18:13 ` [PATCH v2 1/2] media: i2c: imx290: Check " Benjamin Bara
2024-08-29  7:05   ` Sakari Ailus
2024-08-29  7:32     ` Benjamin Bara
2024-08-29 12:39     ` Sakari Ailus
2024-08-29 12:41       ` Sakari Ailus
2024-08-29 12:42   ` Sakari Ailus
2024-08-29 13:19   ` Laurent Pinchart
2024-08-29 15:36     ` Benjamin Bara
2024-08-29 17:00       ` Laurent Pinchart
2024-08-29 16:32     ` Manivannan Sadhasivam
2024-08-29 16:48       ` Laurent Pinchart
2024-08-30  8:31         ` Manivannan Sadhasivam
2024-08-30  9:25           ` Laurent Pinchart
2024-08-30 12:25             ` Manivannan Sadhasivam
2024-08-31  0:53               ` Laurent Pinchart [this message]
2024-08-28 18:13 ` [PATCH v2 2/2] media: i2c: imx290: Remove CHIP_ID reg definition Benjamin Bara
2024-08-29 12:39   ` Laurent Pinchart
2024-08-29 13:06 ` [PATCH v2 0/2] media: i2c: imx290: check for availability in probe() Sakari Ailus

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=20240831005342.GA27958@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=alexander.stein@ew.tq-group.com \
    --cc=bbara93@gmail.com \
    --cc=benjamin.bara@skidata.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=mchehab@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

all inboxes | Powered by JetHome®