Re: [PATCH v2 2/5] [media] exynos-mscl: Add core functionality for the M-Scaler driver

2013-08-29 Thread Sylwester Nawrocki
Hi Shaik,

Couple more comments...

On 08/19/2013 12:58 PM, Shaik Ameer Basha wrote:
 This patch adds the core functionality for the M-Scaler driver.
 
 Signed-off-by: Shaik Ameer Basha shaik.am...@samsung.com
 ---
  drivers/media/platform/exynos-mscl/mscl-core.c | 1312 
 
  drivers/media/platform/exynos-mscl/mscl-core.h |  549 ++
  2 files changed, 1861 insertions(+)
  create mode 100644 drivers/media/platform/exynos-mscl/mscl-core.c
  create mode 100644 drivers/media/platform/exynos-mscl/mscl-core.h
 
 diff --git a/drivers/media/platform/exynos-mscl/mscl-core.c 
 b/drivers/media/platform/exynos-mscl/mscl-core.c
 new file mode 100644
 index 000..4a3a851
 --- /dev/null
 +++ b/drivers/media/platform/exynos-mscl/mscl-core.c
 @@ -0,0 +1,1312 @@
 +/*
 + * Copyright (c) 2013 - 2014 Samsung Electronics Co., Ltd.

First time I see such practice, why not just make it 2013 ?

 + *   http://www.samsung.com
 + *
 + * Samsung EXYNOS5 SoC series M-Scaler driver
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published
 + * by the Free Software Foundation, either version 2 of the License,

 + * or (at your option) any later version.

Are you sure you want this statement included ?

 + */
 +
 +#include linux/clk.h
 +#include linux/interrupt.h
 +#include linux/module.h
 +#include linux/of_platform.h
 +#include linux/pm_runtime.h
 +
 +#ifdef CONFIG_EXYNOS_IOMMU
 +#include asm/dma-iommu.h
 +#endif
 +
 +#include mscl-core.h
 +
 +#define MSCL_CLOCK_GATE_NAME mscl
 +
 +static const struct mscl_fmt mscl_formats[] = {
 + {
 + .name   = YUV 4:2:0 non-contig. 2p, Y/CbCr,
 + .pixelformat= V4L2_PIX_FMT_NV12M,
 + .depth  = { 8, 4 },
 + .color  = MSCL_YUV420,
 + .corder = MSCL_CBCR,

nit: s/corder/color_order ?

 + .num_planes = 2,
 + .num_comp   = 2,
 + .mscl_color = MSCL_YUV420_2P_Y_UV,
 + .mscl_color_fmt_type = (MSCL_FMT_SRC | MSCL_FMT_DST),
 +
 + }, {
 + .name   = YUV 4:2:0 contig. 2p, Y/CbCr,
 + .pixelformat= V4L2_PIX_FMT_NV12,
 + .depth  = { 12 },
 + .color  = MSCL_YUV420,
 + .corder = MSCL_CBCR,
 + .num_planes = 1,
 + .num_comp   = 2,
 + .mscl_color = MSCL_YUV420_2P_Y_UV,
 + .mscl_color_fmt_type = (MSCL_FMT_SRC | MSCL_FMT_DST),
 + }, {
 + .name   = YUV 4:2:0 n.c. 2p, Y/CbCr tiled,
 + .pixelformat= V4L2_PIX_FMT_NV12MT_16X16,
 + .depth  = { 8, 4 },
 + .color  = MSCL_YUV420,
 + .corder = MSCL_CBCR,
 + .num_planes = 2,
 + .num_comp   = 2,
 + .mscl_color = MSCL_YUV420_2P_Y_UV,

 + .mscl_color_fmt_type = (MSCL_FMT_SRC),
 + .is_tiled   = true,

Hm, why not create MSCL_FMT_TILED flags, rename mscl_color_fmt_type to
e.g. 'flags' and use this instead of multiple fields like
mscl_color_fmt_type/is_tiled ?

[...]
 +
 + /* [TBD] support pixel formats, corresponds to these mscl_color formats
 +  * MSCL_L8A8, MSCL_RGBA, MSCL_L8 etc
 +  */

Please remove this, or reformat it so it complies with the kernel coding style.

 +};
 +
 +const struct mscl_fmt *mscl_get_format(int index)
 +{
 + if (index = ARRAY_SIZE(mscl_formats))
 + return NULL;
 +
 + return (struct mscl_fmt *)mscl_formats[index];

Why is casting needed here ?

 +}
 +
 +const struct mscl_fmt *mscl_find_fmt(u32 *pixelformat,
 + u32 *mbus_code, u32 index)
 +{
 + const struct mscl_fmt *fmt, *def_fmt = NULL;
 + unsigned int i;
 +
 + if (index = ARRAY_SIZE(mscl_formats))
 + return NULL;
 +
 + for (i = 0; i  ARRAY_SIZE(mscl_formats); ++i) {
 + fmt = mscl_get_format(i);
 + if (pixelformat  fmt-pixelformat == *pixelformat)
 + return fmt;
 + if (mbus_code  fmt-mbus_code == *mbus_code)
 + return fmt;
 + if (index == i)
 + def_fmt = fmt;
 + }
 +
 + return def_fmt;
 +}
 +
 +void mscl_set_frame_size(struct mscl_frame *frame, int width, int height)
 +{
 + frame-f_width  = width;
 + frame-f_height = height;
 + frame-crop.width = width;
 + frame-crop.height = height;
 + frame-crop.left = 0;
 + frame-crop.top = 0;
 +}
 +
 +int mscl_enum_fmt_mplane(struct v4l2_fmtdesc *f)
 +{
 + const struct mscl_fmt *fmt;
 +
 + fmt = mscl_find_fmt(NULL, NULL, f-index);
 + if (!fmt)
 + return -EINVAL;
 +
 + /* input supports all mscl_formats but all mscl_formats are not
 +  * supported for output. don't return the unsupported formats for 

Re: [PATCH v2 2/5] [media] exynos-mscl: Add core functionality for the M-Scaler driver

2013-08-20 Thread Hans Verkuil
On 08/20/2013 07:43 AM, Shaik Ameer Basha wrote:
 + linux-media, linux-samsung-soc
 
 Hi Hans,
 
 Thanks for the review.
 Will address all your comments in v3.
 
 I have only one doubt regarding try_ctrl... (addressed inline)
 
 
 On Mon, Aug 19, 2013 at 6:36 PM, Hans Verkuil hverk...@xs4all.nl wrote:

 On 08/19/2013 12:58 PM, Shaik Ameer Basha wrote:
 This patch adds the core functionality for the M-Scaler driver.

 Some more comments below...


 Signed-off-by: Shaik Ameer Basha shaik.am...@samsung.com
 ---
  drivers/media/platform/exynos-mscl/mscl-core.c | 1312 
 
  drivers/media/platform/exynos-mscl/mscl-core.h |  549 ++
  2 files changed, 1861 insertions(+)
  create mode 100644 drivers/media/platform/exynos-mscl/mscl-core.c
  create mode 100644 drivers/media/platform/exynos-mscl/mscl-core.h

 diff --git a/drivers/media/platform/exynos-mscl/mscl-core.c 
 b/drivers/media/platform/exynos-mscl/mscl-core.c
 new file mode 100644
 index 000..4a3a851
 --- /dev/null
 +++ b/drivers/media/platform/exynos-mscl/mscl-core.c
 @@ -0,0 +1,1312 @@
 +/*
 + * Copyright (c) 2013 - 2014 Samsung Electronics Co., Ltd.
 + *   http://www.samsung.com
 + *
 + * Samsung EXYNOS5 SoC series M-Scaler driver
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published
 + * by the Free Software Foundation, either version 2 of the License,
 + * or (at your option) any later version.
 + */
 +
 +#include linux/clk.h
 +#include linux/interrupt.h
 
 [snip]
 
 +
 +static int __mscl_s_ctrl(struct mscl_ctx *ctx, struct v4l2_ctrl *ctrl)
 +{
 + struct mscl_dev *mscl = ctx-mscl_dev;
 + struct mscl_variant *variant = mscl-variant;
 + unsigned int flags = MSCL_DST_FMT | MSCL_SRC_FMT;
 + int ret = 0;
 +
 + if (ctrl-flags  V4L2_CTRL_FLAG_INACTIVE)
 + return 0;

 Why would you want to do this check?
 
 Will remove this. seems no such check is required for this driver.
 

 +
 + switch (ctrl-id) {
 + case V4L2_CID_HFLIP:
 + ctx-hflip = ctrl-val;
 + break;
 +
 + case V4L2_CID_VFLIP:
 + ctx-vflip = ctrl-val;
 + break;
 +
 + case V4L2_CID_ROTATE:
 + if ((ctx-state  flags) == flags) {
 + ret = mscl_check_scaler_ratio(variant,
 + ctx-s_frame.crop.width,
 + ctx-s_frame.crop.height,
 + ctx-d_frame.crop.width,
 + ctx-d_frame.crop.height,
 + ctx-ctrls_mscl.rotate-val);
 +
 + if (ret)
 + return -EINVAL;
 + }

 I think it would be good if the try_ctrl op is implemented so you can call
 VIDIOC_EXT_TRY_CTRLS in the application to check if the ROTATE control can be
 set.
 
 * @try_ctrl: Test whether the control's value is valid. Only relevant when
 * the usual min/max/step checks are not sufficient.
 
 As we support only 0,90,270 and the min, max and step can address these 
 values,
 does it really relevant to have try_ctrl op here ???

Well, you seem to have an additional mscl_check_scaler_ratio check here that can
make it fail, in other words: the min/max/step checks aren't sufficient.

Regards,

Hans

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/5] [media] exynos-mscl: Add core functionality for the M-Scaler driver

2013-08-20 Thread Shaik Ameer Basha
On Tue, Aug 20, 2013 at 11:57 AM, Hans Verkuil hverk...@xs4all.nl wrote:
 On 08/20/2013 07:43 AM, Shaik Ameer Basha wrote:
 + linux-media, linux-samsung-soc

 Hi Hans,

 Thanks for the review.
 Will address all your comments in v3.

 I have only one doubt regarding try_ctrl... (addressed inline)


 On Mon, Aug 19, 2013 at 6:36 PM, Hans Verkuil hverk...@xs4all.nl wrote:

 On 08/19/2013 12:58 PM, Shaik Ameer Basha wrote:
 This patch adds the core functionality for the M-Scaler driver.

 Some more comments below...


 Signed-off-by: Shaik Ameer Basha shaik.am...@samsung.com
 ---
  drivers/media/platform/exynos-mscl/mscl-core.c | 1312 
 
  drivers/media/platform/exynos-mscl/mscl-core.h |  549 ++
  2 files changed, 1861 insertions(+)
  create mode 100644 drivers/media/platform/exynos-mscl/mscl-core.c
  create mode 100644 drivers/media/platform/exynos-mscl/mscl-core.h

 diff --git a/drivers/media/platform/exynos-mscl/mscl-core.c 
 b/drivers/media/platform/exynos-mscl/mscl-core.c
 new file mode 100644
 index 000..4a3a851
 --- /dev/null
 +++ b/drivers/media/platform/exynos-mscl/mscl-core.c
 @@ -0,0 +1,1312 @@
 +/*
 + * Copyright (c) 2013 - 2014 Samsung Electronics Co., Ltd.
 + *   http://www.samsung.com
 + *
 + * Samsung EXYNOS5 SoC series M-Scaler driver
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published
 + * by the Free Software Foundation, either version 2 of the License,
 + * or (at your option) any later version.
 + */
 +
 +#include linux/clk.h
 +#include linux/interrupt.h

 [snip]

 +
 +static int __mscl_s_ctrl(struct mscl_ctx *ctx, struct v4l2_ctrl *ctrl)
 +{
 + struct mscl_dev *mscl = ctx-mscl_dev;
 + struct mscl_variant *variant = mscl-variant;
 + unsigned int flags = MSCL_DST_FMT | MSCL_SRC_FMT;
 + int ret = 0;
 +
 + if (ctrl-flags  V4L2_CTRL_FLAG_INACTIVE)
 + return 0;

 Why would you want to do this check?

 Will remove this. seems no such check is required for this driver.


 +
 + switch (ctrl-id) {
 + case V4L2_CID_HFLIP:
 + ctx-hflip = ctrl-val;
 + break;
 +
 + case V4L2_CID_VFLIP:
 + ctx-vflip = ctrl-val;
 + break;
 +
 + case V4L2_CID_ROTATE:
 + if ((ctx-state  flags) == flags) {
 + ret = mscl_check_scaler_ratio(variant,
 + ctx-s_frame.crop.width,
 + ctx-s_frame.crop.height,
 + ctx-d_frame.crop.width,
 + ctx-d_frame.crop.height,
 + ctx-ctrls_mscl.rotate-val);
 +
 + if (ret)
 + return -EINVAL;
 + }

 I think it would be good if the try_ctrl op is implemented so you can call
 VIDIOC_EXT_TRY_CTRLS in the application to check if the ROTATE control can 
 be
 set.

 * @try_ctrl: Test whether the control's value is valid. Only relevant when
 * the usual min/max/step checks are not sufficient.

 As we support only 0,90,270 and the min, max and step can address these 
 values,
 does it really relevant to have try_ctrl op here ???

 Well, you seem to have an additional mscl_check_scaler_ratio check here that 
 can
 make it fail, in other words: the min/max/step checks aren't sufficient.

Ok. Thanks for the explanation. Will implement that.

Regards,
Shaik Ameer Basha


 Regards,

 Hans

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/5] [media] exynos-mscl: Add core functionality for the M-Scaler driver

2013-08-19 Thread Shaik Ameer Basha
This patch adds the core functionality for the M-Scaler driver.

Signed-off-by: Shaik Ameer Basha shaik.am...@samsung.com
---
 drivers/media/platform/exynos-mscl/mscl-core.c | 1312 
 drivers/media/platform/exynos-mscl/mscl-core.h |  549 ++
 2 files changed, 1861 insertions(+)
 create mode 100644 drivers/media/platform/exynos-mscl/mscl-core.c
 create mode 100644 drivers/media/platform/exynos-mscl/mscl-core.h

diff --git a/drivers/media/platform/exynos-mscl/mscl-core.c 
b/drivers/media/platform/exynos-mscl/mscl-core.c
new file mode 100644
index 000..4a3a851
--- /dev/null
+++ b/drivers/media/platform/exynos-mscl/mscl-core.c
@@ -0,0 +1,1312 @@
+/*
+ * Copyright (c) 2013 - 2014 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * Samsung EXYNOS5 SoC series M-Scaler driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 2 of the License,
+ * or (at your option) any later version.
+ */
+
+#include linux/clk.h
+#include linux/interrupt.h
+#include linux/module.h
+#include linux/of_platform.h
+#include linux/pm_runtime.h
+
+#ifdef CONFIG_EXYNOS_IOMMU
+#include asm/dma-iommu.h
+#endif
+
+#include mscl-core.h
+
+#define MSCL_CLOCK_GATE_NAME   mscl
+
+static const struct mscl_fmt mscl_formats[] = {
+   {
+   .name   = YUV 4:2:0 non-contig. 2p, Y/CbCr,
+   .pixelformat= V4L2_PIX_FMT_NV12M,
+   .depth  = { 8, 4 },
+   .color  = MSCL_YUV420,
+   .corder = MSCL_CBCR,
+   .num_planes = 2,
+   .num_comp   = 2,
+   .mscl_color = MSCL_YUV420_2P_Y_UV,
+   .mscl_color_fmt_type = (MSCL_FMT_SRC | MSCL_FMT_DST),
+
+   }, {
+   .name   = YUV 4:2:0 contig. 2p, Y/CbCr,
+   .pixelformat= V4L2_PIX_FMT_NV12,
+   .depth  = { 12 },
+   .color  = MSCL_YUV420,
+   .corder = MSCL_CBCR,
+   .num_planes = 1,
+   .num_comp   = 2,
+   .mscl_color = MSCL_YUV420_2P_Y_UV,
+   .mscl_color_fmt_type = (MSCL_FMT_SRC | MSCL_FMT_DST),
+   }, {
+   .name   = YUV 4:2:0 n.c. 2p, Y/CbCr tiled,
+   .pixelformat= V4L2_PIX_FMT_NV12MT_16X16,
+   .depth  = { 8, 4 },
+   .color  = MSCL_YUV420,
+   .corder = MSCL_CBCR,
+   .num_planes = 2,
+   .num_comp   = 2,
+   .mscl_color = MSCL_YUV420_2P_Y_UV,
+   .mscl_color_fmt_type = (MSCL_FMT_SRC),
+   .is_tiled   = true,
+   }, {
+   .name   = YUV 4:2:2 contig. 2p, Y/CbCr,
+   .pixelformat= V4L2_PIX_FMT_NV16,
+   .depth  = { 16 },
+   .color  = MSCL_YUV422,
+   .corder = MSCL_CBCR,
+   .num_planes = 1,
+   .num_comp   = 2,
+   .mscl_color = MSCL_YUV422_2P_Y_UV,
+   .mscl_color_fmt_type = (MSCL_FMT_SRC | MSCL_FMT_DST),
+   }, {
+   .name   = YUV 4:4:4 contig. 2p, Y/CbCr,
+   .pixelformat= V4L2_PIX_FMT_NV24,
+   .depth  = { 24 },
+   .color  = MSCL_YUV444,
+   .corder = MSCL_CBCR,
+   .num_planes = 1,
+   .num_comp   = 2,
+   .mscl_color = MSCL_YUV444_2P_Y_UV,
+   .mscl_color_fmt_type = (MSCL_FMT_SRC | MSCL_FMT_DST),
+   }, {
+   .name   = RGB565,
+   .pixelformat= V4L2_PIX_FMT_RGB565X,
+   .depth  = { 16 },
+   .color  = MSCL_RGB,
+   .num_planes = 1,
+   .num_comp   = 1,
+   .mscl_color = MSCL_RGB565,
+   .mscl_color_fmt_type = (MSCL_FMT_SRC | MSCL_FMT_DST),
+   }, {
+   .name   = XRGB-1555, 16 bpp,
+   .pixelformat= V4L2_PIX_FMT_RGB555,
+   .depth  = { 16 },
+   .color  = MSCL_RGB,
+   .num_planes = 1,
+   .num_comp   = 1,
+   .mscl_color = MSCL_ARGB1555,
+   .mscl_color_fmt_type = (MSCL_FMT_SRC | MSCL_FMT_DST),
+   }, {
+   .name   = XRGB-, 32 bpp,
+   .pixelformat= V4L2_PIX_FMT_RGB32,
+   .depth  = { 32 },
+   .color  = MSCL_RGB,
+   .num_planes = 1,
+   .num_comp   = 1,
+   .mscl_color = MSCL_ARGB,
+   .mscl_color_fmt_type = (MSCL_FMT_SRC | MSCL_FMT_DST),
+   }, {
+   .name  

Re: [PATCH v2 2/5] [media] exynos-mscl: Add core functionality for the M-Scaler driver

2013-08-19 Thread Hans Verkuil
On 08/19/2013 12:58 PM, Shaik Ameer Basha wrote:
 This patch adds the core functionality for the M-Scaler driver.

Some more comments below...

 
 Signed-off-by: Shaik Ameer Basha shaik.am...@samsung.com
 ---
  drivers/media/platform/exynos-mscl/mscl-core.c | 1312 
 
  drivers/media/platform/exynos-mscl/mscl-core.h |  549 ++
  2 files changed, 1861 insertions(+)
  create mode 100644 drivers/media/platform/exynos-mscl/mscl-core.c
  create mode 100644 drivers/media/platform/exynos-mscl/mscl-core.h
 
 diff --git a/drivers/media/platform/exynos-mscl/mscl-core.c 
 b/drivers/media/platform/exynos-mscl/mscl-core.c
 new file mode 100644
 index 000..4a3a851
 --- /dev/null
 +++ b/drivers/media/platform/exynos-mscl/mscl-core.c
 @@ -0,0 +1,1312 @@
 +/*
 + * Copyright (c) 2013 - 2014 Samsung Electronics Co., Ltd.
 + *   http://www.samsung.com
 + *
 + * Samsung EXYNOS5 SoC series M-Scaler driver
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published
 + * by the Free Software Foundation, either version 2 of the License,
 + * or (at your option) any later version.
 + */
 +
 +#include linux/clk.h
 +#include linux/interrupt.h
 +#include linux/module.h
 +#include linux/of_platform.h
 +#include linux/pm_runtime.h
 +
 +#ifdef CONFIG_EXYNOS_IOMMU
 +#include asm/dma-iommu.h
 +#endif
 +
 +#include mscl-core.h
 +
 +#define MSCL_CLOCK_GATE_NAME mscl
 +
 +static const struct mscl_fmt mscl_formats[] = {
 + {
 + .name   = YUV 4:2:0 non-contig. 2p, Y/CbCr,
 + .pixelformat= V4L2_PIX_FMT_NV12M,
 + .depth  = { 8, 4 },
 + .color  = MSCL_YUV420,
 + .corder = MSCL_CBCR,
 + .num_planes = 2,
 + .num_comp   = 2,
 + .mscl_color = MSCL_YUV420_2P_Y_UV,
 + .mscl_color_fmt_type = (MSCL_FMT_SRC | MSCL_FMT_DST),
 +
 + }, {
 + .name   = YUV 4:2:0 contig. 2p, Y/CbCr,
 + .pixelformat= V4L2_PIX_FMT_NV12,
 + .depth  = { 12 },
 + .color  = MSCL_YUV420,
 + .corder = MSCL_CBCR,
 + .num_planes = 1,
 + .num_comp   = 2,
 + .mscl_color = MSCL_YUV420_2P_Y_UV,
 + .mscl_color_fmt_type = (MSCL_FMT_SRC | MSCL_FMT_DST),
 + }, {
 + .name   = YUV 4:2:0 n.c. 2p, Y/CbCr tiled,
 + .pixelformat= V4L2_PIX_FMT_NV12MT_16X16,
 + .depth  = { 8, 4 },
 + .color  = MSCL_YUV420,
 + .corder = MSCL_CBCR,
 + .num_planes = 2,
 + .num_comp   = 2,
 + .mscl_color = MSCL_YUV420_2P_Y_UV,
 + .mscl_color_fmt_type = (MSCL_FMT_SRC),
 + .is_tiled   = true,
 + }, {
 + .name   = YUV 4:2:2 contig. 2p, Y/CbCr,
 + .pixelformat= V4L2_PIX_FMT_NV16,
 + .depth  = { 16 },
 + .color  = MSCL_YUV422,
 + .corder = MSCL_CBCR,
 + .num_planes = 1,
 + .num_comp   = 2,
 + .mscl_color = MSCL_YUV422_2P_Y_UV,
 + .mscl_color_fmt_type = (MSCL_FMT_SRC | MSCL_FMT_DST),
 + }, {
 + .name   = YUV 4:4:4 contig. 2p, Y/CbCr,
 + .pixelformat= V4L2_PIX_FMT_NV24,
 + .depth  = { 24 },
 + .color  = MSCL_YUV444,
 + .corder = MSCL_CBCR,
 + .num_planes = 1,
 + .num_comp   = 2,
 + .mscl_color = MSCL_YUV444_2P_Y_UV,
 + .mscl_color_fmt_type = (MSCL_FMT_SRC | MSCL_FMT_DST),
 + }, {
 + .name   = RGB565,
 + .pixelformat= V4L2_PIX_FMT_RGB565X,
 + .depth  = { 16 },
 + .color  = MSCL_RGB,
 + .num_planes = 1,
 + .num_comp   = 1,
 + .mscl_color = MSCL_RGB565,
 + .mscl_color_fmt_type = (MSCL_FMT_SRC | MSCL_FMT_DST),
 + }, {
 + .name   = XRGB-1555, 16 bpp,
 + .pixelformat= V4L2_PIX_FMT_RGB555,
 + .depth  = { 16 },
 + .color  = MSCL_RGB,
 + .num_planes = 1,
 + .num_comp   = 1,
 + .mscl_color = MSCL_ARGB1555,
 + .mscl_color_fmt_type = (MSCL_FMT_SRC | MSCL_FMT_DST),
 + }, {
 + .name   = XRGB-, 32 bpp,
 + .pixelformat= V4L2_PIX_FMT_RGB32,
 + .depth  = { 32 },
 + .color  = MSCL_RGB,
 + .num_planes = 1,
 + .num_comp   = 1,
 + .mscl_color = MSCL_ARGB,
 + .mscl_color_fmt_type = (MSCL_FMT_SRC | 

Re: [PATCH v2 2/5] [media] exynos-mscl: Add core functionality for the M-Scaler driver

2013-08-19 Thread Shaik Ameer Basha
+ linux-media, linux-samsung-soc

Hi Hans,

Thanks for the review.
Will address all your comments in v3.

I have only one doubt regarding try_ctrl... (addressed inline)


On Mon, Aug 19, 2013 at 6:36 PM, Hans Verkuil hverk...@xs4all.nl wrote:

 On 08/19/2013 12:58 PM, Shaik Ameer Basha wrote:
  This patch adds the core functionality for the M-Scaler driver.

 Some more comments below...

 
  Signed-off-by: Shaik Ameer Basha shaik.am...@samsung.com
  ---
   drivers/media/platform/exynos-mscl/mscl-core.c | 1312 
  
   drivers/media/platform/exynos-mscl/mscl-core.h |  549 ++
   2 files changed, 1861 insertions(+)
   create mode 100644 drivers/media/platform/exynos-mscl/mscl-core.c
   create mode 100644 drivers/media/platform/exynos-mscl/mscl-core.h
 
  diff --git a/drivers/media/platform/exynos-mscl/mscl-core.c 
  b/drivers/media/platform/exynos-mscl/mscl-core.c
  new file mode 100644
  index 000..4a3a851
  --- /dev/null
  +++ b/drivers/media/platform/exynos-mscl/mscl-core.c
  @@ -0,0 +1,1312 @@
  +/*
  + * Copyright (c) 2013 - 2014 Samsung Electronics Co., Ltd.
  + *   http://www.samsung.com
  + *
  + * Samsung EXYNOS5 SoC series M-Scaler driver
  + *
  + * This program is free software; you can redistribute it and/or modify
  + * it under the terms of the GNU General Public License as published
  + * by the Free Software Foundation, either version 2 of the License,
  + * or (at your option) any later version.
  + */
  +
  +#include linux/clk.h
  +#include linux/interrupt.h

[snip]

  +
  +static int __mscl_s_ctrl(struct mscl_ctx *ctx, struct v4l2_ctrl *ctrl)
  +{
  + struct mscl_dev *mscl = ctx-mscl_dev;
  + struct mscl_variant *variant = mscl-variant;
  + unsigned int flags = MSCL_DST_FMT | MSCL_SRC_FMT;
  + int ret = 0;
  +
  + if (ctrl-flags  V4L2_CTRL_FLAG_INACTIVE)
  + return 0;

 Why would you want to do this check?

Will remove this. seems no such check is required for this driver.


  +
  + switch (ctrl-id) {
  + case V4L2_CID_HFLIP:
  + ctx-hflip = ctrl-val;
  + break;
  +
  + case V4L2_CID_VFLIP:
  + ctx-vflip = ctrl-val;
  + break;
  +
  + case V4L2_CID_ROTATE:
  + if ((ctx-state  flags) == flags) {
  + ret = mscl_check_scaler_ratio(variant,
  + ctx-s_frame.crop.width,
  + ctx-s_frame.crop.height,
  + ctx-d_frame.crop.width,
  + ctx-d_frame.crop.height,
  + ctx-ctrls_mscl.rotate-val);
  +
  + if (ret)
  + return -EINVAL;
  + }

 I think it would be good if the try_ctrl op is implemented so you can call
 VIDIOC_EXT_TRY_CTRLS in the application to check if the ROTATE control can be
 set.

* @try_ctrl: Test whether the control's value is valid. Only relevant when
* the usual min/max/step checks are not sufficient.

As we support only 0,90,270 and the min, max and step can address these values,
does it really relevant to have try_ctrl op here ???

Regards,
Shaik Ameer Basha


  +
  + ctx-rotation = ctrl-val;
  + break;
  +
  + case V4L2_CID_ALPHA_COMPONENT:
  + ctx-d_frame.alpha = ctrl-val;
  + break;
  + }
  +
  + ctx-state |= MSCL_PARAMS;
  + return 0;
  +}
  +
  +static int mscl_s_ctrl(struct v4l2_ctrl *ctrl)
  +{
  + struct mscl_ctx *ctx = ctrl_to_ctx(ctrl);
  + unsigned long flags;
  + int ret;
  +
  + spin_lock_irqsave(ctx-mscl_dev-slock, flags);
  + ret = __mscl_s_ctrl(ctx, ctrl);
  + spin_unlock_irqrestore(ctx-mscl_dev-slock, flags);
  +
  + return ret;
  +}
  +
  +static const struct v4l2_ctrl_ops mscl_ctrl_ops = {
  + .s_ctrl = mscl_s_ctrl,
  +};

 Thanks for the patches!

 Regards,

 Hans
 --
 To unsubscribe from this list: send the line unsubscribe linux-media in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html