2020-07-01 13:04:41

by Benjamin GAIGNARD

[permalink] [raw]
Subject: [PATCH v7 0/3] DCMI set minimum cpufreq requirement

This series allow to STM32 camera interface (DCMI) to require a minimum
frequency to the CPUs before start streaming frames from the sensor.
The minimum frequency requirement is provided in the devide-tree node.

Setting a minimum frequency for the CPUs is needed to ensure a quick handling
of the interrupts between two sensor frames and avoid dropping half of them.

version 7:
- rebase on v5.8-rc3
- add reviewed and ack-by
- fix test condition

version 6:
- come back to version 4 and follow Valentin's suggestions about notifier

version 5:
- add a mutex to protect dcmi_irq_notifier_notify()
- register notifier a probe time

version 4:
- simplify irq affinity handling by using only dcmi_irq_notifier_notify()

version 3:
- add a cpumask field to track boosted CPUs
- add irq_affinity_notify callback
- protect cpumask field with a mutex

Benjamin Gaignard (3):
dt-bindings: media: stm32-dcmi: Add DCMI min frequency property
media: stm32-dcmi: Set minimum cpufreq requirement
ARM: dts: stm32: Set DCMI frequency requirement for stm32mp15x

.../devicetree/bindings/media/st,stm32-dcmi.yaml | 8 ++
arch/arm/boot/dts/stm32mp151.dtsi | 1 +
drivers/media/platform/stm32/stm32-dcmi.c | 138 +++++++++++++++++++--
3 files changed, 139 insertions(+), 8 deletions(-)

--
2.15.0


2020-07-01 13:05:22

by Benjamin GAIGNARD

[permalink] [raw]
Subject: [PATCH v7 1/3] dt-bindings: media: stm32-dcmi: Add DCMI min frequency property

Document st,stm32-dcmi-min-frequency property which is used to
request CPUs minimum frequency when streaming frames.

Signed-off-by: Benjamin Gaignard <[email protected]>
---
Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml b/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
index 3fe778cb5cc3..05ca85a2411a 100644
--- a/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
+++ b/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
@@ -44,6 +44,13 @@ properties:
bindings defined in
Documentation/devicetree/bindings/media/video-interfaces.txt.

+ st,stm32-dcmi-min-frequency:
+ description: DCMI minimum CPUs frequency requirement (in KHz).
+ allOf:
+ - $ref: /schemas/types.yaml#/definitions/uint32
+ - minimum: 0
+ - default: 0
+
required:
- compatible
- reg
@@ -71,6 +78,7 @@ examples:
clock-names = "mclk";
dmas = <&dmamux1 75 0x400 0x0d>;
dma-names = "tx";
+ st,stm32-dcmi-min-frequency = <650000>;

port {
dcmi_0: endpoint {
--
2.15.0

2020-07-09 20:38:05

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v7 1/3] dt-bindings: media: stm32-dcmi: Add DCMI min frequency property

On Wed, Jul 01, 2020 at 03:01:27PM +0200, Benjamin Gaignard wrote:
> Document st,stm32-dcmi-min-frequency property which is used to
> request CPUs minimum frequency when streaming frames.
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> ---
> Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml b/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
> index 3fe778cb5cc3..05ca85a2411a 100644
> --- a/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
> +++ b/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
> @@ -44,6 +44,13 @@ properties:
> bindings defined in
> Documentation/devicetree/bindings/media/video-interfaces.txt.
>
> + st,stm32-dcmi-min-frequency:
> + description: DCMI minimum CPUs frequency requirement (in KHz).
> + allOf:
> + - $ref: /schemas/types.yaml#/definitions/uint32
> + - minimum: 0
> + - default: 0

I think this is questionable to be in DT and if it is, it's something
that's hardly specific to ST or this block. IIRC, we already have a way
to specify minimum OPPs.

Rob

2020-07-10 07:34:35

by Benjamin GAIGNARD

[permalink] [raw]
Subject: Re: [PATCH v7 1/3] dt-bindings: media: stm32-dcmi: Add DCMI min frequency property



On 7/9/20 10:37 PM, Rob Herring wrote:
> On Wed, Jul 01, 2020 at 03:01:27PM +0200, Benjamin Gaignard wrote:
>> Document st,stm32-dcmi-min-frequency property which is used to
>> request CPUs minimum frequency when streaming frames.
>>
>> Signed-off-by: Benjamin Gaignard <[email protected]>
>> ---
>> Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml b/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
>> index 3fe778cb5cc3..05ca85a2411a 100644
>> --- a/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
>> +++ b/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
>> @@ -44,6 +44,13 @@ properties:
>> bindings defined in
>> Documentation/devicetree/bindings/media/video-interfaces.txt.
>>
>> + st,stm32-dcmi-min-frequency:
>> + description: DCMI minimum CPUs frequency requirement (in KHz).
>> + allOf:
>> + - $ref: /schemas/types.yaml#/definitions/uint32
>> + - minimum: 0
>> + - default: 0
> I think this is questionable to be in DT and if it is, it's something
> that's hardly specific to ST or this block. IIRC, we already have a way
> to specify minimum OPPs.
This binding is only needed on some STM32 SoC when DVFS is activated
with low frequency setting in opp. The value also depends of the targeted
video format and framerate.

It is not an opp because it doesn't define a voltage-current-frequency
combination
but only set a minimum target for the CPUs frequency to guaranty a good
reaction
time when handling IRQs for the sensor.

Benjamin
>
> Rob

2020-07-10 20:02:27

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v7 1/3] dt-bindings: media: stm32-dcmi: Add DCMI min frequency property

On Fri, Jul 10, 2020 at 1:33 AM Benjamin GAIGNARD
<[email protected]> wrote:
>
>
>
> On 7/9/20 10:37 PM, Rob Herring wrote:
> > On Wed, Jul 01, 2020 at 03:01:27PM +0200, Benjamin Gaignard wrote:
> >> Document st,stm32-dcmi-min-frequency property which is used to
> >> request CPUs minimum frequency when streaming frames.
> >>
> >> Signed-off-by: Benjamin Gaignard <[email protected]>
> >> ---
> >> Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml | 8 ++++++++
> >> 1 file changed, 8 insertions(+)
> >>
> >> diff --git a/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml b/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
> >> index 3fe778cb5cc3..05ca85a2411a 100644
> >> --- a/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
> >> +++ b/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
> >> @@ -44,6 +44,13 @@ properties:
> >> bindings defined in
> >> Documentation/devicetree/bindings/media/video-interfaces.txt.
> >>
> >> + st,stm32-dcmi-min-frequency:
> >> + description: DCMI minimum CPUs frequency requirement (in KHz).
> >> + allOf:
> >> + - $ref: /schemas/types.yaml#/definitions/uint32
> >> + - minimum: 0
> >> + - default: 0
> > I think this is questionable to be in DT and if it is, it's something
> > that's hardly specific to ST or this block. IIRC, we already have a way
> > to specify minimum OPPs.
> This binding is only needed on some STM32 SoC when DVFS is activated
> with low frequency setting in opp. The value also depends of the targeted
> video format and framerate.

As those 2 things are not in the DT, then neither should this value be.

> It is not an opp because it doesn't define a voltage-current-frequency
> combination
> but only set a minimum target for the CPUs frequency to guaranty a good
> reaction
> time when handling IRQs for the sensor.

OPPs can be frequency only. This is pretty clearly defining the CPU
must Operate at a certain minimum Performance Point.

Rob

2020-07-20 09:39:33

by Benjamin GAIGNARD

[permalink] [raw]
Subject: Re: [PATCH v7 1/3] dt-bindings: media: stm32-dcmi: Add DCMI min frequency property



On 7/10/20 10:01 PM, Rob Herring wrote:
> On Fri, Jul 10, 2020 at 1:33 AM Benjamin GAIGNARD
> <[email protected]> wrote:
>>
>>
>> On 7/9/20 10:37 PM, Rob Herring wrote:
>>> On Wed, Jul 01, 2020 at 03:01:27PM +0200, Benjamin Gaignard wrote:
>>>> Document st,stm32-dcmi-min-frequency property which is used to
>>>> request CPUs minimum frequency when streaming frames.
>>>>
>>>> Signed-off-by: Benjamin Gaignard <[email protected]>
>>>> ---
>>>> Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml | 8 ++++++++
>>>> 1 file changed, 8 insertions(+)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml b/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
>>>> index 3fe778cb5cc3..05ca85a2411a 100644
>>>> --- a/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
>>>> +++ b/Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
>>>> @@ -44,6 +44,13 @@ properties:
>>>> bindings defined in
>>>> Documentation/devicetree/bindings/media/video-interfaces.txt.
>>>>
>>>> + st,stm32-dcmi-min-frequency:
>>>> + description: DCMI minimum CPUs frequency requirement (in KHz).
>>>> + allOf:
>>>> + - $ref: /schemas/types.yaml#/definitions/uint32
>>>> + - minimum: 0
>>>> + - default: 0
>>> I think this is questionable to be in DT and if it is, it's something
>>> that's hardly specific to ST or this block. IIRC, we already have a way
>>> to specify minimum OPPs.
>> This binding is only needed on some STM32 SoC when DVFS is activated
>> with low frequency setting in opp. The value also depends of the targeted
>> video format and framerate.
> As those 2 things are not in the DT, then neither should this value be.
>
>> It is not an opp because it doesn't define a voltage-current-frequency
>> combination
>> but only set a minimum target for the CPUs frequency to guaranty a good
>> reaction
>> time when handling IRQs for the sensor.
> OPPs can be frequency only. This is pretty clearly defining the CPU
> must Operate at a certain minimum Performance Point.
Hi Rob,

My goal here wasn't to define an OPP for the CPU since it is the camera
interface node
but to avoid let the CPU go to down.
I haven't found how to use OPP bindings, can you provide me hints or
examples of how
I should do it?

Thanks,
Benjamin

>
> Rob