Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3308939rwb; Mon, 19 Sep 2022 19:26:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5aPwdShKuuqnsVkG++/8ru6sOe4N4LLUA2cdDJf9cpvST2f9SzLg6pZQkgdT6vbVrMA3ID X-Received: by 2002:a17:902:c402:b0:178:2bd6:c415 with SMTP id k2-20020a170902c40200b001782bd6c415mr2696455plk.48.1663640819541; Mon, 19 Sep 2022 19:26:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663640819; cv=none; d=google.com; s=arc-20160816; b=msjbu6CX1Xl5Mh/iffASMH9/jAftDs66WBjvIfgMkSUvV+l7B5EPvZfATy1bJy4T1d f0fan0DP5uNJS9BqJIoTXoURX3vZHWHIC4wkmZvzO6ljfHtegJGYQGpi5nlT7PtlwMrw 0nvu5RMeB2QTK6YkmYYb5GxtZEORcMCLfMqWBr3gJ9fLBAH+wd+4NiS6YGZncw/yQi/S pILGI69n7QLaDUR3MB64B+wzmIdrD8xxLe0qtVB0dY2hQxr9AAYQmSCi+a94D1iF8FLN GIZUQnoKYTJKPsMEipm3+72In47uvzb9ecdzqXE2lt707jaGVogSRMC/yoU+tICZUyuk GUpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=EjORqgjc+/XhQqghTBNI0hH8VFbCYaiJSHUSAzsHW/I=; b=hTLe7fJMRqgRfBhFtAo3KH68lLtf3c69YiHjNCxvepc2jsrm8ItjGbht8sleBGwaGr GRFzVpEQdicBXk7lNXKvAR8798iWdWGaa0XAsT2jGlXxMhdyrDFGk2bUL7GOZcl3eb0u chMgTM6iOWS9kpSliPux5s6hROl8ErAwnpju1fyMWMzpSz8ZW5uHvOHd5JTAMsTPPsxW XORMT8lPV9LvdlmBVXgzr48wWrd73lkWS4whr+8/tuvAPAtVBoOG3GNXWQgskS73c57F utNTe7tUzo/WJ2QSXguLihvY2I8XzP0LgOrceXUoglMIIxBCH5qatpa6ALn5FCwFc0K6 Ha4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dGZ18Xoz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e13-20020a63d94d000000b0043978b38f2fsi302029pgj.247.2022.09.19.19.26.47; Mon, 19 Sep 2022 19:26:59 -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=@chromium.org header.s=google header.b=dGZ18Xoz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229619AbiITCA3 (ORCPT + 99 others); Mon, 19 Sep 2022 22:00:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbiITCA0 (ORCPT ); Mon, 19 Sep 2022 22:00:26 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88F263ECC1 for ; Mon, 19 Sep 2022 19:00:24 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id t70so1091608pgc.5 for ; Mon, 19 Sep 2022 19:00:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=EjORqgjc+/XhQqghTBNI0hH8VFbCYaiJSHUSAzsHW/I=; b=dGZ18XozA7N0XnASUbI7DGMsKYTkXd2yFvJICwNNaOaJH4dpJDcjL27zwe6QeC3VCp M8Gy8lGui2ZVOGDeboW8GStuOY3D/vHOgXU4MK249GOOYUGFyAuXIK7XGA4i5qYz/qDh 5XBadz57bCkwq3wujP2qDkjmeN60exaMcgAiA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=EjORqgjc+/XhQqghTBNI0hH8VFbCYaiJSHUSAzsHW/I=; b=f8rxd72V10lNjojb6w6G8malBkGoiQYMH/aVN8+Kh7EQbJHNT6BFzplX3V5M7EZyRn txFgqx+IeI033NYu8Nq8TqoJ0FJWIMfwnAXnqJzu4cA7II3JIU3kPtHJPMJPShhZw2F7 Ob3G9d7U7BwfUAOgg0jxpP/q6yQeRz36lWvufmXYsXfiJVdTsjN9gSEjaOQN6A9cKKIu 2sTkezO6UuamK0hmtXaPcBXVV2Cu7GAqMu+nISurr/KllxaI6ujZohtuX0lfEQV4S/ae B9zZKSWKwRRF8e4qzsjhcRvMfikldLeOzMoacPMu/Q0HC+jjGBeZq3/m8efpVYCvhxja LDQA== X-Gm-Message-State: ACrzQf3fPCX0EMKVbuO34SaPY5JHOc9EouHHSCWYl96xdcgWLhv9pbWP 4Qx6CODksuKeSmNojJdTFX5Hew== X-Received: by 2002:a63:778d:0:b0:438:5c5b:f2ac with SMTP id s135-20020a63778d000000b004385c5bf2acmr18209126pgc.401.1663639224075; Mon, 19 Sep 2022 19:00:24 -0700 (PDT) Received: from localhost ([2401:fa00:8f:203:f7fc:1606:58e3:671d]) by smtp.gmail.com with ESMTPSA id z30-20020aa7991e000000b0053bf1f90188sm68003pff.176.2022.09.19.19.00.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Sep 2022 19:00:23 -0700 (PDT) From: Hidenori Kobayashi To: Dongchun Zhu , Mauro Carvalho Chehab Cc: Hidenori Kobayashi , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: ov8856: Add runtime PM callbacks Date: Tue, 20 Sep 2022 11:00:01 +0900 Message-Id: <20220920020002.710533-1-hidenorik@chromium.org> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 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); + + 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 -- 2.37.2.789.g6183377224-goog