Re: [PATCH 3/3] decoder: Add V4L2 stateless H.264 decoder driver

From: Zhentao Guo
Date: Sun Nov 09 2025 - 23:05:39 EST


Hi

在 2025/11/9 6:53, Martin Blumenstingl 写道:
[ EXTERNAL EMAIL ]

Hello,

thank you for your work on this!

On Mon, Oct 27, 2025 at 6:42 AM Zhentao Guo via B4 Relay
<devnull+zhentao.guo.amlogic.com@xxxxxxxxxx> wrote:
[...]
+/**
+ * enum aml_power_type_e - Type of decoder power.
+ */
+enum aml_power_type_e {
+ AML_PM_PD = 0,
+};
Are there any other power types that you are already aware of - or is
this added "just in case" an additional type is needed in future?
Currently, this is the only type on S4 platform. The additional type is needed ih the future.
+/**
+ * struct gate_switch_node - clock node definition
+ * @clk: Pointer to clk instance.
+ * @name: Clock name used.
+ * @mutex: Mutex lock for multi decoder instance.
+ * @ref_count: Curr clk instance ref count.
+ */
+struct gate_switch_node {
+ struct clk *clk;
+ const char *name;
+ struct mutex mutex;
+ int ref_count;
+};
Generally I'm not sure if the whole struct is needed as I think the
common clock framework has everything we need.
There's struct clk_bulk_data which allows mapping clocks from
device-tree to an array in the code.

drivers/staging/media/starfive/camss/stf-camss.h for defines an enum
(stf_clk) to access each of the clocks by it's index in the array.
You even seem to have an enum (clk_type_e) which you could use to
simplify the code.

My understanding is that one can call clk_prepare_enable() and
clk_disable_unprepare() as often as you'd like and these functions
will do the ref-counting internally.
So I think the ref_count is not explicitly needed, as that's managed
by the common clock framework.

Thanks for reminding me of this, I'll check it. The field ref_count is desigend for multi-instance decoding. More than one driver instance reuse one decoder hardware. So we think this maybe still needed. Anyway, we will take this into consideration.


Best regards,
Martin

Thanks

Zhentao