linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
	linux-media@vger.kernel.org, linux-leds@vger.kernel.org,
	devicetree@vger.kernel.org, sebastian.reichel@collabora.co.uk,
	robh@kernel.org, pavel@ucw.cz
Subject: Re: [PATCH 6/8] leds: as3645a: Add LED flash class driver
Date: Thu, 15 Jun 2017 15:01:47 +0200	[thread overview]
Message-ID: <6d27154d-4550-d1ae-8b7a-07dcaaee69ac@gmail.com> (raw)
In-Reply-To: <20170614221028.GS12407@valkosipuli.retiisi.org.uk>

Hi Sakari,

On 06/15/2017 12:10 AM, Sakari Ailus wrote:
> Hi Jacek,
> 
> Thanks for the review!

You're welcome!

> I have to say I found the v4l2-flash-led-class framework quite useful, now
> that I refactored a driver for using it. Now we have a user for the
> indicator, too. :-)

Nice :-). I'm also surprised that v4l2-flash API is also used in
drivers/staging/greybus/light.c which popped up with kbuild test robot
complaints.

> On Wed, Jun 14, 2017 at 11:15:24PM +0200, Jacek Anaszewski wrote:
>>> +static __maybe_unused int as3645a_suspend(struct device *dev)
>>> +{
>>> +	struct i2c_client *client = to_i2c_client(dev);
>>> +	struct as3645a *flash = i2c_get_clientdata(client);
>>> +	int rval;
>>> +
>>> +	rval = as3645a_set_control(flash, AS_MODE_EXT_TORCH, false);
>>> +	dev_dbg(dev, "Suspend %s\n", rval < 0 ? "failed" : "ok");
>>> +
>>> +	return rval;
>>> +}
>>> +
>>> +static __maybe_unused int as3645a_resume(struct device *dev)
>>> +{
>>> +	struct i2c_client *client = to_i2c_client(dev);
>>> +	struct as3645a *flash = i2c_get_clientdata(client);
>>> +	int rval;
>>> +
>>> +	rval = as3645a_setup(flash);
>>> +
>>
>> nitpicking: inconsistent coding style - there is no empty line before
>> dev_dbg() in the as3645a_suspend().
> 
> Added one for as3645a_suspend() --- it should have been there.
> 
>>
>>> +	dev_dbg(dev, "Resume %s\n", rval < 0 ? "fail" : "ok");
>>> +
>>> +	return rval;
>>> +}
> 
> ...
> 
>>> +static int as3645a_led_class_setup(struct as3645a *flash)
>>> +{
>>> +	struct led_classdev *fled_cdev = &flash->fled.led_cdev;
>>> +	struct led_classdev *iled_cdev = &flash->iled_cdev;
>>> +	struct led_flash_setting *cfg;
>>> +	int rval;
>>> +
>>> +	iled_cdev->name = "as3645a indicator";
>>> +	iled_cdev->brightness_set_blocking = as3645a_set_indicator_brightness;
>>> +	iled_cdev->max_brightness =
>>> +		flash->cfg.indicator_max_ua / AS_INDICATOR_INTENSITY_STEP;
>>> +
>>> +	rval = led_classdev_register(&flash->client->dev, iled_cdev);
>>> +	if (rval < 0)
>>> +		return rval;
>>> +
>>> +	cfg = &flash->fled.brightness;
>>> +	cfg->min = AS_FLASH_INTENSITY_MIN;
>>> +	cfg->max = flash->cfg.flash_max_ua;
>>> +	cfg->step = AS_FLASH_INTENSITY_STEP;
>>> +	cfg->val = flash->cfg.flash_max_ua;
>>> +
>>> +	cfg = &flash->fled.timeout;
>>> +	cfg->min = AS_FLASH_TIMEOUT_MIN;
>>> +	cfg->max = flash->cfg.flash_timeout_us;
>>> +	cfg->step = AS_FLASH_TIMEOUT_STEP;
>>> +	cfg->val = flash->cfg.flash_timeout_us;
>>> +
>>> +	flash->fled.ops = &as3645a_led_flash_ops;
>>> +
>>> +	fled_cdev->name = "as3645a flash";
>>
>> LED class device name should be taken from label DT property,
>> or DT node name if the former wasn't defined.
>>
>> Also LED device naming convention defines colon as a separator
>> between name segments.
> 
> Right. I'll fix that.
> 
> I just realised I'm missing DT binding documentation for this device; I'll
> add that, too.
> 
> Is the preference to allow freely chosen node names for the LEDs? Now that
> there's the label, too, this appears to be somewhat duplicated information.

It depends on whether the sub-leds are identified by reg property.
In this case usually common prefix is used followed by reg value,
e.g. led@1, led@2 etc.

Otherwise prevailing scheme is e.g.:

        blue-power {
		...
                label = "netxbig:blue:power";
	}

-- 
Best regards,
Jacek Anaszewski

  reply	other threads:[~2017-06-15 13:02 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14  9:47 [PATCH 0/8] Support registering lens, flash and EEPROM devices Sakari Ailus
2017-06-14  9:47 ` [PATCH 1/8] dt: bindings: Add a binding for flash devices associated to a sensor Sakari Ailus
2017-06-14 15:19   ` Rob Herring
2017-06-15  9:11   ` Pavel Machek
2017-06-15  9:21   ` Sebastian Reichel
2017-06-14  9:47 ` [PATCH 2/8] dt: bindings: Add lens-focus binding for image sensors Sakari Ailus
2017-06-14 15:20   ` Rob Herring
2017-06-14  9:47 ` [PATCH 3/8] dt: bindings: Add a binding for referencing EEPROM from camera sensors Sakari Ailus
2017-06-18 14:05   ` Rob Herring
2017-07-19  7:52   ` Maxime Ripard
2017-07-19  9:21     ` Sakari Ailus
2017-07-19 11:18       ` Maxime Ripard
2017-07-21 11:14         ` Sakari Ailus
2017-06-14  9:47 ` [PATCH 4/8] v4l2-flash: Use led_classdev instead of led_classdev_flash for indicator Sakari Ailus
2017-06-14 21:13   ` Jacek Anaszewski
2017-06-15  6:31   ` kbuild test robot
2017-06-15 10:45   ` Sebastian Reichel
2017-06-14  9:47 ` [PATCH 5/8] v4l2-flash: Flash ops aren't mandatory Sakari Ailus
2017-06-14 21:14   ` Jacek Anaszewski
2017-06-14 21:19     ` Sakari Ailus
2017-06-15 12:08       ` Jacek Anaszewski
2017-06-15  9:24   ` Sebastian Reichel
2017-06-15 12:32     ` Sakari Ailus
2017-06-15 12:51       ` Sebastian Reichel
2017-07-18 17:36   ` [PATCH v1.1 1/1] " Sakari Ailus
2017-07-19 11:53     ` Pavel Machek
2017-06-14  9:47 ` [PATCH 6/8] leds: as3645a: Add LED flash class driver Sakari Ailus
2017-06-14 21:15   ` Jacek Anaszewski
2017-06-14 22:10     ` Sakari Ailus
2017-06-15 13:01       ` Jacek Anaszewski [this message]
2017-06-15 13:34         ` Sakari Ailus
2017-06-15 13:47           ` Jacek Anaszewski
2017-06-14 21:39   ` Pavel Machek
2017-06-14 22:21     ` Sakari Ailus
2017-06-14 22:28       ` Pavel Machek
2017-06-14 22:43         ` Sakari Ailus
2017-06-15 10:43           ` Pavel Machek
2017-06-14  9:47 ` [PATCH 7/8] smiapp: Add support for flash, lens and EEPROM devices Sakari Ailus
2017-06-15  1:50   ` kbuild test robot
2017-06-16 12:07   ` Pavel Machek
2017-06-16 12:26     ` Sakari Ailus
2017-06-16 13:10       ` Pavel Machek
2017-06-16 12:42   ` Pavel Machek
2017-06-16 12:45     ` Sakari Ailus
2017-06-17  9:19       ` Pavel Machek
2017-06-17 12:59       ` Pavel Machek
2017-06-17 21:12         ` Pavel Machek
2017-06-17 12:17   ` Pavel Machek
2017-06-14  9:47 ` [PATCH 8/8] arm: dts: omap3: N9/N950: Add AS3645A camera flash Sakari Ailus
2017-06-15 10:15   ` Sebastian Reichel
2017-06-14  9:53 ` [PATCH 0/8] Support registering lens, flash and EEPROM devices 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=6d27154d-4550-d1ae-8b7a-07dcaaee69ac@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@iki.fi \
    --cc=sakari.ailus@linux.intel.com \
    --cc=sebastian.reichel@collabora.co.uk \
    /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).