Re: [PATCH] drivers:media:video:uvc: fix uvc_v4l2_get_unmapped_area for NOMMU

2012-05-14 Thread Bob Liu
Hi Laurent,

On Tue, May 15, 2012 at 9:01 AM, Bob Liu  wrote:
> Hi Laurent,
>
> On Mon, May 14, 2012 at 7:31 PM, Laurent Pinchart
>  wrote:
>> Hi Bob,
>>
>> On Monday 14 May 2012 18:23:59 Bob Liu wrote:
>>> Fix uvc_v4l2_get_unmapped_area() for NOMMU arch like blackfin after
>>> framework updated to use videobuf2.
>>
>> Thank you for the patch, but I'm afraid you're too late. The fix is already
>> queued for v3.5 :-)
>
> It doesn't matter.

Sorry for my misunderstanding. I've seen the fix in the queue for v3.5.
Please ignore my noise.

>
>>
>>> Signed-off-by: Bob Liu 
>>> ---
>>>  drivers/media/video/uvc/uvc_queue.c |   30 --
>>>  drivers/media/video/uvc/uvc_v4l2.c  |    2 +-
>>>  2 files changed, 1 insertions(+), 31 deletions(-)
>>>
>>> diff --git a/drivers/media/video/uvc/uvc_queue.c
>>> b/drivers/media/video/uvc/uvc_queue.c index 518f77d..30be060 100644
>>> --- a/drivers/media/video/uvc/uvc_queue.c
>>> +++ b/drivers/media/video/uvc/uvc_queue.c
>>> @@ -237,36 +237,6 @@ int uvc_queue_allocated(struct uvc_video_queue *queue)
>>>       return allocated;
>>>  }
>>>
>>> -#ifndef CONFIG_MMU
>>> -/*
>>> - * Get unmapped area.
>>> - *
>>> - * NO-MMU arch need this function to make mmap() work correctly.
>>> - */
>>> -unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
>>> -             unsigned long pgoff)
>>> -{
>>> -     struct uvc_buffer *buffer;
>>> -     unsigned int i;
>>> -     unsigned long ret;
>>> -
>>> -     mutex_lock(&queue->mutex);
>>> -     for (i = 0; i < queue->count; ++i) {
>>> -             buffer = &queue->buffer[i];
>>> -             if ((buffer->buf.m.offset >> PAGE_SHIFT) == pgoff)
>>> -                     break;
>>> -     }
>>> -     if (i == queue->count) {
>>> -             ret = -EINVAL;
>>> -             goto done;
>>> -     }
>>> -     ret = (unsigned long)buf->mem;
>>> -done:
>>> -     mutex_unlock(&queue->mutex);
>>> -     return ret;
>>> -}
>>> -#endif
>>> -
>>>  /*
>>>   * Enable or disable the video buffers queue.
>>>   *
>>> diff --git a/drivers/media/video/uvc/uvc_v4l2.c
>>> b/drivers/media/video/uvc/uvc_v4l2.c index 2ae4f88..506d3d6 100644
>>> --- a/drivers/media/video/uvc/uvc_v4l2.c
>>> +++ b/drivers/media/video/uvc/uvc_v4l2.c
>>> @@ -1067,7 +1067,7 @@ static unsigned long uvc_v4l2_get_unmapped_area(struct
>>> file *file,
>>>
>>>       uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_get_unmapped_area\n");
>>>
>>> -     return uvc_queue_get_unmapped_area(&stream->queue, pgoff);
>>> +     return vb2_get_unmapped_area(&stream->queue, addr, len, pgoff, flags);
>>
>> Just for the record you would have needed to take the queue->mutex around the
>> vb2_get_unmapped_area() call here.
>>
>
> okay, i'll send out v2 soon, please queue it for next window.
> Thank you.
>
>>>  }
>>>  #endif
>>
>> --
>> Regards,
>>
>> Laurent Pinchart
>>
>
> --
> Regards,
> --Bob

-- 
Regards,
--Bob
--
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] [media] rc: Fix invalid free_region and/or free_irq on probe failure

2012-05-14 Thread Ben Hutchings
On Tue, 2012-05-15 at 02:36 +0100, Ben Hutchings wrote:
> fintek-cir, ite-cir and nuvoton-cir may try to free an I/O region
> and/or IRQ handler that was never allocated after a failure in their
> respective probe functions.  Add and use separate labels on the
> failure path so they will do the right cleanup after each possible
> point of failure.
> 
> Compile-tested only.
> 
> Signed-off-by: Ben Hutchings 

And this should probably go to stable as well, if you agree it's a valid
fix.

Ben.

> ---
>  drivers/media/rc/fintek-cir.c  |   13 ++---
>  drivers/media/rc/ite-cir.c |   14 ++
>  drivers/media/rc/nuvoton-cir.c |   26 --
>  3 files changed, 24 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c
> index 4a3a238..6aabf7a 100644
> --- a/drivers/media/rc/fintek-cir.c
> +++ b/drivers/media/rc/fintek-cir.c
> @@ -556,11 +556,11 @@ static int fintek_probe(struct pnp_dev *pdev, const 
> struct pnp_device_id *dev_id
>  
>   if (request_irq(fintek->cir_irq, fintek_cir_isr, IRQF_SHARED,
>   FINTEK_DRIVER_NAME, (void *)fintek))
> - goto failure;
> + goto failure2;
>  
>   ret = rc_register_device(rdev);
>   if (ret)
> - goto failure;
> + goto failure3;
>  
>   device_init_wakeup(&pdev->dev, true);
>   fintek->rdev = rdev;
> @@ -570,12 +570,11 @@ static int fintek_probe(struct pnp_dev *pdev, const 
> struct pnp_device_id *dev_id
>  
>   return 0;
>  
> +failure3:
> + free_irq(fintek->cir_irq, fintek);
> +failure2:
> + release_region(fintek->cir_addr, fintek->cir_port_len);
>  failure:
> - if (fintek->cir_irq)
> - free_irq(fintek->cir_irq, fintek);
> - if (fintek->cir_addr)
> - release_region(fintek->cir_addr, fintek->cir_port_len);
> -
>   rc_free_device(rdev);
>   kfree(fintek);
>  
> diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
> index 0e49c99..36fe5a3 100644
> --- a/drivers/media/rc/ite-cir.c
> +++ b/drivers/media/rc/ite-cir.c
> @@ -1598,24 +1598,22 @@ static int ite_probe(struct pnp_dev *pdev, const 
> struct pnp_device_id
>  
>   if (request_irq(itdev->cir_irq, ite_cir_isr, IRQF_SHARED,
>   ITE_DRIVER_NAME, (void *)itdev))
> - goto failure;
> + goto failure2;
>  
>   ret = rc_register_device(rdev);
>   if (ret)
> - goto failure;
> + goto failure3;
>  
>   itdev->rdev = rdev;
>   ite_pr(KERN_NOTICE, "driver has been successfully loaded\n");
>  
>   return 0;
>  
> +failure3:
> + free_irq(itdev->cir_irq, itdev);
> +failure2:
> + release_region(itdev->cir_addr, itdev->params.io_region_size);
>  failure:
> - if (itdev->cir_irq)
> - free_irq(itdev->cir_irq, itdev);
> -
> - if (itdev->cir_addr)
> - release_region(itdev->cir_addr, itdev->params.io_region_size);
> -
>   rc_free_device(rdev);
>   kfree(itdev);
>  
> diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
> index 8b2c071..dc8a7dd 100644
> --- a/drivers/media/rc/nuvoton-cir.c
> +++ b/drivers/media/rc/nuvoton-cir.c
> @@ -1075,19 +1075,19 @@ static int nvt_probe(struct pnp_dev *pdev, const 
> struct pnp_device_id *dev_id)
>  
>   if (request_irq(nvt->cir_irq, nvt_cir_isr, IRQF_SHARED,
>   NVT_DRIVER_NAME, (void *)nvt))
> - goto failure;
> + goto failure2;
>  
>   if (!request_region(nvt->cir_wake_addr,
>   CIR_IOREG_LENGTH, NVT_DRIVER_NAME))
> - goto failure;
> + goto failure3;
>  
>   if (request_irq(nvt->cir_wake_irq, nvt_cir_wake_isr, IRQF_SHARED,
>   NVT_DRIVER_NAME, (void *)nvt))
> - goto failure;
> + goto failure4;
>  
>   ret = rc_register_device(rdev);
>   if (ret)
> - goto failure;
> + goto failure5;
>  
>   device_init_wakeup(&pdev->dev, true);
>   nvt->rdev = rdev;
> @@ -1099,17 +1099,15 @@ static int nvt_probe(struct pnp_dev *pdev, const 
> struct pnp_device_id *dev_id)
>  
>   return 0;
>  
> +failure5:
> + free_irq(nvt->cir_wake_irq, nvt);
> +failure4:
> + release_region(nvt->cir_wake_addr, CIR_IOREG_LENGTH);
> +failure3:
> + free_irq(nvt->cir_irq, nvt);
> +failure2:
> + release_region(nvt->cir_addr, CIR_IOREG_LENGTH);
>  failure:
> - if (nvt->cir_irq)
> - free_irq(nvt->cir_irq, nvt);
> - if (nvt->cir_addr)
> - release_region(nvt->cir_addr, CIR_IOREG_LENGTH);
> -
> - if (nvt->cir_wake_irq)
> - free_irq(nvt->cir_wake_irq, nvt);
> - if (nvt->cir_wake_addr)
> - release_region(nvt->cir_wake_addr, CIR_IOREG_LENGTH);
> -
>   rc_free_device(rdev);
>   kfree(nvt);
>  

-- 
Ben Hutchings
The two most common things in the universe are hydrogen and stupid

[PATCH] [media] rc: Fix invalid free_region and/or free_irq on probe failure

2012-05-14 Thread Ben Hutchings
fintek-cir, ite-cir and nuvoton-cir may try to free an I/O region
and/or IRQ handler that was never allocated after a failure in their
respective probe functions.  Add and use separate labels on the
failure path so they will do the right cleanup after each possible
point of failure.

Compile-tested only.

Signed-off-by: Ben Hutchings 
---
 drivers/media/rc/fintek-cir.c  |   13 ++---
 drivers/media/rc/ite-cir.c |   14 ++
 drivers/media/rc/nuvoton-cir.c |   26 --
 3 files changed, 24 insertions(+), 29 deletions(-)

diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c
index 4a3a238..6aabf7a 100644
--- a/drivers/media/rc/fintek-cir.c
+++ b/drivers/media/rc/fintek-cir.c
@@ -556,11 +556,11 @@ static int fintek_probe(struct pnp_dev *pdev, const 
struct pnp_device_id *dev_id
 
if (request_irq(fintek->cir_irq, fintek_cir_isr, IRQF_SHARED,
FINTEK_DRIVER_NAME, (void *)fintek))
-   goto failure;
+   goto failure2;
 
ret = rc_register_device(rdev);
if (ret)
-   goto failure;
+   goto failure3;
 
device_init_wakeup(&pdev->dev, true);
fintek->rdev = rdev;
@@ -570,12 +570,11 @@ static int fintek_probe(struct pnp_dev *pdev, const 
struct pnp_device_id *dev_id
 
return 0;
 
+failure3:
+   free_irq(fintek->cir_irq, fintek);
+failure2:
+   release_region(fintek->cir_addr, fintek->cir_port_len);
 failure:
-   if (fintek->cir_irq)
-   free_irq(fintek->cir_irq, fintek);
-   if (fintek->cir_addr)
-   release_region(fintek->cir_addr, fintek->cir_port_len);
-
rc_free_device(rdev);
kfree(fintek);
 
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
index 0e49c99..36fe5a3 100644
--- a/drivers/media/rc/ite-cir.c
+++ b/drivers/media/rc/ite-cir.c
@@ -1598,24 +1598,22 @@ static int ite_probe(struct pnp_dev *pdev, const struct 
pnp_device_id
 
if (request_irq(itdev->cir_irq, ite_cir_isr, IRQF_SHARED,
ITE_DRIVER_NAME, (void *)itdev))
-   goto failure;
+   goto failure2;
 
ret = rc_register_device(rdev);
if (ret)
-   goto failure;
+   goto failure3;
 
itdev->rdev = rdev;
ite_pr(KERN_NOTICE, "driver has been successfully loaded\n");
 
return 0;
 
+failure3:
+   free_irq(itdev->cir_irq, itdev);
+failure2:
+   release_region(itdev->cir_addr, itdev->params.io_region_size);
 failure:
-   if (itdev->cir_irq)
-   free_irq(itdev->cir_irq, itdev);
-
-   if (itdev->cir_addr)
-   release_region(itdev->cir_addr, itdev->params.io_region_size);
-
rc_free_device(rdev);
kfree(itdev);
 
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
index 8b2c071..dc8a7dd 100644
--- a/drivers/media/rc/nuvoton-cir.c
+++ b/drivers/media/rc/nuvoton-cir.c
@@ -1075,19 +1075,19 @@ static int nvt_probe(struct pnp_dev *pdev, const struct 
pnp_device_id *dev_id)
 
if (request_irq(nvt->cir_irq, nvt_cir_isr, IRQF_SHARED,
NVT_DRIVER_NAME, (void *)nvt))
-   goto failure;
+   goto failure2;
 
if (!request_region(nvt->cir_wake_addr,
CIR_IOREG_LENGTH, NVT_DRIVER_NAME))
-   goto failure;
+   goto failure3;
 
if (request_irq(nvt->cir_wake_irq, nvt_cir_wake_isr, IRQF_SHARED,
NVT_DRIVER_NAME, (void *)nvt))
-   goto failure;
+   goto failure4;
 
ret = rc_register_device(rdev);
if (ret)
-   goto failure;
+   goto failure5;
 
device_init_wakeup(&pdev->dev, true);
nvt->rdev = rdev;
@@ -1099,17 +1099,15 @@ static int nvt_probe(struct pnp_dev *pdev, const struct 
pnp_device_id *dev_id)
 
return 0;
 
+failure5:
+   free_irq(nvt->cir_wake_irq, nvt);
+failure4:
+   release_region(nvt->cir_wake_addr, CIR_IOREG_LENGTH);
+failure3:
+   free_irq(nvt->cir_irq, nvt);
+failure2:
+   release_region(nvt->cir_addr, CIR_IOREG_LENGTH);
 failure:
-   if (nvt->cir_irq)
-   free_irq(nvt->cir_irq, nvt);
-   if (nvt->cir_addr)
-   release_region(nvt->cir_addr, CIR_IOREG_LENGTH);
-
-   if (nvt->cir_wake_irq)
-   free_irq(nvt->cir_wake_irq, nvt);
-   if (nvt->cir_wake_addr)
-   release_region(nvt->cir_wake_addr, CIR_IOREG_LENGTH);
-
rc_free_device(rdev);
kfree(nvt);
 
-- 
1.7.10


--
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] drivers:media:video:uvc: fix uvc_v4l2_get_unmapped_area for NOMMU

2012-05-14 Thread Bob Liu
Hi Laurent,

On Mon, May 14, 2012 at 7:31 PM, Laurent Pinchart
 wrote:
> Hi Bob,
>
> On Monday 14 May 2012 18:23:59 Bob Liu wrote:
>> Fix uvc_v4l2_get_unmapped_area() for NOMMU arch like blackfin after
>> framework updated to use videobuf2.
>
> Thank you for the patch, but I'm afraid you're too late. The fix is already
> queued for v3.5 :-)

It doesn't matter.

>
>> Signed-off-by: Bob Liu 
>> ---
>>  drivers/media/video/uvc/uvc_queue.c |   30 --
>>  drivers/media/video/uvc/uvc_v4l2.c  |    2 +-
>>  2 files changed, 1 insertions(+), 31 deletions(-)
>>
>> diff --git a/drivers/media/video/uvc/uvc_queue.c
>> b/drivers/media/video/uvc/uvc_queue.c index 518f77d..30be060 100644
>> --- a/drivers/media/video/uvc/uvc_queue.c
>> +++ b/drivers/media/video/uvc/uvc_queue.c
>> @@ -237,36 +237,6 @@ int uvc_queue_allocated(struct uvc_video_queue *queue)
>>       return allocated;
>>  }
>>
>> -#ifndef CONFIG_MMU
>> -/*
>> - * Get unmapped area.
>> - *
>> - * NO-MMU arch need this function to make mmap() work correctly.
>> - */
>> -unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
>> -             unsigned long pgoff)
>> -{
>> -     struct uvc_buffer *buffer;
>> -     unsigned int i;
>> -     unsigned long ret;
>> -
>> -     mutex_lock(&queue->mutex);
>> -     for (i = 0; i < queue->count; ++i) {
>> -             buffer = &queue->buffer[i];
>> -             if ((buffer->buf.m.offset >> PAGE_SHIFT) == pgoff)
>> -                     break;
>> -     }
>> -     if (i == queue->count) {
>> -             ret = -EINVAL;
>> -             goto done;
>> -     }
>> -     ret = (unsigned long)buf->mem;
>> -done:
>> -     mutex_unlock(&queue->mutex);
>> -     return ret;
>> -}
>> -#endif
>> -
>>  /*
>>   * Enable or disable the video buffers queue.
>>   *
>> diff --git a/drivers/media/video/uvc/uvc_v4l2.c
>> b/drivers/media/video/uvc/uvc_v4l2.c index 2ae4f88..506d3d6 100644
>> --- a/drivers/media/video/uvc/uvc_v4l2.c
>> +++ b/drivers/media/video/uvc/uvc_v4l2.c
>> @@ -1067,7 +1067,7 @@ static unsigned long uvc_v4l2_get_unmapped_area(struct
>> file *file,
>>
>>       uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_get_unmapped_area\n");
>>
>> -     return uvc_queue_get_unmapped_area(&stream->queue, pgoff);
>> +     return vb2_get_unmapped_area(&stream->queue, addr, len, pgoff, flags);
>
> Just for the record you would have needed to take the queue->mutex around the
> vb2_get_unmapped_area() call here.
>

okay, i'll send out v2 soon, please queue it for next window.
Thank you.

>>  }
>>  #endif
>
> --
> Regards,
>
> Laurent Pinchart
>

-- 
Regards,
--Bob
--
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] V4L: Rename V4L2_SEL_TGT_[CROP/COMPOSE]_ACTIVE to V4L2_SEL_TGT_[CROP/COMPOSE]

2012-05-14 Thread Laurent Pinchart
Hi Sylwester,

Thanks for the patch.

On Monday 14 May 2012 19:17:03 Sylwester Nawrocki wrote:
> This patch drops the _ACTIVE part from the selection target names as
> a prerequisite to unify the selection target names on subdevs and regular
> video nodes.
> 
> Although not exactly the same, the meaning of V4L2_SEL_TGT_*_ACTIVE and
> V4L2_SUBDEV_SEL_TGT_*_ACTUAL selection targets is logically the same.
> Different names add to confusion where both APIs are used in a single
> driver or an application.
> The selections API is experimental, so no compatibility layer is added.
> The ABI remains unchanged.
> 
> Signed-off-by: Sylwester Nawrocki 
> Signed-off-by: Kyungmin Park 

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: [GIT PULL FOR v3.5] Implement V4L2_CID_PIXEL_RATE in various drivers

2012-05-14 Thread Laurent Pinchart
Hi Mauro,

On Monday 14 May 2012 13:01:56 Mauro Carvalho Chehab wrote:
> Em 14-05-2012 12:56, Sakari Ailus escreveu:
> > Hi all,
> > 
> > Here are a few patches that implement V4L2_CID_PIXEL_RATE in a couple of
> > drivers. The control is soon required by some CSI-2 receivers to configure
> > the hardware, such as the OMAP 3 ISP one.
> 
> Before spreading this everywhere, let me understand a little bit better
> about V4L2_CID_PIXEL_RATE and the other ioctl's that handle the image rate,
> as changing one affects the other.

Implementing V4L2_CID_PIXEL_RATE is required for sensor drivers used with the 
OMAP3 ISP. The ISP driver needs to know the pixel rate on the ISP sink to 
configure the hardware. This was previously done with a platform callback, the 
ISP now queries the sensor directly using the V4L2_CID_PIXEL_RATE control.

As you've pulled the ISP change for v3.5, I'd like these 3 patches to get in 
v3.5 as well to avoid regressions.

> > ---
> > 
> > The following changes since commit 
e89fca923f32de26b69bf4cd604f7b960b161551:
> >   [media] gspca - ov534: Add Hue control (2012-05-14 09:48:00 -0300)
> > 
> > are available in the git repository at:
> >   ssh://linuxtv.org/git/sailus/media_tree.git media-for-3.5
> > 
> > Laurent Pinchart (3):
> >   mt9t001: Implement V4L2_CID_PIXEL_RATE control
> >   mt9p031: Implement V4L2_CID_PIXEL_RATE control
> >   mt9m032: Implement V4L2_CID_PIXEL_RATE control
> >  
> >  drivers/media/video/mt9m032.c |   13 +++--
> >  drivers/media/video/mt9p031.c |5 -
> >  drivers/media/video/mt9t001.c |   13 +++--
> >  include/media/mt9t001.h   |1 +
> >  4 files changed, 27 insertions(+), 5 deletions(-)

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


[PATCH 05/11] DVB: add support for the LG2160 ATSC-MH demodulator

2012-05-14 Thread Michael Krufky
This patch adds support for controlling the LG2160 and
LG2161 ATSC-MH demodulators.

Signed-off-by: Michael Krufky 
---
 drivers/media/dvb/frontends/Makefile |1 +
 drivers/media/dvb/frontends/lg2160.c | 1468 ++
 drivers/media/dvb/frontends/lg2160.h |   84 ++
 3 files changed, 1553 insertions(+)
 create mode 100644 drivers/media/dvb/frontends/lg2160.c
 create mode 100644 drivers/media/dvb/frontends/lg2160.h

diff --git a/drivers/media/dvb/frontends/Makefile 
b/drivers/media/dvb/frontends/Makefile
index 86fa808..f19775d 100644
--- a/drivers/media/dvb/frontends/Makefile
+++ b/drivers/media/dvb/frontends/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_DVB_BCM3510) += bcm3510.o
 obj-$(CONFIG_DVB_S5H1420) += s5h1420.o
 obj-$(CONFIG_DVB_LGDT330X) += lgdt330x.o
 obj-$(CONFIG_DVB_LGDT3305) += lgdt3305.o
+obj-$(CONFIG_DVB_LG2160) += lg2160.o
 obj-$(CONFIG_DVB_CX24123) += cx24123.o
 obj-$(CONFIG_DVB_LNBP21) += lnbp21.o
 obj-$(CONFIG_DVB_LNBP22) += lnbp22.o
diff --git a/drivers/media/dvb/frontends/lg2160.c 
b/drivers/media/dvb/frontends/lg2160.c
new file mode 100644
index 000..269ab7b
--- /dev/null
+++ b/drivers/media/dvb/frontends/lg2160.c
@@ -0,0 +1,1468 @@
+/*
+ *Support for LG2160 - ATSC/MH
+ *
+ *Copyright (C) 2010 Michael Krufky 
+ *
+ *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.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program; if not, write to the Free Software
+ *Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include 
+#include 
+#include "lg2160.h"
+
+static int debug;
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, "set debug level (info=1, reg=2 (or-able))");
+
+#define DBG_INFO 1
+#define DBG_REG  2
+
+#define lg_printk(kern, fmt, arg...)   \
+   printk(kern "%s: " fmt, __func__, ##arg)
+
+#define lg_info(fmt, arg...)   printk(KERN_INFO "lg2160: " fmt, ##arg)
+#define lg_warn(fmt, arg...)   lg_printk(KERN_WARNING,   fmt, ##arg)
+#define lg_err(fmt, arg...)lg_printk(KERN_ERR,   fmt, ##arg)
+#define lg_dbg(fmt, arg...) if (debug & DBG_INFO)  \
+   lg_printk(KERN_DEBUG, fmt, ##arg)
+#define lg_reg(fmt, arg...) if (debug & DBG_REG)   \
+   lg_printk(KERN_DEBUG, fmt, ##arg)
+
+#define lg_fail(ret)   \
+({ \
+   int __ret;  \
+   __ret = (ret < 0);  \
+   if (__ret)  \
+   lg_err("error %d on line %d\n", ret, __LINE__); \
+   __ret;  \
+})
+
+struct lg216x_state {
+   struct i2c_adapter *i2c_adap;
+   const struct lg2160_config *cfg;
+
+   struct dvb_frontend frontend;
+
+   u32 current_frequency;
+   u8 parade_id;
+   u8 fic_ver;
+   unsigned int last_reset;
+};
+
+/*  */
+
+static int lg216x_write_reg(struct lg216x_state *state, u16 reg, u8 val)
+{
+   int ret;
+   u8 buf[] = { reg >> 8, reg & 0xff, val };
+   struct i2c_msg msg = {
+   .addr = state->cfg->i2c_addr, .flags = 0,
+   .buf = buf, .len = 3,
+   };
+
+   lg_reg("reg: 0x%04x, val: 0x%02x\n", reg, val);
+
+   ret = i2c_transfer(state->i2c_adap, &msg, 1);
+
+   if (ret != 1) {
+   lg_err("error (addr %02x %02x <- %02x, err = %i)\n",
+  msg.buf[0], msg.buf[1], msg.buf[2], ret);
+   if (ret < 0)
+   return ret;
+   else
+   return -EREMOTEIO;
+   }
+   return 0;
+}
+
+static int lg216x_read_reg(struct lg216x_state *state, u16 reg, u8 *val)
+{
+   int ret;
+   u8 reg_buf[] = { reg >> 8, reg & 0xff };
+   struct i2c_msg msg[] = {
+   { .addr = state->cfg->i2c_addr,
+ .flags = 0, .buf = reg_buf, .len = 2 },
+   { .addr = state->cfg->i2c_addr,
+ .flags = I2C_M_RD, .buf = val, .len = 1 },
+   };
+
+   lg_reg("reg: 0x%04x\n", reg);
+
+   ret = i2c_transfer(state->i2c_adap, msg, 2);
+
+   if (ret != 2) {

[PATCH 10/11] mxl111sf: add ATSC-MH support

2012-05-14 Thread Michael Krufky
Add support for the ATSC-MH frontend on the WinTV Aero-m

Signed-off-by: Michael Krufky 
---
 drivers/media/dvb/dvb-usb/Kconfig|1 +
 drivers/media/dvb/dvb-usb/mxl111sf.c |  871 --
 2 files changed, 825 insertions(+), 47 deletions(-)

diff --git a/drivers/media/dvb/dvb-usb/Kconfig 
b/drivers/media/dvb/dvb-usb/Kconfig
index 63bf456..3164273 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -409,6 +409,7 @@ config DVB_USB_MXL111SF
tristate "MxL111SF DTV USB2.0 support"
depends on DVB_USB
select DVB_LGDT3305 if !DVB_FE_CUSTOMISE
+   select DVB_LG2160 if !DVB_FE_CUSTOMISE
select VIDEO_TVEEPROM
help
  Say Y here to support the MxL111SF USB2.0 DTV receiver.
diff --git a/drivers/media/dvb/dvb-usb/mxl111sf.c 
b/drivers/media/dvb/dvb-usb/mxl111sf.c
index 81305de..c518e86 100644
--- a/drivers/media/dvb/dvb-usb/mxl111sf.c
+++ b/drivers/media/dvb/dvb-usb/mxl111sf.c
@@ -21,6 +21,7 @@
 #include "mxl111sf-tuner.h"
 
 #include "lgdt3305.h"
+#include "lg2160.h"
 
 int dvb_usb_mxl111sf_debug;
 module_param_named(debug, dvb_usb_mxl111sf_debug, int, 0644);
@@ -31,6 +32,10 @@ int dvb_usb_mxl111sf_isoc;
 module_param_named(isoc, dvb_usb_mxl111sf_isoc, int, 0644);
 MODULE_PARM_DESC(isoc, "enable usb isoc xfer (0=bulk, 1=isoc).");
 
+int dvb_usb_mxl111sf_spi;
+module_param_named(spi, dvb_usb_mxl111sf_spi, int, 0644);
+MODULE_PARM_DESC(spi, "use spi rather than tp for data xfer (0=tp, 1=spi).");
+
 #define ANT_PATH_AUTO 0
 #define ANT_PATH_EXTERNAL 1
 #define ANT_PATH_INTERNAL 2
@@ -361,6 +366,33 @@ static int mxl111sf_ep6_streaming_ctrl(struct 
dvb_usb_adapter *adap, int onoff)
return ret;
 }
 
+static int mxl111sf_ep5_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
+{
+   struct dvb_usb_device *d = adap->dev;
+   struct mxl111sf_state *state = d->priv;
+   int ret = 0;
+
+   deb_info("%s(%d)\n", __func__, onoff);
+
+   if (onoff) {
+   ret = mxl111sf_enable_usb_output(state);
+   mxl_fail(ret);
+
+   ret = mxl111sf_init_i2s_port(state, 200);
+   mxl_fail(ret);
+   ret = mxl111sf_config_i2s(state, 0, 15);
+   mxl_fail(ret);
+   } else {
+   ret = mxl111sf_disable_i2s_port(state);
+   mxl_fail(ret);
+   }
+   if (state->chip_rev > MXL111SF_V6)
+   ret = mxl111sf_config_spi(state, onoff);
+   mxl_fail(ret);
+
+   return ret;
+}
+
 static int mxl111sf_ep4_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
 {
struct dvb_usb_device *d = adap->dev;
@@ -453,6 +485,255 @@ fail:
return ret;
 }
 
+static struct lg2160_config hauppauge_lg2160_config = {
+   .lg_chip= LG2160,
+   .i2c_addr   = 0x1c >> 1,
+   .deny_i2c_rptr  = 1,
+   .spectral_inversion = 0,
+   .if_khz = 6000,
+};
+
+static int mxl111sf_lg2160_frontend_attach(struct dvb_usb_adapter *adap)
+{
+   struct dvb_usb_device *d = adap->dev;
+   struct mxl111sf_state *state = d->priv;
+   int fe_id = adap->num_frontends_initialized;
+   struct mxl111sf_adap_state *adap_state = adap->fe_adap[fe_id].priv;
+   int ret;
+
+   deb_adv("%s()\n", __func__);
+
+   /* save a pointer to the dvb_usb_device in device state */
+   state->d = d;
+   adap_state->alt_mode = (dvb_usb_mxl111sf_isoc) ? 2 : 1;
+   state->alt_mode = adap_state->alt_mode;
+
+   if (usb_set_interface(adap->dev->udev, 0, state->alt_mode) < 0)
+   err("set interface failed");
+
+   state->gpio_mode = MXL111SF_GPIO_MOD_MH;
+   adap_state->gpio_mode = state->gpio_mode;
+   adap_state->device_mode = MXL_TUNER_MODE;
+   adap_state->ep6_clockphase = 1;
+
+   ret = mxl1x1sf_soft_reset(state);
+   if (mxl_fail(ret))
+   goto fail;
+   ret = mxl111sf_init_tuner_demod(state);
+   if (mxl_fail(ret))
+   goto fail;
+
+   ret = mxl1x1sf_set_device_mode(state, adap_state->device_mode);
+   if (mxl_fail(ret))
+   goto fail;
+
+   ret = mxl111sf_enable_usb_output(state);
+   if (mxl_fail(ret))
+   goto fail;
+   ret = mxl1x1sf_top_master_ctrl(state, 1);
+   if (mxl_fail(ret))
+   goto fail;
+
+   ret = mxl111sf_init_port_expander(state);
+   if (mxl_fail(ret))
+   goto fail;
+   ret = mxl111sf_gpio_mode_switch(state, state->gpio_mode);
+   if (mxl_fail(ret))
+   goto fail;
+
+   ret = get_chip_info(state);
+   if (mxl_fail(ret))
+   goto fail;
+
+   adap->fe_adap[fe_id].fe = dvb_attach(lg2160_attach,
+ &hauppauge_lg2160_config,
+ &adap->dev->i2c_adap);
+   if (adap->fe_adap[fe_id].fe) {
+   adap_state->fe_init = adap->fe_adap[fe_id].fe->ops.init;
+   adap->fe_a

[PATCH 08/11] dvb-usb: add support for dvb-usb-adapters that deliver raw payload

2012-05-14 Thread Michael Krufky
From: Michael Krufky 

Select this feature setting the dvb-usb-adapter caps field with
DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD

Signed-off-by: Michael Krufky 
---
 drivers/media/dvb/dvb-usb/dvb-usb-urb.c |   12 
 drivers/media/dvb/dvb-usb/dvb-usb.h |1 +
 2 files changed, 13 insertions(+)

diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c 
b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c
index 53a5c30..5c8f651 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c
@@ -80,6 +80,14 @@ static void dvb_usb_data_complete_204(struct usb_data_stream 
*stream, u8 *buffer
dvb_dmx_swfilter_204(&adap->demux, buffer, length);
 }
 
+static void dvb_usb_data_complete_raw(struct usb_data_stream *stream,
+ u8 *buffer, size_t length)
+{
+   struct dvb_usb_adapter *adap = stream->user_priv;
+   if (adap->feedcount > 0 && adap->state & DVB_USB_ADAP_STATE_DVB)
+   dvb_dmx_swfilter_raw(&adap->demux, buffer, length);
+}
+
 int dvb_usb_adapter_stream_init(struct dvb_usb_adapter *adap)
 {
int i, ret = 0;
@@ -90,6 +98,10 @@ int dvb_usb_adapter_stream_init(struct dvb_usb_adapter *adap)
adap->fe_adap[i].stream.complete =
dvb_usb_data_complete_204;
else
+   if (adap->props.fe[i].caps & DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD)
+   adap->fe_adap[i].stream.complete =
+   dvb_usb_data_complete_raw;
+   else
adap->fe_adap[i].stream.complete  = dvb_usb_data_complete;
adap->fe_adap[i].stream.user_priv = adap;
ret = usb_urb_init(&adap->fe_adap[i].stream,
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h 
b/drivers/media/dvb/dvb-usb/dvb-usb.h
index 6d7d13f..86cfa86 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb.h
@@ -141,6 +141,7 @@ struct dvb_usb_adapter_fe_properties {
 #define DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF 0x02
 #define DVB_USB_ADAP_NEED_PID_FILTERING   0x04
 #define DVB_USB_ADAP_RECEIVES_204_BYTE_TS 0x08
+#define DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD 0x10
int caps;
int pid_filter_count;
 
-- 
1.7.9.5

--
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 09/11] dvb-usb: increase MAX_NO_OF_FE_PER_ADAP from 2 to 3

2012-05-14 Thread Michael Krufky
The following patch adds support for a third frontend to exist on a single
DVB adapter, in the mxl111sf driver. This patch allows that to be possible.

Signed-off-by: Michael Krufky 
---
 drivers/media/dvb/dvb-usb/dvb-usb.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h 
b/drivers/media/dvb/dvb-usb/dvb-usb.h
index 86cfa86..99f9440 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb.h
@@ -157,7 +157,7 @@ struct dvb_usb_adapter_fe_properties {
int size_of_priv;
 };
 
-#define MAX_NO_OF_FE_PER_ADAP 2
+#define MAX_NO_OF_FE_PER_ADAP 3
 struct dvb_usb_adapter_properties {
int size_of_priv;
 
-- 
1.7.9.5

--
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 11/11] DVB: remove "stats" property bits from ATSC-MH API property additions

2012-05-14 Thread Michael Krufky
Mauro is proposing a new API to handle statistics. This functionality will
be returned after the statistics API is ready. Just remove them for now.

Signed-off-by: Michael Krufky 
---
 Documentation/DocBook/media/dvb/dvbproperty.xml |   18 --
 drivers/media/dvb/dvb-core/dvb_frontend.c   |   12 
 drivers/media/dvb/dvb-core/dvb_frontend.h   |4 
 drivers/media/dvb/frontends/lg2160.c|9 -
 include/linux/dvb/frontend.h|5 +
 5 files changed, 9 insertions(+), 39 deletions(-)

diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml 
b/Documentation/DocBook/media/dvb/dvbproperty.xml
index d631535..e633c09 100644
--- a/Documentation/DocBook/media/dvb/dvbproperty.xml
+++ b/Documentation/DocBook/media/dvb/dvbproperty.xml
@@ -664,21 +664,6 @@ typedef enum atscmh_sccc_code_mode {
 } atscmh_sccc_code_mode_t;
 

-   
-   DTV_ATSCMH_FIC_ERR
-   FIC error count.
-   Possible values: 0, 1, 2, 3, ..., 0x
-   
-   
-   DTV_ATSCMH_CRC_ERR
-   CRC error count.
-   Possible values: 0, 1, 2, 3, ..., 0x
-   
-   
-   DTV_ATSCMH_RS_ERR
-   RS error count.
-   Possible values: 0, 1, 2, 3, ..., 0x
-   


DTV_API_VERSION
@@ -947,9 +932,6 @@ typedef enum fe_hierarchy {
DTV_ATSCMH_SCCC_CODE_MODE_B
DTV_ATSCMH_SCCC_CODE_MODE_C
DTV_ATSCMH_SCCC_CODE_MODE_D
-   DTV_ATSCMH_FIC_ERR
-   DTV_ATSCMH_CRC_ERR
-   DTV_ATSCMH_RS_ERR



diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c 
b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 067f10a..d12caa5 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -1046,9 +1046,6 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
_DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_B, 0, 0),
_DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_C, 0, 0),
_DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_D, 0, 0),
-   _DTV_CMD(DTV_ATSCMH_FIC_ERR, 0, 0),
-   _DTV_CMD(DTV_ATSCMH_CRC_ERR, 0, 0),
-   _DTV_CMD(DTV_ATSCMH_RS_ERR, 0, 0),
 };
 
 static void dtv_property_dump(struct dtv_property *tvp)
@@ -1435,15 +1432,6 @@ static int dtv_property_process_get(struct dvb_frontend 
*fe,
case DTV_ATSCMH_SCCC_CODE_MODE_D:
tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_d;
break;
-   case DTV_ATSCMH_FIC_ERR:
-   tvp->u.data = fe->dtv_property_cache.atscmh_fic_err;
-   break;
-   case DTV_ATSCMH_CRC_ERR:
-   tvp->u.data = fe->dtv_property_cache.atscmh_crc_err;
-   break;
-   case DTV_ATSCMH_RS_ERR:
-   tvp->u.data = fe->dtv_property_cache.atscmh_rs_err;
-   break;
 
default:
return -EINVAL;
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.h 
b/drivers/media/dvb/dvb-core/dvb_frontend.h
index 80f5c27..e929d56 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.h
@@ -390,10 +390,6 @@ struct dtv_frontend_properties {
u8  atscmh_sccc_code_mode_b;
u8  atscmh_sccc_code_mode_c;
u8  atscmh_sccc_code_mode_d;
-
-   u16 atscmh_fic_err;
-   u16 atscmh_crc_err;
-   u16 atscmh_rs_err;
 };
 
 struct dvb_frontend {
diff --git a/drivers/media/dvb/frontends/lg2160.c 
b/drivers/media/dvb/frontends/lg2160.c
index daa8596..b7e6085 100644
--- a/drivers/media/dvb/frontends/lg2160.c
+++ b/drivers/media/dvb/frontends/lg2160.c
@@ -804,6 +804,7 @@ fail:
 
 /*  */
 
+#if 0
 static int lg216x_read_fic_err_count(struct lg216x_state *state, u8 *err)
 {
u8 fic_err;
@@ -936,6 +937,7 @@ static int lg216x_read_rs_err_count(struct lg216x_state 
*state, u16 *err)
}
return ret;
 }
+#endif
 
 /*  */
 
@@ -1016,6 +1018,7 @@ static int lg216x_get_frontend(struct dvb_frontend *fe)
if (lg_fail(ret))
goto fail;
}
+#if 0
ret = lg216x_read_fic_err_count(state,
(u8 *)&fe->dtv_property_cache.atscmh_fic_err);
if (lg_fail(ret))
@@ -1042,6 +1045,7 @@ static int lg216x_get_frontend(struct dvb_frontend *fe)
break;
}
lg_fail(ret);
+#endif
 fail:
retur

[PATCH 07/11] dvb-demux: add functionality to send raw payload to the dvr device

2012-05-14 Thread Michael Krufky
From: Michael Krufky 

If your driver needs to deliver the raw payload to userspace without
passing through the kernel demux, use function: dvb_dmx_swfilter_raw

Signed-off-by: Michael Krufky 
---
 drivers/media/dvb/dvb-core/dvb_demux.c |   10 ++
 drivers/media/dvb/dvb-core/dvb_demux.h |2 ++
 2 files changed, 12 insertions(+)

diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c 
b/drivers/media/dvb/dvb-core/dvb_demux.c
index faa3671..d82469f 100644
--- a/drivers/media/dvb/dvb-core/dvb_demux.c
+++ b/drivers/media/dvb/dvb-core/dvb_demux.c
@@ -568,6 +568,16 @@ void dvb_dmx_swfilter_204(struct dvb_demux *demux, const 
u8 *buf, size_t count)
 }
 EXPORT_SYMBOL(dvb_dmx_swfilter_204);
 
+void dvb_dmx_swfilter_raw(struct dvb_demux *demux, const u8 *buf, size_t count)
+{
+   spin_lock(&demux->lock);
+
+   demux->feed->cb.ts(buf, count, NULL, 0, &demux->feed->feed.ts, DMX_OK);
+
+   spin_unlock(&demux->lock);
+}
+EXPORT_SYMBOL(dvb_dmx_swfilter_raw);
+
 static struct dvb_demux_filter *dvb_dmx_filter_alloc(struct dvb_demux *demux)
 {
int i;
diff --git a/drivers/media/dvb/dvb-core/dvb_demux.h 
b/drivers/media/dvb/dvb-core/dvb_demux.h
index a7d876f..fa7188a 100644
--- a/drivers/media/dvb/dvb-core/dvb_demux.h
+++ b/drivers/media/dvb/dvb-core/dvb_demux.h
@@ -145,5 +145,7 @@ void dvb_dmx_swfilter_packets(struct dvb_demux *dvbdmx, 
const u8 *buf,
 void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count);
 void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf,
  size_t count);
+void dvb_dmx_swfilter_raw(struct dvb_demux *demux, const u8 *buf,
+ size_t count);
 
 #endif /* _DVB_DEMUX_H_ */
-- 
1.7.9.5

--
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 06/11] lg2160: update internal api interfaces and enable build

2012-05-14 Thread Michael Krufky
The lg2160 driver was written against the older dvb frontend internal api.
Because of this, the previous patch that adds the lg2160 driver leaves it
disabled in the build.  This patch updates the driver to the new internal
api and enables it in the build.

Signed-off-by: Michael Krufky 
---
 drivers/media/dvb/frontends/Kconfig  |8 
 drivers/media/dvb/frontends/lg2160.c |   25 +
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/media/dvb/frontends/Kconfig 
b/drivers/media/dvb/frontends/Kconfig
index 2124670..09e21c9 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -531,6 +531,14 @@ config DVB_LGDT3305
  An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
  to support this frontend.
 
+config DVB_LG2160
+   tristate "LG Electronics LG216x based"
+   depends on DVB_CORE && I2C
+   default m if DVB_FE_CUSTOMISE
+   help
+ An ATSC/MH demodulator module. Say Y when you want
+ to support this frontend.
+
 config DVB_S5H1409
tristate "Samsung S5H1409 based"
depends on DVB_CORE && I2C
diff --git a/drivers/media/dvb/frontends/lg2160.c 
b/drivers/media/dvb/frontends/lg2160.c
index 269ab7b..daa8596 100644
--- a/drivers/media/dvb/frontends/lg2160.c
+++ b/drivers/media/dvb/frontends/lg2160.c
@@ -939,17 +939,15 @@ static int lg216x_read_rs_err_count(struct lg216x_state 
*state, u16 *err)
 
 /*  */
 
-static int lg216x_get_frontend(struct dvb_frontend *fe,
-  struct dvb_frontend_parameters *param)
+static int lg216x_get_frontend(struct dvb_frontend *fe)
 {
struct lg216x_state *state = fe->demodulator_priv;
int ret;
 
lg_dbg("\n");
 
-   param->u.vsb.modulation = VSB_8; /* FIXME (MH) */
-   param->frequency = state->current_frequency;
-
+   fe->dtv_property_cache.modulation = VSB_8;
+   fe->dtv_property_cache.frequency = state->current_frequency;
fe->dtv_property_cache.delivery_system = SYS_ATSCMH;
 
ret = lg216x_get_fic_version(state,
@@ -1051,28 +1049,25 @@ fail:
 static int lg216x_get_property(struct dvb_frontend *fe,
   struct dtv_property *tvp)
 {
-   struct dvb_frontend_parameters param;
-
return (DTV_ATSCMH_FIC_VER == tvp->cmd) ?
-   lg216x_get_frontend(fe, ¶m) : 0;
+   lg216x_get_frontend(fe) : 0;
 }
 
 
-static int lg2160_set_frontend(struct dvb_frontend *fe,
-  struct dvb_frontend_parameters *param)
+static int lg2160_set_frontend(struct dvb_frontend *fe)
 {
struct lg216x_state *state = fe->demodulator_priv;
int ret;
 
-   lg_dbg("(%d, %d)\n", param->frequency, param->u.vsb.modulation);
+   lg_dbg("(%d)\n", fe->dtv_property_cache.frequency);
 
if (fe->ops.tuner_ops.set_params) {
-   ret = fe->ops.tuner_ops.set_params(fe, param);
+   ret = fe->ops.tuner_ops.set_params(fe);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0);
if (lg_fail(ret))
goto fail;
-   state->current_frequency = param->frequency;
+   state->current_frequency = fe->dtv_property_cache.frequency;
}
 
ret = lg2160_agc_fix(state, 0, 0);
@@ -1129,7 +1124,7 @@ static int lg2160_set_frontend(struct dvb_frontend *fe,
ret = lg216x_enable_fic(state, 1);
lg_fail(ret);
 
-   lg216x_get_frontend(fe, param);
+   lg216x_get_frontend(fe);
 fail:
return ret;
 }
@@ -1359,7 +1354,6 @@ static struct dvb_frontend_ops lg2160_ops = {
.frequency_min  = 5400,
.frequency_max  = 85800,
.frequency_stepsize = 62500,
-   .caps = FE_CAN_8VSB | FE_HAS_EXTENDED_CAPS /* FIXME (MH) */
},
.i2c_gate_ctrl= lg216x_i2c_gate_ctrl,
 #if 0
@@ -1389,7 +1383,6 @@ static struct dvb_frontend_ops lg2161_ops = {
.frequency_min  = 5400,
.frequency_max  = 85800,
.frequency_stepsize = 62500,
-   .caps = FE_CAN_8VSB | FE_HAS_EXTENDED_CAPS /* FIXME (MH) */
},
.i2c_gate_ctrl= lg216x_i2c_gate_ctrl,
 #if 0
-- 
1.7.9.5

--
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 03/11] increment DVB API to version 5.6 for ATSC-MH frontend control

2012-05-14 Thread Michael Krufky
increment the DVB API version to 5.6 to signify support for
controlling an ATSC-MH frontend.

Signed-off-by: Michael Krufky 
---
 include/linux/dvb/version.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h
index 0559e2b..43d9e8d 100644
--- a/include/linux/dvb/version.h
+++ b/include/linux/dvb/version.h
@@ -24,6 +24,6 @@
 #define _DVBVERSION_H_
 
 #define DVB_API_VERSION 5
-#define DVB_API_VERSION_MINOR 5
+#define DVB_API_VERSION_MINOR 6
 
 #endif /*_DVBVERSION_H_*/
-- 
1.7.9.5

--
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 04/11] mxl111sf-tuner: tune SYS_ATSCMH just like SYS_ATSC

2012-05-14 Thread Michael Krufky
The MxL111SF tuner is programmed the same way for ATSC-MH
as it is programmed for ATSC.

Signed-off-by: Michael Krufky 
---
 drivers/media/dvb/dvb-usb/mxl111sf-tuner.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/dvb/dvb-usb/mxl111sf-tuner.c 
b/drivers/media/dvb/dvb-usb/mxl111sf-tuner.c
index 72db6ee..74da5bb1 100644
--- a/drivers/media/dvb/dvb-usb/mxl111sf-tuner.c
+++ b/drivers/media/dvb/dvb-usb/mxl111sf-tuner.c
@@ -284,6 +284,7 @@ static int mxl111sf_tuner_set_params(struct dvb_frontend 
*fe)
 
switch (delsys) {
case SYS_ATSC:
+   case SYS_ATSCMH:
bw = 0; /* ATSC */
break;
case SYS_DVBC_ANNEX_B:
-- 
1.7.9.5

--
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 02/11] DocBook: document new DTV Properties for ATSC-MH delivery system

2012-05-14 Thread Michael Krufky
Document the following properties for controlling an ATSC-MH frontend:

DTV_ATSCMH_FIC_VER - Version number of the FIC signaling data
DTV_ATSCMH_PARADE_ID - Parade identification number
DTV_ATSCMH_NOG - Number of MH groups per MH subframe for a designated parade
DTV_ATSCMH_TNOG - Total number of MH groups in all parades in one subframe
DTV_ATSCMH_SGN - Start group number
DTV_ATSCMH_PRC - Parade repetition cycle
DTV_ATSCMH_RS_FRAME_MODE - RS frame mode
DTV_ATSCMH_RS_FRAME_ENSEMBLE - RS frame ensemble
DTV_ATSCMH_RS_CODE_MODE_PRI - RS code mode (primary)
DTV_ATSCMH_RS_CODE_MODE_SEC - RS code mode (secondary)
DTV_ATSCMH_SCCC_BLOCK_MODE - Series Concatenated Convolutional Code Block Mode
DTV_ATSCMH_SCCC_CODE_MODE_A - Series Concatenated Convolutional Code Rate A
DTV_ATSCMH_SCCC_CODE_MODE_B - Series Concatenated Convolutional Code Rate B
DTV_ATSCMH_SCCC_CODE_MODE_C - Series Concatenated Convolutional Code Rate C
DTV_ATSCMH_SCCC_CODE_MODE_D - Series Concatenated Convolutional Code Rate D
DTV_ATSCMH_FIC_ERR - FIC error count
DTV_ATSCMH_CRC_ERR - CRC error count
DTV_ATSCMH_RS_ERR - RS error count

Signed-off-by: Michael Krufky 
---
 Documentation/DocBook/media/dvb/dvbproperty.xml |  178 +++
 1 file changed, 178 insertions(+)

diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml 
b/Documentation/DocBook/media/dvb/dvbproperty.xml
index c7a4ca5..d631535 100644
--- a/Documentation/DocBook/media/dvb/dvbproperty.xml
+++ b/Documentation/DocBook/media/dvb/dvbproperty.xml
@@ -531,6 +531,154 @@ typedef enum fe_delivery_system {
here are referring to what can be found in the 
TMCC-structure -
independent of the mode.

+   
+   DTV_ATSCMH_FIC_VER
+   Version number of the FIC (Fast Information 
Channel) signaling data.
+   FIC is used for relaying information to allow 
rapid service acquisition by the receiver.
+   Possible values: 0, 1, 2, 3, ..., 30, 31
+   
+   
+   DTV_ATSCMH_PARADE_ID
+   Parade identification number
+   A parade is a collection of up to eight MH 
groups, conveying one or two ensembles.
+   Possible values: 0, 1, 2, 3, ..., 126, 127
+   
+   
+   DTV_ATSCMH_NOG
+   Number of MH groups per MH subframe for a 
designated parade.
+   Possible values: 1, 2, 3, 4, 5, 6, 7, 8
+   
+   
+   DTV_ATSCMH_TNOG
+   Total number of MH groups including all MH groups 
belonging to all MH parades in one MH subframe.
+   Possible values: 0, 1, 2, 3, ..., 30, 31
+   
+   
+   DTV_ATSCMH_SGN
+   Start group number.
+   Possible values: 0, 1, 2, 3, ..., 14, 15
+   
+   
+   DTV_ATSCMH_PRC
+   Parade repetition cycle.
+   Possible values: 1, 2, 3, 4, 5, 6, 7, 8
+   
+   
+   
DTV_ATSCMH_RS_FRAME_MODE
+   RS frame mode.
+   Possible values are:
+
+typedef enum atscmh_rs_frame_mode {
+   ATSCMH_RSFRAME_PRI_ONLY  = 0,
+   ATSCMH_RSFRAME_PRI_SEC   = 1,
+} atscmh_rs_frame_mode_t;
+
+   
+   
+   
DTV_ATSCMH_RS_FRAME_ENSEMBLE
+   RS frame ensemble.
+   Possible values are:
+
+typedef enum atscmh_rs_frame_ensemble {
+   ATSCMH_RSFRAME_ENS_PRI   = 0,
+   ATSCMH_RSFRAME_ENS_SEC   = 1,
+} atscmh_rs_frame_ensemble_t;
+
+   
+   
+   
DTV_ATSCMH_RS_CODE_MODE_PRI
+   RS code mode (primary).
+   Possible values are:
+
+typedef enum atscmh_rs_code_mode {
+   ATSCMH_RSCODE_211_187= 0,
+   ATSCMH_RSCODE_223_187= 1,
+   ATSCMH_RSCODE_235_187= 2,
+} atscmh_rs_code_mode_t;
+
+   
+   
+   
DTV_ATSCMH_RS_CODE_MODE_SEC
+   RS code mode (secondary).
+   Possible values are:
+
+typedef enum atscmh_rs_code_mode {
+   ATSCMH_RSCODE_211_187= 0,
+   ATSCMH_RSCODE_223_187= 1,
+   ATSCMH_RSCODE_235_187= 2,
+} atscmh_rs_code_mode_t;
+
+   
+   
+   
DTV_ATSCMH_SCCC_BLOCK_MODE
+   Series Concatenated Convolutional Code Block 
Mode.
+   Possible values are:
+
+typedef enum atscmh_sccc_block_mode {
+   ATSCMH_SCCC_BLK_SEP  = 0,
+   ATSCMH_SCCC_BLK_COMB = 1,
+} atscmh_sccc_block_mode_t;
+
+   
+   
+

[PATCH 01/11] linux-dvb v5 API support for ATSC-MH

2012-05-14 Thread Michael Krufky
Add the following properties for controlling an ATSC-MH frontend:

DTV_ATSCMH_FIC_VER
DTV_ATSCMH_PARADE_ID
DTV_ATSCMH_NOG
DTV_ATSCMH_TNOG
DTV_ATSCMH_SGN
DTV_ATSCMH_PRC
DTV_ATSCMH_RS_FRAME_MODE
DTV_ATSCMH_RS_FRAME_ENSEMBLE
DTV_ATSCMH_RS_CODE_MODE_PRI
DTV_ATSCMH_RS_CODE_MODE_SEC
DTV_ATSCMH_SCCC_BLOCK_MODE
DTV_ATSCMH_SCCC_CODE_MODE_A
DTV_ATSCMH_SCCC_CODE_MODE_B
DTV_ATSCMH_SCCC_CODE_MODE_C
DTV_ATSCMH_SCCC_CODE_MODE_D
DTV_ATSCMH_FIC_ERR
DTV_ATSCMH_CRC_ERR
DTV_ATSCMH_RS_ERR

Signed-off-by: Michael Krufky 
---
 drivers/media/dvb/dvb-core/dvb_frontend.c |   92 -
 drivers/media/dvb/dvb-core/dvb_frontend.h |   22 +++
 include/linux/dvb/frontend.h  |   54 -
 3 files changed, 166 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c 
b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 4555baa..067f10a 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -180,13 +180,13 @@ static enum dvbv3_emulation_type dvbv3_type(u32 
delivery_system)
case SYS_DMBTH:
return DVBV3_OFDM;
case SYS_ATSC:
+   case SYS_ATSCMH:
case SYS_DVBC_ANNEX_B:
return DVBV3_ATSC;
case SYS_UNDEFINED:
case SYS_ISDBC:
case SYS_DVBH:
case SYS_DAB:
-   case SYS_ATSCMH:
default:
/*
 * Doesn't know how to emulate those types and/or
@@ -1027,6 +1027,28 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = 
{
_DTV_CMD(DTV_HIERARCHY, 0, 0),
 
_DTV_CMD(DTV_ENUM_DELSYS, 0, 0),
+
+   _DTV_CMD(DTV_ATSCMH_PARADE_ID, 1, 0),
+   _DTV_CMD(DTV_ATSCMH_RS_FRAME_ENSEMBLE, 1, 0),
+
+   _DTV_CMD(DTV_ATSCMH_FIC_VER, 0, 0),
+   _DTV_CMD(DTV_ATSCMH_PARADE_ID, 0, 0),
+   _DTV_CMD(DTV_ATSCMH_NOG, 0, 0),
+   _DTV_CMD(DTV_ATSCMH_TNOG, 0, 0),
+   _DTV_CMD(DTV_ATSCMH_SGN, 0, 0),
+   _DTV_CMD(DTV_ATSCMH_PRC, 0, 0),
+   _DTV_CMD(DTV_ATSCMH_RS_FRAME_MODE, 0, 0),
+   _DTV_CMD(DTV_ATSCMH_RS_FRAME_ENSEMBLE, 0, 0),
+   _DTV_CMD(DTV_ATSCMH_RS_CODE_MODE_PRI, 0, 0),
+   _DTV_CMD(DTV_ATSCMH_RS_CODE_MODE_SEC, 0, 0),
+   _DTV_CMD(DTV_ATSCMH_SCCC_BLOCK_MODE, 0, 0),
+   _DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_A, 0, 0),
+   _DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_B, 0, 0),
+   _DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_C, 0, 0),
+   _DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_D, 0, 0),
+   _DTV_CMD(DTV_ATSCMH_FIC_ERR, 0, 0),
+   _DTV_CMD(DTV_ATSCMH_CRC_ERR, 0, 0),
+   _DTV_CMD(DTV_ATSCMH_RS_ERR, 0, 0),
 };
 
 static void dtv_property_dump(struct dtv_property *tvp)
@@ -1118,6 +1140,8 @@ static int dtv_property_cache_sync(struct dvb_frontend 
*fe,
case DVBV3_ATSC:
dprintk("%s() Preparing ATSC req\n", __func__);
c->modulation = p->u.vsb.modulation;
+   if (c->delivery_system == SYS_ATSCMH)
+   break;
if ((c->modulation == VSB_8) || (c->modulation == VSB_16))
c->delivery_system = SYS_ATSC;
else
@@ -1364,6 +1388,63 @@ static int dtv_property_process_get(struct dvb_frontend 
*fe,
case DTV_DVBT2_PLP_ID:
tvp->u.data = c->dvbt2_plp_id;
break;
+
+   /* ATSC-MH */
+   case DTV_ATSCMH_FIC_VER:
+   tvp->u.data = fe->dtv_property_cache.atscmh_fic_ver;
+   break;
+   case DTV_ATSCMH_PARADE_ID:
+   tvp->u.data = fe->dtv_property_cache.atscmh_parade_id;
+   break;
+   case DTV_ATSCMH_NOG:
+   tvp->u.data = fe->dtv_property_cache.atscmh_nog;
+   break;
+   case DTV_ATSCMH_TNOG:
+   tvp->u.data = fe->dtv_property_cache.atscmh_tnog;
+   break;
+   case DTV_ATSCMH_SGN:
+   tvp->u.data = fe->dtv_property_cache.atscmh_sgn;
+   break;
+   case DTV_ATSCMH_PRC:
+   tvp->u.data = fe->dtv_property_cache.atscmh_prc;
+   break;
+   case DTV_ATSCMH_RS_FRAME_MODE:
+   tvp->u.data = fe->dtv_property_cache.atscmh_rs_frame_mode;
+   break;
+   case DTV_ATSCMH_RS_FRAME_ENSEMBLE:
+   tvp->u.data = fe->dtv_property_cache.atscmh_rs_frame_ensemble;
+   break;
+   case DTV_ATSCMH_RS_CODE_MODE_PRI:
+   tvp->u.data = fe->dtv_property_cache.atscmh_rs_code_mode_pri;
+   break;
+   case DTV_ATSCMH_RS_CODE_MODE_SEC:
+   tvp->u.data = fe->dtv_property_cache.atscmh_rs_code_mode_sec;
+   break;
+   case DTV_ATSCMH_SCCC_BLOCK_MODE:
+   tvp->u.data = fe->dtv_property_cache.atscmh_sccc_block_mode;
+   break;
+   case DTV_ATSCMH_SCCC_CODE_MODE_A:
+   tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_a;
+   break;
+   case DTV_ATSCMH_SCCC_CODE_MODE_B:
+   tvp->u.data = fe->dtv_prope

[PULL PATCH 00/11] ATSC-MH driver support for the Hauppauge WinTV Aero-m

2012-05-14 Thread Michael Krufky
Mauro,

After our discussion in IRC today, I made the additional changes that
you requested, along with better patch descriptions, and the "stats"
bits have been disabled / removed.  Please merge.  (patch bomb
follows)

The following changes since commit 296da3cd14db9eb5606924962b2956c9c656dbb0:

  [media] pwc: poll(): Check that the device has not beem claimed for
streaming already (2012-03-27 11:42:04 -0300)

are available in the git repository at:

  git://git.linuxtv.org/mkrufky/mxl111sf atscmh_aero-m_for_v3.5

for you to fetch changes up to 9196bebd70ae388ecc35656c48879376730dd7c4:

  DVB: remove "stats" property bits from ATSC-MH API property
additions (2012-05-14 17:54:34 -0400)


Michael Krufky (11):
  linux-dvb v5 API support for ATSC-MH
  DocBook: document new DTV Properties for ATSC-MH delivery system
  increment DVB API to version 5.6 for ATSC-MH frontend control
  mxl111sf-tuner: tune SYS_ATSCMH just like SYS_ATSC
  DVB: add support for the LG2160 ATSC-MH demodulator
  lg2160: update internal api interfaces and enable build
  dvb-demux: add functionality to send raw payload to the dvr device
  dvb-usb: add support for dvb-usb-adapters that deliver raw payload
  dvb-usb: increase MAX_NO_OF_FE_PER_ADAP from 2 to 3
  mxl111sf: add ATSC-MH support
  DVB: remove "stats" property bits from ATSC-MH API property additions

 Documentation/DocBook/media/dvb/dvbproperty.xml |  160 +++
 drivers/media/dvb/dvb-core/dvb_demux.c  |   10 +
 drivers/media/dvb/dvb-core/dvb_demux.h  |2 +
 drivers/media/dvb/dvb-core/dvb_frontend.c   |   80 +-
 drivers/media/dvb/dvb-core/dvb_frontend.h   |   18 +
 drivers/media/dvb/dvb-usb/Kconfig   |1 +
 drivers/media/dvb/dvb-usb/dvb-usb-urb.c |   12 +
 drivers/media/dvb/dvb-usb/dvb-usb.h |3 +-
 drivers/media/dvb/dvb-usb/mxl111sf-tuner.c  |1 +
 drivers/media/dvb/dvb-usb/mxl111sf.c|  871 +-
 drivers/media/dvb/frontends/Kconfig |8 +
 drivers/media/dvb/frontends/Makefile|1 +
 drivers/media/dvb/frontends/lg2160.c| 1468 +++
 drivers/media/dvb/frontends/lg2160.h|   84 ++
 include/linux/dvb/frontend.h|   51 +-
 include/linux/dvb/version.h |2 +-
 16 files changed, 2721 insertions(+), 51 deletions(-)
 create mode 100644 drivers/media/dvb/frontends/lg2160.c
 create mode 100644 drivers/media/dvb/frontends/lg2160.h
--
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 V6 1/5] WL128x: Add support for FM TX RDS

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

This patch adds support for following FM TX RDS features,
 1. Radio Text
 2. PS Name
 3. PI Code
 4. PTY Code.

Along with above this patch fixes few other minor issues(like
fm tx get frequency, unnecessary error messages etc).

Signed-off-by: Manjunatha Halli 
---
 drivers/media/radio/wl128x/fmdrv_common.c |   17 +++---
 drivers/media/radio/wl128x/fmdrv_common.h |   17 +++
 drivers/media/radio/wl128x/fmdrv_rx.c |2 +-
 drivers/media/radio/wl128x/fmdrv_tx.c |   41 ++---
 drivers/media/radio/wl128x/fmdrv_tx.h |3 +-
 drivers/media/radio/wl128x/fmdrv_v4l2.c   |   47 +
 6 files changed, 90 insertions(+), 37 deletions(-)

diff --git a/drivers/media/radio/wl128x/fmdrv_common.c 
b/drivers/media/radio/wl128x/fmdrv_common.c
index bf867a6..fcce61a 100644
--- a/drivers/media/radio/wl128x/fmdrv_common.c
+++ b/drivers/media/radio/wl128x/fmdrv_common.c
@@ -354,7 +354,7 @@ static void send_tasklet(unsigned long arg)
 
/* Check, is there any timeout happened to last transmitted packet */
if ((jiffies - fmdev->last_tx_jiffies) > FM_DRV_TX_TIMEOUT) {
-   fmerr("TX timeout occurred\n");
+   fmdbg("TX timeout occurred\n");
atomic_set(&fmdev->tx_cnt, 1);
}
 
@@ -615,7 +615,11 @@ static void fm_irq_handle_rds_start(struct fmdev *fmdev)
 {
if (fmdev->irq_info.flag & FM_RDS_EVENT & fmdev->irq_info.mask) {
fmdbg("irq: rds threshold reached\n");
-   fmdev->irq_info.stage = FM_RDS_SEND_RDS_GETCMD_IDX;
+   /* If RSSI reached below threshold then dont get RDS data */
+   if (fmdev->irq_info.flag & FM_LEV_EVENT)
+   fmdev->irq_info.stage = FM_HW_TUNE_OP_ENDED_IDX;
+   else
+   fmdev->irq_info.stage = FM_RDS_SEND_RDS_GETCMD_IDX;
} else {
/* Continue next function in interrupt handler table */
fmdev->irq_info.stage = FM_HW_TUNE_OP_ENDED_IDX;
@@ -1129,8 +1133,9 @@ int fmc_set_freq(struct fmdev *fmdev, u32 freq_to_set)
 
 int fmc_get_freq(struct fmdev *fmdev, u32 *cur_tuned_frq)
 {
-   if (fmdev->rx.freq == FM_UNDEFINED_FREQ) {
-   fmerr("RX frequency is not set\n");
+   if (fmdev->rx.freq == FM_UNDEFINED_FREQ &&
+   fmdev->tx_data.tx_frq == FM_UNDEFINED_FREQ) {
+   fmerr("RX/TX frequency is not set\n");
return -EPERM;
}
if (cur_tuned_frq == NULL) {
@@ -1144,7 +1149,7 @@ int fmc_get_freq(struct fmdev *fmdev, u32 *cur_tuned_frq)
return 0;
 
case FM_MODE_TX:
-   *cur_tuned_frq = 0; /* TODO : Change this later */
+   *cur_tuned_frq = fmdev->tx_data.tx_frq;
return 0;
 
default:
@@ -1574,6 +1579,8 @@ int fmc_prepare(struct fmdev *fmdev)
fmdev->rx.af_mode = FM_RX_RDS_AF_SWITCH_MODE_OFF;
fmdev->irq_info.retry = 0;
 
+   fmdev->tx_data.tx_frq = FM_UNDEFINED_FREQ;
+
fm_rx_reset_rds_cache(fmdev);
init_waitqueue_head(&fmdev->rx.rds.read_queue);
 
diff --git a/drivers/media/radio/wl128x/fmdrv_common.h 
b/drivers/media/radio/wl128x/fmdrv_common.h
index d9b9c6c..196ff7d 100644
--- a/drivers/media/radio/wl128x/fmdrv_common.h
+++ b/drivers/media/radio/wl128x/fmdrv_common.h
@@ -48,8 +48,8 @@ struct fm_reg_table {
 #define SEARCH_LVL_SET   15
 #define BAND_SET 16
 #define MUTE_STATUS_SET  17
-#define RDS_PAUSE_LVL_SET18
-#define RDS_PAUSE_DUR_SET19
+#define AUD_PAUSE_LVL_SET18
+#define AUD_PAUSE_DUR_SET19
 #define RDS_MEM_SET  20
 #define RDS_BLK_B_SET21
 #define RDS_MSK_B_SET22
@@ -84,11 +84,12 @@ struct fm_reg_table {
 
 #define FM_POWER_MODE254
 #define FM_INTERRUPT 255
+#define STATION_VALID   123
 
 /* Transmitter API */
 
 #define CHANL_SET55
-#define CHANL_BW_SET   56
+#define SCAN_SPACING_SET 56
 #define REF_SET  57
 #define POWER_ENB_SET90
 #define POWER_ATT_SET58
@@ -103,7 +104,8 @@ struct fm_reg_table {
 #define MONO_SET 66
 #define MUTE 92
 #define MPX_LMT_ENABLE   67
-#define PI_SET   93
+#define REF_ERR_SET 93
+#define PI_SET   68
 #define ECC_SET  69
 #define PTY  70
 #define AF   71
@@ -120,6 +122,10 @@ struct fm_reg_table {
 #define TX_AUDIO_LEVEL_TEST  96
 #define TX_AUDIO_LEVEL_TEST_THRESHOLD73
 #define TX_AUDIO_INPUT_LEVEL_RANGE_SET   54
+#define TX_AUDIO_LEVEL_GET  7
+#define READ_FMANT_TUNE_VALUE104
+
+/* New FM APIs (Rx and Tx) */
 #define RX_ANTENNA_SELECT87
 #define I2C_DEV_ADDR_SET 86
 #define REF_ERR_CALIB_PARAM_SET 

[PATCH V6 2/5] New control class and features for FM RX

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

This patch creates new ctrl class for FM RX and adds new CID's for
below FM features,
  1) De-Emphasis filter mode
  2) RDS Alternate Frequency switch

Also this patch adds a field for band selection in struct v4l2_hw_freq_seek
and adds new capability flags for all below FM bands
1) V4L2_TUNER_CAP_BAND_TYPE_DEFAULT -> Default Band
2) V4L2_TUNER_CAP_BAND_TYPE_EUROPE_US -> Europe/US Band
3) V4L2_TUNER_CAP_BAND_TYPE_JAPAN   -> Japan Band
4) V4L2_TUNER_CAP_BAND_TYPE_RUSSIAN -> Russian Band
5) V4L2_TUNER_CAP_BAND_TYPE_WEATHER -> Weather Band

Signed-off-by: Manjunatha Halli 
---
 drivers/media/video/v4l2-ctrls.c |   17 ++---
 include/linux/videodev2.h|   24 +++-
 2 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 18015c0..9d7608e 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -243,8 +243,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
"Vivid",
NULL
};
-   static const char * const tune_preemphasis[] = {
-   "No Preemphasis",
+   static const char * const tune_emphasis[] = {
+   "None",
"50 Microseconds",
"75 Microseconds",
NULL,
@@ -413,7 +413,9 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
case V4L2_CID_COLORFX:
return colorfx;
case V4L2_CID_TUNE_PREEMPHASIS:
-   return tune_preemphasis;
+   return tune_emphasis;
+   case V4L2_CID_TUNE_DEEMPHASIS:
+   return tune_emphasis;
case V4L2_CID_FLASH_LED_MODE:
return flash_led_mode;
case V4L2_CID_FLASH_STROBE_SOURCE:
@@ -644,6 +646,12 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_JPEG_COMPRESSION_QUALITY: return "Compression Quality";
case V4L2_CID_JPEG_ACTIVE_MARKER:   return "Active Markers";
 
+   /* FM Radio Receiver control */
+   /* Keep the order of the 'case's the same as in videodev2.h! */
+   case V4L2_CID_FM_RX_CLASS:  return "FM Radio Receiver 
Controls";
+   case V4L2_CID_RDS_AF_SWITCH:return "RDS Alternate Frequency 
Switch";
+   case V4L2_CID_TUNE_DEEMPHASIS:  return "De-Emphasis";
+
default:
return NULL;
}
@@ -688,6 +696,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM:
case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE:
case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL:
+   case V4L2_CID_RDS_AF_SWITCH:
*type = V4L2_CTRL_TYPE_BOOLEAN;
*min = 0;
*max = *step = 1;
@@ -733,6 +742,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
+   case V4L2_CID_TUNE_DEEMPHASIS:
*type = V4L2_CTRL_TYPE_MENU;
break;
case V4L2_CID_RDS_TX_PS_NAME:
@@ -745,6 +755,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_FM_TX_CLASS:
case V4L2_CID_FLASH_CLASS:
case V4L2_CID_JPEG_CLASS:
+   case V4L2_CID_FM_RX_CLASS:
*type = V4L2_CTRL_TYPE_CTRL_CLASS;
/* You can neither read not write these */
*flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY;
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index c9c9a46..7b3dd95 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1137,6 +1137,7 @@ struct v4l2_ext_controls {
 #define V4L2_CTRL_CLASS_FM_TX 0x009b   /* FM Modulator control class */
 #define V4L2_CTRL_CLASS_FLASH 0x009c   /* Camera flash controls */
 #define V4L2_CTRL_CLASS_JPEG 0x009d/* JPEG-compression 
controls */
+#define V4L2_CTRL_CLASS_FM_RX 0x009e   /* FM Receiver control class */
 
 #define V4L2_CTRL_ID_MASK(0x0fff)
 #define V4L2_CTRL_ID2CLASS(id)((id) & 0x0fffUL)
@@ -1782,6 +1783,13 @@ enum v4l2_jpeg_chroma_subsampling {
 #defineV4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)
 #defineV4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)
 
+/* FM Receiver class control IDs */
+#define V4L2_CID_FM_RX_CLASS_BASE  (V4L2_CTRL_CLASS_FM_RX | 0x900)
+#define V4L2_CID_FM_RX_CLASS   (V4L2_CTRL_CLASS_FM_RX | 1)
+
+#define V4L2_CID_RDS_AF_SWITCH (V4L2_CID_FM_RX_CLASS_BASE + 1)
+#define V4L2_CID_TUNE_DEEMPHASIS   (V4L2_CID_FM_RX_CLASS_BASE + 2)
+
 /*
  * T U N I N G
  */
@@ -1819,6 +1827,12 @@ struct v4l2_modulator {
 #define V4L2_TUNER_CAP_RDS 0x0080

[PATCH V6 4/5] Media: Update docs for V4L2 FM new features

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

The list of new features -
1) New control class for FM RX
2) New FM RX CID's - De-Emphasis filter mode and RDS AF switch
3) New FM TX CID - RDS Alternate frequency set.
4) New capability struct v4l2_tuner flags for band selection

Signed-off-by: Manjunatha Halli 
---
 Documentation/DocBook/media/v4l/compat.xml |3 +
 Documentation/DocBook/media/v4l/controls.xml   |   77 
 Documentation/DocBook/media/v4l/dev-rds.xml|5 +-
 .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml   |7 ++
 Documentation/DocBook/media/v4l/vidioc-g-tuner.xml |   25 +++
 .../DocBook/media/v4l/vidioc-s-hw-freq-seek.xml|   38 +-
 6 files changed, 151 insertions(+), 4 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/compat.xml 
b/Documentation/DocBook/media/v4l/compat.xml
index bce97c5..df1f345 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -2311,6 +2311,9 @@ more information.
  Added FM Modulator (FM TX) Extended Control Class: 
V4L2_CTRL_CLASS_FM_TX and their Control IDs.


+   Added FM Receiver (FM RX) Extended Control Class: 
V4L2_CTRL_CLASS_FM_RX and their Control IDs.
+   
+   
  Added Remote Controller chapter, describing the default Remote 
Controller mapping for media devices.

   
diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index b84f25e..ced2bee 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -3018,6 +3018,12 @@ to find receivers which can scroll strings sized as 32 x 
N or 64 x N characters.
 with steps of 32 or 64 characters. The result is it must always contain a 
string with size multiple of 32 or 64. 
  
  
+ V4L2_CID_RDS_TX_AF_FREQ 
+ integer
+ 
+ Sets the RDS Alternate Frequency value 
which allows a receiver to re-tune to a different frequency providing the same 
station when the first signal becomes too weak (e.g., when moving out of 
range). 
+ 
+ 
V4L2_CID_AUDIO_LIMITER_ENABLED 
boolean
  
@@ -3146,6 +3152,77 @@ manually or automatically if set to zero. Unit, range 
and step are driver-specif
  document, from CENELEC.
 
 
+
+  FM Receiver Control Reference
+
+  The FM Receiver (FM_RX) class includes controls for common 
features of
+FM Reception capable devices.
+
+  
+  FM_RX Control IDs
+
+  
+
+
+
+
+
+
+
+  
+ID
+Type
+  Description
+  
+
+
+  
+  
+V4L2_CID_FM_RX_CLASS 
+class
+  The FM_RX class
+descriptor. Calling &VIDIOC-QUERYCTRL; for this control will return a
+description of this control class.
+  
+  
+V4L2_CID_RDS_AF_SWITCH 
+boolean
+  
+  Enable or Disable the RDS Alternate 
frequency feature. When enabled the driver will decode the RDS AF field and 
tries to switch to this AF frequency once the current frequency RSSI (Received 
signal strength indication) level goes below the threshold. If the frequency is 
switched, then &VIDIOC-G-FREQUENCY; will return the new frequency.
+  
+  
+   V4L2_CID_TUNE_DEEMPHASIS 
+   integer
+ 
+ Configures the 
de-emphasis value for reception.
+A pre-emphasis filter is applied to the broadcast to accentuate the high audio 
frequencies.
+Depending on the region, a time constant of either 50 or 75 useconds is used. 
The enum v4l2_preemphasis
+defines possible values for pre-emphasis. Here they are:
+   
+   
+ 
+   
+ 
V4L2_PREEMPHASIS_DISABLED 
+ No de-emphasis is applied.
+   
+   
+ 
V4L2_PREEMPHASIS_50_uS 
+ A de-emphasis of 50 uS is used.
+   
+   
+ 
V4L2_PREEMPHASIS_75_uS 
+ A de-emphasis of 75 uS is used.
+   
+ 
+   
+
+ 
+  
+
+  
+  
+
+  
 
   Flash Control Reference
 
diff --git a/Documentation/DocBook/media/v4l/dev-rds.xml 
b/Documentation/DocBook/media/v4l/dev-rds.xml
index 38883a4..8188161 100644
--- a/Documentation/DocBook/media/v4l/dev-rds.xml
+++ b/Documentation/DocBook/media/v4l/dev-rds.xml
@@ -55,8 +55,9 @@ If the driver only passes RDS blocks without interpreting the 
data
 the V4L2_TUNER_CAP_RDS_BLOCK_IO flag has to be set. If the
 tuner is capable of handling RDS entities like program identification codes 
and radio
 text, the flag V4L2_TUNER_CAP_RDS_CONTROLS should be set,
-see Writing

[PATCH V6 5/5] WL12xx: Add support for FM new features.

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

This patch adds below features to TI's V4l2 FM driver for Wilink
chipsets,

1) FM RX Set frequency allows to set frequency anywhere between
65.5 MHz till 108 MHz (if chip is Wilink8 then till 164.55 MHz)
2) FM RX seek caters for band switch
3) FM RX RDS AF turn ON/OFF
4) FM RX De-Emphasis mode set/get
5) FM TX Alternate Frequency set/get

Also this patch fixes below issues

1) FM audio volume gain setting
2) Default rssi level is set to 8 instead of 20
3) Issue related to audio mute/unmute
4) Enable FM RX AF support in driver
5) In wrap_around seek mode try for once

Signed-off-by: Manjunatha Halli 
---
 drivers/media/radio/wl128x/fmdrv.h|3 +-
 drivers/media/radio/wl128x/fmdrv_common.c |   38 +--
 drivers/media/radio/wl128x/fmdrv_common.h |   28 +++-
 drivers/media/radio/wl128x/fmdrv_rx.c |   90 -
 drivers/media/radio/wl128x/fmdrv_rx.h |2 +-
 drivers/media/radio/wl128x/fmdrv_v4l2.c   |  101 +++--
 6 files changed, 224 insertions(+), 38 deletions(-)

diff --git a/drivers/media/radio/wl128x/fmdrv.h 
b/drivers/media/radio/wl128x/fmdrv.h
index d84ad9d..c806c85 100644
--- a/drivers/media/radio/wl128x/fmdrv.h
+++ b/drivers/media/radio/wl128x/fmdrv.h
@@ -150,6 +150,7 @@ struct fm_rx {
struct region_info region;  /* Current selected band */
u32 freq;   /* Current RX frquency */
u8 mute_mode;   /* Current mute mode */
+   u8 bl_flag; /* Band limit reached flag */
u8 deemphasis_mode; /* Current deemphasis mode */
/* RF dependent soft mute mode */
u8 rf_depend_mute;
@@ -203,7 +204,7 @@ struct fmtx_data {
 struct fmdev {
struct video_device *radio_dev; /* V4L2 video device pointer */
struct snd_card *card;  /* Card which holds FM mixer controls */
-   u16 asci_id;
+   u16 asic_id;
spinlock_t rds_buff_lock; /* To protect access to RDS buffer */
spinlock_t resp_skb_lock; /* To protect access to received SKB */
 
diff --git a/drivers/media/radio/wl128x/fmdrv_common.c 
b/drivers/media/radio/wl128x/fmdrv_common.c
index fcce61a..ac20556 100644
--- a/drivers/media/radio/wl128x/fmdrv_common.c
+++ b/drivers/media/radio/wl128x/fmdrv_common.c
@@ -44,20 +44,41 @@
 
 /* Region info */
 static struct region_info region_configs[] = {
+   /* Super set of all bands */
+   {
+.chanl_space = FM_CHANNEL_SPACING_200KHZ * FM_FREQ_MUL,
+.bot_freq = 65800, /* 87.5 MHz */
+.top_freq = 162550,/* 108 MHz */
+.fm_band = 0,
+},
/* Europe/US */
{
 .chanl_space = FM_CHANNEL_SPACING_200KHZ * FM_FREQ_MUL,
 .bot_freq = 87500, /* 87.5 MHz */
 .top_freq = 108000,/* 108 MHz */
-.fm_band = 0,
+.fm_band = 1,
 },
/* Japan */
{
 .chanl_space = FM_CHANNEL_SPACING_200KHZ * FM_FREQ_MUL,
 .bot_freq = 76000, /* 76 MHz */
 .top_freq = 9, /* 90 MHz */
-.fm_band = 1,
+.fm_band = 2,
 },
+   /* Russian (OIRT) band */
+   {
+   .chanl_space = FM_CHANNEL_SPACING_50KHZ * FM_FREQ_MUL_RUS,
+   .bot_freq = 65800, /* 65.8 MHz */
+   .top_freq = 74000, /* 74 MHz */
+   .fm_band = 3,
+   },
+   /* Wether Band */
+   {
+   .chanl_space = FM_CHANNEL_SPACING_50KHZ * FM_FREQ_MUL_WB,
+   .bot_freq = 162400, /* 162.4 MHz */
+   .top_freq = 162550, /* 162.55 MHz */
+   .fm_band = 4,
+   }
 };
 
 /* Band selection */
@@ -596,7 +617,6 @@ static void fm_irq_handle_flag_getcmd_resp(struct fmdev 
*fmdev)
memcpy(&fmdev->irq_info.flag, skb->data, fm_evt_hdr->dlen);
 
fmdev->irq_info.flag = be16_to_cpu(fmdev->irq_info.flag);
-   fmdbg("irq: flag register(0x%x)\n", fmdev->irq_info.flag);
 
/* Continue next function in interrupt handler table */
fm_irq_call_stage(fmdev, FM_HW_MAL_FUNC_IDX);
@@ -702,7 +722,7 @@ static void fm_rdsparse_swapbytes(struct fmdev *fmdev,
 * in Dolphin they are in big endian, the parsing of the RDS data
 * is chip dependent
 */
-   if (fmdev->asci_id != 0x6350) {
+   if (fmdev->asic_id != 0x6350) {
rds_buff = &rds_format->data.groupdatabuff.buff[0];
while (index + 1 < FM_RX_RDS_INFO_FIELD_MAX) {
byte1 = rds_buff[index];
@@ -1353,11 +1373,13 @@ static int fm_power_up(struct fmdev *fmdev, u8 mode)
sizeof(asic_ver), &asic_ver, &resp_len))
goto rel;
 
+   fmdev->asic_id = be16_to_cpu(asic_id);
+
fmdbg("ASIC ID: 0x%x , ASIC Version: %d\n",
-   be16_to_cpu(asic_id), be16_to_cpu(asic_ver));
+   fmdev->asic_id, be16_to_cpu(asic_ver));
 
sprintf(fw_name, "%s_%x.%d.bts", FM_FMC_FW_FILE_START,
-  

[PATCH V6 3/5] Add new CID for FM TX RDS Alternate Frequency

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

Signed-off-by: Manjunatha Halli 
---
 drivers/media/video/v4l2-ctrls.c |1 +
 include/linux/videodev2.h|1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 9d7608e..610076c 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -608,6 +608,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_RDS_TX_PTY:   return "RDS Program Type";
case V4L2_CID_RDS_TX_PS_NAME:   return "RDS PS Name";
case V4L2_CID_RDS_TX_RADIO_TEXT:return "RDS Radio Text";
+   case V4L2_CID_RDS_TX_AF_FREQ:   return "RDS Alternate 
Frequency";
case V4L2_CID_AUDIO_LIMITER_ENABLED:return "Audio Limiter Feature 
Enabled";
case V4L2_CID_AUDIO_LIMITER_RELEASE_TIME: return "Audio Limiter Release 
Time";
case V4L2_CID_AUDIO_LIMITER_DEVIATION:  return "Audio Limiter 
Deviation";
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 7b3dd95..b16d603 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1699,6 +1699,7 @@ enum  v4l2_exposure_auto_type {
 #define V4L2_CID_RDS_TX_PTY(V4L2_CID_FM_TX_CLASS_BASE + 3)
 #define V4L2_CID_RDS_TX_PS_NAME
(V4L2_CID_FM_TX_CLASS_BASE + 5)
 #define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6)
+#define V4L2_CID_RDS_TX_AF_FREQ
(V4L2_CID_FM_TX_CLASS_BASE + 7)
 
 #define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64)
 #define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME(V4L2_CID_FM_TX_CLASS_BASE + 65)
-- 
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 V6 0/5] [Media] Radio: Fixes and New features for FM

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

Mauro and the list,

Fixed version 6 of patchset 2/5.
 
This version 6 of patchset resolves the comments received from
Han's on patchset v5.
 
This patchset creates new control class 'V4L2_CTRL_CLASS_FM_RX' for FM RX,
introduces 2 new CID's for FM RX and and 1 new CID for FM TX. Also adds 1
field in struct v4l2_hw_freq_seek.
  
This patch adds few new features to TI's FM driver features
are listed below,
   
1) FM TX RDS Support (RT, PS, AF, PI, PTY)  
2) FM RX Russian band support
3) FM RX AF set/get
4) FM RX De-emphasis mode set/get

Along with new features this patch also fixes few issues in the driver
like default rssi level for seek, unnecessory logs etc.

Manjunatha Halli (5):
  WL128x: Add support for FM TX RDS
  New control class and features for FM RX
  Add new CID for FM TX RDS Alternate Frequency
  Media: Update docs for V4L2 FM new features
  WL12xx: Add support for FM new features.

 Documentation/DocBook/media/v4l/compat.xml |3 +
 Documentation/DocBook/media/v4l/controls.xml   |   77 ++
 Documentation/DocBook/media/v4l/dev-rds.xml|5 +-
 .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml   |7 +
 Documentation/DocBook/media/v4l/vidioc-g-tuner.xml |   25 
 .../DocBook/media/v4l/vidioc-s-hw-freq-seek.xml|   38 +-
 drivers/media/radio/wl128x/fmdrv.h |3 +-
 drivers/media/radio/wl128x/fmdrv_common.c  |   55 ++--
 drivers/media/radio/wl128x/fmdrv_common.h  |   43 +-
 drivers/media/radio/wl128x/fmdrv_rx.c  |   92 ++---
 drivers/media/radio/wl128x/fmdrv_rx.h  |2 +-
 drivers/media/radio/wl128x/fmdrv_tx.c  |   41 +++---
 drivers/media/radio/wl128x/fmdrv_tx.h  |3 +-
 drivers/media/radio/wl128x/fmdrv_v4l2.c|  148 +++-
 drivers/media/video/v4l2-ctrls.c   |   18 ++-
 include/linux/videodev2.h  |   25 +++-
 16 files changed, 503 insertions(+), 82 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 V6 0/5] [Media] Radio: Fixes and New features for FM

2012-05-14 Thread Hans Verkuil
On Mon May 14 2012 22:27:19 manjunatha_ha...@ti.com wrote:
> From: Manjunatha Halli 
> 
> Mauro and the list,
> 
> This version 6 of patchset resolves the comments received from
> Han's on patchset v5.
>  
> This patchset creates new control class 'V4L2_CTRL_CLASS_FM_RX' for FM RX,
> introduces 2 new CID's for FM RX and and 1 new CID for FM TX. Also adds 1
> field in struct v4l2_hw_freq_seek.
>   
> This patch adds few new features to TI's FM driver features
> are listed below,
>
> 1) FM TX RDS Support (RT, PS, AF, PI, PTY)  
> 2) FM RX Russian band support
> 3) FM RX AF set/get
> 4) FM RX De-emphasis mode set/get
> 
> Along with new features this patch also fixes few issues in the driver
> like default rssi level for seek, unnecessory logs etc.

For the whole patch series (just report a fixed version of patch 2/5):

Acked-by: Hans Verkuil 

Regards,

Hans

> 
> Manjunatha Halli (5):
>   WL128x: Add support for FM TX RDS
>   New control class and features for FM RX
>   Add new CID for FM TX RDS Alternate Frequency
>   Media: Update docs for V4L2 FM new features
>   WL12xx: Add support for FM new features.
> 
>  Documentation/DocBook/media/v4l/compat.xml |3 +
>  Documentation/DocBook/media/v4l/controls.xml   |   77 ++
>  Documentation/DocBook/media/v4l/dev-rds.xml|5 +-
>  .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml   |7 +
>  Documentation/DocBook/media/v4l/vidioc-g-tuner.xml |   25 
>  .../DocBook/media/v4l/vidioc-s-hw-freq-seek.xml|   38 +-
>  drivers/media/radio/wl128x/fmdrv.h |3 +-
>  drivers/media/radio/wl128x/fmdrv_common.c  |   55 ++--
>  drivers/media/radio/wl128x/fmdrv_common.h  |   43 +-
>  drivers/media/radio/wl128x/fmdrv_rx.c  |   92 ++---
>  drivers/media/radio/wl128x/fmdrv_rx.h  |2 +-
>  drivers/media/radio/wl128x/fmdrv_tx.c  |   41 +++---
>  drivers/media/radio/wl128x/fmdrv_tx.h  |3 +-
>  drivers/media/radio/wl128x/fmdrv_v4l2.c|  148 
> +++-
>  drivers/media/video/v4l2-ctrls.c   |   18 ++-
>  include/linux/videodev2.h  |   25 +++-
>  16 files changed, 503 insertions(+), 82 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 V6 2/5] New control class and features for FM RX

2012-05-14 Thread Hans Verkuil
On Mon May 14 2012 22:27:21 manjunatha_ha...@ti.com wrote:
> From: Manjunatha Halli 
> 
> This patch creates new ctrl class for FM RX and adds new CID's for
> below FM features,
>   1) De-Emphasis filter mode
>   2) RDS Alternate Frequency switch
> 
> Also this patch adds a field for band selection in struct v4l2_hw_freq_seek
> and adds new capability flags for all below FM bands
>   1) V4L2_TUNER_CAP_BAND_TYPE_DEFAULT -> Default Band
>   2) V4L2_TUNER_CAP_BAND_TYPE_EUROPE_US -> Europe/US Band
>   3) V4L2_TUNER_CAP_BAND_TYPE_JAPAN   -> Japan Band
>   4) V4L2_TUNER_CAP_BAND_TYPE_RUSSIAN -> Russian Band
>   5) V4L2_TUNER_CAP_BAND_TYPE_WEATHER -> Weather Band
> 
> Signed-off-by: Manjunatha Halli 
> ---
>  drivers/media/video/v4l2-ctrls.c |   17 ++---
>  include/linux/videodev2.h|   24 +++-
>  2 files changed, 37 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/video/v4l2-ctrls.c 
> b/drivers/media/video/v4l2-ctrls.c
> index 18015c0..9d7608e 100644
> --- a/drivers/media/video/v4l2-ctrls.c
> +++ b/drivers/media/video/v4l2-ctrls.c
> @@ -243,8 +243,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
>   "Vivid",
>   NULL
>   };
> - static const char * const tune_preemphasis[] = {
> - "No Preemphasis",
> + static const char * const tune_emphasis[] = {
> + "None",
>   "50 Microseconds",
>   "75 Microseconds",
>   NULL,
> @@ -413,7 +413,9 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
>   case V4L2_CID_COLORFX:
>   return colorfx;
>   case V4L2_CID_TUNE_PREEMPHASIS:
> - return tune_preemphasis;
> + return tune_emphasis;
> + case V4L2_CID_TUNE_DEEMPHASIS:
> + return tune_emphasis;
>   case V4L2_CID_FLASH_LED_MODE:
>   return flash_led_mode;
>   case V4L2_CID_FLASH_STROBE_SOURCE:
> @@ -644,6 +646,12 @@ const char *v4l2_ctrl_get_name(u32 id)
>   case V4L2_CID_JPEG_COMPRESSION_QUALITY: return "Compression Quality";
>   case V4L2_CID_JPEG_ACTIVE_MARKER:   return "Active Markers";
>  
> + /* FM Radio Receiver control */
> + /* Keep the order of the 'case's the same as in videodev2.h! */
> + case V4L2_CID_FM_RX_CLASS:  return "FM Radio Receiver 
> Controls";
> + case V4L2_CID_RDS_AF_SWITCH:return "RDS Alternate Frequency 
> Switch";
> + case V4L2_CID_TUNE_DEEMPHASIS:  return "De-Emphasis";
> +
>   default:
>   return NULL;
>   }
> @@ -688,6 +696,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
> v4l2_ctrl_type *type,
>   case V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM:
>   case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE:
>   case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL:
> + case V4L2_CID_RDS_AF_SWITCH:
>   *type = V4L2_CTRL_TYPE_BOOLEAN;
>   *min = 0;
>   *max = *step = 1;
> @@ -733,6 +742,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
> v4l2_ctrl_type *type,
>   case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
>   case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
>   case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
> + case V4L2_CID_TUNE_DEEMPHASIS:
>   *type = V4L2_CTRL_TYPE_MENU;
>   break;
>   case V4L2_CID_RDS_TX_PS_NAME:
> @@ -745,6 +755,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
> v4l2_ctrl_type *type,
>   case V4L2_CID_FM_TX_CLASS:
>   case V4L2_CID_FLASH_CLASS:
>   case V4L2_CID_JPEG_CLASS:
> + case V4L2_CID_FM_RX_CLASS:
>   *type = V4L2_CTRL_TYPE_CTRL_CLASS;
>   /* You can neither read not write these */
>   *flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY;
> diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
> index c9c9a46..91bc47b 100644
> --- a/include/linux/videodev2.h
> +++ b/include/linux/videodev2.h
> @@ -1137,6 +1137,7 @@ struct v4l2_ext_controls {
>  #define V4L2_CTRL_CLASS_FM_TX 0x009b /* FM Modulator control class */
>  #define V4L2_CTRL_CLASS_FLASH 0x009c /* Camera flash controls */
>  #define V4L2_CTRL_CLASS_JPEG 0x009d  /* JPEG-compression 
> controls */
> +#define V4L2_CTRL_CLASS_FM_RX 0x009e /* FM Receiver control class */
>  
>  #define V4L2_CTRL_ID_MASK  (0x0fff)
>  #define V4L2_CTRL_ID2CLASS(id)((id) & 0x0fffUL)
> @@ -1782,6 +1783,13 @@ enum v4l2_jpeg_chroma_subsampling {
>  #define  V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)
>  #define  V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)
>  
> +/* FM Receiver class control IDs */
> +#define V4L2_CID_FM_RX_CLASS_BASE(V4L2_CTRL_CLASS_FM_RX | 0x900)
> +#define V4L2_CID_FM_RX_CLASS (V4L2_CTRL_CLASS_FM_RX | 1)
> +
> +#define V4L2_CID_RDS_AF_SWITCH   
> (V4L2_CID_FM_RX_CLASS_BASE + 1)
> +#define V4L2_CID_TUNE_DEEMPHASIS  

[PATCH] rc-it913x=v2 Incorrect assigned KEY_1

2012-05-14 Thread Malcolm Priestley
Correct incorrect scancode for KEY_1

Signed-off-by: Malcolm Priestley 
---
 drivers/media/rc/keymaps/rc-it913x-v2.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/rc/keymaps/rc-it913x-v2.c 
b/drivers/media/rc/keymaps/rc-it913x-v2.c
index 28e376e..bd42a30 100644
--- a/drivers/media/rc/keymaps/rc-it913x-v2.c
+++ b/drivers/media/rc/keymaps/rc-it913x-v2.c
@@ -40,7 +40,7 @@ static struct rc_map_table it913x_v2_rc[] = {
/* Type 2 */
/* keys stereo, snapshot unassigned */
{ 0x866b00, KEY_0 },
-   { 0x866b1b, KEY_1 },
+   { 0x866b01, KEY_1 },
{ 0x866b02, KEY_2 },
{ 0x866b03, KEY_3 },
{ 0x866b04, KEY_4 },
-- 
1.7.9.5


--
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] m88rs2000 - only flip bit 2 on reg 0x70 on 16th try

2012-05-14 Thread Malcolm Priestley

Continuous flip of bit2 reg 0x70 can cause device to become unresponsive.

Also correct reg read mistake.

Signed-off-by: Malcolm Priestley 
---
 drivers/media/dvb/frontends/m88rs2000.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb/frontends/m88rs2000.c 
b/drivers/media/dvb/frontends/m88rs2000.c
index 045ee5a..c9ab2ce 100644
--- a/drivers/media/dvb/frontends/m88rs2000.c
+++ b/drivers/media/dvb/frontends/m88rs2000.c
@@ -772,13 +772,13 @@ static int m88rs2000_set_frontend(struct dvb_frontend *fe)
return -ENODEV;
 
for (i = 0; i < 25; i++) {
-   u8 reg = m88rs2000_demod_read(state, 0x8c);
+   reg = m88rs2000_demod_read(state, 0x8c);
if ((reg & 0x7) == 0x7) {
status = FE_HAS_LOCK;
break;
}
state->no_lock_count++;
-   if (state->no_lock_count > 15) {
+   if (state->no_lock_count == 15) {
reg = m88rs2000_demod_read(state, 0x70);
reg ^= 0x4;
m88rs2000_demod_write(state, 0x70, reg);
-- 
1.7.9.5


--
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 V6 1/5] WL128x: Add support for FM TX RDS

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

This patch adds support for following FM TX RDS features,
 1. Radio Text
 2. PS Name
 3. PI Code
 4. PTY Code.

Along with above this patch fixes few other minor issues(like
fm tx get frequency, unnecessary error messages etc).

Signed-off-by: Manjunatha Halli 
---
 drivers/media/radio/wl128x/fmdrv_common.c |   17 +++---
 drivers/media/radio/wl128x/fmdrv_common.h |   17 +++
 drivers/media/radio/wl128x/fmdrv_rx.c |2 +-
 drivers/media/radio/wl128x/fmdrv_tx.c |   41 ++---
 drivers/media/radio/wl128x/fmdrv_tx.h |3 +-
 drivers/media/radio/wl128x/fmdrv_v4l2.c   |   47 +
 6 files changed, 90 insertions(+), 37 deletions(-)

diff --git a/drivers/media/radio/wl128x/fmdrv_common.c 
b/drivers/media/radio/wl128x/fmdrv_common.c
index bf867a6..fcce61a 100644
--- a/drivers/media/radio/wl128x/fmdrv_common.c
+++ b/drivers/media/radio/wl128x/fmdrv_common.c
@@ -354,7 +354,7 @@ static void send_tasklet(unsigned long arg)
 
/* Check, is there any timeout happened to last transmitted packet */
if ((jiffies - fmdev->last_tx_jiffies) > FM_DRV_TX_TIMEOUT) {
-   fmerr("TX timeout occurred\n");
+   fmdbg("TX timeout occurred\n");
atomic_set(&fmdev->tx_cnt, 1);
}
 
@@ -615,7 +615,11 @@ static void fm_irq_handle_rds_start(struct fmdev *fmdev)
 {
if (fmdev->irq_info.flag & FM_RDS_EVENT & fmdev->irq_info.mask) {
fmdbg("irq: rds threshold reached\n");
-   fmdev->irq_info.stage = FM_RDS_SEND_RDS_GETCMD_IDX;
+   /* If RSSI reached below threshold then dont get RDS data */
+   if (fmdev->irq_info.flag & FM_LEV_EVENT)
+   fmdev->irq_info.stage = FM_HW_TUNE_OP_ENDED_IDX;
+   else
+   fmdev->irq_info.stage = FM_RDS_SEND_RDS_GETCMD_IDX;
} else {
/* Continue next function in interrupt handler table */
fmdev->irq_info.stage = FM_HW_TUNE_OP_ENDED_IDX;
@@ -1129,8 +1133,9 @@ int fmc_set_freq(struct fmdev *fmdev, u32 freq_to_set)
 
 int fmc_get_freq(struct fmdev *fmdev, u32 *cur_tuned_frq)
 {
-   if (fmdev->rx.freq == FM_UNDEFINED_FREQ) {
-   fmerr("RX frequency is not set\n");
+   if (fmdev->rx.freq == FM_UNDEFINED_FREQ &&
+   fmdev->tx_data.tx_frq == FM_UNDEFINED_FREQ) {
+   fmerr("RX/TX frequency is not set\n");
return -EPERM;
}
if (cur_tuned_frq == NULL) {
@@ -1144,7 +1149,7 @@ int fmc_get_freq(struct fmdev *fmdev, u32 *cur_tuned_frq)
return 0;
 
case FM_MODE_TX:
-   *cur_tuned_frq = 0; /* TODO : Change this later */
+   *cur_tuned_frq = fmdev->tx_data.tx_frq;
return 0;
 
default:
@@ -1574,6 +1579,8 @@ int fmc_prepare(struct fmdev *fmdev)
fmdev->rx.af_mode = FM_RX_RDS_AF_SWITCH_MODE_OFF;
fmdev->irq_info.retry = 0;
 
+   fmdev->tx_data.tx_frq = FM_UNDEFINED_FREQ;
+
fm_rx_reset_rds_cache(fmdev);
init_waitqueue_head(&fmdev->rx.rds.read_queue);
 
diff --git a/drivers/media/radio/wl128x/fmdrv_common.h 
b/drivers/media/radio/wl128x/fmdrv_common.h
index d9b9c6c..196ff7d 100644
--- a/drivers/media/radio/wl128x/fmdrv_common.h
+++ b/drivers/media/radio/wl128x/fmdrv_common.h
@@ -48,8 +48,8 @@ struct fm_reg_table {
 #define SEARCH_LVL_SET   15
 #define BAND_SET 16
 #define MUTE_STATUS_SET  17
-#define RDS_PAUSE_LVL_SET18
-#define RDS_PAUSE_DUR_SET19
+#define AUD_PAUSE_LVL_SET18
+#define AUD_PAUSE_DUR_SET19
 #define RDS_MEM_SET  20
 #define RDS_BLK_B_SET21
 #define RDS_MSK_B_SET22
@@ -84,11 +84,12 @@ struct fm_reg_table {
 
 #define FM_POWER_MODE254
 #define FM_INTERRUPT 255
+#define STATION_VALID   123
 
 /* Transmitter API */
 
 #define CHANL_SET55
-#define CHANL_BW_SET   56
+#define SCAN_SPACING_SET 56
 #define REF_SET  57
 #define POWER_ENB_SET90
 #define POWER_ATT_SET58
@@ -103,7 +104,8 @@ struct fm_reg_table {
 #define MONO_SET 66
 #define MUTE 92
 #define MPX_LMT_ENABLE   67
-#define PI_SET   93
+#define REF_ERR_SET 93
+#define PI_SET   68
 #define ECC_SET  69
 #define PTY  70
 #define AF   71
@@ -120,6 +122,10 @@ struct fm_reg_table {
 #define TX_AUDIO_LEVEL_TEST  96
 #define TX_AUDIO_LEVEL_TEST_THRESHOLD73
 #define TX_AUDIO_INPUT_LEVEL_RANGE_SET   54
+#define TX_AUDIO_LEVEL_GET  7
+#define READ_FMANT_TUNE_VALUE104
+
+/* New FM APIs (Rx and Tx) */
 #define RX_ANTENNA_SELECT87
 #define I2C_DEV_ADDR_SET 86
 #define REF_ERR_CALIB_PARAM_SET 

[PATCH V6 2/5] New control class and features for FM RX

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

This patch creates new ctrl class for FM RX and adds new CID's for
below FM features,
  1) De-Emphasis filter mode
  2) RDS Alternate Frequency switch

Also this patch adds a field for band selection in struct v4l2_hw_freq_seek
and adds new capability flags for all below FM bands
1) V4L2_TUNER_CAP_BAND_TYPE_DEFAULT -> Default Band
2) V4L2_TUNER_CAP_BAND_TYPE_EUROPE_US -> Europe/US Band
3) V4L2_TUNER_CAP_BAND_TYPE_JAPAN   -> Japan Band
4) V4L2_TUNER_CAP_BAND_TYPE_RUSSIAN -> Russian Band
5) V4L2_TUNER_CAP_BAND_TYPE_WEATHER -> Weather Band

Signed-off-by: Manjunatha Halli 
---
 drivers/media/video/v4l2-ctrls.c |   17 ++---
 include/linux/videodev2.h|   24 +++-
 2 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 18015c0..9d7608e 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -243,8 +243,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
"Vivid",
NULL
};
-   static const char * const tune_preemphasis[] = {
-   "No Preemphasis",
+   static const char * const tune_emphasis[] = {
+   "None",
"50 Microseconds",
"75 Microseconds",
NULL,
@@ -413,7 +413,9 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
case V4L2_CID_COLORFX:
return colorfx;
case V4L2_CID_TUNE_PREEMPHASIS:
-   return tune_preemphasis;
+   return tune_emphasis;
+   case V4L2_CID_TUNE_DEEMPHASIS:
+   return tune_emphasis;
case V4L2_CID_FLASH_LED_MODE:
return flash_led_mode;
case V4L2_CID_FLASH_STROBE_SOURCE:
@@ -644,6 +646,12 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_JPEG_COMPRESSION_QUALITY: return "Compression Quality";
case V4L2_CID_JPEG_ACTIVE_MARKER:   return "Active Markers";
 
+   /* FM Radio Receiver control */
+   /* Keep the order of the 'case's the same as in videodev2.h! */
+   case V4L2_CID_FM_RX_CLASS:  return "FM Radio Receiver 
Controls";
+   case V4L2_CID_RDS_AF_SWITCH:return "RDS Alternate Frequency 
Switch";
+   case V4L2_CID_TUNE_DEEMPHASIS:  return "De-Emphasis";
+
default:
return NULL;
}
@@ -688,6 +696,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM:
case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE:
case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL:
+   case V4L2_CID_RDS_AF_SWITCH:
*type = V4L2_CTRL_TYPE_BOOLEAN;
*min = 0;
*max = *step = 1;
@@ -733,6 +742,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
+   case V4L2_CID_TUNE_DEEMPHASIS:
*type = V4L2_CTRL_TYPE_MENU;
break;
case V4L2_CID_RDS_TX_PS_NAME:
@@ -745,6 +755,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_FM_TX_CLASS:
case V4L2_CID_FLASH_CLASS:
case V4L2_CID_JPEG_CLASS:
+   case V4L2_CID_FM_RX_CLASS:
*type = V4L2_CTRL_TYPE_CTRL_CLASS;
/* You can neither read not write these */
*flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY;
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index c9c9a46..91bc47b 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1137,6 +1137,7 @@ struct v4l2_ext_controls {
 #define V4L2_CTRL_CLASS_FM_TX 0x009b   /* FM Modulator control class */
 #define V4L2_CTRL_CLASS_FLASH 0x009c   /* Camera flash controls */
 #define V4L2_CTRL_CLASS_JPEG 0x009d/* JPEG-compression 
controls */
+#define V4L2_CTRL_CLASS_FM_RX 0x009e   /* FM Receiver control class */
 
 #define V4L2_CTRL_ID_MASK(0x0fff)
 #define V4L2_CTRL_ID2CLASS(id)((id) & 0x0fffUL)
@@ -1782,6 +1783,13 @@ enum v4l2_jpeg_chroma_subsampling {
 #defineV4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)
 #defineV4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)
 
+/* FM Receiver class control IDs */
+#define V4L2_CID_FM_RX_CLASS_BASE  (V4L2_CTRL_CLASS_FM_RX | 0x900)
+#define V4L2_CID_FM_RX_CLASS   (V4L2_CTRL_CLASS_FM_RX | 1)
+
+#define V4L2_CID_RDS_AF_SWITCH (V4L2_CID_FM_RX_CLASS_BASE + 1)
+#define V4L2_CID_TUNE_DEEMPHASIS   (V4L2_CID_FM_RX_CLASS_BASE + 2)
+
 /*
  * T U N I N G
  */
@@ -1819,6 +1827,12 @@ struct v4l2_modulator {
 #define V4L2_TUNER_CAP_RDS 0x0080

[PATCH V6 3/5] Add new CID for FM TX RDS Alternate Frequency

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

Signed-off-by: Manjunatha Halli 
---
 drivers/media/video/v4l2-ctrls.c |1 +
 include/linux/videodev2.h|1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 9d7608e..610076c 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -608,6 +608,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_RDS_TX_PTY:   return "RDS Program Type";
case V4L2_CID_RDS_TX_PS_NAME:   return "RDS PS Name";
case V4L2_CID_RDS_TX_RADIO_TEXT:return "RDS Radio Text";
+   case V4L2_CID_RDS_TX_AF_FREQ:   return "RDS Alternate 
Frequency";
case V4L2_CID_AUDIO_LIMITER_ENABLED:return "Audio Limiter Feature 
Enabled";
case V4L2_CID_AUDIO_LIMITER_RELEASE_TIME: return "Audio Limiter Release 
Time";
case V4L2_CID_AUDIO_LIMITER_DEVIATION:  return "Audio Limiter 
Deviation";
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 91bc47b..3931a99 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1699,6 +1699,7 @@ enum  v4l2_exposure_auto_type {
 #define V4L2_CID_RDS_TX_PTY(V4L2_CID_FM_TX_CLASS_BASE + 3)
 #define V4L2_CID_RDS_TX_PS_NAME
(V4L2_CID_FM_TX_CLASS_BASE + 5)
 #define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6)
+#define V4L2_CID_RDS_TX_AF_FREQ
(V4L2_CID_FM_TX_CLASS_BASE + 7)
 
 #define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64)
 #define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME(V4L2_CID_FM_TX_CLASS_BASE + 65)
-- 
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 V6 0/5] [Media] Radio: Fixes and New features for FM

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

Mauro and the list,

This version 6 of patchset resolves the comments received from
Han's on patchset v5.
 
This patchset creates new control class 'V4L2_CTRL_CLASS_FM_RX' for FM RX,
introduces 2 new CID's for FM RX and and 1 new CID for FM TX. Also adds 1
field in struct v4l2_hw_freq_seek.
  
This patch adds few new features to TI's FM driver features
are listed below,
   
1) FM TX RDS Support (RT, PS, AF, PI, PTY)  
2) FM RX Russian band support
3) FM RX AF set/get
4) FM RX De-emphasis mode set/get

Along with new features this patch also fixes few issues in the driver
like default rssi level for seek, unnecessory logs etc.

Manjunatha Halli (5):
  WL128x: Add support for FM TX RDS
  New control class and features for FM RX
  Add new CID for FM TX RDS Alternate Frequency
  Media: Update docs for V4L2 FM new features
  WL12xx: Add support for FM new features.

 Documentation/DocBook/media/v4l/compat.xml |3 +
 Documentation/DocBook/media/v4l/controls.xml   |   77 ++
 Documentation/DocBook/media/v4l/dev-rds.xml|5 +-
 .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml   |7 +
 Documentation/DocBook/media/v4l/vidioc-g-tuner.xml |   25 
 .../DocBook/media/v4l/vidioc-s-hw-freq-seek.xml|   38 +-
 drivers/media/radio/wl128x/fmdrv.h |3 +-
 drivers/media/radio/wl128x/fmdrv_common.c  |   55 ++--
 drivers/media/radio/wl128x/fmdrv_common.h  |   43 +-
 drivers/media/radio/wl128x/fmdrv_rx.c  |   92 ++---
 drivers/media/radio/wl128x/fmdrv_rx.h  |2 +-
 drivers/media/radio/wl128x/fmdrv_tx.c  |   41 +++---
 drivers/media/radio/wl128x/fmdrv_tx.h  |3 +-
 drivers/media/radio/wl128x/fmdrv_v4l2.c|  148 +++-
 drivers/media/video/v4l2-ctrls.c   |   18 ++-
 include/linux/videodev2.h  |   25 +++-
 16 files changed, 503 insertions(+), 82 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


[PATCH V6 4/5] Media: Update docs for V4L2 FM new features

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

The list of new features -
1) New control class for FM RX
2) New FM RX CID's - De-Emphasis filter mode and RDS AF switch
3) New FM TX CID - RDS Alternate frequency set.
4) New capability struct v4l2_tuner flags for band selection

Signed-off-by: Manjunatha Halli 
---
 Documentation/DocBook/media/v4l/compat.xml |3 +
 Documentation/DocBook/media/v4l/controls.xml   |   77 
 Documentation/DocBook/media/v4l/dev-rds.xml|5 +-
 .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml   |7 ++
 Documentation/DocBook/media/v4l/vidioc-g-tuner.xml |   25 +++
 .../DocBook/media/v4l/vidioc-s-hw-freq-seek.xml|   38 +-
 6 files changed, 151 insertions(+), 4 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/compat.xml 
b/Documentation/DocBook/media/v4l/compat.xml
index bce97c5..df1f345 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -2311,6 +2311,9 @@ more information.
  Added FM Modulator (FM TX) Extended Control Class: 
V4L2_CTRL_CLASS_FM_TX and their Control IDs.


+   Added FM Receiver (FM RX) Extended Control Class: 
V4L2_CTRL_CLASS_FM_RX and their Control IDs.
+   
+   
  Added Remote Controller chapter, describing the default Remote 
Controller mapping for media devices.

   
diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index b84f25e..ced2bee 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -3018,6 +3018,12 @@ to find receivers which can scroll strings sized as 32 x 
N or 64 x N characters.
 with steps of 32 or 64 characters. The result is it must always contain a 
string with size multiple of 32 or 64. 
  
  
+ V4L2_CID_RDS_TX_AF_FREQ 
+ integer
+ 
+ Sets the RDS Alternate Frequency value 
which allows a receiver to re-tune to a different frequency providing the same 
station when the first signal becomes too weak (e.g., when moving out of 
range). 
+ 
+ 
V4L2_CID_AUDIO_LIMITER_ENABLED 
boolean
  
@@ -3146,6 +3152,77 @@ manually or automatically if set to zero. Unit, range 
and step are driver-specif
  document, from CENELEC.
 
 
+
+  FM Receiver Control Reference
+
+  The FM Receiver (FM_RX) class includes controls for common 
features of
+FM Reception capable devices.
+
+  
+  FM_RX Control IDs
+
+  
+
+
+
+
+
+
+
+  
+ID
+Type
+  Description
+  
+
+
+  
+  
+V4L2_CID_FM_RX_CLASS 
+class
+  The FM_RX class
+descriptor. Calling &VIDIOC-QUERYCTRL; for this control will return a
+description of this control class.
+  
+  
+V4L2_CID_RDS_AF_SWITCH 
+boolean
+  
+  Enable or Disable the RDS Alternate 
frequency feature. When enabled the driver will decode the RDS AF field and 
tries to switch to this AF frequency once the current frequency RSSI (Received 
signal strength indication) level goes below the threshold. If the frequency is 
switched, then &VIDIOC-G-FREQUENCY; will return the new frequency.
+  
+  
+   V4L2_CID_TUNE_DEEMPHASIS 
+   integer
+ 
+ Configures the 
de-emphasis value for reception.
+A pre-emphasis filter is applied to the broadcast to accentuate the high audio 
frequencies.
+Depending on the region, a time constant of either 50 or 75 useconds is used. 
The enum v4l2_preemphasis
+defines possible values for pre-emphasis. Here they are:
+   
+   
+ 
+   
+ 
V4L2_PREEMPHASIS_DISABLED 
+ No de-emphasis is applied.
+   
+   
+ 
V4L2_PREEMPHASIS_50_uS 
+ A de-emphasis of 50 uS is used.
+   
+   
+ 
V4L2_PREEMPHASIS_75_uS 
+ A de-emphasis of 75 uS is used.
+   
+ 
+   
+
+ 
+  
+
+  
+  
+
+  
 
   Flash Control Reference
 
diff --git a/Documentation/DocBook/media/v4l/dev-rds.xml 
b/Documentation/DocBook/media/v4l/dev-rds.xml
index 38883a4..8188161 100644
--- a/Documentation/DocBook/media/v4l/dev-rds.xml
+++ b/Documentation/DocBook/media/v4l/dev-rds.xml
@@ -55,8 +55,9 @@ If the driver only passes RDS blocks without interpreting the 
data
 the V4L2_TUNER_CAP_RDS_BLOCK_IO flag has to be set. If the
 tuner is capable of handling RDS entities like program identification codes 
and radio
 text, the flag V4L2_TUNER_CAP_RDS_CONTROLS should be set,
-see Writing

[PATCH V6 5/5] WL12xx: Add support for FM new features.

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

This patch adds below features to TI's V4l2 FM driver for Wilink
chipsets,

1) FM RX Set frequency allows to set frequency anywhere between
65.5 MHz till 108 MHz (if chip is Wilink8 then till 164.55 MHz)
2) FM RX seek caters for band switch
3) FM RX RDS AF turn ON/OFF
4) FM RX De-Emphasis mode set/get
5) FM TX Alternate Frequency set/get

Also this patch fixes below issues

1) FM audio volume gain setting
2) Default rssi level is set to 8 instead of 20
3) Issue related to audio mute/unmute
4) Enable FM RX AF support in driver
5) In wrap_around seek mode try for once

Signed-off-by: Manjunatha Halli 
---
 drivers/media/radio/wl128x/fmdrv.h|3 +-
 drivers/media/radio/wl128x/fmdrv_common.c |   38 +--
 drivers/media/radio/wl128x/fmdrv_common.h |   28 +++-
 drivers/media/radio/wl128x/fmdrv_rx.c |   90 -
 drivers/media/radio/wl128x/fmdrv_rx.h |2 +-
 drivers/media/radio/wl128x/fmdrv_v4l2.c   |  101 +++--
 6 files changed, 224 insertions(+), 38 deletions(-)

diff --git a/drivers/media/radio/wl128x/fmdrv.h 
b/drivers/media/radio/wl128x/fmdrv.h
index d84ad9d..c806c85 100644
--- a/drivers/media/radio/wl128x/fmdrv.h
+++ b/drivers/media/radio/wl128x/fmdrv.h
@@ -150,6 +150,7 @@ struct fm_rx {
struct region_info region;  /* Current selected band */
u32 freq;   /* Current RX frquency */
u8 mute_mode;   /* Current mute mode */
+   u8 bl_flag; /* Band limit reached flag */
u8 deemphasis_mode; /* Current deemphasis mode */
/* RF dependent soft mute mode */
u8 rf_depend_mute;
@@ -203,7 +204,7 @@ struct fmtx_data {
 struct fmdev {
struct video_device *radio_dev; /* V4L2 video device pointer */
struct snd_card *card;  /* Card which holds FM mixer controls */
-   u16 asci_id;
+   u16 asic_id;
spinlock_t rds_buff_lock; /* To protect access to RDS buffer */
spinlock_t resp_skb_lock; /* To protect access to received SKB */
 
diff --git a/drivers/media/radio/wl128x/fmdrv_common.c 
b/drivers/media/radio/wl128x/fmdrv_common.c
index fcce61a..ac20556 100644
--- a/drivers/media/radio/wl128x/fmdrv_common.c
+++ b/drivers/media/radio/wl128x/fmdrv_common.c
@@ -44,20 +44,41 @@
 
 /* Region info */
 static struct region_info region_configs[] = {
+   /* Super set of all bands */
+   {
+.chanl_space = FM_CHANNEL_SPACING_200KHZ * FM_FREQ_MUL,
+.bot_freq = 65800, /* 87.5 MHz */
+.top_freq = 162550,/* 108 MHz */
+.fm_band = 0,
+},
/* Europe/US */
{
 .chanl_space = FM_CHANNEL_SPACING_200KHZ * FM_FREQ_MUL,
 .bot_freq = 87500, /* 87.5 MHz */
 .top_freq = 108000,/* 108 MHz */
-.fm_band = 0,
+.fm_band = 1,
 },
/* Japan */
{
 .chanl_space = FM_CHANNEL_SPACING_200KHZ * FM_FREQ_MUL,
 .bot_freq = 76000, /* 76 MHz */
 .top_freq = 9, /* 90 MHz */
-.fm_band = 1,
+.fm_band = 2,
 },
+   /* Russian (OIRT) band */
+   {
+   .chanl_space = FM_CHANNEL_SPACING_50KHZ * FM_FREQ_MUL_RUS,
+   .bot_freq = 65800, /* 65.8 MHz */
+   .top_freq = 74000, /* 74 MHz */
+   .fm_band = 3,
+   },
+   /* Wether Band */
+   {
+   .chanl_space = FM_CHANNEL_SPACING_50KHZ * FM_FREQ_MUL_WB,
+   .bot_freq = 162400, /* 162.4 MHz */
+   .top_freq = 162550, /* 162.55 MHz */
+   .fm_band = 4,
+   }
 };
 
 /* Band selection */
@@ -596,7 +617,6 @@ static void fm_irq_handle_flag_getcmd_resp(struct fmdev 
*fmdev)
memcpy(&fmdev->irq_info.flag, skb->data, fm_evt_hdr->dlen);
 
fmdev->irq_info.flag = be16_to_cpu(fmdev->irq_info.flag);
-   fmdbg("irq: flag register(0x%x)\n", fmdev->irq_info.flag);
 
/* Continue next function in interrupt handler table */
fm_irq_call_stage(fmdev, FM_HW_MAL_FUNC_IDX);
@@ -702,7 +722,7 @@ static void fm_rdsparse_swapbytes(struct fmdev *fmdev,
 * in Dolphin they are in big endian, the parsing of the RDS data
 * is chip dependent
 */
-   if (fmdev->asci_id != 0x6350) {
+   if (fmdev->asic_id != 0x6350) {
rds_buff = &rds_format->data.groupdatabuff.buff[0];
while (index + 1 < FM_RX_RDS_INFO_FIELD_MAX) {
byte1 = rds_buff[index];
@@ -1353,11 +1373,13 @@ static int fm_power_up(struct fmdev *fmdev, u8 mode)
sizeof(asic_ver), &asic_ver, &resp_len))
goto rel;
 
+   fmdev->asic_id = be16_to_cpu(asic_id);
+
fmdbg("ASIC ID: 0x%x , ASIC Version: %d\n",
-   be16_to_cpu(asic_id), be16_to_cpu(asic_ver));
+   fmdev->asic_id, be16_to_cpu(asic_ver));
 
sprintf(fw_name, "%s_%x.%d.bts", FM_FMC_FW_FILE_START,
-  

[PATCH] lmedm04 ver 2.00 - changes for [TEST] Regarding m88rc2000 i2c gate operation, SNR, BER and others

2012-05-14 Thread Malcolm Priestley
Re: [PATCH] [TEST] Regarding m88rc2000 i2c gate operation, SNR, BER and others

This patch restores more less as before, except;

Corrected snr/signal strength are swapped.

m88rs2000_set_voltage is now called inside dm04_lme2510_set_voltage this seems 
to stop intermittent loss of device during channel change/scan.

Unfortunately, lmedm04 cannot support ucblocks or ber, neither are returned in
the interrupt callback. I am working on a patch to map them back in when
streaming is off.

Signed-off-by: Malcolm Priestley 
---
 drivers/media/dvb/dvb-usb/lmedm04.c |   46 ---
 1 file changed, 37 insertions(+), 9 deletions(-)

diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c 
b/drivers/media/dvb/dvb-usb/lmedm04.c
index 5dde06d..424dab6 100644
--- a/drivers/media/dvb/dvb-usb/lmedm04.c
+++ b/drivers/media/dvb/dvb-usb/lmedm04.c
@@ -136,7 +136,7 @@ struct lme2510_state {
void *buffer;
struct urb *lme_urb;
void *usb_buffer;
-
+   int (*fe_set_voltage)(struct dvb_frontend *, fe_sec_voltage_t);
 };
 
 static int lme2510_bulk_write(struct usb_device *dev,
@@ -313,12 +313,12 @@ static void lme2510_int_response(struct urb *lme_urb)
}
break;
case TUNER_RS2000:
-   if (ibuf[2] > 0)
+   if (ibuf[1] == 0x3 &&  ibuf[6] == 0xff)
st->signal_lock = 0xff;
else
-   st->signal_lock = 0xf0;
-   st->signal_level = ibuf[4];
-   st->signal_sn = ibuf[5];
+   st->signal_lock = 0x00;
+   st->signal_level = ibuf[5];
+   st->signal_sn = ibuf[4];
st->time_key = ibuf[7];
default:
break;
@@ -973,6 +973,7 @@ static int dm04_lme2510_set_voltage(struct dvb_frontend *fe,
fe_sec_voltage_t voltage)
 {
struct dvb_usb_adapter *adap = fe->dvb->priv;
+   struct lme2510_state *st = adap->dev->priv;
static u8 voltage_low[] = LME_VOLTAGE_L;
static u8 voltage_high[] = LME_VOLTAGE_H;
static u8 rbuf[1];
@@ -993,9 +994,13 @@ static int dm04_lme2510_set_voltage(struct dvb_frontend 
*fe,
voltage_low, len, rbuf, rlen);
break;
}
-
mutex_unlock(&adap->dev->i2c_mutex);
 
+   if (st->tuner_config == TUNER_RS2000)
+   if (st->fe_set_voltage)
+   st->fe_set_voltage(fe, voltage);
+
+
return (ret < 0) ? -ENODEV : 0;
 }
 
@@ -1005,7 +1010,8 @@ static int dm04_rs2000_read_signal_strength(struct 
dvb_frontend *fe,
struct dvb_usb_adapter *adap = fe->dvb->priv;
struct lme2510_state *st = adap->dev->priv;
 
-   *strength = (u16)((u32)st->signal_level * 0x / 0x7f);
+   *strength = (u16)((u32)st->signal_level * 0x / 0xff);
+
return 0;
 }
 
@@ -1014,7 +1020,22 @@ static int dm04_rs2000_read_snr(struct dvb_frontend *fe, 
u16 *snr)
struct dvb_usb_adapter *adap = fe->dvb->priv;
struct lme2510_state *st = adap->dev->priv;
 
-   *snr = (u16)((u32)st->signal_sn * 0x / 0xff);
+   *snr = (u16)((u32)st->signal_sn * 0x / 0x7f);
+
+   return 0;
+}
+
+static int dm04_read_ber(struct dvb_frontend *fe, u32 *ber)
+{
+   *ber = 0;
+
+   return 0;
+}
+
+static int dm04_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
+{
+   *ucblocks = 0;
+
return 0;
 }
 
@@ -1101,10 +1122,17 @@ static int dm04_lme2510_frontend_attach(struct 
dvb_usb_adapter *adap)
st->i2c_tuner_gate_r = 5;
st->i2c_tuner_addr = 0xc0;
st->tuner_config = TUNER_RS2000;
+   st->fe_set_voltage =
+   adap->fe_adap[0].fe->ops.set_voltage;
+
adap->fe_adap[0].fe->ops.read_signal_strength =
dm04_rs2000_read_signal_strength;
adap->fe_adap[0].fe->ops.read_snr =
dm04_rs2000_read_snr;
+   adap->fe_adap[0].fe->ops.read_ber =
+   dm04_read_ber;
+   adap->fe_adap[0].fe->ops.read_ucblocks =
+   dm04_read_ucblocks;
}
break;
}
@@ -1404,5 +1432,5 @@ module_usb_driver(lme2510_driver);
 
 MODULE_AUTHOR("Malcolm Priestley ");
 MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0");
-MODULE_VERSION("1.99");
+MODULE_VERSION("2.00");
 MODULE_LICENSE("GPL");
-- 
1.7.9.5



--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.ker

Re: [PATCH V5 4/5] Media: Update docs for V4L2 FM new features

2012-05-14 Thread Hans Verkuil
Just some comments on the spacing...

On Mon May 14 2012 21:24:28 manjunatha_ha...@ti.com wrote:
> From: Manjunatha Halli 
> 
> The list of new features -
>   1) New control class for FM RX
>   2) New FM RX CID's - De-Emphasis filter mode and RDS AF switch
>   3) New FM TX CID - RDS Alternate frequency set.
>   4) New capability struct v4l2_tuner flags for band selection
> 
> Signed-off-by: Manjunatha Halli 
> ---
>  Documentation/DocBook/media/v4l/compat.xml |3 +
>  Documentation/DocBook/media/v4l/controls.xml   |   77 
> 
>  Documentation/DocBook/media/v4l/dev-rds.xml|5 +-
>  .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml   |7 ++
>  Documentation/DocBook/media/v4l/vidioc-g-tuner.xml |   25 +++
>  .../DocBook/media/v4l/vidioc-s-hw-freq-seek.xml|   38 +-
>  6 files changed, 151 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/DocBook/media/v4l/compat.xml 
> b/Documentation/DocBook/media/v4l/compat.xml
> index bce97c5..df1f345 100644
> --- a/Documentation/DocBook/media/v4l/compat.xml
> +++ b/Documentation/DocBook/media/v4l/compat.xml
> @@ -2311,6 +2311,9 @@ more information.
> Added FM Modulator (FM TX) Extended Control Class: 
> V4L2_CTRL_CLASS_FM_TX and their Control IDs.
>   
>   
> + Added FM Receiver (FM RX) Extended Control Class: 
> V4L2_CTRL_CLASS_FM_RX and their Control IDs.
> + 
> + 
> Added Remote Controller chapter, describing the default Remote 
> Controller mapping for media devices.
>   
>
> diff --git a/Documentation/DocBook/media/v4l/controls.xml 
> b/Documentation/DocBook/media/v4l/controls.xml
> index b84f25e..976b11b 100644
> --- a/Documentation/DocBook/media/v4l/controls.xml
> +++ b/Documentation/DocBook/media/v4l/controls.xml
> @@ -3018,6 +3018,12 @@ to find receivers which can scroll strings sized as 32 
> x N or 64 x N characters.
>  with steps of 32 or 64 characters. The result is it must always contain a 
> string with size multiple of 32 or 64. 
> 
> 
> +spanname="id">V4L2_CID_RDS_TX_AF_FREQ 
> +   integer
> +   
> +   Sets the RDS Alternate Frequency value 
> which allows a receiver to re-tune to a different frequency providing the 
> same station when the first signal becomes too weak (e.g., when moving out of 
> range). 
> +   
> +   
>spanname="id">V4L2_CID_AUDIO_LIMITER_ENABLED 
>   boolean
> 
> @@ -3146,6 +3152,77 @@ manually or automatically if set to zero. Unit, range 
> and step are driver-specif
>   document, from CENELEC.
>  
>  
> +
> +  FM Receiver Control Reference
> +
> +  The FM Receiver (FM_RX) class includes controls for common 
> features of
> +FM Reception capable devices.
> +
> +  
> +  FM_RX Control IDs
> +
> +  
> +
> +
> +
> +
> +
> +
> +
> +  
> +ID
> +Type
> +   align="left">Description
> +  
> +
> +
> +  
> +  
> + spanname="id">V4L2_CID_FM_RX_CLASS 
> +class
> +  The FM_RX class
> +descriptor. Calling &VIDIOC-QUERYCTRL; for this control will return a
> +description of this control class.
> +  
> +  
> + spanname="id">V4L2_CID_RDS_AF_SWITCH 
> +boolean
> +  
> +  Enable or Disable the RDS Alternate 
> frequency feature. When enabled the driver will decode the RDS AF field and 
> tries to switch to this AF frequency once the current frequency RSSI(Received 
> signal strength indication) level goes below the threshold. If the frequency 
> is switched, then

Put a space before the parenthesis: "RSSI (Received..."

> &VIDIOC-G-FREQUENCY; will return the new frequency.
> +  
> +  
> +  spanname="id">V4L2_CID_TUNE_DEEMPHASIS 
> + integer
> +   
> +   Configures the 
> de-emphasis value for reception.
> +A pre-emphasis filter is applied to the broadcast to accentuate the high 
> audio frequencies.
> +Depending on the region, a time constant of either 50 or 75 useconds is 
> used. The enum v4l2_preemphasis
> +defines possible values for pre-emphasis. Here they are:
> + 
> + 
> +   
> + 
> +   
> V4L2_PREEMPHASIS_DISABLED 
> +   No de-emphasis is applied.
> + 
> + 
> +   
> V4L2_PREEMPHASIS_50_uS 
> +   A de-emphasis of 50 uS is used.
> + 
> + 
> +   
> V4L2_PREEMPHASIS_75_uS 
> +   A de-emphasis of 75 uS is used.
> + 
> +   
> + 
> +
> +   
> +  
> +
> +  
> +  
> +
> +  
>  
>Flash Control Reference
>  
> diff --git a/Documentation/DocBook/media/v4l/dev-rds.xml 
> b/Documentation/DocBo

Re: [PATCH V5 2/5] New control class and features for FM RX

2012-05-14 Thread Hans Verkuil
Hi Manjunatha,

I wish I could ack this series, but there is one thing that really needs
to change:

On Mon May 14 2012 21:24:26 manjunatha_ha...@ti.com wrote:
> @@ -1843,13 +1857,22 @@ struct v4l2_frequency {
>   __u32 reserved[8];
>  };
>  
> +
> +#define FM_BAND_TYPE_DEFAULT 0   /* All Bands 65.8 MHz till 108 Mhz
> +or 162.55 MHz if weather band */
> +#define FM_BAND_TYPE_EUROPE_US   1   /* 87.5 Mhz - 108 MHz*/
> +#define FM_BAND_TYPE_JAPAN   2   /* 76 MHz - 90 MHz*/
> +#define FM_BAND_TYPE_RUSSIAN 3   /* 65.8 MHz - 74 MHz*/
> +#define FM_BAND_TYPE_WEATHER 4   /* 162.4 MHz - 162.55 MHz*/

This needs a V4L2_ prefix. And in my opinion the _TYPE part can be dropped.

So it becomes:

#define V4L2_FM_BAND_DEFAULT0
#define V4L2_FM_BAND_EUROPE_US  1   /* 87.5 Mhz - 108 MHz */
#define V4L2_FM_BAND_JAPAN  2   /* 76 MHz - 90 MHz */
#define V4L2_FM_BAND_RUSSIAN3   /* 65.8 MHz - 74 MHz */
#define V4L2_FM_BAND_WEATHER4   /* 162.4 MHz - 162.55 MHz */

BTW, also put a space before '*/'.

If you can make this change quickly (i.e. today) and post the fixed version
(don't forget to update the documentation as well!) then I'll ack it and
there is a change you can get it merged for 3.5.

Regards,

Hans

> +
>  struct v4l2_hw_freq_seek {
>   __u32 tuner;
>   enum v4l2_tuner_type  type;
>   __u32 seek_upward;
>   __u32 wrap_around;
>   __u32 spacing;
> - __u32 reserved[7];
> + __u32 band;
> + __u32 reserved[6];
>  };
>  
>  /*
> 
--
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 V5 2/5] New control class and features for FM RX

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

This patch creates new ctrl class for FM RX and adds new CID's for
below FM features,
  1) De-Emphasis filter mode
  2) RDS Alternate Frequency switch

Also this patch adds a field for band selection in struct v4l2_hw_freq_seek
and adds new capability flags for all below FM bands
1) V4L2_TUNER_CAP_BAND_TYPE_DEFAULT -> Default Band
2) V4L2_TUNER_CAP_BAND_TYPE_EUROPE_US -> Europe/US Band
3) V4L2_TUNER_CAP_BAND_TYPE_JAPAN   -> Japan Band
4) V4L2_TUNER_CAP_BAND_TYPE_RUSSIAN -> Russian Band
5) V4L2_TUNER_CAP_BAND_TYPE_WEATHER -> Weather Band

Signed-off-by: Manjunatha Halli 
---
 drivers/media/video/v4l2-ctrls.c |   17 ++---
 include/linux/videodev2.h|   25 -
 2 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 18015c0..9d7608e 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -243,8 +243,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
"Vivid",
NULL
};
-   static const char * const tune_preemphasis[] = {
-   "No Preemphasis",
+   static const char * const tune_emphasis[] = {
+   "None",
"50 Microseconds",
"75 Microseconds",
NULL,
@@ -413,7 +413,9 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
case V4L2_CID_COLORFX:
return colorfx;
case V4L2_CID_TUNE_PREEMPHASIS:
-   return tune_preemphasis;
+   return tune_emphasis;
+   case V4L2_CID_TUNE_DEEMPHASIS:
+   return tune_emphasis;
case V4L2_CID_FLASH_LED_MODE:
return flash_led_mode;
case V4L2_CID_FLASH_STROBE_SOURCE:
@@ -644,6 +646,12 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_JPEG_COMPRESSION_QUALITY: return "Compression Quality";
case V4L2_CID_JPEG_ACTIVE_MARKER:   return "Active Markers";
 
+   /* FM Radio Receiver control */
+   /* Keep the order of the 'case's the same as in videodev2.h! */
+   case V4L2_CID_FM_RX_CLASS:  return "FM Radio Receiver 
Controls";
+   case V4L2_CID_RDS_AF_SWITCH:return "RDS Alternate Frequency 
Switch";
+   case V4L2_CID_TUNE_DEEMPHASIS:  return "De-Emphasis";
+
default:
return NULL;
}
@@ -688,6 +696,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM:
case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE:
case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL:
+   case V4L2_CID_RDS_AF_SWITCH:
*type = V4L2_CTRL_TYPE_BOOLEAN;
*min = 0;
*max = *step = 1;
@@ -733,6 +742,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
+   case V4L2_CID_TUNE_DEEMPHASIS:
*type = V4L2_CTRL_TYPE_MENU;
break;
case V4L2_CID_RDS_TX_PS_NAME:
@@ -745,6 +755,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_FM_TX_CLASS:
case V4L2_CID_FLASH_CLASS:
case V4L2_CID_JPEG_CLASS:
+   case V4L2_CID_FM_RX_CLASS:
*type = V4L2_CTRL_TYPE_CTRL_CLASS;
/* You can neither read not write these */
*flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY;
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index c9c9a46..16c0e90 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1137,6 +1137,7 @@ struct v4l2_ext_controls {
 #define V4L2_CTRL_CLASS_FM_TX 0x009b   /* FM Modulator control class */
 #define V4L2_CTRL_CLASS_FLASH 0x009c   /* Camera flash controls */
 #define V4L2_CTRL_CLASS_JPEG 0x009d/* JPEG-compression 
controls */
+#define V4L2_CTRL_CLASS_FM_RX 0x009e   /* FM Receiver control class */
 
 #define V4L2_CTRL_ID_MASK(0x0fff)
 #define V4L2_CTRL_ID2CLASS(id)((id) & 0x0fffUL)
@@ -1782,6 +1783,13 @@ enum v4l2_jpeg_chroma_subsampling {
 #defineV4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)
 #defineV4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)
 
+/* FM Receiver class control IDs */
+#define V4L2_CID_FM_RX_CLASS_BASE  (V4L2_CTRL_CLASS_FM_RX | 0x900)
+#define V4L2_CID_FM_RX_CLASS   (V4L2_CTRL_CLASS_FM_RX | 1)
+
+#define V4L2_CID_RDS_AF_SWITCH (V4L2_CID_FM_RX_CLASS_BASE + 1)
+#define V4L2_CID_TUNE_DEEMPHASIS   (V4L2_CID_FM_RX_CLASS_BASE + 2)
+
 /*
  * T U N I N G
  */
@@ -1819,6 +1827,12 @@ struct v4l2_modulator {
 #define V4L2_TUNER_CAP_RDS 0x008

[PATCH V5 3/5] Add new CID for FM TX RDS Alternate Frequency

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

Signed-off-by: Manjunatha Halli 
---
 drivers/media/video/v4l2-ctrls.c |1 +
 include/linux/videodev2.h|1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 9d7608e..610076c 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -608,6 +608,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_RDS_TX_PTY:   return "RDS Program Type";
case V4L2_CID_RDS_TX_PS_NAME:   return "RDS PS Name";
case V4L2_CID_RDS_TX_RADIO_TEXT:return "RDS Radio Text";
+   case V4L2_CID_RDS_TX_AF_FREQ:   return "RDS Alternate 
Frequency";
case V4L2_CID_AUDIO_LIMITER_ENABLED:return "Audio Limiter Feature 
Enabled";
case V4L2_CID_AUDIO_LIMITER_RELEASE_TIME: return "Audio Limiter Release 
Time";
case V4L2_CID_AUDIO_LIMITER_DEVIATION:  return "Audio Limiter 
Deviation";
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 16c0e90..2170830 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1699,6 +1699,7 @@ enum  v4l2_exposure_auto_type {
 #define V4L2_CID_RDS_TX_PTY(V4L2_CID_FM_TX_CLASS_BASE + 3)
 #define V4L2_CID_RDS_TX_PS_NAME
(V4L2_CID_FM_TX_CLASS_BASE + 5)
 #define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6)
+#define V4L2_CID_RDS_TX_AF_FREQ
(V4L2_CID_FM_TX_CLASS_BASE + 7)
 
 #define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64)
 #define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME(V4L2_CID_FM_TX_CLASS_BASE + 65)
-- 
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 V5 4/5] Media: Update docs for V4L2 FM new features

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

The list of new features -
1) New control class for FM RX
2) New FM RX CID's - De-Emphasis filter mode and RDS AF switch
3) New FM TX CID - RDS Alternate frequency set.
4) New capability struct v4l2_tuner flags for band selection

Signed-off-by: Manjunatha Halli 
---
 Documentation/DocBook/media/v4l/compat.xml |3 +
 Documentation/DocBook/media/v4l/controls.xml   |   77 
 Documentation/DocBook/media/v4l/dev-rds.xml|5 +-
 .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml   |7 ++
 Documentation/DocBook/media/v4l/vidioc-g-tuner.xml |   25 +++
 .../DocBook/media/v4l/vidioc-s-hw-freq-seek.xml|   38 +-
 6 files changed, 151 insertions(+), 4 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/compat.xml 
b/Documentation/DocBook/media/v4l/compat.xml
index bce97c5..df1f345 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -2311,6 +2311,9 @@ more information.
  Added FM Modulator (FM TX) Extended Control Class: 
V4L2_CTRL_CLASS_FM_TX and their Control IDs.


+   Added FM Receiver (FM RX) Extended Control Class: 
V4L2_CTRL_CLASS_FM_RX and their Control IDs.
+   
+   
  Added Remote Controller chapter, describing the default Remote 
Controller mapping for media devices.

   
diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index b84f25e..976b11b 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -3018,6 +3018,12 @@ to find receivers which can scroll strings sized as 32 x 
N or 64 x N characters.
 with steps of 32 or 64 characters. The result is it must always contain a 
string with size multiple of 32 or 64. 
  
  
+ V4L2_CID_RDS_TX_AF_FREQ 
+ integer
+ 
+ Sets the RDS Alternate Frequency value 
which allows a receiver to re-tune to a different frequency providing the same 
station when the first signal becomes too weak (e.g., when moving out of 
range). 
+ 
+ 
V4L2_CID_AUDIO_LIMITER_ENABLED 
boolean
  
@@ -3146,6 +3152,77 @@ manually or automatically if set to zero. Unit, range 
and step are driver-specif
  document, from CENELEC.
 
 
+
+  FM Receiver Control Reference
+
+  The FM Receiver (FM_RX) class includes controls for common 
features of
+FM Reception capable devices.
+
+  
+  FM_RX Control IDs
+
+  
+
+
+
+
+
+
+
+  
+ID
+Type
+  Description
+  
+
+
+  
+  
+V4L2_CID_FM_RX_CLASS 
+class
+  The FM_RX class
+descriptor. Calling &VIDIOC-QUERYCTRL; for this control will return a
+description of this control class.
+  
+  
+V4L2_CID_RDS_AF_SWITCH 
+boolean
+  
+  Enable or Disable the RDS Alternate 
frequency feature. When enabled the driver will decode the RDS AF field and 
tries to switch to this AF frequency once the current frequency RSSI(Received 
signal strength indication) level goes below the threshold. If the frequency is 
switched, then &VIDIOC-G-FREQUENCY; will return the new frequency.
+  
+  
+   V4L2_CID_TUNE_DEEMPHASIS 
+   integer
+ 
+ Configures the 
de-emphasis value for reception.
+A pre-emphasis filter is applied to the broadcast to accentuate the high audio 
frequencies.
+Depending on the region, a time constant of either 50 or 75 useconds is used. 
The enum v4l2_preemphasis
+defines possible values for pre-emphasis. Here they are:
+   
+   
+ 
+   
+ 
V4L2_PREEMPHASIS_DISABLED 
+ No de-emphasis is applied.
+   
+   
+ 
V4L2_PREEMPHASIS_50_uS 
+ A de-emphasis of 50 uS is used.
+   
+   
+ 
V4L2_PREEMPHASIS_75_uS 
+ A de-emphasis of 75 uS is used.
+   
+ 
+   
+
+ 
+  
+
+  
+  
+
+  
 
   Flash Control Reference
 
diff --git a/Documentation/DocBook/media/v4l/dev-rds.xml 
b/Documentation/DocBook/media/v4l/dev-rds.xml
index 38883a4..8188161 100644
--- a/Documentation/DocBook/media/v4l/dev-rds.xml
+++ b/Documentation/DocBook/media/v4l/dev-rds.xml
@@ -55,8 +55,9 @@ If the driver only passes RDS blocks without interpreting the 
data
 the V4L2_TUNER_CAP_RDS_BLOCK_IO flag has to be set. If the
 tuner is capable of handling RDS entities like program identification codes 
and radio
 text, the flag V4L2_TUNER_CAP_RDS_CONTROLS should be set,
-see Writing 

[PATCH V5 5/5] WL12xx: Add support for FM new features.

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

This patch adds below features to TI's V4l2 FM driver for Wilink
chipsets,

1) FM RX Set frequency allows to set frequency anywhere between
65.5 MHz till 108 MHz (if chip is Wilink8 then till 164.55 MHz)
2) FM RX seek caters for band switch
3) FM RX RDS AF turn ON/OFF
4) FM RX De-Emphasis mode set/get
5) FM TX Alternate Frequency set/get

Also this patch fixes below issues

1) FM audio volume gain setting
2) Default rssi level is set to 8 instead of 20
3) Issue related to audio mute/unmute
4) Enable FM RX AF support in driver
5) In wrap_around seek mode try for once

Signed-off-by: Manjunatha Halli 
---
 drivers/media/radio/wl128x/fmdrv.h|3 +-
 drivers/media/radio/wl128x/fmdrv_common.c |   38 +--
 drivers/media/radio/wl128x/fmdrv_common.h |   28 +++-
 drivers/media/radio/wl128x/fmdrv_rx.c |   90 -
 drivers/media/radio/wl128x/fmdrv_rx.h |2 +-
 drivers/media/radio/wl128x/fmdrv_v4l2.c   |  101 +++--
 6 files changed, 224 insertions(+), 38 deletions(-)

diff --git a/drivers/media/radio/wl128x/fmdrv.h 
b/drivers/media/radio/wl128x/fmdrv.h
index d84ad9d..c806c85 100644
--- a/drivers/media/radio/wl128x/fmdrv.h
+++ b/drivers/media/radio/wl128x/fmdrv.h
@@ -150,6 +150,7 @@ struct fm_rx {
struct region_info region;  /* Current selected band */
u32 freq;   /* Current RX frquency */
u8 mute_mode;   /* Current mute mode */
+   u8 bl_flag; /* Band limit reached flag */
u8 deemphasis_mode; /* Current deemphasis mode */
/* RF dependent soft mute mode */
u8 rf_depend_mute;
@@ -203,7 +204,7 @@ struct fmtx_data {
 struct fmdev {
struct video_device *radio_dev; /* V4L2 video device pointer */
struct snd_card *card;  /* Card which holds FM mixer controls */
-   u16 asci_id;
+   u16 asic_id;
spinlock_t rds_buff_lock; /* To protect access to RDS buffer */
spinlock_t resp_skb_lock; /* To protect access to received SKB */
 
diff --git a/drivers/media/radio/wl128x/fmdrv_common.c 
b/drivers/media/radio/wl128x/fmdrv_common.c
index fcce61a..ac20556 100644
--- a/drivers/media/radio/wl128x/fmdrv_common.c
+++ b/drivers/media/radio/wl128x/fmdrv_common.c
@@ -44,20 +44,41 @@
 
 /* Region info */
 static struct region_info region_configs[] = {
+   /* Super set of all bands */
+   {
+.chanl_space = FM_CHANNEL_SPACING_200KHZ * FM_FREQ_MUL,
+.bot_freq = 65800, /* 87.5 MHz */
+.top_freq = 162550,/* 108 MHz */
+.fm_band = 0,
+},
/* Europe/US */
{
 .chanl_space = FM_CHANNEL_SPACING_200KHZ * FM_FREQ_MUL,
 .bot_freq = 87500, /* 87.5 MHz */
 .top_freq = 108000,/* 108 MHz */
-.fm_band = 0,
+.fm_band = 1,
 },
/* Japan */
{
 .chanl_space = FM_CHANNEL_SPACING_200KHZ * FM_FREQ_MUL,
 .bot_freq = 76000, /* 76 MHz */
 .top_freq = 9, /* 90 MHz */
-.fm_band = 1,
+.fm_band = 2,
 },
+   /* Russian (OIRT) band */
+   {
+   .chanl_space = FM_CHANNEL_SPACING_50KHZ * FM_FREQ_MUL_RUS,
+   .bot_freq = 65800, /* 65.8 MHz */
+   .top_freq = 74000, /* 74 MHz */
+   .fm_band = 3,
+   },
+   /* Wether Band */
+   {
+   .chanl_space = FM_CHANNEL_SPACING_50KHZ * FM_FREQ_MUL_WB,
+   .bot_freq = 162400, /* 162.4 MHz */
+   .top_freq = 162550, /* 162.55 MHz */
+   .fm_band = 4,
+   }
 };
 
 /* Band selection */
@@ -596,7 +617,6 @@ static void fm_irq_handle_flag_getcmd_resp(struct fmdev 
*fmdev)
memcpy(&fmdev->irq_info.flag, skb->data, fm_evt_hdr->dlen);
 
fmdev->irq_info.flag = be16_to_cpu(fmdev->irq_info.flag);
-   fmdbg("irq: flag register(0x%x)\n", fmdev->irq_info.flag);
 
/* Continue next function in interrupt handler table */
fm_irq_call_stage(fmdev, FM_HW_MAL_FUNC_IDX);
@@ -702,7 +722,7 @@ static void fm_rdsparse_swapbytes(struct fmdev *fmdev,
 * in Dolphin they are in big endian, the parsing of the RDS data
 * is chip dependent
 */
-   if (fmdev->asci_id != 0x6350) {
+   if (fmdev->asic_id != 0x6350) {
rds_buff = &rds_format->data.groupdatabuff.buff[0];
while (index + 1 < FM_RX_RDS_INFO_FIELD_MAX) {
byte1 = rds_buff[index];
@@ -1353,11 +1373,13 @@ static int fm_power_up(struct fmdev *fmdev, u8 mode)
sizeof(asic_ver), &asic_ver, &resp_len))
goto rel;
 
+   fmdev->asic_id = be16_to_cpu(asic_id);
+
fmdbg("ASIC ID: 0x%x , ASIC Version: %d\n",
-   be16_to_cpu(asic_id), be16_to_cpu(asic_ver));
+   fmdev->asic_id, be16_to_cpu(asic_ver));
 
sprintf(fw_name, "%s_%x.%d.bts", FM_FMC_FW_FILE_START,
-  

[PATCH V5 1/5] WL128x: Add support for FM TX RDS

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

This patch adds support for following FM TX RDS features,
 1. Radio Text
 2. PS Name
 3. PI Code
 4. PTY Code.

Along with above this patch fixes few other minor issues(like
fm tx get frequency, unnecessary error messages etc).

Signed-off-by: Manjunatha Halli 
---
 drivers/media/radio/wl128x/fmdrv_common.c |   17 +++---
 drivers/media/radio/wl128x/fmdrv_common.h |   17 +++
 drivers/media/radio/wl128x/fmdrv_rx.c |2 +-
 drivers/media/radio/wl128x/fmdrv_tx.c |   41 ++---
 drivers/media/radio/wl128x/fmdrv_tx.h |3 +-
 drivers/media/radio/wl128x/fmdrv_v4l2.c   |   47 +
 6 files changed, 90 insertions(+), 37 deletions(-)

diff --git a/drivers/media/radio/wl128x/fmdrv_common.c 
b/drivers/media/radio/wl128x/fmdrv_common.c
index bf867a6..fcce61a 100644
--- a/drivers/media/radio/wl128x/fmdrv_common.c
+++ b/drivers/media/radio/wl128x/fmdrv_common.c
@@ -354,7 +354,7 @@ static void send_tasklet(unsigned long arg)
 
/* Check, is there any timeout happened to last transmitted packet */
if ((jiffies - fmdev->last_tx_jiffies) > FM_DRV_TX_TIMEOUT) {
-   fmerr("TX timeout occurred\n");
+   fmdbg("TX timeout occurred\n");
atomic_set(&fmdev->tx_cnt, 1);
}
 
@@ -615,7 +615,11 @@ static void fm_irq_handle_rds_start(struct fmdev *fmdev)
 {
if (fmdev->irq_info.flag & FM_RDS_EVENT & fmdev->irq_info.mask) {
fmdbg("irq: rds threshold reached\n");
-   fmdev->irq_info.stage = FM_RDS_SEND_RDS_GETCMD_IDX;
+   /* If RSSI reached below threshold then dont get RDS data */
+   if (fmdev->irq_info.flag & FM_LEV_EVENT)
+   fmdev->irq_info.stage = FM_HW_TUNE_OP_ENDED_IDX;
+   else
+   fmdev->irq_info.stage = FM_RDS_SEND_RDS_GETCMD_IDX;
} else {
/* Continue next function in interrupt handler table */
fmdev->irq_info.stage = FM_HW_TUNE_OP_ENDED_IDX;
@@ -1129,8 +1133,9 @@ int fmc_set_freq(struct fmdev *fmdev, u32 freq_to_set)
 
 int fmc_get_freq(struct fmdev *fmdev, u32 *cur_tuned_frq)
 {
-   if (fmdev->rx.freq == FM_UNDEFINED_FREQ) {
-   fmerr("RX frequency is not set\n");
+   if (fmdev->rx.freq == FM_UNDEFINED_FREQ &&
+   fmdev->tx_data.tx_frq == FM_UNDEFINED_FREQ) {
+   fmerr("RX/TX frequency is not set\n");
return -EPERM;
}
if (cur_tuned_frq == NULL) {
@@ -1144,7 +1149,7 @@ int fmc_get_freq(struct fmdev *fmdev, u32 *cur_tuned_frq)
return 0;
 
case FM_MODE_TX:
-   *cur_tuned_frq = 0; /* TODO : Change this later */
+   *cur_tuned_frq = fmdev->tx_data.tx_frq;
return 0;
 
default:
@@ -1574,6 +1579,8 @@ int fmc_prepare(struct fmdev *fmdev)
fmdev->rx.af_mode = FM_RX_RDS_AF_SWITCH_MODE_OFF;
fmdev->irq_info.retry = 0;
 
+   fmdev->tx_data.tx_frq = FM_UNDEFINED_FREQ;
+
fm_rx_reset_rds_cache(fmdev);
init_waitqueue_head(&fmdev->rx.rds.read_queue);
 
diff --git a/drivers/media/radio/wl128x/fmdrv_common.h 
b/drivers/media/radio/wl128x/fmdrv_common.h
index d9b9c6c..196ff7d 100644
--- a/drivers/media/radio/wl128x/fmdrv_common.h
+++ b/drivers/media/radio/wl128x/fmdrv_common.h
@@ -48,8 +48,8 @@ struct fm_reg_table {
 #define SEARCH_LVL_SET   15
 #define BAND_SET 16
 #define MUTE_STATUS_SET  17
-#define RDS_PAUSE_LVL_SET18
-#define RDS_PAUSE_DUR_SET19
+#define AUD_PAUSE_LVL_SET18
+#define AUD_PAUSE_DUR_SET19
 #define RDS_MEM_SET  20
 #define RDS_BLK_B_SET21
 #define RDS_MSK_B_SET22
@@ -84,11 +84,12 @@ struct fm_reg_table {
 
 #define FM_POWER_MODE254
 #define FM_INTERRUPT 255
+#define STATION_VALID   123
 
 /* Transmitter API */
 
 #define CHANL_SET55
-#define CHANL_BW_SET   56
+#define SCAN_SPACING_SET 56
 #define REF_SET  57
 #define POWER_ENB_SET90
 #define POWER_ATT_SET58
@@ -103,7 +104,8 @@ struct fm_reg_table {
 #define MONO_SET 66
 #define MUTE 92
 #define MPX_LMT_ENABLE   67
-#define PI_SET   93
+#define REF_ERR_SET 93
+#define PI_SET   68
 #define ECC_SET  69
 #define PTY  70
 #define AF   71
@@ -120,6 +122,10 @@ struct fm_reg_table {
 #define TX_AUDIO_LEVEL_TEST  96
 #define TX_AUDIO_LEVEL_TEST_THRESHOLD73
 #define TX_AUDIO_INPUT_LEVEL_RANGE_SET   54
+#define TX_AUDIO_LEVEL_GET  7
+#define READ_FMANT_TUNE_VALUE104
+
+/* New FM APIs (Rx and Tx) */
 #define RX_ANTENNA_SELECT87
 #define I2C_DEV_ADDR_SET 86
 #define REF_ERR_CALIB_PARAM_SET 

[PATCH V5 0/5] [Media] Radio: Fixes and New features for FM

2012-05-14 Thread manjunatha_halli
From: Manjunatha Halli 

Mauro and the list,

This version 5 of patchset resolves the comments received from
Han's on patchset v4.

This patchset creates new control class 'V4L2_CTRL_CLASS_FM_RX' for FM RX,
introduces 2 new CID's for FM RX and and 1 new CID for FM TX. Also adds 1
field in struct v4l2_hw_freq_seek.

This patch adds few new features to TI's FM driver features
are listed below,

1) FM TX RDS Support (RT, PS, AF, PI, PTY)
2) FM RX Russian band support
3) FM RX AF set/get
4) FM RX De-emphasis mode set/get

Along with new features this patch also fixes few issues in the driver
like default rssi level for seek, unnecessory logs etc.

Manjunatha Halli (5):
  WL128x: Add support for FM TX RDS
  New control class and features for FM RX
  Add new CID for FM TX RDS Alternate Frequency
  Media: Update docs for V4L2 FM new features
  WL12xx: Add support for FM new features.

 Documentation/DocBook/media/v4l/compat.xml |3 +
 Documentation/DocBook/media/v4l/controls.xml   |   77 ++
 Documentation/DocBook/media/v4l/dev-rds.xml|5 +-
 .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml   |7 +
 Documentation/DocBook/media/v4l/vidioc-g-tuner.xml |   25 
 .../DocBook/media/v4l/vidioc-s-hw-freq-seek.xml|   38 +-
 drivers/media/radio/wl128x/fmdrv.h |3 +-
 drivers/media/radio/wl128x/fmdrv_common.c  |   55 ++--
 drivers/media/radio/wl128x/fmdrv_common.h  |   43 +-
 drivers/media/radio/wl128x/fmdrv_rx.c  |   92 ++---
 drivers/media/radio/wl128x/fmdrv_rx.h  |2 +-
 drivers/media/radio/wl128x/fmdrv_tx.c  |   41 +++---
 drivers/media/radio/wl128x/fmdrv_tx.h  |3 +-
 drivers/media/radio/wl128x/fmdrv_v4l2.c|  148 +++-
 drivers/media/video/v4l2-ctrls.c   |   18 ++-
 include/linux/videodev2.h  |   26 -
 16 files changed, 504 insertions(+), 82 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


[RFC PATCH 2/2] feature-removal: ISA video capture and parport webcams drivers

2012-05-14 Thread Hans Verkuil
From: Hans Verkuil 

Announce the removal of the pms ISA video capture driver and the
parallel port w9966, bw-qcam and c-qcam drivers.

Signed-off-by: Hans Verkuil 
---
 Documentation/feature-removal-schedule.txt |   10 ++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/feature-removal-schedule.txt 
b/Documentation/feature-removal-schedule.txt
index 03ca210..65b8883 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -539,3 +539,13 @@ When:  3.6
 Why:   setitimer is not returning -EFAULT if user pointer is NULL. This
violates the spec.
 Who:   Sasikantha Babu 
+
+
+
+What:  Remove the ISA video capture driver pms and parallel port webcam
+   drivers bw-qcam, c-qcam and w9966.
+When:  3.6
+Why:   Nobody has the hardware anymore to test these, and ISA video boards and
+   parallel port webcams are really obsolete these days. Time to retire
+   these drivers.
+Who:   Hans Verkuil 
-- 
1.7.10

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


[RFC PATCH 1/2] pms/w9966/bw-qcam/c-qcam: mark drivers as deprecated.

2012-05-14 Thread Hans Verkuil
From: Hans Verkuil 

Nobody has the hardware anymore to test it with, and really nobody cares.
Deprecated these drivers.

Signed-off-by: Hans Verkuil 
---
 drivers/media/video/Kconfig |   20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 3dc0ea7..6c092dc 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -813,9 +813,12 @@ menuconfig V4L_ISA_PARPORT_DRIVERS
 if V4L_ISA_PARPORT_DRIVERS
 
 config VIDEO_BWQCAM
-   tristate "Quickcam BW Video For Linux"
+   tristate "Quickcam BW Video For Linux (DEPRECATED)"
depends on PARPORT && VIDEO_V4L2
help
+ This driver is DEPRECATED due to lack of hardware to test it and
+ because parallel port webcams are obsolete.
+
  Say Y have if you the black and white version of the QuickCam
  camera. See the next option for the color version.
 
@@ -823,9 +826,12 @@ config VIDEO_BWQCAM
  module will be called bw-qcam.
 
 config VIDEO_CQCAM
-   tristate "QuickCam Colour Video For Linux"
+   tristate "QuickCam Colour Video For Linux (DEPRECATED)"
depends on PARPORT && VIDEO_V4L2
help
+ This driver is DEPRECATED due to lack of hardware to test it and
+ because parallel port webcams are obsolete.
+
  This is the video4linux driver for the colour version of the
  Connectix QuickCam.  If you have one of these cameras, say Y here,
  otherwise say N.  This driver does not work with the original
@@ -834,9 +840,12 @@ config VIDEO_CQCAM
  Read  for more information.
 
 config VIDEO_PMS
-   tristate "Mediavision Pro Movie Studio Video For Linux"
+   tristate "Mediavision Pro Movie Studio Video For Linux (DEPRECATED)"
depends on ISA && VIDEO_V4L2
help
+ This driver is DEPRECATED due to lack of hardware to test it and
+ because ISA capture boards are obsolete.
+
  Say Y if you have the ISA Mediavision Pro Movie Studio
  capture card.
 
@@ -844,9 +853,12 @@ config VIDEO_PMS
  module will be called pms.
 
 config VIDEO_W9966
-   tristate "W9966CF Webcam (FlyCam Supra and others) Video For Linux"
+   tristate "W9966CF Webcam (FlyCam Supra and others) Video For Linux 
(DEPRECATED)"
depends on PARPORT_1284 && PARPORT && VIDEO_V4L2
help
+ This driver is DEPRECATED due to lack of hardware to test it and
+ because parallel port webcams are obsolete.
+
  Video4linux driver for Winbond's w9966 based Webcams.
  Currently tested with the LifeView FlyCam Supra.
  If you have one of these cameras, say Y here
-- 
1.7.10

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


[RFC PATCH 0/2] Proposal to deprecate four drivers

2012-05-14 Thread Hans Verkuil
Hi all,

These two patches deprecate the ISA video capture pms driver and the three
parallel port webcam drivers bw-qcam, c-qcam and w9966.

Nobody has hardware for the three parallel port webcams anymore (and we really
tried to get hold of some), and my ISA pms board also no longer works (I suspect
the Pentium motherboard I use for testing ISA cards is too fast :-) ).

I've given up on these drivers. I've posted a pull request to get these drivers
up to speed with regards to the latest frameworks (the pms update has already
been merged), and I think that should be the last change before removing them
altogether. If someone ever gets working hardware for these drivers, then they
are easy to resurrect from the git history should there be a desire to do so.

ISA and parallel port are both unsuitable for streaming video, so this hardware
is really obsolete.

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 02/10] DocBook: document new DTV Properties for ATSC-MH delivery system

2012-05-14 Thread Mauro Carvalho Chehab
Em 01-05-2012 01:12, Michael Krufky escreveu:
> Signed-off-by: Michael Krufky 

Where's the patch description? For sure a patch like that deserves to be
well described.

> ---
>  Documentation/DocBook/media/dvb/dvbproperty.xml |  178 
> +++
>  1 files changed, 178 insertions(+), 0 deletions(-)
> 


> + 
> + 
> + DTV_ATSCMH_FIC_ERR
> + FIC error count.
> + Possible values: 0, 1, 2, 3, ..., 0x
> + 
> + 
> + DTV_ATSCMH_CRC_ERR
> + CRC error count.
> + Possible values: 0, 1, 2, 3, ..., 0x
> + 
> + 
> + DTV_ATSCMH_RS_ERR
> + RS error count.
> + Possible values: 0, 1, 2, 3, ..., 0x
> + 

The above for sure belongs to statistics API. It should be addressed together
with the other statistics API bits.

We shouldn't mix statistics with DVB frontent properties.

Btw, this is basically the same case as on ISDB-T: the layer that handles the 
channel
data (TPC, on ATSC M/H; TPS on DVB; TMCC on ISDB) provides statistics about
the frontend. However, the DVBv3 quality ioctl's are prepared to handle only
DVB parameters, and fails with more modern delivery systems.

We should apply a patch that will fix this one for all, like the one proposed 
by:
http://patchwork.linuxtv.org/patch/9578/

Regards,
Mauro
--
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


[GIT PULL FOR v3.5] More old driver cleanups

2012-05-14 Thread Hans Verkuil
Hi Mauro,

I'd almost forgotten that I had these done as well.
These are all trivial, but nobody is able to test it since nobody has the
hardware.

Regards,

Hans

The following changes since commit 152a3a7320d1582009db85d8be365ce430d079af:

  [media] v4l2-dev: rename two functions (2012-05-14 15:06:50 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git easy

for you to fetch changes up to d91593bf09bff27657a9dc1e7d4560fbb9eaac6d:

  w9966: convert to the latest frameworks. (2012-05-14 20:48:37 +0200)


Hans Verkuil (4):
  bw-qcam: update to latest frameworks.
  c-qcam: convert to the latest frameworks.
  arv: use latest frameworks.
  w9966: convert to the latest frameworks.

 drivers/media/video/arv.c |7 +-
 drivers/media/video/bw-qcam.c |  132 
--
 drivers/media/video/c-qcam.c  |  137 
+++
 drivers/media/video/w9966.c   |   94 
+++
 4 files changed, 174 insertions(+), 196 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


cron job: media_tree daily build: ERRORS

2012-05-14 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:Mon May 14 19:00:22 CEST 2012
git hash:528f0f785c042c80294708c5ae2c8005b4a0ee60
gcc version:  i686-linux-gcc (GCC) 4.6.3
host hardware:x86_64
host os:  3.3-5.slh.3-amd64

linux-git-arm-eabi-exynos: WARNINGS
linux-git-arm-eabi-omap: WARNINGS
linux-git-armv5-ixp: WARNINGS
linux-git-i686: OK
linux-git-m32r: ERRORS
linux-git-mips: WARNINGS
linux-git-powerpc64: OK
linux-git-x86_64: OK
linux-2.6.31.12-i686: ERRORS
linux-2.6.32.6-i686: ERRORS
linux-2.6.33-i686: ERRORS
linux-2.6.34-i686: ERRORS
linux-2.6.35.3-i686: ERRORS
linux-2.6.36-i686: ERRORS
linux-2.6.37-i686: ERRORS
linux-2.6.38.2-i686: ERRORS
linux-2.6.39.1-i686: ERRORS
linux-3.0-i686: ERRORS
linux-3.1-i686: ERRORS
linux-3.2.1-i686: ERRORS
linux-3.3-i686: ERRORS
linux-2.6.31.12-x86_64: ERRORS
linux-2.6.32.6-x86_64: ERRORS
linux-2.6.33-x86_64: ERRORS
linux-2.6.34-x86_64: ERRORS
linux-2.6.35.3-x86_64: ERRORS
linux-2.6.36-x86_64: ERRORS
linux-2.6.37-x86_64: ERRORS
linux-2.6.38.2-x86_64: ERRORS
linux-2.6.39.1-x86_64: ERRORS
linux-3.0-x86_64: ERRORS
linux-3.1-x86_64: ERRORS
linux-3.2.1-x86_64: ERRORS
linux-3.3-x86_64: ERRORS
apps: WARNINGS
spec-git: WARNINGS
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

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

The V4L-DVB specification 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


[PATCH] V4L: Rename V4L2_SEL_TGT_[CROP/COMPOSE]_ACTIVE to V4L2_SEL_TGT_[CROP/COMPOSE]

2012-05-14 Thread Sylwester Nawrocki
This patch drops the _ACTIVE part from the selection target names as
a prerequisite to unify the selection target names on subdevs and regular
video nodes.

Although not exactly the same, the meaning of V4L2_SEL_TGT_*_ACTIVE and
V4L2_SUBDEV_SEL_TGT_*_ACTUAL selection targets is logically the same.
Different names add to confusion where both APIs are used in a single
driver or an application.
The selections API is experimental, so no compatibility layer is added.
The ABI remains unchanged.

Signed-off-by: Sylwester Nawrocki 
Signed-off-by: Kyungmin Park 
---
 Documentation/DocBook/media/v4l/selection-api.xml  |   24 ++--
 .../DocBook/media/v4l/vidioc-g-selection.xml   |   15 ++--
 drivers/media/video/s5p-fimc/fimc-capture.c|8 +++
 drivers/media/video/s5p-jpeg/jpeg-core.c   |4 ++--
 drivers/media/video/s5p-tv/mixer_video.c   |8 +++
 drivers/media/video/v4l2-ioctl.c   |8 +++
 include/linux/videodev2.h  |4 ++--
 7 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/selection-api.xml 
b/Documentation/DocBook/media/v4l/selection-api.xml
index b299e47..ac013e5 100644
--- a/Documentation/DocBook/media/v4l/selection-api.xml
+++ b/Documentation/DocBook/media/v4l/selection-api.xml
@@ -91,7 +91,7 @@ top/left corner at position  (0,0) .  
The rectangle's
 coordinates are expressed in pixels.
 
 The top left corner, width and height of the source rectangle, that is
-the area actually sampled, is given by the  V4L2_SEL_TGT_CROP_ACTIVE
+the area actually sampled, is given by the  V4L2_SEL_TGT_CROP
  target. It uses the same coordinate system as 
 V4L2_SEL_TGT_CROP_BOUNDS . The active cropping area must lie
 completely inside the capture boundaries. The driver may further adjust the
@@ -111,7 +111,7 @@ height are equal to the image size set by  
VIDIOC_S_FMT .
 
 
 The part of a buffer into which the image is inserted by the hardware is
-controlled by the  V4L2_SEL_TGT_COMPOSE_ACTIVE  target.
+controlled by the  V4L2_SEL_TGT_COMPOSE  target.
 The rectangle's coordinates are also expressed in the same coordinate system as
 the bounds rectangle. The composing rectangle must lie completely inside bounds
 rectangle. The driver must adjust the composing rectangle to fit to the
@@ -125,7 +125,7 @@ bounding rectangle.
 
 The part of a buffer that is modified by the hardware is given by
  V4L2_SEL_TGT_COMPOSE_PADDED . It contains all pixels
-defined using  V4L2_SEL_TGT_COMPOSE_ACTIVE  plus all
+defined using  V4L2_SEL_TGT_COMPOSE  plus all
 padding data modified by hardware during insertion process. All pixels outside
 this rectangle must not be changed by the hardware. The
 content of pixels that lie inside the padded area but outside active area is
@@ -153,7 +153,7 @@ specified using  VIDIOC_S_FMT  
ioctl.
 
 The top left corner, width and height of the source rectangle, that is
 the area from which image date are processed by the hardware, is given by the
- V4L2_SEL_TGT_CROP_ACTIVE . Its coordinates are expressed
+ V4L2_SEL_TGT_CROP . Its coordinates are expressed
 in in the same coordinate system as the bounds rectangle. The active cropping
 area must lie completely inside the crop boundaries and the driver may further
 adjust the requested size and/or position according to hardware
@@ -165,7 +165,7 @@ bounding rectangle.
 
 The part of a video signal or graphics display where the image is
 inserted by the hardware is controlled by 
-V4L2_SEL_TGT_COMPOSE_ACTIVE  target.  The rectangle's coordinates
+V4L2_SEL_TGT_COMPOSE  target.  The rectangle's coordinates
 are expressed in pixels. The composing rectangle must lie completely inside the
 bounds rectangle.  The driver must adjust the area to fit to the bounding
 limits.  Moreover, the driver can perform other adjustments according to
@@ -184,7 +184,7 @@ such a padded area is driver-dependent feature not covered 
by this document.
 Driver developers are encouraged to keep padded rectangle equal to active one.
 The padded target is accessed by the  V4L2_SEL_TGT_COMPOSE_PADDED
  identifier.  It must contain all pixels from the 
-V4L2_SEL_TGT_COMPOSE_ACTIVE  target.
+V4L2_SEL_TGT_COMPOSE  target.
 

 
@@ -193,8 +193,8 @@ V4L2_SEL_TGT_COMPOSE_ACTIVE  target.
  Scaling control
 
 An application can detect if scaling is performed by comparing the width
-and the height of rectangles obtained using  V4L2_SEL_TGT_CROP_ACTIVE
- and  V4L2_SEL_TGT_COMPOSE_ACTIVE  targets. If
+and the height of rectangles obtained using  V4L2_SEL_TGT_CROP
+ and  V4L2_SEL_TGT_COMPOSE  targets. If
 these are not equal then the scaling is applied. The application can compute
 the scaling ratios using these values.
 
@@ -252,7 +252,7 @@ area)
ret = ioctl(fd, &VIDIOC-G-SELECTION;, &sel);
if (ret)
exit(-1);
-   sel.target = V4L2_SEL_TGT_CROP_ACTIVE;
+   sel.target = V4L2_SEL_TGT_CROP;
ret = ioct

Re: [PATCH v5 18/35] v4l: Allow changing control handler lock

2012-05-14 Thread Sylwester Nawrocki
On 05/14/2012 05:45 PM, Sakari Ailus wrote:
> Ooops. The patch included the changes for adp1653 and vivi which I found to be
> the only drivers using the lock directly. I somehow missed s5p-fimc --- sorry
> about that.

It's all right, no big deal. I'll make a patch to correct this.

-- 
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: [GIT PULL FOR v3.5] Implement V4L2_CID_PIXEL_RATE in various drivers

2012-05-14 Thread Mauro Carvalho Chehab
Sakari,

Em 14-05-2012 12:56, Sakari Ailus escreveu:
> Hi all,
> 
> Here are a few patches that implement V4L2_CID_PIXEL_RATE in a couple of
> drivers. The control is soon required by some CSI-2 receivers to configure
> the hardware, such as the OMAP 3 ISP one.

Before spreading this everywhere, let me understand a little bit better about
V4L2_CID_PIXEL_RATE and the other ioctl's that handle the image rate, as 
changing
one affects the other.

Regards,
Mauro
> 
> ---
> 
> The following changes since commit e89fca923f32de26b69bf4cd604f7b960b161551:
> 
>   [media] gspca - ov534: Add Hue control (2012-05-14 09:48:00 -0300)
> 
> are available in the git repository at:
>   ssh://linuxtv.org/git/sailus/media_tree.git media-for-3.5
> 
> Laurent Pinchart (3):
>   mt9t001: Implement V4L2_CID_PIXEL_RATE control
>   mt9p031: Implement V4L2_CID_PIXEL_RATE control
>   mt9m032: Implement V4L2_CID_PIXEL_RATE control
> 
>  drivers/media/video/mt9m032.c |   13 +++--
>  drivers/media/video/mt9p031.c |5 -
>  drivers/media/video/mt9t001.c |   13 +++--
>  include/media/mt9t001.h   |1 +
>  4 files changed, 27 insertions(+), 5 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: [GIT PULL FOR v3.5] Three small improvements

2012-05-14 Thread Hans Verkuil
On Mon May 14 2012 16:47:19 Laurent Pinchart wrote:
> Hi Hans,
> 
> On Monday 14 May 2012 16:37:23 Hans Verkuil wrote:
> > Hi Mauro, Laurent,
> > 
> > I hope that these three patches address the comments Laurent made.
> 
> Thank you. There's a typo in the first patch:
> 
> "Otherwise you give it a pointer to a struct mutex_lock and the unlocked_ioctl
> file operation is called this lock will be taken by the core and released
> afterwards. See the next section for more details."
> 
> I suppose it should read "... and *before* the unlocked_ioctl ...".

Indeed. Fixed in my git repository.

> The rest looks OK to me (you haven't renamed valid_ioctls to invalid_ioctls, 
> but I suppose that was on purpose).

Yes, that was on purpose. I am not planning to change that.

Regards,

Hans

> 
> > The only remaining item is to take the ioctl lock after copy_from user is
> > called. But that's for 3.6.
> > 
> > Regards,
> > 
> > Hans
> > 
> > The following changes since commit e89fca923f32de26b69bf4cd604f7b960b161551:
> > 
> >   [media] gspca - ov534: Add Hue control (2012-05-14 09:48:00 -0300)
> > 
> > are available in the git repository at:
> > 
> >   git://linuxtv.org/hverkuil/media_tree.git update
> > 
> > for you to fetch changes up to 308cb1f20bcaba72c8234794479cf8962c13032f:
> > 
> >   v4l2-dev: rename two functions. (2012-05-14 16:32:48 +0200)
> > 
> > 
> > Hans Verkuil (3):
> >   v4l2-framework.txt: update the core lock documentation.
> >   v4l2-dev.h: add comment not to use V4L2_FL_LOCK_ALL_FOPS in new
> > drivers. v4l2-dev: rename two functions.
> > 
> >  Documentation/video4linux/v4l2-framework.txt |   18 +-
> >  drivers/media/video/gspca/gspca.c|6 +++---
> >  drivers/media/video/pwc/pwc-if.c |6 +++---
> >  drivers/media/video/v4l2-dev.c   |2 +-
> >  include/media/v4l2-dev.h |   12 ++--
> >  sound/i2c/other/tea575x-tuner.c  |2 +-
> >  6 files changed, 23 insertions(+), 23 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


[GIT PULL FOR v3.5] Implement V4L2_CID_PIXEL_RATE in various drivers

2012-05-14 Thread Sakari Ailus
Hi all,

Here are a few patches that implement V4L2_CID_PIXEL_RATE in a couple of
drivers. The control is soon required by some CSI-2 receivers to configure
the hardware, such as the OMAP 3 ISP one.

---

The following changes since commit e89fca923f32de26b69bf4cd604f7b960b161551:

  [media] gspca - ov534: Add Hue control (2012-05-14 09:48:00 -0300)

are available in the git repository at:
  ssh://linuxtv.org/git/sailus/media_tree.git media-for-3.5

Laurent Pinchart (3):
  mt9t001: Implement V4L2_CID_PIXEL_RATE control
  mt9p031: Implement V4L2_CID_PIXEL_RATE control
  mt9m032: Implement V4L2_CID_PIXEL_RATE control

 drivers/media/video/mt9m032.c |   13 +++--
 drivers/media/video/mt9p031.c |5 -
 drivers/media/video/mt9t001.c |   13 +++--
 include/media/mt9t001.h   |1 +
 4 files changed, 27 insertions(+), 5 deletions(-)



-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi jabber/XMPP/Gmail: sai...@retiisi.org.uk
--
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 v5 18/35] v4l: Allow changing control handler lock

2012-05-14 Thread Sylwester Nawrocki
On 05/14/2012 05:27 PM, Sylwester Nawrocki wrote:
> Hi Sakari,
> 
> On 03/06/2012 05:32 PM, Sakari Ailus wrote:
>> Allow choosing the lock used by the control handler. This may be handy
>> sometimes when a driver providing multiple subdevs does not want to use
>> several locks to serialise its functions.
>>
>> Signed-off-by: Sakari Ailus 
>> ---
>>  drivers/media/video/adp1653.c|8 +++---
>>  drivers/media/video/v4l2-ctrls.c |   39 
>> +++--
>>  drivers/media/video/vivi.c   |4 +-
>>  include/media/v4l2-ctrls.h   |9 +--
>>  4 files changed, 32 insertions(+), 28 deletions(-)
> ...
>> diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
>> index 533315b..71abac0 100644
>> --- a/include/media/v4l2-ctrls.h
>> +++ b/include/media/v4l2-ctrls.h
>> @@ -168,7 +168,9 @@ struct v4l2_ctrl_ref {
>>  /** struct v4l2_ctrl_handler - The control handler keeps track of all the
>>* controls: both the controls owned by the handler and those inherited
>>* from other handlers.
>> +  * @_lock: Default for "lock".
>>* @lock:  Lock to control access to this handler and its controls.
>> +  * May be replaced by the user right after init.
>>* @ctrls: The list of controls owned by this handler.
>>* @ctrl_refs: The list of control references.
>>* @cached:The last found control reference. It is common that the 
>> same
>> @@ -179,7 +181,8 @@ struct v4l2_ctrl_ref {
>>* @error: The error code of the first failed control addition.
>>*/
>>  struct v4l2_ctrl_handler {
>> -struct mutex lock;
>> +struct mutex _lock;
>> +struct mutex *lock;
> 
> I think we have an issue here. All drivers that reference ctrl_handler.lock
> directly need to be updated, since the 'lock' member of struct 
> v4l2_ctrl_handler
> is now a pointer. So instead 
> 
> mutex_lock(&ctrl_handler.lock);
> 
> they should now do
> 
> mutex_lock(ctrl_handler.lock);
> 
> Or am I missing something ?
> 
> For example, I'm getting following error:
> 
> drivers/media/video/s5p-fimc/fimc-core.c: In function ‘fimc_ctrls_activate’:
> drivers/media/video/s5p-fimc/fimc-core.c:678: warning: passing argument 1 of 
> ‘mutex_lock’ from incompatible pointer type
> include/linux/mutex.h:152: note: expected ‘struct mutex *’ but argument is of 
> type ‘struct mutex **’
> drivers/media/video/s5p-fimc/fimc-core.c:697: warning: passing argument 1 of 
> ‘mutex_unlock’ from incompatible pointer type
> include/linux/mutex.h:169: note: expected ‘struct mutex *’ but argument is of 
> type ‘struct mutex **’
> 
> AFAICT only vivi and s5p-fimc drivers use the control handler lock 
> directly, so I can prepare a patch updating those drivers.

OK, vivi and adp1653 are already modified in this patch, so s5p-fimc
seems the only one left. I'll fix that.

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 v5 18/35] v4l: Allow changing control handler lock

2012-05-14 Thread Sakari Ailus

Hi Sylwester,

Sylwester Nawrocki wrote:

Hi Sakari,

On 03/06/2012 05:32 PM, Sakari Ailus wrote:

Allow choosing the lock used by the control handler. This may be handy
sometimes when a driver providing multiple subdevs does not want to use
several locks to serialise its functions.

Signed-off-by: Sakari Ailus
---
  drivers/media/video/adp1653.c|8 +++---
  drivers/media/video/v4l2-ctrls.c |   39 +++--
  drivers/media/video/vivi.c   |4 +-
  include/media/v4l2-ctrls.h   |9 +--
  4 files changed, 32 insertions(+), 28 deletions(-)

...

diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 533315b..71abac0 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -168,7 +168,9 @@ struct v4l2_ctrl_ref {
  /** struct v4l2_ctrl_handler - The control handler keeps track of all the
* controls: both the controls owned by the handler and those inherited
* from other handlers.
+  * @_lock:Default for "lock".
* @lock:Lock to control access to this handler and its controls.
+  *May be replaced by the user right after init.
* @ctrls:   The list of controls owned by this handler.
* @ctrl_refs:   The list of control references.
* @cached:  The last found control reference. It is common that the same
@@ -179,7 +181,8 @@ struct v4l2_ctrl_ref {
* @error:   The error code of the first failed control addition.
*/
  struct v4l2_ctrl_handler {
-   struct mutex lock;
+   struct mutex _lock;
+   struct mutex *lock;


I think we have an issue here. All drivers that reference ctrl_handler.lock
directly need to be updated, since the 'lock' member of struct v4l2_ctrl_handler
is no a pointer. So insted

mutex_lock(&ctrl_handler.lock);

they should now do

mutex_lock(ctrl_handler.lock);

Or am I missing something ?

For example, I'm getting following error:

drivers/media/video/s5p-fimc/fimc-core.c: In function ‘fimc_ctrls_activate’:
drivers/media/video/s5p-fimc/fimc-core.c:678: warning: passing argument 1 of 
‘mutex_lock’ from incompatible pointer type
include/linux/mutex.h:152: note: expected ‘struct mutex *’ but argument is of 
type ‘struct mutex **’
drivers/media/video/s5p-fimc/fimc-core.c:697: warning: passing argument 1 of 
‘mutex_unlock’ from incompatible pointer type
include/linux/mutex.h:169: note: expected ‘struct mutex *’ but argument is of 
type ‘struct mutex **’

AFAICT only vivi and s5p-fimc drivers use the control handler lock
directly, so I can prepare a patch updating those drivers.


Ooops. The patch included the changes for adp1653 and vivi which I found 
to be the only drivers using the lock directly. I somehow missed 
s5p-fimc --- sorry about that.


Regards,

--
Sakari Ailus
sakari.ai...@iki.fi
--
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 v5 18/35] v4l: Allow changing control handler lock

2012-05-14 Thread Sylwester Nawrocki
Hi Sakari,

On 03/06/2012 05:32 PM, Sakari Ailus wrote:
> Allow choosing the lock used by the control handler. This may be handy
> sometimes when a driver providing multiple subdevs does not want to use
> several locks to serialise its functions.
> 
> Signed-off-by: Sakari Ailus 
> ---
>  drivers/media/video/adp1653.c|8 +++---
>  drivers/media/video/v4l2-ctrls.c |   39 +++--
>  drivers/media/video/vivi.c   |4 +-
>  include/media/v4l2-ctrls.h   |9 +--
>  4 files changed, 32 insertions(+), 28 deletions(-)
...
> diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
> index 533315b..71abac0 100644
> --- a/include/media/v4l2-ctrls.h
> +++ b/include/media/v4l2-ctrls.h
> @@ -168,7 +168,9 @@ struct v4l2_ctrl_ref {
>  /** struct v4l2_ctrl_handler - The control handler keeps track of all the
>* controls: both the controls owned by the handler and those inherited
>* from other handlers.
> +  * @_lock:  Default for "lock".
>* @lock:   Lock to control access to this handler and its controls.
> +  *  May be replaced by the user right after init.
>* @ctrls:  The list of controls owned by this handler.
>* @ctrl_refs:  The list of control references.
>* @cached: The last found control reference. It is common that the same
> @@ -179,7 +181,8 @@ struct v4l2_ctrl_ref {
>* @error:  The error code of the first failed control addition.
>*/
>  struct v4l2_ctrl_handler {
> - struct mutex lock;
> + struct mutex _lock;
> + struct mutex *lock;

I think we have an issue here. All drivers that reference ctrl_handler.lock
directly need to be updated, since the 'lock' member of struct v4l2_ctrl_handler
is no a pointer. So insted 

mutex_lock(&ctrl_handler.lock);

they should now do

mutex_lock(ctrl_handler.lock);

Or am I missing something ?

For example, I'm getting following error:

drivers/media/video/s5p-fimc/fimc-core.c: In function ‘fimc_ctrls_activate’:
drivers/media/video/s5p-fimc/fimc-core.c:678: warning: passing argument 1 of 
‘mutex_lock’ from incompatible pointer type
include/linux/mutex.h:152: note: expected ‘struct mutex *’ but argument is of 
type ‘struct mutex **’
drivers/media/video/s5p-fimc/fimc-core.c:697: warning: passing argument 1 of 
‘mutex_unlock’ from incompatible pointer type
include/linux/mutex.h:169: note: expected ‘struct mutex *’ but argument is of 
type ‘struct mutex **’

AFAICT only vivi and s5p-fimc drivers use the control handler lock 
directly, so I can prepare a patch updating those drivers.

>   struct list_head ctrls;
>   struct list_head ctrl_refs;
>   struct v4l2_ctrl_ref *cached;
> @@ -456,7 +459,7 @@ void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
>*/
>  static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
>  {
> - mutex_lock(&ctrl->handler->lock);
> + mutex_lock(ctrl->handler->lock);
>  }
>  
>  /** v4l2_ctrl_lock() - Helper function to unlock the handler
> @@ -465,7 +468,7 @@ static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
>*/
>  static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl)
>  {
> - mutex_unlock(&ctrl->handler->lock);
> + mutex_unlock(ctrl->handler->lock);
>  }
>  
>  /** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from 
> within a driver.

--

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: [GIT PULL FOR v3.5] Three small improvements

2012-05-14 Thread Laurent Pinchart
Hi Hans,

On Monday 14 May 2012 16:37:23 Hans Verkuil wrote:
> Hi Mauro, Laurent,
> 
> I hope that these three patches address the comments Laurent made.

Thank you. There's a typo in the first patch:

"Otherwise you give it a pointer to a struct mutex_lock and the unlocked_ioctl
file operation is called this lock will be taken by the core and released
afterwards. See the next section for more details."

I suppose it should read "... and *before* the unlocked_ioctl ...".

The rest looks OK to me (you haven't renamed valid_ioctls to invalid_ioctls, 
but I suppose that was on purpose).

> The only remaining item is to take the ioctl lock after copy_from user is
> called. But that's for 3.6.
> 
> Regards,
> 
>   Hans
> 
> The following changes since commit e89fca923f32de26b69bf4cd604f7b960b161551:
> 
>   [media] gspca - ov534: Add Hue control (2012-05-14 09:48:00 -0300)
> 
> are available in the git repository at:
> 
>   git://linuxtv.org/hverkuil/media_tree.git update
> 
> for you to fetch changes up to 308cb1f20bcaba72c8234794479cf8962c13032f:
> 
>   v4l2-dev: rename two functions. (2012-05-14 16:32:48 +0200)
> 
> 
> Hans Verkuil (3):
>   v4l2-framework.txt: update the core lock documentation.
>   v4l2-dev.h: add comment not to use V4L2_FL_LOCK_ALL_FOPS in new
> drivers. v4l2-dev: rename two functions.
> 
>  Documentation/video4linux/v4l2-framework.txt |   18 +-
>  drivers/media/video/gspca/gspca.c|6 +++---
>  drivers/media/video/pwc/pwc-if.c |6 +++---
>  drivers/media/video/v4l2-dev.c   |2 +-
>  include/media/v4l2-dev.h |   12 ++--
>  sound/i2c/other/tea575x-tuner.c  |2 +-
>  6 files changed, 23 insertions(+), 23 deletions(-)

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


[GIT PULL FOR v3.5] Three small improvements

2012-05-14 Thread Hans Verkuil
Hi Mauro, Laurent,

I hope that these three patches address the comments Laurent made.

The only remaining item is to take the ioctl lock after copy_from user is
called. But that's for 3.6.

Regards,

Hans

The following changes since commit e89fca923f32de26b69bf4cd604f7b960b161551:

  [media] gspca - ov534: Add Hue control (2012-05-14 09:48:00 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git update

for you to fetch changes up to 308cb1f20bcaba72c8234794479cf8962c13032f:

  v4l2-dev: rename two functions. (2012-05-14 16:32:48 +0200)


Hans Verkuil (3):
  v4l2-framework.txt: update the core lock documentation.
  v4l2-dev.h: add comment not to use V4L2_FL_LOCK_ALL_FOPS in new drivers.
  v4l2-dev: rename two functions.

 Documentation/video4linux/v4l2-framework.txt |   18 +-
 drivers/media/video/gspca/gspca.c|6 +++---
 drivers/media/video/pwc/pwc-if.c |6 +++---
 drivers/media/video/v4l2-dev.c   |2 +-
 include/media/v4l2-dev.h |   12 ++--
 sound/i2c/other/tea575x-tuner.c  |2 +-
 6 files changed, 23 insertions(+), 23 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: [RFCv1 PATCH 5/5] v4l2-dev: add flag to have the core lock all file operations.

2012-05-14 Thread Laurent Pinchart
Hi Hans,

On Monday 14 May 2012 15:42:37 Hans Verkuil wrote:
> On Mon May 14 2012 14:31:32 Laurent Pinchart wrote:
> > On Thursday 10 May 2012 09:05:14 Hans Verkuil wrote:
> > > From: Hans Verkuil 
> > > 
> > > This used to be the default if the lock pointer was set, but now that
> > > lock is by default only used for ioctl serialization.
> > 
> > Shouldn't that be documented ?
> > Documentation/video4linux/v4l2-framework.txt
> > still states that the lock is taken for each file operation.
> 
> I'd have sworn I'd done that, but obviously my memory is playing tricks on
> me.
> 
> Will fix.

Thanks.

> > > Those drivers that already used core locking have this flag set
> > > explicitly, except for some drivers where it was obvious that there was
> > > no need to serialize any file operations other than ioctl.
> > > 
> > > The drivers that didn't need this flag were:
> > > 
> > > drivers/media/radio/dsbr100.c
> > > drivers/media/radio/radio-isa.c
> > > drivers/media/radio/radio-keene.c
> > > drivers/media/radio/radio-miropcm20.c
> > > drivers/media/radio/radio-mr800.c
> > > drivers/media/radio/radio-tea5764.c
> > > drivers/media/radio/radio-timb.c
> > > drivers/media/video/vivi.c
> > > sound/i2c/other/tea575x-tuner.c
> > 
> > Be careful that drivers for hot-pluggable devices can use the core lock to
> > serialize open/disconnect. The dsbr100 driver takes the core lock in its
> > disconnect handler for instance. Have you double-checked that no race
> > condition exists in those cases ?
> 
> Yes. This drivers use core helper functions for open/release/poll where we
> know that there is no race condition.
> 
> > > The other drivers that use core locking and where it was not immediately
> > > obvious that this flag wasn't needed were changed so that the flag is
> > > set together with a comment that that driver needs work to avoid having
> > > to set that flag. This will often involve taking the core lock in the
> > > fops themselves.
> > 
> > Or not using the core lock :-)
> > 
> > > Eventually this flag should go and it should not be used in new drivers.
> > 
> > Could you please add a comment above the flag to state that new drivers
> > must not use it ?
> 
> Good one. Will do.
> 
> > > There are a few reasons why we want to avoid core locking of non-ioctl
> > > fops: in the case of mmap this can lead to a deadlock in rare situations
> > > since when mmap is called the mmap_sem is held and it is possible for
> > > other parts of the code to take that lock as well
> > > (copy_from_user()/copy_to_user() perform a down_read(&mm->mmap_sem) when
> > > a page fault occurs).
> > 
> > This patch won't solve the problem. We have (at least) two AB-BA deadlock
> > issues with the mm->mmap_sem. Both of them share the fact that the mmap()
> > handler is called with mm->mmap_sem held and will then take a
> > device-related lock (could be a global driver lock, a device-wide lock or
> > a queue-specific lock). I don't think we can do anything about that.
> > 
> > The first problem was solved some time ago. VIDIOC_QBUF is called with the
> > same device-related lock held and then needs to take mm->mmap_sem. We
> > solved that be calling the queue wait_prepare() and wait_finish() around
> > down(&mm-> 
> > >mmap_sem) and up(&mm->mmap_sem). Maybe not ideal, but that seems to work.
> > 
> > The second problem comes from the copy_from_user()/copy_to_user() code in
> > video_usercopy(). That function is called by video_ioctl2() which is
> > itself called with the device lock held. Copying from/to user can fault if
> > the userspace memory has been paged out, in which case the fault handler
> > needs to take mm->mmap_sem to solve the fault. This can deadlock with
> > mmap().
> > 
> > To solve the second issue we must delay taking the device lock until after
> > copying from user, as we can't forbid the mmap() handler from taking the
> > device lock (that would introduce race conditions). I think that can be
> > done by pushing the device lock into __video_do_ioctl.
> 
> Good idea, but for 3.6. This will be a nice one to combine with my
> v4l2-ioctl.c reorganization.

I'm fine with 3.6, but then I'd appreciate if you could reword your commit 
message. It gives the false impression that this commit solves the issue.

-- 
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: [RFCv1 PATCH 2/5] v4l2-dev/ioctl: determine the valid ioctls upfront.

2012-05-14 Thread Laurent Pinchart
Hi Hans,

On Monday 14 May 2012 15:51:27 Hans Verkuil wrote:
> On Mon May 14 2012 15:00:05 Laurent Pinchart wrote:
> > On Thursday 10 May 2012 09:05:11 Hans Verkuil wrote:
> > > From: Hans Verkuil 
> > > 
> > > Rather than testing whether an ioctl is implemented in the driver or not
> > > every time the ioctl is called, do it upfront when the device is
> > > registered.
> > > 
> > > This also allows a driver to disable certain ioctls based on the
> > > capabilities of the detected board, something you can't do today without
> > > creating separate v4l2_ioctl_ops structs for each new variation.
> > > 
> > > For the most part it is pretty straightforward, but for control ioctls a
> > > flag is needed since it is possible that you have per-filehandle
> > > controls, and that can't be determined upfront of course.
> > > 
> > > Signed-off-by: Hans Verkuil 
> > > ---
> > > 
> > >  drivers/media/video/v4l2-dev.c   |  171 +
> > >  drivers/media/video/v4l2-ioctl.c |  391
> > >  ++-
> > >  include/media/v4l2-dev.h |   11 ++
> > >  3 files changed, 297 insertions(+), 276 deletions(-)
> > > 
> > > diff --git a/drivers/media/video/v4l2-dev.c
> > > b/drivers/media/video/v4l2-dev.c index a51a061..4d98ee1 100644
> > > --- a/drivers/media/video/v4l2-dev.c
> > > +++ b/drivers/media/video/v4l2-dev.c
> > > @@ -516,6 +516,175 @@ static int get_index(struct video_device *vdev)
> > > 
> > >   return find_first_zero_bit(used, VIDEO_NUM_DEVICES);
> > >  
> > >  }
> > > 
> > > +#define SET_VALID_IOCTL(ops, cmd, op)\
> > > + if (ops->op)\
> > > + set_bit(_IOC_NR(cmd), valid_ioctls)
> > > +
> > > +/* This determines which ioctls are actually implemented in the driver.
> > > +   It's a one-time thing which simplifies video_ioctl2 as it can just
> > > do
> > > +   a bit test.
> > > +
> > > +   Note that drivers can override this by setting bits to 1 in
> > > +   vdev->valid_ioctls. If an ioctl is marked as 1 when this function is
> > > +   called, then that ioctl will actually be marked as unimplemented.
> > > +
> > > +   It does that by first setting up the local valid_ioctls bitmap, and
> > > +   at the end do a:
> > > +
> > > +   vdev->valid_ioctls = valid_ioctls & ~(vdev->valid_ioctls)
> > 
> > Wouldn't it be more logical to initialize valid_ioctls to all 1s and clear
> > bits in v4l2_dont_use_cmd() ? Otherwise the meaning of the field changes
> > depending on whether the device is registered or not.
> 
> The reason is that drivers initialize struct video_device to 0. There is
> also no initialization function that can set it to all 1. So then you would
> have to modify all drivers, and that's way overkill.
> 
> If you have a better suggestion, then I'm all ears!

Right, that's a problem. One possible solution would be to rename valid_ioctls 
to invalid_ioctls (and obviously update the code accordingly).

> > Another bikeshedding comment, what about renaming v4l2_dont_use_cmd() with
> > something that includes ioctl in the name ?
> > 
> > - v4l2_dont_use_ioctl
> > - v4l2_dont_use_ioctl_cmd
> > - v4l2_ioctl_cmd_not_used
> > - v4l2_ioctl_dont_use
> > - v4l2_ioctl_dont_use_cmd
> > - v4l2_disable_ioctl
> > - v4l2_disable_ioctl_cmd
> 
> How about:
> 
> v4l2_is_known_ioctl -> v4l2_is_known_ioctl_cmd
> v4l2_dont_use_lock -> v4l2_disable_ioctl_cmd_locking
> v4l2_dont_use_cmd -> v4l2_disable_ioctl_cmd
> 
> or:
> 
> v4l2_ioctl_cmd_is_known
> v4l2_ioctl_cmd_disable_locking
> v4l2_ioctl_cmd_disable
> 
> The last set looks better but sounds worse :-)

I have no strong preference, the format sounds a little bit better to me. I 
would probably have dropped cmd, but that's up to you.

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


[PATCH 1/2] [media] ati_remote: add keymap for Medion X10 OR2x remotes

2012-05-14 Thread Anssi Hannula
Add another Medion X10 remote keymap. This is for the Medion OR2x
remotes with the Windows MCE button.

The receiver shipped with this remote has the same USB ID as the other
Medion receivers, but the name is different and is therefore used to
detect this variant.

Signed-off-by: Anssi Hannula 
---
 drivers/media/rc/ati_remote.c |   30 ++-
 drivers/media/rc/keymaps/Makefile |1 +
 drivers/media/rc/keymaps/rc-medion-x10-or2x.c |  108 +
 include/media/rc-map.h|1 +
 4 files changed, 136 insertions(+), 4 deletions(-)
 create mode 100644 drivers/media/rc/keymaps/rc-medion-x10-or2x.c

diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c
index 26fa043..2c70352 100644
--- a/drivers/media/rc/ati_remote.c
+++ b/drivers/media/rc/ati_remote.c
@@ -161,11 +161,33 @@ static const char *get_medion_keymap(struct usb_interface 
*interface)
 {
struct usb_device *udev = interface_to_usbdev(interface);
 
-   /* The receiver shipped with the "Digitainer" variant helpfully has
-* a single additional bit set in its descriptor. */
-   if (udev->actconfig->desc.bmAttributes & USB_CONFIG_ATT_WAKEUP)
-   return RC_MAP_MEDION_X10_DIGITAINER;
+   /*
+* There are many different Medion remotes shipped with a receiver
+* with the same usb id, but the receivers have subtle differences
+* in the USB descriptors allowing us to detect them.
+*/
+
+   if (udev->manufacturer && udev->product) {
+   if (udev->actconfig->desc.bmAttributes & USB_CONFIG_ATT_WAKEUP) 
{
+
+   if (!strcmp(udev->manufacturer, "X10 Wireless 
Technology Inc")
+   && !strcmp(udev->product, "USB Receiver"))
+   return RC_MAP_MEDION_X10_DIGITAINER;
+
+   if (!strcmp(udev->manufacturer, "X10 WTI")
+   && !strcmp(udev->product, "RF receiver"))
+   return RC_MAP_MEDION_X10_OR2X;
+   } else {
+
+if (!strcmp(udev->manufacturer, "X10 Wireless 
Technology Inc")
+   && !strcmp(udev->product, "USB Receiver"))
+   return RC_MAP_MEDION_X10;
+   }
+   }
 
+   dev_info(&interface->dev,
+"Unknown Medion X10 receiver, using default ati_remote Medion 
keymap\n");
+   
return RC_MAP_MEDION_X10;
 }
 
diff --git a/drivers/media/rc/keymaps/Makefile 
b/drivers/media/rc/keymaps/Makefile
index c1d977c..975e130 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -50,6 +50,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-manli.o \
rc-medion-x10.o \
rc-medion-x10-digitainer.o \
+   rc-medion-x10-or2x.o \
rc-msi-digivox-ii.o \
rc-msi-digivox-iii.o \
rc-msi-tvanywhere.o \
diff --git a/drivers/media/rc/keymaps/rc-medion-x10-or2x.c 
b/drivers/media/rc/keymaps/rc-medion-x10-or2x.c
new file mode 100644
index 000..b077300
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-medion-x10-or2x.c
@@ -0,0 +1,108 @@
+/*
+ * Medion X10 OR22/OR24 RF remote keytable
+ *
+ * Copyright (C) 2012 Anssi Hannula 
+ *
+ * This keymap is for several Medion X10 remotes that have the Windows MCE
+ * button. This has been tested with a "RF VISTA Remote Control", OR24V,
+ * P/N 20035335, but should work with other variants that have the same
+ * buttons, such as OR22V and OR24E.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include 
+#include 
+
+static struct rc_map_table medion_x10_or2x[] = {
+   { 0x02, KEY_POWER },
+   { 0x16, KEY_TEXT },   /* "T" in a box, for teletext */
+
+   { 0x09, KEY_VOLUMEUP },
+   { 0x08, KEY_VOLUMEDOWN },
+   { 0x00, KEY_MUTE },
+   { 0x0b, KEY_CHANNELUP },
+   { 0x0c, KEY_CHANNELDOWN },
+
+   { 0x32, KEY_RED },
+   { 0x33, KEY_GREEN },
+   { 0x34, KEY_YELLOW },
+   { 0x35, KEY_BLUE },
+
+   { 0x18, KEY_PVR },/* record symbol inside a tv symbol */
+   { 0x04, KEY_DVD },/* disc symbo

[PATCH 2/2] [media] ati_remote: add regular up/down buttons to Medion Digitainer keymap

2012-05-14 Thread Anssi Hannula
There are many different Medion X10 remotes that need slightly different
keymaps. We may not yet have all the needed keymaps, in which case a
wrong keymap may be used. This happened with Medion X10 OR2x remotes
before the keymap for them was added, causing the ati_remote driver to
select the Medion Digitainer keymap instead. Unfortunately, the Medion
Digitainer keymap doesn't have the standard X10 up/down scancodes
assigned to KEY_UP and KEY_DOWN keycodes, making wrongly assigned
remotes mostly unusable.

Add the regular KEY_UP and KEY_DOWN scancodes to the Medion X10
Digitainer keymap, making any Medion remote mostly usable even when
wrongly used with that keymap (standard buttons, such as
up/down/left/right, 0-9, play/stop/pause, have the same scancode in all
the X10 remotes).

Signed-off-by: Anssi Hannula 
---
 drivers/media/rc/keymaps/rc-medion-x10-digitainer.c |8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/media/rc/keymaps/rc-medion-x10-digitainer.c 
b/drivers/media/rc/keymaps/rc-medion-x10-digitainer.c
index 0a5ce84..966f9b3 100644
--- a/drivers/media/rc/keymaps/rc-medion-x10-digitainer.c
+++ b/drivers/media/rc/keymaps/rc-medion-x10-digitainer.c
@@ -86,6 +86,14 @@ static struct rc_map_table medion_x10_digitainer[] = {
{ 0x14, KEY_8 },
{ 0x15, KEY_9 },
{ 0x17, KEY_0 },
+
+   /* these do not actually exist on this remote, but these scancodes
+* exist on all other Medion X10 remotes and adding them here allows
+* such remotes to be adequately usable with this keymap in case
+* this keymap is wrongly used with them (which is quite possible as
+* there are lots of different Medion X10 remotes): */
+   { 0x1a, KEY_UP },
+   { 0x22, KEY_DOWN },
 };
 
 static struct rc_map_list medion_x10_digitainer_map = {
-- 
1.7.10

--
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: [RFCv1 PATCH 2/5] v4l2-dev/ioctl: determine the valid ioctls upfront.

2012-05-14 Thread Hans Verkuil
On Mon May 14 2012 15:00:05 Laurent Pinchart wrote:
> Hi Hans,
> 
> Thanks for the patch.
> 
> On Thursday 10 May 2012 09:05:11 Hans Verkuil wrote:
> > From: Hans Verkuil 
> > 
> > Rather than testing whether an ioctl is implemented in the driver or not
> > every time the ioctl is called, do it upfront when the device is registered.
> > 
> > This also allows a driver to disable certain ioctls based on the
> > capabilities of the detected board, something you can't do today without
> > creating separate v4l2_ioctl_ops structs for each new variation.
> > 
> > For the most part it is pretty straightforward, but for control ioctls a
> > flag is needed since it is possible that you have per-filehandle controls,
> > and that can't be determined upfront of course.
> > 
> > Signed-off-by: Hans Verkuil 
> > ---
> >  drivers/media/video/v4l2-dev.c   |  171 +
> >  drivers/media/video/v4l2-ioctl.c |  391 ++-
> >  include/media/v4l2-dev.h |   11 ++
> >  3 files changed, 297 insertions(+), 276 deletions(-)
> > 
> > diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
> > index a51a061..4d98ee1 100644
> > --- a/drivers/media/video/v4l2-dev.c
> > +++ b/drivers/media/video/v4l2-dev.c
> > @@ -516,6 +516,175 @@ static int get_index(struct video_device *vdev)
> > return find_first_zero_bit(used, VIDEO_NUM_DEVICES);
> >  }
> > 
> > +#define SET_VALID_IOCTL(ops, cmd, op)  \
> > +   if (ops->op)\
> > +   set_bit(_IOC_NR(cmd), valid_ioctls)
> > +
> > +/* This determines which ioctls are actually implemented in the driver.
> > +   It's a one-time thing which simplifies video_ioctl2 as it can just do
> > +   a bit test.
> > +
> > +   Note that drivers can override this by setting bits to 1 in
> > +   vdev->valid_ioctls. If an ioctl is marked as 1 when this function is
> > +   called, then that ioctl will actually be marked as unimplemented.
> > +
> > +   It does that by first setting up the local valid_ioctls bitmap, and
> > +   at the end do a:
> > +
> > +   vdev->valid_ioctls = valid_ioctls & ~(vdev->valid_ioctls)
> 
> Wouldn't it be more logical to initialize valid_ioctls to all 1s and clear 
> bits in v4l2_dont_use_cmd() ? Otherwise the meaning of the field changes 
> depending on whether the device is registered or not.

The reason is that drivers initialize struct video_device to 0. There is also
no initialization function that can set it to all 1. So then you would have to
modify all drivers, and that's way overkill.

If you have a better suggestion, then I'm all ears!

> 
> Another bikeshedding comment, what about renaming v4l2_dont_use_cmd() with 
> something that includes ioctl in the name ?
> 
> - v4l2_dont_use_ioctl
> - v4l2_dont_use_ioctl_cmd
> - v4l2_ioctl_cmd_not_used
> - v4l2_ioctl_dont_use
> - v4l2_ioctl_dont_use_cmd
> - v4l2_disable_ioctl
> - v4l2_disable_ioctl_cmd

How about:

v4l2_is_known_ioctl -> v4l2_is_known_ioctl_cmd
v4l2_dont_use_lock -> v4l2_disable_ioctl_cmd_locking
v4l2_dont_use_cmd -> v4l2_disable_ioctl_cmd

or:

v4l2_ioctl_cmd_is_known
v4l2_ioctl_cmd_disable_locking
v4l2_ioctl_cmd_disable

The last set looks better but sounds worse :-)

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: [RFCv1 PATCH 5/5] v4l2-dev: add flag to have the core lock all file operations.

2012-05-14 Thread Hans Verkuil
Hi Laurent,

Thanks for the review!

On Mon May 14 2012 14:31:32 Laurent Pinchart wrote:
> Hi Hans,
> 
> Thanks for the patch.
> 
> On Thursday 10 May 2012 09:05:14 Hans Verkuil wrote:
> > From: Hans Verkuil 
> > 
> > This used to be the default if the lock pointer was set, but now that lock
> > is by default only used for ioctl serialization.
> 
> Shouldn't that be documented ? Documentation/video4linux/v4l2-framework.txt 
> still states that the lock is taken for each file operation.

I'd have sworn I'd done that, but obviously my memory is playing tricks on me.

Will fix.

> > Those drivers that already used core locking have this flag set explicitly,
> > except for some drivers where it was obvious that there was no need to
> > serialize any file operations other than ioctl.
> > 
> > The drivers that didn't need this flag were:
> > 
> > drivers/media/radio/dsbr100.c
> > drivers/media/radio/radio-isa.c
> > drivers/media/radio/radio-keene.c
> > drivers/media/radio/radio-miropcm20.c
> > drivers/media/radio/radio-mr800.c
> > drivers/media/radio/radio-tea5764.c
> > drivers/media/radio/radio-timb.c
> > drivers/media/video/vivi.c
> > sound/i2c/other/tea575x-tuner.c
> 
> Be careful that drivers for hot-pluggable devices can use the core lock to 
> serialize open/disconnect. The dsbr100 driver takes the core lock in its 
> disconnect handler for instance. Have you double-checked that no race 
> condition exists in those cases ?

Yes. This drivers use core helper functions for open/release/poll where we
know that there is no race condition.

> 
> > The other drivers that use core locking and where it was not immediately
> > obvious that this flag wasn't needed were changed so that the flag is set
> > together with a comment that that driver needs work to avoid having to
> > set that flag. This will often involve taking the core lock in the fops
> > themselves.
> 
> Or not using the core lock :-)
> 
> > Eventually this flag should go and it should not be used in new drivers.
> 
> Could you please add a comment above the flag to state that new drivers must 
> not use it ?

Good one. Will do.

> > There are a few reasons why we want to avoid core locking of non-ioctl
> > fops: in the case of mmap this can lead to a deadlock in rare situations
> > since when mmap is called the mmap_sem is held and it is possible for
> > other parts of the code to take that lock as well
> > (copy_from_user()/copy_to_user() perform a down_read(&mm->mmap_sem) when a
> > page fault occurs).
> 
> This patch won't solve the problem. We have (at least) two AB-BA deadlock 
> issues with the mm->mmap_sem. Both of them share the fact that the mmap() 
> handler is called with mm->mmap_sem held and will then take a device-related 
> lock (could be a global driver lock, a device-wide lock or a queue-specific 
> lock). I don't think we can do anything about that.
> 
> The first problem was solved some time ago. VIDIOC_QBUF is called with the 
> same device-related lock held and then needs to take mm->mmap_sem. We solved 
> that be calling the queue wait_prepare() and wait_finish() around down(&mm-
> >mmap_sem) and up(&mm->mmap_sem). Maybe not ideal, but that seems to work.
> 
> The second problem comes from the copy_from_user()/copy_to_user() code in 
> video_usercopy(). That function is called by video_ioctl2() which is itself 
> called with the device lock held. Copying from/to user can fault if the 
> userspace memory has been paged out, in which case the fault handler needs to 
> take mm->mmap_sem to solve the fault. This can deadlock with mmap().
> 
> To solve the second issue we must delay taking the device lock until after 
> copying from user, as we can't forbid the mmap() handler from taking the 
> device lock (that would introduce race conditions). I think that can be done 
> by pushing the device lock into __video_do_ioctl.

Good idea, but for 3.6. This will be a nice one to combine with my v4l2-ioctl.c
reorganization.

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


[GIT PULL FOR v3.5] Fix compiler warnings

2012-05-14 Thread Hans Verkuil
Hi Mauro,

Here is the rebased version incorporating your remarks.
Instead of commenting out variables I now put them under #if 0 together with
the relevant piece of 'TODO' code.

Regards,

Hans

The following changes since commit e89fca923f32de26b69bf4cd604f7b960b161551:

  [media] gspca - ov534: Add Hue control (2012-05-14 09:48:00 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git warnings

for you to fetch changes up to d15edd383368cdd20ad142b1179282385303b56b:

  v4l/dvb: fix compiler warnings. (2012-05-14 15:22:58 +0200)


Hans Verkuil (8):
  dw2102: fix compile warnings
  cx231xx: fix compiler warnings
  ivtv/cx18: fix compiler warnings
  cx25821: fix compiler warnings.
  v4l: fix compiler warnings.
  v4l: fix compiler warnings.
  v4l/dvb: fix compiler warnings
  v4l/dvb: fix compiler warnings.

 drivers/media/dvb/bt8xx/dst_ca.c |2 --
 drivers/media/dvb/dvb-usb/dw2102.c   |   76 
++
 drivers/media/dvb/dvb-usb/lmedm04.c  |3 +-
 drivers/media/dvb/frontends/af9013.c |   13 
 drivers/media/dvb/frontends/cx24110.c|7 ++---
 drivers/media/dvb/frontends/dib9000.c|3 +-
 drivers/media/dvb/frontends/drxk_hard.c  |   14 ++---
 drivers/media/dvb/frontends/it913x-fe.c  |   26 

 drivers/media/dvb/frontends/lgs8gxx.c|3 +-
 drivers/media/dvb/frontends/m88rs2000.c  |3 +-
 drivers/media/dvb/frontends/stb0899_drv.c|8 +
 drivers/media/dvb/frontends/stb6100.c|3 +-
 drivers/media/dvb/frontends/stv0297.c|2 --
 drivers/media/dvb/frontends/stv0900_sw.c |2 --
 drivers/media/dvb/frontends/stv090x.c|2 --
 drivers/media/dvb/frontends/zl10353.c|3 +-
 drivers/media/dvb/mantis/hopper_cards.c  |3 +-
 drivers/media/dvb/mantis/mantis_cards.c  |3 +-
 drivers/media/dvb/mantis/mantis_dma.c|4 ---
 drivers/media/dvb/mantis/mantis_evm.c|3 +-
 drivers/media/dvb/siano/smssdio.c|4 +--
 drivers/media/rc/ir-sanyo-decoder.c  |4 +--
 drivers/media/rc/mceusb.c|3 +-
 drivers/media/video/adv7343.c|4 +--
 drivers/media/video/au0828/au0828-video.c|4 +--
 drivers/media/video/c-qcam.c |3 +-
 drivers/media/video/cx18/cx18-alsa-main.c|1 +
 drivers/media/video/cx18/cx18-alsa-pcm.c |   10 ++-
 drivers/media/video/cx18/cx18-mailbox.c  |6 +---
 drivers/media/video/cx18/cx18-streams.c  |3 --
 drivers/media/video/cx231xx/cx231xx-417.c|   18 ++-
 drivers/media/video/cx231xx/cx231xx-audio.c  |   18 ++-
 drivers/media/video/cx231xx/cx231xx-avcore.c |  144 

 drivers/media/video/cx231xx/cx231xx-core.c   |   76 
++
 drivers/media/video/cx231xx/cx231xx-vbi.c|6 +---
 drivers/media/video/cx231xx/cx231xx-video.c  |   16 --
 drivers/media/video/cx23885/cx23888-ir.c |4 +--
 drivers/media/video/cx25821/cx25821-alsa.c   |2 --
 drivers/media/video/cx25821/cx25821-audio-upstream.c |3 +-
 drivers/media/video/cx25821/cx25821-core.c   |   14 ++---
 drivers/media/video/cx25821/cx25821-i2c.c|3 +-
 drivers/media/video/cx25821/cx25821-medusa-video.c   |   13 
 drivers/media/video/cx25821/cx25821-video-upstream-ch2.c |3 +-
 drivers/media/video/cx25821/cx25821-video-upstream.c |3 +-
 drivers/media/video/cx25821/cx25821-video.c  |   25 
++--
 drivers/media/video/cx25821/cx25821-video.h  |2 --
 drivers/media/video/cx25840/cx25840-ir.c |6 +---
 drivers/media/video/em28xx/em28xx-audio.c|   11 ---
 drivers/media/video/hdpvr/hdpvr-control.c|2 ++
 drivers/media/video/hdpvr/hdpvr-video.c  |2 +-
 drivers/media/video/ivtv/ivtv-ioctl.c|3 --
 drivers/media/video/ivtv/ivtvfb.c|2 ++
 drivers/media/video/pms.c|4 +--
 drivers/media/video/s2255drv.c   |4 ---
 drivers/media/video/saa7134/saa7134-video.c  |2 +-
 drivers/me

[GIT PULL FOR v3.5] saa7146 clean ups/fixes

2012-05-14 Thread Hans Verkuil
Hi Mauro,

Since this is your last day of merges I'd thought I'd put this in your queue
as well.

This patch series cleans up saa7146, mxb, hexium-orion, hexium-gemini and
av7110. These drivers now all pass the v4l2-compliance tests.

I've tested with all of these cards, the only driver I was unable to test is the
budget driver as I don't have hardware for it.

All changes only apply to the V4L2 side of these drivers.

Two patches relate to vivi: I've extended the number of supported pixelformats.
This makes it easier to test the various variants.

Regards,

Hans

The following changes since commit e89fca923f32de26b69bf4cd604f7b960b161551:

  [media] gspca - ov534: Add Hue control (2012-05-14 09:48:00 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git saa7146

for you to fetch changes up to 34893ef0d80aa888e1bb93efdde1d3e615bf53d6:

  av7110: fix v4l2_compliance test issues. (2012-05-14 14:58:05 +0200)


Hans Verkuil (19):
  mxb/saa7146: first round of cleanups.
  mxb: fix initial audio + ntsc/secam support.
  mxb: fix audio handling.
  mxb: simplify a line that was too long.
  tda9840: fix setting of the audio mode.
  mxb: fix audio and standard handling.
  saa7146: move overlay information from saa7146_fh into saa7146_vv
  saa7146: move video_fmt from saa7146_fh to saa7146_vv.
  saa7146: move vbi fields from saa7146_fh to saa7146_vv
  saa7146: remove the unneeded type field from saa7146_fh
  saa7146: rename vbi/video_q to vbi/video_dmaq.
  saa7146: support control events and priority handling.
  saa7146: fix querycap, vbi/video separation and g/s_register
  fixes and add querystd support to mxb.
  hexium-gemini: remove B&W control, fix input table.
  hexium-orion: fix incorrect input table.
  vivi: add more pixelformats.
  vivi: add the alpha component control.
  av7110: fix v4l2_compliance test issues.

 drivers/media/common/saa7146_fops.c  |  122 
+---
 drivers/media/common/saa7146_hlp.c   |   23 +++
 drivers/media/common/saa7146_vbi.c   |   54 ++--
 drivers/media/common/saa7146_video.c |  367 
+++-
 drivers/media/dvb/ttpci/av7110_v4l.c |   72 +++--
 drivers/media/dvb/ttpci/budget-av.c  |6 +-
 drivers/media/video/hexium_gemini.c  |  129 
--
 drivers/media/video/hexium_orion.c   |   24 +++
 drivers/media/video/mxb.c|  351 
---
 drivers/media/video/mxb.h|   42 -
 drivers/media/video/tda9840.c|   75 --
 drivers/media/video/vivi.c   |  188 
---
 include/media/saa7146.h  |4 +-
 include/media/saa7146_vv.h   |   25 
 14 files changed, 736 insertions(+), 746 deletions(-)
 delete mode 100644 drivers/media/video/mxb.h
--
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: [GIT PULL FOR 3.5] s5p-fimc driver updates

2012-05-14 Thread Mauro Carvalho Chehab
Em 14-05-2012 10:04, Mauro Carvalho Chehab escreveu:
> Em 04-05-2012 12:31, Sylwester Nawrocki escreveu:
>> Hi Mauro,
>>
>> The following changes since commit 34b2debaa62bfa384ef91b61cf2c40c48e86a5e2:
>>
>>   s5p-fimc: Correct memory allocation for VIDIOC_CREATE_BUFS (2012-05-04 
>> 17:07:24 +0200)
>>
>> are available in the git repository at:
>>
>>   git://git.infradead.org/users/kmpark/linux-samsung v4l-fimc-exynos4x12
> 
> It seems that there are something wrong with this tree:
> 
> git pull git://git.infradead.org/users/kmpark/linux-samsung 
> v4l-fimc-exynos4x12
> warning: no common commits
> Counting objects: 1793460   

Please discard this comment. I was at the wrong directory.

Regards,
Mauro
> 
> Regards,
> Mauro

--
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: [GIT PULL FOR 3.5] s5p-fimc driver updates

2012-05-14 Thread Mauro Carvalho Chehab
Em 04-05-2012 12:31, Sylwester Nawrocki escreveu:
> Hi Mauro,
> 
> The following changes since commit 34b2debaa62bfa384ef91b61cf2c40c48e86a5e2:
> 
>   s5p-fimc: Correct memory allocation for VIDIOC_CREATE_BUFS (2012-05-04 
> 17:07:24 +0200)
> 
> are available in the git repository at:
> 
>   git://git.infradead.org/users/kmpark/linux-samsung v4l-fimc-exynos4x12

It seems that there are something wrong with this tree:

git pull git://git.infradead.org/users/kmpark/linux-samsung v4l-fimc-exynos4x12
warning: no common commits
Counting objects: 1793460   

Regards,
Mauro
--
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: [RFCv1 PATCH 2/5] v4l2-dev/ioctl: determine the valid ioctls upfront.

2012-05-14 Thread Laurent Pinchart
Hi Hans,

Thanks for the patch.

On Thursday 10 May 2012 09:05:11 Hans Verkuil wrote:
> From: Hans Verkuil 
> 
> Rather than testing whether an ioctl is implemented in the driver or not
> every time the ioctl is called, do it upfront when the device is registered.
> 
> This also allows a driver to disable certain ioctls based on the
> capabilities of the detected board, something you can't do today without
> creating separate v4l2_ioctl_ops structs for each new variation.
> 
> For the most part it is pretty straightforward, but for control ioctls a
> flag is needed since it is possible that you have per-filehandle controls,
> and that can't be determined upfront of course.
> 
> Signed-off-by: Hans Verkuil 
> ---
>  drivers/media/video/v4l2-dev.c   |  171 +
>  drivers/media/video/v4l2-ioctl.c |  391 ++-
>  include/media/v4l2-dev.h |   11 ++
>  3 files changed, 297 insertions(+), 276 deletions(-)
> 
> diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
> index a51a061..4d98ee1 100644
> --- a/drivers/media/video/v4l2-dev.c
> +++ b/drivers/media/video/v4l2-dev.c
> @@ -516,6 +516,175 @@ static int get_index(struct video_device *vdev)
>   return find_first_zero_bit(used, VIDEO_NUM_DEVICES);
>  }
> 
> +#define SET_VALID_IOCTL(ops, cmd, op)\
> + if (ops->op)\
> + set_bit(_IOC_NR(cmd), valid_ioctls)
> +
> +/* This determines which ioctls are actually implemented in the driver.
> +   It's a one-time thing which simplifies video_ioctl2 as it can just do
> +   a bit test.
> +
> +   Note that drivers can override this by setting bits to 1 in
> +   vdev->valid_ioctls. If an ioctl is marked as 1 when this function is
> +   called, then that ioctl will actually be marked as unimplemented.
> +
> +   It does that by first setting up the local valid_ioctls bitmap, and
> +   at the end do a:
> +
> +   vdev->valid_ioctls = valid_ioctls & ~(vdev->valid_ioctls)

Wouldn't it be more logical to initialize valid_ioctls to all 1s and clear 
bits in v4l2_dont_use_cmd() ? Otherwise the meaning of the field changes 
depending on whether the device is registered or not.

Another bikeshedding comment, what about renaming v4l2_dont_use_cmd() with 
something that includes ioctl in the name ?

- v4l2_dont_use_ioctl
- v4l2_dont_use_ioctl_cmd
- v4l2_ioctl_cmd_not_used
- v4l2_ioctl_dont_use
- v4l2_ioctl_dont_use_cmd
- v4l2_disable_ioctl
- v4l2_disable_ioctl_cmd
...

(I like "disable" slightly better than "don't use").

> + */

-- 
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: [ANN] Selection API naming meeting #v4l-meeting next Monday

2012-05-14 Thread Sakari Ailus
On Thu, May 10, 2012 at 11:18:49PM +0300, Sakari Ailus wrote:
> Hi all,
> 
> Let's have a quick meeting 14:00 Finnish time (GMT + 3) next Monday on
> #v4l-meeting on two topics:
> 
> - Selection target naming. It has been proposed that the _ACTUAL / _ACTIVE
>   be removed and e.g. the crop targets would be then called
>   V4L2_SEL_TGT_CROP and V4L2_SUBDEV_SEL_TGT_CROP on V4L2 and subdve
>   interfaces, respectively.
> 
> - Unifying selection targets on subdevs and V4L2 API. Currently the IDs of
>   mostly equivalent targets are the same, but there are subtle differences
>   between the targets in some cases. We still have documented everything
>   twice, even if the differences are subtle. Would it make sese to unify the
>   two, and just mention the differences?

Hi all,

The meeting log is available here:

http://www.retiisi.org.uk/v4l2/notes/v4l2-selections-rename-2012-05-14.txt>

Short summary: we decided that the _ACTUAL/_ACTIVE can be removed from
selection target names, and that the selection targets can be unified
between V4L2 and V4L2 subdev interfaces.

Kind regards,

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi jabber/XMPP/Gmail: sai...@retiisi.org.uk
--
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: [RFCv1 PATCH 5/5] v4l2-dev: add flag to have the core lock all file operations.

2012-05-14 Thread Laurent Pinchart
Hi Hans,

Thanks for the patch.

On Thursday 10 May 2012 09:05:14 Hans Verkuil wrote:
> From: Hans Verkuil 
> 
> This used to be the default if the lock pointer was set, but now that lock
> is by default only used for ioctl serialization.

Shouldn't that be documented ? Documentation/video4linux/v4l2-framework.txt 
still states that the lock is taken for each file operation.

> Those drivers that already used core locking have this flag set explicitly,
> except for some drivers where it was obvious that there was no need to
> serialize any file operations other than ioctl.
> 
> The drivers that didn't need this flag were:
> 
> drivers/media/radio/dsbr100.c
> drivers/media/radio/radio-isa.c
> drivers/media/radio/radio-keene.c
> drivers/media/radio/radio-miropcm20.c
> drivers/media/radio/radio-mr800.c
> drivers/media/radio/radio-tea5764.c
> drivers/media/radio/radio-timb.c
> drivers/media/video/vivi.c
> sound/i2c/other/tea575x-tuner.c

Be careful that drivers for hot-pluggable devices can use the core lock to 
serialize open/disconnect. The dsbr100 driver takes the core lock in its 
disconnect handler for instance. Have you double-checked that no race 
condition exists in those cases ?

> The other drivers that use core locking and where it was not immediately
> obvious that this flag wasn't needed were changed so that the flag is set
> together with a comment that that driver needs work to avoid having to
> set that flag. This will often involve taking the core lock in the fops
> themselves.

Or not using the core lock :-)

> Eventually this flag should go and it should not be used in new drivers.

Could you please add a comment above the flag to state that new drivers must 
not use it ?

> There are a few reasons why we want to avoid core locking of non-ioctl
> fops: in the case of mmap this can lead to a deadlock in rare situations
> since when mmap is called the mmap_sem is held and it is possible for
> other parts of the code to take that lock as well
> (copy_from_user()/copy_to_user() perform a down_read(&mm->mmap_sem) when a
> page fault occurs).

This patch won't solve the problem. We have (at least) two AB-BA deadlock 
issues with the mm->mmap_sem. Both of them share the fact that the mmap() 
handler is called with mm->mmap_sem held and will then take a device-related 
lock (could be a global driver lock, a device-wide lock or a queue-specific 
lock). I don't think we can do anything about that.

The first problem was solved some time ago. VIDIOC_QBUF is called with the 
same device-related lock held and then needs to take mm->mmap_sem. We solved 
that be calling the queue wait_prepare() and wait_finish() around down(&mm-
>mmap_sem) and up(&mm->mmap_sem). Maybe not ideal, but that seems to work.

The second problem comes from the copy_from_user()/copy_to_user() code in 
video_usercopy(). That function is called by video_ioctl2() which is itself 
called with the device lock held. Copying from/to user can fault if the 
userspace memory has been paged out, in which case the fault handler needs to 
take mm->mmap_sem to solve the fault. This can deadlock with mmap().

To solve the second issue we must delay taking the device lock until after 
copying from user, as we can't forbid the mmap() handler from taking the 
device lock (that would introduce race conditions). I think that can be done 
by pushing the device lock into __video_do_ioctl.

> It is very unlikely that that happens since the core lock serializes all
> fops, but the kernel warns about it if lock validation is turned on.
> 
> For poll it is also undesirable to take the core lock as that can introduce
> increased latency. The same is true for read/write.
> 
> While it was possible to make flags or something to turn on/off taking the
> core lock for each file operation, in practice it is much simpler to just
> not take it at all except for ioctl and leave it to the driver to take the
> lock. There are only a handful fops compared to the zillion ioctls we have.
> 
> I also wanted to make it obvious which drivers still take the lock for all
> fops, so that's why I chose to have drivers set it explicitly.

-- 
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: Fwd: Bug#669715: dvb-apps: Channel/frequency/etc. data needs updating for London transmitters

2012-05-14 Thread Andrew Benham
Of course it's not just the data for the London transmitters which needs
to be updated - most of GB has now switched to digital only with
different channel allocations.

I've been using the information from
http://stakeholders.ofcom.org.uk/broadcasting/guidance/tech-guidance/dsodetails/
to derive new data.

I don't know if it's just Crystal Palace, but one of the multiplexes
thinks it's using QPSK even though it's using QAM64 - this messes up
'scan' unless one reorders the frequency list.
Having done the scan, one then needs to replace 'QPSK' by 'QAM_64' in
the output.

See also:
http://www.adsb.co.uk/linuxtv/

-- 
Andrew Benham, Southgate, London N14, United Kingdom

The gates in my computer are AND OR and NOT, not "Bill"
--
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] [media] s5p-mfc: Use devm_* functions in s5p_mfc.c file

2012-05-14 Thread Sachin Kamat
devm_* functions are device managed functions and make error handling
and cleanup simpler.

Signed-off-by: Sachin Kamat 
---
 drivers/media/video/s5p-mfc/s5p_mfc.c|   63 ++
 drivers/media/video/s5p-mfc/s5p_mfc_common.h |2 -
 2 files changed, 14 insertions(+), 51 deletions(-)

diff --git a/drivers/media/video/s5p-mfc/s5p_mfc.c 
b/drivers/media/video/s5p-mfc/s5p_mfc.c
index 83fe461..3302d45 100644
--- a/drivers/media/video/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/video/s5p-mfc/s5p_mfc.c
@@ -948,7 +948,7 @@ static int s5p_mfc_probe(struct platform_device *pdev)
int ret;
 
pr_debug("%s++\n", __func__);
-   dev = kzalloc(sizeof *dev, GFP_KERNEL);
+   dev = devm_kzalloc(&pdev->dev, sizeof *dev, GFP_KERNEL);
if (!dev) {
dev_err(&pdev->dev, "Not enough memory for MFC device\n");
return -ENOMEM;
@@ -959,49 +959,35 @@ static int s5p_mfc_probe(struct platform_device *pdev)
dev->plat_dev = pdev;
if (!dev->plat_dev) {
dev_err(&pdev->dev, "No platform data specified\n");
-   ret = -ENODEV;
-   goto err_dev;
+   return -ENODEV;
}
 
ret = s5p_mfc_init_pm(dev);
if (ret < 0) {
dev_err(&pdev->dev, "failed to get mfc clock source\n");
-   goto err_clk;
+   return ret;
}
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (res == NULL) {
-   dev_err(&pdev->dev, "failed to get memory region resource\n");
-   ret = -ENOENT;
-   goto err_res;
-   }
 
-   dev->mfc_mem = request_mem_region(res->start, resource_size(res),
- pdev->name);
-   if (dev->mfc_mem == NULL) {
-   dev_err(&pdev->dev, "failed to get memory region\n");
-   ret = -ENOENT;
-   goto err_mem_reg;
-   }
-   dev->regs_base = ioremap(dev->mfc_mem->start, 
resource_size(dev->mfc_mem));
+   dev->regs_base = devm_request_and_ioremap(&pdev->dev, res);
if (dev->regs_base == NULL) {
-   dev_err(&pdev->dev, "failed to ioremap address region\n");
-   ret = -ENOENT;
-   goto err_ioremap;
+   dev_err(&pdev->dev, "Failed to obtain io memory\n");
+   return -ENOENT;
}
 
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (res == NULL) {
dev_err(&pdev->dev, "failed to get irq resource\n");
ret = -ENOENT;
-   goto err_get_res;
+   goto err_res;
}
dev->irq = res->start;
-   ret = request_irq(dev->irq, s5p_mfc_irq, IRQF_DISABLED, pdev->name,
-   dev);
+   ret = devm_request_irq(&pdev->dev, dev->irq, s5p_mfc_irq,
+   IRQF_DISABLED, pdev->name, dev);
if (ret) {
dev_err(&pdev->dev, "Failed to install irq (%d)\n", ret);
-   goto err_req_irq;
+   goto err_res;
}
 
dev->mem_dev_l = device_find_child(&dev->plat_dev->dev, "s5p-mfc-l",
@@ -1009,20 +995,20 @@ static int s5p_mfc_probe(struct platform_device *pdev)
if (!dev->mem_dev_l) {
mfc_err("Mem child (L) device get failed\n");
ret = -ENODEV;
-   goto err_find_child;
+   goto err_res;
}
dev->mem_dev_r = device_find_child(&dev->plat_dev->dev, "s5p-mfc-r",
   match_child);
if (!dev->mem_dev_r) {
mfc_err("Mem child (R) device get failed\n");
ret = -ENODEV;
-   goto err_find_child;
+   goto err_res;
}
 
dev->alloc_ctx[0] = vb2_dma_contig_init_ctx(dev->mem_dev_l);
if (IS_ERR_OR_NULL(dev->alloc_ctx[0])) {
ret = PTR_ERR(dev->alloc_ctx[0]);
-   goto err_mem_init_ctx_0;
+   goto err_res;
}
dev->alloc_ctx[1] = vb2_dma_contig_init_ctx(dev->mem_dev_r);
if (IS_ERR_OR_NULL(dev->alloc_ctx[1])) {
@@ -1110,22 +1096,9 @@ err_v4l2_dev_reg:
vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[1]);
 err_mem_init_ctx_1:
vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[0]);
-err_mem_init_ctx_0:
-err_find_child:
-   free_irq(dev->irq, dev);
-err_req_irq:
-err_get_res:
-   iounmap(dev->regs_base);
-   dev->regs_base = NULL;
-err_ioremap:
-   release_resource(dev->mfc_mem);
-   kfree(dev->mfc_mem);
-err_mem_reg:
 err_res:
s5p_mfc_final_pm(dev);
-err_clk:
-err_dev:
-   kfree(dev);
+
pr_debug("%s-- with error\n", __func__);
return ret;
 
@@ -1148,15 +1121,7 @@ static int __devexit s5p_mfc_remove(struct 
platform_device *pdev)
vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[0]);
vb2_dma_contig_cleanup_ctx(dev->alloc_ctx

Re: [PATCH] drivers:media:video:uvc: fix uvc_v4l2_get_unmapped_area for NOMMU

2012-05-14 Thread Laurent Pinchart
Hi Bob,

On Monday 14 May 2012 18:23:59 Bob Liu wrote:
> Fix uvc_v4l2_get_unmapped_area() for NOMMU arch like blackfin after
> framework updated to use videobuf2.

Thank you for the patch, but I'm afraid you're too late. The fix is already 
queued for v3.5 :-)

> Signed-off-by: Bob Liu 
> ---
>  drivers/media/video/uvc/uvc_queue.c |   30 --
>  drivers/media/video/uvc/uvc_v4l2.c  |2 +-
>  2 files changed, 1 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/media/video/uvc/uvc_queue.c
> b/drivers/media/video/uvc/uvc_queue.c index 518f77d..30be060 100644
> --- a/drivers/media/video/uvc/uvc_queue.c
> +++ b/drivers/media/video/uvc/uvc_queue.c
> @@ -237,36 +237,6 @@ int uvc_queue_allocated(struct uvc_video_queue *queue)
>   return allocated;
>  }
> 
> -#ifndef CONFIG_MMU
> -/*
> - * Get unmapped area.
> - *
> - * NO-MMU arch need this function to make mmap() work correctly.
> - */
> -unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
> - unsigned long pgoff)
> -{
> - struct uvc_buffer *buffer;
> - unsigned int i;
> - unsigned long ret;
> -
> - mutex_lock(&queue->mutex);
> - for (i = 0; i < queue->count; ++i) {
> - buffer = &queue->buffer[i];
> - if ((buffer->buf.m.offset >> PAGE_SHIFT) == pgoff)
> - break;
> - }
> - if (i == queue->count) {
> - ret = -EINVAL;
> - goto done;
> - }
> - ret = (unsigned long)buf->mem;
> -done:
> - mutex_unlock(&queue->mutex);
> - return ret;
> -}
> -#endif
> -
>  /*
>   * Enable or disable the video buffers queue.
>   *
> diff --git a/drivers/media/video/uvc/uvc_v4l2.c
> b/drivers/media/video/uvc/uvc_v4l2.c index 2ae4f88..506d3d6 100644
> --- a/drivers/media/video/uvc/uvc_v4l2.c
> +++ b/drivers/media/video/uvc/uvc_v4l2.c
> @@ -1067,7 +1067,7 @@ static unsigned long uvc_v4l2_get_unmapped_area(struct
> file *file,
> 
>   uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_get_unmapped_area\n");
> 
> - return uvc_queue_get_unmapped_area(&stream->queue, pgoff);
> + return vb2_get_unmapped_area(&stream->queue, addr, len, pgoff, flags);

Just for the record you would have needed to take the queue->mutex around the 
vb2_get_unmapped_area() call here.

>  }
>  #endif

-- 
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 1/6] libdvbv5 shared lib

2012-05-14 Thread Mauro Carvalho Chehab
Em 13-05-2012 11:18, Gregor Jasny escreveu:
> Hello,
> 
> I noticed the dvb library is partially licensed as GPL2 and partially
> LGPL2.1+. Do you consider a re-licensing to LGPL2.1?

It is actually released as GPLv2 only. There's one file with LGPL2.1 only there:
the DVB frontend API file (include/linux/dvb/frontend.h, c/c there as 
dvb-frontend.h).

Currently, I've no plans to change it to LGPL2.1.

> 
> For better maintainability in distributions I'd also suggest to hide
> non-public symbols like it's done for libv4l*.

I'll put it on my TODO list. I won't have any time to work on that during the 
last
3 weeks, due to the merge window, so, if André or someone else can help with 
patches,
those will be very welcome ;)

Regards,
Mauro
> 
> Thanks,
> Gregor

--
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/3] gspca - ov534: saturation and hue (using fixp-arith.h)

2012-05-14 Thread Antonio Ospite
On Sun,  6 May 2012 12:14:55 +0200
Antonio Ospite  wrote:

> Hi,

[...]
> 
> Antonio Ospite (3):
>   gspca - ov534: Add Saturation control
>   Input: move drivers/input/fixp-arith.h to include/linux
>   gspca - ov534: Add Hue control
> 

These changes are now in
http://git.linuxtv.org/hgoede/gspca.git/shortlog/refs/heads/media-for_v3.5

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpC7hKLwWxqE.pgp
Description: PGP signature


[GIT PULL for v3.4-final] media fixes

2012-05-14 Thread Mauro Carvalho Chehab
Hi Linus,

Please pull from:
  git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 
v4l_for_linus

For a some fix patches for v3.4, including a regression fix at DVB core.

Thanks!
Mauro

-

Latest commit at the branch: 
788ab1bb03d304232711b6ca9718534f588ee9fc [media] gspca - sonixj: Fix a zero 
divide in isoc interrupt
The following changes since commit 36be50515fe2aef61533b516fa2576a2c7fe7664:

  Linux 3.4-rc7 (2012-05-12 18:37:47 -0700)

are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 
v4l_for_linus

Dan Carpenter (1):
  [media] fintek-cir: change || to &&

Guennadi Liakhovetski (1):
  [media] V4L: soc-camera: protect hosts during probing from overzealous 
user-space

H Hartley Sweeten (2):
  [media] media: videobuf2-dma-contig: quiet sparse noise about plain 
integer as NULL pointer
  [media] media: videobuf2-dma-contig: include header for exported symbols

Jean-François Moine (1):
  [media] gspca - sonixj: Fix a zero divide in isoc interrupt

Jonathan Corbet (1):
  [media] marvell-cam: fix an ARM build error

Laurent Pinchart (1):
  [media] media: vb2-memops: Export vb2_get_vma symbol

Luis Henriques (1):
  [media] rc: Postpone ISR registration

Mauro Carvalho Chehab (1):
  [media] dvb_frontend: fix a regression with DVB-S zig-zag

Sylwester Nawrocki (3):
  [media] V4L: Schedule V4L2_CID_HCENTER, V4L2_CID_VCENTER controls for 
removal
  [media] s5p-fimc: Fix locking in subdev set_crop op
  [media] s5p-fimc: Correct memory allocation for VIDIOC_CREATE_BUFS

 Documentation/feature-removal-schedule.txt|   10 +++
 drivers/media/dvb/dvb-core/dvb_frontend.c |4 +
 drivers/media/rc/ene_ir.c |   32 +-
 drivers/media/rc/fintek-cir.c |   22 
 drivers/media/rc/ite-cir.c|   20 +++---
 drivers/media/rc/nuvoton-cir.c|   36 ++--
 drivers/media/rc/winbond-cir.c|   78 
 drivers/media/video/gspca/sonixj.c|8 +-
 drivers/media/video/marvell-ccic/mmp-driver.c |1 -
 drivers/media/video/s5p-fimc/fimc-capture.c   |   33 +++
 drivers/media/video/s5p-fimc/fimc-core.c  |4 +-
 drivers/media/video/s5p-fimc/fimc-core.h  |2 +-
 drivers/media/video/soc_camera.c  |8 ++-
 drivers/media/video/videobuf2-dma-contig.c|3 +-
 drivers/media/video/videobuf2-memops.c|1 +
 include/media/soc_camera.h|3 +-
 16 files changed, 147 insertions(+), 118 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] drivers:media:video:uvc: fix uvc_v4l2_get_unmapped_area for NOMMU

2012-05-14 Thread Bob Liu
Fix uvc_v4l2_get_unmapped_area() for NOMMU arch like blackfin after framework
updated to use videobuf2.

Signed-off-by: Bob Liu 
---
 drivers/media/video/uvc/uvc_queue.c |   30 --
 drivers/media/video/uvc/uvc_v4l2.c  |2 +-
 2 files changed, 1 insertions(+), 31 deletions(-)

diff --git a/drivers/media/video/uvc/uvc_queue.c 
b/drivers/media/video/uvc/uvc_queue.c
index 518f77d..30be060 100644
--- a/drivers/media/video/uvc/uvc_queue.c
+++ b/drivers/media/video/uvc/uvc_queue.c
@@ -237,36 +237,6 @@ int uvc_queue_allocated(struct uvc_video_queue *queue)
return allocated;
 }
 
-#ifndef CONFIG_MMU
-/*
- * Get unmapped area.
- *
- * NO-MMU arch need this function to make mmap() work correctly.
- */
-unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
-   unsigned long pgoff)
-{
-   struct uvc_buffer *buffer;
-   unsigned int i;
-   unsigned long ret;
-
-   mutex_lock(&queue->mutex);
-   for (i = 0; i < queue->count; ++i) {
-   buffer = &queue->buffer[i];
-   if ((buffer->buf.m.offset >> PAGE_SHIFT) == pgoff)
-   break;
-   }
-   if (i == queue->count) {
-   ret = -EINVAL;
-   goto done;
-   }
-   ret = (unsigned long)buf->mem;
-done:
-   mutex_unlock(&queue->mutex);
-   return ret;
-}
-#endif
-
 /*
  * Enable or disable the video buffers queue.
  *
diff --git a/drivers/media/video/uvc/uvc_v4l2.c 
b/drivers/media/video/uvc/uvc_v4l2.c
index 2ae4f88..506d3d6 100644
--- a/drivers/media/video/uvc/uvc_v4l2.c
+++ b/drivers/media/video/uvc/uvc_v4l2.c
@@ -1067,7 +1067,7 @@ static unsigned long uvc_v4l2_get_unmapped_area(struct 
file *file,
 
uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_get_unmapped_area\n");
 
-   return uvc_queue_get_unmapped_area(&stream->queue, pgoff);
+   return vb2_get_unmapped_area(&stream->queue, addr, len, pgoff, flags);
 }
 #endif
 
-- 
1.6.3.3


--
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 1/2] staging: media: go7007: Adlink MPG24 board

2012-05-14 Thread Dan Carpenter

On Mon, May 14, 2012 at 01:25:43PM +0400, vol...@telros.ru wrote:
> On Mon, May 14, 2012 at 12:04:15PM +0300, Dan Carpenter wrote:
> > On Mon, May 14, 2012 at 12:09:18PM +0400, vol...@telros.ru wrote:
> > > It`s very horrible to describe every changing...
> > 
> > Maybe, but that's the rules.  There has to be a reason for every
> > change otherwise why are you doing crap for no reason?
> > 
> > It's not hard to break changes up into separate commits by the way.
> > Just use "git citool", highlight the lines you want, right click,
> > and choose "commit selected lines".
> > 
> > regards,
> > dan carpenter
>
> Excuse for crap, I`ll not do so.

Uh.  Ok.  That's your call to make.

Please don't drop the other people from the CC list.

regards,
dan carpenter
--
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] s5p-jpeg: Use devm_* functions in jpeg-core.c file

2012-05-14 Thread Sachin Kamat
devm_* functions are used to replace kzalloc, request_mem_region, ioremap
and request_irq functions in probe call. With the usage of devm_* functions
explicit freeing and unmapping is not required.

Signed-off-by: Sachin Kamat 
---
 drivers/media/video/s5p-jpeg/jpeg-core.c |   58 +
 drivers/media/video/s5p-jpeg/jpeg-core.h |2 -
 2 files changed, 10 insertions(+), 50 deletions(-)

diff --git a/drivers/media/video/s5p-jpeg/jpeg-core.c 
b/drivers/media/video/s5p-jpeg/jpeg-core.c
index 5a49c30..a83a7e3 100644
--- a/drivers/media/video/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/video/s5p-jpeg/jpeg-core.c
@@ -1290,7 +1290,7 @@ static int s5p_jpeg_probe(struct platform_device *pdev)
int ret;
 
/* JPEG IP abstraction struct */
-   jpeg = kzalloc(sizeof(struct s5p_jpeg), GFP_KERNEL);
+   jpeg = devm_kzalloc(&pdev->dev, sizeof(struct s5p_jpeg), GFP_KERNEL);
if (!jpeg)
return -ENOMEM;
 
@@ -1300,43 +1300,25 @@ static int s5p_jpeg_probe(struct platform_device *pdev)
 
/* memory-mapped registers */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!res) {
-   dev_err(&pdev->dev, "cannot find IO resource\n");
-   ret = -ENOENT;
-   goto jpeg_alloc_rollback;
-   }
-
-   jpeg->ioarea = request_mem_region(res->start, resource_size(res),
- pdev->name);
-   if (!jpeg->ioarea) {
-   dev_err(&pdev->dev, "cannot request IO\n");
-   ret = -ENXIO;
-   goto jpeg_alloc_rollback;
-   }
 
-   jpeg->regs = ioremap(res->start, resource_size(res));
-   if (!jpeg->regs) {
-   dev_err(&pdev->dev, "cannot map IO\n");
-   ret = -ENXIO;
-   goto mem_region_rollback;
+   jpeg->regs = devm_request_and_ioremap(&pdev->dev, res);
+   if (jpeg->regs == NULL) {
+   dev_err(&pdev->dev, "Failed to obtain io memory\n");
+   return -ENOENT;
}
 
-   dev_dbg(&pdev->dev, "registers %p (%p, %p)\n",
-   jpeg->regs, jpeg->ioarea, res);
-
/* interrupt service routine registration */
jpeg->irq = ret = platform_get_irq(pdev, 0);
if (ret < 0) {
dev_err(&pdev->dev, "cannot find IRQ\n");
-   goto ioremap_rollback;
+   return ret;
}
 
-   ret = request_irq(jpeg->irq, s5p_jpeg_irq, 0,
- dev_name(&pdev->dev), jpeg);
-
+   ret = devm_request_irq(&pdev->dev, jpeg->irq, s5p_jpeg_irq, 0,
+   dev_name(&pdev->dev), jpeg);
if (ret) {
dev_err(&pdev->dev, "cannot claim IRQ %d\n", jpeg->irq);
-   goto ioremap_rollback;
+   return ret;
}
 
/* clocks */
@@ -1344,7 +1326,7 @@ static int s5p_jpeg_probe(struct platform_device *pdev)
if (IS_ERR(jpeg->clk)) {
dev_err(&pdev->dev, "cannot get clock\n");
ret = PTR_ERR(jpeg->clk);
-   goto request_irq_rollback;
+   return ret;
}
dev_dbg(&pdev->dev, "clock source %p\n", jpeg->clk);
clk_enable(jpeg->clk);
@@ -1456,18 +1438,6 @@ clk_get_rollback:
clk_disable(jpeg->clk);
clk_put(jpeg->clk);
 
-request_irq_rollback:
-   free_irq(jpeg->irq, jpeg);
-
-ioremap_rollback:
-   iounmap(jpeg->regs);
-
-mem_region_rollback:
-   release_resource(jpeg->ioarea);
-   release_mem_region(jpeg->ioarea->start, resource_size(jpeg->ioarea));
-
-jpeg_alloc_rollback:
-   kfree(jpeg);
return ret;
 }
 
@@ -1488,14 +1458,6 @@ static int s5p_jpeg_remove(struct platform_device *pdev)
clk_disable(jpeg->clk);
clk_put(jpeg->clk);
 
-   free_irq(jpeg->irq, jpeg);
-
-   iounmap(jpeg->regs);
-
-   release_resource(jpeg->ioarea);
-   release_mem_region(jpeg->ioarea->start, resource_size(jpeg->ioarea));
-   kfree(jpeg);
-
return 0;
 }
 
diff --git a/drivers/media/video/s5p-jpeg/jpeg-core.h 
b/drivers/media/video/s5p-jpeg/jpeg-core.h
index 38d7367..9d0cd2b 100644
--- a/drivers/media/video/s5p-jpeg/jpeg-core.h
+++ b/drivers/media/video/s5p-jpeg/jpeg-core.h
@@ -54,7 +54,6 @@
  * @vfd_encoder:   video device node for encoder mem2mem mode
  * @vfd_decoder:   video device node for decoder mem2mem mode
  * @m2m_dev:   v4l2 mem2mem device data
- * @ioarea:JPEG IP memory region
  * @regs:  JPEG IP registers mapping
  * @irq:   JPEG IP irq
  * @clk:   JPEG IP clock
@@ -70,7 +69,6 @@ struct s5p_jpeg {
struct video_device *vfd_decoder;
struct v4l2_m2m_dev *m2m_dev;
 
-   struct resource *ioarea;
void __iomem*regs;
unsigned intirq;
struct clk  *clk;
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the b

[PATCH] s5p-g2d: Use devm_* functions in g2d.c file

2012-05-14 Thread Sachin Kamat
devm_* functions are device managed functions and make error handling
and cleanup simpler.

Signed-off-by: Sachin Kamat 
---
 drivers/media/video/s5p-g2d/g2d.c |   47 
 drivers/media/video/s5p-g2d/g2d.h |1 -
 2 files changed, 11 insertions(+), 37 deletions(-)

diff --git a/drivers/media/video/s5p-g2d/g2d.c 
b/drivers/media/video/s5p-g2d/g2d.c
index 789de74..5a11d37 100644
--- a/drivers/media/video/s5p-g2d/g2d.c
+++ b/drivers/media/video/s5p-g2d/g2d.c
@@ -674,42 +674,27 @@ static int g2d_probe(struct platform_device *pdev)
struct resource *res;
int ret = 0;
 
-   dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+   dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
if (!dev)
return -ENOMEM;
+
spin_lock_init(&dev->ctrl_lock);
mutex_init(&dev->mutex);
atomic_set(&dev->num_inst, 0);
init_waitqueue_head(&dev->irq_queue);
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!res) {
-   dev_err(&pdev->dev, "failed to find registers\n");
-   ret = -ENOENT;
-   goto free_dev;
-   }
 
-   dev->res_regs = request_mem_region(res->start, resource_size(res),
-   dev_name(&pdev->dev));
-
-   if (!dev->res_regs) {
-   dev_err(&pdev->dev, "failed to obtain register region\n");
-   ret = -ENOENT;
-   goto free_dev;
-   }
-
-   dev->regs = ioremap(res->start, resource_size(res));
-   if (!dev->regs) {
-   dev_err(&pdev->dev, "failed to map registers\n");
-   ret = -ENOENT;
-   goto rel_res_regs;
+   dev->regs = devm_request_and_ioremap(&pdev->dev, res);
+   if (dev->regs == NULL) {
+   dev_err(&pdev->dev, "Failed to obtain io memory\n");
+   return -ENOENT;
}
 
dev->clk = clk_get(&pdev->dev, "sclk_fimg2d");
if (IS_ERR_OR_NULL(dev->clk)) {
dev_err(&pdev->dev, "failed to get g2d clock\n");
-   ret = -ENXIO;
-   goto unmap_regs;
+   return -ENXIO;
}
 
ret = clk_prepare(dev->clk);
@@ -740,7 +725,8 @@ static int g2d_probe(struct platform_device *pdev)
 
dev->irq = res->start;
 
-   ret = request_irq(dev->irq, g2d_isr, 0, pdev->name, dev);
+   ret = devm_request_irq(&pdev->dev, dev->irq, g2d_isr,
+   0, pdev->name, dev);
if (ret) {
dev_err(&pdev->dev, "failed to install IRQ\n");
goto put_clk_gate;
@@ -749,7 +735,7 @@ static int g2d_probe(struct platform_device *pdev)
dev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
if (IS_ERR(dev->alloc_ctx)) {
ret = PTR_ERR(dev->alloc_ctx);
-   goto rel_irq;
+   goto unprep_clk_gate;
}
 
ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev);
@@ -793,8 +779,6 @@ unreg_v4l2_dev:
v4l2_device_unregister(&dev->v4l2_dev);
 alloc_ctx_cleanup:
vb2_dma_contig_cleanup_ctx(dev->alloc_ctx);
-rel_irq:
-   free_irq(dev->irq, dev);
 unprep_clk_gate:
clk_unprepare(dev->gate);
 put_clk_gate:
@@ -803,12 +787,7 @@ unprep_clk:
clk_unprepare(dev->clk);
 put_clk:
clk_put(dev->clk);
-unmap_regs:
-   iounmap(dev->regs);
-rel_res_regs:
-   release_resource(dev->res_regs);
-free_dev:
-   kfree(dev);
+
return ret;
 }
 
@@ -821,14 +800,10 @@ static int g2d_remove(struct platform_device *pdev)
video_unregister_device(dev->vfd);
v4l2_device_unregister(&dev->v4l2_dev);
vb2_dma_contig_cleanup_ctx(dev->alloc_ctx);
-   free_irq(dev->irq, dev);
clk_unprepare(dev->gate);
clk_put(dev->gate);
clk_unprepare(dev->clk);
clk_put(dev->clk);
-   iounmap(dev->regs);
-   release_resource(dev->res_regs);
-   kfree(dev);
return 0;
 }
 
diff --git a/drivers/media/video/s5p-g2d/g2d.h 
b/drivers/media/video/s5p-g2d/g2d.h
index 1b82065..6b765b0 100644
--- a/drivers/media/video/s5p-g2d/g2d.h
+++ b/drivers/media/video/s5p-g2d/g2d.h
@@ -23,7 +23,6 @@ struct g2d_dev {
spinlock_t  ctrl_lock;
atomic_tnum_inst;
struct vb2_alloc_ctx*alloc_ctx;
-   struct resource *res_regs;
void __iomem*regs;
struct clk  *clk;
struct clk  *gate;
-- 
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 1/2] staging: media: go7007: Adlink MPG24 board

2012-05-14 Thread Dan Carpenter
On Mon, May 14, 2012 at 12:09:18PM +0400, vol...@telros.ru wrote:
> It`s very horrible to describe every changing...

Maybe, but that's the rules.  There has to be a reason for every
change otherwise why are you doing crap for no reason?

It's not hard to break changes up into separate commits by the way.
Just use "git citool", highlight the lines you want, right click,
and choose "commit selected lines".

regards,
dan carpenter
--
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 1/2] staging: media: go7007: Adlink MPG24 board

2012-05-14 Thread volokh
On Sun, May 13, 2012 at 10:21:48PM +0300, Dan Carpenter wrote:
> On Sun, May 13, 2012 at 10:52:41PM +0400, Volokh Konstantin wrote:
> > This patch applies only for Adlink MPG24 board with go7007, all these 
> > changes were tested for continuous loading & restarting modes
> > 
> > This is minimal changes needed for start up go7007 to work correctly
> >   in 3.4 branch
> > 
> > Changes:
> >   - When go7007 reset device, i2c was not working (need rewrite GPIO5)
> >   - As wis2804 has i2c_addr=0x00/*really*/, so Need set I2C_CLIENT_TEN flag 
> > for validity
> >   - some main nonzero initialization, rewrites with kzalloc instead kmalloc
> >   - STATUS_SHUTDOWN was placed in incorrect place, so if firmware wasn`t 
> > loaded, we
> > failed v4l2_device_unregister with kernel panic (OOPS)
> >   - some new v4l2 style features as call_all(...s_stream...) for using 
> > subdev calls
> > 
> 
> In some ways, yes, I can see that this seems like one thing "Make
> go7007 work correctly", but really it would be better if each of
> the bullet points was its own patch.
> 
> The changelogs should explain why you do something not what you do.
> We can all see that kmalloc() was changed to kzalloc() but why? Is

struct go7007 contains "struct v4l2_device v4l2_dev;" field, so if transfer it 
uninitialized (may be nonzero)
in function: "int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, 
struct v4l2_subdev *sd)"
(drivers/media/video/v4l2-device.c), so next code may be called:
#if defined(CONFIG_MEDIA_CONTROLLER)
/* Register the entity. */
if (v4l2_dev->mdev) {
err = media_device_register_entity(v4l2_dev->mdev, entity);
if (err < 0) {
if (sd->internal_ops && sd->internal_ops->unregistered)
sd->internal_ops->unregistered(sd);
module_put(sd->owner);
return err;
}
}
#endif
I`ve got error here. because go7007 don`t control mdev field.

The next kzalloc: "gofh = kzalloc(sizeof(struct go7007_file), GFP_KERNEL);" was 
written only for zero initialization on creation purpose, driver work properly 
without it changing
> their and information leak for example?  That might have security
> implications and be good thing to know about.
> 
> regards,
> dan carpenter
> 
> 
> --
> 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

It`s very horrible to describe every changing...

Volokh Konstantin
--
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 01/13] davinci: vpif: add check for genuine interrupts in the isr

2012-05-14 Thread Laurent Pinchart
Hi Manjunath,

On Friday 11 May 2012 05:32:13 Hadli, Manjunath wrote:
> On Tue, Apr 17, 2012 at 15:36:16, Laurent Pinchart wrote:
> > On Tuesday 17 April 2012 14:22:59 Manjunath Hadli wrote:
> > > As the same interrupt is shared between capture and display devices,
> > > sometimes we get isr calls where the interrupt might not genuinely
> > > belong to capture or display. Hence, add a condition in the isr to
> > > check for interrupt ownership and channel number to make sure we do
> > > not service wrong interrupts.
> > > 
> > > Signed-off-by: Manjunath Hadli 
> > > ---
> > > 
> > >  drivers/media/video/davinci/vpif_capture.c |5 +
> > >  drivers/media/video/davinci/vpif_display.c |5 +
> > >  include/media/davinci/vpif_types.h |2 ++
> > >  3 files changed, 12 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/drivers/media/video/davinci/vpif_capture.c
> > > b/drivers/media/video/davinci/vpif_capture.c index 6504e40..33d865d
> > > 100644
> > > --- a/drivers/media/video/davinci/vpif_capture.c
> > > +++ b/drivers/media/video/davinci/vpif_capture.c
> > > @@ -333,6 +333,7 @@ static void vpif_schedule_next_buffer(struct
> > > common_obj
> > > *common) */
> > > 
> > >  static irqreturn_t vpif_channel_isr(int irq, void *dev_id)  {
> > > 
> > > + struct vpif_capture_config *config = vpif_dev->platform_data;
> > > 
> > >   struct vpif_device *dev = &vpif_obj;
> > >   struct common_obj *common;
> > >   struct channel_obj *ch;
> > > 
> > > @@ -341,6 +342,10 @@ static irqreturn_t vpif_channel_isr(int irq, void
> > > *dev_id) int fid = -1, i;
> > > 
> > >   channel_id = *(int *)(dev_id);
> > > 
> > > + if (!config->intr_status ||
> > > + !config->intr_status(vpif_base, channel_id))
> > > + return IRQ_NONE;
> > > +
> > 
> > I don't think this is the right way to handle the situation. You should
> > instead read the interrupt source register for the VPIF capture device,
> > and return IRQ_NONE if you find that no interrupt source has been flagged
> > (and similarly for the display device below).
>
> Agreed, and this is what is being done in intr_status() function, which
> is implemented in the board file. This function checks the interrupt source
> register for VPIF capture and display devices the way you mentioned.

Why do you need to do that in board code ? You can just check whether the VPIF 
capture hardware has generated an interrupt here exactly the same way as you 
do in your board code, and return IRQ_NONE if it hasn't. There's no need for 
the VPIF capture driver to be aware of the VPIF display driver (and vice 
versa).

> > >   ch = dev->dev[channel_id];
> > >   
> > >   field = ch->common[VPIF_VIDEO_INDEX].fmt.fmt.pix.field;

-- 
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 05/13] davinci: vpif display: declare contiguous region of memory handled by dma_alloc_coherent

2012-05-14 Thread Laurent Pinchart
Hi Manjunath,

On Friday 11 May 2012 05:30:43 Hadli, Manjunath wrote:
> On Tue, Apr 17, 2012 at 15:32:55, Laurent Pinchart wrote:
> > On Tuesday 17 April 2012 14:23:03 Manjunath Hadli wrote:
> > > add support to declare contiguous region of memory to be handled when
> > > requested by dma_alloc_coherent call. The user can specify the size of
> > > the buffers with an offset from the kernel image using cont_bufsize
> > > and cont_bufoffset module parameters respectively.

[snip]

> > > @@ -1686,12 +1710,14 @@ static __init int vpif_probe(struct
> > > platform_device *pdev) struct vpif_subdev_info *subdevdata;
> > > 
> > >   struct vpif_display_config *config;
> > >   int i, j = 0, k, q, m, err = 0;
> > > 
> > > + unsigned long phys_end_kernel;
> > > 
> > >   struct i2c_adapter *i2c_adap;
> > >   struct common_obj *common;
> > >   struct channel_obj *ch;
> > >   struct video_device *vfd;
> > >   struct resource *res;
> > >   int subdev_count;
> > > 
> > > + size_t size;
> > > 
> > >   vpif_dev = &pdev->dev;
> > > 
> > > @@ -1749,6 +1775,41 @@ static __init int vpif_probe(struct
> > > platform_device
> > > *pdev) ch->video_dev = vfd;
> > > 
> > >   }
> > > 
> > > + /* Initialising the memory from the input arguments file for
> > > +  * contiguous memory buffers and avoid defragmentation
> > > +  */
> > > + if (cont_bufsize) {
> > > + /* attempt to determine the end of Linux kernel memory */
> > > + phys_end_kernel = virt_to_phys((void *)PAGE_OFFSET) +
> > > + (num_physpages << PAGE_SHIFT);
> > > + phys_end_kernel += cont_bufoffset;
> > > + size = cont_bufsize;
> > > +
> > > + err = dma_declare_coherent_memory(&pdev->dev, phys_end_kernel,
> > > + phys_end_kernel, size,
> > > + DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
> > 
> > This is a pretty dangerous hack. You should compute the memory address and
> > size in board code, and pass it to the driver through a device resource
> > (don't forget to call request_mem_region on the resource). I think the
> > dma_declare_coherent_memory() call should be moved to board code as well.
>
> I don't think it is a hack. Since the device does not support scatter gather
> MMU, we need to make sure that the requirement of memory scucceeds for the
> Driver buffers.

If two drivers attempt to do the same you're screwed. That's why this should 
be moved to board code, where memory reservation for all devices that need it 
can be coordinated. You should call dma_declare_coherent_memory() there, not 
in the VPIF driver.

> Here the size is taken as part of module parameters, which If I am right,
> cannot be moved to board file.

Depending on how early you need the information in board code you can use 
early_param(), __setup() or normal module parameter macros in the board code.

> > > + if (!err) {
> > > + dev_err(&pdev->dev, "Unable to declare MMAP memory.\n");
> > > + err = -ENOMEM;
> > > + goto probe_out;
> > > + }
> > > +
> > > + /* The resources are divided into two equal memory and when
> > > +  * we have HD output we can add them together
> > > +  */
> > > + for (j = 0; j < VPIF_DISPLAY_MAX_DEVICES; j++) {
> > > + ch = vpif_obj.dev[j];
> > > + ch->channel_id = j;
> > > +
> > > + /* only enabled if second resource exists */
> > > + config_params.video_limit[ch->channel_id] = 0;
> > > + if (cont_bufsize)
> > > + config_params.video_limit[ch->channel_id] =
> > > + size/2;
> > > + }
> > > + }
> > > +
> > > 
> > >   for (j = 0; j < VPIF_DISPLAY_MAX_DEVICES; j++) {
> > >   
> > >   ch = vpif_obj.dev[j];
> > >   /* Initialize field of the channel objects */ diff --git

-- 
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 0/3] V4L2_CID_PIXEL_RATE support in sensor drivers

2012-05-14 Thread Laurent Pinchart
Hi Sakari,

On Monday 14 May 2012 00:53:36 Sakari Ailus wrote:
> On Wed, May 09, 2012 at 02:55:56PM +0200, Laurent Pinchart wrote:
> > Hi everybody,
> > 
> > This patch implements support for the V4L2_CID_PIXEL_RATE control in the
> > mt9t001, mt9p031 and mt9m032 sensor drivers.
> > 
> > Recent changes to the OMAP3 ISP driver (see the media-for-3.5 branch in
> > the http://git.linuxtv.org/sailus/media_tree.git repository) made support
> > for that control mandatory for sensor drivers that are to be used with the
> > OMAP3 ISP.
> > 
> > Sakari, would you like to take these patches in your tree and push them
> > for v3.5 ? V4L2_CID_PIXEL_RATE support for the mt9v032 driver is also
> > still missing, the patch you've sent to the list two months ago needs to
> > be rebased. Will you do that or should I do it ? I'm also wondering
> > whether that patch shouldn't mark the V4L2_CID_PIXEL_RATE control as
> > volatile, calling v4l2_s_ext_ctrls() from inside the driver looks quite
> > hackish to> me. The alternative would be to create a 64-bit version of
> > v4l2_ctrl_s_ctrl().
> >
> > Laurent Pinchart (3):
> >   mt9t001: Implement V4L2_CID_PIXEL_RATE control
> >   mt9p031: Implement V4L2_CID_PIXEL_RATE control
> >   mt9m032: Implement V4L2_CID_PIXEL_RATE control
> >  
> >  drivers/media/video/mt9m032.c |   13 +++--
> >  drivers/media/video/mt9p031.c |5 -
> >  drivers/media/video/mt9t001.c |   13 +++--
> >  include/media/mt9t001.h   |1 +
> >  4 files changed, 27 insertions(+), 5 deletions(-)
> 
> Acked-by: Sakari Ailus 

Thank you. Ad the patches depend on the V4L2_CID_PIXEL_RATE control, could you 
please take them in your tree and push them for v3.5 ?

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