From: Daniel Mack <daniel@zonque.org>
To: Matt Ranostay <mranostay@gmail.com>,
Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
linux-leds@vger.kernel.org,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v4 2/2] cap11xx: add LED support
Date: Tue, 16 Jun 2015 23:26:14 +0200 [thread overview]
Message-ID: <55809476.90407@zonque.org> (raw)
In-Reply-To: <CAKzfze9gneY_LmWaWGNKxLXBsw_k2d596CkGNat5RoTbn3cYEg@mail.gmail.com>
On 06/16/2015 04:39 PM, Matt Ranostay wrote:
> On Tue, Jun 16, 2015 at 12:54 AM, Jacek Anaszewski
> <j.anaszewski@samsung.com> wrote:
>> On 06/16/2015 04:46 AM, Matt Ranostay wrote:
>>> + for_each_child_of_node(node, child) {
>>> + led->cdev.name =
>>> + of_get_property(child, "label", NULL) ? :
>>> child->name;
>>> + led->cdev.default_trigger =
>>> + of_get_property(child, "linux,default-trigger",
>>> NULL);
>>> + led->cdev.flags = 0;
>>> + led->cdev.brightness_set = cap11xx_led_set;
>>> + led->cdev.max_brightness = 1;
>>> + led->cdev.brightness = LED_OFF;
>>> +
>>> + error = of_property_read_u32(child, "reg", ®);
>>> + if (error != 0 || reg >= priv->num_leds)
>>> + continue;
>>> + led->reg = reg;
>>> + led->priv = priv;
>>> +
>>> + INIT_WORK(&led->work, cap11xx_led_work);
>>> + error = devm_led_classdev_register(dev, &led->cdev);
>>> + if (error < 0)
>>> + return -EINVAL;
>>> +
>>> + schedule_work(&led->work);
>>
>>
>> Why do you schedule work here? It should be done only in brightness_set op.
>>
> The LED needs to be set to initial turned off state, since there is no
> Power ON/OFF register for the cap11xx devices.. So LEDs state would be
> persistent across warm reboots.
> Thoughts on how to do this better?
What's wrong with this?
regmap_write(priv->regmap, CAP11XX_REG_LED_OUTPUT_CONTROL, 0);
Outside the loop, of course ...
Daniel
next prev parent reply other threads:[~2015-06-16 21:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-16 2:46 [PATCH v4 0/2] cap118x: add LED support Matt Ranostay
2015-06-16 2:46 ` [PATCH v4 1/2] dt: add cap11xx LED documentation Matt Ranostay
2015-06-16 7:57 ` Jacek Anaszewski
2015-06-16 14:31 ` Matt Ranostay
2015-06-16 2:46 ` [PATCH v4 2/2] cap11xx: add LED support Matt Ranostay
2015-06-16 7:54 ` Jacek Anaszewski
2015-06-16 14:39 ` Matt Ranostay
2015-06-16 21:26 ` Daniel Mack [this message]
2015-06-16 21:55 ` Matt Ranostay
2015-06-17 6:34 ` Matt Ranostay
[not found] ` <CAKzfze8629xyiz1wufjoGbOu+npDRXyCgyGEhxY_1h7XHKeTQg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-17 6:49 ` Matt Ranostay
2015-06-17 8:59 ` Daniel Mack
2015-06-17 21:53 ` Matt Ranostay
[not found] ` <CAKzfze-H=m55j-1ty4xOkrVzMswU7FpXe=6pHq4ws=P+3vcZNQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-17 22:38 ` Dmitry Torokhov
2015-06-17 23:36 ` Matt Ranostay
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=55809476.90407@zonque.org \
--to=daniel@zonque.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=j.anaszewski@samsung.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=mranostay@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;
as well as URLs for NNTP newsgroup(s).