Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3594288rwb; Tue, 20 Sep 2022 01:55:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FGCLmlH7fTLnsJXGc8HvJe8CpL4B48vaNAGAQPMmbzAe/0qNB65aBjBiwAmu9y9xsOvAV X-Received: by 2002:a05:6402:1943:b0:443:5ffb:b04e with SMTP id f3-20020a056402194300b004435ffbb04emr18959362edz.230.1663664101265; Tue, 20 Sep 2022 01:55:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1663664101; cv=pass; d=google.com; s=arc-20160816; b=nOUU3JtgUxGeDEmP6KBRQc1MCX+A1c1YlVHbdK5k7dO3jzBKMTlvkt5GGvl5u/sKNt RXe88k5Lv7dreJGCUh84wJ2P98te1e3RgvlXzkFOOSPE0bR3Ua6+boFAC8rodGugmW+c qpGFzPf0oqqRAFWWrf0EzdbTR2tD7baAIjqDIoFpIy6bQ1D33epy3ShpbOiaeDuWlAbl ZwBQEnvxaLTOS7mhbp9+1RPJwhxwmI8QloQD6ybdptjRZvK/+Mbufe47n3/IB9HT9XkI 7dv9NfQqeezv4cuONGY50zvY2NnZ4TwO0j1dyG+JdASmTKXjiWX6S8PXjktbo2BTsknE W8bA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=GlPLCGc/da4Da/fy1sO3woiVLHczv9MB6uMDmjv0bMA=; b=qUmi4vXpMzbpLmSaltgWH47atK9W7kMx/dsS7Sfy4SXMHKyHG6vUCzqVuh2o6s4A9a QkUyW7If10aQltLNaYNX+h7X14FT7hAx3lOp5u1hqKe72cimTxULAND0wCLDsGmgWdiK XNNZSTSgMUx7BfdHIxhp5VqQi5eL7iPoXN3ULQfmA66eUKTGao8NNgxEUMpJ9Cj8pcCA gCXz76waMeW+8UibnkCNc1/JPCqlSUBniS37sv8qAApP3X6YTfKeT9Omed2MciEiwxwE H15EqcSuHwoErtcGZV8oCQgPxoje9QUFXzoKWzgYFHeoyW14V70tG/6UOYgs5rgrSoAT 5izQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@iki.fi header.s=meesny header.b=tuNsAKU6; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh14-20020a1709076e8e00b0078037cd5c3csi1081001ejc.279.2022.09.20.01.54.36; Tue, 20 Sep 2022 01:55:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@iki.fi header.s=meesny header.b=tuNsAKU6; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231128AbiITIjS (ORCPT + 99 others); Tue, 20 Sep 2022 04:39:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231351AbiITIiR (ORCPT ); Tue, 20 Sep 2022 04:38:17 -0400 Received: from meesny.iki.fi (meesny.iki.fi [IPv6:2001:67c:2b0:1c1::201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42B306B653; Tue, 20 Sep 2022 01:37:12 -0700 (PDT) Received: from hillosipuli.retiisi.eu (dkwl20tj04snw15cjtflt-3.rev.dnainternet.fi [IPv6:2001:14ba:4493:6f40:fec3:d72a:e447:8113]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sailus) by meesny.iki.fi (Postfix) with ESMTPSA id 2632420167; Tue, 20 Sep 2022 11:37:07 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1663663027; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GlPLCGc/da4Da/fy1sO3woiVLHczv9MB6uMDmjv0bMA=; b=tuNsAKU6z4OTnrweOUm5IuaXE/+/Q192I6Exa1uBxNWWaI86SoZAs5FvUjw9NhYl8YitwE fI0o0PndPKGBFHUXnDKC5h59WWkw6Avq3fATwvjHBkephrb74vjNgnSpfzTT156XKteb9E CDqoVtqq1iWNnvkR8nxjUoEVTRkFRlg= Received: from valkosipuli.retiisi.eu (valkosipuli.localdomain [192.168.4.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hillosipuli.retiisi.eu (Postfix) with ESMTPS id BCB62634C91; Tue, 20 Sep 2022 11:37:06 +0300 (EEST) Date: Tue, 20 Sep 2022 11:37:06 +0300 From: Sakari Ailus To: Hidenori Kobayashi Cc: Dongchun Zhu , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] media: ov8856: Add runtime PM callbacks Message-ID: References: <20220920020002.710533-1-hidenorik@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220920020002.710533-1-hidenorik@chromium.org> ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=sailus smtp.mailfrom=sakari.ailus@iki.fi ARC-Seal: i=1; s=meesny; d=iki.fi; t=1663663027; a=rsa-sha256; cv=none; b=T7mPl+Ppct5PQk5Tq1S+wOcV1ERVUWDRfy5MFa1HwMdkJpqDPjTYQdhc4zX9n5olFFlsvW Io1iv87K229sGwQVH6qNCp+tGvkW0Q26OK2c4trhTK57r/Fd3TcXMHGR2xPdm95YLW4V+G xuleL6TU93sBr6ASzADzXeQ847A5GWQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1663663027; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GlPLCGc/da4Da/fy1sO3woiVLHczv9MB6uMDmjv0bMA=; b=uRG6DjTDYKe0FE1FoLSCIGWtrJ4PLFlboB6UkGx62jWqxzjmFoUXmIeexjrL7wFsHsG7Yx dliCMMXMGUdr8NAiHbFChTkdPUVGf/BcTwSne/DB/Dab5JMaiY1bJLfihHotDFE9PLpnIW 3yPXxWoKtpjJ0wQ1OSHDD1ts3ZOllfc= X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Hidenori, On Tue, Sep 20, 2022 at 11:00:01AM +0900, Hidenori Kobayashi wrote: > There were no runtime PM callbacks registered, leaving regulators being > enabled while the device is suspended on DT systems. Calling existing > power controlling functions from callbacks properly turn them off/on. > > Signed-off-by: Hidenori Kobayashi > --- > drivers/media/i2c/ov8856.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/drivers/media/i2c/ov8856.c b/drivers/media/i2c/ov8856.c > index a9728afc81d4..3f57bc30b78b 100644 > --- a/drivers/media/i2c/ov8856.c > +++ b/drivers/media/i2c/ov8856.c > @@ -2200,6 +2200,26 @@ static int __maybe_unused ov8856_resume(struct device *dev) > return 0; > } > > +static int __maybe_unused ov8856_runtime_suspend(struct device *dev) > +{ > + struct i2c_client *client = to_i2c_client(dev); > + struct v4l2_subdev *sd = i2c_get_clientdata(client); > + struct ov8856 *ov8856 = to_ov8856(sd); > + > + __ov8856_power_off(ov8856); Could you refactor this a bit, changing the __ov8856_power_off() argument to struct dev *? > + > + return 0; > +} > + > +static int __maybe_unused ov8856_runtime_resume(struct device *dev) > +{ > + struct i2c_client *client = to_i2c_client(dev); > + struct v4l2_subdev *sd = i2c_get_clientdata(client); > + struct ov8856 *ov8856 = to_ov8856(sd); > + > + return __ov8856_power_on(ov8856); > +} > + > static int ov8856_set_format(struct v4l2_subdev *sd, > struct v4l2_subdev_state *sd_state, > struct v4l2_subdev_format *fmt) > @@ -2540,6 +2560,7 @@ static int ov8856_probe(struct i2c_client *client) > > static const struct dev_pm_ops ov8856_pm_ops = { > SET_SYSTEM_SLEEP_PM_OPS(ov8856_suspend, ov8856_resume) > + SET_RUNTIME_PM_OPS(ov8856_runtime_suspend, ov8856_runtime_resume, NULL) > }; > > #ifdef CONFIG_ACPI -- Kind regards, Sakari Ailus