Mistake on the colorspace page in the API doc

2013-05-25 Thread Wouter Thielen
Hi all,

I have been trying to get the colors right in the images grabbed from my
webcam, and I tried the color conversion code on
http://linuxtv.org/downloads/v4l-dvb-apis/colorspaces.html.

It turned out to be very white, so I checked out the intermediate steps,
and thought the part:

ER = clamp (r * 255); /* [ok? one should prob. limit y1,pb,pr] */
EG = clamp (g * 255);
EB = clamp (b * 255);


should be without the * 255. I tried removing *255 and that worked.

Regards,

--
Wouter Thielen
http://morannon.org/
--
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 0/4] media: i2c: ths7303 cleanup

2013-05-25 Thread Laurent Pinchart
On Saturday 25 May 2013 23:09:32 Prabhakar Lad wrote:
> From: Lad, Prabhakar 
> 
> Trivial cleanup of the driver.
> 
> Changes for v2:
> 1: Dropped the asynchronous probing and, OF
>support patches will be handling them independently because of
> dependencies. 2: Arranged the patches logically so that git bisect
>succeeds.
> 
> Lad, Prabhakar (4):
>   ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata
>   media: i2c: ths7303: remove init_enable option from pdata
>   media: i2c: ths7303: remove unnecessary function ths7303_setup()
>   media: i2c: ths7303: make the pdata as a constant pointer
> 
>  arch/arm/mach-davinci/board-dm365-evm.c |1 -
>  drivers/media/i2c/ths7303.c |   48 
>  include/media/ths7303.h |2 -
>  3 files changed, 12 insertions(+), 39 deletions(-)

For the whole series,

Acked-by: Laurent Pinchart 

-- 
Regards,

Laurent Pinchart

--
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 4/5] media: davinci: vpif_capture: Convert to devm_* api

2013-05-25 Thread Laurent Pinchart
Hi Prabhakar,

Thank you for the patch.

On Saturday 25 May 2013 22:06:35 Prabhakar Lad wrote:
> From: Lad, Prabhakar 
> 
> use devm_request_irq() instead of request_irq().
> This ensures more consistent error values and simplifies error paths.
> 
> use module_platform_driver to simplify the code.
> 
> Signed-off-by: Lad, Prabhakar 

There's two separate changes in this patch, could you split it in two if you 
resubmit the series ? It would then be good to work on removing the vpif_obj 
and vpif_dev global variables.

Same comment for patch 5/5.

> ---
>  drivers/media/platform/davinci/vpif_capture.c |   73 --
>  1 files changed, 13 insertions(+), 60 deletions(-)
> 
> diff --git a/drivers/media/platform/davinci/vpif_capture.c
> b/drivers/media/platform/davinci/vpif_capture.c index caaf4fe..f37adf1
> 100644
> --- a/drivers/media/platform/davinci/vpif_capture.c
> +++ b/drivers/media/platform/davinci/vpif_capture.c
> @@ -2082,14 +2082,13 @@ static __init int vpif_probe(struct platform_device
> *pdev)
> 
>   while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, res_idx))) {
>   for (i = res->start; i <= res->end; i++) {
> - if (request_irq(i, vpif_channel_isr, IRQF_SHARED,
> - "VPIF_Capture", (void *)
> - (&vpif_obj.dev[res_idx]->channel_id))) {
> - err = -EBUSY;
> - for (j = 0; j < i; j++)
> - free_irq(j, (void *)
> - (&vpif_obj.dev[res_idx]->channel_id));
> - goto vpif_int_err;
> + err = devm_request_irq(&pdev->dev, i, vpif_channel_isr,
> +  IRQF_SHARED, "VPIF_Capture",
> +  (void *)(&vpif_obj.dev[res_idx]->
> +  channel_id));
> + if (err) {
> + err = -EINVAL;
> + goto vpif_unregister;
>   }
>   }
>   res_idx++;
> @@ -2106,7 +2105,7 @@ static __init int vpif_probe(struct platform_device
> *pdev) video_device_release(ch->video_dev);
>   }
>   err = -ENOMEM;
> - goto vpif_int_err;
> + goto vpif_unregister;
>   }
> 
>   /* Initialize field of video device */
> @@ -2207,13 +2206,8 @@ vpif_sd_error:
>   /* Note: does nothing if ch->video_dev == NULL */
>   video_device_release(ch->video_dev);
>   }
> -vpif_int_err:
> +vpif_unregister:
>   v4l2_device_unregister(&vpif_obj.v4l2_dev);
> - for (i = 0; i < res_idx; i++) {
> - res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
> - for (j = res->start; j <= res->end; j++)
> - free_irq(j, (void *)(&vpif_obj.dev[i]->channel_id));
> - }
>   return err;
>  }
> 
> @@ -2229,14 +2223,16 @@ static int vpif_remove(struct platform_device
> *device) struct channel_obj *ch;
> 
>   v4l2_device_unregister(&vpif_obj.v4l2_dev);
> -
> + kfree(vpif_obj.sd);
>   /* un-register device */
>   for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) {
>   /* Get the pointer to the channel object */
>   ch = vpif_obj.dev[i];
>   /* Unregister video device */
>   video_unregister_device(ch->video_dev);
> + kfree(vpif_obj.dev[i]);
>   }
> +
>   return 0;
>  }
> 
> @@ -2326,47 +2322,4 @@ static __refdata struct platform_driver vpif_driver =
> { .remove = vpif_remove,
>  };
> 
> -/**
> - * vpif_init: initialize the vpif driver
> - *
> - * This function registers device and driver to the kernel, requests irq
> - * handler and allocates memory
> - * for channel objects
> - */
> -static __init int vpif_init(void)
> -{
> - return platform_driver_register(&vpif_driver);
> -}
> -
> -/**
> - * vpif_cleanup : This function clean up the vpif capture resources
> - *
> - * This will un-registers device and driver to the kernel, frees
> - * requested irq handler and de-allocates memory allocated for channel
> - * objects.
> - */
> -static void vpif_cleanup(void)
> -{
> - struct platform_device *pdev;
> - struct resource *res;
> - int irq_num;
> - int i = 0;
> -
> - pdev = container_of(vpif_dev, struct platform_device, dev);
> - while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, i))) {
> - for (irq_num = res->start; irq_num <= res->end; irq_num++)
> - free_irq(irq_num,
> -  (void *)(&vpif_obj.dev[i]->channel_id));
> - i++;
> - }
> -
> - platform_driver_unregister(&vpif_driver);
> -
> - kfree(vpif_obj.sd);
> - for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++)
> - kfree(vpif_obj.d

Re: [PATCH v2 3/5] media: davinci: vpif: remove unnecessary braces around defines

2013-05-25 Thread Laurent Pinchart
Hi Prabhakar,

Thank you for the patch.

On Saturday 25 May 2013 22:06:34 Prabhakar Lad wrote:
> From: Lad, Prabhakar 
> 
> Signed-off-by: Lad, Prabhakar 
> ---
>  drivers/media/platform/davinci/vpif.c |8 
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/davinci/vpif.c
> b/drivers/media/platform/davinci/vpif.c index 164c1b7..d9269c9 100644
> --- a/drivers/media/platform/davinci/vpif.c
> +++ b/drivers/media/platform/davinci/vpif.c
> @@ -32,10 +32,10 @@
>  MODULE_DESCRIPTION("TI DaVinci Video Port Interface driver");
>  MODULE_LICENSE("GPL");
> 
> -#define VPIF_CH0_MAX_MODES   (22)
> -#define VPIF_CH1_MAX_MODES   (02)
> -#define VPIF_CH2_MAX_MODES   (15)
> -#define VPIF_CH3_MAX_MODES   (02)
> +#define VPIF_CH0_MAX_MODES   22
> +#define VPIF_CH1_MAX_MODES   02
> +#define VPIF_CH2_MAX_MODES   15
> +#define VPIF_CH3_MAX_MODES   02

Could you also replace 02 with 2 while you're at it ? 02 is an octal constant. 
While it still evaluates to 2 in this case, it would be a good practice to use 
decimal when decimal is intended.

With that change,

Laurent Pinchart 

>  spinlock_t vpif_lock;
-- 
Regards,

Laurent Pinchart

--
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 1/5] media: davinci: vpif: remove unwanted header mach/hardware.h and sort the includes alphabetically

2013-05-25 Thread Laurent Pinchart
Hi Prabhakar,

Thank you for the patch.

On Saturday 25 May 2013 22:06:32 Prabhakar Lad wrote:
> From: Lad, Prabhakar 
> 
> This patch removes unwanted header include of mach/hardware.h
> and along side sorts the header inclusion alphabetically.
> 
> Signed-off-by: Lad, Prabhakar 

Acked-by: Laurent Pinchart 

> ---
>  drivers/media/platform/davinci/vpif.c |   10 --
>  1 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/platform/davinci/vpif.c
> b/drivers/media/platform/davinci/vpif.c index ea82a8b..761c825 100644
> --- a/drivers/media/platform/davinci/vpif.c
> +++ b/drivers/media/platform/davinci/vpif.c
> @@ -17,18 +17,16 @@
>   * GNU General Public License for more details.
>   */
> 
> +#include 
>  #include 
> +#include 
> +#include 
>  #include 
>  #include 
> -#include 
> -#include 
> -#include 
> -#include 
>  #include 
> +#include 
>  #include 
> 
> -#include 
> -
>  #include "vpif.h"
> 
>  MODULE_DESCRIPTION("TI DaVinci Video Port Interface driver");
-- 
Regards,

Laurent Pinchart

--
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: davinci: vpif: Convert to devm_* api

2013-05-25 Thread Laurent Pinchart
Hi Prabhakar,

Thank you for the patch.

On Saturday 25 May 2013 22:06:33 Prabhakar Lad wrote:
> From: Lad, Prabhakar 
> 
> Use devm_ioremap_resource instead of reques_mem_region()/ioremap().
> This ensures more consistent error values and simplifies error paths.
> 
> Signed-off-by: Lad, Prabhakar 
> ---
>  drivers/media/platform/davinci/vpif.c |   27 ---
>  1 files changed, 4 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/media/platform/davinci/vpif.c
> b/drivers/media/platform/davinci/vpif.c index 761c825..164c1b7 100644
> --- a/drivers/media/platform/davinci/vpif.c
> +++ b/drivers/media/platform/davinci/vpif.c
> @@ -37,8 +37,6 @@ MODULE_LICENSE("GPL");
>  #define VPIF_CH2_MAX_MODES   (15)
>  #define VPIF_CH3_MAX_MODES   (02)
> 
> -static resource_size_t   res_len;
> -static struct resource   *res;
>  spinlock_t vpif_lock;
> 
>  void __iomem *vpif_base;
> @@ -421,23 +419,12 @@ EXPORT_SYMBOL(vpif_channel_getfid);
> 
>  static int vpif_probe(struct platform_device *pdev)
>  {
> - int status = 0;
> + static struct resource  *res;
> 
>   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!res)
> - return -ENOENT;
> -
> - res_len = resource_size(res);
> -
> - res = request_mem_region(res->start, res_len, res->name);
> - if (!res)
> - return -EBUSY;
> -
> - vpif_base = ioremap(res->start, res_len);
> - if (!vpif_base) {
> - status = -EBUSY;
> - goto fail;
> - }
> + vpif_base = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(vpif_base))
> + return PTR_ERR(vpif_base);

You're loosing the request_mem_region(). You should use 
devm_request_and_ioremap() function instead of devm_ioremap_resource(). With 
that change,

Acked-by: Laurent Pinchart 

>   pm_runtime_enable(&pdev->dev);
>   pm_runtime_get(&pdev->dev);
> @@ -445,17 +432,11 @@ static int vpif_probe(struct platform_device *pdev)
>   spin_lock_init(&vpif_lock);
>   dev_info(&pdev->dev, "vpif probe success\n");
>   return 0;
> -
> -fail:
> - release_mem_region(res->start, res_len);
> - return status;
>  }
> 
>  static int vpif_remove(struct platform_device *pdev)
>  {
>   pm_runtime_disable(&pdev->dev);
> - iounmap(vpif_base);
> - release_mem_region(res->start, res_len);
>   return 0;
>  }
-- 
Regards,

Laurent Pinchart

--
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


cron job: media_tree daily build: WARNINGS

2013-05-25 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Sat May 25 19:00:22 CEST 2013
git branch: test
git hash:   6a084d6b3dc200b855ae8a3c6771abe285a3835d
gcc version:i686-linux-gcc (GCC) 4.8.0
host hardware:  x86_64
host os:3.8-3.slh.2-amd64

linux-git-arm-davinci: OK
linux-git-arm-exynos: WARNINGS
linux-git-arm-omap: WARNINGS
linux-git-blackfin: WARNINGS
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.31.14-i686: WARNINGS
linux-2.6.32.27-i686: WARNINGS
linux-2.6.33.7-i686: WARNINGS
linux-2.6.34.7-i686: WARNINGS
linux-2.6.35.9-i686: WARNINGS
linux-2.6.36.4-i686: WARNINGS
linux-2.6.37.6-i686: WARNINGS
linux-2.6.38.8-i686: WARNINGS
linux-2.6.39.4-i686: WARNINGS
linux-3.0.60-i686: WARNINGS
linux-3.10-rc1-i686: WARNINGS
linux-3.1.10-i686: WARNINGS
linux-3.2.37-i686: WARNINGS
linux-3.3.8-i686: WARNINGS
linux-3.4.27-i686: WARNINGS
linux-3.5.7-i686: WARNINGS
linux-3.6.11-i686: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-2.6.31.14-x86_64: WARNINGS
linux-2.6.32.27-x86_64: WARNINGS
linux-2.6.33.7-x86_64: WARNINGS
linux-2.6.34.7-x86_64: WARNINGS
linux-2.6.35.9-x86_64: WARNINGS
linux-2.6.36.4-x86_64: WARNINGS
linux-2.6.37.6-x86_64: WARNINGS
linux-2.6.38.8-x86_64: WARNINGS
linux-2.6.39.4-x86_64: WARNINGS
linux-3.0.60-x86_64: WARNINGS
linux-3.10-rc1-x86_64: WARNINGS
linux-3.1.10-x86_64: WARNINGS
linux-3.2.37-x86_64: WARNINGS
linux-3.3.8-x86_64: WARNINGS
linux-3.4.27-x86_64: WARNINGS
linux-3.5.7-x86_64: WARNINGS
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
apps: WARNINGS
spec-git: OK
sparse: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Saturday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Saturday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.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


Re: [PATCH RFC v2] media: OF: add sync-on-green endpoint property

2013-05-25 Thread Sylwester Nawrocki

On 05/25/2013 04:26 PM, Prabhakar Lad wrote:

Thus it might make sense to have only following integer properties (added
>  as needed):
>
>  composite-sync-active
>  sync-on-green-active
>  sync-on-comp-active
>  sync-on-luma-active
>
>  This would allow to specify polarity of each signal and at the same time
>  the parsing code could derive synchronisation type. A new field could be
>  added to struct v4l2_of_parallel_bus, e.g. sync_type and it would be filled
>  within v4l2_of_parse_endpoint().
>

I am OK with this option. and I hope you meant "struct
v4l2_of_bus_parallel" instead
of " struct v4l2_of_parallel_bus" and to fill sync_type within
v4l2_of_parse_parallel_bus()
and not in v4l2_of_parse_endpoint().


Yes, that's what I meant, sorry for this confusion.

Regards,
Sylwester
--
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 1/4] ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata

2013-05-25 Thread Prabhakar Lad
Hi Sekhar,

On Sat, May 25, 2013 at 11:09 PM, Prabhakar Lad
 wrote:
> From: Lad, Prabhakar 
>
> remove init_enable from ths7303 pdata as it is being dropped
> from ths7303_platform_data.
>
Can you please ack this patch as I intend to take this patch via media
tree.

Regards,
--Prabhakar Lad
--
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/4] media: i2c: ths7303: remove init_enable option from pdata

2013-05-25 Thread Prabhakar Lad
From: Lad, Prabhakar 

This patch removes init_enable option from pdata, the init_enable
was intended that the device should start streaming video immediately
but ideally the bridge drivers should call s_stream explicitly for such
devices to start video.

Signed-off-by: Lad, Prabhakar 
Cc: Hans Verkuil 
Cc: Laurent Pinchart 
Cc: Mauro Carvalho Chehab 
Cc: linux-ker...@vger.kernel.org
Cc: davinci-linux-open-sou...@linux.davincidsp.com
---
 drivers/media/i2c/ths7303.c |4 +---
 include/media/ths7303.h |2 --
 2 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/ths7303.c b/drivers/media/i2c/ths7303.c
index 65853ee..8cddcd0 100644
--- a/drivers/media/i2c/ths7303.c
+++ b/drivers/media/i2c/ths7303.c
@@ -356,9 +356,7 @@ static int ths7303_setup(struct v4l2_subdev *sd)
int ret;
u8 mask;
 
-   state->stream_on = pdata->init_enable;
-
-   mask = state->stream_on ? 0xff : 0xf8;
+   mask = 0xf8;
 
ret = ths7303_write(sd, THS7303_CHANNEL_1, pdata->ch_1 & mask);
if (ret)
diff --git a/include/media/ths7303.h b/include/media/ths7303.h
index 980ec51..a7b4929 100644
--- a/include/media/ths7303.h
+++ b/include/media/ths7303.h
@@ -30,13 +30,11 @@
  * @ch_1: Bias value for channel one.
  * @ch_2: Bias value for channel two.
  * @ch_3: Bias value for channel three.
- * @init_enable: initalize on init.
  */
 struct ths7303_platform_data {
u8 ch_1;
u8 ch_2;
u8 ch_3;
-   u8 init_enable;
 };
 
 #endif
-- 
1.7.0.4

--
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 1/4] ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata

2013-05-25 Thread Prabhakar Lad
From: Lad, Prabhakar 

remove init_enable from ths7303 pdata as it is being dropped
from ths7303_platform_data.

Signed-off-by: Lad, Prabhakar 
Cc: Sekhar Nori 
Cc: Hans Verkuil 
Cc: Laurent Pinchart 
Cc: Mauro Carvalho Chehab 
Cc: linux-ker...@vger.kernel.org
Cc: davinci-linux-open-sou...@linux.davincidsp.com
---
 arch/arm/mach-davinci/board-dm365-evm.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm365-evm.c 
b/arch/arm/mach-davinci/board-dm365-evm.c
index fd38c8d..afbc439 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -509,7 +509,6 @@ struct ths7303_platform_data ths7303_pdata = {
.ch_1 = 3,
.ch_2 = 3,
.ch_3 = 3,
-   .init_enable = 1,
 };
 
 static struct amp_config_info vpbe_amp = {
-- 
1.7.0.4

--
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 0/4] media: i2c: ths7303 cleanup

2013-05-25 Thread Prabhakar Lad
From: Lad, Prabhakar 

Trivial cleanup of the driver.

Changes for v2:
1: Dropped the asynchronous probing and, OF
   support patches will be handling them independently because of dependencies.
2: Arranged the patches logically so that git bisect 
   succeeds.

Lad, Prabhakar (4):
  ARM: davinci: dm365 evm: remove init_enable from ths7303 pdata
  media: i2c: ths7303: remove init_enable option from pdata
  media: i2c: ths7303: remove unnecessary function ths7303_setup()
  media: i2c: ths7303: make the pdata as a constant pointer

 arch/arm/mach-davinci/board-dm365-evm.c |1 -
 drivers/media/i2c/ths7303.c |   48 ---
 include/media/ths7303.h |2 -
 3 files changed, 12 insertions(+), 39 deletions(-)

--
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 3/4] media: i2c: ths7303: remove unnecessary function ths7303_setup()

2013-05-25 Thread Prabhakar Lad
From: Lad, Prabhakar 

the ths7303_setup() was doing the same thing as ths7303_setval()
except that ths7303_setval() sets it to some particular mode.
This patch removes ths7303_setup() function and calls ths7303_setval()
in the probe setting the device to 480I_576I filter mode in the probe.

Signed-off-by: Lad, Prabhakar 
Cc: Hans Verkuil 
Cc: Laurent Pinchart 
Cc: Mauro Carvalho Chehab 
Cc: linux-ker...@vger.kernel.org
Cc: davinci-linux-open-sou...@linux.davincidsp.com
---
 drivers/media/i2c/ths7303.c |   31 ---
 1 files changed, 4 insertions(+), 27 deletions(-)

diff --git a/drivers/media/i2c/ths7303.c b/drivers/media/i2c/ths7303.c
index 8cddcd0..af06187 100644
--- a/drivers/media/i2c/ths7303.c
+++ b/drivers/media/i2c/ths7303.c
@@ -349,30 +349,6 @@ static const struct v4l2_subdev_ops ths7303_ops = {
.video  = &ths7303_video_ops,
 };
 
-static int ths7303_setup(struct v4l2_subdev *sd)
-{
-   struct ths7303_state *state = to_state(sd);
-   struct ths7303_platform_data *pdata = &state->pdata;
-   int ret;
-   u8 mask;
-
-   mask = 0xf8;
-
-   ret = ths7303_write(sd, THS7303_CHANNEL_1, pdata->ch_1 & mask);
-   if (ret)
-   return ret;
-
-   ret = ths7303_write(sd, THS7303_CHANNEL_2, pdata->ch_2 & mask);
-   if (ret)
-   return ret;
-
-   ret = ths7303_write(sd, THS7303_CHANNEL_3, pdata->ch_3 & mask);
-   if (ret)
-   return ret;
-
-   return 0;
-}
-
 static int ths7303_probe(struct i2c_client *client,
const struct i2c_device_id *id)
 {
@@ -402,9 +378,10 @@ static int ths7303_probe(struct i2c_client *client,
/* store the driver data to differntiate the chip */
state->driver_data = (int)id->driver_data;
 
-   if (ths7303_setup(sd) < 0) {
-   v4l_err(client, "init failed\n");
-   return -EIO;
+   /* set to default 480I_576I filter mode */
+   if (ths7303_setval(sd, THS7303_FILTER_MODE_480I_576I) < 0) {
+   v4l_err(client, "Setting to 480I_576I filter mode failed!\n");
+   return -EINVAL;
}
 
return 0;
-- 
1.7.0.4

--
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 4/4] media: i2c: ths7303: make the pdata as a constant pointer

2013-05-25 Thread Prabhakar Lad
From: Lad, Prabhakar 

generally the pdata needs to be a constant pointer in the device
state structure. This patch makes the pdata as a constant pointer
and alongside returns -EINVAL when pdata is NULL.

Signed-off-by: Lad, Prabhakar 
Cc: Hans Verkuil 
Cc: Laurent Pinchart 
Cc: Mauro Carvalho Chehab 
Cc: linux-ker...@vger.kernel.org
Cc: davinci-linux-open-sou...@linux.davincidsp.com
---
 drivers/media/i2c/ths7303.c |   15 ---
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/media/i2c/ths7303.c b/drivers/media/i2c/ths7303.c
index af06187..b954195 100644
--- a/drivers/media/i2c/ths7303.c
+++ b/drivers/media/i2c/ths7303.c
@@ -35,7 +35,7 @@
 
 struct ths7303_state {
struct v4l2_subdev  sd;
-   struct ths7303_platform_datapdata;
+   const struct ths7303_platform_data *pdata;
struct v4l2_bt_timings  bt;
int std_id;
int stream_on;
@@ -89,7 +89,7 @@ int ths7303_setval(struct v4l2_subdev *sd, enum 
ths7303_filter_mode mode)
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct ths7303_state *state = to_state(sd);
-   struct ths7303_platform_data *pdata = &state->pdata;
+   const struct ths7303_platform_data *pdata = state->pdata;
u8 val, sel = 0;
int err, disable = 0;
 
@@ -356,6 +356,11 @@ static int ths7303_probe(struct i2c_client *client,
struct ths7303_state *state;
struct v4l2_subdev *sd;
 
+   if (pdata == NULL) {
+   dev_err(&client->dev, "No platform data\n");
+   return -EINVAL;
+   }
+
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -ENODEV;
 
@@ -367,11 +372,7 @@ static int ths7303_probe(struct i2c_client *client,
if (!state)
return -ENOMEM;
 
-   if (!pdata)
-   v4l_warn(client, "No platform data, using default data!\n");
-   else
-   state->pdata = *pdata;
-
+   state->pdata = pdata;
sd = &state->sd;
v4l2_i2c_subdev_init(sd, client, &ths7303_ops);
 
-- 
1.7.0.4

--
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: InstantFM

2013-05-25 Thread Patrice Levesque

> This, as well as the "Invalid freq '12715'" and the "get_baseline:
> min=65535.00 max=65535.00" messages seem to indicate that only
>  is being read from all the registers of the tuner chip, so
> somehow the communication between the usb micro-controller and the
> si470x tuner chip is not working.

A disconnect-connect of the USB device reset its internal state and now
I can confirm the device properly works with the 3.9.3-gentoo kernel,
using the 3.103 version of xawtv.

Under the same kernel, the 3.95-r2 xawtv version shipped with gentoo
fails to detect signal: “radio -i -d” outputs no channel and shows
“get_baseline: min=0.00 max=0.00”.


Thanks for your good work on this, you know who you are,



-- 
 --|--
|
Patrice Levesque
 http://ptaff.ca/
video4linux.wa...@ptaff.ca
|
 --|--
--


signature.asc
Description: Digital signature


[PATCH v2 5/5] media: davinci: vpif_display: Convert to devm_* api

2013-05-25 Thread Prabhakar Lad
From: Lad, Prabhakar 

use devm_request_irq() instead of request_irq().
This ensures more consistent error values and simplifies error paths.

use module_platform_driver to simplify the code.

Signed-off-by: Lad, Prabhakar 
---
 drivers/media/platform/davinci/vpif_display.c |   61 +
 1 files changed, 12 insertions(+), 49 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_display.c 
b/drivers/media/platform/davinci/vpif_display.c
index 5b6f906..1bb24cb 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -1718,15 +1718,14 @@ static __init int vpif_probe(struct platform_device 
*pdev)
 
while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, res_idx))) {
for (i = res->start; i <= res->end; i++) {
-   if (request_irq(i, vpif_channel_isr, IRQF_SHARED,
-   "VPIF_Display", (void *)
-   (&vpif_obj.dev[res_idx]->channel_id))) {
-   err = -EBUSY;
-   for (j = 0; j < i; j++)
-   free_irq(j, (void *)
-   (&vpif_obj.dev[res_idx]->channel_id));
+   err = devm_request_irq(&pdev->dev, i, vpif_channel_isr,
+IRQF_SHARED, "VPIF_Display",
+(void *)(&vpif_obj.dev[res_idx]->
+channel_id));
+   if (err) {
+   err = -EINVAL;
vpif_err("VPIF IRQ request failed\n");
-   goto vpif_int_err;
+   goto vpif_unregister;
}
}
res_idx++;
@@ -1744,7 +1743,7 @@ static __init int vpif_probe(struct platform_device *pdev)
video_device_release(ch->video_dev);
}
err = -ENOMEM;
-   goto vpif_int_err;
+   goto vpif_unregister;
}
 
/* Initialize field of video device */
@@ -1878,13 +1877,8 @@ vpif_sd_error:
/* Note: does nothing if ch->video_dev == NULL */
video_device_release(ch->video_dev);
}
-vpif_int_err:
+vpif_unregister:
v4l2_device_unregister(&vpif_obj.v4l2_dev);
-   for (i = 0; i < res_idx; i++) {
-   res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
-   for (j = res->start; j <= res->end; j++)
-   free_irq(j, (void *)(&vpif_obj.dev[i]->channel_id));
-   }
 
return err;
 }
@@ -1899,6 +1893,7 @@ static int vpif_remove(struct platform_device *device)
 
v4l2_device_unregister(&vpif_obj.v4l2_dev);
 
+   kfree(vpif_obj.sd);
/* un-register device */
for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) {
/* Get the pointer to the channel object */
@@ -1907,6 +1902,7 @@ static int vpif_remove(struct platform_device *device)
video_unregister_device(ch->video_dev);
 
ch->video_dev = NULL;
+   kfree(vpif_obj.dev[i]);
}
 
return 0;
@@ -1992,37 +1988,4 @@ static __refdata struct platform_driver vpif_driver = {
.remove = vpif_remove,
 };
 
-static __init int vpif_init(void)
-{
-   return platform_driver_register(&vpif_driver);
-}
-
-/*
- * vpif_cleanup: This function un-registers device and driver to the kernel,
- * frees requested irq handler and de-allocates memory allocated for channel
- * objects.
- */
-static void vpif_cleanup(void)
-{
-   struct platform_device *pdev;
-   struct resource *res;
-   int irq_num;
-   int i = 0;
-
-   pdev = container_of(vpif_dev, struct platform_device, dev);
-
-   while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, i))) {
-   for (irq_num = res->start; irq_num <= res->end; irq_num++)
-   free_irq(irq_num,
-(void *)(&vpif_obj.dev[i]->channel_id));
-   i++;
-   }
-
-   platform_driver_unregister(&vpif_driver);
-   kfree(vpif_obj.sd);
-   for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++)
-   kfree(vpif_obj.dev[i]);
-}
-
-module_init(vpif_init);
-module_exit(vpif_cleanup);
+module_platform_driver(vpif_driver);
-- 
1.7.0.4

--
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 3/5] media: davinci: vpif: remove unnecessary braces around defines

2013-05-25 Thread Prabhakar Lad
From: Lad, Prabhakar 

Signed-off-by: Lad, Prabhakar 
---
 drivers/media/platform/davinci/vpif.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif.c 
b/drivers/media/platform/davinci/vpif.c
index 164c1b7..d9269c9 100644
--- a/drivers/media/platform/davinci/vpif.c
+++ b/drivers/media/platform/davinci/vpif.c
@@ -32,10 +32,10 @@
 MODULE_DESCRIPTION("TI DaVinci Video Port Interface driver");
 MODULE_LICENSE("GPL");
 
-#define VPIF_CH0_MAX_MODES (22)
-#define VPIF_CH1_MAX_MODES (02)
-#define VPIF_CH2_MAX_MODES (15)
-#define VPIF_CH3_MAX_MODES (02)
+#define VPIF_CH0_MAX_MODES 22
+#define VPIF_CH1_MAX_MODES 02
+#define VPIF_CH2_MAX_MODES 15
+#define VPIF_CH3_MAX_MODES 02
 
 spinlock_t vpif_lock;
 
-- 
1.7.0.4

--
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 4/5] media: davinci: vpif_capture: Convert to devm_* api

2013-05-25 Thread Prabhakar Lad
From: Lad, Prabhakar 

use devm_request_irq() instead of request_irq().
This ensures more consistent error values and simplifies error paths.

use module_platform_driver to simplify the code.

Signed-off-by: Lad, Prabhakar 
---
 drivers/media/platform/davinci/vpif_capture.c |   73 +
 1 files changed, 13 insertions(+), 60 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c 
b/drivers/media/platform/davinci/vpif_capture.c
index caaf4fe..f37adf1 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -2082,14 +2082,13 @@ static __init int vpif_probe(struct platform_device 
*pdev)
 
while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, res_idx))) {
for (i = res->start; i <= res->end; i++) {
-   if (request_irq(i, vpif_channel_isr, IRQF_SHARED,
-   "VPIF_Capture", (void *)
-   (&vpif_obj.dev[res_idx]->channel_id))) {
-   err = -EBUSY;
-   for (j = 0; j < i; j++)
-   free_irq(j, (void *)
-   (&vpif_obj.dev[res_idx]->channel_id));
-   goto vpif_int_err;
+   err = devm_request_irq(&pdev->dev, i, vpif_channel_isr,
+IRQF_SHARED, "VPIF_Capture",
+(void *)(&vpif_obj.dev[res_idx]->
+channel_id));
+   if (err) {
+   err = -EINVAL;
+   goto vpif_unregister;
}
}
res_idx++;
@@ -2106,7 +2105,7 @@ static __init int vpif_probe(struct platform_device *pdev)
video_device_release(ch->video_dev);
}
err = -ENOMEM;
-   goto vpif_int_err;
+   goto vpif_unregister;
}
 
/* Initialize field of video device */
@@ -2207,13 +2206,8 @@ vpif_sd_error:
/* Note: does nothing if ch->video_dev == NULL */
video_device_release(ch->video_dev);
}
-vpif_int_err:
+vpif_unregister:
v4l2_device_unregister(&vpif_obj.v4l2_dev);
-   for (i = 0; i < res_idx; i++) {
-   res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
-   for (j = res->start; j <= res->end; j++)
-   free_irq(j, (void *)(&vpif_obj.dev[i]->channel_id));
-   }
return err;
 }
 
@@ -2229,14 +2223,16 @@ static int vpif_remove(struct platform_device *device)
struct channel_obj *ch;
 
v4l2_device_unregister(&vpif_obj.v4l2_dev);
-
+   kfree(vpif_obj.sd);
/* un-register device */
for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) {
/* Get the pointer to the channel object */
ch = vpif_obj.dev[i];
/* Unregister video device */
video_unregister_device(ch->video_dev);
+   kfree(vpif_obj.dev[i]);
}
+
return 0;
 }
 
@@ -2326,47 +2322,4 @@ static __refdata struct platform_driver vpif_driver = {
.remove = vpif_remove,
 };
 
-/**
- * vpif_init: initialize the vpif driver
- *
- * This function registers device and driver to the kernel, requests irq
- * handler and allocates memory
- * for channel objects
- */
-static __init int vpif_init(void)
-{
-   return platform_driver_register(&vpif_driver);
-}
-
-/**
- * vpif_cleanup : This function clean up the vpif capture resources
- *
- * This will un-registers device and driver to the kernel, frees
- * requested irq handler and de-allocates memory allocated for channel
- * objects.
- */
-static void vpif_cleanup(void)
-{
-   struct platform_device *pdev;
-   struct resource *res;
-   int irq_num;
-   int i = 0;
-
-   pdev = container_of(vpif_dev, struct platform_device, dev);
-   while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, i))) {
-   for (irq_num = res->start; irq_num <= res->end; irq_num++)
-   free_irq(irq_num,
-(void *)(&vpif_obj.dev[i]->channel_id));
-   i++;
-   }
-
-   platform_driver_unregister(&vpif_driver);
-
-   kfree(vpif_obj.sd);
-   for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++)
-   kfree(vpif_obj.dev[i]);
-}
-
-/* Function for module initialization and cleanup */
-module_init(vpif_init);
-module_exit(vpif_cleanup);
+module_platform_driver(vpif_driver);
-- 
1.7.0.4

--
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: davinci: vpif: Convert to devm_* api

2013-05-25 Thread Prabhakar Lad
From: Lad, Prabhakar 

Use devm_ioremap_resource instead of reques_mem_region()/ioremap().
This ensures more consistent error values and simplifies error paths.

Signed-off-by: Lad, Prabhakar 
---
 drivers/media/platform/davinci/vpif.c |   27 ---
 1 files changed, 4 insertions(+), 23 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif.c 
b/drivers/media/platform/davinci/vpif.c
index 761c825..164c1b7 100644
--- a/drivers/media/platform/davinci/vpif.c
+++ b/drivers/media/platform/davinci/vpif.c
@@ -37,8 +37,6 @@ MODULE_LICENSE("GPL");
 #define VPIF_CH2_MAX_MODES (15)
 #define VPIF_CH3_MAX_MODES (02)
 
-static resource_size_t res_len;
-static struct resource *res;
 spinlock_t vpif_lock;
 
 void __iomem *vpif_base;
@@ -421,23 +419,12 @@ EXPORT_SYMBOL(vpif_channel_getfid);
 
 static int vpif_probe(struct platform_device *pdev)
 {
-   int status = 0;
+   static struct resource  *res;
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!res)
-   return -ENOENT;
-
-   res_len = resource_size(res);
-
-   res = request_mem_region(res->start, res_len, res->name);
-   if (!res)
-   return -EBUSY;
-
-   vpif_base = ioremap(res->start, res_len);
-   if (!vpif_base) {
-   status = -EBUSY;
-   goto fail;
-   }
+   vpif_base = devm_ioremap_resource(&pdev->dev, res);
+   if (IS_ERR(vpif_base))
+   return PTR_ERR(vpif_base);
 
pm_runtime_enable(&pdev->dev);
pm_runtime_get(&pdev->dev);
@@ -445,17 +432,11 @@ static int vpif_probe(struct platform_device *pdev)
spin_lock_init(&vpif_lock);
dev_info(&pdev->dev, "vpif probe success\n");
return 0;
-
-fail:
-   release_mem_region(res->start, res_len);
-   return status;
 }
 
 static int vpif_remove(struct platform_device *pdev)
 {
pm_runtime_disable(&pdev->dev);
-   iounmap(vpif_base);
-   release_mem_region(res->start, res_len);
return 0;
 }
 
-- 
1.7.0.4

--
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 1/5] media: davinci: vpif: remove unwanted header mach/hardware.h and sort the includes alphabetically

2013-05-25 Thread Prabhakar Lad
From: Lad, Prabhakar 

This patch removes unwanted header include of mach/hardware.h
and along side sorts the header inclusion alphabetically.

Signed-off-by: Lad, Prabhakar 
---
 drivers/media/platform/davinci/vpif.c |   10 --
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif.c 
b/drivers/media/platform/davinci/vpif.c
index ea82a8b..761c825 100644
--- a/drivers/media/platform/davinci/vpif.c
+++ b/drivers/media/platform/davinci/vpif.c
@@ -17,18 +17,16 @@
  * GNU General Public License for more details.
  */
 
+#include 
 #include 
+#include 
+#include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
 #include 
+#include 
 #include 
 
-#include 
-
 #include "vpif.h"
 
 MODULE_DESCRIPTION("TI DaVinci Video Port Interface driver");
-- 
1.7.0.4

--
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 0/5] media: davinci: vpif trivial cleanup

2013-05-25 Thread Prabhakar Lad
From: Lad, Prabhakar 

This patch series cleans the VPIF driver, uses devm_* api wherever
required and uses module_platform_driver() to simplify the code.

This patch series applies on http://git.linuxtv.org/hverkuil/media_tree.git/
shortlog/refs/heads/for-v3.11 and is tested on OMAP-L138.

Changes for v2:
1: Rebased on v3.11 branch of Hans.
2: Dropped the patches which removed headers as mentioned by Laurent.

Lad, Prabhakar (5):
  media: davinci: vpif: remove unwanted header mach/hardware.h and sort
the includes alphabetically
  media: davinci: vpif: Convert to devm_* api
  media: davinci: vpif: remove unnecessary braces around defines
  media: davinci: vpif_capture: Convert to devm_* api
  media: davinci: vpif_display: Convert to devm_* api

 drivers/media/platform/davinci/vpif.c |   45 ---
 drivers/media/platform/davinci/vpif_capture.c |   73 +
 drivers/media/platform/davinci/vpif_display.c |   61 -
 3 files changed, 37 insertions(+), 142 deletions(-)

--
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 RFC v2] media: OF: add sync-on-green endpoint property

2013-05-25 Thread Prabhakar Lad
Hi Sylwester,

On Sat, May 25, 2013 at 7:41 PM, Sylwester Nawrocki
 wrote:
> Hi,
>
>
> On 05/25/2013 11:17 AM, Prabhakar Lad wrote:
>>>
>>>  From looking at Figure 8 "TVP7002 Application Example" in the TVP7002's
>>> >  datasheet
>>> >  ([2], p. 52) and your initial TVP7002 patches it looks like what you
>>> > want is
>>> >  to
>>> >  specify polarity of the SOGOUT signal, so the processor that receives
>>> > this
>>> >  signal
>>> >  can properly interpret it, is it correct ?
>>> >
>>
>> Yes
>>>
>>> >  If so then wouldn't it be more appropriate to define e.g. 'sog-active'
>>> >  property
>>> >  and media bus flags:
>>> >   V4L2_MBUS_SYNC_ON_GREEN_ACTIVE_LOW
>>> >   V4L2_MBUS_SYNC_ON_GREEN_ACTIVE_HIGH
>>> >  ?
>>> >
>>
>> Agreed I'll add these flags.
>>
>>> >  And for synchronisation method on the analog part we could perhaps
>>> > define
>>> >  'component-sync' or similar property that would enumerate all possible
>>> >  synchronisation methods. We might as well use separate boolean
>>> > properties,
>>> >  but I'm a bit concerned about the increasing number of properties that
>>> > need
>>> >  to be parsed for each parallel video bus "endpoint".
>>> >
>>
>> I am not clear on it can please elaborate more on this.
>
>
> I thought about two possible options:
>
> 1. single property 'component-sync' or 'video-sync' that would have values:
>
> #define VIDEO_SEPARATE_SYNC 0x01
> #define VIDEO_COMPOSITE_SYNC0x02
> #define VIDEO_SYNC_ON_COMPOSITE 0x04
> #define VIDEO_SYNC_ON_GREEN 0x08
> #define VIDEO_SYNC_ON_LUMINANCE 0x10
>
> And we could put these definitions into a separate header, e.g.
> 
>
> Then in a device tree source file one could have, e.g.
>
> video-sync = ;
>
>
> 2. Separate boolean property for each video sync type, e.g.
>
> "video-composite-sync"
> "video-sync-on-composite"
> "video-sync-on-green"
> "video-sync-on-luminance"
>
> Separate sync, with separate VSYNC, HSYNC lines, would be the default, when
> none of the above is specified and 'vsync-active', 'hsync-active' properties
> are present.
>
> However, I suppose the better would be to deduce the video synchronisation
> method from the sync signal polarity flags. Then, for instance, when an
> endpoint node contains "composite-sync-active" property the parser would
> determine the "composite sync" synchronisation type is used.
>
> Thus it might make sense to have only following integer properties (added
> as needed):
>
> composite-sync-active
> sync-on-green-active
> sync-on-comp-active
> sync-on-luma-active
>
> This would allow to specify polarity of each signal and at the same time
> the parsing code could derive synchronisation type. A new field could be
> added to struct v4l2_of_parallel_bus, e.g. sync_type and it would be filled
> within v4l2_of_parse_endpoint().
>
I am OK with this option. and I hope you meant "struct
v4l2_of_bus_parallel" instead
of " struct v4l2_of_parallel_bus" and to fill sync_type within
v4l2_of_parse_parallel_bus()
and not in v4l2_of_parse_endpoint().

Regards,
--Prabhakar Lad
--
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 RFC v2] media: OF: add sync-on-green endpoint property

2013-05-25 Thread Sylwester Nawrocki

Hi,

On 05/25/2013 11:17 AM, Prabhakar Lad wrote:

 From looking at Figure 8 "TVP7002 Application Example" in the TVP7002's
>  datasheet
>  ([2], p. 52) and your initial TVP7002 patches it looks like what you want is
>  to
>  specify polarity of the SOGOUT signal, so the processor that receives this
>  signal
>  can properly interpret it, is it correct ?
>

Yes

>  If so then wouldn't it be more appropriate to define e.g. 'sog-active'
>  property
>  and media bus flags:
>   V4L2_MBUS_SYNC_ON_GREEN_ACTIVE_LOW
>   V4L2_MBUS_SYNC_ON_GREEN_ACTIVE_HIGH
>  ?
>

Agreed I'll add these flags.


>  And for synchronisation method on the analog part we could perhaps define
>  'component-sync' or similar property that would enumerate all possible
>  synchronisation methods. We might as well use separate boolean properties,
>  but I'm a bit concerned about the increasing number of properties that need
>  to be parsed for each parallel video bus "endpoint".
>

I am not clear on it can please elaborate more on this.


I thought about two possible options:

1. single property 'component-sync' or 'video-sync' that would have values:

#define VIDEO_SEPARATE_SYNC 0x01
#define VIDEO_COMPOSITE_SYNC0x02
#define VIDEO_SYNC_ON_COMPOSITE 0x04
#define VIDEO_SYNC_ON_GREEN 0x08
#define VIDEO_SYNC_ON_LUMINANCE 0x10

And we could put these definitions into a separate header, e.g.


Then in a device tree source file one could have, e.g.

video-sync = ;


2. Separate boolean property for each video sync type, e.g.

"video-composite-sync"
"video-sync-on-composite"
"video-sync-on-green"
"video-sync-on-luminance"

Separate sync, with separate VSYNC, HSYNC lines, would be the default, when
none of the above is specified and 'vsync-active', 'hsync-active' properties
are present.

However, I suppose the better would be to deduce the video synchronisation
method from the sync signal polarity flags. Then, for instance, when an
endpoint node contains "composite-sync-active" property the parser would
determine the "composite sync" synchronisation type is used.

Thus it might make sense to have only following integer properties (added
as needed):

composite-sync-active
sync-on-green-active
sync-on-comp-active
sync-on-luma-active

This would allow to specify polarity of each signal and at the same time
the parsing code could derive synchronisation type. A new field could be
added to struct v4l2_of_parallel_bus, e.g. sync_type and it would be filled
within v4l2_of_parse_endpoint().

What do you think ?


Thanks,
Sylwester
--
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 5/5] s5p-mfc: Remove unused s5p_mfc_get_decoded_status_v6() function

2013-05-25 Thread Sylwester Nawrocki
This patch fixes following compilation warning:

  CC [M]  drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.o
drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c:1733:12: warning: 
‘s5p_mfc_get_decoded_status_v6’ defined but not used

It assigns existing but not used s5p_mfc_get_dec_status_v6() function to the
get_dec_status callback. It seems the get_dec_status callback is not used
anyway, as there is no corresponding s5p_mfc_hw_call().

Cc: Kamil Debski 
Cc: Arun Kumar K 
Signed-off-by: Sylwester Nawrocki 
---
WARNING: This patch has not been tested.
---
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |8 +---
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
index 7e76fce..3f97363 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -62,12 +62,6 @@ static void s5p_mfc_release_dec_desc_buffer_v6(struct 
s5p_mfc_ctx *ctx)
/* NOP */
 }
 
-static int s5p_mfc_get_dec_status_v6(struct s5p_mfc_dev *dev)
-{
-   /* NOP */
-   return -1;
-}
-
 /* Allocate codec buffers */
 static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx)
 {
@@ -1730,7 +1724,7 @@ static int s5p_mfc_get_dspl_status_v6(struct s5p_mfc_dev 
*dev)
return mfc_read(dev, S5P_FIMV_D_DISPLAY_STATUS_V6);
 }
 
-static int s5p_mfc_get_decoded_status_v6(struct s5p_mfc_dev *dev)
+static int s5p_mfc_get_dec_status_v6(struct s5p_mfc_dev *dev)
 {
return mfc_read(dev, S5P_FIMV_D_DECODED_STATUS_V6);
 }
-- 
1.7.4.1

--
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 4/5] s5p-tv: Don't ignore return value of regulator_bulk_enable() in hdmi_drv.c

2013-05-25 Thread Sylwester Nawrocki
This patch fixes following compilation warning:
 CC [M]  drivers/media/platform/s5p-tv/hdmi_drv.o
drivers/media/platform/s5p-tv/hdmi_drv.c: In function ‘hdmi_resource_poweron’:
drivers/media/platform/s5p-tv/hdmi_drv.c:583:23: warning: ignoring return value
 of ‘regulator_bulk_enable’, declared with attribute warn_unused_result

Cc: Tomasz Stanislawski 
Signed-off-by: Sylwester Nawrocki 
---
 drivers/media/platform/s5p-tv/hdmi_drv.c |   16 
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/hdmi_drv.c 
b/drivers/media/platform/s5p-tv/hdmi_drv.c
index 4e86626..cca83f5 100644
--- a/drivers/media/platform/s5p-tv/hdmi_drv.c
+++ b/drivers/media/platform/s5p-tv/hdmi_drv.c
@@ -576,16 +576,22 @@ static int hdmi_s_stream(struct v4l2_subdev *sd, int 
enable)
return hdmi_streamoff(hdev);
 }
 
-static void hdmi_resource_poweron(struct hdmi_resources *res)
+static int hdmi_resource_poweron(struct hdmi_resources *res)
 {
+   int ret;
+
/* turn HDMI power on */
-   regulator_bulk_enable(res->regul_count, res->regul_bulk);
+   ret = regulator_bulk_enable(res->regul_count, res->regul_bulk);
+   if (ret < 0)
+   return ret;
/* power-on hdmi physical interface */
clk_enable(res->hdmiphy);
/* use VPP as parent clock; HDMIPHY is not working yet */
clk_set_parent(res->sclk_hdmi, res->sclk_pixel);
/* turn clocks on */
clk_enable(res->sclk_hdmi);
+
+   return 0;
 }
 
 static void hdmi_resource_poweroff(struct hdmi_resources *res)
@@ -728,11 +734,13 @@ static int hdmi_runtime_resume(struct device *dev)
 {
struct v4l2_subdev *sd = dev_get_drvdata(dev);
struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
-   int ret = 0;
+   int ret;
 
dev_dbg(dev, "%s\n", __func__);
 
-   hdmi_resource_poweron(&hdev->res);
+   ret = hdmi_resource_poweron(&hdev->res);
+   if (ret < 0)
+   return ret;
 
/* starting MHL */
ret = v4l2_subdev_call(hdev->mhl_sd, core, s_power, 1);
-- 
1.7.4.1

--
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 3/5] s5p-tv: Do not ignore regulator/clk API return values in sdo_drv.c

2013-05-25 Thread Sylwester Nawrocki
This patch fixes following compilation warning:

drivers/media/platform/s5p-tv/sdo_drv.c: In function ‘sdo_runtime_resume’:
drivers/media/platform/s5p-tv/sdo_drv.c:268:18: warning: ignoring return value 
of ‘regulator_enable’,
  declared with attribute warn_unused_result
drivers/media/platform/s5p-tv/sdo_drv.c:269:18: warning: ignoring return value 
of ‘regulator_enable’,
  declared with attribute warn_unused_result

Cc: Tomasz Stanislawski 
Signed-off-by: Sylwester Nawrocki 
---
 drivers/media/platform/s5p-tv/sdo_drv.c |   22 +++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c 
b/drivers/media/platform/s5p-tv/sdo_drv.c
index ab6f9ef..0afa90f 100644
--- a/drivers/media/platform/s5p-tv/sdo_drv.c
+++ b/drivers/media/platform/s5p-tv/sdo_drv.c
@@ -262,11 +262,21 @@ static int sdo_runtime_resume(struct device *dev)
 {
struct v4l2_subdev *sd = dev_get_drvdata(dev);
struct sdo_device *sdev = sd_to_sdev(sd);
+   int ret;
 
dev_info(dev, "resume\n");
-   clk_enable(sdev->sclk_dac);
-   regulator_enable(sdev->vdac);
-   regulator_enable(sdev->vdet);
+
+   ret = clk_enable(sdev->sclk_dac);
+   if (ret < 0)
+   return ret;
+
+   ret = regulator_enable(sdev->vdac);
+   if (ret < 0)
+   goto dac_clk_dis;
+
+   ret = regulator_enable(sdev->vdet);
+   if (ret < 0)
+   goto vdac_r_dis;
 
/* software reset */
sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_SW_RESET);
@@ -285,6 +295,12 @@ static int sdo_runtime_resume(struct device *dev)
SDO_COMPENSATION_CVBS_COMP_OFF);
sdo_reg_debug(sdev);
return 0;
+
+vdac_r_dis:
+   regulator_disable(sdev->vdac);
+dac_clk_dis:
+   clk_disable(sdev->sclk_dac);
+   return ret;
 }
 
 static const struct dev_pm_ops sdo_pm_ops = {
-- 
1.7.4.1

--
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 2/5] s5p-tv: Don't ignore return value of regulator_enable() in sii9234_drv.c

2013-05-25 Thread Sylwester Nawrocki
This patch fixes following compilation warning:

  CC [M]  drivers/media/platform/s5p-tv/sii9234_drv.o
drivers/media/platform/s5p-tv/sii9234_drv.c: In function 
‘sii9234_runtime_resume’:
drivers/media/platform/s5p-tv/sii9234_drv.c:252:18: warning: ignoring return
  value of ‘regulator_enable’, declared with attribute warn_unused_result

Cc: Tomasz Stanislawski 
Signed-off-by: Sylwester Nawrocki 
---
 drivers/media/platform/s5p-tv/sii9234_drv.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/sii9234_drv.c 
b/drivers/media/platform/s5p-tv/sii9234_drv.c
index 39b77d2..3dd762e 100644
--- a/drivers/media/platform/s5p-tv/sii9234_drv.c
+++ b/drivers/media/platform/s5p-tv/sii9234_drv.c
@@ -249,7 +249,9 @@ static int sii9234_runtime_resume(struct device *dev)
int ret;
 
dev_info(dev, "resume start\n");
-   regulator_enable(ctx->power);
+   ret = regulator_enable(ctx->power);
+   if (ret < 0)
+   return ret;
 
ret = sii9234_reset(ctx);
if (ret)
-- 
1.7.4.1

--
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 1/5] s5c73m3: Do not ignore errors from regulator_enable()

2013-05-25 Thread Sylwester Nawrocki
This fixes following compilation warning:

drivers/media/i2c/s5c73m3/s5c73m3-core.c: In function ‘__s5c73m3_power_off’:
drivers/media/i2c/s5c73m3/s5c73m3-core.c:1389:19: warning: ignoring return value
of ‘regulator_enable’, declared with attribute warn_unused_result

Cc: Andrzej Hajda 
Signed-off-by: Sylwester Nawrocki 
---
 drivers/media/i2c/s5c73m3/s5c73m3-core.c |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c 
b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
index d3e867a..402da96 100644
--- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c
+++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
@@ -1385,9 +1385,12 @@ static int __s5c73m3_power_off(struct s5c73m3 *state)
}
return 0;
 err:
-   for (++i; i < S5C73M3_MAX_SUPPLIES; i++)
-   regulator_enable(state->supplies[i].consumer);
-
+   for (++i; i < S5C73M3_MAX_SUPPLIES; i++) {
+   int r = regulator_enable(state->supplies[i].consumer);
+   if (r < 0)
+   v4l2_err(&state->oif_sd, "Failed to reenable %s: %d\n",
+state->supplies[i].supply, r);
+   }
return ret;
 }
 
-- 
1.7.4.1

--
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 0/5] arm/exynos compilation warning fixes

2013-05-25 Thread Sylwester Nawrocki
This patch set fixes couple issues that cause warnings seen in the media 
daily build. Any testing/ack are welcome, as these patches are completely 
untested yet.

Sylwester Nawrocki (5):
  s5c73m3: Do not ignore errors from regulator_enable()
  s5p-tv: Don't ignore return value of regulator_enable() in
sii9234_drv.c
  s5p-tv: Do not ignore regulator/clk API return values in sdo_drv.c
  s5p-tv: Don't ignore return value of regulator_bulk_enable() in
hdmi_drv.c
  s5p-mfc: Remove unused s5p_mfc_get_decoded_status_v6() function

 drivers/media/i2c/s5c73m3/s5c73m3-core.c|9 ++---
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |8 +---
 drivers/media/platform/s5p-tv/hdmi_drv.c|   16 
 drivers/media/platform/s5p-tv/sdo_drv.c |   22 +++---
 drivers/media/platform/s5p-tv/sii9234_drv.c |4 +++-
 5 files changed, 41 insertions(+), 18 deletions(-)

-- 
1.7.4.1
--
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 RFC v2] media: OF: add sync-on-green endpoint property

2013-05-25 Thread Prabhakar Lad
Hi Sylwester,

On Fri, May 24, 2013 at 4:41 PM, Sylwester Nawrocki
 wrote:
> Prabhakar,
>
>
> On 05/16/2013 03:18 PM, Lad Prabhakar wrote:
>>
>> From: Lad, Prabhakar 
>>
>> This patch adds "sync-on-green" property as part of
>> endpoint properties and also support to parse them in the parser.
>
>
>> --- a/Documentation/devicetree/bindings/media/video-interfaces.txt
>> +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt
>> @@ -101,6 +101,8 @@ Optional endpoint properties
>> array contains only one entry.
>>   - clock-noncontinuous: a boolean property to allow MIPI CSI-2
>> non-continuous
>> clock mode.
>> +-sync-on-green: a boolean property indicating to sync with the green
>> signal in
>> + RGB.
>
>
> Are you sure this is what you need for the TVP7002 chip ?
>
Yes

> I think we should differentiate between analog and digital signals and the
> related
> device's configuration. AFAIU for the analog part there can be various video
> sychronisation methods, i.e. ways in which the synchronisation signals are
> transmitted along side the video component (RGB or luma/chroma) signals.
> According
> to [1] (presumably not most reliable source of information) there are
> following
> methods of transmitting sync signals:
>
>  - Separate sync
>  - Composite sync
>  - Sync-on-green (SOG)
>  - Sync-on-luminance
>  - Sync-on-composite
>
> And all these seem to refer to analog video signal.
>
I was about to add all these but as per Laurent mentioned we can add this
whenever there is a need of it.

> From looking at Figure 8 "TVP7002 Application Example" in the TVP7002's
> datasheet
> ([2], p. 52) and your initial TVP7002 patches it looks like what you want is
> to
> specify polarity of the SOGOUT signal, so the processor that receives this
> signal
> can properly interpret it, is it correct ?
>
Yes
> If so then wouldn't it be more appropriate to define e.g. 'sog-active'
> property
> and media bus flags:
> V4L2_MBUS_SYNC_ON_GREEN_ACTIVE_LOW
> V4L2_MBUS_SYNC_ON_GREEN_ACTIVE_HIGH
> ?
>
Agreed I'll add these flags.

> And for synchronisation method on the analog part we could perhaps define
> 'component-sync' or similar property that would enumerate all possible
> synchronisation methods. We might as well use separate boolean properties,
> but I'm a bit concerned about the increasing number of properties that need
> to be parsed for each parallel video bus "endpoint".
>
I am not clear on it can please elaborate more on this.

Regards,
--Prabhakar Lad
--
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