linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: Jacek Anaszewski <j.anaszewski@samsung.com>,
	Bryan Wu <cooloney@gmail.com>,
	Linux LED Subsystem <linux-leds@vger.kernel.org>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	b.zolnierkie@samsung.com, "rpurdie@rpsys.net" <rpurdie@rpsys.net>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>
Subject: Re: [PATCH/RFC v8 02/14] Documentation: leds: Add description of LED Flash class extension
Date: Thu, 29 Jan 2015 22:24:40 +0100	[thread overview]
Message-ID: <20150129212440.GB21140@amd> (raw)
In-Reply-To: <20141210231431.GP15559@valkosipuli.retiisi.org.uk>

Hi!

> > > This approach would require implementing additional mechanisms on
> > > both sides: LED Flash class core and a LED Flash class driver.
> > > In the former the sysfs attribute write permissions would have
> > > to be decided in the runtime and in the latter caching mechanism
> > 
> > Write attributes at runtime? Why? We can emulate sane and consistent
> > behaviour for all the controllers: read gives you list of faults,
> > write clears it. We can do it for all the controllers.
> > 
> > Only cost is few lines of code in the drivers where hardware clears
> > faults at read.
> 
> Please take the time to read this, and consider it.
> 
> I'd say the cost is I2C register access, not so much a few lines added to
> the drivers. The functionality and behaviour between the flash controllers
> varies. They have different faults, presence of (some) faults may prevent
> strobing, some support reading the flash status and some don't.
> 
> Some of the flash faults are mostly relevant in production testing, some can
> be used to find hardware issues during use (rare) and some are produced in
> common use (timeout, for instance).
> 
> The V4L2 flash API defines that reading the faults clears them, but does not
> state whether presence of faults would prevent further use of the flash.
> This is flash controller chip specific.

Yeah, but we are discussing sysfs reads. V4L2 API can just behave differently.

> I think you *could* force a policy on the level of kernel API, for instance
> require that the user clears the faults before strobing again rather than
> relying on the chip requiring this instead.

Yes, we could do that.

> Most of the time there are no faults. When there are, they may appear at
> some point of time after the strobing, but how long? Probably roughly after
> the timeout period the flash should have faults available if there were any
> --- except if the strobe is external such as a sensor timed strobe. In that
> case the software running on the CPU has no knowledge when the flash is
> strobed nor when the faults should be read. So the requirement of checking
> the faults would probably have to be limited to software strobe only. The
> user would still have to be able to check the faults for externally strobed
> pulses. Would it be acceptable that the interface was different
> there?

Should the user just read the faults before scheduling next strobe?

> So, after the user has strobed, when the user should check the flash faults?
> After the timeout period has passed? Right before strobing again? If this
> was a requirement, it adds an additional I2C access to potentially the place
> which should absolutely have no extra delay --- the flash strobe time. This
> would be highly unwanted.

I'd do it before strobing again. Not neccessarily "just" before
strobing again (you claim it is slow ... is it really so slow it matters)?

> Finally, should the LED flash class enforce such a policy, would the V4L2
> flash API which is provided to the same devices be changed as well? I'm not
> against that if we have
> 
> 	1) can come up with a good policy that is understood to be
> 	   meaningful for all thinkable flash controller implementations and
> 
> 	2) agreement the behaviour can be changed.

I am saying that reading from /sys should not have side effects. For
V4L2, existing behaviour might be ok.

Each driver should have two operations: read_faults() and
clear_faults().

On devices where i2c read clears faults, operations will be:

int my_faults

read_faults()
	my_faults |= read_i2c_faults()
	return my_faults

clear_faults()
	my_faults = 0

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2015-01-29 21:24 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-28  9:17 [PATCH/RFC v8 00/14] LED / flash API integration Jacek Anaszewski
2014-11-28  9:17 ` [PATCH/RFC v8 01/14] leds: Add LED Flash class extension to the LED subsystem Jacek Anaszewski
     [not found]   ` <CAK5ve-KMdJOLQ0ThKw9OM9u_CcwT87Bx4vcUjnX4fG2+t3pJsw@mail.gmail.com>
2014-12-08 17:07     ` Jacek Anaszewski
2014-11-28  9:17 ` [PATCH/RFC v8 02/14] Documentation: leds: Add description of LED Flash class extension Jacek Anaszewski
2014-11-29 12:58   ` Pavel Machek
2014-12-01 11:40     ` Jacek Anaszewski
2014-12-01 13:04       ` Pavel Machek
2014-12-01 13:58         ` Jacek Anaszewski
2014-12-01 15:21           ` Sakari Ailus
2014-12-05 19:45           ` Bryan Wu
2014-12-06 12:43             ` Pavel Machek
2014-12-08 16:55               ` Jacek Anaszewski
2014-12-08 20:18                 ` Pavel Machek
2014-12-09  8:54                   ` Jacek Anaszewski
2014-12-09 15:50                     ` Pavel Machek
2014-12-10 13:17                       ` Jacek Anaszewski
2014-12-10 13:32                         ` Pavel Machek
2014-12-10 23:14                       ` Sakari Ailus
2015-01-29 21:24                         ` Pavel Machek [this message]
2014-11-28  9:17 ` [PATCH/RFC v8 03/14] Documentation: leds: Add description of v4l2-flash sub-device Jacek Anaszewski
2014-11-29 23:44   ` Sakari Ailus
2014-12-05 19:50   ` Bryan Wu
2014-11-28  9:17 ` [PATCH/RFC v8 04/14] v4l2-async: change custom.match callback argument type Jacek Anaszewski
2014-11-29 13:00   ` Pavel Machek
2014-11-29 16:38   ` Laurent Pinchart
2014-12-01  9:35     ` Jacek Anaszewski
2014-11-28  9:17 ` [PATCH/RFC v8 05/14] v4l2-ctrls: Add V4L2_CID_FLASH_SYNC_STROBE control Jacek Anaszewski
2014-11-28  9:17 ` [PATCH/RFC v8 06/14] media: Add registration helpers for V4L2 flash sub-devices Jacek Anaszewski
2014-12-01 14:53   ` Jacek Anaszewski
2014-11-28  9:17 ` [PATCH/RFC v8 07/14] exynos4-is: Add support for v4l2-flash subdevs Jacek Anaszewski
2014-11-29 13:02   ` Pavel Machek
2014-11-28  9:18 ` [PATCH/RFC v8 08/14] DT: Add documentation for exynos4-is 'flashes' property Jacek Anaszewski
2014-11-28 11:14   ` Mark Rutland
2014-11-28 12:09     ` Jacek Anaszewski
     [not found]       ` <547865EA.5010700-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-11-28 12:30         ` Mark Rutland
2014-11-28 14:11           ` Jacek Anaszewski
     [not found]             ` <54788278.7080101-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-11-28 14:38               ` Mark Rutland
2014-11-28  9:18 ` [PATCH/RFC v8 09/14] mfd: max77693: adjust max77693_led_platform_data Jacek Anaszewski
2014-12-01 11:34   ` Lee Jones
2014-12-01 12:49     ` Jacek Anaszewski
2014-12-01 12:53       ` Lee Jones
2014-11-28  9:18 ` [PATCH/RFC v8 10/14] leds: Add support for max77693 mfd flash cell Jacek Anaszewski
     [not found] ` <1417166286-27685-1-git-send-email-j.anaszewski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-11-28  9:18   ` [PATCH/RFC v8 11/14] DT: Add documentation for the mfd Maxim max77693 Jacek Anaszewski
2014-11-29 19:26     ` Pavel Machek
2014-12-01 12:58       ` Jacek Anaszewski
2014-12-01 13:02         ` Pavel Machek
2014-12-01 13:43           ` Jacek Anaszewski
2014-12-01 11:15     ` Lee Jones
2014-11-28  9:18 ` [PATCH/RFC v8 12/14] leds: Add driver for AAT1290 current regulator Jacek Anaszewski
2014-11-29 19:05   ` Pavel Machek
2014-12-01 11:47     ` Jacek Anaszewski
2014-11-28  9:18 ` [PATCH/RFC v8 13/14] of: Add Skyworks Solutions, Inc. vendor prefix Jacek Anaszewski
2014-11-28  9:18 ` [PATCH/RFC v8 14/14] DT: Add documentation for the Skyworks AAT1290 Jacek Anaszewski

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=20150129212440.GB21140@amd \
    --to=pavel@ucw.cz \
    --cc=b.zolnierkie@samsung.com \
    --cc=cooloney@gmail.com \
    --cc=j.anaszewski@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    --cc=s.nawrocki@samsung.com \
    --cc=sakari.ailus@iki.fi \
    /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;
as well as URLs for NNTP newsgroup(s).