From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55215C433F5 for ; Mon, 6 Sep 2021 08:05:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 41A8460F43 for ; Mon, 6 Sep 2021 08:05:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240602AbhIFIGI (ORCPT ); Mon, 6 Sep 2021 04:06:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:43926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240504AbhIFIEX (ORCPT ); Mon, 6 Sep 2021 04:04:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8493A60F43; Mon, 6 Sep 2021 08:03:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630915396; bh=wvOQMqx+ttkvKL5vTgiWBch+7sKvXQrHilV+EnzpqDY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=qJelRv7D2U3fMcsBsFcgqqREJc978ZMcQmtjZz3YTAXAI0mwLSSN8+C5ZftlBJvUh pl6AreYgAthuXlPl4mq4oN88NXnDI8HGvTcWlrXIlVnS7eNFqkeXHOu/tKjt5EtENE WXWjkCqT76vEyLVp/ZL6KttsiBTpv5gigeOMd7dOPICYY93gQWfsjq9eSgavw0EpgM QWpO9Ah8eaAxkllHHuCGIgIqnO6p9xrDpNFmmxZflqSmHgjd59oLf8SJiyqRmdeqSr 9Gu5cmSed6Tcp6en0IhiRPOwSeUp3Y6nXvPzK5R5GaGOibpDTJpGSZdyacdq834n74 oqKBZHCk/QijA== Date: Mon, 6 Sep 2021 10:03:10 +0200 From: Mauro Carvalho Chehab To: Cc: , , , , , , , , , , Subject: Re: [PATCH 08/25] media: atmel: properly get pm_runtime Message-ID: <20210906100310.4891fa2c@coco.lan> In-Reply-To: References: <975645970144b6c8401ab9bd1243619978a868a9.1620207353.git.mchehab+huawei@kernel.org> <20210505130835.000006b7@Huawei.com> <20210610113827.57db9e77@coco.lan> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Eugen, Em Thu, 10 Jun 2021 12:00:42 +0000 escreveu: > On 6/10/21 12:38 PM, Mauro Carvalho Chehab wrote: > > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > > > Em Thu, 10 Jun 2021 09:04:07 +0000 > > escreveu: > > > >>>> diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c > >>>> index fe3ec8d0eaee..ce8e1351fa53 100644 > >>>> --- a/drivers/media/platform/atmel/atmel-isc-base.c > >>>> +++ b/drivers/media/platform/atmel/atmel-isc-base.c > >>>> @@ -294,9 +294,13 @@ static int isc_wait_clk_stable(struct clk_hw *hw) > >>>> static int isc_clk_prepare(struct clk_hw *hw) > >>>> { > >>>> struct isc_clk *isc_clk = to_isc_clk(hw); > >>>> + int ret; > >>>> > >>>> - if (isc_clk->id == ISC_ISPCK) > >>>> - pm_runtime_get_sync(isc_clk->dev); > >>>> + if (isc_clk->id == ISC_ISPCK) { > >>>> + ret = pm_runtime_resume_and_get(isc_clk->dev); > >>>> + if (ret < 0) > >>>> + return ret; > >>>> + } > >> > >> Hi Mauro, > >> > >> With this patch, the ISC is broken on latest media tree. It looks like > >> pm_runtime_resume_and_get for the ISC_ISPCK clock returns -ENOACCESS and > >> thus, the probe of the driver fails: > >> > >> atmel-sama5d2-isc f0008000.isc: failed to enable ispck: -13 > >> atmel-sama5d2-isc: probe of f0008000.isc failed with error -13 What's the current status of this issue? If the bug still happens, we need a fix for it. We might revert this patch, but this would just be masking some other hidden bug. Regards, Mauro > >> > >> > >> Could you point out how I could fix this ? Maybe the isc_clk->dev is not > >> properly handled/initialized in some other part of the code ? > > > > Looking at RPM implementation: > > > > static int rpm_resume(struct device *dev, int rpmflags) > > { > > ... > > if (dev->power.runtime_error) > > retval = -EINVAL; > > else if (dev->power.disable_depth == 1 && dev->power.is_suspended > > && dev->power.runtime_status == RPM_ACTIVE) > > retval = 1; > > else if (dev->power.disable_depth > 0) > > retval = -EACCES; > > ... > > > > It sounds that RPM is disabled for this clock. Did you call > > pm_runtime_enable() before calling isc_clk_prepare()? > > > > Thanks, > > Mauro > > > > I tried to call pm_runtime_enable for the clk at clk_init time, but > doing that makes the runtime for the ISC fail like this: > > atmel-sama5d2-isc f0008000.isc: Unbalanced pm_runtime_enable! Thanks, Mauro