All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Cc: Pavel Machek <pavel@ucw.cz>,
	"open list:LED SUBSYSTEM" <linux-leds@vger.kernel.org>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	Kalle Valo <kvalo@codeaurora.org>,
	ath10k@lists.infradead.org,
	Sebastian Gottschall <s.gottschall@newmedia-net.de>
Subject: Re: [PATCH v12] ath10k: add LED and GPIO controlling support for various chipsets
Date: Wed, 7 Mar 2018 17:22:53 +0100	[thread overview]
Message-ID: <CACna6rys85VEkzRGDVUAkBy7KgHS2y0DET7YvedboX-YEQHrkg@mail.gmail.com> (raw)
In-Reply-To: <e77d25d4-a824-380a-c51a-e81175ba6205@dd-wrt.com>

On 2 March 2018 at 10:22, Sebastian Gottschall <s.gottschall@dd-wrt.com> wr=
ote:
>>> leds-gpio is crap and limited. you can just register one platform data =
at
>>> kernel runtime since its identified by its object name "led-gpio" but t=
he
>>> kernel forbidds to register 2 platform datas with the same name
>>> consider the ar71xx devices with qca988x wifi chipsets. they all have
>>> already a led platform data registered
>>> at boottime. a second can't be registered anymore so gpio_led is useles=
s
>>> at
>>> all for most developers on such platforms. its mainly used for early
>>> kernel
>>> platform data initialisation for system leds.
>>
>> If leds-gpio has limitations, please fix those, rather then
>> introducing duplicated code.
>
> there is no duplicated code introduced and there is no solution for it.
> consider that all wifi drivers with softled support
> are going that way with registering a own led driver. see ath9k for
> instance. gpio-led cannot be used for it and there is no way to
> support multiple platform datas with the same name. its a kernel limitati=
on

I just reviewed some mips arch patch adding support for more LEDs for
selected devices:
[PATCH] MIPS: BCM47XX: Add Luxul XAP1500/XWR1750 WiFi LEDs
https://patchwork.linux-mips.org/patch/18681/

It seems to be simply adding another call to the
gpio_led_register_device(). It seems to me you can call that function
multiple times and register multiple structs with LEDs.

Isn't all you need something like this?

static const struct gpio_led ath10k_leds[] =3D {
        {
                .name =3D "ath10k:color:function",
                .active_low =3D 1,
                .default_state =3D LEDS_GPIO_DEFSTATE_KEEP,
        }
};

static struct gpio_led_platform_data bcm47xx_leds_pdata_extra =3D {
        leds =3D ath10k_leds;
        num_leds =3D ARRAY_SIZE(ath10k_leds);
};

ath10k_leds.gpio =3D ar->hw_params.led_pin;
gpio_led_register_device(0, &ath10k_leds);

--=20
Rafa=C5=82

WARNING: multiple messages have this Message-ID (diff)
From: "Rafał Miłecki" <zajec5@gmail.com>
To: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	ath10k@lists.infradead.org,
	"open list:LED SUBSYSTEM" <linux-leds@vger.kernel.org>,
	Pavel Machek <pavel@ucw.cz>,
	Sebastian Gottschall <s.gottschall@newmedia-net.de>,
	Kalle Valo <kvalo@codeaurora.org>
Subject: Re: [PATCH v12] ath10k: add LED and GPIO controlling support for various chipsets
Date: Wed, 7 Mar 2018 17:22:53 +0100	[thread overview]
Message-ID: <CACna6rys85VEkzRGDVUAkBy7KgHS2y0DET7YvedboX-YEQHrkg@mail.gmail.com> (raw)
In-Reply-To: <e77d25d4-a824-380a-c51a-e81175ba6205@dd-wrt.com>

On 2 March 2018 at 10:22, Sebastian Gottschall <s.gottschall@dd-wrt.com> wrote:
>>> leds-gpio is crap and limited. you can just register one platform data at
>>> kernel runtime since its identified by its object name "led-gpio" but the
>>> kernel forbidds to register 2 platform datas with the same name
>>> consider the ar71xx devices with qca988x wifi chipsets. they all have
>>> already a led platform data registered
>>> at boottime. a second can't be registered anymore so gpio_led is useless
>>> at
>>> all for most developers on such platforms. its mainly used for early
>>> kernel
>>> platform data initialisation for system leds.
>>
>> If leds-gpio has limitations, please fix those, rather then
>> introducing duplicated code.
>
> there is no duplicated code introduced and there is no solution for it.
> consider that all wifi drivers with softled support
> are going that way with registering a own led driver. see ath9k for
> instance. gpio-led cannot be used for it and there is no way to
> support multiple platform datas with the same name. its a kernel limitation

I just reviewed some mips arch patch adding support for more LEDs for
selected devices:
[PATCH] MIPS: BCM47XX: Add Luxul XAP1500/XWR1750 WiFi LEDs
https://patchwork.linux-mips.org/patch/18681/

It seems to be simply adding another call to the
gpio_led_register_device(). It seems to me you can call that function
multiple times and register multiple structs with LEDs.

Isn't all you need something like this?

static const struct gpio_led ath10k_leds[] = {
        {
                .name = "ath10k:color:function",
                .active_low = 1,
                .default_state = LEDS_GPIO_DEFSTATE_KEEP,
        }
};

static struct gpio_led_platform_data bcm47xx_leds_pdata_extra = {
        leds = ath10k_leds;
        num_leds = ARRAY_SIZE(ath10k_leds);
};

ath10k_leds.gpio = ar->hw_params.led_pin;
gpio_led_register_device(0, &ath10k_leds);

-- 
Rafał

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

  reply	other threads:[~2018-03-07 16:22 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26  8:44 [PATCH v12] ath10k: add LED and GPIO controlling support for various chipsets s.gottschall
2018-02-26  8:44 ` s.gottschall
2018-02-27 17:03 ` Steve deRosier
2018-02-27 17:03   ` Steve deRosier
2018-02-27 17:43   ` Sebastian Gottschall
2018-02-27 17:43     ` Sebastian Gottschall
2018-02-27 22:08 ` Rafał Miłecki
2018-02-27 22:08   ` Rafał Miłecki
2018-02-28  1:49   ` Sebastian Gottschall
2018-02-28  1:49     ` Sebastian Gottschall
2018-03-02  9:03     ` Pavel Machek
2018-03-02  9:03       ` Pavel Machek
2018-03-02  9:22       ` Sebastian Gottschall
2018-03-02  9:22         ` Sebastian Gottschall
2018-03-02  9:22         ` Sebastian Gottschall
2018-03-07 16:22         ` Rafał Miłecki [this message]
2018-03-07 16:22           ` Rafał Miłecki
2018-03-07 17:54           ` Sebastian Gottschall
2018-03-07 17:54             ` Sebastian Gottschall
2018-03-08  9:02             ` Pavel Machek
2018-03-08  9:02               ` Pavel Machek
2018-03-08 12:33               ` Sebastian Gottschall
2018-03-08 12:33                 ` Sebastian Gottschall
2018-03-08 14:05                 ` Pavel Machek
2018-03-08 14:05                   ` Pavel Machek
2018-03-08 14:29                   ` Kalle Valo
2018-03-08 14:29                     ` Kalle Valo
2018-03-08 14:29                     ` Kalle Valo
2018-03-08 14:43                     ` Sebastian Gottschall
2018-03-08 14:43                       ` Sebastian Gottschall
2018-03-08 14:34                   ` Sebastian Gottschall
2018-03-08 14:34                     ` Sebastian Gottschall
2018-03-08 15:04                     ` Pavel Machek
2018-03-08 15:04                       ` Pavel Machek
2018-03-08 15:04                       ` Pavel Machek
2018-03-08 15:31                       ` Sebastian Gottschall
2018-03-08 15:31                         ` Sebastian Gottschall
2018-03-08 15:46                   ` Felix Fietkau
2018-03-08 15:46                     ` Felix Fietkau
2018-03-10  7:44                     ` Julian Calaby
2018-03-10  7:44                       ` Julian Calaby
2018-03-10  7:56                       ` Sebastian Gottschall
2018-03-10  7:56                         ` Sebastian Gottschall
2018-03-12  7:53                         ` Mathias Kresin
2018-03-12  7:53                           ` Mathias Kresin
2018-03-12  7:53                           ` Mathias Kresin
2018-03-12  9:09                           ` Sebastian Gottschall
2018-03-12  9:09                             ` Sebastian Gottschall
2018-03-12  9:09                             ` Sebastian Gottschall
2018-04-05 14:44 ` Kalle Valo
2018-04-05 14:44   ` Kalle Valo
2018-04-05 18:01   ` Sebastian Gottschall
2018-04-05 18:01     ` Sebastian Gottschall
2018-04-05 20:00     ` Sebastian Gottschall
2018-04-05 20:00       ` Sebastian Gottschall
2018-04-06  8:07       ` Kalle Valo
2018-04-06  8:07         ` Kalle Valo
2018-04-06  8:10         ` Sebastian Gottschall
2018-04-06  8:10           ` Sebastian Gottschall
     [not found]       ` <1d917688-9f59-39ad-46a6-527d9e3dec03@dd-wrt.com>
2018-04-06  8:09         ` Kalle Valo
2018-04-06  8:09           ` Kalle Valo
2018-04-06  8:11           ` Sebastian Gottschall
2018-04-06  8:11             ` Sebastian Gottschall
2018-04-06  8:25             ` Kalle Valo
2018-04-06  8:25               ` Kalle Valo
     [not found]               ` <f3617290-34d5-0cca-6442-4a37c06701b1@dd-wrt.com>
2018-04-06  9:17                 ` Kalle Valo
2018-04-06  9:17                   ` Kalle Valo
2018-04-06  8:05     ` Kalle Valo
2018-04-06  8:05       ` Kalle Valo

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=CACna6rys85VEkzRGDVUAkBy7KgHS2y0DET7YvedboX-YEQHrkg@mail.gmail.com \
    --to=zajec5@gmail.com \
    --cc=ath10k@lists.infradead.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=s.gottschall@dd-wrt.com \
    --cc=s.gottschall@newmedia-net.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.