diff mbox series

[05/16] media: vimc: Create multiplanar parameter

Message ID 20190315164359.626-6-andrealmeid@collabora.com (mailing list archive)
State New, archived
Headers show
Series media: vimc: Add support for multiplanar formats | expand

Commit Message

André Almeida March 15, 2019, 4:43 p.m. UTC
Create multiplanar kernel module parameter to define if
the driver is running in single planar or in multiplanar mode.

Signed-off-by: André Almeida <andrealmeid@collabora.com>
---
 drivers/media/platform/vimc/vimc-common.h | 2 ++
 drivers/media/platform/vimc/vimc-core.c   | 8 ++++++++
 2 files changed, 10 insertions(+)

Comments

Helen Mae Koike Fornazier March 15, 2019, 7:30 p.m. UTC | #1
On 3/15/19 1:43 PM, André Almeida wrote:
> Create multiplanar kernel module parameter to define if
> the driver is running in single planar or in multiplanar mode.
> 
> Signed-off-by: André Almeida <andrealmeid@collabora.com>
> ---
>  drivers/media/platform/vimc/vimc-common.h | 2 ++
>  drivers/media/platform/vimc/vimc-core.c   | 8 ++++++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/drivers/media/platform/vimc/vimc-common.h b/drivers/media/platform/vimc/vimc-common.h
> index 7ceb9ea937e2..25e47c8691dd 100644
> --- a/drivers/media/platform/vimc/vimc-common.h
> +++ b/drivers/media/platform/vimc/vimc-common.h
> @@ -26,6 +26,8 @@
>  
>  #define VIMC_PDEV_NAME "vimc"
>  
> +extern unsigned int multiplanar;
> +
>  /* VIMC-specific controls */
>  #define VIMC_CID_VIMC_BASE		(0x00f00000 | 0xf000)
>  #define VIMC_CID_VIMC_CLASS		(0x00f00000 | 1)
> diff --git a/drivers/media/platform/vimc/vimc-core.c b/drivers/media/platform/vimc/vimc-core.c
> index 0fbb7914098f..34ca90fa6e79 100644
> --- a/drivers/media/platform/vimc/vimc-core.c
> +++ b/drivers/media/platform/vimc/vimc-core.c
> @@ -26,6 +26,11 @@
>  
>  #define VIMC_MDEV_MODEL_NAME "VIMC MDEV"
>  
> +unsigned int multiplanar;
> +module_param(multiplanar, uint, 0000);
> +MODULE_PARM_DESC(sca_mult, "0 (default) creates a single planar device, 1 creates a multiplanar device.");
> +
> +
>  #define VIMC_ENT_LINK(src, srcpad, sink, sinkpad, link_flags) {	\
>  	.src_ent = src,						\
>  	.src_pad = srcpad,					\
> @@ -388,6 +393,9 @@ static int __init vimc_init(void)
>  		return ret;
>  	}
>  
> +	dev_dbg(&vimc_dev.pdev.dev, "vimc: multiplanar mode is %s\n",
> +		multiplanar ? "ON" : "OFF");
> +
>  	return 0;
>  }
>  
> 

It just came to me that instead of using the multiplanar variable
everywhere, you can just check the vcap->vdev.device_caps to see if
multiplanar is supported. This way, you can add this multiplanar
variable together with the capability in the [PATCH 16/16] media: vimc:
cap: Dynamically define device caps.

Like this, we won't have the weird state where user can set
multiplanar=1 but the capabilities says it doesn't really support
multiplanar.


Regards,
Helen
diff mbox series

Patch

diff --git a/drivers/media/platform/vimc/vimc-common.h b/drivers/media/platform/vimc/vimc-common.h
index 7ceb9ea937e2..25e47c8691dd 100644
--- a/drivers/media/platform/vimc/vimc-common.h
+++ b/drivers/media/platform/vimc/vimc-common.h
@@ -26,6 +26,8 @@ 
 
 #define VIMC_PDEV_NAME "vimc"
 
+extern unsigned int multiplanar;
+
 /* VIMC-specific controls */
 #define VIMC_CID_VIMC_BASE		(0x00f00000 | 0xf000)
 #define VIMC_CID_VIMC_CLASS		(0x00f00000 | 1)
diff --git a/drivers/media/platform/vimc/vimc-core.c b/drivers/media/platform/vimc/vimc-core.c
index 0fbb7914098f..34ca90fa6e79 100644
--- a/drivers/media/platform/vimc/vimc-core.c
+++ b/drivers/media/platform/vimc/vimc-core.c
@@ -26,6 +26,11 @@ 
 
 #define VIMC_MDEV_MODEL_NAME "VIMC MDEV"
 
+unsigned int multiplanar;
+module_param(multiplanar, uint, 0000);
+MODULE_PARM_DESC(sca_mult, "0 (default) creates a single planar device, 1 creates a multiplanar device.");
+
+
 #define VIMC_ENT_LINK(src, srcpad, sink, sinkpad, link_flags) {	\
 	.src_ent = src,						\
 	.src_pad = srcpad,					\
@@ -388,6 +393,9 @@  static int __init vimc_init(void)
 		return ret;
 	}
 
+	dev_dbg(&vimc_dev.pdev.dev, "vimc: multiplanar mode is %s\n",
+		multiplanar ? "ON" : "OFF");
+
 	return 0;
 }