linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>,
	Daniel Mack <daniel@zonque.org>,
	Robert Jarzmik <robert.jarzmik@free.fr>,
	Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Bryan Wu <cooloney@gmail.com>, Richard Purdie <rpurdie@rpsys.net>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Lee Jones <lee.jones@linaro.org>, Mark Brown <broonie@kernel.org>,
	Jingoo Han <jg1.han@samsung.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Andrea Adami <andrea.adami@gmail.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	linux-i2c@vger.kernel.org,
	linux-input <linux-input@vger.kernel.org>,
	linux-leds <linux-leds@vger.kernel.or>
Subject: Re: [PATCH v2 02/17] leds: port locomo leds driver to new locomo core
Date: Wed, 13 May 2015 14:53:03 +0000	[thread overview]
Message-ID: <5553654F.4010608@samsung.com> (raw)
In-Reply-To: <CALT56yOJyZvWF9neC2A09Y_w1Ej41uwWvU=aOOM0idbzUkBiFQ@mail.gmail.com>

On 05/13/2015 04:14 PM, Dmitry Eremin-Solenikov wrote:
> 2015-05-13 13:31 GMT+03:00 Jacek Anaszewski <j.anaszewski@samsung.com>:
>> On 05/12/2015 05:35 PM, Dmitry Eremin-Solenikov wrote:
>>>
>>> 2015-05-06 18:05 GMT+03:00 Jacek Anaszewski <j.anaszewski@samsung.com>:
>>>>
>>>> On 04/28/2015 01:55 AM, Dmitry Eremin-Solenikov wrote:
>>>>>
>>>>>
>>>>> Adapt locomo leds driver to new locomo core setup.
>>>>>
>>>>> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
>>>>> ---
>>>>>     drivers/leds/Kconfig       |   1 -
>>>>>     drivers/leds/leds-locomo.c | 119
>>>>> +++++++++++++++++++++++----------------------
>>>>>     2 files changed, 61 insertions(+), 59 deletions(-)
>>>>>
>>>>> diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
>>>>> index 966b960..4b4650b 100644
>>>>> --- a/drivers/leds/Kconfig
>>>>> +++ b/drivers/leds/Kconfig
>>>>> @@ -79,7 +79,6 @@ config LEDS_LM3642
>>>>>     config LEDS_LOCOMO
>>>>>           tristate "LED Support for Locomo device"
>>>>>           depends on LEDS_CLASS
>>>>> -       depends on SHARP_LOCOMO
>>>>
>>>>
>>>>
>>>> Why do you remove this dependency?
>>>
>>>
>>> Because SHARP_LOCOMO is a Kconfig symbol for the old driver. New driver
>>> uses MFD_LOCOMO Kconfig entry. Also the driver now uses generic platform
>>> device and regmap interfaces, so there is no direct dependency on main
>>> LoCoMo driver. And the policy (IIRC) was not to have such dependencies.
>>
>>
>> Ack. Shouldn't you also need "select REGMAP_MMIO" ?
>
> No. Maybe I should add "select REGMAP" instead.

REGMAP is enabled by default if REGMAP_MMIO is enabled. Having
REGMAP_MMIO selected would also allow to notice at first glance which
regmap backend is used. This would in turn provide a straightforward
explanation on why brightness_set op is not delegated to work queue.

>>>>>    static void locomoled_brightness_set(struct led_classdev *led_cdev,
>>>>> -                               enum led_brightness value, int offset)
>>>>> +                               enum led_brightness value)
>>>>>     {
>>>>> -       struct locomo_dev *locomo_dev >>>>> LOCOMO_DEV(led_cdev->dev->parent);
>>>>> -       unsigned long flags;
>>>>> +       struct locomo_led *led = container_of(led_cdev, struct
>>>>> locomo_led,
>>>>> led);
>>>>>
>>>>> -       local_irq_save(flags);
>>>>> -       if (value)
>>>>> -               locomo_writel(LOCOMO_LPT_TOFH, locomo_dev->mapbase +
>>>>> offset);
>>>>> -       else
>>>>> -               locomo_writel(LOCOMO_LPT_TOFL, locomo_dev->mapbase +
>>>>> offset);
>>>>> -       local_irq_restore(flags);
>>>>> +       regmap_write(led->regmap, led->reg,
>>>>> +                       value ? LOCOMO_LPT_TOFH : LOCOMO_LPT_TOFL);
>>>>>     }
>>>>
>>>>
>>>>
>>>> Please use work queue for setting brightness. This is required for the
>>>> driver to be compatible with led triggers. You can refer to the
>>>> existing LED drivers on how to implement this.
>>>
>>>
>>> Hmm. Why? The regmap here uses MMIO access, so it is atomic operation
>>> and doesn't need to be wrapped into work queue, does it?
>>
>>
>> Triggers can call brightness_set op in the interrupt context, so it
>> cannot sleep. I see "map->lock(map->lock_arg)" in regmap_write, thus
>> I am inferring that it can sleep.
>>
>> I am not sure if regmap implements its 'lock' op when using MMIO.
>>
>> The best way to figure this out is turning "LED Timer Trigger" on
>> in the config and execute:
>>
>> echo "timer" > trigger
>
> It works without any "might sleep/sleeping in atomic context" warnings.
>
> Technically I'd agree with you. If I'm using regmaps, ideally I should not
> depend on the exact backend and put working with it to the work queue.
> However as this is a driver for quite old IP block, it is not used with
> regmap backends other than MMIO, I'd deduce, it's ok to do things
> in a more relaxed way and to call regmap_write even from atomic
> contexts.

Ack.

-- 
Best Regards,
Jacek Anaszewski

  reply	other threads:[~2015-05-13 14:53 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27 23:55 [PATCH v2 00/17] new locomo driver set Dmitry Eremin-Solenikov
2015-04-27 23:55 ` [PATCH v2 02/17] leds: port locomo leds driver to new locomo core Dmitry Eremin-Solenikov
2015-05-06 15:05   ` Jacek Anaszewski
2015-05-12 15:35     ` Dmitry Eremin-Solenikov
     [not found]       ` <CALT56yNJWapNw1XLrzfbUDUz1LF_BB9DfF94H6GhbnBUEP80_w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-13 10:31         ` Jacek Anaszewski
     [not found]           ` <555327EA.5060402-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-05-13 14:14             ` Dmitry Eremin-Solenikov
2015-05-13 14:53               ` Jacek Anaszewski [this message]
     [not found]                 ` <5553654F.4010608-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-05-13 16:42                   ` Dmitry Torokhov
2015-05-14  6:35                     ` Jacek Anaszewski
2015-04-27 23:55 ` [PATCH v2 05/17] video: backlight: add new locomo backlight driver Dmitry Eremin-Solenikov
2015-04-27 23:55 ` [PATCH v2 07/17] gpio: port LoCoMo gpio support from old driver Dmitry Eremin-Solenikov
2015-05-06 14:12   ` Linus Walleij
2015-04-27 23:55 ` [PATCH v2 08/17] gpio: locomo: implement per-pin irq handling Dmitry Eremin-Solenikov
2015-05-06 14:15   ` Linus Walleij
2015-05-06 16:42     ` Dmitry Eremin-Solenikov
2015-05-12 11:15       ` Linus Walleij
2015-04-27 23:55 ` [PATCH v2 09/17] spi: add locomo SPI driver Dmitry Eremin-Solenikov
2015-04-29 11:27   ` Mark Brown
     [not found] ` <1430178954-11138-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-04-27 23:55   ` [PATCH v2 03/17] input: convert LoCoMo keyboard driver to use new locomo core Dmitry Eremin-Solenikov
2015-05-12 20:21     ` Dmitry Torokhov
2015-05-12 21:01       ` Dmitry Eremin-Solenikov
2015-05-12 21:13         ` Dmitry Torokhov
2015-04-27 23:55   ` [PATCH v2 04/17] input: locomokbd: provide an Alt-SysRQ combination Dmitry Eremin-Solenikov
2015-05-12 20:12     ` Dmitry Torokhov
2015-05-12 20:40       ` Dmitry Eremin-Solenikov
2015-04-27 23:55   ` [PATCH v2 06/17] video: lcd: add LoCoMo LCD driver Dmitry Eremin-Solenikov
2015-04-27 23:55   ` [PATCH v2 10/17] i2c: add locomo i2c driver Dmitry Eremin-Solenikov
2015-05-12 19:24     ` Wolfram Sang
2015-05-12 19:27       ` Dmitry Eremin-Solenikov
2015-05-12 19:28         ` Wolfram Sang
2015-04-27 23:55 ` [PATCH v2 11/17] ARM: sa1100: make collie use new locomo drivers Dmitry Eremin-Solenikov
2015-04-27 23:55 ` [PATCH v2 12/17] ARM: sa1100: don't preallocate IRQ space for locomo Dmitry Eremin-Solenikov
2015-04-27 23:55 ` [PATCH v2 13/17] ASoC: pxa: poodle: make use of new locomo GPIO interface Dmitry Eremin-Solenikov
2015-05-06 14:19   ` Linus Walleij
2015-04-27 23:55 ` [PATCH v2 14/17] ARM: pxa: poodle: use new LoCoMo driver Dmitry Eremin-Solenikov
     [not found]   ` <1430178954-11138-15-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-04-28 19:35     ` Robert Jarzmik
2015-05-06 14:20     ` Linus Walleij
2015-04-27 23:55 ` [PATCH v2 15/17] ARM: pxa: poodle: don't preallocate IRQ space for locomo Dmitry Eremin-Solenikov
2015-04-28 19:36   ` Robert Jarzmik
2015-04-27 23:55 ` [PATCH v2 16/17] video: backlight: drop old locomo bl/lcd driver Dmitry Eremin-Solenikov
     [not found] ` <1430178954-11138-18-git-send-email-dbaryshkov@gmail.com>
     [not found]   ` <1430178954-11138-18-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-06 14:22     ` [PATCH v2 17/17] ARM: drop old LoCoMo driver Linus Walleij
     [not found] ` <1430178954-11138-2-git-send-email-dbaryshkov@gmail.com>
     [not found]   ` <20150428184525.GJ9169@x1>
2015-05-12 20:39     ` [PATCH v2 01/17] mfd: add new driver for Sharp LoCoMo Dmitry Eremin-Solenikov
2015-05-13  9:41       ` Lee Jones

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=5553654F.4010608@samsung.com \
    --to=j.anaszewski@samsung.com \
    --cc=andrea.adami@gmail.com \
    --cc=broonie@kernel.org \
    --cc=cooloney@gmail.com \
    --cc=daniel@zonque.org \
    --cc=dbaryshkov@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gnurou@gmail.com \
    --cc=jg1.han@samsung.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-leds@vger.kernel.or \
    --cc=linux@arm.linux.org.uk \
    --cc=plagnioj@jcrosoft.com \
    --cc=robert.jarzmik@free.fr \
    --cc=rpurdie@rpsys.net \
    --cc=sameo@linux.intel.com \
    --cc=tomi.valkeinen@ti.com \
    --cc=wsa@the-dreams.de \
    /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).