Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1147969ybg; Tue, 2 Jun 2020 02:34:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEHP8Fx1QT67cD5afiiBI7IJw7Jn2G3+EqCZJt2EFjFcQqkkYaqfTCbmLFCeZ2khf3D60p X-Received: by 2002:a50:a782:: with SMTP id i2mr25832203edc.33.1591090440176; Tue, 02 Jun 2020 02:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591090440; cv=none; d=google.com; s=arc-20160816; b=fmQk3HrI3pWKujuGWcfhlG26FOYYWsfeyHsXP9IZy7Np/r1xivVGOHv2/L5gBqylY0 A2yrmY5oalfV/gFPgA0P4+LiHSpVMhRsj75U+4hPPGHs5GrzO3ImqACMQL1XXBpE0DKN pwiaLznK9tSGnYn0PQO7MFvSGnBNS79/DFeO0UbjKtjBGeMEExWsTk4FApxGaa0YH9Bw VxS9aNYPqZVkr9gO5pinA+Tq9TVXUDxgw8Obc8Wl3Y5b70mIC2KzZZ4RWbr7y07RVJLx 5M3lTdT2WAxDCuzRjy1mRR+VXNEveXZFwx/C2yE2ctYiB40GiGFflo0IJDSQ4DchRd7u oddA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:in-reply-to :subject:cc:to:from:user-agent:references; bh=4sTuXThUuQ57vAXwBDO0IGlpQbaYlVB3wm4guFXBbSE=; b=0BE7LKnaI1A9/VQdJqG471wSoi+3b4kN7Mvgxb79h5cdB3yz7/qrEezrNM0unN/8a5 mRdNs+8pS27I+izKQvuTyvH+p48S3A74BldgcMDbedErJht3oxp/fvXSGFXqG0z2Rk91 l4dsgaPrPru61nmw5kuYDoreuI/Esolq5UoCaSp5xxWg7JMIXXIYVh2Hn6hUrbbzaaJv /8pGL0eWVHOeSlc4vRuV2bJeDWDOu8OVHaNyuNkfd1E/8+m712s8AL1Y4i3VXZh1NinI nTy+2ccgxitx/6Ntv3FkKGdhl/S4xPl/xMBupazFEMYrStV7ND8yDrXq920vRseYGE4q JFlg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c16si1204887ejr.477.2020.06.02.02.33.35; Tue, 02 Jun 2020 02:34:00 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726856AbgFBJb3 (ORCPT + 99 others); Tue, 2 Jun 2020 05:31:29 -0400 Received: from foss.arm.com ([217.140.110.172]:48558 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbgFBJb2 (ORCPT ); Tue, 2 Jun 2020 05:31:28 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 45ACC55D; Tue, 2 Jun 2020 02:31:28 -0700 (PDT) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A47393F305; Tue, 2 Jun 2020 02:31:26 -0700 (PDT) References: <20200527151613.16083-1-benjamin.gaignard@st.com> User-agent: mu4e 0.9.17; emacs 26.3 From: Valentin Schneider To: Benjamin Gaignard Cc: hugues.fruchet@st.com, mchehab@kernel.org, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, linux-media@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, vincent.guittot@linaro.org, rjw@rjwysocki.net Subject: Re: [PATCH] media: stm32-dcmi: Set minimum cpufreq requirement In-reply-to: <20200527151613.16083-1-benjamin.gaignard@st.com> Date: Tue, 02 Jun 2020 10:31:21 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Benjamin, On 27/05/20 16:16, Benjamin Gaignard wrote: > Before start streaming set cpufreq minimum frequency requirement. > The cpufreq governor will adapt the frequencies and we will have > no latency for handling interrupts. > Few comments below from someone oblivious to your platform, they may not be all that relevant but I figured I'd pitch in anyway. > Signed-off-by: Benjamin Gaignard > --- > drivers/media/platform/stm32/stm32-dcmi.c | 29 ++++++++++++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c > index b8931490b83b..97c342351569 100644 > --- a/drivers/media/platform/stm32/stm32-dcmi.c > +++ b/drivers/media/platform/stm32/stm32-dcmi.c > @@ -13,6 +13,7 @@ > > #include > #include > +#include > #include > #include > #include > @@ -99,6 +100,8 @@ enum state { > > #define OVERRUN_ERROR_THRESHOLD 3 > > +#define DCMI_MIN_FREQ 650000 /* in KHz */ > + This assumes the handling part is guaranteed to always run on the same CPU with the same performance profile (regardless of the platform). If that's not guaranteed, it feels like you'd want this to be configurable in some way. > struct dcmi_graph_entity { > struct v4l2_async_subdev asd; > [...] > @@ -2020,6 +2042,8 @@ static int dcmi_probe(struct platform_device *pdev) > goto err_cleanup; > } > > + dcmi->policy = cpufreq_cpu_get(0); > + Ideally you'd want to fetch the policy of the CPU your IRQ (and handling thread) is affined to; The only compatible DTS I found describes a single A7, which is somewhat limited in the affinity area... > dev_info(&pdev->dev, "Probe done\n"); > > platform_set_drvdata(pdev, dcmi); > @@ -2049,6 +2073,9 @@ static int dcmi_remove(struct platform_device *pdev) > > pm_runtime_disable(&pdev->dev); > > + if (dcmi->policy) > + cpufreq_cpu_put(dcmi->policy); > + > v4l2_async_notifier_unregister(&dcmi->notifier); > v4l2_async_notifier_cleanup(&dcmi->notifier); > media_entity_cleanup(&dcmi->vdev->entity);