Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp609173imm; Wed, 25 Jul 2018 03:04:01 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcAP49MreLDqOeHmpeeOcwstR3Jtra8OHDq3QjtdIUp4gnzYBC7A5BCqyzkh5L2SYnq+xuT X-Received: by 2002:a17:902:9a8b:: with SMTP id w11-v6mr20390491plp.333.1532513041526; Wed, 25 Jul 2018 03:04:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532513041; cv=none; d=google.com; s=arc-20160816; b=e5ctnNhvR/7UzQx1edqAQv8tg341sTd3zzj/tFtH+cmSoRVRH8vE/Drsg3EW37j3S2 +nMs1b3BeKhns5/bpJrQ3mzzk2jH1iLrM4HGALxwi17vUc4TUJNjIpasOg1cyCPKax6F ZJZyvLbGgggqMiJez8XGHmQxhwmK5U/MRw+9FqO9yYntT45+JwFzSNK6bvn7pWPlizvU ZrWL/oqq5YGYD0f/ImC1AwPq0wvLI96TlGF2xj2kJKXMNBEaA/U6RXZQK3cCgKZxhwyM vkY57Maz3qsR/WphvawRvE23dLNsRK4S88+VmIy1XWzfSpva9LPtKRY0MC6sJj6/yQCE rqyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=3O2OKxjgBDx/xRVYJHzGFxkgx0Sj3AA23qzaa9sK0/I=; b=xH6NpyYSxwfO8FqsYk6VBhnloTka9NJcaalkUSD1RFa/MTG4YAT4HC7Bd5ZEKqK2s1 1blXjSxvAgc3uMguNnLA8IIfCR3/LSLDUJKtt1gr8akheRDkeQgaWXsNX7x/fFP57sjR a8ZjiFkdqQT/Odh31ZoRAUArfCw+01oQem9uHI14QGQMjEjr6rVxzlsx6yU0JFwNoe/2 P7yua0k5fi0mL+76UKywxl033bsSlnZOAReeI5i6Zl0MaIMiRZ7ZguW6AdnzH4fuXA30 Wd5unc6B4AKyWybFD9BFxY0QUBeDkY4bMPk566PHHazmM3q/lkZKpGNEv77LRCa8jc2F RJBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K3EMLFSu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l184-v6si13505743pge.257.2018.07.25.03.03.46; Wed, 25 Jul 2018 03:04:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K3EMLFSu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728850AbeGYLMc (ORCPT + 99 others); Wed, 25 Jul 2018 07:12:32 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42895 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728658AbeGYLMc (ORCPT ); Wed, 25 Jul 2018 07:12:32 -0400 Received: by mail-wr1-f67.google.com with SMTP id e7-v6so6803342wrs.9 for ; Wed, 25 Jul 2018 03:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=3O2OKxjgBDx/xRVYJHzGFxkgx0Sj3AA23qzaa9sK0/I=; b=K3EMLFSu2WJWltm1ATudhNoJNhO36I6tp5LJSGc0yjf1hbz+9Jxw505msYIeuydU+7 ywK85kt8B6dE7vt6t2Vz3+sbpT1jQr/2NxlYDtJUeU7fJEwetbVmn5Tka2Q6KbqNOu8H CFkh3EZUr7zgNoN3qiwaRjZqqqYcXUQYBfrJ4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=3O2OKxjgBDx/xRVYJHzGFxkgx0Sj3AA23qzaa9sK0/I=; b=JrlO5iTHa1pjIoZ/CAAQCibJqAoWmgjtRi0YNcgI6mSnl42SzHQ6A3XhbJZv0wlglZ aJA6/zbgHSlRB/JVYkqp/56mIbCU24aJXavxFFFoWXXGy9svhV7d1cPdhlLj6FBWvxcp QiGkqk01R9lJdXR8ExYfHaUnVI0ulErw4LI2PyI4Y4eE0OGDtopPzPhZMN0VSm2GfXrf mzTBryzvgtrH1CDdgQsYwmx8qsUkpCbMcell2iHuOwNdgiJ8zO9xAAeJEBbHVMZ9SD1h DNxrxkoOgR8rGuD/b1Tj238Cgy2CBJHzGWlwq1KXHHFG2fH7p0V//NquVcGZQm5etTm3 69Gg== X-Gm-Message-State: AOUpUlEYAtn96WQJZ60FMsklZ4lmEDTA2Z68Q8ZEz6YsYCriEcSB3YeF qc2Q+YPAOlMQykVhb1Pz6JKnMz49/SQ= X-Received: by 2002:adf:9d1c:: with SMTP id k28-v6mr14663837wre.29.1532512892960; Wed, 25 Jul 2018 03:01:32 -0700 (PDT) Received: from [192.168.27.197] ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id a9-v6sm10174104wrp.55.2018.07.25.03.01.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jul 2018 03:01:32 -0700 (PDT) Subject: Re: [PATCH v3 18/35] media: camss: Add basic runtime PM support To: Sakari Ailus Cc: mchehab@kernel.org, hans.verkuil@cisco.com, laurent.pinchart+renesas@ideasonboard.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org References: <1532343772-27382-1-git-send-email-todor.tomov@linaro.org> <1532343772-27382-19-git-send-email-todor.tomov@linaro.org> <20180724124916.iyanzu3nux35cudg@paasikivi.fi.intel.com> From: Todor Tomov Message-ID: <096a3fb4-01b8-3096-116f-8562cfb8b6b8@linaro.org> Date: Wed, 25 Jul 2018 13:01:31 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180724124916.iyanzu3nux35cudg@paasikivi.fi.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sakari, Thank you for review. On 24.07.2018 15:49, Sakari Ailus wrote: > Hi Todor, > > On Mon, Jul 23, 2018 at 02:02:35PM +0300, Todor Tomov wrote: >> There is a PM domain for each of the VFE hardware modules. Add >> support for basic runtime PM support to be able to control the >> PM domains. When a PM domain needs to be powered on - a device >> link is created. When a PM domain needs to be powered off - >> its device link is removed. This allows separate and >> independent control of the PM domains. >> >> Suspend/Resume is still not supported. >> >> Signed-off-by: Todor Tomov >> --- >> drivers/media/platform/qcom/camss/camss-csid.c | 4 ++ >> drivers/media/platform/qcom/camss/camss-csiphy.c | 5 ++ >> drivers/media/platform/qcom/camss/camss-ispif.c | 19 ++++++- >> drivers/media/platform/qcom/camss/camss-vfe.c | 13 +++++ >> drivers/media/platform/qcom/camss/camss.c | 63 ++++++++++++++++++++++++ >> drivers/media/platform/qcom/camss/camss.h | 11 +++++ >> 6 files changed, 113 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c >> index 627ef44..ea2b0ba 100644 >> --- a/drivers/media/platform/qcom/camss/camss-csid.c >> +++ b/drivers/media/platform/qcom/camss/camss-csid.c >> @@ -13,6 +13,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -316,6 +317,8 @@ static int csid_set_power(struct v4l2_subdev *sd, int on) >> if (on) { >> u32 hw_version; >> >> + pm_runtime_get_sync(dev); >> + >> ret = regulator_enable(csid->vdda); > > Shouldn't the regulator be enabled in the runtime_resume callback instead? Ideally - yes, but it becomes more complex (different pipelines are possible and we have only one callback) so (at least for now) I have left it as it is and stated in the commit message that suspend/resume is still not supported. > >> if (ret < 0) >> return ret; > > Note that you'll need pm_runtime_put() in in error handling here. Perhaps > elsewhere, too. Yes, I'll add it here and on all other places. > > Can powering on the device (i.e. pm_runtime_get_sync() call) fail? I'd really like to say that it cannot fail :) at least the callback is empty for now and cannot fail, but the logic in pm_runtime_get_sync() is not that simple and I'm really not sure. I'll add checks in the code in case it fails. > >> @@ -348,6 +351,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int on) >> disable_irq(csid->irq); >> camss_disable_clocks(csid->nclocks, csid->clock); >> ret = regulator_disable(csid->vdda); >> + pm_runtime_put_sync(dev); >> } >> >> return ret; >> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c >> index 0383e94..2db78791 100644 >> --- a/drivers/media/platform/qcom/camss/camss-csiphy.c >> +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c >> @@ -13,6 +13,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -240,6 +241,8 @@ static int csiphy_set_power(struct v4l2_subdev *sd, int on) >> u8 hw_version; >> int ret; >> >> + pm_runtime_get_sync(dev); >> + >> ret = csiphy_set_clock_rates(csiphy); >> if (ret < 0) >> return ret; > > Like here. Yes, I'll add it here too. -- Best regards, Todor Tomov