All of lore.kernel.org
 help / color / mirror / Atom feed
* Nokia N900 increased power draw with panel-sony-acx565akm loaded v5.9 and v5.10
@ 2021-12-10 19:18 Merlijn Wajer
  2021-12-10 19:59 ` Andreas Kemnade
  2021-12-13 13:10 ` Sebastian Reichel
  0 siblings, 2 replies; 7+ messages in thread
From: Merlijn Wajer @ 2021-12-10 19:18 UTC (permalink / raw)
  To: linux-omap, Sebastian Reichel
  Cc: Ivaylo Dimitrov, Dev Null, Pavel Machek, Tony Lindgren

Hi Sebastian,

I don't know if this is something that requires any action currently,
but I wanted to report that I'm seeing some increased power draw on a
Nokia N900 with minimal userspace on Linux 5.10 (and the same happens on
5.15 it seems, so it doesn't seem to be resolved since). I tried to
bisect the problem but my initial attempt failed, because the problem
seems a bit racy or unpredictable.

Basically I boot a system to init=/bin/bash and run the following:

> modprobe panel-sony-acx565akm
> 
> mount -t proc none /proc
> mount -t sysfs none /sys
> mount -t debugfs none /sys/kernel/debug
> mount -o rw,remount /
> 
> echo 1 > /sys/kernel/debug/pm_debug/enable_off_mode
> echo 0 > /sys/class/backlight/acx565akm/brightness
> 
> 
> consoles=$(find /sys/bus/platform/devices/4*.serial/ -name console)
> for console in ${consoles}; do
>     echo N > ${console}
> done
> 
> # Enable autosuspend
> uarts=$(find /sys/bus/platform/devices/4*.serial/power/ -type d)
> for uart in ${uarts}; do
>     echo 2000 > ${uart}/autosuspend_delay_ms
>     echo enabled > ${uart}/wakeup
>     echo auto > ${uart}/control
> done
> 
> # Configure wake-up from suspend
> uarts=$(find /sys/class/tty/tty[SO]*/power/ -type d)
> for uart in ${uarts}; do
>     echo enabled > ${uart}/wakeup
> done

This loads the panel and then sets the brightness to zero, enables off
mode and idles the kernel console/serial.

Then run the following to check idle states:

	grep ^core_pwrdm /sys/kernel/debug/pm_debug/count | cut -d',' -f2,3

And also check the power usage on lab power supply that I have here.

With the above, Linux v5.9 (no patches applied) idles at around 42mW
(15mW goes to the serial device, so it's more like 27mW, anyway...).

Linux v5.10 with the following two commits reverted (otherwise the
system is not stable):

* fb2c599f056640d289b2147fbe6d9eaee689f1b2 (ARM: omap3: enable off mode
automatically)
* 21b2cec61c04bd175f0860d9411a472d5a0e7ba1 (mmc: Set
PROBE_PREFER_ASYNCHRONOUS for drivers that existed in v4.4)

And the following config change on top of omap2plus_defconfig (to make
OFF mode work on v5.10 as detailed in "Nokia N900 not hitting OFF mode
since 5.9 is caused by proactive memory compaction"):

> sed -i 's/CONFIG_COMPACTION=y/CONFIG_COMPACTION=n/' .config

Idles at much more -- 60mW (compared to 42mW). Executing "rmmod
panel-sony-acx565akm" makes the power draw return to v5.9 levels.

I don't really understand why this would happen, and as stated before
wasn't able to really bisect the problem. However, some simple guesswork
led me to find that reverting 7c4bada12d320d8648ba3ede6f9b6f9e10f1126a
("drm/panel: sony-acx565akm: Fix race condition in probe") makes v5.10
idle at 42mW again. I don't know if this because v5.9 never properly
initialised the panel, or because the race condition fix introduced
another problem that leaves the hardware in an abnormal state.

Any hints on what could cause this extra power draw? Maybe the panel is
waiting for something? I suppose it's potentially feasible that with
more modules and userspace loaded the panel idles properly, but I
currently don't have a way to measure that.

Regards,
Merlijn


PS: For both v5.9 and v5.10 kernels the only other change to
omap2plus_defconfig is to make the watchdog(s) built-in.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Nokia N900 increased power draw with panel-sony-acx565akm loaded v5.9 and v5.10
  2021-12-10 19:18 Nokia N900 increased power draw with panel-sony-acx565akm loaded v5.9 and v5.10 Merlijn Wajer
@ 2021-12-10 19:59 ` Andreas Kemnade
  2021-12-10 20:30   ` Merlijn Wajer
  2021-12-13 13:10 ` Sebastian Reichel
  1 sibling, 1 reply; 7+ messages in thread
From: Andreas Kemnade @ 2021-12-10 19:59 UTC (permalink / raw)
  To: Merlijn Wajer
  Cc: linux-omap, Sebastian Reichel, Ivaylo Dimitrov, Dev Null,
	Pavel Machek, Tony Lindgren

Hi,

On Fri, 10 Dec 2021 20:18:35 +0100
Merlijn Wajer <merlijn@wizzup.org> wrote:

[...]
> * 21b2cec61c04bd175f0860d9411a472d5a0e7ba1 (mmc: Set
> PROBE_PREFER_ASYNCHRONOUS for drivers that existed in v4.4)
> 
just for the records, I have a fix for that commit which also went into
stable, so this is not an additional contruction site:

commit ec76c2eea903947202098090bbe07a739b5246e9
Author: Andreas Kemnade <andreas@kemnade.info>
Date:   Fri Dec 4 10:55:39 2020 +0100

    ARM: OMAP2+: omap_device: fix idling of devices during probe

Regards,
Andreas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Nokia N900 increased power draw with panel-sony-acx565akm loaded v5.9 and v5.10
  2021-12-10 19:59 ` Andreas Kemnade
@ 2021-12-10 20:30   ` Merlijn Wajer
  0 siblings, 0 replies; 7+ messages in thread
From: Merlijn Wajer @ 2021-12-10 20:30 UTC (permalink / raw)
  To: Andreas Kemnade
  Cc: linux-omap, Sebastian Reichel, Ivaylo Dimitrov, Dev Null,
	Pavel Machek, Tony Lindgren

Hi Andreas,

On 10/12/2021 20:59, Andreas Kemnade wrote:
> Hi,
> 
> On Fri, 10 Dec 2021 20:18:35 +0100
> Merlijn Wajer <merlijn@wizzup.org> wrote:
> 
> [...]
>> * 21b2cec61c04bd175f0860d9411a472d5a0e7ba1 (mmc: Set
>> PROBE_PREFER_ASYNCHRONOUS for drivers that existed in v4.4)
>>
> just for the records, I have a fix for that commit which also went into
> stable, so this is not an additional contruction site:
> 
> commit ec76c2eea903947202098090bbe07a739b5246e9
> Author: Andreas Kemnade <andreas@kemnade.info>
> Date:   Fri Dec 4 10:55:39 2020 +0100
> 
>     ARM: OMAP2+: omap_device: fix idling of devices during probe

Right - thanks, I was aware of this commit, but for bisect purposes I
decided to just revert offending commits because they weren't relevant
(or so I think at least) to the problem I was trying to debug. So I
wasn't able to use a stable branch for bisecting because the first thing
the bisect would do was throw out the stable fixes.

Regards,
Merlijn

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Nokia N900 increased power draw with panel-sony-acx565akm loaded v5.9 and v5.10
  2021-12-10 19:18 Nokia N900 increased power draw with panel-sony-acx565akm loaded v5.9 and v5.10 Merlijn Wajer
  2021-12-10 19:59 ` Andreas Kemnade
@ 2021-12-13 13:10 ` Sebastian Reichel
  2021-12-16 13:06   ` Merlijn Wajer
  1 sibling, 1 reply; 7+ messages in thread
From: Sebastian Reichel @ 2021-12-13 13:10 UTC (permalink / raw)
  To: Merlijn Wajer
  Cc: linux-omap, Ivaylo Dimitrov, Dev Null, Pavel Machek, Tony Lindgren

[-- Attachment #1: Type: text/plain, Size: 5869 bytes --]

Hi,

On Fri, Dec 10, 2021 at 08:18:35PM +0100, Merlijn Wajer wrote:
> Hi Sebastian,
> 
> I don't know if this is something that requires any action currently,
> but I wanted to report that I'm seeing some increased power draw on a
> Nokia N900 with minimal userspace on Linux 5.10 (and the same happens on
> 5.15 it seems, so it doesn't seem to be resolved since). I tried to
> bisect the problem but my initial attempt failed, because the problem
> seems a bit racy or unpredictable.
> 
> Basically I boot a system to init=/bin/bash and run the following:
> 
> > modprobe panel-sony-acx565akm
> > 
> > mount -t proc none /proc
> > mount -t sysfs none /sys
> > mount -t debugfs none /sys/kernel/debug
> > mount -o rw,remount /
> > 
> > echo 1 > /sys/kernel/debug/pm_debug/enable_off_mode
> > echo 0 > /sys/class/backlight/acx565akm/brightness
> > 
> > 
> > consoles=$(find /sys/bus/platform/devices/4*.serial/ -name console)
> > for console in ${consoles}; do
> >     echo N > ${console}
> > done
> > 
> > # Enable autosuspend
> > uarts=$(find /sys/bus/platform/devices/4*.serial/power/ -type d)
> > for uart in ${uarts}; do
> >     echo 2000 > ${uart}/autosuspend_delay_ms
> >     echo enabled > ${uart}/wakeup
> >     echo auto > ${uart}/control
> > done
> > 
> > # Configure wake-up from suspend
> > uarts=$(find /sys/class/tty/tty[SO]*/power/ -type d)
> > for uart in ${uarts}; do
> >     echo enabled > ${uart}/wakeup
> > done
> 
> This loads the panel and then sets the brightness to zero, enables off
> mode and idles the kernel console/serial.
> 
> Then run the following to check idle states:
> 
> 	grep ^core_pwrdm /sys/kernel/debug/pm_debug/count | cut -d',' -f2,3
> 
> And also check the power usage on lab power supply that I have here.
> 
> With the above, Linux v5.9 (no patches applied) idles at around 42mW
> (15mW goes to the serial device, so it's more like 27mW, anyway...).
> 
> Linux v5.10 with the following two commits reverted (otherwise the
> system is not stable):
> 
> * fb2c599f056640d289b2147fbe6d9eaee689f1b2 (ARM: omap3: enable off mode
> automatically)
> * 21b2cec61c04bd175f0860d9411a472d5a0e7ba1 (mmc: Set
> PROBE_PREFER_ASYNCHRONOUS for drivers that existed in v4.4)
> 
> And the following config change on top of omap2plus_defconfig (to make
> OFF mode work on v5.10 as detailed in "Nokia N900 not hitting OFF mode
> since 5.9 is caused by proactive memory compaction"):
> 
> > sed -i 's/CONFIG_COMPACTION=y/CONFIG_COMPACTION=n/' .config
> 
> Idles at much more -- 60mW (compared to 42mW). Executing "rmmod
> panel-sony-acx565akm" makes the power draw return to v5.9 levels.
> 
> I don't really understand why this would happen, and as stated before
> wasn't able to really bisect the problem. However, some simple guesswork
> led me to find that reverting 7c4bada12d320d8648ba3ede6f9b6f9e10f1126a
> ("drm/panel: sony-acx565akm: Fix race condition in probe") makes v5.10
> idle at 42mW again. I don't know if this because v5.9 never properly
> initialised the panel, or because the race condition fix introduced
> another problem that leaves the hardware in an abnormal state.
> 
> Any hints on what could cause this extra power draw? Maybe the panel is
> waiting for something? I suppose it's potentially feasible that with
> more modules and userspace loaded the panel idles properly, but I
> currently don't have a way to measure that.

First of all: I do not have documentation for that panel. Before my
patch what happened was that gpiod_get() initialized the reset GPIO
as OUTPUT_LOW. Immediately afterwards it is configured as OUTPUT_HIGH
in acx565akm_detect(). So there are 2 options:

1. The reset GPIO was low before the driver probe starts. In that
   case everything is fine with or without 7c4bada12d320 and there
   is no expected change in behaviour. The GPIO is just toggled
   slightly earlier.

2. The reset GPIO was output-high before the driver probe starts
   (e.g. because bootloader used the panel, kexec, ...). In that
   case the reset GPIO will be low for just a very short time (just
   a few instructions). Usually panels have a minimum time required
   for reset lines to be asserted. In acx565akm_power_off() it is
   hinted, that 100ms should be ok.

My patch fixes the behaviour, so that reset is no longer asserted
for less than 100ms in the second case by not asserting it at all.
That also means, that the LCD is not reset when it has already been
configured before the probe routine is called. An alternative would
be the following patch, which does the reset and ensures minimum
reset times are ok:

------------------------------------------------------
git diff drivers/gpu/drm/panel/panel-sony-acx565akm.c
diff --git a/drivers/gpu/drm/panel/panel-sony-acx565akm.c b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
index ba0b3ead150f..2a8c0f7342ce 100644
--- a/drivers/gpu/drm/panel/panel-sony-acx565akm.c
+++ b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
@@ -629,11 +629,12 @@ static int acx565akm_probe(struct spi_device *spi)
        lcd->spi = spi;
        mutex_init(&lcd->mutex);
 
-       lcd->reset_gpio = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_HIGH);
+       lcd->reset_gpio = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_LOW);
        if (IS_ERR(lcd->reset_gpio)) {
                dev_err(&spi->dev, "failed to get reset GPIO\n");
                return PTR_ERR(lcd->reset_gpio);
        }
+       msleep(100); /* ensure minimum reset assertion time */
 
        ret = acx565akm_detect(lcd);
        if (ret < 0) {
------------------------------------------------------

-- Sebastian

> 
> Regards,
> Merlijn
> 
> 
> PS: For both v5.9 and v5.10 kernels the only other change to
> omap2plus_defconfig is to make the watchdog(s) built-in.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: Nokia N900 increased power draw with panel-sony-acx565akm loaded v5.9 and v5.10
  2021-12-13 13:10 ` Sebastian Reichel
@ 2021-12-16 13:06   ` Merlijn Wajer
  2022-01-06 12:53     ` Merlijn Wajer
  0 siblings, 1 reply; 7+ messages in thread
From: Merlijn Wajer @ 2021-12-16 13:06 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: linux-omap, Ivaylo Dimitrov, Dev Null, Pavel Machek, Tony Lindgren

Hi Sebastian,

On 13/12/2021 14:10, Sebastian Reichel wrote:
> Hi,
> 
> On Fri, Dec 10, 2021 at 08:18:35PM +0100, Merlijn Wajer wrote:
> 
>> Any hints on what could cause this extra power draw? Maybe the panel is
>> waiting for something? I suppose it's potentially feasible that with
>> more modules and userspace loaded the panel idles properly, but I
>> currently don't have a way to measure that.
> 
> First of all: I do not have documentation for that panel. Before my
> patch what happened was that gpiod_get() initialized the reset GPIO
> as OUTPUT_LOW. Immediately afterwards it is configured as OUTPUT_HIGH
> in acx565akm_detect(). So there are 2 options:
> 
> 1. The reset GPIO was low before the driver probe starts. In that
>    case everything is fine with or without 7c4bada12d320 and there
>    is no expected change in behaviour. The GPIO is just toggled
>    slightly earlier.
> 
> 2. The reset GPIO was output-high before the driver probe starts
>    (e.g. because bootloader used the panel, kexec, ...). In that
>    case the reset GPIO will be low for just a very short time (just
>    a few instructions). Usually panels have a minimum time required
>    for reset lines to be asserted. In acx565akm_power_off() it is
>    hinted, that 100ms should be ok.
> 
> My patch fixes the behaviour, so that reset is no longer asserted
> for less than 100ms in the second case by not asserting it at all.
> That also means, that the LCD is not reset when it has already been
> configured before the probe routine is called. An alternative would
> be the following patch, which does the reset and ensures minimum
> reset times are ok:
> 
> ------------------------------------------------------
> git diff drivers/gpu/drm/panel/panel-sony-acx565akm.c
> diff --git a/drivers/gpu/drm/panel/panel-sony-acx565akm.c b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> index ba0b3ead150f..2a8c0f7342ce 100644
> --- a/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> +++ b/drivers/gpu/drm/panel/panel-sony-acx565akm.c
> @@ -629,11 +629,12 @@ static int acx565akm_probe(struct spi_device *spi)
>         lcd->spi = spi;
>         mutex_init(&lcd->mutex);
>  
> -       lcd->reset_gpio = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_HIGH);
> +       lcd->reset_gpio = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_LOW);
>         if (IS_ERR(lcd->reset_gpio)) {
>                 dev_err(&spi->dev, "failed to get reset GPIO\n");
>                 return PTR_ERR(lcd->reset_gpio);
>         }
> +       msleep(100); /* ensure minimum reset assertion time */
>  
>         ret = acx565akm_detect(lcd);
>         if (ret < 0) {
> ------------------------------------------------------

With this additional patch applied the device seems to idle at lower
power usage in the test environment I described in my previous email.
That is, it idles at at 42mW with the panel probed, as opposed to 60mW
with the panel probed. I also just booted to my Maemo Leste environment
and the panel still comes up fine and seems to behave fine.

Is there additional testing I can perform to make sure this patch is the
right one?

Thanks,
Regards,
Merlijn

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Nokia N900 increased power draw with panel-sony-acx565akm loaded v5.9 and v5.10
  2021-12-16 13:06   ` Merlijn Wajer
@ 2022-01-06 12:53     ` Merlijn Wajer
  2022-01-06 16:36       ` Ivaylo Dimitrov
  0 siblings, 1 reply; 7+ messages in thread
From: Merlijn Wajer @ 2022-01-06 12:53 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: linux-omap, Ivaylo Dimitrov, Dev Null, Pavel Machek, Tony Lindgren

Hi Sebastian,

On 16/12/2021 14:06, Merlijn Wajer wrote:
> Hi Sebastian,
> 
> [...]
> 
> With this additional patch applied the device seems to idle at lower
> power usage in the test environment I described in my previous email.
> That is, it idles at at 42mW with the panel probed, as opposed to 60mW
> with the panel probed. I also just booted to my Maemo Leste environment
> and the panel still comes up fine and seems to behave fine.
> 
> Is there additional testing I can perform to make sure this patch is the
> right one?

Just an update, Ivaylo is seeing some problems with this patch, so we
might have to dig in deeper later on. I'll keep the patch around, but it
shouldn't be merged at this point in time.

Regards,
Merlijn

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Nokia N900 increased power draw with panel-sony-acx565akm loaded v5.9 and v5.10
  2022-01-06 12:53     ` Merlijn Wajer
@ 2022-01-06 16:36       ` Ivaylo Dimitrov
  0 siblings, 0 replies; 7+ messages in thread
From: Ivaylo Dimitrov @ 2022-01-06 16:36 UTC (permalink / raw)
  To: Merlijn Wajer, Sebastian Reichel
  Cc: linux-omap, Dev Null, Pavel Machek, Tony Lindgren



On 6.01.22 г. 14:53 ч., Merlijn Wajer wrote:
> Hi Sebastian,
> 
> On 16/12/2021 14:06, Merlijn Wajer wrote:
>> Hi Sebastian,
>>
>> [...]
>>
>> With this additional patch applied the device seems to idle at lower
>> power usage in the test environment I described in my previous email.
>> That is, it idles at at 42mW with the panel probed, as opposed to 60mW
>> with the panel probed. I also just booted to my Maemo Leste environment
>> and the panel still comes up fine and seems to behave fine.
>>
>> Is there additional testing I can perform to make sure this patch is the
>> right one?
> 
> Just an update, Ivaylo is seeing some problems with this patch, so we
> might have to dig in deeper later on. I'll keep the patch around, but it
> shouldn't be merged at this point in time.
> 

Basically, the problems I see is a black screen :) - the same as without 
7c4bada12d320 (though I didn't test if blank/unblank will make it work). 
I may look into fremantle kernel to see what Nokia did.

Regards,
Ivo

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-06 16:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 19:18 Nokia N900 increased power draw with panel-sony-acx565akm loaded v5.9 and v5.10 Merlijn Wajer
2021-12-10 19:59 ` Andreas Kemnade
2021-12-10 20:30   ` Merlijn Wajer
2021-12-13 13:10 ` Sebastian Reichel
2021-12-16 13:06   ` Merlijn Wajer
2022-01-06 12:53     ` Merlijn Wajer
2022-01-06 16:36       ` Ivaylo Dimitrov

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.