Linux LED subsystem development
 help / color / mirror / Atom feed
From: "Alexander Shiyan" <shc_work@mail.ru>
To: "Jacek Anaszewski" <j.anaszewski@samsung.com>
Cc: "Bryan Wu" <cooloney@gmail.com>,
	linux-leds@vger.kernel.org, "Alexander Kurz" <akurz@blala.de>,
	"Richard Purdie" <rpurdie@rpsys.net>
Subject: Re: [PATCH] leds: leds-mc13783: Fix MC13892 keypad led access
Date: Mon, 10 Oct 2016 15:22:06 +0300	[thread overview]
Message-ID: <1476102126.310584619@f351.i.mail.ru> (raw)
In-Reply-To: <fdbc8f96-3a9b-b87e-467d-5279353811d9@samsung.com>

>Понедельник, 10 октября 2016, 15:14 +03:00 от Jacek Anaszewski <j.anaszewski@samsung.com>:
>
>Hi Alexander,
>
>Thanks for the patch.
>
>On 10/09/2016 03:37 PM, Alexander Kurz wrote:
>> Fix the register access shift argument calculation introduced with
>> commit a59ce6584d56 ("leds: leds-mc13783: Add MC34708 LED support")
>> and re-enable access to the "keypad" led for MC13892 MFC devices.
>>
>> Signed-off-by: Alexander Kurz < akurz@blala.de >
>> ---
>>  drivers/leds/leds-mc13783.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/leds/leds-mc13783.c b/drivers/leds/leds-mc13783.c
>> index a2e4c17..2421cf10 100644
>> --- a/drivers/leds/leds-mc13783.c
>> +++ b/drivers/leds/leds-mc13783.c
>> @@ -84,8 +84,9 @@ static int mc13xxx_led_set(struct led_classdev *led_cdev,
>>  case MC13892_LED_MD:
>>  case MC13892_LED_AD:
>>  case MC13892_LED_KP:
>> -reg = (led->id - MC13892_LED_MD) / 2;
>> -shift = 3 + (led->id - MC13892_LED_MD) * 12;
>> +off = led->id - MC13892_LED_MD;
>> +reg = off / 2;
>> +shift = 3 + (off - reg * 2) * 12;
>>  break;
>>  case MC13892_LED_R:
>>  case MC13892_LED_G:
>>
>
>While trying to analyze these calculations I noticed a discrepancy
>between DT documentation and the enum in the header file.
>
>Documentation/devicetree/bindings/mfd/mc13xxx.txt:
>
>MC13892 LED IDs:
>     0  : Main display
>     1  : AUX display
>     2  : Keypad
>     3  : Red
>     4  : Green
>     5  : Blue
>
>include/linux/mfd/mc13xxx.h:
>
>enum {
>         /* MC13783 LED IDs */
>         MC13783_LED_MD,
>         MC13783_LED_AD,
>         MC13783_LED_KP,
>         MC13783_LED_R1,
>         MC13783_LED_G1,
>         MC13783_LED_B1,
>         MC13783_LED_R2,
>         MC13783_LED_G2,
>         MC13783_LED_B2,
>         MC13783_LED_R3,
>         MC13783_LED_G3,
>         MC13783_LED_B3,
>         /* MC13892 LED IDs */
>         MC13892_LED_MD,
>         MC13892_LED_AD,
>         MC13892_LED_KP,
>         MC13892_LED_R,
>         MC13892_LED_G,
>         MC13892_LED_B,
>         /* MC34708 LED IDs */
>         MC34708_LED_R,
>         MC34708_LED_G,
>}
>
>Keypad LED enum identifier is 15, but documentation states
>that it is 2. The code seems to expect the former:

The driver uses calculation:

if (of_property_read_u32(child, "reg", &tmp))
  continue;
pdata->led[i].id = leds->devtype->led_min + tmp;

Where led_min = MC13892_LED_MD for MC13892.

---


  reply	other threads:[~2016-10-10 13:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20161009134104eucas1p17d4028424741a2b6c758b268e50e6e12@eucas1p1.samsung.com>
2016-10-09 13:37 ` [PATCH] leds: leds-mc13783: Fix MC13892 keypad led access Alexander Kurz
2016-10-09 17:41   ` Alexander Shiyan
2016-10-09 19:15     ` Alexander Kurz
2016-10-10 12:14   ` Jacek Anaszewski
2016-10-10 12:22     ` Alexander Shiyan [this message]
2016-10-10 13:06       ` Jacek Anaszewski
2016-10-10 12:52     ` Alexander Kurz
2016-10-10 13:12       ` Jacek Anaszewski
2016-10-10 13:24         ` Alexander Kurz
2016-10-10 14:32           ` Jacek Anaszewski
2016-10-10 14:52             ` Alexander Kurz
2016-10-11  8:18               ` 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=1476102126.310584619@f351.i.mail.ru \
    --to=shc_work@mail.ru \
    --cc=akurz@blala.de \
    --cc=cooloney@gmail.com \
    --cc=j.anaszewski@samsung.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    /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