mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: b.danias@tutamail.com
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Serin Yeh <serin.yeh@intel.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Robert Foss <rfoss@kernel.org>, Hans de Goede <hansg@kernel.org>,
	Bryan O'Donoghue <bod@kernel.org>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH 1/3] media: i2c: ov8856: Don't power off a suspended sensor in remove()
Date: Mon, 9 Nov 2026 15:01:24 +0200	[thread overview]
Message-ID: <avHEJFI-DNz074FS@kekkonen.localdomain> (raw)
In-Reply-To: <20261104-ov8856-pm-fixes-v1-1-1958b730ce66@tutamail.com>

Hi Babis,

Thanks for the set.

On Wed, Nov 04, 2026 at 11:42:47AM +0200, Babis Danias via B4 Relay wrote:
> From: Babis Danias <b.danias@tutamail.com>
> 
> ov8856_remove() calls ov8856_power_off() unconditionally. The sensor is
> normally runtime-suspended by then, so its regulators and clock get
> disabled a second time. On every unbind, the regulator core refuses the
> extra disable with an "unbalanced disables" warning, and the clock
> framework warns that the clock is already disabled and unprepared.
> 
> For the clock this is more than a warning: the clock framework keeps
> one enable count per clock, shared by all its consumers. Where sensors
> share a clock, such as the TPS68470 clock that int3472 hands to every
> sensor behind it, the extra disable can stop the clock under another
> sensor that is streaming.
> 
> This has been the case on devicetree systems since the power handling
> was added. Since commit 609a71568664 ("media: i2c: ov8856 : remove ACPI
> node bypass mechanism"), it happens on ACPI systems too. Seen on a Dell
> Latitude 7320 Detachable (rear OV8856 behind a TPS68470) when unbinding
> the driver:
> 
>   [  220.072107] unbalanced disables for CORE
>   [  220.072109] WARNING: drivers/regulator/core.c:3262 at _regulator_disable+0xc3/0x150, CPU#2: tee/8667
>   [  220.072825] tps68470-clk already disabled
>   [  220.072828] WARNING: drivers/clk/clk.c:1188 at clk_core_disable+0x82/0x140, CPU#2: tee/8667
>   [  220.073620] tps68470-clk already unprepared
>   [  220.073623] WARNING: drivers/clk/clk.c:1047 at clk_core_unprepare+0x1cf/0x200, CPU#2: tee/8667
> 
> Power the sensor off only if it isn't runtime-suspended, then mark it
> suspended, as other sensor drivers such as ov5675 do.
> 
> The problem was found, and this patch written, with the help of an AI
> coding assistant (Claude Opus 5.5). See the cover letter for details.
> 
> Fixes: 0c2c7a1e0d69 ("media: ov8856: Add devicetree support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Babis Danias <b.danias@tutamail.com>
> ---
>  drivers/media/i2c/ov8856.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/ov8856.c b/drivers/media/i2c/ov8856.c
> index 42c4b9c4e..988ce0310 100644
> --- a/drivers/media/i2c/ov8856.c
> +++ b/drivers/media/i2c/ov8856.c
> @@ -2367,7 +2367,9 @@ static void ov8856_remove(struct i2c_client *client)
>  	pm_runtime_disable(ov8856->dev);
>  	mutex_destroy(&ov8856->mutex);
>  
> -	ov8856_power_off(ov8856->dev);
> +	if (!pm_runtime_status_suspended(ov8856->dev))
> +		ov8856_power_off(ov8856->dev);
> +	pm_runtime_set_suspended(ov8856->dev);

Also setting the device suspended should be conditional to its status, not
just powering it off.

>  }
>  
>  static int ov8856_probe(struct i2c_client *client)
> 

-- 
Regards,

Sakari Ailus

  reply	other threads:[~2026-11-09 13:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04  9:42 [PATCH 0/3] media: i2c: ov8856: Power management fixes Babis Danias via B4 Relay
2026-11-04  9:42 ` [PATCH 1/3] media: i2c: ov8856: Don't power off a suspended sensor in remove() Babis Danias via B4 Relay
2026-11-09 13:01   ` Sakari Ailus [this message]
2026-11-04  9:42 ` [PATCH 2/3] media: i2c: ov8856: Enable runtime PM before registering the sub-device Babis Danias via B4 Relay
2026-11-08 23:45   ` Charles Drolet
2026-11-09 13:04     ` Sakari Ailus
2026-11-09 13:02   ` Sakari Ailus
2026-11-04  9:42 ` [PATCH 3/3] media: i2c: ov8856: Power off the sensor during system suspend Babis Danias via B4 Relay
2026-11-06  1:53   ` Charles Drolet
2026-11-09  0:24   ` Laurent Pinchart

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=avHEJFI-DNz074FS@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=b.danias@tutamail.com \
    --cc=bod@kernel.org \
    --cc=hansg@kernel.org \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rfoss@kernel.org \
    --cc=serin.yeh@intel.com \
    --cc=stable@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®