[PATCH v5] arm64: dts: sdm845: add video nodes

2019-01-25 Thread Malathi Gottam
This adds video nodes to sdm845 based on the examples
in the bindings.

Signed-off-by: Malathi Gottam 
---
Changes:
Added video firmware node
 arch/arm64/boot/dts/qcom/sdm845.dtsi | 38 
 1 file changed, 38 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index b72bdb0..1af68f5 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -87,6 +87,11 @@
reg = <0 0x8620 0 0x2d0>;
no-map;
};
+
+   venus_region: memory@9580 {
+   reg = <0x0 0x9580 0x0 0x50>;
+   no-map;
+   };
};
 
cpus {
@@ -1403,5 +1408,38 @@
status = "disabled";
};
};
+
+   video-codec@aa0 {
+   compatible = "qcom,sdm845-venus";
+   reg = <0x0aa0 0xff000>;
+   interrupts = ;
+   power-domains = < VENUS_GDSC>;
+   clocks = < VIDEO_CC_VENUS_CTL_CORE_CLK>,
+< VIDEO_CC_VENUS_AHB_CLK>,
+< VIDEO_CC_VENUS_CTL_AXI_CLK>;
+   clock-names = "core", "iface", "bus";
+   iommus = <_smmu 0x10a0 0x8>,
+<_smmu 0x10b0 0x0>;
+   memory-region = <_region>;
+
+   video-core0 {
+   compatible = "venus-decoder";
+   clocks = < VIDEO_CC_VCODEC0_CORE_CLK>,
+< VIDEO_CC_VCODEC0_AXI_CLK>;
+   clock-names = "core", "bus";
+   power-domains = < VCODEC0_GDSC>;
+   };
+
+   video-core1 {
+   compatible = "venus-encoder";
+   clocks = < VIDEO_CC_VCODEC1_CORE_CLK>,
+< VIDEO_CC_VCODEC1_AXI_CLK>;
+   clock-names = "core", "bus";
+   power-domains = < VCODEC1_GDSC>;
+   };
+   video-firmware {
+   iommus = <_smmu 0x10b2 0x0>;
+   };
+   };
};
 };
-- 
1.9.1



Re: [PATCH v3] arm64: dts: sdm845: add video nodes

2019-01-24 Thread Malathi Gottam

On 2019-01-25 13:16, Alexandre Courbot wrote:

On Thu, Jan 17, 2019 at 8:58 PM Stanimir Varbanov
 wrote:


Hi Malathi,

On 12/20/18 9:47 AM, Malathi Gottam wrote:
> This adds video nodes to sdm845 based on the examples
> in the bindings.
>
> Signed-off-by: Malathi Gottam 
> ---
>  arch/arm64/boot/dts/qcom/sdm845.dtsi | 35 +++
>  1 file changed, 35 insertions(+)

Looks good to me:

Reviewed-by: Stanimir Varbanov 

>
> diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845.dtsi
> index b72bdb0..ccd2b10 100644
> --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
> @@ -87,6 +87,11 @@
>   reg = <0 0x8620 0 0x2d0>;
>   no-map;
>   };
> +
> + venus_region: memory@9580 {
> + reg = <0x0 0x9580 0x0 0x50>;
> + no-map;
> + };
>   };
>
>   cpus {
> @@ -1403,5 +1408,35 @@
>   status = "disabled";
>   };
>   };
> +
> + video-codec@aa0 {
> + compatible = "qcom,sdm845-venus";
> + reg = <0x0aa0 0xff000>;
> + interrupts = ;
> + power-domains = < VENUS_GDSC>;
> + clocks = < VIDEO_CC_VENUS_CTL_CORE_CLK>,
> +  < VIDEO_CC_VENUS_AHB_CLK>,
> +  < VIDEO_CC_VENUS_CTL_AXI_CLK>;
> + clock-names = "core", "iface", "bus";
> + iommus = <_smmu 0x10a0 0x8>,
> +  <_smmu 0x10b0 0x0>;
> + memory-region = <_region>;
> +
> + video-core0 {
> + compatible = "venus-decoder";
> + clocks = < VIDEO_CC_VCODEC0_CORE_CLK>,
> +  < VIDEO_CC_VCODEC0_AXI_CLK>;
> + clock-names = "core", "bus";
> + power-domains = < VCODEC0_GDSC>;
> + };
> +
> + video-core1 {
> + compatible = "venus-encoder";
> + clocks = < VIDEO_CC_VCODEC1_CORE_CLK>,
> +  < VIDEO_CC_VCODEC1_AXI_CLK>;
> + clock-names = "core", "bus";
> + power-domains = < VCODEC1_GDSC>;
> + };
> + };


This patch lacks the video-firmware node, it should at the very least
be added before this gets merged.


Yes Alex, I missed adding video-firmware node. Thanks for noticing.
Will add it and post new version.

Thanks,
Malathi.


[PATCH v4] arm64: dts: sdm845: add video nodes

2019-01-07 Thread Malathi Gottam
This adds video nodes to sdm845 based on the examples
in the bindings.

Signed-off-by: Malathi Gottam 
---
 arch/arm64/boot/dts/qcom/sdm845.dtsi | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index b72bdb0..df31d39 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -87,6 +87,11 @@
reg = <0 0x8620 0 0x2d0>;
no-map;
};
+
+   venus_region: memory@9580 {
+   reg = <0x0 0x9580 0x0 0x60>;
+   no-map;
+   };
};
 
cpus {
@@ -1403,5 +1408,35 @@
status = "disabled";
};
};
+
+   video-codec@aa0 {
+   compatible = "qcom,sdm845-venus";
+   reg = <0x0aa0 0xff000>;
+   interrupts = ;
+   power-domains = < VENUS_GDSC>;
+   clocks = < VIDEO_CC_VENUS_CTL_CORE_CLK>,
+< VIDEO_CC_VENUS_AHB_CLK>,
+< VIDEO_CC_VENUS_CTL_AXI_CLK>;
+   clock-names = "core", "iface", "bus";
+   iommus = <_smmu 0x10a0 0x8>,
+<_smmu 0x10b0 0x0>;
+   memory-region = <_region>;
+
+   video-core0 {
+   compatible = "venus-decoder";
+   clocks = < VIDEO_CC_VCODEC0_CORE_CLK>,
+< VIDEO_CC_VCODEC0_AXI_CLK>;
+   clock-names = "core", "bus";
+   power-domains = < VCODEC0_GDSC>;
+   };
+
+   video-core1 {
+   compatible = "venus-encoder";
+   clocks = < VIDEO_CC_VCODEC1_CORE_CLK>,
+< VIDEO_CC_VCODEC1_AXI_CLK>;
+   clock-names = "core", "bus";
+   power-domains = < VCODEC1_GDSC>;
+   };
+   };
};
 };
-- 
1.9.1



[PATCH v2] media: venus: add debugfs support

2019-01-07 Thread Malathi Gottam
Enable logs in venus through debugfs to print
debug information.

Signed-off-by: Malathi Gottam 
---
 drivers/media/platform/qcom/venus/core.c   |  62 -
 drivers/media/platform/qcom/venus/core.h   |  32 +
 drivers/media/platform/qcom/venus/firmware.c   |   6 +-
 drivers/media/platform/qcom/venus/helpers.c|  51 +--
 drivers/media/platform/qcom/venus/hfi.c|  93 ++---
 drivers/media/platform/qcom/venus/hfi_cmds.c   |  33 +++--
 drivers/media/platform/qcom/venus/hfi_msgs.c   |   5 +
 drivers/media/platform/qcom/venus/vdec.c   | 185 +++--
 drivers/media/platform/qcom/venus/vdec_ctrls.c |   7 +-
 drivers/media/platform/qcom/venus/venc.c   | 139 +++
 drivers/media/platform/qcom/venus/venc_ctrls.c |   9 +-
 11 files changed, 512 insertions(+), 110 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/core.c 
b/drivers/media/platform/qcom/venus/core.c
index cb411eb..abfc6c9 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -13,6 +13,7 @@
  *
  */
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -31,6 +32,50 @@
 #include "venc.h"
 #include "firmware.h"
 
+struct dentry *debugfs_root;
+int venus_debug = ERR;
+EXPORT_SYMBOL_GPL(venus_debug);
+
+static struct dentry *venus_debugfs_init_drv(void)
+{
+   bool ok = false;
+   struct dentry *dir = NULL;
+
+   dir = debugfs_create_dir("venus", NULL);
+   if (IS_ERR_OR_NULL(dir)) {
+   dir = NULL;
+   pr_err("failed to create debug dir");
+   goto failed_create_dir;
+   }
+
+#define __debugfs_create(__type, __fname, __value) ({  
\
+   struct dentry *f = debugfs_create_##__type(__fname, 0644,   \
+   dir, __value);\
+   if (IS_ERR_OR_NULL(f)) {  \
+   dprintk(ERR, "Failed creating debugfs file '%pd/%s'\n",  \
+   dir, __fname); \
+   f = NULL; \
+   } \
+   f;\
+})
+
+   ok =
+   __debugfs_create(x32, "debug_level", _debug);
+
+#undef __debugfs_create
+
+   if (!ok)
+   goto failed_create_dir;
+
+   return dir;
+
+failed_create_dir:
+   if (dir)
+   debugfs_remove_recursive(debugfs_root);
+
+   return NULL;
+}
+
 static void venus_event_notify(struct venus_core *core, u32 event)
 {
struct venus_inst *inst;
@@ -137,6 +182,7 @@ static int venus_clks_enable(struct venus_core *core)
 
return 0;
 err:
+   dprintk(ERR, "Failed to enable clk:%d\n", i);
while (i--)
clk_disable_unprepare(core->clks[i]);
 
@@ -236,6 +282,8 @@ static int venus_probe(struct platform_device *pdev)
struct resource *r;
int ret;
 
+   debugfs_root = venus_debugfs_init_drv();
+
core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL);
if (!core)
return -ENOMEM;
@@ -245,8 +293,10 @@ static int venus_probe(struct platform_device *pdev)
 
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
core->base = devm_ioremap_resource(dev, r);
-   if (IS_ERR(core->base))
+   if (IS_ERR(core->base)) {
+   dprintk(ERR, "Failed to ioremap platform resources");
return PTR_ERR(core->base);
+   }
 
core->irq = platform_get_irq(pdev, 0);
if (core->irq < 0)
@@ -297,8 +347,10 @@ static int venus_probe(struct platform_device *pdev)
goto err_runtime_disable;
 
ret = venus_firmware_init(core);
-   if (ret)
+   if (ret) {
+   dprintk(ERR, "Failed to init video firmware\n");
goto err_runtime_disable;
+   }
 
ret = venus_boot(core);
if (ret)
@@ -321,8 +373,10 @@ static int venus_probe(struct platform_device *pdev)
goto err_venus_shutdown;
 
ret = v4l2_device_register(dev, >v4l2_dev);
-   if (ret)
+   if (ret) {
+   dprintk(ERR, "Failed to register v4l2 device\n");
goto err_core_deinit;
+   }
 
ret = pm_runtime_put_sync(dev);
if (ret)
@@ -366,6 +420,8 @@ static int venus_remove(struct platform_device *pdev)
 
v4l2_device_unregister(>v4l2_dev);
 
+   debugfs_remove_recursive(debugfs_root);
+
return ret;
 }
 
diff --git a/drivers/media/platform/qcom/venus/core.h 
b/drivers/media/platform/qcom/venus/core.h
index 6382cea..c31d9e0 100644
--- a/drivers/media/platform/qcom/venus/core

[PATCH v2] media: venus: add debugfs support

2018-12-28 Thread Malathi Gottam
Enable logs in venus through debugfs to print
debug information.

Change-Id: I9b2a423829df9ee171f95f18bcb85646319086d0
Signed-off-by: Malathi Gottam 
---
 drivers/media/platform/qcom/venus/core.c   |  62 -
 drivers/media/platform/qcom/venus/core.h   |  32 +
 drivers/media/platform/qcom/venus/firmware.c   |   6 +-
 drivers/media/platform/qcom/venus/helpers.c|  51 +--
 drivers/media/platform/qcom/venus/hfi.c|  93 ++---
 drivers/media/platform/qcom/venus/hfi_cmds.c   |  33 +++--
 drivers/media/platform/qcom/venus/hfi_msgs.c   |   5 +
 drivers/media/platform/qcom/venus/vdec.c   | 185 +++--
 drivers/media/platform/qcom/venus/vdec_ctrls.c |   7 +-
 drivers/media/platform/qcom/venus/venc.c   | 139 +++
 drivers/media/platform/qcom/venus/venc_ctrls.c |   9 +-
 11 files changed, 512 insertions(+), 110 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/core.c 
b/drivers/media/platform/qcom/venus/core.c
index cb411eb..abfc6c9 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -13,6 +13,7 @@
  *
  */
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -31,6 +32,50 @@
 #include "venc.h"
 #include "firmware.h"
 
+struct dentry *debugfs_root;
+int venus_debug = ERR;
+EXPORT_SYMBOL_GPL(venus_debug);
+
+static struct dentry *venus_debugfs_init_drv(void)
+{
+   bool ok = false;
+   struct dentry *dir = NULL;
+
+   dir = debugfs_create_dir("venus", NULL);
+   if (IS_ERR_OR_NULL(dir)) {
+   dir = NULL;
+   pr_err("failed to create debug dir");
+   goto failed_create_dir;
+   }
+
+#define __debugfs_create(__type, __fname, __value) ({  
\
+   struct dentry *f = debugfs_create_##__type(__fname, 0644,   \
+   dir, __value);\
+   if (IS_ERR_OR_NULL(f)) {  \
+   dprintk(ERR, "Failed creating debugfs file '%pd/%s'\n",  \
+   dir, __fname); \
+   f = NULL; \
+   } \
+   f;\
+})
+
+   ok =
+   __debugfs_create(x32, "debug_level", _debug);
+
+#undef __debugfs_create
+
+   if (!ok)
+   goto failed_create_dir;
+
+   return dir;
+
+failed_create_dir:
+   if (dir)
+   debugfs_remove_recursive(debugfs_root);
+
+   return NULL;
+}
+
 static void venus_event_notify(struct venus_core *core, u32 event)
 {
struct venus_inst *inst;
@@ -137,6 +182,7 @@ static int venus_clks_enable(struct venus_core *core)
 
return 0;
 err:
+   dprintk(ERR, "Failed to enable clk:%d\n", i);
while (i--)
clk_disable_unprepare(core->clks[i]);
 
@@ -236,6 +282,8 @@ static int venus_probe(struct platform_device *pdev)
struct resource *r;
int ret;
 
+   debugfs_root = venus_debugfs_init_drv();
+
core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL);
if (!core)
return -ENOMEM;
@@ -245,8 +293,10 @@ static int venus_probe(struct platform_device *pdev)
 
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
core->base = devm_ioremap_resource(dev, r);
-   if (IS_ERR(core->base))
+   if (IS_ERR(core->base)) {
+   dprintk(ERR, "Failed to ioremap platform resources");
return PTR_ERR(core->base);
+   }
 
core->irq = platform_get_irq(pdev, 0);
if (core->irq < 0)
@@ -297,8 +347,10 @@ static int venus_probe(struct platform_device *pdev)
goto err_runtime_disable;
 
ret = venus_firmware_init(core);
-   if (ret)
+   if (ret) {
+   dprintk(ERR, "Failed to init video firmware\n");
goto err_runtime_disable;
+   }
 
ret = venus_boot(core);
if (ret)
@@ -321,8 +373,10 @@ static int venus_probe(struct platform_device *pdev)
goto err_venus_shutdown;
 
ret = v4l2_device_register(dev, >v4l2_dev);
-   if (ret)
+   if (ret) {
+   dprintk(ERR, "Failed to register v4l2 device\n");
goto err_core_deinit;
+   }
 
ret = pm_runtime_put_sync(dev);
if (ret)
@@ -366,6 +420,8 @@ static int venus_remove(struct platform_device *pdev)
 
v4l2_device_unregister(>v4l2_dev);
 
+   debugfs_remove_recursive(debugfs_root);
+
return ret;
 }
 
diff --git a/drivers/media/platform/qcom/venus/core.h 
b/drivers/media/platform/qcom/venus/core.h
index 6382cea..c31d9e0 

[PATCH] media: venus: add debugfs support

2018-12-27 Thread Malathi Gottam
Enable logs in venus through debugfs to print
debug information.

Signed-off-by: Malathi Gottam 
---
 drivers/media/platform/qcom/venus/core.c   |  62 -
 drivers/media/platform/qcom/venus/core.h   |  32 +
 drivers/media/platform/qcom/venus/firmware.c   |   6 +-
 drivers/media/platform/qcom/venus/helpers.c|  51 +--
 drivers/media/platform/qcom/venus/hfi.c|  93 ++---
 drivers/media/platform/qcom/venus/hfi_cmds.c   |  33 +++--
 drivers/media/platform/qcom/venus/hfi_msgs.c   |   5 +
 drivers/media/platform/qcom/venus/vdec.c   | 185 +++--
 drivers/media/platform/qcom/venus/vdec_ctrls.c |   7 +-
 drivers/media/platform/qcom/venus/venc.c   | 139 +++
 drivers/media/platform/qcom/venus/venc_ctrls.c |   9 +-
 11 files changed, 512 insertions(+), 110 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/core.c 
b/drivers/media/platform/qcom/venus/core.c
index cb411eb..6531830 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -13,6 +13,7 @@
  *
  */
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -31,6 +32,50 @@
 #include "venc.h"
 #include "firmware.h"
 
+struct dentry *debugfs_root;
+int venus_debug = ERR;
+EXPORT_SYMBOL_GPL(venus_debug);
+
+static struct dentry *venus_debugfs_init_drv(void)
+{
+   bool ok = false;
+   struct dentry *dir = NULL;
+
+   dir = debugfs_create_dir("venus", NULL);
+   if (IS_ERR_OR_NULL(dir)) {
+   dir = NULL;
+   pr_err("failed to create debug dir");
+   goto failed_create_dir;
+   }
+
+#define __debugfs_create(__type, __fname, __value) ({  
\
+   struct dentry *f = debugfs_create_##__type(__fname, 0644,   \
+   dir, __value);\
+   if (IS_ERR_OR_NULL(f)) {  \
+   dprintk(ERR, "Failed creating debugfs file '%pd/%s'\n",  \
+   dir, __name); \
+   f = NULL; \
+   } \
+   f;\
+})
+
+   ok =
+   __debugfs_create(x32, "debug_level", _debug);
+
+#undef __debugfs_create
+
+   if (!ok)
+   goto failed_create_dir;
+
+   return dir;
+
+failed_create_dir:
+   if (dir)
+   debugfs_remove_recursive(debugfs_root);
+
+   return NULL;
+}
+
 static void venus_event_notify(struct venus_core *core, u32 event)
 {
struct venus_inst *inst;
@@ -137,6 +182,7 @@ static int venus_clks_enable(struct venus_core *core)
 
return 0;
 err:
+   dprintk(ERR, "Failed to enable clk:%d\n", i);
while (i--)
clk_disable_unprepare(core->clks[i]);
 
@@ -236,6 +282,8 @@ static int venus_probe(struct platform_device *pdev)
struct resource *r;
int ret;
 
+   debugfs_root = venus_debugfs_init_drv();
+
core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL);
if (!core)
return -ENOMEM;
@@ -245,8 +293,10 @@ static int venus_probe(struct platform_device *pdev)
 
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
core->base = devm_ioremap_resource(dev, r);
-   if (IS_ERR(core->base))
+   if (IS_ERR(core->base)) {
+   dprintk(ERR, "Failed to ioremap platform resources");
return PTR_ERR(core->base);
+   }
 
core->irq = platform_get_irq(pdev, 0);
if (core->irq < 0)
@@ -297,8 +347,10 @@ static int venus_probe(struct platform_device *pdev)
goto err_runtime_disable;
 
ret = venus_firmware_init(core);
-   if (ret)
+   if (ret) {
+   dprintk(ERR, "Failed to init video firmware\n");
goto err_runtime_disable;
+   }
 
ret = venus_boot(core);
if (ret)
@@ -321,8 +373,10 @@ static int venus_probe(struct platform_device *pdev)
goto err_venus_shutdown;
 
ret = v4l2_device_register(dev, >v4l2_dev);
-   if (ret)
+   if (ret) {
+   dprintk(ERR, "Failed to register v4l2 device\n");
goto err_core_deinit;
+   }
 
ret = pm_runtime_put_sync(dev);
if (ret)
@@ -366,6 +420,8 @@ static int venus_remove(struct platform_device *pdev)
 
v4l2_device_unregister(>v4l2_dev);
 
+   debugfs_remove_recursive(debugfs_root);
+
return ret;
 }
 
diff --git a/drivers/media/platform/qcom/venus/core.h 
b/drivers/media/platform/qcom/venus/core.h
index 6382cea..c31d9e0 100644
--- a/drivers/media/platform/qcom/venus/core

[PATCH v3] arm64: dts: sdm845: add video nodes

2018-12-19 Thread Malathi Gottam
This adds video nodes to sdm845 based on the examples
in the bindings.

Signed-off-by: Malathi Gottam 
---
 arch/arm64/boot/dts/qcom/sdm845.dtsi | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index b72bdb0..ccd2b10 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -87,6 +87,11 @@
reg = <0 0x8620 0 0x2d0>;
no-map;
};
+
+   venus_region: memory@9580 {
+   reg = <0x0 0x9580 0x0 0x50>;
+   no-map;
+   };
};
 
cpus {
@@ -1403,5 +1408,35 @@
status = "disabled";
};
};
+
+   video-codec@aa0 {
+   compatible = "qcom,sdm845-venus";
+   reg = <0x0aa0 0xff000>;
+   interrupts = ;
+   power-domains = < VENUS_GDSC>;
+   clocks = < VIDEO_CC_VENUS_CTL_CORE_CLK>,
+< VIDEO_CC_VENUS_AHB_CLK>,
+< VIDEO_CC_VENUS_CTL_AXI_CLK>;
+   clock-names = "core", "iface", "bus";
+   iommus = <_smmu 0x10a0 0x8>,
+<_smmu 0x10b0 0x0>;
+   memory-region = <_region>;
+
+   video-core0 {
+   compatible = "venus-decoder";
+   clocks = < VIDEO_CC_VCODEC0_CORE_CLK>,
+< VIDEO_CC_VCODEC0_AXI_CLK>;
+   clock-names = "core", "bus";
+   power-domains = < VCODEC0_GDSC>;
+   };
+
+   video-core1 {
+   compatible = "venus-encoder";
+   clocks = < VIDEO_CC_VCODEC1_CORE_CLK>,
+< VIDEO_CC_VCODEC1_AXI_CLK>;
+   clock-names = "core", "bus";
+   power-domains = < VCODEC1_GDSC>;
+   };
+   };
};
 };
-- 
1.9.1



[PATCH v2] arm64: dts: sdm845: add video nodes

2018-11-28 Thread Malathi Gottam
This adds video nodes to sdm845 based on the examples
in the bindings.

Signed-off-by: Malathi Gottam 
---
 arch/arm64/boot/dts/qcom/sdm845.dtsi | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index 0c9a2aa..4c9d6a4 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -84,6 +84,11 @@
reg = <0 0x8620 0 0x2d0>;
no-map;
};
+
+   venus_region: memory@9580 {
+   reg = <0x0 0x9580 0x0 0x50>;
+   no-map;
+   };
};
 
cpus {
@@ -1103,5 +1108,35 @@
status = "disabled";
};
};
+
+   video-codec@aa0 {
+   compatible = "qcom,sdm845-venus";
+   reg = <0x0aa0 0xff000>;
+   interrupts = ;
+   power-domains = < VENUS_GDSC>;
+   clocks = < VIDEO_CC_VENUS_CTL_CORE_CLK>,
+< VIDEO_CC_VENUS_AHB_CLK>,
+< VIDEO_CC_VENUS_CTL_AXI_CLK>;
+   clock-names = "core", "iface", "bus";
+   iommus = <_smmu 0x10a0 0x8>,
+<_smmu 0x10b0 0x0>;
+   memory-region = <_region>;
+
+   video-core0 {
+   compatible = "venus-decoder";
+   clocks = < VIDEO_CC_VCODEC0_CORE_CLK>,
+< VIDEO_CC_VCODEC0_AXI_CLK>;
+   clock-names = "core", "bus";
+   power-domains = < VCODEC0_GDSC>;
+   };
+
+   video-core1 {
+   compatible = "venus-encoder";
+   clocks = < VIDEO_CC_VCODEC1_CORE_CLK>,
+< VIDEO_CC_VCODEC1_AXI_CLK>;
+   clock-names = "core", "bus";
+   power-domains = < VCODEC1_GDSC>;
+   };
+   };
};
 };
-- 
1.9.1



[PATCH v2] arm64: dts: sdm845: add video nodes

2018-11-28 Thread Malathi Gottam
This adds video nodes to sdm845 based on the examples
in the bindings.

Signed-off-by: Malathi Gottam 
---
 arch/arm64/boot/dts/qcom/sdm845.dtsi | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index 0c9a2aa..4c9d6a4 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -84,6 +84,11 @@
reg = <0 0x8620 0 0x2d0>;
no-map;
};
+
+   venus_region: memory@9580 {
+   reg = <0x0 0x9580 0x0 0x50>;
+   no-map;
+   };
};
 
cpus {
@@ -1103,5 +1108,35 @@
status = "disabled";
};
};
+
+   video-codec@aa0 {
+   compatible = "qcom,sdm845-venus";
+   reg = <0x0aa0 0xff000>;
+   interrupts = ;
+   power-domains = < VENUS_GDSC>;
+   clocks = < VIDEO_CC_VENUS_CTL_CORE_CLK>,
+< VIDEO_CC_VENUS_AHB_CLK>,
+< VIDEO_CC_VENUS_CTL_AXI_CLK>;
+   clock-names = "core", "iface", "bus";
+   iommus = <_smmu 0x10a0 0x8>,
+<_smmu 0x10b0 0x0>;
+   memory-region = <_region>;
+
+   video-core0 {
+   compatible = "venus-decoder";
+   clocks = < VIDEO_CC_VCODEC0_CORE_CLK>,
+< VIDEO_CC_VCODEC0_AXI_CLK>;
+   clock-names = "core", "bus";
+   power-domains = < VCODEC0_GDSC>;
+   };
+
+   video-core1 {
+   compatible = "venus-encoder";
+   clocks = < VIDEO_CC_VCODEC1_CORE_CLK>,
+< VIDEO_CC_VCODEC1_AXI_CLK>;
+   clock-names = "core", "bus";
+   power-domains = < VCODEC1_GDSC>;
+   };
+   };
};
 };
-- 
1.9.1



[PATCH] media: venus: amend buffer size for bitstream plane

2018-10-09 Thread Malathi Gottam
For lower resolutions, incase of encoder, the compressed
frame size is more than half of the corresponding input
YUV. Keep the size as same as YUV considering worst case.

Signed-off-by: Malathi Gottam 
---
 drivers/media/platform/qcom/venus/helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/venus/helpers.c 
b/drivers/media/platform/qcom/venus/helpers.c
index 2679adb..05c5423 100644
--- a/drivers/media/platform/qcom/venus/helpers.c
+++ b/drivers/media/platform/qcom/venus/helpers.c
@@ -649,7 +649,7 @@ u32 venus_helper_get_framesz(u32 v4l2_fmt, u32 width, u32 
height)
}
 
if (compressed) {
-   sz = ALIGN(height, 32) * ALIGN(width, 32) * 3 / 2 / 2;
+   sz = ALIGN(height, 32) * ALIGN(width, 32) * 3 / 2;
return ALIGN(sz, SZ_4K);
}
 
-- 
1.9.1



[PATCH] media: venus: add support for USERPTR to queue

2018-10-09 Thread Malathi Gottam
Add USERPTR to queue access methods by adding this
support to io_modes on both the planes.

Signed-off-by: Malathi Gottam 
---
 drivers/media/platform/qcom/venus/venc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/venc.c 
b/drivers/media/platform/qcom/venus/venc.c
index 754c19a..b86994c 100644
--- a/drivers/media/platform/qcom/venus/venc.c
+++ b/drivers/media/platform/qcom/venus/venc.c
@@ -1096,7 +1096,7 @@ static int m2m_queue_init(void *priv, struct vb2_queue 
*src_vq,
int ret;
 
src_vq->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
-   src_vq->io_modes = VB2_MMAP | VB2_DMABUF;
+   src_vq->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF;
src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
src_vq->ops = _vb2_ops;
src_vq->mem_ops = _dma_sg_memops;
@@ -1112,7 +1112,7 @@ static int m2m_queue_init(void *priv, struct vb2_queue 
*src_vq,
return ret;
 
dst_vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
-   dst_vq->io_modes = VB2_MMAP | VB2_DMABUF;
+   dst_vq->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF;
dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
dst_vq->ops = _vb2_ops;
dst_vq->mem_ops = _dma_sg_memops;
-- 
1.9.1



[PATCH] media: venus: amend buffer size for bitstream plane

2018-10-09 Thread Malathi Gottam
For lower resolutions, incase of encoder, the compressed
frame size is more than half of the corresponding input
YUV. Keep the size as same as YUV considering worst case.

Signed-off-by: Malathi Gottam 
---
 drivers/media/platform/qcom/venus/helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/venus/helpers.c 
b/drivers/media/platform/qcom/venus/helpers.c
index 2679adb..05c5423 100644
--- a/drivers/media/platform/qcom/venus/helpers.c
+++ b/drivers/media/platform/qcom/venus/helpers.c
@@ -649,7 +649,7 @@ u32 venus_helper_get_framesz(u32 v4l2_fmt, u32 width, u32 
height)
}
 
if (compressed) {
-   sz = ALIGN(height, 32) * ALIGN(width, 32) * 3 / 2 / 2;
+   sz = ALIGN(height, 32) * ALIGN(width, 32) * 3 / 2;
return ALIGN(sz, SZ_4K);
}
 
-- 
1.9.1



[PATCH] media: venus: add support for USERPTR to queue

2018-10-09 Thread Malathi Gottam
Add USERPTR to queue access methods by adding this
support to io_modes on both the planes.

Signed-off-by: Malathi Gottam 
---
 drivers/media/platform/qcom/venus/venc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/venc.c 
b/drivers/media/platform/qcom/venus/venc.c
index 754c19a..b86994c 100644
--- a/drivers/media/platform/qcom/venus/venc.c
+++ b/drivers/media/platform/qcom/venus/venc.c
@@ -1096,7 +1096,7 @@ static int m2m_queue_init(void *priv, struct vb2_queue 
*src_vq,
int ret;
 
src_vq->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
-   src_vq->io_modes = VB2_MMAP | VB2_DMABUF;
+   src_vq->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF;
src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
src_vq->ops = _vb2_ops;
src_vq->mem_ops = _dma_sg_memops;
@@ -1112,7 +1112,7 @@ static int m2m_queue_init(void *priv, struct vb2_queue 
*src_vq,
return ret;
 
dst_vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
-   dst_vq->io_modes = VB2_MMAP | VB2_DMABUF;
+   dst_vq->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF;
dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
dst_vq->ops = _vb2_ops;
dst_vq->mem_ops = _dma_sg_memops;
-- 
1.9.1