* [PATCH v5 0/3] media: venus: Provide support for selecting encoder/decoder from in-driver
@ 2024-12-09 11:52 Bryan O'Donoghue
2024-12-09 11:52 ` [PATCH v5 1/3] media: venus: Add support for static video encoder/decoder declarations Bryan O'Donoghue
` (3 more replies)
0 siblings, 4 replies; 16+ messages in thread
From: Bryan O'Donoghue @ 2024-12-09 11:52 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Mauro Carvalho Chehab,
Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: quic_renjiang, quic_vnagar, quic_dikshita, konradybcio,
linux-media, linux-arm-msm, linux-kernel, devicetree,
Stanimir Varbanov, Bryan O'Donoghue, Krzysztof Kozlowski
v5:
- Fixes venus_remove_dynamic_nodes() on probe err path - Dikshita
- Link to v4: https://lore.kernel.org/r/20241128-media-staging-24-11-25-rb3-hw-compat-string-v4-0-fd062b399374@linaro.org
v4:
- Adds some unavoidable conditional CONFIG_OF_DYNAMIC to fix media-ci testcase # Test build:OF x86_64
- Added logic for of_changeset_revert() and of_changeset_destroy() on
error/remove paths - Bryan
- Link to v3: https://lore.kernel.org/r/20241127-media-staging-24-11-25-rb3-hw-compat-string-v3-0-ef6bd25e98db@linaro.org
v3:
- Adds select OF_DYNAMIC to venus/Kconfig to ensure of_changeset_*() is
available. Instead of ifdefing and have the fix not work without
OF_DYNAMIC, select OF_DYANMIC with venus - linux-media-ci
- Link to v2: https://lore.kernel.org/r/20241127-media-staging-24-11-25-rb3-hw-compat-string-v2-0-c010fd45f7ff@linaro.org
v2:
- Removes useless dev_info() leftover from debugging - Bryan
Link: https://lore.kernel.org/r/ce9ac473-2f73-4c7a-97b1-08be39f3adb4@linaro.org
- Trivial newline change @ np = of_changeset_create_node(ocs, dev->of_node, node_name); - Bryan
- Fixes a missing goto identified by smatch - Smatch/Bryan
- Adds Krzysztof's RB to deprecated - Krzysztof
- Link to v1: https://lore.kernel.org/r/20241127-media-staging-24-11-25-rb3-hw-compat-string-v1-0-99c16f266b46@linaro.org
v1:
Various venus patches have been held up due to the misuse of DT to provide
a configuration input to venus as to which mode a given transcoder should
be in.
Link: https://lore.kernel.org/linux-arm-msm/436145fd-d65f-44ec-b950-c434775187ca@kernel.org
Link: https://lore.kernel.org/linux-media/ba40de82-b308-67b1-5751-bb2d95f2b8a5@linaro.org/
This series provides support for static configuration of venus from the resource
structure via:
1. Adding two strings to the resource structure.
One string for the decoder one for the encoder.
2. The string for each SoC has been matched to the existing in the
DT which currently specifies the mode as decoder or encoder.
3. New logic in the driver parses the DTB looking for the node name
specified for the decoder and encoder .
4. If the DTB contains the node name, then no new node is added as
we assume to be working with an "old" DTB.
5. If the DTB does not contain the specified decoder/encoder string
then a new in-memory node is added which contains a compat string
consistent with upstream compat strings used to currently select
between the decoder and encoder respectively.
6. In this way new venus driver entries may be added which respect
the requirement to move mode selection out of DTB and into driver.
7. Simple instances of decoder/encoder nodes in the yaml schema have been
marked as deprecated.
8. Since the proposed scheme here always defers to what the DTB says that
means it would be possible to remove decoder/encoder entries for the
deprecated schema should we choose to do so at a later date but,
that step is not taken in this series.
9. Some of the upstream encoder/decoder nodes for example sdm630/sdm660
also contain clock and power-domain information and have not been
updated with the static configuration data or had the schema amended to
deprecate values. Because these nodes impart hardware specific
information and are already upstream this series proposes to leave
those as-is.
However if this scheme is adopted it should allow for addition of venus for
both qcs615[1] and sc8280xp[2].
Other SoCs such as sm8550, sm8650 and beyond are expected to be supported
by Iris.
The sm8350 and sm8280xp in the second series would then be able to excise
the offending compat = "video-encoder" | "video-decoder" in the schema and
DT.
I considered making this series an all singing all dancing method to select
between encoder and decoder for all SoCs but, the objective here is not to
add functionality but to provide support for configuration in-driver
consistent with current usage and to do so with a minimal code
intervention.
So far I've tested on RB3 by removing:
video-core0 {
compatible = "venus-decoder";
};
video-core1 {
compatible = "venus-encoder";
};
This works - the code adds the nodes into memory and the video
encoder/decoder logic in the plaform code runs.
Similarly if the nodes are left in-place then no new nodes are added by the
code in this series and still both encoder and decoder probe.
Thus proving the code works and will provide support for new platforms
while also leaving open the option of dropping nodes from upstream.
I've left the dropping step out for now, it can be implemented later.
[1] https://lore.kernel.org/linux-arm-msm/20241125-add-venus-for-qcs615-v3-0-5a376b97a68e@quicinc.com
[2] https://lore.kernel.org/linux-media/20230731-topic-8280_venus-v1-0-8c8bbe1983a5@linaro.org/
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
Bryan O'Donoghue (3):
media: venus: Add support for static video encoder/decoder declarations
media: venus: Populate video encoder/decoder nodename entries
media: dt-bindings: qcom-venus: Deprecate video-decoder and video-encoder where applicable
.../bindings/media/qcom,msm8916-venus.yaml | 12 +--
.../bindings/media/qcom,sc7180-venus.yaml | 12 +--
.../bindings/media/qcom,sc7280-venus.yaml | 12 +--
.../bindings/media/qcom,sdm845-venus-v2.yaml | 12 +--
.../bindings/media/qcom,sm8250-venus.yaml | 12 +--
drivers/media/platform/qcom/venus/Kconfig | 1 +
drivers/media/platform/qcom/venus/core.c | 104 ++++++++++++++++++++-
drivers/media/platform/qcom/venus/core.h | 4 +
8 files changed, 118 insertions(+), 51 deletions(-)
---
base-commit: 72ad4ff638047bbbdf3232178fea4bec1f429319
change-id: 20241127-media-staging-24-11-25-rb3-hw-compat-string-ea3c99938021
Best regards,
--
Bryan O'Donoghue <bryan.odonoghue@linaro.org>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v5 1/3] media: venus: Add support for static video encoder/decoder declarations
2024-12-09 11:52 [PATCH v5 0/3] media: venus: Provide support for selecting encoder/decoder from in-driver Bryan O'Donoghue
@ 2024-12-09 11:52 ` Bryan O'Donoghue
2024-12-18 10:44 ` Renjiang Han
2024-12-28 13:33 ` Stanimir Varbanov
2024-12-09 11:52 ` [PATCH v5 2/3] media: venus: Populate video encoder/decoder nodename entries Bryan O'Donoghue
` (2 subsequent siblings)
3 siblings, 2 replies; 16+ messages in thread
From: Bryan O'Donoghue @ 2024-12-09 11:52 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Mauro Carvalho Chehab,
Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: quic_renjiang, quic_vnagar, quic_dikshita, konradybcio,
linux-media, linux-arm-msm, linux-kernel, devicetree,
Stanimir Varbanov, Bryan O'Donoghue
Add resource structure data and probe() logic to support static
declarations of encoder and decoder.
Right now we rely on video encoder/decoder selection happening in the dtb
but, this goes against the remit of device tree which is supposed to
describe hardware, not select functional logic in Linux drivers.
Provide two strings in the venus resource structure enc_nodename and
dec_nodename.
When set the venus driver will create an OF entry in-memory consistent
with:
dec_nodename {
compat = "video-decoder";
};
and/or
enc_nodename {
compat = "video-encoder";
};
This will allow us to reuse the existing driver scheme of relying on compat
names maintaining compatibility with old dtb files.
dec_nodename can be "video-decoder" or "video0"
enc_nodename can be "video-encoder" or "video1"
This change relies on of_changeset() API as a result select OF_DYNAMIC will
be added to venus/Kconfig
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
drivers/media/platform/qcom/venus/Kconfig | 1 +
drivers/media/platform/qcom/venus/core.c | 94 ++++++++++++++++++++++++++++++-
drivers/media/platform/qcom/venus/core.h | 4 ++
3 files changed, 98 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/qcom/venus/Kconfig b/drivers/media/platform/qcom/venus/Kconfig
index bfd50e8f34219db8a1de7960d7ea93b20db2982a..bc2e410b29cb415a36540a4f98709eae44f4ec35 100644
--- a/drivers/media/platform/qcom/venus/Kconfig
+++ b/drivers/media/platform/qcom/venus/Kconfig
@@ -3,6 +3,7 @@ config VIDEO_QCOM_VENUS
depends on V4L_MEM2MEM_DRIVERS
depends on VIDEO_DEV && QCOM_SMEM
depends on (ARCH_QCOM && IOMMU_DMA) || COMPILE_TEST
+ select OF_DYNAMIC if ARCH_QCOM
select QCOM_MDT_LOADER if ARCH_QCOM
select QCOM_SCM
select VIDEOBUF2_DMA_CONTIG
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index 4e26b18790537885a77d66c1917a4e7a146eaf57..88dfa9f240dc6d18a7f58dc06b1bf10274b7121e 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -286,6 +286,89 @@ static irqreturn_t venus_isr_thread(int irq, void *dev_id)
return ret;
}
+#if defined(CONFIG_OF_DYNAMIC)
+static int venus_add_video_core(struct venus_core *core, const char *node_name,
+ const char *compat)
+{
+ struct of_changeset *ocs = core->ocs;
+ struct device *dev = core->dev;
+ struct device_node *np, *enp;
+ int ret;
+
+ if (!node_name)
+ return 0;
+
+ enp = of_find_node_by_name(dev->of_node, node_name);
+ if (enp) {
+ of_node_put(enp);
+ return 0;
+ }
+
+ np = of_changeset_create_node(ocs, dev->of_node, node_name);
+ if (!np) {
+ dev_err(dev, "Unable to create new node\n");
+ return -ENODEV;
+ }
+
+ ret = of_changeset_add_prop_string(ocs, np, "compatible", compat);
+ if (ret)
+ dev_err(dev, "unable to add %s\n", compat);
+
+ of_node_put(np);
+
+ return ret;
+}
+
+static int venus_add_dynamic_nodes(struct venus_core *core)
+{
+ struct device *dev = core->dev;
+ int ret;
+
+ core->ocs = kmalloc(sizeof(*core->ocs), GFP_KERNEL);
+ if (!core->ocs)
+ return -ENOMEM;
+
+ of_changeset_init(core->ocs);
+
+ ret = venus_add_video_core(core, core->res->dec_nodename, "venus-decoder");
+ if (ret)
+ goto err;
+
+ ret = venus_add_video_core(core, core->res->enc_nodename, "venus-encoder");
+ if (ret)
+ goto err;
+
+ ret = of_changeset_apply(core->ocs);
+ if (ret) {
+ dev_err(dev, "applying changeset fail ret %d\n", ret);
+ goto err;
+ }
+
+ return 0;
+err:
+ of_changeset_destroy(core->ocs);
+ kfree(core->ocs);
+ core->ocs = NULL;
+ return ret;
+}
+
+static void venus_remove_dynamic_nodes(struct venus_core *core)
+{
+ if (core->ocs) {
+ of_changeset_revert(core->ocs);
+ of_changeset_destroy(core->ocs);
+ kfree(core->ocs);
+ }
+}
+#else
+static int venus_add_dynamic_nodes(struct venus_core *core)
+{
+ return 0;
+}
+
+static void venus_remove_dynamic_nodes(struct venus_core *core) {}
+#endif
+
static int venus_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -365,9 +448,14 @@ static int venus_probe(struct platform_device *pdev)
if (ret < 0)
goto err_runtime_disable;
+ if (core->res->dec_nodename || core->res->enc_nodename) {
+ if (venus_add_dynamic_nodes(core))
+ goto err_runtime_disable;
+ }
+
ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
if (ret)
- goto err_runtime_disable;
+ goto err_remove_dynamic_nodes;
ret = venus_firmware_init(core);
if (ret)
@@ -411,6 +499,8 @@ static int venus_probe(struct platform_device *pdev)
venus_firmware_deinit(core);
err_of_depopulate:
of_platform_depopulate(dev);
+err_remove_dynamic_nodes:
+ venus_remove_dynamic_nodes(core);
err_runtime_disable:
pm_runtime_put_noidle(dev);
pm_runtime_disable(dev);
@@ -443,6 +533,8 @@ static void venus_remove(struct platform_device *pdev)
venus_firmware_deinit(core);
+ venus_remove_dynamic_nodes(core);
+
pm_runtime_put_sync(dev);
pm_runtime_disable(dev);
diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h
index 27784fd7082c321222b23ca4b2902a04c49e19ca..306231b4f7d0201175974b4a42574f30d23e08f0 100644
--- a/drivers/media/platform/qcom/venus/core.h
+++ b/drivers/media/platform/qcom/venus/core.h
@@ -90,6 +90,8 @@ struct venus_resources {
u32 cp_nonpixel_start;
u32 cp_nonpixel_size;
const char *fwname;
+ const char *enc_nodename;
+ const char *dec_nodename;
};
enum venus_fmt {
@@ -171,6 +173,7 @@ struct venus_format {
* @root: debugfs root directory
* @venus_ver: the venus firmware version
* @dump_core: a flag indicating that a core dump is required
+ * @ocs: OF changeset pointer
*/
struct venus_core {
void __iomem *base;
@@ -235,6 +238,7 @@ struct venus_core {
u32 rev;
} venus_ver;
unsigned long dump_core;
+ struct of_changeset *ocs;
};
struct vdec_controls {
--
2.47.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v5 2/3] media: venus: Populate video encoder/decoder nodename entries
2024-12-09 11:52 [PATCH v5 0/3] media: venus: Provide support for selecting encoder/decoder from in-driver Bryan O'Donoghue
2024-12-09 11:52 ` [PATCH v5 1/3] media: venus: Add support for static video encoder/decoder declarations Bryan O'Donoghue
@ 2024-12-09 11:52 ` Bryan O'Donoghue
2024-12-13 20:00 ` Nicolas Dufresne
2024-12-18 10:45 ` Renjiang Han
2024-12-09 11:52 ` [PATCH v5 3/3] media: dt-bindings: qcom-venus: Deprecate video-decoder and video-encoder where applicable Bryan O'Donoghue
2024-12-19 7:37 ` [PATCH v5 0/3] media: venus: Provide support for selecting encoder/decoder from in-driver Vikash Garodia
3 siblings, 2 replies; 16+ messages in thread
From: Bryan O'Donoghue @ 2024-12-09 11:52 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Mauro Carvalho Chehab,
Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: quic_renjiang, quic_vnagar, quic_dikshita, konradybcio,
linux-media, linux-arm-msm, linux-kernel, devicetree,
Stanimir Varbanov, Bryan O'Donoghue
Populate encoder and decoder node-name entries for the upstream parts. Once
done the compat="video-encoder" and compat="video-decoder" in the dtsi can
be dropped though the venus driver will continue to favour DT declared
video-encoder/video-decoder declarations over static declarations for
compatibility.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
drivers/media/platform/qcom/venus/core.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index 88dfa9f240dc6d18a7f58dc06b1bf10274b7121e..deef391d78770b8ae0f486dd3a3ab44c4ea6a581 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -674,6 +674,8 @@ static const struct venus_resources msm8916_res = {
.vmem_addr = 0,
.dma_mask = 0xddc00000 - 1,
.fwname = "qcom/venus-1.8/venus.mbn",
+ .dec_nodename = "video-decoder",
+ .enc_nodename = "video-encoder",
};
static const struct freq_tbl msm8996_freq_table[] = {
@@ -883,6 +885,8 @@ static const struct venus_resources sdm845_res_v2 = {
.cp_nonpixel_start = 0x1000000,
.cp_nonpixel_size = 0x24800000,
.fwname = "qcom/venus-5.2/venus.mbn",
+ .dec_nodename = "video-core0",
+ .enc_nodename = "video-core1",
};
static const struct freq_tbl sc7180_freq_table[] = {
@@ -931,6 +935,8 @@ static const struct venus_resources sc7180_res = {
.cp_nonpixel_start = 0x1000000,
.cp_nonpixel_size = 0x24800000,
.fwname = "qcom/venus-5.4/venus.mbn",
+ .dec_nodename = "video-decoder",
+ .enc_nodename = "video-encoder",
};
static const struct freq_tbl sm8250_freq_table[] = {
@@ -986,6 +992,8 @@ static const struct venus_resources sm8250_res = {
.vmem_addr = 0,
.dma_mask = 0xe0000000 - 1,
.fwname = "qcom/vpu-1.0/venus.mbn",
+ .dec_nodename = "video-decoder",
+ .enc_nodename = "video-encoder",
};
static const struct freq_tbl sc7280_freq_table[] = {
@@ -1048,6 +1056,8 @@ static const struct venus_resources sc7280_res = {
.cp_nonpixel_start = 0x1000000,
.cp_nonpixel_size = 0x24800000,
.fwname = "qcom/vpu-2.0/venus.mbn",
+ .dec_nodename = "video-decoder",
+ .enc_nodename = "video-encoder",
};
static const struct of_device_id venus_dt_match[] = {
--
2.47.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v5 3/3] media: dt-bindings: qcom-venus: Deprecate video-decoder and video-encoder where applicable
2024-12-09 11:52 [PATCH v5 0/3] media: venus: Provide support for selecting encoder/decoder from in-driver Bryan O'Donoghue
2024-12-09 11:52 ` [PATCH v5 1/3] media: venus: Add support for static video encoder/decoder declarations Bryan O'Donoghue
2024-12-09 11:52 ` [PATCH v5 2/3] media: venus: Populate video encoder/decoder nodename entries Bryan O'Donoghue
@ 2024-12-09 11:52 ` Bryan O'Donoghue
2024-12-18 10:46 ` Renjiang Han
2024-12-19 7:37 ` [PATCH v5 0/3] media: venus: Provide support for selecting encoder/decoder from in-driver Vikash Garodia
3 siblings, 1 reply; 16+ messages in thread
From: Bryan O'Donoghue @ 2024-12-09 11:52 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Mauro Carvalho Chehab,
Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: quic_renjiang, quic_vnagar, quic_dikshita, konradybcio,
linux-media, linux-arm-msm, linux-kernel, devicetree,
Stanimir Varbanov, Bryan O'Donoghue, Krzysztof Kozlowski
For the list of yaml files here the video-decoder and video-encoder nodes
provide nothing more than configuration input for the driver. These entries
do not in fact impart hardware specific data and should be deprecated.
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
.../devicetree/bindings/media/qcom,msm8916-venus.yaml | 12 ++----------
.../devicetree/bindings/media/qcom,sc7180-venus.yaml | 12 ++----------
.../devicetree/bindings/media/qcom,sc7280-venus.yaml | 12 ++----------
.../devicetree/bindings/media/qcom,sdm845-venus-v2.yaml | 12 ++----------
.../devicetree/bindings/media/qcom,sm8250-venus.yaml | 12 ++----------
5 files changed, 10 insertions(+), 50 deletions(-)
diff --git a/Documentation/devicetree/bindings/media/qcom,msm8916-venus.yaml b/Documentation/devicetree/bindings/media/qcom,msm8916-venus.yaml
index 9410f13ca97c181973c62fe62d0399fc9e82f05d..da140c2e3d3f3c3e886496e3e2303eda1df99bb4 100644
--- a/Documentation/devicetree/bindings/media/qcom,msm8916-venus.yaml
+++ b/Documentation/devicetree/bindings/media/qcom,msm8916-venus.yaml
@@ -45,6 +45,7 @@ properties:
required:
- compatible
+ deprecated: true
additionalProperties: false
video-encoder:
@@ -57,13 +58,12 @@ properties:
required:
- compatible
+ deprecated: true
additionalProperties: false
required:
- compatible
- iommus
- - video-decoder
- - video-encoder
unevaluatedProperties: false
@@ -83,12 +83,4 @@ examples:
power-domains = <&gcc VENUS_GDSC>;
iommus = <&apps_iommu 5>;
memory-region = <&venus_mem>;
-
- video-decoder {
- compatible = "venus-decoder";
- };
-
- video-encoder {
- compatible = "venus-encoder";
- };
};
diff --git a/Documentation/devicetree/bindings/media/qcom,sc7180-venus.yaml b/Documentation/devicetree/bindings/media/qcom,sc7180-venus.yaml
index 5cec1d077cda77817f6d876109defcb0abbfeb2c..83c4a5d95f020437bd160d6456850bc84a2cf5ff 100644
--- a/Documentation/devicetree/bindings/media/qcom,sc7180-venus.yaml
+++ b/Documentation/devicetree/bindings/media/qcom,sc7180-venus.yaml
@@ -70,6 +70,7 @@ properties:
required:
- compatible
+ deprecated: true
additionalProperties: false
video-encoder:
@@ -82,14 +83,13 @@ properties:
required:
- compatible
+ deprecated: true
additionalProperties: false
required:
- compatible
- power-domain-names
- iommus
- - video-decoder
- - video-encoder
unevaluatedProperties: false
@@ -114,12 +114,4 @@ examples:
"vcodec0_core", "vcodec0_bus";
iommus = <&apps_smmu 0x0c00 0x60>;
memory-region = <&venus_mem>;
-
- video-decoder {
- compatible = "venus-decoder";
- };
-
- video-encoder {
- compatible = "venus-encoder";
- };
};
diff --git a/Documentation/devicetree/bindings/media/qcom,sc7280-venus.yaml b/Documentation/devicetree/bindings/media/qcom,sc7280-venus.yaml
index 10c334e6b3dcf25967fa438f8e6e5035448af1b9..413c5b4ee6504ba1d5fe9f74d5be04ad8c90c318 100644
--- a/Documentation/devicetree/bindings/media/qcom,sc7280-venus.yaml
+++ b/Documentation/devicetree/bindings/media/qcom,sc7280-venus.yaml
@@ -68,6 +68,7 @@ properties:
required:
- compatible
+ deprecated: true
additionalProperties: false
video-encoder:
@@ -80,14 +81,13 @@ properties:
required:
- compatible
+ deprecated: true
additionalProperties: false
required:
- compatible
- power-domain-names
- iommus
- - video-decoder
- - video-encoder
unevaluatedProperties: false
@@ -125,14 +125,6 @@ examples:
memory-region = <&video_mem>;
- video-decoder {
- compatible = "venus-decoder";
- };
-
- video-encoder {
- compatible = "venus-encoder";
- };
-
video-firmware {
iommus = <&apps_smmu 0x21a2 0x0>;
};
diff --git a/Documentation/devicetree/bindings/media/qcom,sdm845-venus-v2.yaml b/Documentation/devicetree/bindings/media/qcom,sdm845-venus-v2.yaml
index 6228fd2b324631f3138e128c918266da58f6b544..c839cb1ebc0999e10b865f4bb43ea76ffa2bf46d 100644
--- a/Documentation/devicetree/bindings/media/qcom,sdm845-venus-v2.yaml
+++ b/Documentation/devicetree/bindings/media/qcom,sdm845-venus-v2.yaml
@@ -70,6 +70,7 @@ properties:
required:
- compatible
+ deprecated: true
additionalProperties: false
video-core1:
@@ -82,14 +83,13 @@ properties:
required:
- compatible
+ deprecated: true
additionalProperties: false
required:
- compatible
- power-domain-names
- iommus
- - video-core0
- - video-core1
unevaluatedProperties: false
@@ -119,12 +119,4 @@ examples:
iommus = <&apps_smmu 0x10a0 0x8>,
<&apps_smmu 0x10b0 0x0>;
memory-region = <&venus_mem>;
-
- video-core0 {
- compatible = "venus-decoder";
- };
-
- video-core1 {
- compatible = "venus-encoder";
- };
};
diff --git a/Documentation/devicetree/bindings/media/qcom,sm8250-venus.yaml b/Documentation/devicetree/bindings/media/qcom,sm8250-venus.yaml
index f66033ae8b590e7b6f1e344c368994744411aca2..da54493220c9dc90e7d9f5fcfce7590acb241c85 100644
--- a/Documentation/devicetree/bindings/media/qcom,sm8250-venus.yaml
+++ b/Documentation/devicetree/bindings/media/qcom,sm8250-venus.yaml
@@ -73,6 +73,7 @@ properties:
required:
- compatible
+ deprecated: true
additionalProperties: false
video-encoder:
@@ -85,6 +86,7 @@ properties:
required:
- compatible
+ deprecated: true
additionalProperties: false
required:
@@ -95,8 +97,6 @@ required:
- iommus
- resets
- reset-names
- - video-decoder
- - video-encoder
unevaluatedProperties: false
@@ -132,12 +132,4 @@ examples:
resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>,
<&videocc VIDEO_CC_MVS0C_CLK_ARES>;
reset-names = "bus", "core";
-
- video-decoder {
- compatible = "venus-decoder";
- };
-
- video-encoder {
- compatible = "venus-encoder";
- };
};
--
2.47.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v5 2/3] media: venus: Populate video encoder/decoder nodename entries
2024-12-09 11:52 ` [PATCH v5 2/3] media: venus: Populate video encoder/decoder nodename entries Bryan O'Donoghue
@ 2024-12-13 20:00 ` Nicolas Dufresne
2024-12-13 22:46 ` Bryan O'Donoghue
2024-12-18 10:45 ` Renjiang Han
1 sibling, 1 reply; 16+ messages in thread
From: Nicolas Dufresne @ 2024-12-13 20:00 UTC (permalink / raw)
To: Bryan O'Donoghue, Stanimir Varbanov, Vikash Garodia,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: quic_renjiang, quic_vnagar, quic_dikshita, konradybcio,
linux-media, linux-arm-msm, linux-kernel, devicetree,
Stanimir Varbanov
Hi Bryan,
Le lundi 09 décembre 2024 à 11:52 +0000, Bryan O'Donoghue a écrit :
> Populate encoder and decoder node-name entries for the upstream parts. Once
> done the compat="video-encoder" and compat="video-decoder" in the dtsi can
> be dropped though the venus driver will continue to favour DT declared
> video-encoder/video-decoder declarations over static declarations for
> compatibility.
Hope this hardcoding of node name is historical ? And not done for newer chips ?
We discourage userspace on relying on node names cause it always leads to
complication and non-portable code.
Nicolas
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
> drivers/media/platform/qcom/venus/core.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 88dfa9f240dc6d18a7f58dc06b1bf10274b7121e..deef391d78770b8ae0f486dd3a3ab44c4ea6a581 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -674,6 +674,8 @@ static const struct venus_resources msm8916_res = {
> .vmem_addr = 0,
> .dma_mask = 0xddc00000 - 1,
> .fwname = "qcom/venus-1.8/venus.mbn",
> + .dec_nodename = "video-decoder",
> + .enc_nodename = "video-encoder",
> };
>
> static const struct freq_tbl msm8996_freq_table[] = {
> @@ -883,6 +885,8 @@ static const struct venus_resources sdm845_res_v2 = {
> .cp_nonpixel_start = 0x1000000,
> .cp_nonpixel_size = 0x24800000,
> .fwname = "qcom/venus-5.2/venus.mbn",
> + .dec_nodename = "video-core0",
> + .enc_nodename = "video-core1",
> };
>
> static const struct freq_tbl sc7180_freq_table[] = {
> @@ -931,6 +935,8 @@ static const struct venus_resources sc7180_res = {
> .cp_nonpixel_start = 0x1000000,
> .cp_nonpixel_size = 0x24800000,
> .fwname = "qcom/venus-5.4/venus.mbn",
> + .dec_nodename = "video-decoder",
> + .enc_nodename = "video-encoder",
> };
>
> static const struct freq_tbl sm8250_freq_table[] = {
> @@ -986,6 +992,8 @@ static const struct venus_resources sm8250_res = {
> .vmem_addr = 0,
> .dma_mask = 0xe0000000 - 1,
> .fwname = "qcom/vpu-1.0/venus.mbn",
> + .dec_nodename = "video-decoder",
> + .enc_nodename = "video-encoder",
> };
>
> static const struct freq_tbl sc7280_freq_table[] = {
> @@ -1048,6 +1056,8 @@ static const struct venus_resources sc7280_res = {
> .cp_nonpixel_start = 0x1000000,
> .cp_nonpixel_size = 0x24800000,
> .fwname = "qcom/vpu-2.0/venus.mbn",
> + .dec_nodename = "video-decoder",
> + .enc_nodename = "video-encoder",
> };
>
> static const struct of_device_id venus_dt_match[] = {
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v5 2/3] media: venus: Populate video encoder/decoder nodename entries
2024-12-13 20:00 ` Nicolas Dufresne
@ 2024-12-13 22:46 ` Bryan O'Donoghue
0 siblings, 0 replies; 16+ messages in thread
From: Bryan O'Donoghue @ 2024-12-13 22:46 UTC (permalink / raw)
To: Nicolas Dufresne, Stanimir Varbanov, Vikash Garodia,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: quic_renjiang, quic_vnagar, quic_dikshita, konradybcio,
linux-media, linux-arm-msm, linux-kernel, devicetree,
Stanimir Varbanov
On 13/12/2024 20:00, Nicolas Dufresne wrote:
> Hope this hardcoding of node name is historical ?
Hardcoding is historical in dts.
We need to add two more chips into venus before iris is merged and at
feature parity for HFI_6XX and above - HFI_GEN2
Something like this.
enum {
HFI_1XX
..
HFI_6XX
HFI_GEN2
..
};
> And not done for newer chips ?
HFI_6XX and above will be fully supported in "iris" with encoder/decoder
selection done at session creation time.
Iris is being added phased. Basic decoder with one format, followed by
decoder and additional formats.
Once we get to feature parity HFI_6XX and above will be supported in
Iris and removed from venus.
Leaving HFI_4XX and below.
That's a long winded way of saying new chips minted from the fab will
either be HFI_GEN2+ or HFI_6XX.
> We discourage userspace on relying on node names cause it always leads to
> complication and non-portable code.
Writing this driver from scratch - basically what HFI_6XX in Iris does,
you'd select encoder/decoder when you create the initial session - the
initial state.
For venus that's an unknown amount of work to do.
What we _could_ certainly do is make the static assignment in this
series assignable via a kernel parameter.
I'd say though that's an additional series on top of this.
First pass here is just to fix up the original sin, not to improve
selectivity, just yet.
---
bod
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v5 1/3] media: venus: Add support for static video encoder/decoder declarations
2024-12-09 11:52 ` [PATCH v5 1/3] media: venus: Add support for static video encoder/decoder declarations Bryan O'Donoghue
@ 2024-12-18 10:44 ` Renjiang Han
2024-12-28 13:33 ` Stanimir Varbanov
1 sibling, 0 replies; 16+ messages in thread
From: Renjiang Han @ 2024-12-18 10:44 UTC (permalink / raw)
To: Bryan O'Donoghue, Stanimir Varbanov, Vikash Garodia,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: quic_vnagar, quic_dikshita, konradybcio, linux-media,
linux-arm-msm, linux-kernel, devicetree, Stanimir Varbanov
On 12/9/2024 7:52 PM, Bryan O'Donoghue wrote:
> Add resource structure data and probe() logic to support static
> declarations of encoder and decoder.
>
> Right now we rely on video encoder/decoder selection happening in the dtb
> but, this goes against the remit of device tree which is supposed to
> describe hardware, not select functional logic in Linux drivers.
>
> Provide two strings in the venus resource structure enc_nodename and
> dec_nodename.
>
> When set the venus driver will create an OF entry in-memory consistent
> with:
>
> dec_nodename {
> compat = "video-decoder";
> };
>
> and/or
>
> enc_nodename {
> compat = "video-encoder";
> };
>
> This will allow us to reuse the existing driver scheme of relying on compat
> names maintaining compatibility with old dtb files.
>
> dec_nodename can be "video-decoder" or "video0"
> enc_nodename can be "video-encoder" or "video1"
>
> This change relies on of_changeset() API as a result select OF_DYNAMIC will
> be added to venus/Kconfig
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
> drivers/media/platform/qcom/venus/Kconfig | 1 +
> drivers/media/platform/qcom/venus/core.c | 94 ++++++++++++++++++++++++++++++-
> drivers/media/platform/qcom/venus/core.h | 4 ++
> 3 files changed, 98 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/qcom/venus/Kconfig b/drivers/media/platform/qcom/venus/Kconfig
> index bfd50e8f34219db8a1de7960d7ea93b20db2982a..bc2e410b29cb415a36540a4f98709eae44f4ec35 100644
> --- a/drivers/media/platform/qcom/venus/Kconfig
> +++ b/drivers/media/platform/qcom/venus/Kconfig
> @@ -3,6 +3,7 @@ config VIDEO_QCOM_VENUS
> depends on V4L_MEM2MEM_DRIVERS
> depends on VIDEO_DEV && QCOM_SMEM
> depends on (ARCH_QCOM && IOMMU_DMA) || COMPILE_TEST
> + select OF_DYNAMIC if ARCH_QCOM
> select QCOM_MDT_LOADER if ARCH_QCOM
> select QCOM_SCM
> select VIDEOBUF2_DMA_CONTIG
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 4e26b18790537885a77d66c1917a4e7a146eaf57..88dfa9f240dc6d18a7f58dc06b1bf10274b7121e 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -286,6 +286,89 @@ static irqreturn_t venus_isr_thread(int irq, void *dev_id)
> return ret;
> }
>
> +#if defined(CONFIG_OF_DYNAMIC)
> +static int venus_add_video_core(struct venus_core *core, const char *node_name,
> + const char *compat)
> +{
> + struct of_changeset *ocs = core->ocs;
> + struct device *dev = core->dev;
> + struct device_node *np, *enp;
> + int ret;
> +
> + if (!node_name)
> + return 0;
> +
> + enp = of_find_node_by_name(dev->of_node, node_name);
> + if (enp) {
> + of_node_put(enp);
> + return 0;
> + }
> +
> + np = of_changeset_create_node(ocs, dev->of_node, node_name);
> + if (!np) {
> + dev_err(dev, "Unable to create new node\n");
> + return -ENODEV;
> + }
> +
> + ret = of_changeset_add_prop_string(ocs, np, "compatible", compat);
> + if (ret)
> + dev_err(dev, "unable to add %s\n", compat);
> +
> + of_node_put(np);
> +
> + return ret;
> +}
> +
> +static int venus_add_dynamic_nodes(struct venus_core *core)
> +{
> + struct device *dev = core->dev;
> + int ret;
> +
> + core->ocs = kmalloc(sizeof(*core->ocs), GFP_KERNEL);
> + if (!core->ocs)
> + return -ENOMEM;
> +
> + of_changeset_init(core->ocs);
> +
> + ret = venus_add_video_core(core, core->res->dec_nodename, "venus-decoder");
> + if (ret)
> + goto err;
> +
> + ret = venus_add_video_core(core, core->res->enc_nodename, "venus-encoder");
> + if (ret)
> + goto err;
> +
> + ret = of_changeset_apply(core->ocs);
> + if (ret) {
> + dev_err(dev, "applying changeset fail ret %d\n", ret);
> + goto err;
> + }
> +
> + return 0;
> +err:
> + of_changeset_destroy(core->ocs);
> + kfree(core->ocs);
> + core->ocs = NULL;
> + return ret;
> +}
> +
> +static void venus_remove_dynamic_nodes(struct venus_core *core)
> +{
> + if (core->ocs) {
> + of_changeset_revert(core->ocs);
> + of_changeset_destroy(core->ocs);
> + kfree(core->ocs);
> + }
> +}
> +#else
> +static int venus_add_dynamic_nodes(struct venus_core *core)
> +{
> + return 0;
> +}
> +
> +static void venus_remove_dynamic_nodes(struct venus_core *core) {}
> +#endif
> +
> static int venus_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> @@ -365,9 +448,14 @@ static int venus_probe(struct platform_device *pdev)
> if (ret < 0)
> goto err_runtime_disable;
>
> + if (core->res->dec_nodename || core->res->enc_nodename) {
> + if (venus_add_dynamic_nodes(core))
> + goto err_runtime_disable;
> + }
> +
> ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
> if (ret)
> - goto err_runtime_disable;
> + goto err_remove_dynamic_nodes;
>
> ret = venus_firmware_init(core);
> if (ret)
> @@ -411,6 +499,8 @@ static int venus_probe(struct platform_device *pdev)
> venus_firmware_deinit(core);
> err_of_depopulate:
> of_platform_depopulate(dev);
> +err_remove_dynamic_nodes:
> + venus_remove_dynamic_nodes(core);
> err_runtime_disable:
> pm_runtime_put_noidle(dev);
> pm_runtime_disable(dev);
> @@ -443,6 +533,8 @@ static void venus_remove(struct platform_device *pdev)
>
> venus_firmware_deinit(core);
>
> + venus_remove_dynamic_nodes(core);
> +
> pm_runtime_put_sync(dev);
> pm_runtime_disable(dev);
>
> diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h
> index 27784fd7082c321222b23ca4b2902a04c49e19ca..306231b4f7d0201175974b4a42574f30d23e08f0 100644
> --- a/drivers/media/platform/qcom/venus/core.h
> +++ b/drivers/media/platform/qcom/venus/core.h
> @@ -90,6 +90,8 @@ struct venus_resources {
> u32 cp_nonpixel_start;
> u32 cp_nonpixel_size;
> const char *fwname;
> + const char *enc_nodename;
> + const char *dec_nodename;
> };
>
> enum venus_fmt {
> @@ -171,6 +173,7 @@ struct venus_format {
> * @root: debugfs root directory
> * @venus_ver: the venus firmware version
> * @dump_core: a flag indicating that a core dump is required
> + * @ocs: OF changeset pointer
> */
> struct venus_core {
> void __iomem *base;
> @@ -235,6 +238,7 @@ struct venus_core {
> u32 rev;
> } venus_ver;
> unsigned long dump_core;
> + struct of_changeset *ocs;
> };
>
> struct vdec_controls {
It is working fine on QCS615.
Tested-by: Renjiang Han <quic_renjiang@quicinc.com>
--
Best Regards,
Renjiang
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v5 2/3] media: venus: Populate video encoder/decoder nodename entries
2024-12-09 11:52 ` [PATCH v5 2/3] media: venus: Populate video encoder/decoder nodename entries Bryan O'Donoghue
2024-12-13 20:00 ` Nicolas Dufresne
@ 2024-12-18 10:45 ` Renjiang Han
1 sibling, 0 replies; 16+ messages in thread
From: Renjiang Han @ 2024-12-18 10:45 UTC (permalink / raw)
To: Bryan O'Donoghue, Stanimir Varbanov, Vikash Garodia,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: quic_vnagar, quic_dikshita, konradybcio, linux-media,
linux-arm-msm, linux-kernel, devicetree, Stanimir Varbanov
On 12/9/2024 7:52 PM, Bryan O'Donoghue wrote:
> Populate encoder and decoder node-name entries for the upstream parts. Once
> done the compat="video-encoder" and compat="video-decoder" in the dtsi can
> be dropped though the venus driver will continue to favour DT declared
> video-encoder/video-decoder declarations over static declarations for
> compatibility.
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
> drivers/media/platform/qcom/venus/core.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 88dfa9f240dc6d18a7f58dc06b1bf10274b7121e..deef391d78770b8ae0f486dd3a3ab44c4ea6a581 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -674,6 +674,8 @@ static const struct venus_resources msm8916_res = {
> .vmem_addr = 0,
> .dma_mask = 0xddc00000 - 1,
> .fwname = "qcom/venus-1.8/venus.mbn",
> + .dec_nodename = "video-decoder",
> + .enc_nodename = "video-encoder",
> };
>
> static const struct freq_tbl msm8996_freq_table[] = {
> @@ -883,6 +885,8 @@ static const struct venus_resources sdm845_res_v2 = {
> .cp_nonpixel_start = 0x1000000,
> .cp_nonpixel_size = 0x24800000,
> .fwname = "qcom/venus-5.2/venus.mbn",
> + .dec_nodename = "video-core0",
> + .enc_nodename = "video-core1",
> };
>
> static const struct freq_tbl sc7180_freq_table[] = {
> @@ -931,6 +935,8 @@ static const struct venus_resources sc7180_res = {
> .cp_nonpixel_start = 0x1000000,
> .cp_nonpixel_size = 0x24800000,
> .fwname = "qcom/venus-5.4/venus.mbn",
> + .dec_nodename = "video-decoder",
> + .enc_nodename = "video-encoder",
> };
>
> static const struct freq_tbl sm8250_freq_table[] = {
> @@ -986,6 +992,8 @@ static const struct venus_resources sm8250_res = {
> .vmem_addr = 0,
> .dma_mask = 0xe0000000 - 1,
> .fwname = "qcom/vpu-1.0/venus.mbn",
> + .dec_nodename = "video-decoder",
> + .enc_nodename = "video-encoder",
> };
>
> static const struct freq_tbl sc7280_freq_table[] = {
> @@ -1048,6 +1056,8 @@ static const struct venus_resources sc7280_res = {
> .cp_nonpixel_start = 0x1000000,
> .cp_nonpixel_size = 0x24800000,
> .fwname = "qcom/vpu-2.0/venus.mbn",
> + .dec_nodename = "video-decoder",
> + .enc_nodename = "video-encoder",
> };
>
> static const struct of_device_id venus_dt_match[] = {
It is working fine on QCS615.
Tested-by: Renjiang Han <quic_renjiang@quicinc.com>
--
Best Regards,
Renjiang
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v5 3/3] media: dt-bindings: qcom-venus: Deprecate video-decoder and video-encoder where applicable
2024-12-09 11:52 ` [PATCH v5 3/3] media: dt-bindings: qcom-venus: Deprecate video-decoder and video-encoder where applicable Bryan O'Donoghue
@ 2024-12-18 10:46 ` Renjiang Han
2024-12-18 12:38 ` Krzysztof Kozlowski
0 siblings, 1 reply; 16+ messages in thread
From: Renjiang Han @ 2024-12-18 10:46 UTC (permalink / raw)
To: Bryan O'Donoghue, Stanimir Varbanov, Vikash Garodia,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: quic_vnagar, quic_dikshita, konradybcio, linux-media,
linux-arm-msm, linux-kernel, devicetree, Stanimir Varbanov,
Krzysztof Kozlowski
On 12/9/2024 7:52 PM, Bryan O'Donoghue wrote:
> For the list of yaml files here the video-decoder and video-encoder nodes
> provide nothing more than configuration input for the driver. These entries
> do not in fact impart hardware specific data and should be deprecated.
>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
> .../devicetree/bindings/media/qcom,msm8916-venus.yaml | 12 ++----------
> .../devicetree/bindings/media/qcom,sc7180-venus.yaml | 12 ++----------
> .../devicetree/bindings/media/qcom,sc7280-venus.yaml | 12 ++----------
> .../devicetree/bindings/media/qcom,sdm845-venus-v2.yaml | 12 ++----------
> .../devicetree/bindings/media/qcom,sm8250-venus.yaml | 12 ++----------
> 5 files changed, 10 insertions(+), 50 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/media/qcom,msm8916-venus.yaml b/Documentation/devicetree/bindings/media/qcom,msm8916-venus.yaml
> index 9410f13ca97c181973c62fe62d0399fc9e82f05d..da140c2e3d3f3c3e886496e3e2303eda1df99bb4 100644
> --- a/Documentation/devicetree/bindings/media/qcom,msm8916-venus.yaml
> +++ b/Documentation/devicetree/bindings/media/qcom,msm8916-venus.yaml
> @@ -45,6 +45,7 @@ properties:
> required:
> - compatible
>
> + deprecated: true
> additionalProperties: false
>
> video-encoder:
> @@ -57,13 +58,12 @@ properties:
> required:
> - compatible
>
> + deprecated: true
> additionalProperties: false
>
> required:
> - compatible
> - iommus
> - - video-decoder
> - - video-encoder
>
> unevaluatedProperties: false
>
> @@ -83,12 +83,4 @@ examples:
> power-domains = <&gcc VENUS_GDSC>;
> iommus = <&apps_iommu 5>;
> memory-region = <&venus_mem>;
> -
> - video-decoder {
> - compatible = "venus-decoder";
> - };
> -
> - video-encoder {
> - compatible = "venus-encoder";
> - };
> };
> diff --git a/Documentation/devicetree/bindings/media/qcom,sc7180-venus.yaml b/Documentation/devicetree/bindings/media/qcom,sc7180-venus.yaml
> index 5cec1d077cda77817f6d876109defcb0abbfeb2c..83c4a5d95f020437bd160d6456850bc84a2cf5ff 100644
> --- a/Documentation/devicetree/bindings/media/qcom,sc7180-venus.yaml
> +++ b/Documentation/devicetree/bindings/media/qcom,sc7180-venus.yaml
> @@ -70,6 +70,7 @@ properties:
> required:
> - compatible
>
> + deprecated: true
> additionalProperties: false
>
> video-encoder:
> @@ -82,14 +83,13 @@ properties:
> required:
> - compatible
>
> + deprecated: true
> additionalProperties: false
>
> required:
> - compatible
> - power-domain-names
> - iommus
> - - video-decoder
> - - video-encoder
>
> unevaluatedProperties: false
>
> @@ -114,12 +114,4 @@ examples:
> "vcodec0_core", "vcodec0_bus";
> iommus = <&apps_smmu 0x0c00 0x60>;
> memory-region = <&venus_mem>;
> -
> - video-decoder {
> - compatible = "venus-decoder";
> - };
> -
> - video-encoder {
> - compatible = "venus-encoder";
> - };
> };
> diff --git a/Documentation/devicetree/bindings/media/qcom,sc7280-venus.yaml b/Documentation/devicetree/bindings/media/qcom,sc7280-venus.yaml
> index 10c334e6b3dcf25967fa438f8e6e5035448af1b9..413c5b4ee6504ba1d5fe9f74d5be04ad8c90c318 100644
> --- a/Documentation/devicetree/bindings/media/qcom,sc7280-venus.yaml
> +++ b/Documentation/devicetree/bindings/media/qcom,sc7280-venus.yaml
> @@ -68,6 +68,7 @@ properties:
> required:
> - compatible
>
> + deprecated: true
> additionalProperties: false
>
> video-encoder:
> @@ -80,14 +81,13 @@ properties:
> required:
> - compatible
>
> + deprecated: true
> additionalProperties: false
>
> required:
> - compatible
> - power-domain-names
> - iommus
> - - video-decoder
> - - video-encoder
>
> unevaluatedProperties: false
>
> @@ -125,14 +125,6 @@ examples:
>
> memory-region = <&video_mem>;
>
> - video-decoder {
> - compatible = "venus-decoder";
> - };
> -
> - video-encoder {
> - compatible = "venus-encoder";
> - };
> -
> video-firmware {
> iommus = <&apps_smmu 0x21a2 0x0>;
> };
> diff --git a/Documentation/devicetree/bindings/media/qcom,sdm845-venus-v2.yaml b/Documentation/devicetree/bindings/media/qcom,sdm845-venus-v2.yaml
> index 6228fd2b324631f3138e128c918266da58f6b544..c839cb1ebc0999e10b865f4bb43ea76ffa2bf46d 100644
> --- a/Documentation/devicetree/bindings/media/qcom,sdm845-venus-v2.yaml
> +++ b/Documentation/devicetree/bindings/media/qcom,sdm845-venus-v2.yaml
> @@ -70,6 +70,7 @@ properties:
> required:
> - compatible
>
> + deprecated: true
> additionalProperties: false
>
> video-core1:
> @@ -82,14 +83,13 @@ properties:
> required:
> - compatible
>
> + deprecated: true
> additionalProperties: false
>
> required:
> - compatible
> - power-domain-names
> - iommus
> - - video-core0
> - - video-core1
>
> unevaluatedProperties: false
>
> @@ -119,12 +119,4 @@ examples:
> iommus = <&apps_smmu 0x10a0 0x8>,
> <&apps_smmu 0x10b0 0x0>;
> memory-region = <&venus_mem>;
> -
> - video-core0 {
> - compatible = "venus-decoder";
> - };
> -
> - video-core1 {
> - compatible = "venus-encoder";
> - };
> };
> diff --git a/Documentation/devicetree/bindings/media/qcom,sm8250-venus.yaml b/Documentation/devicetree/bindings/media/qcom,sm8250-venus.yaml
> index f66033ae8b590e7b6f1e344c368994744411aca2..da54493220c9dc90e7d9f5fcfce7590acb241c85 100644
> --- a/Documentation/devicetree/bindings/media/qcom,sm8250-venus.yaml
> +++ b/Documentation/devicetree/bindings/media/qcom,sm8250-venus.yaml
> @@ -73,6 +73,7 @@ properties:
> required:
> - compatible
>
> + deprecated: true
> additionalProperties: false
>
> video-encoder:
> @@ -85,6 +86,7 @@ properties:
> required:
> - compatible
>
> + deprecated: true
> additionalProperties: false
>
> required:
> @@ -95,8 +97,6 @@ required:
> - iommus
> - resets
> - reset-names
> - - video-decoder
> - - video-encoder
>
> unevaluatedProperties: false
>
> @@ -132,12 +132,4 @@ examples:
> resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>,
> <&videocc VIDEO_CC_MVS0C_CLK_ARES>;
> reset-names = "bus", "core";
> -
> - video-decoder {
> - compatible = "venus-decoder";
> - };
> -
> - video-encoder {
> - compatible = "venus-encoder";
> - };
> };
It is working fine on QCS615.
Tested-by: Renjiang Han <quic_renjiang@quicinc.com>
--
Best Regards,
Renjiang
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v5 3/3] media: dt-bindings: qcom-venus: Deprecate video-decoder and video-encoder where applicable
2024-12-18 10:46 ` Renjiang Han
@ 2024-12-18 12:38 ` Krzysztof Kozlowski
2024-12-19 2:45 ` Renjiang Han
0 siblings, 1 reply; 16+ messages in thread
From: Krzysztof Kozlowski @ 2024-12-18 12:38 UTC (permalink / raw)
To: Renjiang Han, Bryan O'Donoghue, Stanimir Varbanov,
Vikash Garodia, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: quic_vnagar, quic_dikshita, konradybcio, linux-media,
linux-arm-msm, linux-kernel, devicetree, Stanimir Varbanov
On 18/12/2024 11:46, Renjiang Han wrote:
>
> On 12/9/2024 7:52 PM, Bryan O'Donoghue wrote:
>> For the list of yaml files here the video-decoder and video-encoder nodes
>> provide nothing more than configuration input for the driver. These entries
>> do not in fact impart hardware specific data and should be deprecated.
>>
>> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
>> ---
Please kindly trim the replies from unnecessary context. It makes it
much easier to find new content.
>> @@ -132,12 +132,4 @@ examples:
>> resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>,
>> <&videocc VIDEO_CC_MVS0C_CLK_ARES>;
>> reset-names = "bus", "core";
>> -
>> - video-decoder {
>> - compatible = "venus-decoder";
>> - };
>> -
>> - video-encoder {
>> - compatible = "venus-encoder";
>> - };
>> };
> It is working fine on QCS615.
> Tested-by: Renjiang Han <quic_renjiang@quicinc.com>
How? How is it possible to test a binding on real hardware? To my
knowledge it is impossible, so I really would like to see explanation of
this tag.
I recently voiced my concerns that I really dislike tested-by tags on
bindings, because they are fake or not accurate. Story continues...
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v5 3/3] media: dt-bindings: qcom-venus: Deprecate video-decoder and video-encoder where applicable
2024-12-18 12:38 ` Krzysztof Kozlowski
@ 2024-12-19 2:45 ` Renjiang Han
2024-12-19 8:16 ` Krzysztof Kozlowski
0 siblings, 1 reply; 16+ messages in thread
From: Renjiang Han @ 2024-12-19 2:45 UTC (permalink / raw)
To: Krzysztof Kozlowski, Bryan O'Donoghue, Stanimir Varbanov,
Vikash Garodia, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: quic_vnagar, quic_dikshita, konradybcio, linux-media,
linux-arm-msm, linux-kernel, devicetree, Stanimir Varbanov
On 12/18/2024 8:38 PM, Krzysztof Kozlowski wrote:
>>> @@ -132,12 +132,4 @@ examples:
>>> resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>,
>>> <&videocc VIDEO_CC_MVS0C_CLK_ARES>;
>>> reset-names = "bus", "core";
>>> -
>>> - video-decoder {
>>> - compatible = "venus-decoder";
>>> - };
>>> -
>>> - video-encoder {
>>> - compatible = "venus-encoder";
>>> - };
>>> };
>> It is working fine on QCS615.
>> Tested-by: Renjiang Han<quic_renjiang@quicinc.com>
> How? How is it possible to test a binding on real hardware? To my
> knowledge it is impossible, so I really would like to see explanation of
> this tag.
I used this binding and modified the driver to verify the video
function, and the result was fine. Also, I used this binding to
verify the dtb, and there was no related error, so I added
Tested-by.
--
Best Regards,
Renjiang
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v5 0/3] media: venus: Provide support for selecting encoder/decoder from in-driver
2024-12-09 11:52 [PATCH v5 0/3] media: venus: Provide support for selecting encoder/decoder from in-driver Bryan O'Donoghue
` (2 preceding siblings ...)
2024-12-09 11:52 ` [PATCH v5 3/3] media: dt-bindings: qcom-venus: Deprecate video-decoder and video-encoder where applicable Bryan O'Donoghue
@ 2024-12-19 7:37 ` Vikash Garodia
2024-12-19 12:07 ` Bryan O'Donoghue
3 siblings, 1 reply; 16+ messages in thread
From: Vikash Garodia @ 2024-12-19 7:37 UTC (permalink / raw)
To: Bryan O'Donoghue, Stanimir Varbanov, Mauro Carvalho Chehab,
Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: quic_renjiang, quic_vnagar, quic_dikshita, konradybcio,
linux-media, linux-arm-msm, linux-kernel, devicetree,
Stanimir Varbanov, Krzysztof Kozlowski
Hi Bryan,
On 12/9/2024 5:22 PM, Bryan O'Donoghue wrote:
> v5:
> - Fixes venus_remove_dynamic_nodes() on probe err path - Dikshita
> - Link to v4: https://lore.kernel.org/r/20241128-media-staging-24-11-25-rb3-hw-compat-string-v4-0-fd062b399374@linaro.org
>
> v4:
>
> - Adds some unavoidable conditional CONFIG_OF_DYNAMIC to fix media-ci testcase # Test build:OF x86_64
> - Added logic for of_changeset_revert() and of_changeset_destroy() on
> error/remove paths - Bryan
> - Link to v3: https://lore.kernel.org/r/20241127-media-staging-24-11-25-rb3-hw-compat-string-v3-0-ef6bd25e98db@linaro.org
>
> v3:
> - Adds select OF_DYNAMIC to venus/Kconfig to ensure of_changeset_*() is
> available. Instead of ifdefing and have the fix not work without
> OF_DYNAMIC, select OF_DYANMIC with venus - linux-media-ci
> - Link to v2: https://lore.kernel.org/r/20241127-media-staging-24-11-25-rb3-hw-compat-string-v2-0-c010fd45f7ff@linaro.org
>
> v2:
> - Removes useless dev_info() leftover from debugging - Bryan
> Link: https://lore.kernel.org/r/ce9ac473-2f73-4c7a-97b1-08be39f3adb4@linaro.org
> - Trivial newline change @ np = of_changeset_create_node(ocs, dev->of_node, node_name); - Bryan
> - Fixes a missing goto identified by smatch - Smatch/Bryan
> - Adds Krzysztof's RB to deprecated - Krzysztof
> - Link to v1: https://lore.kernel.org/r/20241127-media-staging-24-11-25-rb3-hw-compat-string-v1-0-99c16f266b46@linaro.org
>
> v1:
> Various venus patches have been held up due to the misuse of DT to provide
> a configuration input to venus as to which mode a given transcoder should
> be in.
>
> Link: https://lore.kernel.org/linux-arm-msm/436145fd-d65f-44ec-b950-c434775187ca@kernel.org
> Link: https://lore.kernel.org/linux-media/ba40de82-b308-67b1-5751-bb2d95f2b8a5@linaro.org/
>
> This series provides support for static configuration of venus from the resource
> structure via:
>
> 1. Adding two strings to the resource structure.
> One string for the decoder one for the encoder.
> 2. The string for each SoC has been matched to the existing in the
> DT which currently specifies the mode as decoder or encoder.
> 3. New logic in the driver parses the DTB looking for the node name
> specified for the decoder and encoder .
> 4. If the DTB contains the node name, then no new node is added as
> we assume to be working with an "old" DTB.
> 5. If the DTB does not contain the specified decoder/encoder string
> then a new in-memory node is added which contains a compat string
> consistent with upstream compat strings used to currently select
> between the decoder and encoder respectively.
> 6. In this way new venus driver entries may be added which respect
> the requirement to move mode selection out of DTB and into driver.
> 7. Simple instances of decoder/encoder nodes in the yaml schema have been
> marked as deprecated.
> 8. Since the proposed scheme here always defers to what the DTB says that
> means it would be possible to remove decoder/encoder entries for the
> deprecated schema should we choose to do so at a later date but,
> that step is not taken in this series.
> 9. Some of the upstream encoder/decoder nodes for example sdm630/sdm660
> also contain clock and power-domain information and have not been
> updated with the static configuration data or had the schema amended to
> deprecate values. Because these nodes impart hardware specific
> information and are already upstream this series proposes to leave
> those as-is.
>
> However if this scheme is adopted it should allow for addition of venus for
> both qcs615[1] and sc8280xp[2].
>
> Other SoCs such as sm8550, sm8650 and beyond are expected to be supported
> by Iris.
>
> The sm8350 and sm8280xp in the second series would then be able to excise
> the offending compat = "video-encoder" | "video-decoder" in the schema and
> DT.
>
> I considered making this series an all singing all dancing method to select
> between encoder and decoder for all SoCs but, the objective here is not to
> add functionality but to provide support for configuration in-driver
> consistent with current usage and to do so with a minimal code
> intervention.
>
> So far I've tested on RB3 by removing:
>
> video-core0 {
> compatible = "venus-decoder";
> };
>
> video-core1 {
> compatible = "venus-encoder";
> };
>
> This works - the code adds the nodes into memory and the video
> encoder/decoder logic in the plaform code runs.
>
> Similarly if the nodes are left in-place then no new nodes are added by the
> code in this series and still both encoder and decoder probe.
>
> Thus proving the code works and will provide support for new platforms
> while also leaving open the option of dropping nodes from upstream.
>
> I've left the dropping step out for now, it can be implemented later.
>
> [1] https://lore.kernel.org/linux-arm-msm/20241125-add-venus-for-qcs615-v3-0-5a376b97a68e@quicinc.com
> [2] https://lore.kernel.org/linux-media/20230731-topic-8280_venus-v1-0-8c8bbe1983a5@linaro.org/
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Thank you for the changes, looks good to me. Let me come back with some
validation on few SOCs and update here.
Regards,
Vikash
> ---
> Bryan O'Donoghue (3):
> media: venus: Add support for static video encoder/decoder declarations
> media: venus: Populate video encoder/decoder nodename entries
> media: dt-bindings: qcom-venus: Deprecate video-decoder and video-encoder where applicable
>
> .../bindings/media/qcom,msm8916-venus.yaml | 12 +--
> .../bindings/media/qcom,sc7180-venus.yaml | 12 +--
> .../bindings/media/qcom,sc7280-venus.yaml | 12 +--
> .../bindings/media/qcom,sdm845-venus-v2.yaml | 12 +--
> .../bindings/media/qcom,sm8250-venus.yaml | 12 +--
> drivers/media/platform/qcom/venus/Kconfig | 1 +
> drivers/media/platform/qcom/venus/core.c | 104 ++++++++++++++++++++-
> drivers/media/platform/qcom/venus/core.h | 4 +
> 8 files changed, 118 insertions(+), 51 deletions(-)
> ---
> base-commit: 72ad4ff638047bbbdf3232178fea4bec1f429319
> change-id: 20241127-media-staging-24-11-25-rb3-hw-compat-string-ea3c99938021
>
> Best regards,
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v5 3/3] media: dt-bindings: qcom-venus: Deprecate video-decoder and video-encoder where applicable
2024-12-19 2:45 ` Renjiang Han
@ 2024-12-19 8:16 ` Krzysztof Kozlowski
0 siblings, 0 replies; 16+ messages in thread
From: Krzysztof Kozlowski @ 2024-12-19 8:16 UTC (permalink / raw)
To: Renjiang Han, Bryan O'Donoghue, Stanimir Varbanov,
Vikash Garodia, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: quic_vnagar, quic_dikshita, konradybcio, linux-media,
linux-arm-msm, linux-kernel, devicetree, Stanimir Varbanov
On 19/12/2024 03:45, Renjiang Han wrote:
>
> On 12/18/2024 8:38 PM, Krzysztof Kozlowski wrote:
>>>> @@ -132,12 +132,4 @@ examples:
>>>> resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>,
>>>> <&videocc VIDEO_CC_MVS0C_CLK_ARES>;
>>>> reset-names = "bus", "core";
>>>> -
>>>> - video-decoder {
>>>> - compatible = "venus-decoder";
>>>> - };
>>>> -
>>>> - video-encoder {
>>>> - compatible = "venus-encoder";
>>>> - };
>>>> };
>>> It is working fine on QCS615.
>>> Tested-by: Renjiang Han<quic_renjiang@quicinc.com>
>> How? How is it possible to test a binding on real hardware? To my
>> knowledge it is impossible, so I really would like to see explanation of
>> this tag.
> I used this binding and modified the driver to verify the video
> function, and the result was fine. Also, I used this binding to
> verify the dtb, and there was no related error, so I added
> Tested-by.
This is not a testing of binding. You tested driver. Don't add fake tags.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v5 0/3] media: venus: Provide support for selecting encoder/decoder from in-driver
2024-12-19 7:37 ` [PATCH v5 0/3] media: venus: Provide support for selecting encoder/decoder from in-driver Vikash Garodia
@ 2024-12-19 12:07 ` Bryan O'Donoghue
0 siblings, 0 replies; 16+ messages in thread
From: Bryan O'Donoghue @ 2024-12-19 12:07 UTC (permalink / raw)
To: Vikash Garodia, Stanimir Varbanov, Mauro Carvalho Chehab,
Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: quic_renjiang, quic_vnagar, quic_dikshita, konradybcio,
linux-media, linux-arm-msm, linux-kernel, devicetree,
Stanimir Varbanov, Krzysztof Kozlowski
On 19/12/2024 07:37, Vikash Garodia wrote:
>> Signed-off-by: Bryan O'Donoghue<bryan.odonoghue@linaro.org>
> Thank you for the changes, looks good to me. Let me come back with some
> validation on few SOCs and update here.
>
> Regards,
> Vikash
ACK, appreciated.
---
bod
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v5 1/3] media: venus: Add support for static video encoder/decoder declarations
2024-12-09 11:52 ` [PATCH v5 1/3] media: venus: Add support for static video encoder/decoder declarations Bryan O'Donoghue
2024-12-18 10:44 ` Renjiang Han
@ 2024-12-28 13:33 ` Stanimir Varbanov
2024-12-30 11:32 ` Bryan O'Donoghue
1 sibling, 1 reply; 16+ messages in thread
From: Stanimir Varbanov @ 2024-12-28 13:33 UTC (permalink / raw)
To: Bryan O'Donoghue, Vikash Garodia, Mauro Carvalho Chehab,
Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: quic_renjiang, quic_vnagar, quic_dikshita, konradybcio,
linux-media, linux-arm-msm, linux-kernel, devicetree,
Stanimir Varbanov
Hi Bryan,
Thank for your work !
On 9.12.24 г. 13:52 ч., Bryan O'Donoghue wrote:
> Add resource structure data and probe() logic to support static
> declarations of encoder and decoder.
>
> Right now we rely on video encoder/decoder selection happening in the dtb
> but, this goes against the remit of device tree which is supposed to
> describe hardware, not select functional logic in Linux drivers.
>
> Provide two strings in the venus resource structure enc_nodename and
> dec_nodename.
>
> When set the venus driver will create an OF entry in-memory consistent
> with:
>
> dec_nodename {
> compat = "video-decoder";
> };
>
> and/or
>
> enc_nodename {
> compat = "video-encoder";
> };
>
> This will allow us to reuse the existing driver scheme of relying on compat
> names maintaining compatibility with old dtb files.
>
> dec_nodename can be "video-decoder" or "video0"
> enc_nodename can be "video-encoder" or "video1"
>
> This change relies on of_changeset() API as a result select OF_DYNAMIC will
> be added to venus/Kconfig
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
> drivers/media/platform/qcom/venus/Kconfig | 1 +
> drivers/media/platform/qcom/venus/core.c | 94 ++++++++++++++++++++++++++++++-
> drivers/media/platform/qcom/venus/core.h | 4 ++
> 3 files changed, 98 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/qcom/venus/Kconfig b/drivers/media/platform/qcom/venus/Kconfig
> index bfd50e8f34219db8a1de7960d7ea93b20db2982a..bc2e410b29cb415a36540a4f98709eae44f4ec35 100644
> --- a/drivers/media/platform/qcom/venus/Kconfig
> +++ b/drivers/media/platform/qcom/venus/Kconfig
> @@ -3,6 +3,7 @@ config VIDEO_QCOM_VENUS
> depends on V4L_MEM2MEM_DRIVERS
> depends on VIDEO_DEV && QCOM_SMEM
> depends on (ARCH_QCOM && IOMMU_DMA) || COMPILE_TEST
> + select OF_DYNAMIC if ARCH_QCOM
> select QCOM_MDT_LOADER if ARCH_QCOM
> select QCOM_SCM
> select VIDEOBUF2_DMA_CONTIG
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 4e26b18790537885a77d66c1917a4e7a146eaf57..88dfa9f240dc6d18a7f58dc06b1bf10274b7121e 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -286,6 +286,89 @@ static irqreturn_t venus_isr_thread(int irq, void *dev_id)
> return ret;
> }
>
> +#if defined(CONFIG_OF_DYNAMIC)
> +static int venus_add_video_core(struct venus_core *core, const char *node_name,
> + const char *compat)
> +{
> + struct of_changeset *ocs = core->ocs;
> + struct device *dev = core->dev;
> + struct device_node *np, *enp;
> + int ret;
> +
> + if (!node_name)
> + return 0;
> +
> + enp = of_find_node_by_name(dev->of_node, node_name);
> + if (enp) {
> + of_node_put(enp);
> + return 0;
> + }
> +
> + np = of_changeset_create_node(ocs, dev->of_node, node_name);
> + if (!np) {
> + dev_err(dev, "Unable to create new node\n");
> + return -ENODEV;
> + }
> +
> + ret = of_changeset_add_prop_string(ocs, np, "compatible", compat);
> + if (ret)
> + dev_err(dev, "unable to add %s\n", compat);
> +
> + of_node_put(np);
> +
> + return ret;
> +}
> +
> +static int venus_add_dynamic_nodes(struct venus_core *core)
> +{
> + struct device *dev = core->dev;
> + int ret;
> +
> + core->ocs = kmalloc(sizeof(*core->ocs), GFP_KERNEL);
> + if (!core->ocs)
> + return -ENOMEM;
> +
> + of_changeset_init(core->ocs);
> +
> + ret = venus_add_video_core(core, core->res->dec_nodename, "venus-decoder");
> + if (ret)
> + goto err;
> +
> + ret = venus_add_video_core(core, core->res->enc_nodename, "venus-encoder");
> + if (ret)
> + goto err;
> +
> + ret = of_changeset_apply(core->ocs);
> + if (ret) {
> + dev_err(dev, "applying changeset fail ret %d\n", ret);
> + goto err;
> + }
> +
> + return 0;
> +err:
> + of_changeset_destroy(core->ocs);
> + kfree(core->ocs);
> + core->ocs = NULL;
> + return ret;
> +}
> +
> +static void venus_remove_dynamic_nodes(struct venus_core *core)
> +{
> + if (core->ocs) {
> + of_changeset_revert(core->ocs);
> + of_changeset_destroy(core->ocs);
> + kfree(core->ocs);
> + }
> +}
> +#else
> +static int venus_add_dynamic_nodes(struct venus_core *core)
> +{
> + return 0;
> +}
> +
> +static void venus_remove_dynamic_nodes(struct venus_core *core) {}
> +#endif
> +
> static int venus_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> @@ -365,9 +448,14 @@ static int venus_probe(struct platform_device *pdev)
> if (ret < 0)
> goto err_runtime_disable;
>
> + if (core->res->dec_nodename || core->res->enc_nodename) {
> + if (venus_add_dynamic_nodes(core))
It'd be good to pass the error code to the upper layer.
> + goto err_runtime_disable;
> + }
> +
> ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
> if (ret)
> - goto err_runtime_disable;
> + goto err_remove_dynamic_nodes;
>
> ret = venus_firmware_init(core);
> if (ret)
> @@ -411,6 +499,8 @@ static int venus_probe(struct platform_device *pdev)
> venus_firmware_deinit(core);
> err_of_depopulate:
> of_platform_depopulate(dev);
> +err_remove_dynamic_nodes:
> + venus_remove_dynamic_nodes(core);
> err_runtime_disable:
> pm_runtime_put_noidle(dev);
> pm_runtime_disable(dev);
> @@ -443,6 +533,8 @@ static void venus_remove(struct platform_device *pdev)
>
> venus_firmware_deinit(core);
>
> + venus_remove_dynamic_nodes(core);
> +
> pm_runtime_put_sync(dev);
> pm_runtime_disable(dev);
>
> diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h
> index 27784fd7082c321222b23ca4b2902a04c49e19ca..306231b4f7d0201175974b4a42574f30d23e08f0 100644
> --- a/drivers/media/platform/qcom/venus/core.h
> +++ b/drivers/media/platform/qcom/venus/core.h
> @@ -90,6 +90,8 @@ struct venus_resources {
> u32 cp_nonpixel_start;
> u32 cp_nonpixel_size;
> const char *fwname;
> + const char *enc_nodename;
> + const char *dec_nodename;
> };
>
> enum venus_fmt {
> @@ -171,6 +173,7 @@ struct venus_format {
> * @root: debugfs root directory
> * @venus_ver: the venus firmware version
> * @dump_core: a flag indicating that a core dump is required
> + * @ocs: OF changeset pointer
> */
> struct venus_core {
> void __iomem *base;
> @@ -235,6 +238,7 @@ struct venus_core {
> u32 rev;
> } venus_ver;
> unsigned long dump_core;
> + struct of_changeset *ocs;
> };
>
> struct vdec_controls {
>
--
regards,
Stan
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v5 1/3] media: venus: Add support for static video encoder/decoder declarations
2024-12-28 13:33 ` Stanimir Varbanov
@ 2024-12-30 11:32 ` Bryan O'Donoghue
0 siblings, 0 replies; 16+ messages in thread
From: Bryan O'Donoghue @ 2024-12-30 11:32 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Mauro Carvalho Chehab,
Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: quic_renjiang, quic_vnagar, quic_dikshita, konradybcio,
linux-media, linux-arm-msm, linux-kernel, devicetree,
Stanimir Varbanov
On 28/12/2024 13:33, Stanimir Varbanov wrote:
>> + if (core->res->dec_nodename || core->res->enc_nodename) {
>> + if (venus_add_dynamic_nodes(core))
>
> It'd be good to pass the error code to the upper layer.
np
---
bod
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2024-12-30 11:32 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-09 11:52 [PATCH v5 0/3] media: venus: Provide support for selecting encoder/decoder from in-driver Bryan O'Donoghue
2024-12-09 11:52 ` [PATCH v5 1/3] media: venus: Add support for static video encoder/decoder declarations Bryan O'Donoghue
2024-12-18 10:44 ` Renjiang Han
2024-12-28 13:33 ` Stanimir Varbanov
2024-12-30 11:32 ` Bryan O'Donoghue
2024-12-09 11:52 ` [PATCH v5 2/3] media: venus: Populate video encoder/decoder nodename entries Bryan O'Donoghue
2024-12-13 20:00 ` Nicolas Dufresne
2024-12-13 22:46 ` Bryan O'Donoghue
2024-12-18 10:45 ` Renjiang Han
2024-12-09 11:52 ` [PATCH v5 3/3] media: dt-bindings: qcom-venus: Deprecate video-decoder and video-encoder where applicable Bryan O'Donoghue
2024-12-18 10:46 ` Renjiang Han
2024-12-18 12:38 ` Krzysztof Kozlowski
2024-12-19 2:45 ` Renjiang Han
2024-12-19 8:16 ` Krzysztof Kozlowski
2024-12-19 7:37 ` [PATCH v5 0/3] media: venus: Provide support for selecting encoder/decoder from in-driver Vikash Garodia
2024-12-19 12:07 ` Bryan O'Donoghue
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).