* [PATCH 1/6] media: dt-bindings: mediatek,vcodec: Allow single clock for mt8183
2023-06-05 16:20 [PATCH 0/6] Enable decoder for mt8183 Nícolas F. R. A. Prado
@ 2023-06-05 16:20 ` Nícolas F. R. A. Prado
2023-06-06 6:36 ` Matthias Brugger
` (2 more replies)
2023-06-05 16:20 ` [PATCH 2/6] media: dt-bindings: mediatek,vcodec: Don't require assigned-clocks Nícolas F. R. A. Prado
` (3 subsequent siblings)
4 siblings, 3 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2023-06-05 16:20 UTC (permalink / raw)
To: Matthias Brugger, Hans Verkuil
Cc: AngeloGioacchino Del Regno, kernel, Nícolas F. R. A. Prado,
Andrew-CT Chen, Conor Dooley, Krzysztof Kozlowski,
Mauro Carvalho Chehab, Rob Herring, Tiffany Lin, Yunfei Dong,
devicetree, linux-arm-kernel, linux-kernel, linux-media,
linux-mediatek
MT8173 and MT8183 have different clocks, and consequently clock-names.
Relax the number of clocks and set clock-names based on compatible.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
.../media/mediatek,vcodec-decoder.yaml | 29 +++++++++++++------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
index fad59b486d5d..57d5ca776df0 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
@@ -27,18 +27,12 @@ properties:
maxItems: 1
clocks:
+ minItems: 1
maxItems: 8
clock-names:
- items:
- - const: vcodecpll
- - const: univpll_d2
- - const: clk_cci400_sel
- - const: vdec_sel
- - const: vdecpll
- - const: vencpll
- - const: venc_lt_sel
- - const: vdec_bus_clk_src
+ minItems: 1
+ maxItems: 8
assigned-clocks: true
@@ -88,6 +82,11 @@ allOf:
required:
- mediatek,scp
+ properties:
+ clock-names:
+ items:
+ - const: vdec
+
- if:
properties:
compatible:
@@ -99,6 +98,18 @@ allOf:
required:
- mediatek,vpu
+ properties:
+ clock-names:
+ items:
+ - const: vcodecpll
+ - const: univpll_d2
+ - const: clk_cci400_sel
+ - const: vdec_sel
+ - const: vdecpll
+ - const: vencpll
+ - const: venc_lt_sel
+ - const: vdec_bus_clk_src
+
additionalProperties: false
examples:
--
2.40.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 1/6] media: dt-bindings: mediatek,vcodec: Allow single clock for mt8183
2023-06-05 16:20 ` [PATCH 1/6] media: dt-bindings: mediatek,vcodec: Allow single clock " Nícolas F. R. A. Prado
@ 2023-06-06 6:36 ` Matthias Brugger
2023-06-06 7:28 ` AngeloGioacchino Del Regno
2023-06-06 9:12 ` Krzysztof Kozlowski
2 siblings, 0 replies; 17+ messages in thread
From: Matthias Brugger @ 2023-06-06 6:36 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Hans Verkuil
Cc: AngeloGioacchino Del Regno, kernel, Andrew-CT Chen, Conor Dooley,
Krzysztof Kozlowski, Mauro Carvalho Chehab, Rob Herring,
Tiffany Lin, Yunfei Dong, devicetree, linux-arm-kernel,
linux-kernel, linux-media, linux-mediatek
On 05/06/2023 18:20, Nícolas F. R. A. Prado wrote:
> MT8173 and MT8183 have different clocks, and consequently clock-names.
> Relax the number of clocks and set clock-names based on compatible.
>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
>
> ---
>
> .../media/mediatek,vcodec-decoder.yaml | 29 +++++++++++++------
> 1 file changed, 20 insertions(+), 9 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> index fad59b486d5d..57d5ca776df0 100644
> --- a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> +++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> @@ -27,18 +27,12 @@ properties:
> maxItems: 1
>
> clocks:
> + minItems: 1
> maxItems: 8
>
> clock-names:
> - items:
> - - const: vcodecpll
> - - const: univpll_d2
> - - const: clk_cci400_sel
> - - const: vdec_sel
> - - const: vdecpll
> - - const: vencpll
> - - const: venc_lt_sel
> - - const: vdec_bus_clk_src
> + minItems: 1
> + maxItems: 8
>
> assigned-clocks: true
>
> @@ -88,6 +82,11 @@ allOf:
> required:
> - mediatek,scp
>
> + properties:
> + clock-names:
> + items:
> + - const: vdec
> +
> - if:
> properties:
> compatible:
> @@ -99,6 +98,18 @@ allOf:
> required:
> - mediatek,vpu
>
> + properties:
> + clock-names:
> + items:
> + - const: vcodecpll
> + - const: univpll_d2
> + - const: clk_cci400_sel
> + - const: vdec_sel
> + - const: vdecpll
> + - const: vencpll
> + - const: venc_lt_sel
> + - const: vdec_bus_clk_src
> +
> additionalProperties: false
>
> examples:
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/6] media: dt-bindings: mediatek,vcodec: Allow single clock for mt8183
2023-06-05 16:20 ` [PATCH 1/6] media: dt-bindings: mediatek,vcodec: Allow single clock " Nícolas F. R. A. Prado
2023-06-06 6:36 ` Matthias Brugger
@ 2023-06-06 7:28 ` AngeloGioacchino Del Regno
2023-06-06 9:12 ` Krzysztof Kozlowski
2 siblings, 0 replies; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-06-06 7:28 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Matthias Brugger, Hans Verkuil
Cc: kernel, Andrew-CT Chen, Conor Dooley, Krzysztof Kozlowski,
Mauro Carvalho Chehab, Rob Herring, Tiffany Lin, Yunfei Dong,
devicetree, linux-arm-kernel, linux-kernel, linux-media,
linux-mediatek
Il 05/06/23 18:20, Nícolas F. R. A. Prado ha scritto:
> MT8173 and MT8183 have different clocks, and consequently clock-names.
> Relax the number of clocks and set clock-names based on compatible.
>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/6] media: dt-bindings: mediatek,vcodec: Allow single clock for mt8183
2023-06-05 16:20 ` [PATCH 1/6] media: dt-bindings: mediatek,vcodec: Allow single clock " Nícolas F. R. A. Prado
2023-06-06 6:36 ` Matthias Brugger
2023-06-06 7:28 ` AngeloGioacchino Del Regno
@ 2023-06-06 9:12 ` Krzysztof Kozlowski
2 siblings, 0 replies; 17+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-06 9:12 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Matthias Brugger, Hans Verkuil
Cc: AngeloGioacchino Del Regno, kernel, Andrew-CT Chen, Conor Dooley,
Krzysztof Kozlowski, Mauro Carvalho Chehab, Rob Herring,
Tiffany Lin, Yunfei Dong, devicetree, linux-arm-kernel,
linux-kernel, linux-media, linux-mediatek
On 05/06/2023 18:20, Nícolas F. R. A. Prado wrote:
> MT8173 and MT8183 have different clocks, and consequently clock-names.
> Relax the number of clocks and set clock-names based on compatible.
>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
>
> ---
>
> .../media/mediatek,vcodec-decoder.yaml | 29 +++++++++++++------
> 1 file changed, 20 insertions(+), 9 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> index fad59b486d5d..57d5ca776df0 100644
> --- a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> +++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> @@ -27,18 +27,12 @@ properties:
> maxItems: 1
>
> clocks:
> + minItems: 1
> maxItems: 8
>
> clock-names:
> - items:
> - - const: vcodecpll
> - - const: univpll_d2
> - - const: clk_cci400_sel
> - - const: vdec_sel
> - - const: vdecpll
> - - const: vencpll
> - - const: venc_lt_sel
> - - const: vdec_bus_clk_src
> + minItems: 1
> + maxItems: 8
>
> assigned-clocks: true
>
> @@ -88,6 +82,11 @@ allOf:
> required:
> - mediatek,scp
>
> + properties:
> + clock-names:
> + items:
> + - const: vdec
You should constrain also clocks as they must be in sync with names.
> +
> - if:
> properties:
> compatible:
> @@ -99,6 +98,18 @@ allOf:
> required:
> - mediatek,vpu
>
> + properties:
> + clock-names:
> + items:
> + - const: vcodecpll
> + - const: univpll_d2
> + - const: clk_cci400_sel
> + - const: vdec_sel
> + - const: vdecpll
> + - const: vencpll
> + - const: venc_lt_sel
> + - const: vdec_bus_clk_src
Ditto.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 2/6] media: dt-bindings: mediatek,vcodec: Don't require assigned-clocks
2023-06-05 16:20 [PATCH 0/6] Enable decoder for mt8183 Nícolas F. R. A. Prado
2023-06-05 16:20 ` [PATCH 1/6] media: dt-bindings: mediatek,vcodec: Allow single clock " Nícolas F. R. A. Prado
@ 2023-06-05 16:20 ` Nícolas F. R. A. Prado
2023-06-06 6:36 ` Matthias Brugger
` (2 more replies)
2023-06-05 16:20 ` [PATCH 3/6] media: dt-bindings: mediatek,vcodec: Remove VDEC_SYS for mt8183 Nícolas F. R. A. Prado
` (2 subsequent siblings)
4 siblings, 3 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2023-06-05 16:20 UTC (permalink / raw)
To: Matthias Brugger, Hans Verkuil
Cc: AngeloGioacchino Del Regno, kernel, Nícolas F. R. A. Prado,
Andrew-CT Chen, Conor Dooley, Krzysztof Kozlowski,
Mauro Carvalho Chehab, Rob Herring, Tiffany Lin, Yunfei Dong,
devicetree, linux-arm-kernel, linux-kernel, linux-media,
linux-mediatek
On MT8183 it's not necessary to configure the parent for the clocks.
Remove the assigned-clocks and assigned-clock-parents from the required
list.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
.../devicetree/bindings/media/mediatek,vcodec-decoder.yaml | 2 --
1 file changed, 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
index 57d5ca776df0..6447e6c86f29 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
@@ -67,8 +67,6 @@ required:
- clocks
- clock-names
- iommus
- - assigned-clocks
- - assigned-clock-parents
allOf:
- if:
--
2.40.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 2/6] media: dt-bindings: mediatek,vcodec: Don't require assigned-clocks
2023-06-05 16:20 ` [PATCH 2/6] media: dt-bindings: mediatek,vcodec: Don't require assigned-clocks Nícolas F. R. A. Prado
@ 2023-06-06 6:36 ` Matthias Brugger
2023-06-06 7:28 ` AngeloGioacchino Del Regno
2023-06-06 9:12 ` Krzysztof Kozlowski
2 siblings, 0 replies; 17+ messages in thread
From: Matthias Brugger @ 2023-06-06 6:36 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Hans Verkuil
Cc: AngeloGioacchino Del Regno, kernel, Andrew-CT Chen, Conor Dooley,
Krzysztof Kozlowski, Mauro Carvalho Chehab, Rob Herring,
Tiffany Lin, Yunfei Dong, devicetree, linux-arm-kernel,
linux-kernel, linux-media, linux-mediatek
On 05/06/2023 18:20, Nícolas F. R. A. Prado wrote:
> On MT8183 it's not necessary to configure the parent for the clocks.
> Remove the assigned-clocks and assigned-clock-parents from the required
> list.
>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
> ---
>
> .../devicetree/bindings/media/mediatek,vcodec-decoder.yaml | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> index 57d5ca776df0..6447e6c86f29 100644
> --- a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> +++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> @@ -67,8 +67,6 @@ required:
> - clocks
> - clock-names
> - iommus
> - - assigned-clocks
> - - assigned-clock-parents
>
> allOf:
> - if:
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 2/6] media: dt-bindings: mediatek,vcodec: Don't require assigned-clocks
2023-06-05 16:20 ` [PATCH 2/6] media: dt-bindings: mediatek,vcodec: Don't require assigned-clocks Nícolas F. R. A. Prado
2023-06-06 6:36 ` Matthias Brugger
@ 2023-06-06 7:28 ` AngeloGioacchino Del Regno
2023-06-06 9:12 ` Krzysztof Kozlowski
2 siblings, 0 replies; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-06-06 7:28 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Matthias Brugger, Hans Verkuil
Cc: kernel, Andrew-CT Chen, Conor Dooley, Krzysztof Kozlowski,
Mauro Carvalho Chehab, Rob Herring, Tiffany Lin, Yunfei Dong,
devicetree, linux-arm-kernel, linux-kernel, linux-media,
linux-mediatek
Il 05/06/23 18:20, Nícolas F. R. A. Prado ha scritto:
> On MT8183 it's not necessary to configure the parent for the clocks.
> Remove the assigned-clocks and assigned-clock-parents from the required
> list.
>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
It should not be mandatory to configure clock parents manually on any model
anyway...
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 2/6] media: dt-bindings: mediatek,vcodec: Don't require assigned-clocks
2023-06-05 16:20 ` [PATCH 2/6] media: dt-bindings: mediatek,vcodec: Don't require assigned-clocks Nícolas F. R. A. Prado
2023-06-06 6:36 ` Matthias Brugger
2023-06-06 7:28 ` AngeloGioacchino Del Regno
@ 2023-06-06 9:12 ` Krzysztof Kozlowski
2 siblings, 0 replies; 17+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-06 9:12 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Matthias Brugger, Hans Verkuil
Cc: AngeloGioacchino Del Regno, kernel, Andrew-CT Chen, Conor Dooley,
Krzysztof Kozlowski, Mauro Carvalho Chehab, Rob Herring,
Tiffany Lin, Yunfei Dong, devicetree, linux-arm-kernel,
linux-kernel, linux-media, linux-mediatek
On 05/06/2023 18:20, Nícolas F. R. A. Prado wrote:
> On MT8183 it's not necessary to configure the parent for the clocks.
> Remove the assigned-clocks and assigned-clock-parents from the required
> list.
>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> ---
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 3/6] media: dt-bindings: mediatek,vcodec: Remove VDEC_SYS for mt8183
2023-06-05 16:20 [PATCH 0/6] Enable decoder for mt8183 Nícolas F. R. A. Prado
2023-06-05 16:20 ` [PATCH 1/6] media: dt-bindings: mediatek,vcodec: Allow single clock " Nícolas F. R. A. Prado
2023-06-05 16:20 ` [PATCH 2/6] media: dt-bindings: mediatek,vcodec: Don't require assigned-clocks Nícolas F. R. A. Prado
@ 2023-06-05 16:20 ` Nícolas F. R. A. Prado
2023-06-06 7:30 ` AngeloGioacchino Del Regno
2023-06-06 9:16 ` Krzysztof Kozlowski
2023-06-05 16:20 ` [PATCH 5/6] clk: mediatek: mt8183: Add CLK_VDEC_ACTIVE to vdec Nícolas F. R. A. Prado
2023-06-05 16:20 ` [PATCH 6/6] arm64: dts: mediatek: mt8183: Add decoder Nícolas F. R. A. Prado
4 siblings, 2 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2023-06-05 16:20 UTC (permalink / raw)
To: Matthias Brugger, Hans Verkuil
Cc: AngeloGioacchino Del Regno, kernel, Nícolas F. R. A. Prado,
Andrew-CT Chen, Conor Dooley, Krzysztof Kozlowski,
Mauro Carvalho Chehab, Rob Herring, Tiffany Lin, Yunfei Dong,
devicetree, linux-arm-kernel, linux-kernel, linux-media,
linux-mediatek
The binding expects the first register space to be VDEC_SYS. But on
mt8183, which uses the stateless decoders, this space is used only for
controlling clocks and resets, which are better described as separate
clock-controller and reset-controller nodes.
In fact, in mt8173's devicetree there are already such separate
clock-controller nodes, which cause duplicate addresses between the
vdecsys node and the vcodec node. But for this SoC, since the stateful
decoder code makes other uses of the VDEC_SYS register space, it's not
straightforward to remove it.
In order to avoid the same address conflict to happen on mt8183,
since the only current use of the VDEC_SYS register space in
the driver is to read the status of a clock that indicates the hardware
is active, remove the VDEC_SYS register space from the binding and
describe an extra clock that will be used to directly check the hardware
status.
Also add reg-names to be able to tell that this new register schema is
used, so the driver can keep backward compatibility.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
.../media/mediatek,vcodec-decoder.yaml | 29 +++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
index 6447e6c86f29..36a53b2484d6 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
@@ -21,17 +21,21 @@ properties:
- mediatek,mt8183-vcodec-dec
reg:
+ minItems: 11
maxItems: 12
+ reg-names:
+ minItems: 11
+
interrupts:
maxItems: 1
clocks:
- minItems: 1
+ minItems: 2
maxItems: 8
clock-names:
- minItems: 1
+ minItems: 2
maxItems: 8
assigned-clocks: true
@@ -84,6 +88,24 @@ allOf:
clock-names:
items:
- const: vdec
+ - const: active
+
+ reg:
+ maxItems: 11
+
+ reg-names:
+ items:
+ - const: misc
+ - const: ld
+ - const: top
+ - const: cm
+ - const: ad
+ - const: av
+ - const: pp
+ - const: hwd
+ - const: hwq
+ - const: hwb
+ - const: hwg
- if:
properties:
@@ -108,6 +130,9 @@ allOf:
- const: venc_lt_sel
- const: vdec_bus_clk_src
+ reg:
+ minItems: 12
+
additionalProperties: false
examples:
--
2.40.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 3/6] media: dt-bindings: mediatek,vcodec: Remove VDEC_SYS for mt8183
2023-06-05 16:20 ` [PATCH 3/6] media: dt-bindings: mediatek,vcodec: Remove VDEC_SYS for mt8183 Nícolas F. R. A. Prado
@ 2023-06-06 7:30 ` AngeloGioacchino Del Regno
2023-06-06 9:16 ` Krzysztof Kozlowski
1 sibling, 0 replies; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-06-06 7:30 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Matthias Brugger, Hans Verkuil
Cc: kernel, Andrew-CT Chen, Conor Dooley, Krzysztof Kozlowski,
Mauro Carvalho Chehab, Rob Herring, Tiffany Lin, Yunfei Dong,
devicetree, linux-arm-kernel, linux-kernel, linux-media,
linux-mediatek
Il 05/06/23 18:20, Nícolas F. R. A. Prado ha scritto:
> The binding expects the first register space to be VDEC_SYS. But on
> mt8183, which uses the stateless decoders, this space is used only for
> controlling clocks and resets, which are better described as separate
> clock-controller and reset-controller nodes.
>
> In fact, in mt8173's devicetree there are already such separate
> clock-controller nodes, which cause duplicate addresses between the
> vdecsys node and the vcodec node. But for this SoC, since the stateful
> decoder code makes other uses of the VDEC_SYS register space, it's not
> straightforward to remove it.
>
> In order to avoid the same address conflict to happen on mt8183,
> since the only current use of the VDEC_SYS register space in
> the driver is to read the status of a clock that indicates the hardware
> is active, remove the VDEC_SYS register space from the binding and
> describe an extra clock that will be used to directly check the hardware
> status.
>
> Also add reg-names to be able to tell that this new register schema is
> used, so the driver can keep backward compatibility.
>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 3/6] media: dt-bindings: mediatek,vcodec: Remove VDEC_SYS for mt8183
2023-06-05 16:20 ` [PATCH 3/6] media: dt-bindings: mediatek,vcodec: Remove VDEC_SYS for mt8183 Nícolas F. R. A. Prado
2023-06-06 7:30 ` AngeloGioacchino Del Regno
@ 2023-06-06 9:16 ` Krzysztof Kozlowski
2023-06-07 19:58 ` Nícolas F. R. A. Prado
1 sibling, 1 reply; 17+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-06 9:16 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Matthias Brugger, Hans Verkuil
Cc: AngeloGioacchino Del Regno, kernel, Andrew-CT Chen, Conor Dooley,
Krzysztof Kozlowski, Mauro Carvalho Chehab, Rob Herring,
Tiffany Lin, Yunfei Dong, devicetree, linux-arm-kernel,
linux-kernel, linux-media, linux-mediatek
On 05/06/2023 18:20, Nícolas F. R. A. Prado wrote:
> The binding expects the first register space to be VDEC_SYS. But on
> mt8183, which uses the stateless decoders, this space is used only for
> controlling clocks and resets, which are better described as separate
> clock-controller and reset-controller nodes.
>
> In fact, in mt8173's devicetree there are already such separate
> clock-controller nodes, which cause duplicate addresses between the
> vdecsys node and the vcodec node. But for this SoC, since the stateful
> decoder code makes other uses of the VDEC_SYS register space, it's not
> straightforward to remove it.
>
> In order to avoid the same address conflict to happen on mt8183,
> since the only current use of the VDEC_SYS register space in
> the driver is to read the status of a clock that indicates the hardware
> is active, remove the VDEC_SYS register space from the binding and
> describe an extra clock that will be used to directly check the hardware
> status.
>
> Also add reg-names to be able to tell that this new register schema is
> used, so the driver can keep backward compatibility.
>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> ---
>
> .../media/mediatek,vcodec-decoder.yaml | 29 +++++++++++++++++--
> 1 file changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> index 6447e6c86f29..36a53b2484d6 100644
> --- a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> +++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> @@ -21,17 +21,21 @@ properties:
> - mediatek,mt8183-vcodec-dec
>
> reg:
> + minItems: 11
> maxItems: 12
>
> + reg-names:
> + minItems: 11
maxItems
> +
> interrupts:
> maxItems: 1
>
> clocks:
> - minItems: 1
> + minItems: 2
It does not make any sense. Just two patches ago you made it 1! Don't
add incorrect values which are immediately changed in the same patchset.
> maxItems: 8
>
> clock-names:
> - minItems: 1
> + minItems: 2
> maxItems: 8
>
> assigned-clocks: true
> @@ -84,6 +88,24 @@ allOf:
> clock-names:
> items:
> - const: vdec
> + - const: active
> +
> + reg:
> + maxItems: 11
> +
> + reg-names:
> + items:
> + - const: misc
> + - const: ld
> + - const: top
> + - const: cm
> + - const: ad
> + - const: av
> + - const: pp
> + - const: hwd
> + - const: hwq
> + - const: hwb
> + - const: hwg
>
> - if:
> properties:
> @@ -108,6 +130,9 @@ allOf:
> - const: venc_lt_sel
> - const: vdec_bus_clk_src
>
> + reg:
> + minItems: 12
so max can be 1000?
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 3/6] media: dt-bindings: mediatek,vcodec: Remove VDEC_SYS for mt8183
2023-06-06 9:16 ` Krzysztof Kozlowski
@ 2023-06-07 19:58 ` Nícolas F. R. A. Prado
0 siblings, 0 replies; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2023-06-07 19:58 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Matthias Brugger, Hans Verkuil, AngeloGioacchino Del Regno,
kernel, Andrew-CT Chen, Conor Dooley, Krzysztof Kozlowski,
Mauro Carvalho Chehab, Rob Herring, Tiffany Lin, Yunfei Dong,
devicetree, linux-arm-kernel, linux-kernel, linux-media,
linux-mediatek
On Tue, Jun 06, 2023 at 11:16:12AM +0200, Krzysztof Kozlowski wrote:
> On 05/06/2023 18:20, Nícolas F. R. A. Prado wrote:
> > The binding expects the first register space to be VDEC_SYS. But on
> > mt8183, which uses the stateless decoders, this space is used only for
> > controlling clocks and resets, which are better described as separate
> > clock-controller and reset-controller nodes.
> >
> > In fact, in mt8173's devicetree there are already such separate
> > clock-controller nodes, which cause duplicate addresses between the
> > vdecsys node and the vcodec node. But for this SoC, since the stateful
> > decoder code makes other uses of the VDEC_SYS register space, it's not
> > straightforward to remove it.
> >
> > In order to avoid the same address conflict to happen on mt8183,
> > since the only current use of the VDEC_SYS register space in
> > the driver is to read the status of a clock that indicates the hardware
> > is active, remove the VDEC_SYS register space from the binding and
> > describe an extra clock that will be used to directly check the hardware
> > status.
> >
> > Also add reg-names to be able to tell that this new register schema is
> > used, so the driver can keep backward compatibility.
> >
> > Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> > ---
> >
> > .../media/mediatek,vcodec-decoder.yaml | 29 +++++++++++++++++--
> > 1 file changed, 27 insertions(+), 2 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> > index 6447e6c86f29..36a53b2484d6 100644
> > --- a/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> > +++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-decoder.yaml
> > @@ -21,17 +21,21 @@ properties:
> > - mediatek,mt8183-vcodec-dec
> >
> > reg:
> > + minItems: 11
> > maxItems: 12
> >
> > + reg-names:
> > + minItems: 11
>
> maxItems
>
> > +
> > interrupts:
> > maxItems: 1
> >
> > clocks:
> > - minItems: 1
> > + minItems: 2
>
> It does not make any sense. Just two patches ago you made it 1! Don't
> add incorrect values which are immediately changed in the same patchset.
It's not an incorrect value. At the point that commit was added, the first reg
was still VDEC_SYS, so an active clock wasn't required. This commit removes the
VDEC_SYS reg, and so the active clock becomes necessary. Splitting it like this
made the most sense to me, and I thought it would also simplify review. But
since it seems to be a problem I'll merge commit 1 with this one in v2 to avoid
changing the number of clocks twice.
>
> > maxItems: 8
> >
> > clock-names:
> > - minItems: 1
> > + minItems: 2
> > maxItems: 8
> >
> > assigned-clocks: true
> > @@ -84,6 +88,24 @@ allOf:
> > clock-names:
> > items:
> > - const: vdec
> > + - const: active
> > +
> > + reg:
> > + maxItems: 11
> > +
> > + reg-names:
> > + items:
> > + - const: misc
> > + - const: ld
> > + - const: top
> > + - const: cm
> > + - const: ad
> > + - const: av
> > + - const: pp
> > + - const: hwd
> > + - const: hwq
> > + - const: hwb
> > + - const: hwg
> >
> > - if:
> > properties:
> > @@ -108,6 +130,9 @@ allOf:
> > - const: venc_lt_sel
> > - const: vdec_bus_clk_src
> >
> > + reg:
> > + minItems: 12
>
> so max can be 1000?
No, there's 'maxItems: 12' up above in the general case.
Thanks,
Nícolas
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 5/6] clk: mediatek: mt8183: Add CLK_VDEC_ACTIVE to vdec
2023-06-05 16:20 [PATCH 0/6] Enable decoder for mt8183 Nícolas F. R. A. Prado
` (2 preceding siblings ...)
2023-06-05 16:20 ` [PATCH 3/6] media: dt-bindings: mediatek,vcodec: Remove VDEC_SYS for mt8183 Nícolas F. R. A. Prado
@ 2023-06-05 16:20 ` Nícolas F. R. A. Prado
2023-06-06 7:39 ` AngeloGioacchino Del Regno
2023-06-05 16:20 ` [PATCH 6/6] arm64: dts: mediatek: mt8183: Add decoder Nícolas F. R. A. Prado
4 siblings, 1 reply; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2023-06-05 16:20 UTC (permalink / raw)
To: Matthias Brugger, Hans Verkuil
Cc: AngeloGioacchino Del Regno, kernel, Nícolas F. R. A. Prado,
Chen-Yu Tsai, Conor Dooley, Krzysztof Kozlowski,
Michael Turquette, Miles Chen, Rob Herring, Stephen Boyd,
devicetree, linux-arm-kernel, linux-clk, linux-kernel,
linux-mediatek
Add the CLK_VDEC_ACTIVE clock to the vdec clock driver. This clock is
enabled by the VPU once it starts decoding.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
drivers/clk/mediatek/clk-mt8183-vdec.c | 5 +++++
include/dt-bindings/clock/mt8183-clk.h | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/mediatek/clk-mt8183-vdec.c b/drivers/clk/mediatek/clk-mt8183-vdec.c
index 513b7956cbea..5830934a6d25 100644
--- a/drivers/clk/mediatek/clk-mt8183-vdec.c
+++ b/drivers/clk/mediatek/clk-mt8183-vdec.c
@@ -27,6 +27,10 @@ static const struct mtk_gate_regs vdec1_cg_regs = {
GATE_MTK(_id, _name, _parent, &vdec0_cg_regs, _shift, \
&mtk_clk_gate_ops_setclr_inv)
+#define GATE_VDEC0(_id, _name, _parent, _shift) \
+ GATE_MTK(_id, _name, _parent, &vdec0_cg_regs, _shift, \
+ &mtk_clk_gate_ops_setclr)
+
#define GATE_VDEC1_I(_id, _name, _parent, _shift) \
GATE_MTK(_id, _name, _parent, &vdec1_cg_regs, _shift, \
&mtk_clk_gate_ops_setclr_inv)
@@ -34,6 +38,7 @@ static const struct mtk_gate_regs vdec1_cg_regs = {
static const struct mtk_gate vdec_clks[] = {
/* VDEC0 */
GATE_VDEC0_I(CLK_VDEC_VDEC, "vdec_vdec", "mm_sel", 0),
+ GATE_VDEC0(CLK_VDEC_ACTIVE, "vdec_active", "mm_sel", 4),
/* VDEC1 */
GATE_VDEC1_I(CLK_VDEC_LARB1, "vdec_larb1", "mm_sel", 0),
};
diff --git a/include/dt-bindings/clock/mt8183-clk.h b/include/dt-bindings/clock/mt8183-clk.h
index a7b470b0ec8a..32dd7d91dbe2 100644
--- a/include/dt-bindings/clock/mt8183-clk.h
+++ b/include/dt-bindings/clock/mt8183-clk.h
@@ -357,7 +357,8 @@
/* VDEC_GCON */
#define CLK_VDEC_VDEC 0
#define CLK_VDEC_LARB1 1
-#define CLK_VDEC_NR_CLK 2
+#define CLK_VDEC_ACTIVE 2
+#define CLK_VDEC_NR_CLK 3
/* VENC_GCON */
#define CLK_VENC_LARB 0
--
2.40.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 5/6] clk: mediatek: mt8183: Add CLK_VDEC_ACTIVE to vdec
2023-06-05 16:20 ` [PATCH 5/6] clk: mediatek: mt8183: Add CLK_VDEC_ACTIVE to vdec Nícolas F. R. A. Prado
@ 2023-06-06 7:39 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-06-06 7:39 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Matthias Brugger, Hans Verkuil
Cc: kernel, Chen-Yu Tsai, Conor Dooley, Krzysztof Kozlowski,
Michael Turquette, Miles Chen, Rob Herring, Stephen Boyd,
devicetree, linux-arm-kernel, linux-clk, linux-kernel,
linux-mediatek
Il 05/06/23 18:20, Nícolas F. R. A. Prado ha scritto:
> Add the CLK_VDEC_ACTIVE clock to the vdec clock driver. This clock is
> enabled by the VPU once it starts decoding.
>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Since this is hw managed, it's a good idea to add CLK_IGNORE_UNUSED to this
clock's flags to avoid potential lockups at boot. Please add that flag.
Cheers,
Angelo
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 6/6] arm64: dts: mediatek: mt8183: Add decoder
2023-06-05 16:20 [PATCH 0/6] Enable decoder for mt8183 Nícolas F. R. A. Prado
` (3 preceding siblings ...)
2023-06-05 16:20 ` [PATCH 5/6] clk: mediatek: mt8183: Add CLK_VDEC_ACTIVE to vdec Nícolas F. R. A. Prado
@ 2023-06-05 16:20 ` Nícolas F. R. A. Prado
2023-06-06 7:40 ` AngeloGioacchino Del Regno
4 siblings, 1 reply; 17+ messages in thread
From: Nícolas F. R. A. Prado @ 2023-06-05 16:20 UTC (permalink / raw)
To: Matthias Brugger, Hans Verkuil
Cc: AngeloGioacchino Del Regno, kernel, Yunfei Dong,
Nícolas F . R . A . Prado, Conor Dooley, Krzysztof Kozlowski,
Rob Herring, devicetree, linux-arm-kernel, linux-kernel,
linux-mediatek
From: Yunfei Dong <yunfei.dong@mediatek.com>
Add node for the hardware decoder present on the MT8183 SoC.
Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Signed-off-by: Qianqian Yan <qianqian.yan@mediatek.com>
Signed-off-by: Frederic Chen <frederic.chen@mediatek.com>
Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
arch/arm64/boot/dts/mediatek/mt8183.dtsi | 39 ++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
index 5169779d01df..8bb10ed67e87 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
@@ -2019,6 +2019,45 @@ vdecsys: syscon@16000000 {
#clock-cells = <1>;
};
+ vcodec_dec: video-codec@16020000 {
+ compatible = "mediatek,mt8183-vcodec-dec";
+ reg = <0 0x16020000 0 0x1000>, /* VDEC_MISC */
+ <0 0x16021000 0 0x800>, /* VDEC_VLD */
+ <0 0x16021800 0 0x800>, /* VDEC_TOP */
+ <0 0x16022000 0 0x1000>, /* VDEC_MC */
+ <0 0x16023000 0 0x1000>, /* VDEC_AVCVLD */
+ <0 0x16024000 0 0x1000>, /* VDEC_AVCMV */
+ <0 0x16025000 0 0x1000>, /* VDEC_PP */
+ <0 0x16026800 0 0x800>, /* VP8_VD */
+ <0 0x16027000 0 0x800>, /* VP6_VD */
+ <0 0x16027800 0 0x800>, /* VP8_VL */
+ <0 0x16028400 0 0x400>; /* VP9_VD */
+ reg-names = "misc",
+ "ld",
+ "top",
+ "cm",
+ "ad",
+ "av",
+ "pp",
+ "hwd",
+ "hwq",
+ "hwb",
+ "hwg";
+ interrupts = <GIC_SPI 250 IRQ_TYPE_LEVEL_LOW>;
+ iommus = <&iommu M4U_PORT_HW_VDEC_MC_EXT>,
+ <&iommu M4U_PORT_HW_VDEC_PP_EXT>,
+ <&iommu M4U_PORT_HW_VDEC_VLD_EXT>,
+ <&iommu M4U_PORT_HW_VDEC_AVC_MV_EXT>,
+ <&iommu M4U_PORT_HW_VDEC_PRED_RD_EXT>,
+ <&iommu M4U_PORT_HW_VDEC_PRED_WR_EXT>,
+ <&iommu M4U_PORT_HW_VDEC_PPWRAP_EXT>;
+ mediatek,scp = <&scp>;
+ power-domains = <&spm MT8183_POWER_DOMAIN_VDEC>;
+ clocks = <&vdecsys CLK_VDEC_VDEC>,
+ <&vdecsys CLK_VDEC_ACTIVE>;
+ clock-names = "vdec", "active";
+ };
+
larb1: larb@16010000 {
compatible = "mediatek,mt8183-smi-larb";
reg = <0 0x16010000 0 0x1000>;
--
2.40.1
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH 6/6] arm64: dts: mediatek: mt8183: Add decoder
2023-06-05 16:20 ` [PATCH 6/6] arm64: dts: mediatek: mt8183: Add decoder Nícolas F. R. A. Prado
@ 2023-06-06 7:40 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 17+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-06-06 7:40 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Matthias Brugger, Hans Verkuil
Cc: kernel, Yunfei Dong, Conor Dooley, Krzysztof Kozlowski,
Rob Herring, devicetree, linux-arm-kernel, linux-kernel,
linux-mediatek
Il 05/06/23 18:20, Nícolas F. R. A. Prado ha scritto:
> From: Yunfei Dong <yunfei.dong@mediatek.com>
>
> Add node for the hardware decoder present on the MT8183 SoC.
>
> Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
> Signed-off-by: Qianqian Yan <qianqian.yan@mediatek.com>
> Signed-off-by: Frederic Chen <frederic.chen@mediatek.com>
> Signed-off-by: Alexandre Courbot <acourbot@chromium.org>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> ---
>
> arch/arm64/boot/dts/mediatek/mt8183.dtsi | 39 ++++++++++++++++++++++++
> 1 file changed, 39 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
> index 5169779d01df..8bb10ed67e87 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
> @@ -2019,6 +2019,45 @@ vdecsys: syscon@16000000 {
> #clock-cells = <1>;
> };
>
> + vcodec_dec: video-codec@16020000 {
> + compatible = "mediatek,mt8183-vcodec-dec";
> + reg = <0 0x16020000 0 0x1000>, /* VDEC_MISC */
> + <0 0x16021000 0 0x800>, /* VDEC_VLD */
> + <0 0x16021800 0 0x800>, /* VDEC_TOP */
> + <0 0x16022000 0 0x1000>, /* VDEC_MC */
> + <0 0x16023000 0 0x1000>, /* VDEC_AVCVLD */
> + <0 0x16024000 0 0x1000>, /* VDEC_AVCMV */
> + <0 0x16025000 0 0x1000>, /* VDEC_PP */
> + <0 0x16026800 0 0x800>, /* VP8_VD */
> + <0 0x16027000 0 0x800>, /* VP6_VD */
> + <0 0x16027800 0 0x800>, /* VP8_VL */
> + <0 0x16028400 0 0x400>; /* VP9_VD */
> + reg-names = "misc",
> + "ld",
> + "top",
> + "cm",
> + "ad",
> + "av",
> + "pp",
> + "hwd",
> + "hwq",
> + "hwb",
> + "hwg";
Do we really need one line for each 2/3 characters reg name? :-P
Regards,
Angelo
^ permalink raw reply [flat|nested] 17+ messages in thread