Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp676894pxh; Tue, 9 Nov 2021 17:19:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJwkp2T5zOIl9/VV4QieWHYe49FuhAvQpLLHkbKaIZiQqlYqeWmHZUGa+/b9HYo3Th1bEl/f X-Received: by 2002:a05:6638:2103:: with SMTP id n3mr9261950jaj.25.1636507179863; Tue, 09 Nov 2021 17:19:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636507179; cv=none; d=google.com; s=arc-20160816; b=rtYp2q9WfA+6jcM2s+23b/pz6/nRLDxTOc7xvKDQKtQTSX7YBgwO/J6Np3JlDjf9LQ P70jT8Wt9WOld1b0WzxLgYt5UhJLxT3OSqBvrO6UQntsHvQsWBJiDN9NGwhbYdDjZt4b dd+LvpJPf4Abko7pdC5VXjaTB7wydY0tcgfhiLOiRObO2hmdFu2+zDghrRxweRQKqrxp K5ZUzUEM75GFvsOrPcCOd4uJ7+37HFNf7XXSLXzmcqI34t1dm+yVMl0IPfXrHDs+gxHM zhpbQHizn+RGVk1/G6U8ftDPPujLboDYHOHCOet7t29F8uB3IGreVIEQxIH32jQELxnf iJcg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=jhIbA0CD5FKG2SIUU+filLCF3hFvuHaOgVId0vgQXl0=; b=cXFY26CS2pYYAYQcvd4mAnirVCLtv8/maehejrd/InFzpYFZo0loenXT4tZp32+RAu +jzSBQy5L/3sL2qbh2z+/VLYr+cgvX0iGJKOVtRbPgbwxh8EV3KLyCn5846PXhJzTNx+ F9ohwhMRpwWsU/CrqKkIK/51a2LboxrBiIgStXY1A2acr3KgrKLnFmK+B+WYo4GFEEb1 9F2cHfRRhf6mD7ztYYdkeARjLuqfJXqrd9547CukTl6n7TdayNCHWvryinwQA4h21FcF eiR8w8s/cWtUwB6Z4JhVLozD0vvJaoS9aobPfdZVZHwEnqN1bQP4Myrp6a7qJpH2oNiP 5a0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=puri.sm Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 8si3904933ilx.163.2021.11.09.17.19.28; Tue, 09 Nov 2021 17:19:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=puri.sm Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234644AbhKINNh (ORCPT + 97 others); Tue, 9 Nov 2021 08:13:37 -0500 Received: from comms.puri.sm ([159.203.221.185]:47352 "EHLO comms.puri.sm" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234488AbhKINNg (ORCPT ); Tue, 9 Nov 2021 08:13:36 -0500 Received: from localhost (localhost [127.0.0.1]) by comms.puri.sm (Postfix) with ESMTP id 47ECAE0304; Tue, 9 Nov 2021 05:10:50 -0800 (PST) Received: from comms.puri.sm ([127.0.0.1]) by localhost (comms.puri.sm [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LPH1gB_nCPrf; Tue, 9 Nov 2021 05:10:49 -0800 (PST) From: Martin Kepplinger To: sakari.ailus@linux.intel.com, mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@puri.sm, Martin Kepplinger Subject: [PATCH v1 2/2] media: i2c: hi846: use pm_runtime_force_suspend/resume for system suspend Date: Tue, 9 Nov 2021 14:10:13 +0100 Message-Id: <20211109131013.2684058-3-martin.kepplinger@puri.sm> In-Reply-To: <20211109131013.2684058-1-martin.kepplinger@puri.sm> References: <20211109131013.2684058-1-martin.kepplinger@puri.sm> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In cases like this when controlling regulators and clocks the suspend() and resume() functions are meant to be called balanced toggling the behaviour. It's wrong to use the same suspend function for runtime and system suspend in this case and leads to errors like [ 77.718890] Failed to disable vddd: -EIO Use pm_runtime_force_* helpers in order to support system suspend properly when runtime pm is already implemented and fix this. Signed-off-by: Martin Kepplinger --- drivers/media/i2c/hi846.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/hi846.c b/drivers/media/i2c/hi846.c index ed55c3894284..9bb96754a091 100644 --- a/drivers/media/i2c/hi846.c +++ b/drivers/media/i2c/hi846.c @@ -2418,7 +2418,11 @@ static int hi846_remove(struct i2c_client *client) return 0; } -static UNIVERSAL_DEV_PM_OPS(hi846_pm_ops, hi846_suspend, hi846_resume, NULL); +static const struct dev_pm_ops hi846_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) + SET_RUNTIME_PM_OPS(hi846_suspend, hi846_resume, NULL) +}; static const struct of_device_id hi846_of_match[] = { { .compatible = "hynix,hi846", }, -- 2.30.2