Subject: leds: apu: drop obsolete support for apu>=2

Hi folks,


the legacy apu LEDs driver has been superseded by the more complete
pcengines-apu2 platform driver, for APU >= 2. It only supports
the three front LEDs, but lacks all the other GPIOs (eg. button
or simsw), and conflicts with the pcengines-apu2 driver.

Old APUv1 has a very different chipset.

Therefore I propose dropping the apu>=2 support from the legacy
driver, reducing it to only the old (obsolete) APUv1 boards.


--mtx



Subject: [PATCH 2/6] leds: apu: drop enum_apu_led_platform_types

From: Enrico Weigelt <[email protected]>

As this driver now only supports the APU1 boards, we don't need
to differenciate between board types anymore. Therefore optimize
away the now obsolete code.

Signed-off-by: Enrico Weigelt <[email protected]>
---
drivers/leds/leds-apu.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/leds/leds-apu.c b/drivers/leds/leds-apu.c
index 140093a..37b054f 100644
--- a/drivers/leds/leds-apu.c
+++ b/drivers/leds/leds-apu.c
@@ -66,16 +66,10 @@ struct apu_led_profile {
unsigned long offset; /* for devm_ioremap */
};

-/* Supported platform types */
-enum apu_led_platform_types {
- APU1_LED_PLATFORM,
-};
-
struct apu_led_pdata {
struct platform_device *pdev;
struct apu_led_priv *pled;
const struct apu_led_profile *profile;
- enum apu_led_platform_types platform;
int num_led_instances;
int iosize; /* for devm_ioremap() */
spinlock_t lock;
@@ -130,8 +124,7 @@ static int apu_led_config(struct device *dev, struct apu_led_pdata *apuld)
led_cdev->brightness = apu_led->profile[i].brightness;
led_cdev->max_brightness = 1;
led_cdev->flags = LED_CORE_SUSPENDRESUME;
- if (apu_led->platform == APU1_LED_PLATFORM)
- led_cdev->brightness_set = apu1_led_brightness_set;
+ led_cdev->brightness_set = apu1_led_brightness_set;

pled->param.addr = devm_ioremap(dev,
apu_led->profile[i].offset, apu_led->iosize);
@@ -144,7 +137,7 @@ static int apu_led_config(struct device *dev, struct apu_led_pdata *apuld)
if (err)
goto error;

- led_cdev->brightness_set(led_cdev, apu_led->profile[i].brightness);
+ apu1_led_brightness_set(led_cdev, apu_led->profile[i].brightness);
}

return 0;
@@ -166,7 +159,6 @@ static int __init apu_led_probe(struct platform_device *pdev)
apu_led->pdev = pdev;

apu_led->profile = apu1_led_profile;
- apu_led->platform = APU1_LED_PLATFORM;
apu_led->num_led_instances = ARRAY_SIZE(apu1_led_profile);
apu_led->iosize = APU1_IOSIZE;

--
1.9.1

Subject: [PATCH 4/6] leds: apu: drop profile field from priv data

From: Enrico Weigelt <[email protected]>

As this driver now only supports the APU1 boards, we don't need
to handle profiles anymore and just can use the only one global
array directly.

Signed-off-by: Enrico Weigelt <[email protected]>
---
drivers/leds/leds-apu.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/leds/leds-apu.c b/drivers/leds/leds-apu.c
index f79146c..451cb9f 100644
--- a/drivers/leds/leds-apu.c
+++ b/drivers/leds/leds-apu.c
@@ -69,8 +69,6 @@ struct apu_led_profile {
struct apu_led_pdata {
struct platform_device *pdev;
struct apu_led_priv *pled;
- const struct apu_led_profile *profile;
- int num_led_instances;
spinlock_t lock;
};

@@ -109,24 +107,24 @@ static int apu_led_config(struct device *dev, struct apu_led_pdata *apuld)
int err;

apu_led->pled = devm_kcalloc(dev,
- apu_led->num_led_instances, sizeof(struct apu_led_priv),
+ ARRAY_SIZE(apu1_led_profile), sizeof(struct apu_led_priv),
GFP_KERNEL);

if (!apu_led->pled)
return -ENOMEM;

- for (i = 0; i < apu_led->num_led_instances; i++) {
+ for (i = 0; i < ARRAY_SIZE(apu1_led_profile); i++) {
struct apu_led_priv *pled = &apu_led->pled[i];
struct led_classdev *led_cdev = &pled->cdev;

- led_cdev->name = apu_led->profile[i].name;
- led_cdev->brightness = apu_led->profile[i].brightness;
+ led_cdev->name = apu1_led_profile[i].name;
+ led_cdev->brightness = apu1_led_profile[i].brightness;
led_cdev->max_brightness = 1;
led_cdev->flags = LED_CORE_SUSPENDRESUME;
led_cdev->brightness_set = apu1_led_brightness_set;

pled->param.addr = devm_ioremap(dev,
- apu_led->profile[i].offset, APU1_IOSIZE);
+ apu1_led_profile[i].offset, APU1_IOSIZE);
if (!pled->param.addr) {
err = -ENOMEM;
goto error;
@@ -136,7 +134,7 @@ static int apu_led_config(struct device *dev, struct apu_led_pdata *apuld)
if (err)
goto error;

- apu1_led_brightness_set(led_cdev, apu_led->profile[i].brightness);
+ apu1_led_brightness_set(led_cdev, apu1_led_profile[i].brightness);
}

return 0;
@@ -157,9 +155,6 @@ static int __init apu_led_probe(struct platform_device *pdev)

apu_led->pdev = pdev;

- apu_led->profile = apu1_led_profile;
- apu_led->num_led_instances = ARRAY_SIZE(apu1_led_profile);
-
spin_lock_init(&apu_led->lock);
return apu_led_config(&pdev->dev, apu_led);
}
@@ -204,7 +199,7 @@ static void __exit apu_led_exit(void)
{
int i;

- for (i = 0; i < apu_led->num_led_instances; i++)
+ for (i = 0; i < ARRAY_SIZE(apu1_led_profile); i++)
led_classdev_unregister(&apu_led->pled[i].cdev);

platform_device_unregister(apu_led->pdev);
--
1.9.1

2019-07-16 19:26:36

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH 2/6] leds: apu: drop enum_apu_led_platform_types

On Mon 2019-07-15 16:57:29, Enrico Weigelt, metux IT consult wrote:
> From: Enrico Weigelt <[email protected]>
>
> As this driver now only supports the APU1 boards, we don't need
> to differenciate between board types anymore. Therefore optimize
> away the now obsolete code.
>
> Signed-off-by: Enrico Weigelt <[email protected]>

Acked-by: Pavel Machek <[email protected]>

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


Attachments:
(No filename) (516.00 B)
signature.asc (188.00 B)
Digital signature
Download all attachments

2019-07-16 19:29:05

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH 4/6] leds: apu: drop profile field from priv data

On Mon 2019-07-15 16:57:31, Enrico Weigelt, metux IT consult wrote:
> From: Enrico Weigelt <[email protected]>
>
> As this driver now only supports the APU1 boards, we don't need
> to handle profiles anymore and just can use the only one global
> array directly.
>
> Signed-off-by: Enrico Weigelt <[email protected]>

Acked-by: Pavel Machek <[email protected]>

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


Attachments:
(No filename) (503.00 B)
signature.asc (188.00 B)
Digital signature
Download all attachments

2019-07-23 03:09:52

by Jacek Anaszewski

[permalink] [raw]
Subject: Re: leds: apu: drop obsolete support for apu>=2

Hi Enrico,

Thank you for the patch set.

On 7/15/19 4:57 PM, Enrico Weigelt, metux IT consult wrote:
> Hi folks,
>
>
> the legacy apu LEDs driver has been superseded by the more complete
> pcengines-apu2 platform driver, for APU >= 2. It only supports
> the three front LEDs, but lacks all the other GPIOs (eg. button
> or simsw), and conflicts with the pcengines-apu2 driver.
>
> Old APUv1 has a very different chipset.
>
> Therefore I propose dropping the apu>=2 support from the legacy
> driver, reducing it to only the old (obsolete) APUv1 boards.


Patch set applied along with the update for the patch 5/6.

--
Best regards,
Jacek Anaszewski

Subject: Re: leds: apu: drop obsolete support for apu>=2

On 22.07.19 22:12, Jacek Anaszewski wrote:

Hi,

> Patch set applied along with the update for the patch 5/6.

What's the status of this patch set ?
Doesn't seem to have landed in Torvalds tree yet.


--mtx

--
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287

2019-08-29 19:52:35

by Jacek Anaszewski

[permalink] [raw]
Subject: Re: leds: apu: drop obsolete support for apu>=2

On 8/29/19 11:08 AM, Enrico Weigelt, metux IT consult wrote:
> On 22.07.19 22:12, Jacek Anaszewski wrote:
>
> Hi,
>
>> Patch set applied along with the update for the patch 5/6.
>
> What's the status of this patch set ?
> Doesn't seem to have landed in Torvalds tree yet.

It is in linux-next and will be sent upstream for 5.4-rc1.

--
Best regards,
Jacek Anaszewski

Subject: Re: leds: apu: drop obsolete support for apu>=2

On 29.08.19 21:51, Jacek Anaszewski wrote:
> On 8/29/19 11:08 AM, Enrico Weigelt, metux IT consult wrote:
>> On 22.07.19 22:12, Jacek Anaszewski wrote:
>>
>> Hi,
>>
>>> Patch set applied along with the update for the patch 5/6.
>>
>> What's the status of this patch set ?
>> Doesn't seem to have landed in Torvalds tree yet.
>
> It is in linux-next and will be sent upstream for 5.4-rc1.
>

Thanks very much.


--mtx

--
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287