Re: [patch] [media] davinci: remove an unneeded check

2014-09-22 Thread Prabhakar Lad
Hi Dan,

Thanks for the patch!

On Mon, Sep 22, 2014 at 9:00 AM, Dan Carpenter  wrote:
> We don't need to check "ret", we know it's zero.
>
> Signed-off-by: Dan Carpenter 

Acked-by: Lad, Prabhakar 

Regards,
--Prabhakar Lad

>
> diff --git a/drivers/media/platform/davinci/vpfe_capture.c 
> b/drivers/media/platform/davinci/vpfe_capture.c
> index c557eb5..3eb6e4b 100644
> --- a/drivers/media/platform/davinci/vpfe_capture.c
> +++ b/drivers/media/platform/davinci/vpfe_capture.c
> @@ -442,11 +442,10 @@ static int vpfe_config_image_format(struct vpfe_device 
> *vpfe_dev,
> return ret;
>
> /* Update the values of sizeimage and bytesperline */
> -   if (!ret) {
> -   pix->bytesperline = ccdc_dev->hw_ops.get_line_length();
> -   pix->sizeimage = pix->bytesperline * pix->height;
> -   }
> -   return ret;
> +   pix->bytesperline = ccdc_dev->hw_ops.get_line_length();
> +   pix->sizeimage = pix->bytesperline * pix->height;
> +
> +   return 0;
>  }
>
>  static int vpfe_initialize_device(struct vpfe_device *vpfe_dev)
--
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] videobuf-dma-contig: replace vm_iomap_memory() with remap_pfn_range().

2014-09-22 Thread Hans Verkuil
Hi Fancy Fang,

I do have a few comments:

1) One reason why the switch to vm_iomap_memory() was made originally was that
that function did a bunch of sanity checks. Since this patch moves back to
remap_pfn_range() those sanity checks are lost and should be reinstated.

2) You need Marek's Ack as well since he understands the memory code much
better than I do.

3) There are efforts underway to make a modern i.mx6 video driver based on
vb2 and all the other modern V4L2 APIs, wouldn't it be much better if freescale
jumps on board and starts working on that code as well? See e.g. this mail
thread: http://www.spinics.net/lists/linux-media/msg79078.html

I assume this refers to the same hardware. The official freescale driver
for that hardware is horrendous.

If you are writing code for unrelated hardware, then you should move over to
vb2 yourself. videobuf should not be used anymore for new drivers.

4) I still do not entirely understand the control flow and I will have to take
another look. I'll see if I can do that tomorrow.

Regards,

Hans

On 09/23/2014 05:11 AM, chen.f...@freescale.com wrote:
> Hans,
> Do you have any more comment on this patch?
> 
> Best regards,
> Fancy Fang
> 
> -Original Message-
> From: Fang Chen-B47543 
> Sent: Wednesday, September 10, 2014 3:29 PM
> To: 'Hans Verkuil'; m.che...@samsung.com; v...@zeniv.linux.org.uk
> Cc: Guo Shawn-R65073; linux-media@vger.kernel.org; 
> linux-ker...@vger.kernel.org; Marek Szyprowski
> Subject: RE: [PATCH] [media] videobuf-dma-contig: replace vm_iomap_memory() 
> with remap_pfn_range().
> 
> On the Freescale imx6 platform which belongs to ARM architecture. The driver 
> is our local v4l2 output driver which is not upstream yet unfortunately.
> 
> Best regards,
> Fancy Fang
> 
> -Original Message-
> From: Hans Verkuil [mailto:hverk...@xs4all.nl]
> Sent: Wednesday, September 10, 2014 3:21 PM
> To: Fang Chen-B47543; m.che...@samsung.com; v...@zeniv.linux.org.uk
> Cc: Guo Shawn-R65073; linux-media@vger.kernel.org; 
> linux-ker...@vger.kernel.org; Marek Szyprowski
> Subject: Re: [PATCH] [media] videobuf-dma-contig: replace vm_iomap_memory() 
> with remap_pfn_range().
> 
> On 09/10/14 09:14, chen.f...@freescale.com wrote:
>> It is not a theoretically issue, it is a real case that the mapping failed 
>> issue happens in 3.14.y kernel but not happens in previous 3.10.y kernel.
>> So I need your confirmation on it.
> 
> With which driver does this happen? On which architecture?
> 
> Regards,
> 
>   Hans
> 
>>
>> Thanks.
>>
>> Best regards,
>> Fancy Fang
>>
>> -Original Message-
>> From: Hans Verkuil [mailto:hverk...@xs4all.nl]
>> Sent: Wednesday, September 10, 2014 3:01 PM
>> To: Fang Chen-B47543; m.che...@samsung.com; v...@zeniv.linux.org.uk
>> Cc: Guo Shawn-R65073; linux-media@vger.kernel.org; 
>> linux-ker...@vger.kernel.org; Marek Szyprowski
>> Subject: Re: [PATCH] [media] videobuf-dma-contig: replace vm_iomap_memory() 
>> with remap_pfn_range().
>>
>> On 09/10/14 07:28, Fancy Fang wrote:
>>> When user requests V4L2_MEMORY_MMAP type buffers, the videobuf-core 
>>> will assign the corresponding offset to the 'boff' field of the 
>>> videobuf_buffer for each requested buffer sequentially. Later, user 
>>> may call mmap() to map one or all of the buffers with the 'offset'
>>> parameter which is equal to its 'boff' value. Obviously, the 'offset'
>>> value is only used to find the matched buffer instead of to be the 
>>> real offset from the buffer's physical start address as used by 
>>> vm_iomap_memory(). So, in some case that if the offset is not zero,
>>> vm_iomap_memory() will fail.
>>
>> Is this just a fix for something that can fail theoretically, or do you 
>> actually have a case where this happens? I am very reluctant to make any 
>> changes to videobuf. Drivers should all migrate to vb2.
>>
>> I have CC-ed Marek as well since he knows a lot more about this stuff than I 
>> do.
>>
>> Regards,
>>
>>  Hans
>>
>>>
>>> Signed-off-by: Fancy Fang 
>>> ---
>>>  drivers/media/v4l2-core/videobuf-dma-contig.c | 4 +++-
>>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/media/v4l2-core/videobuf-dma-contig.c
>>> b/drivers/media/v4l2-core/videobuf-dma-contig.c
>>> index bf80f0f..8bd9889 100644
>>> --- a/drivers/media/v4l2-core/videobuf-dma-contig.c
>>> +++ b/drivers/media/v4l2-core/videobuf-dma-contig.c
>>> @@ -305,7 +305,9 @@ static int __videobuf_mmap_mapper(struct videobuf_queue 
>>> *q,
>>> /* Try to remap memory */
>>> size = vma->vm_end - vma->vm_start;
>>> vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
>>> -   retval = vm_iomap_memory(vma, mem->dma_handle, size);
>>> +   retval = remap_pfn_range(vma, vma->vm_start,
>>> +mem->dma_handle >> PAGE_SHIFT,
>>> +size, vma->vm_page_prot);
>>> if (retval) {
>>> dev_err(q->dev, "mmap: remap failed with error %d. ",
>>> retval);
>>>
>>
>

Re: [PATCH 7/7] si2165: do load firmware without extra header

2014-09-22 Thread Matthias Schwarzott
On 23.09.2014 00:58, Mauro Carvalho Chehab wrote:
> Em Sun, 31 Aug 2014 13:35:12 +0200
> Matthias Schwarzott  escreveu:
> 
>> The new file has a different name: dvb-demod-si2165-D.fw
>>
>> Count blocks instead of reading count from extra header.
>> Calculate CRC during upload and compare result to what chip calcuated.
>> Use 0x01 instead of real patch version, because this is only used to
>> check if something was uploaded but not to check the version of it.
>>
>> Signed-off-by: Matthias Schwarzott 
>> ---
> 
> ...
> 
>> diff --git a/drivers/media/dvb-frontends/si2165_priv.h 
>> b/drivers/media/dvb-frontends/si2165_priv.h
>> index 2b70cf1..fd778dc 100644
>> --- a/drivers/media/dvb-frontends/si2165_priv.h
>> +++ b/drivers/media/dvb-frontends/si2165_priv.h
>> @@ -18,6 +18,6 @@
>>  #ifndef _DVB_SI2165_PRIV
>>  #define _DVB_SI2165_PRIV
>>  
>> -#define SI2165_FIRMWARE_REV_D "dvb-demod-si2165.fw"
>> +#define SI2165_FIRMWARE_REV_D "dvb-demod-si2165-D.fw"
> 
> Please, don't do that. Changing the name of the firmware and breaking
> the format is a bad idea, specially since you're not supporting anymore
> the legacy one.
> 
> I would be ok if you were not breaking support for the old firmware
> file.
> 
Hmm, there is no kernel yet that contains this driver.
And the firmware is identical, just the header is missing.
Do I really have to support both then?

> Also, better to use lowercase for the firmware name.

Ok, I will change the "D" to lower-case.

> 
> PS.: I'm not applying patch 6/7 as this got rejected.

Ok, I will resend patch 6 and eventually 7.

Regards
Matthias
--
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] videobuf-dma-contig: replace vm_iomap_memory() with remap_pfn_range().

2014-09-22 Thread chen.f...@freescale.com
Hans,
Do you have any more comment on this patch?

Best regards,
Fancy Fang

-Original Message-
From: Fang Chen-B47543 
Sent: Wednesday, September 10, 2014 3:29 PM
To: 'Hans Verkuil'; m.che...@samsung.com; v...@zeniv.linux.org.uk
Cc: Guo Shawn-R65073; linux-media@vger.kernel.org; 
linux-ker...@vger.kernel.org; Marek Szyprowski
Subject: RE: [PATCH] [media] videobuf-dma-contig: replace vm_iomap_memory() 
with remap_pfn_range().

On the Freescale imx6 platform which belongs to ARM architecture. The driver is 
our local v4l2 output driver which is not upstream yet unfortunately.

Best regards,
Fancy Fang

-Original Message-
From: Hans Verkuil [mailto:hverk...@xs4all.nl]
Sent: Wednesday, September 10, 2014 3:21 PM
To: Fang Chen-B47543; m.che...@samsung.com; v...@zeniv.linux.org.uk
Cc: Guo Shawn-R65073; linux-media@vger.kernel.org; 
linux-ker...@vger.kernel.org; Marek Szyprowski
Subject: Re: [PATCH] [media] videobuf-dma-contig: replace vm_iomap_memory() 
with remap_pfn_range().

On 09/10/14 09:14, chen.f...@freescale.com wrote:
> It is not a theoretically issue, it is a real case that the mapping failed 
> issue happens in 3.14.y kernel but not happens in previous 3.10.y kernel.
> So I need your confirmation on it.

With which driver does this happen? On which architecture?

Regards,

Hans

> 
> Thanks.
> 
> Best regards,
> Fancy Fang
> 
> -Original Message-
> From: Hans Verkuil [mailto:hverk...@xs4all.nl]
> Sent: Wednesday, September 10, 2014 3:01 PM
> To: Fang Chen-B47543; m.che...@samsung.com; v...@zeniv.linux.org.uk
> Cc: Guo Shawn-R65073; linux-media@vger.kernel.org; 
> linux-ker...@vger.kernel.org; Marek Szyprowski
> Subject: Re: [PATCH] [media] videobuf-dma-contig: replace vm_iomap_memory() 
> with remap_pfn_range().
> 
> On 09/10/14 07:28, Fancy Fang wrote:
>> When user requests V4L2_MEMORY_MMAP type buffers, the videobuf-core 
>> will assign the corresponding offset to the 'boff' field of the 
>> videobuf_buffer for each requested buffer sequentially. Later, user 
>> may call mmap() to map one or all of the buffers with the 'offset'
>> parameter which is equal to its 'boff' value. Obviously, the 'offset'
>> value is only used to find the matched buffer instead of to be the 
>> real offset from the buffer's physical start address as used by 
>> vm_iomap_memory(). So, in some case that if the offset is not zero,
>> vm_iomap_memory() will fail.
> 
> Is this just a fix for something that can fail theoretically, or do you 
> actually have a case where this happens? I am very reluctant to make any 
> changes to videobuf. Drivers should all migrate to vb2.
> 
> I have CC-ed Marek as well since he knows a lot more about this stuff than I 
> do.
> 
> Regards,
> 
>   Hans
> 
>>
>> Signed-off-by: Fancy Fang 
>> ---
>>  drivers/media/v4l2-core/videobuf-dma-contig.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/v4l2-core/videobuf-dma-contig.c
>> b/drivers/media/v4l2-core/videobuf-dma-contig.c
>> index bf80f0f..8bd9889 100644
>> --- a/drivers/media/v4l2-core/videobuf-dma-contig.c
>> +++ b/drivers/media/v4l2-core/videobuf-dma-contig.c
>> @@ -305,7 +305,9 @@ static int __videobuf_mmap_mapper(struct videobuf_queue 
>> *q,
>>  /* Try to remap memory */
>>  size = vma->vm_end - vma->vm_start;
>>  vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
>> -retval = vm_iomap_memory(vma, mem->dma_handle, size);
>> +retval = remap_pfn_range(vma, vma->vm_start,
>> + mem->dma_handle >> PAGE_SHIFT,
>> + size, vma->vm_page_prot);
>>  if (retval) {
>>  dev_err(q->dev, "mmap: remap failed with error %d. ",
>>  retval);
>>
> 

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

2014-09-22 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:   Tue Sep 23 04:00:19 CEST 2014
git branch: test
git hash:   c0aaf696d45e2a72048a56441e81dad78659c698
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-20-g7abd8a7
host hardware:  x86_64
host os:3.16-2.slh.3-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: WARNINGS
linux-2.6.32.27-i686: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: WARNINGS
linux-3.12.23-i686: WARNINGS
linux-3.13.11-i686: WARNINGS
linux-3.14.9-i686: WARNINGS
linux-3.15.2-i686: WARNINGS
linux-3.16-i686: WARNINGS
linux-3.17-rc1-i686: WARNINGS
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: WARNINGS
linux-3.12.23-x86_64: WARNINGS
linux-3.13.11-x86_64: WARNINGS
linux-3.14.9-x86_64: WARNINGS
linux-3.15.2-x86_64: WARNINGS
linux-3.16-x86_64: WARNINGS
linux-3.17-rc1-x86_64: WARNINGS
apps: OK
spec-git: OK
sparse: ERRORS
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

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


[linuxtv-media:devel-3.17-rc6 491/499] drivers/media/usb/em28xx/em28xx.h:787:2: warning: 'vid' may be used uninitialized in this function

2014-09-22 Thread kbuild test robot
tree:   git://linuxtv.org/media_tree.git devel-3.17-rc6
head:   7f8de65b0dc84c19e79d7a642a5655524c57035c
commit: f5ac7a471e156f997833f94bad2228e57122c227 [491/499] [media] em28xx: 
remove some unnecessary fields from struct em28xx_audio_mode
config: i386-randconfig-r0-0923 (attached as .config)
reproduce:
  git checkout f5ac7a471e156f997833f94bad2228e57122c227
  # save the attached .config to linux build tree
  make ARCH=i386 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings:

   In file included from drivers/media/usb/em28xx/em28xx-core.c:35:0:
   drivers/media/usb/em28xx/em28xx-core.c: In function 'em28xx_audio_setup':
>> drivers/media/usb/em28xx/em28xx.h:787:2: warning: 'vid' may be used 
>> uninitialized in this function [-Wmaybe-uninitialized]
 printk(KERN_INFO "%s: "fmt,\
 ^
   drivers/media/usb/em28xx/em28xx-core.c:507:6: note: 'vid' was declared here
 u32 vid;
 ^

vim +/vid +787 drivers/media/usb/em28xx/em28xx.h

47677e51 drivers/media/usb/em28xx/em28xx.h   Mauro Carvalho Chehab 2014-03-05  
771  void em28xx_free_device(struct kref *ref);
c8793b03 drivers/media/video/em28xx/em28xx.h Mauro Carvalho Chehab 2008-01-13  
772  
855ff38e drivers/media/usb/em28xx/em28xx.h   Frank Schaefer2013-03-27  
773  /* Provided by em28xx-camera.c */
855ff38e drivers/media/usb/em28xx/em28xx.h   Frank Schaefer2013-03-27  
774  int em28xx_detect_sensor(struct em28xx *dev);
855ff38e drivers/media/usb/em28xx/em28xx.h   Frank Schaefer2013-03-27  
775  int em28xx_init_camera(struct em28xx *dev);
855ff38e drivers/media/usb/em28xx/em28xx.h   Frank Schaefer2013-03-27  
776  
a6c2ba28 drivers/media/video/em28xx/em28xx.h Andrew Morton 2005-11-08  
777  /* printk macros */
a6c2ba28 drivers/media/video/em28xx/em28xx.h Andrew Morton 2005-11-08  
778  
3acf2809 drivers/media/video/em28xx/em28xx.h Mauro Carvalho Chehab 2005-11-08  
779  #define em28xx_err(fmt, arg...) do {\
a6c2ba28 drivers/media/video/em28xx/em28xx.h Andrew Morton 2005-11-08  
780  printk(KERN_ERR fmt , ##arg); } while (0)
a6c2ba28 drivers/media/video/em28xx/em28xx.h Andrew Morton 2005-11-08  
781  
3acf2809 drivers/media/video/em28xx/em28xx.h Mauro Carvalho Chehab 2005-11-08  
782  #define em28xx_errdev(fmt, arg...) do {\
a6c2ba28 drivers/media/video/em28xx/em28xx.h Andrew Morton 2005-11-08  
783  printk(KERN_ERR "%s: "fmt,\
a6c2ba28 drivers/media/video/em28xx/em28xx.h Andrew Morton 2005-11-08  
784  dev->name , ##arg); } while (0)
a6c2ba28 drivers/media/video/em28xx/em28xx.h Andrew Morton 2005-11-08  
785  
3acf2809 drivers/media/video/em28xx/em28xx.h Mauro Carvalho Chehab 2005-11-08  
786  #define em28xx_info(fmt, arg...) do {\
a6c2ba28 drivers/media/video/em28xx/em28xx.h Andrew Morton 2005-11-08 
@787  printk(KERN_INFO "%s: "fmt,\
a6c2ba28 drivers/media/video/em28xx/em28xx.h Andrew Morton 2005-11-08  
788  dev->name , ##arg); } while (0)
3acf2809 drivers/media/video/em28xx/em28xx.h Mauro Carvalho Chehab 2005-11-08  
789  #define em28xx_warn(fmt, arg...) do {\
a6c2ba28 drivers/media/video/em28xx/em28xx.h Andrew Morton 2005-11-08  
790  printk(KERN_WARNING "%s: "fmt,\
a6c2ba28 drivers/media/video/em28xx/em28xx.h Andrew Morton 2005-11-08  
791  dev->name , ##arg); } while (0)
a6c2ba28 drivers/media/video/em28xx/em28xx.h Andrew Morton 2005-11-08  
792  
a6c2ba28 drivers/media/video/em28xx/em28xx.h Andrew Morton 2005-11-08  
793  #endif

:: The code at line 787 was first introduced by commit
:: a6c2ba283565dbc9f055dcb2ecba1971460bb535 [PATCH] v4l: 716: support for 
em28xx board family

:: TO: a...@osdl.org 
:: CC: Linus Torvalds 

---
0-DAY kernel build testing backend  Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
#
# Automatically generated file; DO NOT EDIT.
# Linux/i386 3.17.0-rc5 Kernel Configuration
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf32-i386"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig"
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_MMU=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ARCH_HAS_CPU_RELAX=y
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
# CONFIG_ZONE_DMA32 is not set
# CONFIG_AUDIT_ARCH is not set
CONFIG_ARCH_SUPPORTS_OPTI

[PATCH v2] media: tuner xc5000 - release firmwware from xc5000_release()

2014-09-22 Thread Shuah Khan
xc5000 releases firmware right after loading it. Change it to
save the firmware and release it from xc5000_release(). This
helps avoid fecthing firmware when forced firmware load requests
come in to change analog tv frequence and when firmware needs to
be reloaded after suspend and resume.

Signed-off-by: Shuah Khan 
---

patch v2: fixes issues found in patch v1 review

 drivers/media/tuners/xc5000.c |   34 --
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/drivers/media/tuners/xc5000.c b/drivers/media/tuners/xc5000.c
index 512fe50..b72ec64 100644
--- a/drivers/media/tuners/xc5000.c
+++ b/drivers/media/tuners/xc5000.c
@@ -70,6 +70,8 @@ struct xc5000_priv {
 
struct dvb_frontend *fe;
struct delayed_work timer_sleep;
+
+   const struct firmware   *firmware;
 };
 
 /* Misc Defines */
@@ -1136,20 +1138,23 @@ static int xc_load_fw_and_init_tuner(struct 
dvb_frontend *fe, int force)
if (!force && xc5000_is_firmware_loaded(fe) == 0)
return 0;
 
-   ret = request_firmware(&fw, desired_fw->name,
-  priv->i2c_props.adap->dev.parent);
-   if (ret) {
-   printk(KERN_ERR "xc5000: Upload failed. (file not found?)\n");
-   return ret;
-   }
-
-   dprintk(1, "firmware read %Zu bytes.\n", fw->size);
+   if (!priv->firmware) {
+   ret = request_firmware(&fw, desired_fw->name,
+   priv->i2c_props.adap->dev.parent);
+   if (ret) {
+   pr_err("xc5000: Upload failed. rc %d\n", ret);
+   return ret;
+   }
+   dprintk(1, "firmware read %Zu bytes.\n", fw->size);
 
-   if (fw->size != desired_fw->size) {
-   printk(KERN_ERR "xc5000: Firmware file with incorrect size\n");
-   ret = -EINVAL;
-   goto err;
-   }
+   if (fw->size != desired_fw->size) {
+   pr_err("xc5000: Firmware file with incorrect size\n");
+   release_firmware(fw);
+   return -EINVAL;
+   }
+   priv->firmware = fw;
+   } else
+   fw = priv->firmware;
 
/* Try up to 5 times to load firmware */
for (i = 0; i < 5; i++) {
@@ -1232,7 +1237,6 @@ err:
else
printk(KERN_CONT " - too many retries. Giving up\n");
 
-   release_firmware(fw);
return ret;
 }
 
@@ -1316,6 +1320,8 @@ static int xc5000_release(struct dvb_frontend *fe)
if (priv) {
cancel_delayed_work(&priv->timer_sleep);
hybrid_tuner_release_state(priv);
+   if (priv->firmware)
+   release_firmware(priv->firmware);
}
 
mutex_unlock(&xc5000_list_mutex);
-- 
1.7.10.4

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


Re: [PATCH 4/4] em28xx: get rid of structs em28xx_ac97_mode and em28xx_audio_mode

2014-09-22 Thread Mauro Carvalho Chehab
Em Sat, 13 Sep 2014 10:52:22 +0200
Frank Schäfer  escreveu:

> Now that we have enum em28xx_int_audio (none/i2s/ac97), it is no longer
> necessary to check dev->audio_mode.ac97 to determine the type of internal 
> audio connection.
> There is also no need to save the type of the detected AC97 chip.

Removing the AC97 chip is a bad idea, as the mux of each AC97 device
is different.

I don't remember anymore what device comes with the sigmatel chips,
but it does have a different mixer than em202. The logic to set it
different is not there basically for two reasons:

1) I don't have the device with sigmatel (I think someone borrowed it to me
at that time, and for a very limited period of time);

2) there's a hole ac97 support at /sound. The idea is to re-use it instead
of reinventing the wheel, but that requires time and a few different AC97
setups.

Btw, there are other em28xx devices with other non-em202 AC97 chips out
there, with different settings (and even different sampling rates).
Those AC97 devices are generally found at the "grabber" devices.

Regards,
Mauro

> 
> So replce the remaining checks of dev->audio_mode.ac97 with equivalent checks
> of dev->int_audio_type and get rid of struct em28xx_ac97_mode and finally the
> whole struct em28xx_audio_mode.
> 
> Signed-off-by: Frank Schäfer 
> ---
>  drivers/media/usb/em28xx/em28xx-audio.c |  2 +-
>  drivers/media/usb/em28xx/em28xx-core.c  | 36 
> ++---
>  drivers/media/usb/em28xx/em28xx-video.c |  2 +-
>  drivers/media/usb/em28xx/em28xx.h   | 13 
>  4 files changed, 8 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
> b/drivers/media/usb/em28xx/em28xx-audio.c
> index 90c7a83..c3a4224 100644
> --- a/drivers/media/usb/em28xx/em28xx-audio.c
> +++ b/drivers/media/usb/em28xx/em28xx-audio.c
> @@ -933,7 +933,7 @@ static int em28xx_audio_init(struct em28xx *dev)
>  
>   INIT_WORK(&adev->wq_trigger, audio_trigger);
>  
> - if (dev->audio_mode.ac97 != EM28XX_NO_AC97) {
> + if (dev->int_audio_type == EM28XX_INT_AUDIO_AC97) {
>   em28xx_cvol_new(card, dev, "Video", AC97_VIDEO);
>   em28xx_cvol_new(card, dev, "Line In", AC97_LINE);
>   em28xx_cvol_new(card, dev, "Phone", AC97_PHONE);
> diff --git a/drivers/media/usb/em28xx/em28xx-core.c 
> b/drivers/media/usb/em28xx/em28xx-core.c
> index ed83e4e..7464e70 100644
> --- a/drivers/media/usb/em28xx/em28xx-core.c
> +++ b/drivers/media/usb/em28xx/em28xx-core.c
> @@ -405,12 +405,8 @@ static int em28xx_set_audio_source(struct em28xx *dev)
>   return ret;
>   msleep(5);
>  
> - switch (dev->audio_mode.ac97) {
> - case EM28XX_NO_AC97:
> - break;
> - default:
> + if (dev->int_audio_type == EM28XX_INT_AUDIO_AC97)
>   ret = set_ac97_input(dev);
> - }
>  
>   return ret;
>  }
> @@ -439,7 +435,7 @@ int em28xx_audio_analog_set(struct em28xx *dev)
>   /* It is assumed that all devices use master volume for output.
>  It would be possible to use also line output.
>*/
> - if (dev->audio_mode.ac97 != EM28XX_NO_AC97) {
> + if (dev->int_audio_type == EM28XX_INT_AUDIO_AC97) {
>   /* Mute all outputs */
>   for (i = 0; i < ARRAY_SIZE(outputs); i++) {
>   ret = em28xx_write_ac97(dev, outputs[i].reg, 0x8000);
> @@ -462,7 +458,7 @@ int em28xx_audio_analog_set(struct em28xx *dev)
>   ret = em28xx_set_audio_source(dev);
>  
>   /* Sets volume */
> - if (dev->audio_mode.ac97 != EM28XX_NO_AC97) {
> + if (dev->int_audio_type == EM28XX_INT_AUDIO_AC97) {
>   int vol;
>  
>   em28xx_write_ac97(dev, AC97_POWERDOWN, 0x4200);
> @@ -544,14 +540,11 @@ int em28xx_audio_setup(struct em28xx *dev)
>   em28xx_info("I2S Audio (%d sample rate(s))\n",
>  i2s_samplerates);
>   /* Skip the code that does AC97 vendor detection */
> - dev->audio_mode.ac97 = EM28XX_NO_AC97;
>   goto init_audio;
>   } else {
>   dev->int_audio_type = EM28XX_INT_AUDIO_AC97;
>   }
>  
> - dev->audio_mode.ac97 = EM28XX_AC97_OTHER;
> -
>   vid1 = em28xx_read_ac97(dev, AC97_VENDOR_ID1);
>   if (vid1 < 0) {
>   /*
> @@ -560,7 +553,6 @@ int em28xx_audio_setup(struct em28xx *dev)
>*   CHIPCFG register, even not having an AC97 chip
>*/
>   em28xx_warn("AC97 chip type couldn't be determined\n");
> - dev->audio_mode.ac97 = EM28XX_NO_AC97;
>   if (dev->usb_audio_type == EM28XX_USB_AUDIO_VENDOR)
>   dev->usb_audio_type = EM28XX_USB_AUDIO_NONE;
>   dev->int_audio_type = EM28XX_INT_AUDIO_NONE;
> @@ -582,30 +574,14 @@ int em28xx_audio_setup(struct em28xx *dev)
>  
>   /* Try to identify what audio processor we have */
>   if (((vid == 0x) || (vid ==

Re: [PATCH] Si2165: Add experimental DVB-C support for HVR-4400/HVR-5500

2014-09-22 Thread Mauro Carvalho Chehab
Em Tue,  9 Sep 2014 21:31:58 +0200
Matthias Schwarzott  escreveu:

> This patch is sent out, because I got multiple requests for it.
> So here it is.
> 
> It works only for HVR-4400/HVR-5500.
> For WinTV-HVR-930C-HD it fails with bad/no reception for unknown reasons.

There are some coding style issues on this patch, like the usage of // for
comments and some bad whitespacing...

> 
> Signed-off-by: Matthias Schwarzott 
> ---
>  drivers/media/dvb-frontends/si2165.c | 132 
> +--
>  1 file changed, 125 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/dvb-frontends/si2165.c 
> b/drivers/media/dvb-frontends/si2165.c
> index c807180..660298b 100644
> --- a/drivers/media/dvb-frontends/si2165.c
> +++ b/drivers/media/dvb-frontends/si2165.c
> @@ -781,7 +781,7 @@ static int si2165_set_if_freq_shift(struct si2165_state 
> *state, u32 IF)
>   return si2165_writereg32(state, 0x00e8, reg_value);
>  }
>  
> -static int si2165_set_parameters(struct dvb_frontend *fe)
> +static int si2165_set_parameters_t(struct dvb_frontend *fe)
>  {
>   int ret;
>   struct dtv_frontend_properties *p = &fe->dtv_property_cache;
> @@ -929,6 +929,119 @@ static int si2165_set_parameters(struct dvb_frontend 
> *fe)
>   return 0;
>  }
>  
> +static int si2165_set_parameters_c(struct dvb_frontend *fe)
> +{
> + struct dtv_frontend_properties *p = &fe->dtv_property_cache;
> + struct si2165_state *state = fe->demodulator_priv;
> + u8 val[3];
> + u32 IF;
> +
> + if (!state->has_dvbc)
> + return -EINVAL;
> +
> + si2165_writereg8(state, 0x00e0, 0x00);
> +
> + si2165_readreg8(state, 0x0118, val); /* returned 0x07 */

Huh? I didn't understand the comment. The same applies to other similar
comments.

> + 
> + si2165_writereg8(state, 0x012a, 0x46);
> + si2165_writereg8(state, 0x012c, 0x00);
> + si2165_writereg8(state, 0x012e, 0x0a);
> + si2165_writereg8(state, 0x012f, 0xff);
> + si2165_writereg8(state, 0x0123, 0x70);
> + {
> +   si2165_writereg8(state, 0x00ec, 0x05);
> +   si2165_adjust_pll_divl(state, 0x0e);
> + }

Also, why are you adding those { } here? Same applies to other
similar blocks.

> + si2165_readreg8(state, 0x00e0, val); /* returned 0x00 */
> + {
> +   si2165_writereg32(state, 0x00e8, 0x02db6db6);
> + }
> + si2165_writereg8(state, 0x08f8, 0x00);
> + si2165_readreg8(state, 0x04e4, val); /* returned 0x21 */
> + si2165_writereg8(state, 0x04e4, 0x20); // clear bit 1
> + si2165_writereg16(state, 0x04ef, 0x00fe);
> + si2165_writereg24(state, 0x04f4, 0x55);
> + si2165_readreg8(state, 0x04e4, val); /* returned 0x20 */
> + si2165_writereg8(state, 0x04e4, 0x20);
> + si2165_readreg8(state, 0x04e5, val); /* returned 0x03 */
> + si2165_writereg8(state, 0x04e5, 0x03);
> + si2165_readreg8(state, 0x04e5, val); /* returned 0x03 */
> + si2165_writereg8(state, 0x04e5, 0x01);
> + {
> +   si2165_writereg32(state, 0x00e4, 0x0494f77e);
> +   si2165_writereg8(state, 0x016e, 0x50);
> + }
> + si2165_writereg8(state, 0x016c, 0x0e);
> + si2165_writereg8(state, 0x016d, 0x10);
> + si2165_writereg8(state, 0x015b, 0x03);
> + {
> +   si2165_writereg8(state, 0x0150, 0x68);
> +   si2165_writereg8(state, 0x01a0, 0x68);
> +   si2165_writereg8(state, 0x01c8, 0x50);
> +   si2165_readreg8(state, 0x0278, val); /* returned 0x0d */
> +   si2165_writereg8(state, 0x0278, 0x0d);
> +   si2165_writereg8(state, 0x023a, 0x05); // or 0x05
> +   si2165_writereg8(state, 0x0261, 0x09);
> +   si2165_writereg16(state, 0x0350, 0x3e80);
> +   si2165_writereg8(state, 0x02f4, 0x00);
> + }
> + si2165_writereg32(state, 0x0348, 0xf400);
> + {
> +   si2165_writereg32(state, 0x00c4, 0x007a1200);
> +   si2165_writereg8(state, 0x00cb, 0x01);
> +   si2165_writereg8(state, 0x00c0, 0x00);
> +   si2165_writereg8(state, 0x012a, 0x46);
> +   si2165_writereg8(state, 0x012c, 0x00);
> +   si2165_writereg8(state, 0x012e, 0x0a);
> +   si2165_writereg8(state, 0x012f, 0xff);
> +   si2165_writereg8(state, 0x0123, 0x70);
> +   si2165_writereg16(state, 0x024c, 0x);
> +   si2165_writereg16(state, 0x027c, 0x);
> +   si2165_writereg8(state, 0x0232, 0x03);
> +   si2165_writereg8(state, 0x02f4, 0x0b);
> +   si2165_writereg32(state, 0x00e4, 0x040ed730); // or 0x040ed730
> +   si2165_writereg8(state, 0x00c0, 0x00);
> +   si2165_readreg8(state, 0x0118, val); /* returned 0x07 */
> +   si2165_writereg8(state, 0x018b, 0x00);
> + }
> +
> + if (!fe->ops.tuner_ops.get_if_frequency) {
> + pr_err("Error: get_if_frequency() not defined at tuner. Can't 
> work without it!\n");
> + return -EINVAL;
> + }
> +
> + if (fe->ops.tuner_ops.set_params)
> + fe->ops.tuner_ops.set_params(fe);
> + 
> + fe->ops.tuner_ops.get_if_frequency(fe, 

Re: [PATCH 7/7] si2165: do load firmware without extra header

2014-09-22 Thread Mauro Carvalho Chehab
Em Sun, 31 Aug 2014 13:35:12 +0200
Matthias Schwarzott  escreveu:

> The new file has a different name: dvb-demod-si2165-D.fw
> 
> Count blocks instead of reading count from extra header.
> Calculate CRC during upload and compare result to what chip calcuated.
> Use 0x01 instead of real patch version, because this is only used to
> check if something was uploaded but not to check the version of it.
> 
> Signed-off-by: Matthias Schwarzott 
> ---

...

> diff --git a/drivers/media/dvb-frontends/si2165_priv.h 
> b/drivers/media/dvb-frontends/si2165_priv.h
> index 2b70cf1..fd778dc 100644
> --- a/drivers/media/dvb-frontends/si2165_priv.h
> +++ b/drivers/media/dvb-frontends/si2165_priv.h
> @@ -18,6 +18,6 @@
>  #ifndef _DVB_SI2165_PRIV
>  #define _DVB_SI2165_PRIV
>  
> -#define SI2165_FIRMWARE_REV_D "dvb-demod-si2165.fw"
> +#define SI2165_FIRMWARE_REV_D "dvb-demod-si2165-D.fw"

Please, don't do that. Changing the name of the firmware and breaking
the format is a bad idea, specially since you're not supporting anymore
the legacy one.

I would be ok if you were not breaking support for the old firmware
file.

Also, better to use lowercase for the firmware name.

PS.: I'm not applying patch 6/7 as this got rejected.

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: [PATCH 0/3] media:st-rc: Misc fixes.

2014-09-22 Thread Mauro Carvalho Chehab
Em Mon, 22 Sep 2014 23:21:41 +0100
Srinivas Kandagatla  escreveu:

> Hi Mauro,
> 
> Thankyou for the "[media] enable COMPILE_TEST for media drivers" patch
> which picked up few things in st-rc driver in linux-next testing.

Anytime. Yeah, the idea is to let more people to test and check for
hidden issues there.
> 
> Here is a few minor fixes to the driver, could you consider them for
> the next merge window.

Applied, thanks!

Btw, there are still lots of warnings there produced with smatch:

$ make ARCH=i386 C=1 CF=-D__CHECK_ENDIAN__ CONFIG_DEBUG_SECTION_MISMATCH=y W=1 
CF=-D__CHECK_ENDIAN__ M=drivers/media
drivers/media/rc/st_rc.c:107:38: warning: incorrect type in argument 1 
(different address spaces)
drivers/media/rc/st_rc.c:107:38:expected void const volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:107:38:got void *
drivers/media/rc/st_rc.c:110:53: warning: incorrect type in argument 1 
(different address spaces)
drivers/media/rc/st_rc.c:110:53:expected void const volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:110:53:got void *
drivers/media/rc/st_rc.c:116:54: warning: incorrect type in argument 2 
(different address spaces)
drivers/media/rc/st_rc.c:116:54:expected void volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:116:54:got void *
drivers/media/rc/st_rc.c:120:45: warning: incorrect type in argument 1 
(different address spaces)
drivers/media/rc/st_rc.c:120:45:expected void const volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:120:45:got void *
drivers/media/rc/st_rc.c:121:43: warning: incorrect type in argument 1 
(different address spaces)
drivers/media/rc/st_rc.c:121:43:expected void const volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:121:43:got void *
drivers/media/rc/st_rc.c:150:46: warning: incorrect type in argument 1 
(different address spaces)
drivers/media/rc/st_rc.c:150:46:expected void const volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:150:46:got void *
drivers/media/rc/st_rc.c:153:42: warning: incorrect type in argument 2 
(different address spaces)
drivers/media/rc/st_rc.c:153:42:expected void volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:153:42:got void *
drivers/media/rc/st_rc.c:174:32: warning: incorrect type in argument 2 
(different address spaces)
drivers/media/rc/st_rc.c:174:32:expected void volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:174:32:got void *
drivers/media/rc/st_rc.c:177:48: warning: incorrect type in argument 2 
(different address spaces)
drivers/media/rc/st_rc.c:177:48:expected void volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:177:48:got void *
drivers/media/rc/st_rc.c:187:48: warning: incorrect type in argument 2 
(different address spaces)
drivers/media/rc/st_rc.c:187:48:expected void volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:187:48:got void *
drivers/media/rc/st_rc.c:204:42: warning: incorrect type in argument 2 
(different address spaces)
drivers/media/rc/st_rc.c:204:42:expected void volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:204:42:got void *
drivers/media/rc/st_rc.c:205:35: warning: incorrect type in argument 2 
(different address spaces)
drivers/media/rc/st_rc.c:205:35:expected void volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:205:35:got void *
drivers/media/rc/st_rc.c:215:35: warning: incorrect type in argument 2 
(different address spaces)
drivers/media/rc/st_rc.c:215:35:expected void volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:215:35:got void *
drivers/media/rc/st_rc.c:216:35: warning: incorrect type in argument 2 
(different address spaces)
drivers/media/rc/st_rc.c:216:35:expected void volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:216:35:got void *
drivers/media/rc/st_rc.c:269:22: warning: incorrect type in assignment 
(different address spaces)
drivers/media/rc/st_rc.c:269:22:expected void *base
drivers/media/rc/st_rc.c:269:22:got void [noderef] *
drivers/media/rc/st_rc.c:349:46: warning: incorrect type in argument 2 
(different address spaces)
drivers/media/rc/st_rc.c:349:46:expected void volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:349:46:got void *
drivers/media/rc/st_rc.c:350:46: warning: incorrect type in argument 2 
(different address spaces)
drivers/media/rc/st_rc.c:350:46:expected void volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:350:46:got void *
drivers/media/rc/st_rc.c:371:61: warning: incorrect type in argument 2 
(different address spaces)
drivers/media/rc/st_rc.c:371:61:expected void volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:371:61:got void *
drivers/media/rc/st_rc.c:372:54: warning: incorrect type in argument 2 
(different address spaces)
drivers/media/rc/st_rc.c:372:54:expected void volatile [noderef] 
*addr
drivers/media/rc/st_rc.c:372:54:got void *

Regards,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
M

[PATCH 3/3] media: st-rc: Remove .owner field for driver

2014-09-22 Thread Srinivas Kandagatla
There is no need to init .owner field.

Based on the patch from Peter Griffin 
"mmc: remove .owner field for drivers using module_platform_driver"

This patch removes the superflous .owner field for drivers which
use the module_platform_driver API, as this is overriden in
platform_driver_register anyway."

Signed-off-by: Srinivas Kandagatla 
---
 drivers/media/rc/st_rc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c
index 03bbb09..e309441 100644
--- a/drivers/media/rc/st_rc.c
+++ b/drivers/media/rc/st_rc.c
@@ -392,7 +392,6 @@ MODULE_DEVICE_TABLE(of, st_rc_match);
 static struct platform_driver st_rc_driver = {
.driver = {
.name = IR_ST_NAME,
-   .owner  = THIS_MODULE,
.of_match_table = of_match_ptr(st_rc_match),
.pm = &st_rc_pm_ops,
},
-- 
1.9.1

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


[PATCH 2/3] media: st-rc: move pm ops setup out of conditional compilation.

2014-09-22 Thread Srinivas Kandagatla
This patch moves setting of pm_ops out of the CONFIG_PM_SLEEP condition.
Setting pm ops under CONFIG_PM_SLEEP does not make any sense.
This patch also remove unnecessary also remove CONFIG_PM condition for pm
member in st_rc_driver structure.

Signed-off-by: Srinivas Kandagatla 
---
 drivers/media/rc/st_rc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c
index e0f1312..03bbb09 100644
--- a/drivers/media/rc/st_rc.c
+++ b/drivers/media/rc/st_rc.c
@@ -376,9 +376,10 @@ static int st_rc_resume(struct device *dev)
return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(st_rc_pm_ops, st_rc_suspend, st_rc_resume);
 #endif
 
+static SIMPLE_DEV_PM_OPS(st_rc_pm_ops, st_rc_suspend, st_rc_resume);
+
 #ifdef CONFIG_OF
 static struct of_device_id st_rc_match[] = {
{ .compatible = "st,comms-irb", },
@@ -393,9 +394,7 @@ static struct platform_driver st_rc_driver = {
.name = IR_ST_NAME,
.owner  = THIS_MODULE,
.of_match_table = of_match_ptr(st_rc_match),
-#ifdef CONFIG_PM
.pm = &st_rc_pm_ops,
-#endif
},
.probe = st_rc_probe,
.remove = st_rc_remove,
-- 
1.9.1

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


[PATCH 1/3] media: st-rc: move to using reset_control_get_optional

2014-09-22 Thread Srinivas Kandagatla
This patch fixes a compilation error while building with the
random kernel configuration.

drivers/media/rc/st_rc.c: In function 'st_rc_probe':
drivers/media/rc/st_rc.c:281:2: error: implicit declaration of
function 'reset_control_get' [-Werror=implicit-function-declaration]
  rc_dev->rstc = reset_control_get(dev, NULL);

drivers/media/rc/st_rc.c:281:15: warning: assignment makes pointer
from integer without a cast [enabled by default]
  rc_dev->rstc = reset_control_get(dev, NULL);

Reported-by: Jim Davis 
Signed-off-by: Srinivas Kandagatla 
---
 drivers/media/rc/st_rc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c
index 5c15135..e0f1312 100644
--- a/drivers/media/rc/st_rc.c
+++ b/drivers/media/rc/st_rc.c
@@ -278,7 +278,7 @@ static int st_rc_probe(struct platform_device *pdev)
rc_dev->rx_base = rc_dev->base;
 
 
-   rc_dev->rstc = reset_control_get(dev, NULL);
+   rc_dev->rstc = reset_control_get_optional(dev, NULL);
if (IS_ERR(rc_dev->rstc))
rc_dev->rstc = NULL;
 
-- 
1.9.1

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


[PATCH 0/3] media:st-rc: Misc fixes.

2014-09-22 Thread Srinivas Kandagatla
Hi Mauro,

Thankyou for the "[media] enable COMPILE_TEST for media drivers" patch
which picked up few things in st-rc driver in linux-next testing.

Here is a few minor fixes to the driver, could you consider them for
the next merge window.

Thanks,
srini

Srinivas Kandagatla (3):
  media: st-rc: move to using reset_control_get_optional
  media: st-rc: move pm ops setup out of conditional compilation.
  media: st-rc: Remove .owner field for driver

 drivers/media/rc/st_rc.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

-- 
1.9.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] [media] dib0700_devices: Use c99 initializers for structures.

2014-09-22 Thread Mauro Carvalho Chehab
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// 
@decl@
identifier i1,fld;
type T;
field list[n] fs;
@@

struct i1 {
 fs
 T fld;
 ...};

@bad@
identifier decl.i1,i2;
expression e;
initializer list[decl.n] is;
@@

struct i1 i2 = { is,
+ .fld = e
- e
 ,...};
// 

Not sure why, but some tables are still using the old way,
but at least several of them got fixed.

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c 
b/drivers/media/usb/dvb-usb/dib0700_devices.c
index ce47d3f1c850..e1757b8f5f5d 100644
--- a/drivers/media/usb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/usb/dvb-usb/dib0700_devices.c
@@ -220,12 +220,21 @@ static struct dibx000_agc_config 
stk7700d_7000p_mt2266_agc_config[2] = {
 };
 
 static struct dibx000_bandwidth_config stk7700d_mt2266_pll_config = {
-   6, 3,
-   1, 8, 3, 1, 0,
-   0, 0, 1, 1, 2,
-   (3 << 14) | (1 << 12) | (524 << 0),
-   0,
-   20452225,
+   .internal = 6,
+   .sampling = 3,
+   .pll_prediv = 1,
+   .pll_ratio = 8,
+   .pll_range = 3,
+   .pll_reset = 1,
+   .pll_bypass = 0,
+   .enable_refdiv = 0,
+   .bypclk_div = 0,
+   .IO_CLK_en_core = 1,
+   .ADClkSrc = 1,
+   .modulo = 2,
+   .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0),
+   .ifreq = 0,
+   .timf = 20452225,
 };
 
 static struct dib7000p_config stk7700d_dib7000p_mt2266_config[] = {
@@ -342,57 +351,57 @@ static int stk7700d_tuner_attach(struct dvb_usb_adapter 
*adap)
 
 /* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */
 static struct dibx000_agc_config xc3028_agc_config = {
-   BAND_VHF | BAND_UHF,   /* band_caps */
-
+   .band_caps = BAND_VHF | BAND_UHF,
/* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0,
 * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0,
 * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */
-   (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) |
-   (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */
-
-   712,/* inv_gain */
-   21, /* time_stabiliz */
-
-   0,  /* alpha_level */
-   118,/* thlock */
-
-   0,  /* wbd_inv */
-   2867,   /* wbd_ref */
-   0,  /* wbd_sel */
-   2,  /* wbd_alpha */
-
-   0,  /* agc1_max */
-   0,  /* agc1_min */
-   39718,  /* agc2_max */
-   9930,   /* agc2_min */
-   0,  /* agc1_pt1 */
-   0,  /* agc1_pt2 */
-   0,  /* agc1_pt3 */
-   0,  /* agc1_slope1 */
-   0,  /* agc1_slope2 */
-   0,  /* agc2_pt1 */
-   128,/* agc2_pt2 */
-   29, /* agc2_slope1 */
-   29, /* agc2_slope2 */
-
-   17, /* alpha_mant */
-   27, /* alpha_exp */
-   23, /* beta_mant */
-   51, /* beta_exp */
-
-   1,  /* perform_agc_softsplit */
+   .setup = (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 
<< 8) | (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0),
+   .inv_gain = 712,
+   .time_stabiliz = 21,
+   .alpha_level = 0,
+   .thlock = 118,
+   .wbd_inv = 0,
+   .wbd_ref = 2867,
+   .wbd_sel = 0,
+   .wbd_alpha = 2,
+   .agc1_max = 0,
+   .agc1_min = 0,
+   .agc2_max = 39718,
+   .agc2_min = 9930,
+   .agc1_pt1 = 0,
+   .agc1_pt2 = 0,
+   .agc1_pt3 = 0,
+   .agc1_slope1 = 0,
+   .agc1_slope2 = 0,
+   .agc2_pt1 = 0,
+   .agc2_pt2 = 128,
+   .agc2_slope1 = 29,
+   .agc2_slope2 = 29,
+   .alpha_mant = 17,
+   .alpha_exp = 27,
+   .beta_mant = 23,
+   .beta_exp = 51,
+   .perform_agc_softsplit = 1,
 };
 
 /* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */
 static struct dibx000_bandwidth_config xc3028_bw_config = {
-   6, 3, /* internal, sampling */
-   1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */
-   0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc,
- modulo */
-   (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */
-   (1 << 25) | 5816102, /* ifreq = 5.20 MHz */
-   20452225, /* timf */
-   3000, /* xtal_hz */
+   .internal = 6,
+   .sampling = 3,
+   .pll_prediv = 1,
+   .pll_ratio = 8,
+   .pll_range = 3,
+   .pll_reset = 1,
+   .pll_bypass = 0,
+   .enable_refdiv = 0,
+   .bypclk_div = 0,
+   .IO_CLK_en_core = 1,
+   .ADClkSrc = 1,
+   .modulo = 0,
+   .sad_cfg = (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, 
freq_15k */
+   .ifreq = (1 << 25) | 5816102,  /* ifreq = 5.20 MHz */
+   .timf = 20452225,
+   .xtal_hz = 3000,
 };
 
 static struct dib7000p_config stk7700ph_dib7700_xc3028_config = {
@@ -614,59 +623,55 

Re: [PATCH] saa7146: generate device name early

2014-09-22 Thread Thomas Voegtle

On Mon, 22 Sep 2014, Daniel Glöckner wrote:


It is needed when requesting the irq.

Signed-off-by: Daniel Glöckner 
---
drivers/media/common/saa7146/saa7146_core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/common/saa7146/saa7146_core.c 
b/drivers/media/common/saa7146/saa7146_core.c
index 97afee6..4418119 100644
--- a/drivers/media/common/saa7146/saa7146_core.c
+++ b/drivers/media/common/saa7146/saa7146_core.c
@@ -364,6 +364,9 @@ static int saa7146_init_one(struct pci_dev *pci, const 
struct pci_device_id *ent
goto out;
}

+   /* create a nice device name */
+   sprintf(dev->name, "saa7146 (%d)", saa7146_num);
+
DEB_EE("pci:%p\n", pci);

err = pci_enable_device(pci);
@@ -438,9 +441,6 @@ static int saa7146_init_one(struct pci_dev *pci, const 
struct pci_device_id *ent

/* the rest + print status message */

-   /* create a nice device name */
-   sprintf(dev->name, "saa7146 (%d)", saa7146_num);
-
pr_info("found saa7146 @ mem %p (revision %d, irq %d) 
(0x%04x,0x%04x)\n",
dev->mem, dev->revision, pci->irq,
pci->subsystem_vendor, pci->subsystem_device);




No warning anymore, this fixes it for me.

Thank you,

Thomas


Re: [PATCH 1/2] media: tuner xc5000 - release firmwware from xc5000_release()

2014-09-22 Thread Shuah Khan
On 09/22/2014 02:18 PM, Mauro Carvalho Chehab wrote:
> Em Wed, 13 Aug 2014 19:09:23 -0600
> Shuah Khan  escreveu:
> 
>> xc5000 releases firmware right after loading it. Change it to
>> save the firmware and release it from xc5000_release(). This
>> helps avoid fecthing firmware when forced firmware load requests
>> come in to change analog tv frequence and when firmware needs to
>> be reloaded after suspend and resume.
>>
>> Signed-off-by: Shuah Khan 
>> ---
>>  drivers/media/tuners/xc5000.c |   34 --
>>  1 file changed, 20 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/media/tuners/xc5000.c b/drivers/media/tuners/xc5000.c
>> index 512fe50..31b1dec 100644
>> --- a/drivers/media/tuners/xc5000.c
>> +++ b/drivers/media/tuners/xc5000.c
>> @@ -70,6 +70,8 @@ struct xc5000_priv {
>>  
>>  struct dvb_frontend *fe;
>>  struct delayed_work timer_sleep;
>> +
>> +const struct firmware   *firmware;
>>  };
>>  
>>  /* Misc Defines */
>> @@ -1136,20 +1138,23 @@ static int xc_load_fw_and_init_tuner(struct 
>> dvb_frontend *fe, int force)
>>  if (!force && xc5000_is_firmware_loaded(fe) == 0)
>>  return 0;
>>  
>> -ret = request_firmware(&fw, desired_fw->name,
>> -   priv->i2c_props.adap->dev.parent);
>> -if (ret) {
>> -printk(KERN_ERR "xc5000: Upload failed. (file not found?)\n");
>> -return ret;
>> -}
>> -
>> -dprintk(1, "firmware read %Zu bytes.\n", fw->size);
>> +if (!priv->firmware) {
>> +ret = request_firmware(&fw, desired_fw->name,
>> +priv->i2c_props.adap->dev.parent);
>> +if (ret) {
>> +pr_err("xc5000: Upload failed. rc %d\n", ret);
>> +return ret;
>> +}
>> +dprintk(1, "firmware read %Zu bytes.\n", fw->size);
>>  
>> -if (fw->size != desired_fw->size) {
>> -printk(KERN_ERR "xc5000: Firmware file with incorrect size\n");
>> -ret = -EINVAL;
>> -goto err;
>> -}
>> +if (fw->size != desired_fw->size) {
>> +pr_err("xc5000: Firmware file with incorrect size\n");
>> +ret = -EINVAL;
>> +goto err;
> 
> In this case, we should be releasing the firmware too. Btw, this code will
> also add a memory leak, as priv->firmware will be null, but the firmware
> was loaded.

Yes you are right. I will revise the patch series and resend it.

-- Shuah


-- 
Shuah Khan
Sr. Linux Kernel Developer
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
--
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] saa7146: generate device name early

2014-09-22 Thread Daniel Glöckner
It is needed when requesting the irq.

Signed-off-by: Daniel Glöckner 
---
 drivers/media/common/saa7146/saa7146_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/common/saa7146/saa7146_core.c 
b/drivers/media/common/saa7146/saa7146_core.c
index 97afee6..4418119 100644
--- a/drivers/media/common/saa7146/saa7146_core.c
+++ b/drivers/media/common/saa7146/saa7146_core.c
@@ -364,6 +364,9 @@ static int saa7146_init_one(struct pci_dev *pci, const 
struct pci_device_id *ent
goto out;
}
 
+   /* create a nice device name */
+   sprintf(dev->name, "saa7146 (%d)", saa7146_num);
+
DEB_EE("pci:%p\n", pci);
 
err = pci_enable_device(pci);
@@ -438,9 +441,6 @@ static int saa7146_init_one(struct pci_dev *pci, const 
struct pci_device_id *ent
 
/* the rest + print status message */
 
-   /* create a nice device name */
-   sprintf(dev->name, "saa7146 (%d)", saa7146_num);
-
pr_info("found saa7146 @ mem %p (revision %d, irq %d) 
(0x%04x,0x%04x)\n",
dev->mem, dev->revision, pci->irq,
pci->subsystem_vendor, pci->subsystem_device);
-- 
1.8.3.4

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


[PATCH 1/2] [media] stv0367: Remove an unused parameter

2014-09-22 Thread Mauro Carvalho Chehab
cab_state->modulation is initialized with a wrong value:

drivers/media/dvb-frontends/stv0367.c:3000:42: warning: mixing different enum 
types
drivers/media/dvb-frontends/stv0367.c:3000:42: int enum fe_modulation  
versus
drivers/media/dvb-frontends/stv0367.c:3000:42: int enum stv0367cab_mod

as it was declared as "enum stv0367cab_mod". While it could be fixed,
there's no value on it, as this is never used.

So, just remove the modulation from cab_state structure.

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/dvb-frontends/stv0367.c 
b/drivers/media/dvb-frontends/stv0367.c
index 7f010683dbf8..b31ff265ff24 100644
--- a/drivers/media/dvb-frontends/stv0367.c
+++ b/drivers/media/dvb-frontends/stv0367.c
@@ -59,7 +59,6 @@ struct stv0367cab_state {
int locked; /* channel found*/
u32 freq_khz;   /* found frequency (in kHz) */
u32 symbol_rate;/* found symbol rate (in Bds)   */
-   enum stv0367cab_mod modulation; /* modulation   */
fe_spectral_inversion_t spect_inv; /* Spectrum Inversion*/
 };
 
@@ -2997,7 +2996,6 @@ enum stv0367_cab_signal_type stv0367cab_algo(struct 
stv0367_state *state,
 
if (QAMFEC_Lock) {
signalType = FE_CAB_DATAOK;
-   cab_state->modulation = p->modulation;
cab_state->spect_inv = stv0367_readbits(state,
F367CAB_QUAD_INV);
 #if 0
-- 
1.9.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


[PATCH 2/2] [media] au0828-cards: remove a comment about i2c clock stretching

2014-09-22 Thread Mauro Carvalho Chehab
This comment is already at the au0828-i2c where it belongs.
So, remove it from a board's entry. It doesn't make any sense
there, as we're setting the clock to 250kHz there, slowing it
down only at the au0828-i2c.

Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/usb/au0828/au0828-cards.c 
b/drivers/media/usb/au0828/au0828-cards.c
index d229c6dbddb9..585a8f84228c 100644
--- a/drivers/media/usb/au0828/au0828-cards.c
+++ b/drivers/media/usb/au0828/au0828-cards.c
@@ -73,12 +73,6 @@ struct au0828_board au0828_boards[] = {
.tuner_type = TUNER_XC5000,
.tuner_addr = 0x61,
.has_ir_i2c = 1,
-   /* The au0828 hardware i2c implementation does not properly
-  support the xc5000's i2c clock stretching.  So we need to
-  lower the clock frequency enough where the 15us clock
-  stretch fits inside of a normal clock cycle, or else the
-  au0828 fails to set the STOP bit.  A 30 KHz clock puts the
-  clock pulse width at 18us */
.i2c_clk_divider = AU0828_I2C_CLK_250KHZ,
.input = {
{
-- 
1.9.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 2/5] media: v4l2-core changes to use media tuner token api

2014-09-22 Thread Shuah Khan
Hi Devin,

On 09/22/2014 01:21 PM, Devin Heitmueller wrote:
> Hi Shuah,
> 
> What about G_INPUT and G_TUNER?  Consider the following use case, which is
> entirely legal in the V4L2 API:

Did you mean G_INPUT and G_STD here? I didn't see G_TUNER mentioned
below in the use-case.

I didn't know this use-case, I did notice ENUM_INPUT getting called
in a loop during testing. I think I didn't run into this because I
changed the au0828: vidioc_g_tuner to hold the lock as it does a tuner
init and messes up the tuner when it is in use by dvb. But, that doesn't
cover this use-case for other drivers. So I need to make more changes
to cover it. Thanks for pointing this out.

> 
> 1.  Program opens /dev/video0
> 2.  Program calls G_INPUT/G_STD and sees that the appropriate input and
> standard are already set, since all devices have a default input at
> initialization
> 3.  Program never calls S_INPUT, S_STD, or S_TUNER
> 4.  Program goes into a loop calling ENUM_INPUT, waiting until it returns
> the input as having signal lock
> 5.  When signal lock is seen, program calls STREAMON.

I am missing vb2 streamon change to hold the tuner in this patch set.
Without that change vb2 work isn't complete. Unfortunately I don't
have hybrid hardware that uses a vb2 driver.

> 
> In the above case, you would be actively using the au8522 video decoder but
> not holding the lock, so thr DVB device can be opened and screw everything
> up.  Likewise if the DVB device were in use and such a program were run, it
> wouls break.
> 

I think this use-case will be covered with changes to vb2 streamon
to check and hold tuner. I am thinking it might not be necessary to
change g_tuner, g_std, g_input and enum_input at v4l2-core level.
Does that sounds right??

thanks,
-- Shuah


-- 
Shuah Khan
Sr. Linux Kernel Developer
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
--
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] media: tuner xc5000 - release firmwware from xc5000_release()

2014-09-22 Thread Mauro Carvalho Chehab
Em Wed, 13 Aug 2014 19:09:23 -0600
Shuah Khan  escreveu:

> xc5000 releases firmware right after loading it. Change it to
> save the firmware and release it from xc5000_release(). This
> helps avoid fecthing firmware when forced firmware load requests
> come in to change analog tv frequence and when firmware needs to
> be reloaded after suspend and resume.
> 
> Signed-off-by: Shuah Khan 
> ---
>  drivers/media/tuners/xc5000.c |   34 --
>  1 file changed, 20 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/media/tuners/xc5000.c b/drivers/media/tuners/xc5000.c
> index 512fe50..31b1dec 100644
> --- a/drivers/media/tuners/xc5000.c
> +++ b/drivers/media/tuners/xc5000.c
> @@ -70,6 +70,8 @@ struct xc5000_priv {
>  
>   struct dvb_frontend *fe;
>   struct delayed_work timer_sleep;
> +
> + const struct firmware   *firmware;
>  };
>  
>  /* Misc Defines */
> @@ -1136,20 +1138,23 @@ static int xc_load_fw_and_init_tuner(struct 
> dvb_frontend *fe, int force)
>   if (!force && xc5000_is_firmware_loaded(fe) == 0)
>   return 0;
>  
> - ret = request_firmware(&fw, desired_fw->name,
> -priv->i2c_props.adap->dev.parent);
> - if (ret) {
> - printk(KERN_ERR "xc5000: Upload failed. (file not found?)\n");
> - return ret;
> - }
> -
> - dprintk(1, "firmware read %Zu bytes.\n", fw->size);
> + if (!priv->firmware) {
> + ret = request_firmware(&fw, desired_fw->name,
> + priv->i2c_props.adap->dev.parent);
> + if (ret) {
> + pr_err("xc5000: Upload failed. rc %d\n", ret);
> + return ret;
> + }
> + dprintk(1, "firmware read %Zu bytes.\n", fw->size);
>  
> - if (fw->size != desired_fw->size) {
> - printk(KERN_ERR "xc5000: Firmware file with incorrect size\n");
> - ret = -EINVAL;
> - goto err;
> - }
> + if (fw->size != desired_fw->size) {
> + pr_err("xc5000: Firmware file with incorrect size\n");
> + ret = -EINVAL;
> + goto err;

In this case, we should be releasing the firmware too. Btw, this code will
also add a memory leak, as priv->firmware will be null, but the firmware
was loaded.

The rest of the patch looks ok.

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


saa7146: WARNING at fs/proc/generic.c, name len 0

2014-09-22 Thread Thomas Voegtle


Hi,

does anyone have an idea what this is?

Card is working flawless, for me it is just cosmetic.

3.17.0-rc6

[1.793384] saa7146: register extension 'budget_av'
[1.793393] ata1.00: ATA-8: ST31000524AS, JC4B, max UDMA/133
[1.793394] ata1.00: 1953525168 sectors, multi 16: LBA48 NCQ (depth 
31/32)

[1.810836] ata1.00: configured for UDMA/133
[1.811029] [ cut here ]
[1.811033] WARNING: CPU: 1 PID: 1 at fs/proc/generic.c:341 
__proc_create+0x18d/0x1a0()

[1.811033] name len 0
[1.811035] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 
3.17.0-rc6-celeron+ #174
[1.811036] Hardware name: Gigabyte Technology Co., Ltd. To be filled 
by O.E.M./C1037UN-EU, BIOS FA 02/25/2014
[1.811039]  0009 88011a8c7a88 8148d1f9 
88011a8c7ad0
[1.811040]  88011a8c7ac0 81043ece 88011a8c7b78 
0002
[1.811042]  416d   
88011a8c7b20

[1.811042] Call Trace:
[1.811046]  [] dump_stack+0x45/0x56
[1.811049]  [] warn_slowpath_common+0x6e/0x90
[1.811051]  [] warn_slowpath_fmt+0x47/0x50
[1.811053]  [] __proc_create+0x18d/0x1a0
[1.811054]  [] proc_mkdir_data+0x35/0x70
[1.811056]  [] proc_mkdir+0x10/0x20
[1.811059]  [] register_handler_proc+0xdc/0x100
[1.811061]  [] __setup_irq+0x3e1/0x520
[1.811064]  [] ? 
saa7146_i2c_adapter_prepare+0xc0/0xc0

[1.811066]  [] request_threaded_irq+0xc2/0x170
[1.811068]  [] saa7146_init_one+0x11d/0x830
[1.811072]  [] pci_device_probe+0x7c/0xe0
[1.811076]  [] driver_probe_device+0x8b/0x3d0
[1.811078]  [] __driver_attach+0x8b/0x90
[1.811080]  [] ? __device_attach+0x40/0x40
[1.811083]  [] bus_for_each_dev+0x63/0xa0
[1.811085]  [] driver_attach+0x19/0x20
[1.811088]  [] bus_add_driver+0x168/0x230
[1.811091]  [] ? saa7146_vv_init_module+0x8/0x8
[1.811092]  [] driver_register+0x5f/0xf0
[1.811095]  [] __pci_register_driver+0x46/0x50
[1.811097]  [] saa7146_register_extension+0x5c/0x80
[1.811099]  [] budget_av_init+0x10/0x12
[1.811101]  [] do_one_initcall+0xf9/0x183
[1.811104]  [] ? parse_args+0x128/0x440
[1.811106]  [] kernel_init_freeable+0x112/0x198
[1.811109]  [] ? initcall_blacklist+0xba/0xba
[1.82]  [] ? rest_init+0x70/0x70
[1.83]  [] kernel_init+0x9/0xf0
[1.87]  [] ret_from_fork+0x7c/0xb0
[1.88]  [] ? rest_init+0x70/0x70
[1.811122] ---[ end trace 857c2d050441921d ]---
[1.811126] saa7146: found saa7146 @ mem c904e000 (revision 1, 
irq 18) (0x1894,0x0021)

[1.811128] saa7146 (0): dma buffer size 192512
[1.811129] DVB: registering new adapter (KNC1 DVB-C Plus)
[1.48] adapter failed MAC signature check
[1.54] encoded MAC from EEPROM was 
ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff




--
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] [media] coda: Improve runtime PM support

2014-09-22 Thread Ulf Hansson
On 22 September 2014 18:05, Philipp Zabel  wrote:
> From: Ulf Hansson 
>
> For several reasons it's good practice to leave devices in runtime PM
> active state while those have been probed.
>
> In this cases we also want to prevent the device from going inactive,
> until the firmware has been completely installed, especially when using
> a PM domain.
>
> Signed-off-by: Ulf Hansson 
> Signed-off-by: Philipp Zabel 

Thanks for moving this to the next version, I have been a bit busy the
last week.

Changes looking good!

Kind regards
Uffe

>
> ---
> Changes since v1:
>  - Deactivate PM domain on error
>  - Added a comment to runtime PM setup
> ---
>  drivers/media/platform/coda/coda-common.c | 55 
> ---
>  1 file changed, 21 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/media/platform/coda/coda-common.c 
> b/drivers/media/platform/coda/coda-common.c
> index 0997b5c..ced4760 100644
> --- a/drivers/media/platform/coda/coda-common.c
> +++ b/drivers/media/platform/coda/coda-common.c
> @@ -1688,7 +1688,7 @@ static void coda_fw_callback(const struct firmware *fw, 
> void *context)
>
> if (!fw) {
> v4l2_err(&dev->v4l2_dev, "firmware request failed\n");
> -   return;
> +   goto put_pm;
> }
>
> /* allocate auxiliary per-device code buffer for the BIT processor */
> @@ -1696,50 +1696,27 @@ static void coda_fw_callback(const struct firmware 
> *fw, void *context)
>  dev->debugfs_root);
> if (ret < 0) {
> dev_err(&pdev->dev, "failed to allocate code buffer\n");
> -   return;
> +   goto put_pm;
> }
>
> /* Copy the whole firmware image to the code buffer */
> memcpy(dev->codebuf.vaddr, fw->data, fw->size);
> release_firmware(fw);
>
> -   if (pm_runtime_enabled(&pdev->dev) && pdev->dev.pm_domain) {
> -   /*
> -* Enabling power temporarily will cause coda_hw_init to be
> -* called via coda_runtime_resume by the pm domain.
> -*/
> -   ret = pm_runtime_get_sync(&dev->plat_dev->dev);
> -   if (ret < 0) {
> -   v4l2_err(&dev->v4l2_dev, "failed to power on: %d\n",
> -ret);
> -   return;
> -   }
> -
> -   ret = coda_check_firmware(dev);
> -   if (ret < 0)
> -   return;
> -
> -   pm_runtime_put_sync(&dev->plat_dev->dev);
> -   } else {
> -   /*
> -* If runtime pm is disabled or pm_domain is not set,
> -* initialize once manually.
> -*/
> -   ret = coda_hw_init(dev);
> -   if (ret < 0) {
> -   v4l2_err(&dev->v4l2_dev, "HW initialization 
> failed\n");
> -   return;
> -   }
> -
> -   ret = coda_check_firmware(dev);
> -   if (ret < 0)
> -   return;
> +   ret = coda_hw_init(dev);
> +   if (ret < 0) {
> +   v4l2_err(&dev->v4l2_dev, "HW initialization failed\n");
> +   goto put_pm;
> }
>
> +   ret = coda_check_firmware(dev);
> +   if (ret < 0)
> +   goto put_pm;
> +
> dev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
> if (IS_ERR(dev->alloc_ctx)) {
> v4l2_err(&dev->v4l2_dev, "Failed to alloc vb2 context\n");
> -   return;
> +   goto put_pm;
> }
>
> dev->m2m_dev = v4l2_m2m_init(&coda_m2m_ops);
> @@ -1771,12 +1748,15 @@ static void coda_fw_callback(const struct firmware 
> *fw, void *context)
> v4l2_info(&dev->v4l2_dev, "codec registered as /dev/video[%d-%d]\n",
>   dev->vfd[0].num, dev->vfd[1].num);
>
> +   pm_runtime_put_sync(&pdev->dev);
> return;
>
>  rel_m2m:
> v4l2_m2m_release(dev->m2m_dev);
>  rel_ctx:
> vb2_dma_contig_cleanup_ctx(dev->alloc_ctx);
> +put_pm:
> +   pm_runtime_put_sync(&pdev->dev);
>  }
>
>  static int coda_firmware_request(struct coda_dev *dev)
> @@ -1998,6 +1978,13 @@ static int coda_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, dev);
>
> +   /*
> +* Start activated so we can directly call coda_hw_init in
> +* coda_fw_callback regardless of whether CONFIG_PM_RUNTIME is
> +* enabled or whether the device is associated with a PM domain.
> +*/
> +   pm_runtime_get_noresume(&pdev->dev);
> +   pm_runtime_set_active(&pdev->dev);
> pm_runtime_enable(&pdev->dev);
>
> return coda_firmware_request(dev);
> --
> 2.1.0
>
--
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] tda18271-common: Convert _tda_printk to return void

2014-09-22 Thread Joe Perches
No caller or macro uses the return value so make it void.

Signed-off-by: Joe Perches 
---
This change is associated to a desire to eventually
change printk to return void.

 drivers/media/tuners/tda18271-common.c | 19 ---
 drivers/media/tuners/tda18271-priv.h   |  4 ++--
 2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/media/tuners/tda18271-common.c 
b/drivers/media/tuners/tda18271-common.c
index 18c77af..86e5e31 100644
--- a/drivers/media/tuners/tda18271-common.c
+++ b/drivers/media/tuners/tda18271-common.c
@@ -714,12 +714,11 @@ fail:
return ret;
 }
 
-int _tda_printk(struct tda18271_priv *state, const char *level,
-   const char *func, const char *fmt, ...)
+void _tda_printk(struct tda18271_priv *state, const char *level,
+const char *func, const char *fmt, ...)
 {
struct va_format vaf;
va_list args;
-   int rtn;
 
va_start(args, fmt);
 
@@ -727,15 +726,13 @@ int _tda_printk(struct tda18271_priv *state, const char 
*level,
vaf.va = &args;
 
if (state)
-   rtn = printk("%s%s: [%d-%04x|%c] %pV",
-level, func, i2c_adapter_id(state->i2c_props.adap),
-state->i2c_props.addr,
-(state->role == TDA18271_MASTER) ? 'M' : 'S',
-&vaf);
+   printk("%s%s: [%d-%04x|%c] %pV",
+  level, func, i2c_adapter_id(state->i2c_props.adap),
+  state->i2c_props.addr,
+  (state->role == TDA18271_MASTER) ? 'M' : 'S',
+  &vaf);
else
-   rtn = printk("%s%s: %pV", level, func, &vaf);
+   printk("%s%s: %pV", level, func, &vaf);
 
va_end(args);
-
-   return rtn;
 }
diff --git a/drivers/media/tuners/tda18271-priv.h 
b/drivers/media/tuners/tda18271-priv.h
index 454c152..b36a7b7 100644
--- a/drivers/media/tuners/tda18271-priv.h
+++ b/drivers/media/tuners/tda18271-priv.h
@@ -139,8 +139,8 @@ extern int tda18271_debug;
 #define DBG_CAL  16
 
 __attribute__((format(printf, 4, 5)))
-int _tda_printk(struct tda18271_priv *state, const char *level,
-   const char *func, const char *fmt, ...);
+void _tda_printk(struct tda18271_priv *state, const char *level,
+const char *func, const char *fmt, ...);
 
 #define tda_printk(st, lvl, fmt, arg...)   \
_tda_printk(st, lvl, __func__, fmt, ##arg)


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


randconfig build error with next-20140922, in drivers/media/platform/vivid/vivid-core.c

2014-09-22 Thread Jim Davis
Building with the attached random configuration file,

drivers/built-in.o: In function `vivid_fb_release_buffers':
(.text+0x14960f): undefined reference to `fb_dealloc_cmap'
drivers/built-in.o: In function `vivid_fb_init':
(.text+0x149828): undefined reference to `fb_alloc_cmap'
drivers/built-in.o: In function `vivid_fb_init':
(.text+0x1498b9): undefined reference to `register_framebuffer'
drivers/built-in.o: In function `vivid_exit':
vivid-core.c:(.exit.text+0x14ba): undefined reference to
`unregister_framebuffer'
drivers/built-in.o:(.data+0x8d168): undefined reference to `cfb_fillrect'
drivers/built-in.o:(.data+0x8d170): undefined reference to `cfb_copyarea'
drivers/built-in.o:(.data+0x8d178): undefined reference to `cfb_imageblit'
make: *** [vmlinux] Error 1
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 3.17.0-rc6 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_MMU=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ARCH_HAS_CPU_RELAX=y
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
CONFIG_ZONE_DMA32=y
CONFIG_AUDIT_ARCH=y
CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_X86_64_SMP=y
CONFIG_X86_HT=y
CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx 
-fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 
-fcall-saved-r11"
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_CONSTRUCTORS=y
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_EXTABLE_SORT=y

#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
# CONFIG_COMPILE_TEST is not set
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
CONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
CONFIG_DEFAULT_HOSTNAME="(none)"
# CONFIG_SYSVIPC is not set
CONFIG_CROSS_MEMORY_ATTACH=y
CONFIG_FHANDLE=y
CONFIG_USELIB=y
CONFIG_HAVE_ARCH_AUDITSYSCALL=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_LEGACY_ALLOC_HWIRQ=y
CONFIG_GENERIC_PENDING_IRQ=y
CONFIG_IRQ_DOMAIN=y
# CONFIG_IRQ_DOMAIN_DEBUG is not set
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_ARCH_CLOCKSOURCE_DATA=y
CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
CONFIG_GENERIC_CMOS_UPDATE=y

#
# Timers subsystem
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ_COMMON=y
# CONFIG_HZ_PERIODIC is not set
CONFIG_NO_HZ_IDLE=y
# CONFIG_NO_HZ_FULL is not set
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y

#
# CPU/Task time and stats accounting
#
CONFIG_TICK_CPU_ACCOUNTING=y
# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set
# CONFIG_IRQ_TIME_ACCOUNTING is not set
# CONFIG_BSD_PROCESS_ACCT is not set

#
# RCU Subsystem
#
CONFIG_TREE_RCU=y
# CONFIG_PREEMPT_RCU is not set
# CONFIG_TASKS_RCU is not set
CONFIG_RCU_STALL_COMMON=y
CONFIG_CONTEXT_TRACKING=y
CONFIG_RCU_USER_QS=y
# CONFIG_CONTEXT_TRACKING_FORCE is not set
CONFIG_RCU_FANOUT=64
CONFIG_RCU_FANOUT_LEAF=16
# CONFIG_RCU_FANOUT_EXACT is not set
# CONFIG_RCU_FAST_NO_HZ is not set
# CONFIG_TREE_RCU_TRACE is not set
CONFIG_RCU_NOCB_CPU=y
CONFIG_RCU_NOCB_CPU_NONE=y
# CONFIG_RCU_NOCB_CPU_ZERO is not set
# CONFIG_RCU_NOCB_CPU_ALL is not set
CONFIG_BUILD_BIN2C=y
CONFIG_IKCONFIG=m
# CONFIG_IKCONFIG_PROC is not set
CONFIG_LOG_BUF_SHIFT=17
CONFIG_LOG_CPU_MAX_BUF_SHIFT=12
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y
CONFIG_ARCH_SUPPORTS_INT128=y
# CONFIG_NUMA_BALANCING_DEFAULT_ENABLED is not set
CONFIG_NUMA_BALANCING=y
CONFIG_CGROUPS=y
CONFIG_CGROUP_DEBUG=y
CONFIG_CGROUP_FREEZER=y
# CONFIG_CGROUP_DEVICE is not set
CONFIG_CPUSETS=y
# CONFIG_PROC_PID_CPUSET is not set
# CONFIG_CGROUP_CPUACCT is not set
CONFIG_RESOURCE_COUNTERS=y
# CONFIG_MEMCG is not set
# CONFIG_CGROUP_PERF is not set
CONFIG_CGROUP_SCHED=y
CONFIG_FAIR_GROUP_SCHED=y
# CONFIG_CFS_BANDWIDTH is not set
# CONFIG_RT_GROUP_SCHED is not set
CONFIG_CHECKPOINT_RESTORE=y
CONFIG_NAMESPACES=y
# CONFIG_UTS_NS is not set
CONFIG_USER_NS=y
CONFIG_PID_NS=y
CONFIG_SCHED

Re: [PATCH] s5p-mfc: correct the formats info for encoder

2014-09-22 Thread ayaka
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



 2014/09/23 00:28, Kamil Debski wrote:
> Hi Ayaka,
> 
> Sorry for such a late reply - I just noticed this patch.
> 
>> The NV12M is supported by all the version of MFC, so it is better
>> to use it as default OUTPUT format. MFC v5 doesn't support NV21,
>> I have tested it, for the SEC doc it is not supported either.
> 

> A proper Sign-off is missing here.
> 
Sorry  to miss it again.
> According to the documentation of MFC v5 I have non-tiled format
> is supported. Which documentation were you looking at?
> 
But the V4L2_PIX_FMT_NV12MT is only supported by MFC_V5_BIT from your
code, V4L2_PIX_FMT_NV12M is supported by all the version.

>> From my documentation:
> ++ ENC_MAP_FOR_CUR0xC51C Memory structure setting
> register of the current frame.R/W 0x
> 
> Bits  NameDescription Reset Value [31:2]  RESERVED
> Reserved0 [1:0]
> ENC_MAP_FOR_CUR   Memory structure of the current frame 0 : Linear
> mode 3 : 64x32 tiled mode 0 ++
> 
In the page 2277. The same result.
I think the V4L2_PIX_FMT_NV12MT is 64x32 Tiles mode, but what I remove
for MFC v5 is V4L2_PIX_FMT_NV21M.
> Best wishes,
> 

- -- 
ayaka
-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQIcBAEBAgAGBQJUIFNLAAoJEPsGh4kgR4i5HcIP/2qwn7uIFq66qpSajXmtcLx3
3/wt8n26u6GhTMUnIJKZS07FGtv7qizUVqeY3WmfWQw3jLaUjZeVviVH08y3DrE8
+7Vjq2rxz57ou4bBtc4qIgTWB7z2yuVSpBOYUB94laItQ7KDap4EgLf89m4KaKTt
5nULR0byxXh+RuUOw80v0eP/TBz7SRfYZnulASV9QlGS6T3Xp6v4U6W8LbSbieR5
63PwPxYP7aDVb5R6qzaLIVXNuI53vn5VhrQ6JJUfKee5YSbkV/Ff6XK+7/P162Pn
5cVt06X+RUeZXHGqCroMNb9cdm+7JHOZL458NPn4NmTJnFcPNu6JzW9iLymHeHC8
iFmNhpDuHJBulKsW44lqKe1fHT22a5C/oJAI1ZS9c3yrH+TqHkfEkUJjglSRByzj
ptTFFZVTCdiL5VwnDlfowR4ZzrkZuoWzHIn5cGeHogvbLbxCbtV67+IFpWlXfyJu
rKnCI+DKYb5cjEiHm7kzGbAO04AfNMT79sNwrD+sPuvnaFyRiy2rjKv3ubnPFRVp
3agNRzAcCgmsW3K10P3ism4ceJUqeZtFvieCQrjiQdxj8EB7QAcgOhgn3K//zrQ1
mQP7xuVQcwpaRIOx/3jSlVWYFrkFs2+tmgS9oEn+v40gXOQXk8rML21gHvpDuCnf
qJXx0UVYQRV7Bhgv8EFW
=SNTL
-END PGP SIGNATURE-
--
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: au0828_init_tuner() called without dev lock held

2014-09-22 Thread Shuah Khan
On 09/22/2014 10:37 AM, Hans Verkuil wrote:
> On 09/22/2014 06:31 PM, Shuah Khan wrote:
>> Hi Hans and Mauro,
>>
>> While I was making changes for media token work, I noticed there are
>> several places au0828_init_tuner() gets called without holding dev lock.
> 
> au0828 sets the lock pointer in struct video_device to the dev lock.
> That means that all v4l2 ioctl calls are serialized in v4l2_ioctl()
> in v4l2-dev.c. So these calls *do* hold the device lock.
> 
> Not au0828_v4l2_resume() though, that's not an ioctl op.
> 

Good. I will go ahead and fix au0828_v4l2_resume() to do
it right.

thanks,
-- Shuah


-- 
Shuah Khan
Sr. Linux Kernel Developer
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
--
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: au0828_init_tuner() called without dev lock held

2014-09-22 Thread Hans Verkuil
On 09/22/2014 06:31 PM, Shuah Khan wrote:
> Hi Hans and Mauro,
> 
> While I was making changes for media token work, I noticed there are
> several places au0828_init_tuner() gets called without holding dev lock.

au0828 sets the lock pointer in struct video_device to the dev lock.
That means that all v4l2 ioctl calls are serialized in v4l2_ioctl()
in v4l2-dev.c. So these calls *do* hold the device lock.

Not au0828_v4l2_resume() though, that's not an ioctl op.

Regards,

Hans

> 
> vidioc_s_std(), vidioc_g_tuner(), vidioc_s_tuner(), vidioc_streamon()
> au0828_v4l2_resume()
> 
> Some of these might be intended since au0828_init_tuner() invokes
> s_std. All of these changes including the au0828_init_tuner() itself
> were added in ea86968fb91471493ccac7d8f2a65bc65db6803b
> 
> au0828_v4l2_resume() also does this and this one for sure needs fixing
> very likely. I am not sure about the others. Thoughts??
> 
> -- Shuah
> 

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


au0828_init_tuner() called without dev lock held

2014-09-22 Thread Shuah Khan
Hi Hans and Mauro,

While I was making changes for media token work, I noticed there are
several places au0828_init_tuner() gets called without holding dev lock.

vidioc_s_std(), vidioc_g_tuner(), vidioc_s_tuner(), vidioc_streamon()
au0828_v4l2_resume()

Some of these might be intended since au0828_init_tuner() invokes
s_std. All of these changes including the au0828_init_tuner() itself
were added in ea86968fb91471493ccac7d8f2a65bc65db6803b

au0828_v4l2_resume() also does this and this one for sure needs fixing
very likely. I am not sure about the others. Thoughts??

-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
--
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] s5p-mfc: correct the formats info for encoder

2014-09-22 Thread Kamil Debski
Hi Ayaka,

Sorry for such a late reply - I just noticed this patch.

> From: ayaka [mailto:ay...@soulik.info]
> Sent: Wednesday, July 23, 2014 6:15 PM
> To: linux-media@vger.kernel.org
> Cc: kyungmin.p...@samsung.com; k.deb...@samsung.com;
> jtp.p...@samsung.com; m.che...@samsung.com; ayaka
> Subject: [PATCH] s5p-mfc: correct the formats info for encoder
> 
> The NV12M is supported by all the version of MFC, so it is better to
> use it as default OUTPUT format.
> MFC v5 doesn't support NV21, I have tested it, for the SEC doc it is
> not supported either.

A proper Sign-off is missing here.

According to the documentation of MFC v5 I have non-tiled format is
supported. Which documentation were you looking at?

>From my documentation:
++
ENC_MAP_FOR_CUR 0xC51C  
Memory structure setting register of the current frame. R/W 0x

BitsNameDescription Reset Value
[31:2]  RESERVEDReserved0
[1:0]   ENC_MAP_FOR_CUR Memory structure of the current frame
0 : Linear mode
3 : 64x32 tiled mode0
++

Best wishes,
-- 
Kamil Debski
Samsung R&D Institute Poland

> ---
>  drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> index d26b248..4ea3796 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> @@ -32,7 +32,7 @@
>  #include "s5p_mfc_intr.h"
>  #include "s5p_mfc_opr.h"
> 
> -#define DEF_SRC_FMT_ENC  V4L2_PIX_FMT_NV12MT
> +#define DEF_SRC_FMT_ENC  V4L2_PIX_FMT_NV12M
>  #define DEF_DST_FMT_ENC  V4L2_PIX_FMT_H264
> 
>  static struct s5p_mfc_fmt formats[] = { @@ -67,8 +67,7 @@ static
> struct s5p_mfc_fmt formats[] = {
>   .codec_mode = S5P_MFC_CODEC_NONE,
>   .type   = MFC_FMT_RAW,
>   .num_planes = 2,
> - .versions   = MFC_V5_BIT | MFC_V6_BIT | MFC_V7_BIT |
> - MFC_V8_BIT,
> + .versions   = MFC_V6_BIT | MFC_V7_BIT | MFC_V8_BIT,
>   },
>   {
>   .name   = "H264 Encoded Stream",
> --
> 1.9.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


[PATCH v2] [media] coda: Improve runtime PM support

2014-09-22 Thread Philipp Zabel
From: Ulf Hansson 

For several reasons it's good practice to leave devices in runtime PM
active state while those have been probed.

In this cases we also want to prevent the device from going inactive,
until the firmware has been completely installed, especially when using
a PM domain.

Signed-off-by: Ulf Hansson 
Signed-off-by: Philipp Zabel 

---
Changes since v1:
 - Deactivate PM domain on error
 - Added a comment to runtime PM setup
---
 drivers/media/platform/coda/coda-common.c | 55 ---
 1 file changed, 21 insertions(+), 34 deletions(-)

diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index 0997b5c..ced4760 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1688,7 +1688,7 @@ static void coda_fw_callback(const struct firmware *fw, 
void *context)
 
if (!fw) {
v4l2_err(&dev->v4l2_dev, "firmware request failed\n");
-   return;
+   goto put_pm;
}
 
/* allocate auxiliary per-device code buffer for the BIT processor */
@@ -1696,50 +1696,27 @@ static void coda_fw_callback(const struct firmware *fw, 
void *context)
 dev->debugfs_root);
if (ret < 0) {
dev_err(&pdev->dev, "failed to allocate code buffer\n");
-   return;
+   goto put_pm;
}
 
/* Copy the whole firmware image to the code buffer */
memcpy(dev->codebuf.vaddr, fw->data, fw->size);
release_firmware(fw);
 
-   if (pm_runtime_enabled(&pdev->dev) && pdev->dev.pm_domain) {
-   /*
-* Enabling power temporarily will cause coda_hw_init to be
-* called via coda_runtime_resume by the pm domain.
-*/
-   ret = pm_runtime_get_sync(&dev->plat_dev->dev);
-   if (ret < 0) {
-   v4l2_err(&dev->v4l2_dev, "failed to power on: %d\n",
-ret);
-   return;
-   }
-
-   ret = coda_check_firmware(dev);
-   if (ret < 0)
-   return;
-
-   pm_runtime_put_sync(&dev->plat_dev->dev);
-   } else {
-   /*
-* If runtime pm is disabled or pm_domain is not set,
-* initialize once manually.
-*/
-   ret = coda_hw_init(dev);
-   if (ret < 0) {
-   v4l2_err(&dev->v4l2_dev, "HW initialization failed\n");
-   return;
-   }
-
-   ret = coda_check_firmware(dev);
-   if (ret < 0)
-   return;
+   ret = coda_hw_init(dev);
+   if (ret < 0) {
+   v4l2_err(&dev->v4l2_dev, "HW initialization failed\n");
+   goto put_pm;
}
 
+   ret = coda_check_firmware(dev);
+   if (ret < 0)
+   goto put_pm;
+
dev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
if (IS_ERR(dev->alloc_ctx)) {
v4l2_err(&dev->v4l2_dev, "Failed to alloc vb2 context\n");
-   return;
+   goto put_pm;
}
 
dev->m2m_dev = v4l2_m2m_init(&coda_m2m_ops);
@@ -1771,12 +1748,15 @@ static void coda_fw_callback(const struct firmware *fw, 
void *context)
v4l2_info(&dev->v4l2_dev, "codec registered as /dev/video[%d-%d]\n",
  dev->vfd[0].num, dev->vfd[1].num);
 
+   pm_runtime_put_sync(&pdev->dev);
return;
 
 rel_m2m:
v4l2_m2m_release(dev->m2m_dev);
 rel_ctx:
vb2_dma_contig_cleanup_ctx(dev->alloc_ctx);
+put_pm:
+   pm_runtime_put_sync(&pdev->dev);
 }
 
 static int coda_firmware_request(struct coda_dev *dev)
@@ -1998,6 +1978,13 @@ static int coda_probe(struct platform_device *pdev)
 
platform_set_drvdata(pdev, dev);
 
+   /*
+* Start activated so we can directly call coda_hw_init in
+* coda_fw_callback regardless of whether CONFIG_PM_RUNTIME is
+* enabled or whether the device is associated with a PM domain.
+*/
+   pm_runtime_get_noresume(&pdev->dev);
+   pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev);
 
return coda_firmware_request(dev);
-- 
2.1.0

--
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/RFC v6 3/6] DT: Add documentation for exynos4-is 'flashes' property

2014-09-22 Thread Jacek Anaszewski
This patch adds a description of 'flashes' property
to the samsung-fimc.txt.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
---
 .../devicetree/bindings/media/samsung-fimc.txt |5 +
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/samsung-fimc.txt 
b/Documentation/devicetree/bindings/media/samsung-fimc.txt
index 922d6f8..387ef3b 100644
--- a/Documentation/devicetree/bindings/media/samsung-fimc.txt
+++ b/Documentation/devicetree/bindings/media/samsung-fimc.txt
@@ -40,6 +40,10 @@ should be inactive. For the "active-a" state the camera port 
A must be activated
 and the port B deactivated and for the state "active-b" it should be the other
 way around.
 
+Optional properties:
+
+- flashes - array of phandles to the available flash led devices
+
 The 'camera' node must include at least one 'fimc' child node.
 
 
@@ -166,6 +170,7 @@ Example:
clock-output-names = "cam_a_clkout", "cam_b_clkout";
pinctrl-names = "default";
pinctrl-0 = <&cam_port_a_clk_active>;
+   flashes = <&max77693-flash>, <&aat1290>;
status = "okay";
#address-cells = <1>;
#size-cells = <1>;
-- 
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/RFC v6 5/6] of: Add Skyworks Solutions, Inc. vendor prefix

2014-09-22 Thread Jacek Anaszewski
Use "skyworks" as the vendor prefix for the
Skyworks Solutions, Inc.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
---
 .../devicetree/bindings/vendor-prefixes.txt|1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index ac7269f..9d5b3f6 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -117,6 +117,7 @@ renesas Renesas Electronics Corporation
 ricoh  Ricoh Co. Ltd.
 rockchip   Fuzhou Rockchip Electronics Co., Ltd
 samsungSamsung Semiconductor
+skyworks   Skyworks Solutions, Inc.
 sbsSmart Battery System
 schindler  Schindler
 seagateSeagate Technology PLC
-- 
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/RFC v6 4/6] DT: Add documentation for the mfd Maxim max77693

2014-09-22 Thread Jacek Anaszewski
This patch adds device tree binding documentation for
the flash cell of the Maxim max77693 multifunctional device.

Signed-off-by: Jacek Anaszewski 
Signed-off-by: Andrzej Hajda 
Acked-by: Kyungmin Park 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
---
 Documentation/devicetree/bindings/mfd/max77693.txt |   62 
 1 file changed, 62 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/max77693.txt 
b/Documentation/devicetree/bindings/mfd/max77693.txt
index 11921cc..0c3db3d 100644
--- a/Documentation/devicetree/bindings/mfd/max77693.txt
+++ b/Documentation/devicetree/bindings/mfd/max77693.txt
@@ -27,6 +27,55 @@ Optional properties:
 
[*] refer Documentation/devicetree/bindings/regulator/regulator.txt
 
+Optional node:
+- led-flash : the LED submodule device node
+
+Required properties of "led-flash" node:
+- compatible : must be "maxim,max77693-flash"
+- maxim,num-leds : number of connected leds
+   Possible values: 1 or 2.
+- maxim,fleds : array of current outputs in order: fled1, fled2
+   Note: both current outputs can be connected to a single led
+   Possible values:
+   0 - the output is left disconnected,
+   1 - a diode is connected to the output.
+
+Optional properties of "led-flash" node:
+- maxim,boost-mode :
+   In boost mode the device can produce up to 1.2A of total current
+   on both outputs. The maximum current on each output is reduced
+   to 625mA then. If maxim,num-leds == <2> boost must be enabled
+   (it defaults to 1 if not set):
+   Possible values:
+   0 - no boost,
+   1 - adaptive mode,
+   2 - fixed mode.
+- iout-torch : Array of maximum intensities in microamperes of the torch
+   led currents in order: fled1, fled2.
+   15625 - 25
+- iout-flash : Array of maximum intensities in microamperes of the flash
+   led currents in order: fled1, fled2.
+   Range:
+   15625 - 100 (max 625000 if boost mode is enabled)
+- flash-timeout : timeout in microseconds after which flash led
+ is turned off
+   Range:
+   62500 - 100
+- maxim,trigger : Array of flags indicating which trigger can activate given 
led
+   in order: fled1, fled2
+   Possible flag values (can be combined):
+   1 - FLASH pin of the chip,
+   2 - TORCH pin of the chip,
+   4 - software via I2C command.
+- maxim,trigger-type : Array of trigger types in order: flash, torch.
+   Possible trigger types:
+   0 - Rising edge of the signal triggers the flash/torch,
+   1 - Signal level controls duration of the flash/torch.
+- maxim,boost-vout : Output voltage of the boost module in millivolts.
+- maxim,vsys-min : Low input voltage level in millivolts. Flash is not fired
+   if chip estimates that system voltage could drop below this level due
+   to flash power consumption.
+
 Example:
max77693@66 {
compatible = "maxim,max77693";
@@ -52,4 +101,17 @@ Example:
regulator-boot-on;
};
};
+   led_flash: led-flash {
+   compatible = "maxim,max77693-flash";
+   iout-torch = <50 0>;
+   iout-flash = <125 0>;
+   flash-timeout = <100 100>;
+   maxim,num-leds = <1>;
+   maxim,fleds = <1 1>;
+   maxim,trigger = <7 7>;
+   maxim,trigger-type = <0 1>;
+   maxim,boost-mode = <1>;
+   maxim,boost-vout = <5000>;
+   maxim,vsys-min = <2400>;
+   };
};
-- 
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/RFC v6 2/6] DT: leds: Add flash led devices related properties

2014-09-22 Thread Jacek Anaszewski
Addition of a LED Flash Class extension entails the need for flash led
specific device tree properties. The properties being added are:
iout-torch, iout-flash, iout-indicator and flash-timeout.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Stephen Warren 
Cc: Grant Likely 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
---
 Documentation/devicetree/bindings/leds/common.txt |   16 
 1 file changed, 16 insertions(+)

diff --git a/Documentation/devicetree/bindings/leds/common.txt 
b/Documentation/devicetree/bindings/leds/common.txt
index 2d88816..40f4b9a 100644
--- a/Documentation/devicetree/bindings/leds/common.txt
+++ b/Documentation/devicetree/bindings/leds/common.txt
@@ -3,6 +3,17 @@ Common leds properties.
 Optional properties for child nodes:
 - label : The label for this LED.  If omitted, the label is
   taken from the node name (excluding the unit address).
+- iout-torch : Array of maximum intensities in microamperes of the torch
+   led currents in order from sub-led 0 to N-1, where N is the number
+   of torch sub-leds exposed by the device
+- iout-flash : Array of maximum intensities in microamperes of the flash
+   led currents in order from sub-led 0 to N-1, where N is the number
+   of flash sub-leds exposed by the device
+- iout-indicator : Array of maximum intensities in microamperes of
+   the indicator led currents in order from sub-led 0 to N-1,
+   where N is the number of indicator sub-leds exposed by the device
+- flash-timeout : timeout in microseconds after which flash led
+   is turned off
 
 - linux,default-trigger :  This parameter, if present, is a
 string defining the trigger assigned to the LED.  Current triggers are:
@@ -19,5 +30,10 @@ Examples:
 system-status {
label = "Status";
linux,default-trigger = "heartbeat";
+   iout-torch = <500 500>;
+   iout-flash = <1000 1000>;
+   iout-indicator = <100 100>;
+   flash-timeout = <1000>;
+
...
 };
-- 
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/RFC v6 6/6] DT: Add documentation for the Skyworks AAT1290

2014-09-22 Thread Jacek Anaszewski
This patch adds device tree binding documentation for
1.5A Step-Up Current Regulator for Flash LEDs.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
---
 .../devicetree/bindings/leds/leds-aat1290.txt  |   17 +
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-aat1290.txt

diff --git a/Documentation/devicetree/bindings/leds/leds-aat1290.txt 
b/Documentation/devicetree/bindings/leds/leds-aat1290.txt
new file mode 100644
index 000..9a9ad15
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-aat1290.txt
@@ -0,0 +1,17 @@
+* Skyworks Solutions, Inc. AAT1290 Current Regulator for Flash LEDs
+
+Required properties:
+
+- compatible : should be "skyworks,aat1290"
+- gpios : two gpio pins in order FLEN, EN/SET
+- skyworks,flash-timeout : maximum flash timeout in microseconds -
+  it can be calculated using following formula:
+  T = 8.82 * 10^9 * Ct
+
+Example:
+
+flash_led: flash-led {
+   compatible = "skyworks,aat1290";
+   gpios = <&gpj1 1 0>, <&gpj1 2 0>;
+   flash-timeout = <194>;
+}
-- 
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/RFC v6 1/6] Documentation: leds: Add description of LED Flash Class extension

2014-09-22 Thread Jacek Anaszewski
The documentation being added contains overall description of the
LED Flash Class and the related sysfs attributes. There are also
chapters devoted specifically to the Flash Manager feature.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Bryan Wu 
Cc: Richard Purdie 
---
 Documentation/leds/leds-class-flash.txt |   51 +++
 1 file changed, 51 insertions(+)
 create mode 100644 Documentation/leds/leds-class-flash.txt

diff --git a/Documentation/leds/leds-class-flash.txt 
b/Documentation/leds/leds-class-flash.txt
new file mode 100644
index 000..0cf5449a
--- /dev/null
+++ b/Documentation/leds/leds-class-flash.txt
@@ -0,0 +1,51 @@
+
+Flash LED handling under Linux
+==
+
+Some LED devices support two modes - torch and flash. In order to enable
+support for flash LEDs CONFIG_LEDS_CLASS_FLASH symbol must be defined
+in the kernel config. A flash LED driver must register in the LED subsystem
+with led_classdev_flash_register to gain flash capabilities.
+
+Following sysfs attributes are exposed for controlling flash led devices:
+
+   - flash_brightness - flash LED brightness in microamperes (RW)
+   - max_flash_brightness - maximum available flash LED brightness (RO)
+   - indicator_brightness - privacy LED brightness in microamperes (RW)
+   - max_indicator_brightness - maximum privacy LED brightness in
+microamperes (RO)
+   - flash_timeout - flash strobe duration in microseconds (RW)
+   - max_flash_timeout - maximum available flash strobe duration (RO)
+   - flash_strobe - flash strobe state (RW)
+   - flash_fault - bitmask of flash faults that may have occurred,
+   possible flags are:
+   * 0x01 - flash controller voltage to the flash LED has exceeded
+the limit specific to the flash controller
+   * 0x02 - the flash strobe was still on when the timeout set by
+the user has expired; not all flash controllers may
+set this in all such conditions
+   * 0x04 - the flash controller has overheated
+   * 0x08 - the short circuit protection of the flash controller
+has been triggered
+   * 0x10 - current in the LED power supply has exceeded the limit
+specific to the flash controller
+   * 0x40 - flash controller voltage to the flash LED has been
+below the minimum limit specific to the flash
+   * 0x80 - the input voltage of the flash controller is below
+the limit under which strobing the flash at full
+current will not be possible. The condition persists
+until this flag is no longer set
+   * 0x100 - the temperature of the LED has exceeded its allowed
+ upper limit
+
+A LED subsystem driver can be controlled also from the level of VideoForLinux2
+subsystem. In order to enable this CONFIG_V4L2_FLASH_LED_CLASS symbol has to
+be defined in the kernel config. The driver must call v4l2_flash_init function
+to get registered in the V4L2 subsystem. On remove v4l2_flash_release function
+has to be called (see ).
+
+After proper initialization V4L2 Flash sub-device is created. The sub-device
+exposes a number of V4L2 controls. When the V4L2_CID_FLASH_LED_MODE control
+is set to V4L2_FLASH_LED_MODE_TORCH or V4L2_FLASH_LED_MODE_FLASH the
+LED subsystem sysfs interface becomes unavailable. The interface can be
+unlocked by setting the mode back to V4L2_FLASH_LED_MODE_NONE.
-- 
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/RFC v6 0/2] LED / flash API integration - LED Flash Class drivers

2014-09-22 Thread Jacek Anaszewski
This patch set is the follow-up of the LED / flash API integration
series [1]. For clarity reasons the patchset has been split into
four subsets:

- LED Flash Class
- V4L2 Flash
- LED Flash Class drivers
- Documentation


Changes since version 5:


- removed flash manager framework - its implementation needs
  further thorough discussion.
- removed external strobe facilities from the LED Flash Class
  and provided external_strobe_set op in v4l2-flash. LED subsystem
  should be strobe provider agnostic.

Thanks,
Jacek Anaszewski

[1] https://lkml.org/lkml/2014/7/11/914

Jacek Anaszewski (2):
  leds: Add support for max77693 mfd flash cell
  leds: Add driver for AAT1290 current regulator

 drivers/leds/Kconfig |   15 +
 drivers/leds/Makefile|2 +
 drivers/leds/leds-aat1290.c  |  460 ++
 drivers/leds/leds-max77693.c | 1083 ++
 4 files changed, 1560 insertions(+)
 create mode 100644 drivers/leds/leds-aat1290.c
 create mode 100644 drivers/leds/leds-max77693.c

-- 
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/RFC v6 0/6] LED / flash API integration - Documentation

2014-09-22 Thread Jacek Anaszewski
This patch set is the follow-up of the LED / flash API integration
series [1]. For clarity reasons the patchset has been split into
four subsets:

- LED Flash Class
- V4L2 Flash
- LED Flash Class drivers
- Documentation


Changes since version 5:


- removed flash manager framework - its implementation needs
  further thorough discussion.
- removed external strobe facilities from the LED Flash Class
  and provided external_strobe_set op in v4l2-flash. LED subsystem
  should be strobe provider agnostic.

Thanks,
Jacek Anaszewski

[1] https://lkml.org/lkml/2014/7/11/914

Jacek Anaszewski (6):
  Documentation: leds: Add description of LED Flash Class extension
  DT: leds: Add flash led devices related properties
  DT: Add documentation for exynos4-is 'flashes' property
  DT: Add documentation for the mfd Maxim max77693
  of: Add Skyworks Solutions, Inc. vendor prefix
  DT: Add documentation for the Skyworks AAT1290

 Documentation/devicetree/bindings/leds/common.txt  |   16 +
 .../devicetree/bindings/leds/leds-aat1290.txt  |   17 ++
 .../devicetree/bindings/media/samsung-fimc.txt |5 ++
 Documentation/devicetree/bindings/mfd/max77693.txt |   62 
 .../devicetree/bindings/vendor-prefixes.txt|1 +
 Documentation/leds/leds-class-flash.txt|   51 
 6 files changed, 152 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-aat1290.txt
 create mode 100644 Documentation/leds/leds-class-flash.txt

-- 
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/RFC v6 1/2] leds: Add support for max77693 mfd flash cell

2014-09-22 Thread Jacek Anaszewski
This patch adds led-flash support to Maxim max77693 chipset.
A device can be exposed to user space through LED subsystem
sysfs interface or through V4L2 subdevice when the support
for V4L2 Flash sub-devices is enabled. Device supports up to
two leds which can work in flash and torch mode. Leds can
be triggered externally or by software.

Signed-off-by: Jacek Anaszewski 
Signed-off-by: Andrzej Hajda 
Acked-by: Kyungmin Park 
Cc: Bryan Wu 
Cc: Richard Purdie 
Cc: SangYoung Son 
Cc: Samuel Ortiz 
---
 drivers/leds/Kconfig |9 +
 drivers/leds/Makefile|1 +
 drivers/leds/leds-max77693.c | 1083 ++
 3 files changed, 1093 insertions(+)
 create mode 100644 drivers/leds/leds-max77693.c

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 3c58021..c654f74 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -457,6 +457,15 @@ config LEDS_TCA6507
  LED driver chips accessed via the I2C bus.
  Driver support brightness control and hardware-assisted blinking.
 
+config LEDS_MAX77693
+   tristate "LED support for MAX77693 Flash"
+   depends on LEDS_CLASS_FLASH
+   depends on MFD_MAX77693
+   help
+ This option enables support for the flash part of the MAX77693
+ multifunction device. It has build in control for two leds in flash
+ and torch mode.
+
 config LEDS_MAX8997
tristate "LED support for MAX8997 PMIC"
depends on LEDS_CLASS && MFD_MAX8997
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 9238b8a..1178426 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -51,6 +51,7 @@ obj-$(CONFIG_LEDS_MC13783)+= leds-mc13783.o
 obj-$(CONFIG_LEDS_NS2) += leds-ns2.o
 obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o
 obj-$(CONFIG_LEDS_ASIC3)   += leds-asic3.o
+obj-$(CONFIG_LEDS_MAX77693)+= leds-max77693.o
 obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o
 obj-$(CONFIG_LEDS_LM355x)  += leds-lm355x.o
 obj-$(CONFIG_LEDS_BLINKM)  += leds-blinkm.o
diff --git a/drivers/leds/leds-max77693.c b/drivers/leds/leds-max77693.c
new file mode 100644
index 000..f1e6e79
--- /dev/null
+++ b/drivers/leds/leds-max77693.c
@@ -0,0 +1,1083 @@
+/*
+ * LED Flash Class driver for the flash cell of max77693 mfd.
+ *
+ * Copyright (C) 2014, Samsung Electronics Co., Ltd.
+ *
+ * Authors: Jacek Anaszewski 
+ *  Andrzej Hajda 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define MAX77693_LED_NAME_1"max77693-flash_1"
+#define MAX77693_LED_NAME_2"max77693-flash_2"
+
+#define MODE_OFF   0
+#define MODE_FLASH1(1 << 0)
+#define MODE_FLASH2(1 << 1)
+#define MODE_TORCH1(1 << 2)
+#define MODE_TORCH2(1 << 3)
+#define MODE_FLASH_EXTERNAL1   (1 << 4)
+#define MODE_FLASH_EXTERNAL2   (1 << 5)
+
+enum {
+   FLED1,
+   FLED2
+};
+
+enum {
+   FLASH,
+   TORCH
+};
+
+struct max77693_sub_led {
+   struct led_classdev_flash ldev;
+   struct work_struct work_brightness_set;
+   struct v4l2_flash *v4l2_flash;
+
+   unsigned int torch_brightness;
+   unsigned int flash_timeout;
+};
+
+struct max77693_led {
+   struct regmap *regmap;
+   struct platform_device *pdev;
+   struct max77693_led_platform_data *pdata;
+   struct mutex lock;
+
+   struct max77693_sub_led sub_leds[2];
+
+   unsigned int current_flash_timeout;
+   unsigned int mode_flags;
+   u8 torch_iout_reg;
+   bool iout_joint;
+   int strobing_sub_led_id;
+};
+
+struct max77693_led_settings {
+   struct led_flash_setting torch_brightness;
+   struct led_flash_setting flash_brightness;
+   struct led_flash_setting flash_timeout;
+};
+
+static u8 max77693_led_iout_to_reg(u32 ua)
+{
+   if (ua < FLASH_IOUT_MIN)
+   ua = FLASH_IOUT_MIN;
+   return (ua - FLASH_IOUT_MIN) / FLASH_IOUT_STEP;
+}
+
+static u8 max77693_flash_timeout_to_reg(u32 us)
+{
+   return (us - FLASH_TIMEOUT_MIN) / FLASH_TIMEOUT_STEP;
+}
+
+static inline struct max77693_led *ldev1_to_led(
+   struct led_classdev_flash *ldev)
+{
+   struct max77693_sub_led *sub_led = container_of(ldev,
+   struct max77693_sub_led,
+   ldev);
+   return container_of(sub_led, struct max77693_led, sub_leds[0]);
+}
+
+static inline struct max77693_led *ldev2_to_led(
+   struct led_classdev_flash *ldev)
+{
+   struct max77693_sub_led *sub_led = contain

[PATCH/RFC v6 2/2] leds: Add driver for AAT1290 current regulator

2014-09-22 Thread Jacek Anaszewski
This patch adds a driver for the 1.5A Step-Up
Current Regulator for Flash LEDs. The device is
programmed through a Skyworks' proprietary AS2Cwire
serial digital interface.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Bryan Wu 
Cc: Richard Purdie 
---
 drivers/leds/Kconfig|6 +
 drivers/leds/Makefile   |1 +
 drivers/leds/leds-aat1290.c |  460 +++
 3 files changed, 467 insertions(+)
 create mode 100644 drivers/leds/leds-aat1290.c

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index c654f74..2a158fc 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -43,6 +43,12 @@ config LEDS_88PM860X
  This option enables support for on-chip LED drivers found on Marvell
  Semiconductor 88PM8606 PMIC.
 
+config LEDS_AAT1290
+   tristate "LED support for the AAT1290"
+   depends on LEDS_CLASS_FLASH
+   help
+This option enables support for the LEDs on the AAT1290.
+
 config LEDS_LM3530
tristate "LCD Backlight driver for LM3530"
depends on LEDS_CLASS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 1178426..1675ef9 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o
 
 # LED Platform Drivers
 obj-$(CONFIG_LEDS_88PM860X)+= leds-88pm860x.o
+obj-$(CONFIG_LEDS_AAT1290) += leds-aat1290.o
 obj-$(CONFIG_LEDS_BD2802)  += leds-bd2802.o
 obj-$(CONFIG_LEDS_LOCOMO)  += leds-locomo.o
 obj-$(CONFIG_LEDS_LM3530)  += leds-lm3530.o
diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c
new file mode 100644
index 000..35ee4d5
--- /dev/null
+++ b/drivers/leds/leds-aat1290.c
@@ -0,0 +1,460 @@
+/*
+ * LED Flash Class driver for the AAT1290
+ * 1.5A Step-Up Current Regulator for Flash LEDs
+ *
+ * Copyright (C) 2014, Samsung Electronics Co., Ltd.
+ * Author: Jacek Anaszewski 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define AAT1290_LED_NAME   "aat1290"
+#define AAT1290_MOVIE_MODE_CURRENT_ADDR17
+#define AAT1290_FLASH_SAFETY_TIMER_ADDR18
+#define AAT1290_MOVIE_MODE_CONFIG_ADDR 19
+#define AAT1290_MM_CURRENT_RATIO_ADDR  20
+#define AAT1290_LATCH_TIME_US  500
+#define AAT1290_EN_SET_TICK_TIME_US1
+#define AAT1290_MOVIE_MODE_OFF 1
+#define AAT1290_MOVIE_MODE_ON  3
+#define AAT1290_MAX_MM_CURR_PERCENT_0  16
+#define AAT1290_MAX_MM_CURR_PERCENT_100 1
+#define AAT1290_FLASH_TM_NUM_LEVELS16
+
+#define AAT1290_MM_TO_FL_1_92  1
+#define AAT1290_MM_TO_FL_3_7   2
+#define AAT1290_MM_TO_FL_5_5   3
+#define AAT1290_MM_TO_FL_7_3   4
+#define AAT1290_MM_TO_FL_9 5
+#define AAT1290_MM_TO_FL_10_7  6
+#define AAT1290_MM_TO_FL_12_4  7
+#define AAT1290_MM_TO_FL_148
+#define AAT1290_MM_TO_FL_15_9  9
+#define AAT1290_MM_TO_FL_17_5  10
+#define AAT1290_MM_TO_FL_19_1  11
+#define AAT1290_MM_TO_FL_20_8  12
+#define AAT1290_MM_TO_FL_22_4  13
+#define AAT1290_MM_TO_FL_2414
+#define AAT1290_MM_TO_FL_25_6  15
+#define AAT1290_MM_TO_FL_OFF   16
+
+struct aat1290_led_settings {
+   struct led_flash_setting torch_brightness;
+   struct led_flash_setting flash_brightness;
+   struct led_flash_setting flash_timeout;
+};
+
+struct aat1290_led {
+   struct platform_device *pdev;
+   struct mutex lock;
+
+   struct led_classdev_flash ldev;
+   struct v4l2_flash *v4l2_flash;
+
+   int flen_gpio;
+   int en_set_gpio;
+
+   u32 max_flash_tm;
+   bool movie_mode;
+
+   unsigned int torch_brightness;
+   unsigned int flash_timeout;
+   struct work_struct work_brightness_set;
+};
+
+static struct aat1290_led *ldev_to_led(struct led_classdev_flash *ldev)
+{
+   return container_of(ldev, struct aat1290_led, ldev);
+}
+
+static void aat1290_as2cwire_write(struct aat1290_led *led, int addr, int 
value)
+{
+   int i;
+
+   gpio_set_value(led->flen_gpio, 0);
+   gpio_set_value(led->en_set_gpio, 0);
+
+   udelay(10);
+
+   /* write address */
+   for (i = 0; i < addr; ++i) {
+   udelay(AAT1290_EN_SET_TICK_TIME_US);
+   gpio_set_value(led->en_set_gpio, 0);
+   udelay(AAT1290_EN_SET_TICK_TIME_US);
+   gpio_set_value(led->en_set_gpio, 1);
+   }
+
+   udelay(AAT1290_LATCH_TIME_US);
+
+   /* write data */
+   for (i = 0; i < value; ++i) {
+   udelay(AAT1290_EN_SET_TICK_TIME_US);
+   gpio_set_value(led->en_set_gpio, 0);
+   udelay(AAT1290_EN_SET_TICK_TIME_US);
+   gpio_set_value(led->en_set_gpio, 1)

[PATCH/RFC v6 3/3] leds: Add LED Flash Class wrapper to LED subsystem

2014-09-22 Thread Jacek Anaszewski
Some LED devices support two operation modes - torch and flash.
This patch provides support for flash LED devices in the LED subsystem
by introducing new sysfs attributes and kernel internal interface.
The attributes being introduced are: flash_brightness, flash_strobe,
flash_timeout, max_flash_timeout, max_flash_brightness, flash_fault,
indicator_brightness and  max_indicator_brightness. All the flash
related features are placed in a separate module.

The modifications aim to be compatible with V4L2 framework requirements
related to the flash devices management. The design assumes that V4L2
sub-device can take of the LED class device control and communicate
with it through the kernel internal interface. When V4L2 Flash sub-device
file is opened, the LED class device sysfs interface is made
unavailable.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Bryan Wu 
Cc: Richard Purdie 
---
 drivers/leds/Kconfig|   11 +
 drivers/leds/Makefile   |1 +
 drivers/leds/led-class-flash.c  |  557 +++
 drivers/leds/led-class.c|4 +
 include/linux/led-class-flash.h |  238 +
 include/linux/leds.h|3 +
 6 files changed, 814 insertions(+)
 create mode 100644 drivers/leds/led-class-flash.c
 create mode 100644 include/linux/led-class-flash.h

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 8c96e2d..3c58021 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -22,6 +22,17 @@ config LEDS_CLASS
  This option enables the led sysfs class in /sys/class/leds.  You'll
  need this to do anything useful with LEDs.  If unsure, say N.
 
+config LEDS_CLASS_FLASH
+   tristate "LED Flash Class Support"
+   depends on LEDS_CLASS
+   depends on OF
+   help
+ This option enables the flash led sysfs class in /sys/class/leds.
+ It wrapps LED Class and adds flash LEDs specific sysfs attributes
+ and kernel internal API to it. You'll need this to provide support
+ for the flash related features of a LED device. It can be built
+ as a module.
+
 comment "LED drivers"
 
 config LEDS_88PM860X
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index d8cc5f2..9238b8a 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -2,6 +2,7 @@
 # LED Core
 obj-$(CONFIG_NEW_LEDS) += led-core.o
 obj-$(CONFIG_LEDS_CLASS)   += led-class.o
+obj-$(CONFIG_LEDS_CLASS_FLASH) += led-class-flash.o
 obj-$(CONFIG_LEDS_TRIGGERS)+= led-triggers.o
 
 # LED Platform Drivers
diff --git a/drivers/leds/led-class-flash.c b/drivers/leds/led-class-flash.c
new file mode 100644
index 000..f1ba539
--- /dev/null
+++ b/drivers/leds/led-class-flash.c
@@ -0,0 +1,557 @@
+/*
+ * LED Flash Class interface
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd.
+ * Author: Jacek Anaszewski 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "leds.h"
+
+#define has_flash_op(flash, op)\
+   (flash && flash->ops->op)
+
+#define call_flash_op(flash, op, args...)  \
+   ((has_flash_op(flash, op)) ?\
+   (flash->ops->op(flash, args)) : \
+   -EINVAL)
+
+static ssize_t flash_brightness_store(struct device *dev,
+   struct device_attribute *attr, const char *buf, size_t size)
+{
+   struct led_classdev *led_cdev = dev_get_drvdata(dev);
+   struct led_classdev_flash *flash = lcdev_to_flash(led_cdev);
+   unsigned long state;
+   ssize_t ret;
+
+   mutex_lock(&led_cdev->led_access);
+
+   if (led_sysfs_is_disabled(led_cdev)) {
+   ret = -EBUSY;
+   goto unlock;
+   }
+
+   ret = kstrtoul(buf, 10, &state);
+   if (ret)
+   goto unlock;
+
+   ret = led_set_flash_brightness(flash, state);
+   if (ret < 0)
+   goto unlock;
+
+   ret = size;
+unlock:
+   mutex_unlock(&led_cdev->led_access);
+   return ret;
+}
+
+static ssize_t flash_brightness_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct led_classdev *led_cdev = dev_get_drvdata(dev);
+   struct led_classdev_flash *flash = lcdev_to_flash(led_cdev);
+
+   /* no lock needed for this */
+   led_update_flash_brightness(flash);
+
+   return sprintf(buf, "%u\n", flash->brightness.val);
+}
+static DEVICE_ATTR_RW(flash_brightness);
+
+static ssize_t max_flash_brightness_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct led_classdev *led_cdev = dev_get_drvdata(dev);
+   struct led_classdev_flash *flash = lcdev_to_flash(l

[PATCH/RFC v6 0/2] LED / flash API integration - V4L2 Flash

2014-09-22 Thread Jacek Anaszewski
This patch set is the follow-up of the LED / flash API integration
series [1]. For clarity reasons the patchset has been split into
four subsets:

- LED Flash Class
- V4L2 Flash
- LED Flash Class drivers
- Documentation


Changes since version 5:


- removed flash manager framework - its implementation needs
  further thorough discussion.
- removed external strobe facilities from the LED Flash Class
  and provided external_strobe_set op in v4l2-flash. LED subsystem
  should be strobe provider agnostic.

Thanks,
Jacek Anaszewski

[1] https://lkml.org/lkml/2014/7/11/914

Jacek Anaszewski (2):
  media: Add registration helpers for V4L2 flash
  exynos4-is: Add support for v4l2-flash subdevs

 drivers/media/platform/exynos4-is/media-dev.c |   36 +-
 drivers/media/platform/exynos4-is/media-dev.h |   13 +-
 drivers/media/v4l2-core/Kconfig   |   11 +
 drivers/media/v4l2-core/Makefile  |2 +
 drivers/media/v4l2-core/v4l2-flash.c  |  502 +
 include/media/v4l2-flash.h|  135 +++
 6 files changed, 696 insertions(+), 3 deletions(-)
 create mode 100644 drivers/media/v4l2-core/v4l2-flash.c
 create mode 100644 include/media/v4l2-flash.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/RFC v6 2/2] exynos4-is: Add support for v4l2-flash subdevs

2014-09-22 Thread Jacek Anaszewski
This patch adds suppport for external v4l2-flash devices.
The support includes parsing camera-flash DT property
and asynchronous subdevice registration.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Sylwester Nawrocki 
---
 drivers/media/platform/exynos4-is/media-dev.c |   36 +++--
 drivers/media/platform/exynos4-is/media-dev.h |   13 -
 2 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/exynos4-is/media-dev.c 
b/drivers/media/platform/exynos4-is/media-dev.c
index 344718d..9758b59 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -451,6 +451,25 @@ rpm_put:
return ret;
 }
 
+static void fimc_md_register_flash_entities(struct fimc_md *fmd)
+{
+   struct device_node *parent = fmd->pdev->dev.of_node;
+   struct device_node *np;
+   int i = 0;
+
+   do {
+   np = of_parse_phandle(parent, "flashes", i);
+   if (np) {
+   fmd->flash[fmd->num_flashes].asd.match_type =
+   V4L2_ASYNC_MATCH_OF;
+   fmd->flash[fmd->num_flashes].asd.match.of.node = np;
+   fmd->num_flashes++;
+   fmd->async_subdevs[fmd->num_sensors + i] =
+   &fmd->flash[i].asd;
+   }
+   } while (np && (++i < FIMC_MAX_FLASHES));
+}
+
 static int __of_get_csis_id(struct device_node *np)
 {
u32 reg = 0;
@@ -1273,6 +1292,15 @@ static int subdev_notifier_bound(struct 
v4l2_async_notifier *notifier,
struct fimc_sensor_info *si = NULL;
int i;
 
+   /* Register flash subdev if detected any */
+   for (i = 0; i < ARRAY_SIZE(fmd->flash); i++) {
+   if (fmd->flash[i].asd.match.of.node == subdev->dev->of_node) {
+   fmd->flash[i].subdev = subdev;
+   fmd->num_flashes++;
+   return 0;
+   }
+   }
+
/* Find platform data for this sensor subdev */
for (i = 0; i < ARRAY_SIZE(fmd->sensor); i++)
if (fmd->sensor[i].asd.match.of.node == subdev->dev->of_node)
@@ -1383,6 +1411,8 @@ static int fimc_md_probe(struct platform_device *pdev)
goto err_m_ent;
}
 
+   fimc_md_register_flash_entities(fmd);
+
mutex_unlock(&fmd->media_dev.graph_mutex);
 
ret = device_create_file(&pdev->dev, &dev_attr_subdev_conf_mode);
@@ -1399,12 +1429,14 @@ static int fimc_md_probe(struct platform_device *pdev)
goto err_attr;
}
 
-   if (fmd->num_sensors > 0) {
+   if (fmd->num_sensors > 0 || fmd->num_flashes > 0) {
fmd->subdev_notifier.subdevs = fmd->async_subdevs;
-   fmd->subdev_notifier.num_subdevs = fmd->num_sensors;
+   fmd->subdev_notifier.num_subdevs = fmd->num_sensors +
+   fmd->num_flashes;
fmd->subdev_notifier.bound = subdev_notifier_bound;
fmd->subdev_notifier.complete = subdev_notifier_complete;
fmd->num_sensors = 0;
+   fmd->num_flashes = 0;
 
ret = v4l2_async_notifier_register(&fmd->v4l2_dev,
&fmd->subdev_notifier);
diff --git a/drivers/media/platform/exynos4-is/media-dev.h 
b/drivers/media/platform/exynos4-is/media-dev.h
index 0321454..feff9c8 100644
--- a/drivers/media/platform/exynos4-is/media-dev.h
+++ b/drivers/media/platform/exynos4-is/media-dev.h
@@ -34,6 +34,8 @@
 
 #define FIMC_MAX_SENSORS   4
 #define FIMC_MAX_CAMCLKS   2
+#define FIMC_MAX_FLASHES   2
+#define FIMC_MAX_ASYNC_SUBDEVS (FIMC_MAX_SENSORS + FIMC_MAX_FLASHES)
 #define DEFAULT_SENSOR_CLK_FREQ2400U
 
 /* LCD/ISP Writeback clocks (PIXELASYNCMx) */
@@ -93,6 +95,11 @@ struct fimc_sensor_info {
struct fimc_dev *host;
 };
 
+struct fimc_flash_info {
+   struct v4l2_subdev *subdev;
+   struct v4l2_async_subdev asd;
+};
+
 struct cam_clk {
struct clk_hw hw;
struct fimc_md *fmd;
@@ -104,6 +111,8 @@ struct cam_clk {
  * @csis: MIPI CSIS subdevs data
  * @sensor: array of registered sensor subdevs
  * @num_sensors: actual number of registered sensors
+ * @flash: array of registered flash subdevs
+ * @num_flashes: actual number of registered flashes
  * @camclk: external sensor clock information
  * @fimc: array of registered fimc devices
  * @fimc_is: fimc-is data structure
@@ -123,6 +132,8 @@ struct fimc_md {
struct fimc_csis_info csis[CSIS_MAX_ENTITIES];
struct fimc_sensor_info sensor[FIMC_MAX_SENSORS];
int num_sensors;
+   struct fimc_flash_info flash[FIMC_MAX_FLASHES];
+   int num_flashes;
struct fimc_camclk_info camclk[FIMC_MAX_CAMCLKS];
struct clk *wbclk[FIMC_MAX_WBCLKS];
struct fimc_lite *fimc_

[PATCH/RFC v6 1/3] leds: implement sysfs interface locking mechanism

2014-09-22 Thread Jacek Anaszewski
Add a mechanism for locking LED subsystem sysfs interface.
This patch prepares ground for addition of LED Flash Class
extension, whose API will be integrated with V4L2 Flash API.
Such a fusion enforces introducing a locking scheme, which
will secure consistent access to the LED Flash Class device.

The mechanism being introduced allows for disabling LED
subsystem sysfs interface by calling led_sysfs_disable function
and enabling it by calling led_sysfs_enable. The functions
alter the LED_SYSFS_DISABLE flag state and must be called
under mutex lock. The state of the lock is checked with use
of led_sysfs_is_disabled function. Such a design allows for
providing immediate feedback to the user space on whether
the LED Flash Class device is available or is under V4L2 Flash
sub-device control.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Bryan Wu 
Cc: Richard Purdie 
---
 drivers/leds/led-class.c|   19 ---
 drivers/leds/led-core.c |   18 ++
 drivers/leds/led-triggers.c |   16 +---
 include/linux/leds.h|   32 
 4 files changed, 79 insertions(+), 6 deletions(-)

diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 2e124aa2..a39ca8f 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -39,17 +39,27 @@ static ssize_t brightness_store(struct device *dev,
 {
struct led_classdev *led_cdev = dev_get_drvdata(dev);
unsigned long state;
-   ssize_t ret = -EINVAL;
+   ssize_t ret;
+
+   mutex_lock(&led_cdev->led_access);
+
+   if (led_sysfs_is_disabled(led_cdev)) {
+   ret = -EBUSY;
+   goto unlock;
+   }
 
ret = kstrtoul(buf, 10, &state);
if (ret)
-   return ret;
+   goto unlock;
 
if (state == LED_OFF)
led_trigger_remove(led_cdev);
__led_set_brightness(led_cdev, state);
 
-   return size;
+   ret = size;
+unlock:
+   mutex_unlock(&led_cdev->led_access);
+   return ret;
 }
 static DEVICE_ATTR_RW(brightness);
 
@@ -213,6 +223,7 @@ int led_classdev_register(struct device *parent, struct 
led_classdev *led_cdev)
 #ifdef CONFIG_LEDS_TRIGGERS
init_rwsem(&led_cdev->trigger_lock);
 #endif
+   mutex_init(&led_cdev->led_access);
/* add to the list of leds */
down_write(&leds_list_lock);
list_add_tail(&led_cdev->node, &leds_list);
@@ -266,6 +277,8 @@ void led_classdev_unregister(struct led_classdev *led_cdev)
down_write(&leds_list_lock);
list_del(&led_cdev->node);
up_write(&leds_list_lock);
+
+   mutex_destroy(&led_cdev->led_access);
 }
 EXPORT_SYMBOL_GPL(led_classdev_unregister);
 
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
index 0d15aa9..cca86ab 100644
--- a/drivers/leds/led-core.c
+++ b/drivers/leds/led-core.c
@@ -142,3 +142,21 @@ int led_update_brightness(struct led_classdev *led_cdev)
return ret;
 }
 EXPORT_SYMBOL(led_update_brightness);
+
+/* Caller must ensure led_cdev->led_access held */
+void led_sysfs_disable(struct led_classdev *led_cdev)
+{
+   lockdep_assert_held(&led_cdev->led_access);
+
+   led_cdev->flags |= LED_SYSFS_DISABLE;
+}
+EXPORT_SYMBOL_GPL(led_sysfs_disable);
+
+/* Caller must ensure led_cdev->led_access held */
+void led_sysfs_enable(struct led_classdev *led_cdev)
+{
+   lockdep_assert_held(&led_cdev->led_access);
+
+   led_cdev->flags &= ~LED_SYSFS_DISABLE;
+}
+EXPORT_SYMBOL_GPL(led_sysfs_enable);
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index c3734f1..e8b1120 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -37,6 +37,14 @@ ssize_t led_trigger_store(struct device *dev, struct 
device_attribute *attr,
char trigger_name[TRIG_NAME_MAX];
struct led_trigger *trig;
size_t len;
+   int ret = count;
+
+   mutex_lock(&led_cdev->led_access);
+
+   if (led_sysfs_is_disabled(led_cdev)) {
+   ret = -EBUSY;
+   goto unlock;
+   }
 
trigger_name[sizeof(trigger_name) - 1] = '\0';
strncpy(trigger_name, buf, sizeof(trigger_name) - 1);
@@ -47,7 +55,7 @@ ssize_t led_trigger_store(struct device *dev, struct 
device_attribute *attr,
 
if (!strcmp(trigger_name, "none")) {
led_trigger_remove(led_cdev);
-   return count;
+   goto unlock;
}
 
down_read(&triggers_list_lock);
@@ -58,12 +66,14 @@ ssize_t led_trigger_store(struct device *dev, struct 
device_attribute *attr,
up_write(&led_cdev->trigger_lock);
 
up_read(&triggers_list_lock);
-   return count;
+   goto unlock;
}
}
up_read(&triggers_list_lock);
 
-   return -EINVAL;
+unlock:
+   mutex_unlock(&led_cdev->led_access);
+   return ret;
 }
 EXPORT_SYMBOL_G

[PATCH/RFC v6 2/3] leds: add API for setting torch brightness

2014-09-22 Thread Jacek Anaszewski
This patch prepares ground for addition of LED Flash Class extension to
the LED subsystem. Since turning the torch on must have guaranteed
immediate effect the brightness_set op can't be used for it. Drivers must
schedule a work queue task in this op to be compatible with led-triggers,
which call brightess_set from timer irqs. In order to address this
limitation a torch_brightness_set op and led_set_torch_brightness API
is introduced. Setting brightness sysfs attribute will result in calling
brightness_set op for LED Class devices and torch_brightness_set op for
LED Flash Class devices, whereas triggers will still call brightness
op in both cases.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Bryan Wu 
Cc: Richard Purdie 
---
 drivers/leds/led-class.c |9 +++--
 drivers/leds/led-core.c  |   14 ++
 include/linux/leds.h |   21 +
 3 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index a39ca8f..5a11a07 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -54,9 +54,14 @@ static ssize_t brightness_store(struct device *dev,
 
if (state == LED_OFF)
led_trigger_remove(led_cdev);
-   __led_set_brightness(led_cdev, state);
 
-   ret = size;
+   if (led_cdev->flags & LED_DEV_CAP_TORCH)
+   ret = led_set_torch_brightness(led_cdev, state);
+   else
+   __led_set_brightness(led_cdev, state);
+
+   if (!ret)
+   ret = size;
 unlock:
mutex_unlock(&led_cdev->led_access);
return ret;
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
index cca86ab..c6d8288 100644
--- a/drivers/leds/led-core.c
+++ b/drivers/leds/led-core.c
@@ -143,6 +143,20 @@ int led_update_brightness(struct led_classdev *led_cdev)
 }
 EXPORT_SYMBOL(led_update_brightness);
 
+int led_set_torch_brightness(struct led_classdev *led_cdev,
+   enum led_brightness brightness)
+{
+   int ret = 0;
+
+   led_cdev->brightness = min(brightness, led_cdev->max_brightness);
+
+   if (!(led_cdev->flags & LED_SUSPENDED))
+   ret = led_cdev->torch_brightness_set(led_cdev,
+led_cdev->brightness);
+   return ret;
+}
+EXPORT_SYMBOL_GPL(led_set_torch_brightness);
+
 /* Caller must ensure led_cdev->led_access held */
 void led_sysfs_disable(struct led_classdev *led_cdev)
 {
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 44c8a98..bc2a570 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -44,11 +44,21 @@ struct led_classdev {
 #define LED_BLINK_ONESHOT_STOP (1 << 18)
 #define LED_BLINK_INVERT   (1 << 19)
 #define LED_SYSFS_DISABLE  (1 << 20)
+#define LED_DEV_CAP_TORCH  (1 << 21)
 
/* Set LED brightness level */
/* Must not sleep, use a workqueue if needed */
void(*brightness_set)(struct led_classdev *led_cdev,
  enum led_brightness brightness);
+   /*
+* Set LED brightness immediately - it is required for flash led
+* devices as they require setting torch brightness to have immediate
+* effect. brightness_set op cannot be used for this purpose because
+* the led drivers schedule a work queue task in it to allow for
+* being called from led-triggers, i.e. from the timer irq context.
+*/
+   int (*torch_brightness_set)(struct led_classdev *led_cdev,
+   enum led_brightness brightness);
/* Get LED brightness level */
enum led_brightness (*brightness_get)(struct led_classdev *led_cdev);
 
@@ -157,6 +167,17 @@ extern void led_set_brightness(struct led_classdev 
*led_cdev,
 extern int led_update_brightness(struct led_classdev *led_cdev);
 
 /**
+ * led_set_torch_brightness - set torch LED brightness
+ * @led_cdev: the LED to set
+ * @brightness: the brightness to set it to
+ *
+ * Returns: 0 on success or negative error value on failure
+ *
+ * Set a torch LED's brightness.
+ */
+extern int led_set_torch_brightness(struct led_classdev *led_cdev,
+   enum led_brightness brightness);
+/**
  * led_sysfs_disable - disable LED sysfs interface
  * @led_cdev: the LED to set
  *
-- 
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/RFC v6 0/3] LED / flash API integration - LED Flash Class

2014-09-22 Thread Jacek Anaszewski
This patch set is the follow-up of the LED / flash API integration
series [1]. For clarity reasons the patchset has been split into
four subsets:

- LED Flash Class
- V4L2 Flash
- LED Flash Class drivers
- Documentation


Changes since version 5:


- removed flash manager framework - its implementation needs
  further thorough discussion.
- removed external strobe facilities from the LED Flash Class
  and provided external_strobe_set op in v4l2-flash. LED subsystem
  should be strobe provider agnostic.

Thanks,
Jacek Anaszewski

[1] https://lkml.org/lkml/2014/7/11/914


Jacek Anaszewski (3):
  leds: implement sysfs interface locking mechanism
  leds: add API for setting torch brightness
  leds: Add LED Flash Class wrapper to LED subsystem

 drivers/leds/Kconfig|   11 +
 drivers/leds/Makefile   |1 +
 drivers/leds/led-class-flash.c  |  557 +++
 drivers/leds/led-class.c|   30 ++-
 drivers/leds/led-core.c |   32 +++
 drivers/leds/led-triggers.c |   16 +-
 include/linux/led-class-flash.h |  238 +
 include/linux/leds.h|   56 
 8 files changed, 934 insertions(+), 7 deletions(-)
 create mode 100644 drivers/leds/led-class-flash.c
 create mode 100644 include/linux/led-class-flash.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/RFC v6 1/2] media: Add registration helpers for V4L2 flash

2014-09-22 Thread Jacek Anaszewski
This patch adds helper functions for registering/unregistering
LED class flash devices as V4L2 subdevs. The functions should
be called from the LED subsystem device driver. In case the
support for V4L2 Flash sub-devices is disabled in the kernel
config the functions' empty versions will be used.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Sakari Ailus 
Cc: Hans Verkuil 
Cc: Bryan Wu 
Cc: Richard Purdie 
---
 drivers/media/v4l2-core/Kconfig  |   11 +
 drivers/media/v4l2-core/Makefile |2 +
 drivers/media/v4l2-core/v4l2-flash.c |  502 ++
 include/media/v4l2-flash.h   |  135 +
 4 files changed, 650 insertions(+)
 create mode 100644 drivers/media/v4l2-core/v4l2-flash.c
 create mode 100644 include/media/v4l2-flash.h

diff --git a/drivers/media/v4l2-core/Kconfig b/drivers/media/v4l2-core/Kconfig
index 9ca0f8d..7e0c42f 100644
--- a/drivers/media/v4l2-core/Kconfig
+++ b/drivers/media/v4l2-core/Kconfig
@@ -35,6 +35,17 @@ config V4L2_MEM2MEM_DEV
 tristate
 depends on VIDEOBUF2_CORE
 
+# Used by LED subsystem flash drivers
+config V4L2_FLASH_LED_CLASS
+   tristate "Enable support for Flash sub-devices"
+   depends on VIDEO_V4L2_SUBDEV_API
+   depends on LEDS_CLASS_FLASH
+   ---help---
+ Say Y here to enable support for Flash sub-devices, which allow
+ to control LED class devices with use of V4L2 Flash controls.
+
+ When in doubt, say N.
+
 # Used by drivers that need Videobuf modules
 config VIDEOBUF_GEN
tristate
diff --git a/drivers/media/v4l2-core/Makefile b/drivers/media/v4l2-core/Makefile
index 63d29f2..44e858c 100644
--- a/drivers/media/v4l2-core/Makefile
+++ b/drivers/media/v4l2-core/Makefile
@@ -22,6 +22,8 @@ obj-$(CONFIG_VIDEO_TUNER) += tuner.o
 
 obj-$(CONFIG_V4L2_MEM2MEM_DEV) += v4l2-mem2mem.o
 
+obj-$(CONFIG_V4L2_FLASH_LED_CLASS) += v4l2-flash.o
+
 obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o
 obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o
 obj-$(CONFIG_VIDEOBUF_DMA_CONTIG) += videobuf-dma-contig.o
diff --git a/drivers/media/v4l2-core/v4l2-flash.c 
b/drivers/media/v4l2-core/v4l2-flash.c
new file mode 100644
index 000..2236f8b
--- /dev/null
+++ b/drivers/media/v4l2-core/v4l2-flash.c
@@ -0,0 +1,502 @@
+/*
+ * V4L2 Flash LED sub-device registration helpers.
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd
+ * Author: Jacek Anaszewski 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation."
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define has_flash_op(v4l2_flash, op)   \
+   (v4l2_flash && v4l2_flash->ops->op)
+
+#define call_flash_op(v4l2_flash, op, args...) \
+   (has_flash_op(v4l2_flash, op) ? \
+   v4l2_flash->ops->op(args) : \
+   -EINVAL)
+
+static inline enum led_brightness v4l2_flash_intensity_to_led_brightness(
+   struct v4l2_ctrl *ctrl,
+   s32 intensity)
+{
+   s64 __intensity = intensity - ctrl->minimum;
+
+   do_div(__intensity, ctrl->step);
+
+   return __intensity + 1;
+}
+
+static inline s32 v4l2_flash_led_brightness_to_intensity(
+   struct v4l2_ctrl *ctrl,
+   enum led_brightness brightness)
+{
+   return ((brightness - 1) * ctrl->step) + ctrl->minimum;
+}
+
+static int v4l2_flash_g_volatile_ctrl(struct v4l2_ctrl *c)
+{
+   struct v4l2_flash *v4l2_flash = v4l2_ctrl_to_v4l2_flash(c);
+   struct led_classdev_flash *flash = v4l2_flash->flash;
+   struct led_classdev *led_cdev = &flash->led_cdev;
+   struct v4l2_ctrl **ctrls = v4l2_flash->ctrls;
+   bool is_strobing;
+   int ret;
+
+   switch (c->id) {
+   case V4L2_CID_FLASH_TORCH_INTENSITY:
+   /*
+* Update torch brightness only if in TORCH_MODE,
+* as otherwise brightness_update op returns 0,
+* which would spuriously inform user space that
+* V4L2_CID_FLASH_TORCH_INTENSITY control value
+* has changed.
+*/
+   if (ctrls[LED_MODE]->val == V4L2_FLASH_LED_MODE_TORCH) {
+   ret = led_update_brightness(led_cdev);
+   if (ret < 0)
+   return ret;
+   ctrls[TORCH_INTENSITY]->val =
+   v4l2_flash_led_brightness_to_intensity(
+   ctrls[TORCH_INTENSITY],
+   led_cdev->brightness);
+   }
+   return 0;
+   case V4L2_CID_FLASH_INTENSITY:
+   ret = led_update_flash_brightness(flash);
+

[PATCH 5/5] media: au0828-core changes to create and destroy media token res

2014-09-22 Thread Shuah Khan
Changed au0828-core to create media token resource in its
usb_probe() and destroy it from usb_disconnect() interfaces.
It creates the resource on the main struct device which is
the parent device for the interface usb device. This is the
main struct device that is common for all the drivers that
control the media device, including the non-media sound
drivers.

Signed-off-by: Shuah Khan 
---
 drivers/media/usb/au0828/au0828-core.c |   23 +++
 1 file changed, 23 insertions(+)

diff --git a/drivers/media/usb/au0828/au0828-core.c 
b/drivers/media/usb/au0828/au0828-core.c
index bc06480..189e435 100644
--- a/drivers/media/usb/au0828/au0828-core.c
+++ b/drivers/media/usb/au0828/au0828-core.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  * 1 = General debug messages
@@ -127,6 +128,17 @@ static int recv_control_msg(struct au0828_dev *dev, u16 
request, u32 value,
return status;
 }
 
+/* interfaces to create and destroy media tknres */
+static int au0828_create_media_tknres(struct au0828_dev *dev)
+{
+   return media_tknres_create(&dev->usbdev->dev);
+}
+
+static int au0828_destroy_media_tknres(struct au0828_dev *dev)
+{
+   return media_tknres_destroy(&dev->usbdev->dev);
+}
+
 static void au0828_usb_release(struct au0828_dev *dev)
 {
/* I2C */
@@ -157,6 +169,8 @@ static void au0828_usb_disconnect(struct usb_interface 
*interface)
/* Digital TV */
au0828_dvb_unregister(dev);
 
+   au0828_destroy_media_tknres(dev);
+
usb_set_intfdata(interface, NULL);
mutex_lock(&dev->mutex);
dev->usbdev = NULL;
@@ -215,6 +229,13 @@ static int au0828_usb_probe(struct usb_interface 
*interface,
dev->usbdev = usbdev;
dev->boardnr = id->driver_info;
 
+   /* create media token resource */
+   if (au0828_create_media_tknres(dev)) {
+   mutex_unlock(&dev->lock);
+   kfree(dev);
+   return -ENOMEM;
+   }
+
 #ifdef CONFIG_VIDEO_AU0828_V4L2
dev->v4l2_dev.release = au0828_usb_v4l2_release;
 
@@ -223,6 +244,7 @@ static int au0828_usb_probe(struct usb_interface *interface,
if (retval) {
pr_err("%s() v4l2_device_register failed\n",
   __func__);
+   au0828_destroy_media_tknres(dev);
mutex_unlock(&dev->lock);
kfree(dev);
return retval;
@@ -232,6 +254,7 @@ static int au0828_usb_probe(struct usb_interface *interface,
if (retval) {
pr_err("%s() v4l2_ctrl_handler_init failed\n",
   __func__);
+   au0828_destroy_media_tknres(dev);
mutex_unlock(&dev->lock);
kfree(dev);
return retval;
-- 
1.7.10.4

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


[PATCH 1/5] media: add media token device resource framework

2014-09-22 Thread Shuah Khan
Add media token device resource framework to allow sharing
resources such as tuner, dma, audio etc. across media drivers
and non-media sound drivers that control media hardware. The
Media token resource is created at the main struct device that
is common to all drivers that claim various pieces of the main
media device, which allows them to find the resource using the
main struct device. As an example, digital, analog, and
snd-usb-audio drivers can use the media token resource API
using the main struct device for the interface the media device
is attached to.

The media token resource contains token for tuner, dma, and
audio. Each token has valid modes or states it can be in.
When a token is in one of the exclusive modes, only one owner
is allowed. When a token is in shared mode, owners with the
request the token in the same mode in shared mode are allowed
to share the token.

As an example, when tuner token is held digital and exclusive
mode, no other requests are granted. On the other hand, when
the tuner token is held in shared analog mode, other requests
for shared analog access are granted.

Signed-off-by: Shuah Khan 
---
 MAINTAINERS  |2 +
 include/linux/media_tknres.h |   98 
 lib/Makefile |2 +
 lib/media_tknres.c   |  361 ++
 4 files changed, 463 insertions(+)
 create mode 100644 include/linux/media_tknres.h
 create mode 100644 lib/media_tknres.c

diff --git a/MAINTAINERS b/MAINTAINERS
index aefa948..861f6c6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5821,6 +5821,8 @@ F:include/uapi/linux/v4l2-*
 F: include/uapi/linux/meye.h
 F: include/uapi/linux/ivtv*
 F: include/uapi/linux/uvcvideo.h
+F: include/linux/media_tknres.h
+F: lib/media_tknres.c
 
 MEDIAVISION PRO MOVIE STUDIO DRIVER
 M: Hans Verkuil 
diff --git a/include/linux/media_tknres.h b/include/linux/media_tknres.h
new file mode 100644
index 000..65a24df
--- /dev/null
+++ b/include/linux/media_tknres.h
@@ -0,0 +1,98 @@
+/*
+ * media_tknres.h - managed media token resource
+ *
+ * Copyright (c) 2014 Shuah Khan 
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * This file is released under the GPLv2.
+ */
+#ifndef __LINUX_MEDIA_TOKEN_H
+#define __LINUX_MEDIA_TOKEN_H
+
+struct device;
+
+enum media_tkn_mode {
+   MEDIA_MODE_DVB,
+   MEDIA_MODE_ANALOG,
+   MEDIA_MODE_RADIO,
+};
+
+#if defined(CONFIG_MEDIA_SUPPORT)
+extern int media_tknres_create(struct device *dev);
+extern int media_tknres_destroy(struct device *dev);
+
+extern int media_get_tuner_tkn(struct device *dev, enum media_tkn_mode mode);
+extern int media_get_shared_tuner_tkn(struct device *dev,
+   enum media_tkn_mode mode);
+extern int media_put_tuner_tkn(struct device *dev, enum media_tkn_mode mode);
+extern int media_reset_shared_tuner_tkn(struct device *dev,
+   enum media_tkn_mode mode);
+
+extern int media_get_dma_tkn(struct device *dev, enum media_tkn_mode mode);
+extern int media_get_shared_dma_tkn(struct device *dev,
+   enum media_tkn_mode mode);
+extern int media_put_dma_tkn(struct device *dev, enum media_tkn_mode mode);
+
+extern int media_get_audio_tkn(struct device *dev, enum media_tkn_mode mode);
+extern int media_get_shared_audio_tkn(struct device *dev,
+   enum media_tkn_mode mode);
+extern int media_put_audio_tkn(struct device *dev, enum media_tkn_mode mode);
+#else
+static inline int media_tknres_create(struct device *dev)
+{
+   return 0;
+}
+static inline int media_tknres_destroy(struct device *dev)
+{
+   return 0;
+}
+static inline int media_get_tuner_tkn(struct device *dev,
+   enum media_tkn_mode mode)
+{
+   return 0;
+}
+static inline int media_get_shared_tuner_tkn(struct device *dev,
+   enum media_tkn_mode mode)
+{
+   return 0;
+}
+static inline int media_put_tuner_tkn(struct device *dev)
+{
+   return 0;
+}
+static inline int media_reset_shared_tuner_tkn(struct device *dev,
+   enum media_tkn_mode mode)
+{
+   return 0;
+}
+static inline int media_get_dma_tkn(struct device *dev,
+   enum media_tkn_mode mode)
+{
+   return 0;
+}
+static inline int media_get_shared_dma_tkn(struct device *dev,
+   enum media_tkn_mode mode)
+{
+   return 0;
+}
+static inline int media_put_dma_tkn(struct device *dev)
+{
+   return 0;
+}
+static inline int media_get_audio_tkn(struct device *dev,
+   enum media_tkn_mode mode)
+{
+   return 0;
+}
+static inline int media_get_shared_audio_tkn(struct device *dev,
+   enum media_tkn_mode mode)
+{
+   return 0;
+}
+static inline int media_put_a

[PATCH 0/5] media token resource framework

2014-09-22 Thread Shuah Khan
Add media token device resource framework to allow sharing
resources such as tuner, dma, audio etc. across media drivers
and non-media sound drivers that control media hardware. The
Media token resource is created at the main struct device that
is common to all drivers that claim various pieces of the main
media device, which allows them to find the resource using the
main struct device. As an example, digital, analog, and
snd-usb-audio drivers can use the media token resource API
using the main struct device for the interface the media device
is attached to.

This patch series consists of media token resource framework
and changes to use it in dvb-core, v4l2-core, and au0828
driver.

With these changes dvb and v4l2 can share the tuner without
disrupting each other. Used tvtime, xawtv, kaffeine, and
vlc to during development to identify v4l2 vb2 and vb1 ioctls
and file operations that disrupt the digital stream and would
require changes to check tuner ownership prior to changing the
tuner configuration. vb2 changes are made in the v4l2-core and
vb1 changes are made in the au0828 driver to encourage porting
drivers to vb2 to advantage of the new media token resource
framework with changes in the core.

Shuah Khan (5):
  media: add media token device resource framework
  media: v4l2-core changes to use media tuner token api
  media: au0828-video changes to use media tuner token api
  media: dvb-core changes to use media tuner token api
  media: au0828-core changes to create and destroy media token res

 MAINTAINERS |2 +
 drivers/media/dvb-core/dvb_frontend.c   |   10 +
 drivers/media/usb/au0828/au0828-core.c  |   23 ++
 drivers/media/usb/au0828/au0828-video.c |   43 +++-
 drivers/media/v4l2-core/v4l2-fh.c   |   16 ++
 drivers/media/v4l2-core/v4l2-ioctl.c|   96 +++-
 include/linux/media_tknres.h|   98 +
 lib/Makefile|2 +
 lib/media_tknres.c  |  361 +++
 9 files changed, 648 insertions(+), 3 deletions(-)
 create mode 100644 include/linux/media_tknres.h
 create mode 100644 lib/media_tknres.c

-- 
1.7.10.4

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


[PATCH 2/5] media: v4l2-core changes to use media tuner token api

2014-09-22 Thread Shuah Khan
Changes to v4l2-core to hold tuner token in v4l2 ioctl that change
the tuner modes, and reset the token from fh exit. The changes are
limited to vb2 calls that disrupt digital stream. vb1 changes are
made in the driver. The following ioctls are changed:

S_INPUT, S_OUTPUT, S_FMT, S_TUNER, S_MODULATOR, S_FREQUENCY,
S_STD, S_HW_FREQ_SEEK:

- hold tuner in shared analog mode before calling appropriate
  ops->vidioc_s_*
- return leaving tuner in shared mode.
- Note that S_MODULATOR is now implemented in the core
  previously FCN.

QUERYSTD:
- hold tuner in shared analog mode before calling
  ops->vidioc_querystd
- return after calling put tuner - this simply decrements the
  owners. Leaves tuner in shared analog mode if owners > 0

v4l2_fh_exit:
- resets the media tuner token. A simple put token could leave
  the token in shared mode. The nature of analog token holds
  is unbalanced requiring a reset to clear it.

Signed-off-by: Shuah Khan 
---
 drivers/media/v4l2-core/v4l2-fh.c|   16 ++
 drivers/media/v4l2-core/v4l2-ioctl.c |   96 +-
 2 files changed, 110 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-fh.c 
b/drivers/media/v4l2-core/v4l2-fh.c
index c97067a..81ce3f9 100644
--- a/drivers/media/v4l2-core/v4l2-fh.c
+++ b/drivers/media/v4l2-core/v4l2-fh.c
@@ -25,7 +25,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -92,6 +95,19 @@ void v4l2_fh_exit(struct v4l2_fh *fh)
 {
if (fh->vdev == NULL)
return;
+
+   if (fh->vdev->dev_parent) {
+   enum media_tkn_mode mode;
+
+   mode = (fh->vdev->vfl_type == V4L2_TUNER_RADIO) ?
+   MEDIA_MODE_RADIO : MEDIA_MODE_ANALOG;
+   /* reset the token - the nature of token get in
+  analog mode is shared and unbalanced. There is
+  no clear start and stop, so shared token might
+  never get cleared */
+   media_reset_shared_tuner_tkn(fh->vdev->dev_parent, mode);
+   }
+
v4l2_event_unsubscribe_all(fh);
fh->vdev = NULL;
 }
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index d15e167..9e1f042 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -1003,6 +1004,37 @@ static void v4l_sanitize_format(struct v4l2_format *fmt)
   sizeof(fmt->fmt.pix) - offset);
 }
 
+static int v4l_get_tuner_tkn(struct video_device *vfd,
+   enum v4l2_tuner_type type)
+{
+   int ret = 0;
+
+   if (vfd->dev_parent) {
+   enum media_tkn_mode mode;
+
+   mode = (type == V4L2_TUNER_RADIO) ?
+   MEDIA_MODE_RADIO : MEDIA_MODE_ANALOG;
+   ret = media_get_shared_tuner_tkn(vfd->dev_parent, mode);
+   if (ret)
+   dev_info(vfd->dev_parent,
+   "%s: Tuner is busy\n", __func__);
+   }
+   dev_dbg(vfd->dev_parent, "%s: No token?? %d\n", __func__, ret);
+   return ret;
+}
+
+static void v4l_put_tuner_tkn(struct video_device *vfd,
+   enum v4l2_tuner_type type)
+{
+   if (vfd->dev_parent) {
+   enum media_tkn_mode mode;
+
+   mode = (type == V4L2_TUNER_RADIO) ?
+   MEDIA_MODE_RADIO : MEDIA_MODE_ANALOG;
+   media_put_tuner_tkn(vfd->dev_parent, mode);
+   }
+}
+
 static int v4l_querycap(const struct v4l2_ioctl_ops *ops,
struct file *file, void *fh, void *arg)
 {
@@ -1022,12 +1054,24 @@ static int v4l_querycap(const struct v4l2_ioctl_ops 
*ops,
 static int v4l_s_input(const struct v4l2_ioctl_ops *ops,
struct file *file, void *fh, void *arg)
 {
+   struct video_device *vfd = video_devdata(file);
+   int ret = 0;
+
+   ret = v4l_get_tuner_tkn(vfd, V4L2_TUNER_ANALOG_TV);
+   if (ret)
+   return ret;
return ops->vidioc_s_input(file, fh, *(unsigned int *)arg);
 }
 
 static int v4l_s_output(const struct v4l2_ioctl_ops *ops,
struct file *file, void *fh, void *arg)
 {
+   struct video_device *vfd = video_devdata(file);
+   int ret = 0;
+
+   ret = v4l_get_tuner_tkn(vfd, V4L2_TUNER_ANALOG_TV);
+   if (ret)
+   return ret;
return ops->vidioc_s_output(file, fh, *(unsigned int *)arg);
 }
 
@@ -1236,6 +1280,10 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,
bool is_tx = vfd->vfl_dir != VFL_DIR_RX;
int ret;
 
+   ret = v4l_get_tuner_tkn(vfd, V4L2_TUNER_ANALOG_TV);
+   if (ret)
+   return ret;
+
v4l_sanitize_format(p);
 
switch (p->type) {
@@ -1415,9 +1463,13 @@ static int v4l_s_tuner(const struct v

[PATCH 3/5] media: au0828-video changes to use media tuner token api

2014-09-22 Thread Shuah Khan
au0828-video driver uses vb1 api and needs changes to vb1
v4l2 interfaces that change the tuner status. In addition
to that this driver initializes the tuner from a some ioctls
that are query (read) tuner status. These ioctls are changed
to hold the tuner token to avoid disrupting digital stream
if active. Further more, release v4l2_file_operations powers
down the tuner. The following changes are made:

read, poll v4l2_file_operations:
- hold tuner in shared analog mode
- return leaving tuner in shared mode

vb1 streamon:
- hold tuner in shared analog mode
- return leaving tuner in shared mode

release v4l2_file_operations:
- hold tuner in exclusive analog mode to power down.
  Don't call s_power when tuner is busy.

Initialize dev_parent field struct video_device to enable
media tuner token lookup from v4l2-core.

Signed-off-by: Shuah Khan 
---
 drivers/media/usb/au0828/au0828-video.c |   43 ++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/au0828/au0828-video.c 
b/drivers/media/usb/au0828/au0828-video.c
index 5f337b1..52a3644 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1085,10 +1086,21 @@ static int au0828_v4l2_close(struct file *filp)
 
au0828_uninit_isoc(dev);
 
+   ret = media_get_tuner_tkn(&dev->usbdev->dev, MEDIA_MODE_ANALOG);
+   if (ret) {
+   dev_info(&dev->usbdev->dev,
+   "%s: Tuner is busy\n", __func__);
+   /* don't touch tuner and usb device interface */
+   goto skip_s_power;
+   }
+   dev_info(&dev->usbdev->dev, "%s: Putting tuner to sleep\n",
+   __func__);
/* Save some power by putting tuner to sleep */
v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
-   dev->std_set_in_tuner_core = 0;
+   media_put_tuner_tkn(&dev->usbdev->dev, MEDIA_MODE_ANALOG);
 
+skip_s_power:
+   dev->std_set_in_tuner_core = 0;
/* When close the device, set the usb intf0 into alt0 to free
   USB bandwidth */
ret = usb_set_interface(dev->usbdev, 0, 0);
@@ -1136,6 +1148,12 @@ static ssize_t au0828_v4l2_read(struct file *filp, char 
__user *buf,
if (rc < 0)
return rc;
 
+   /* don't put the tuner token - this case is same as STREAMON */
+   rc = media_get_shared_tuner_tkn(&dev->usbdev->dev, MEDIA_MODE_ANALOG);
+   if (rc) {
+   dev_info(&dev->usbdev->dev, "%s: Tuner is busy\n", __func__);
+   return -EBUSY;
+   }
if (mutex_lock_interruptible(&dev->lock))
return -ERESTARTSYS;
au0828_init_tuner(dev);
@@ -1177,6 +1195,12 @@ static unsigned int au0828_v4l2_poll(struct file *filp, 
poll_table *wait)
if (check_dev(dev) < 0)
return POLLERR;
 
+   /* don't put the tuner token - this case is same as STREAMON */
+   res = media_get_shared_tuner_tkn(&dev->usbdev->dev, MEDIA_MODE_ANALOG);
+   if (res) {
+   dev_info(&dev->usbdev->dev, "%s: Tuner is busy\n", __func__);
+   return -EBUSY;
+   }
res = v4l2_ctrl_poll(filp, wait);
if (!(req_events & (POLLIN | POLLRDNORM)))
return res;
@@ -1548,16 +1572,24 @@ static int vidioc_g_tuner(struct file *file, void 
*priv, struct v4l2_tuner *t)
 {
struct au0828_fh *fh = priv;
struct au0828_dev *dev = fh->dev;
+   int ret;
 
if (t->index != 0)
return -EINVAL;
 
+   ret = media_get_shared_tuner_tkn(&dev->usbdev->dev, MEDIA_MODE_ANALOG);
+   if (ret) {
+   dev_info(&dev->usbdev->dev, "%s: Tuner is busy\n", __func__);
+   return -EBUSY;
+   }
+
strcpy(t->name, "Auvitek tuner");
 
au0828_init_tuner(dev);
i2c_gate_ctrl(dev, 1);
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t);
i2c_gate_ctrl(dev, 0);
+   media_put_tuner_tkn(&dev->usbdev->dev, MEDIA_MODE_ANALOG);
return 0;
 }
 
@@ -1682,6 +1714,12 @@ static int vidioc_streamon(struct file *file, void *priv,
dprintk(1, "vidioc_streamon fh=%p t=%d fh->res=%d dev->res=%d\n",
fh, type, fh->resources, dev->resources);
 
+   rc = media_get_shared_tuner_tkn(&dev->usbdev->dev, MEDIA_MODE_ANALOG);
+   if (rc) {
+   dev_info(&dev->usbdev->dev, "%s: Tuner is busy\n", __func__);
+   return -EBUSY;
+   }
+
if (unlikely(!res_get(fh, get_ressource(fh
return -EBUSY;
 
@@ -2083,12 +2121,15 @@ int au0828_analog_register(struct au0828_dev *dev,
dev->vdev->v4l2_dev = &dev->v4l2_dev;
dev->vdev->lock = &dev->lock;

[PATCH 4/5] media: dvb-core changes to use media tuner token api

2014-09-22 Thread Shuah Khan
Change to hold media tuner token exclusive mode in
dvb_frontend_start() before starting the dvb thread
and release from dvb_frontend_thread() when thread
exits. dvb frontend thread is started only when the
dvb device is opened in Read/Write mode.

Signed-off-by: Shuah Khan 
---
 drivers/media/dvb-core/dvb_frontend.c |   10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/media/dvb-core/dvb_frontend.c 
b/drivers/media/dvb-core/dvb_frontend.c
index c862ad7..22833c6 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "dvb_frontend.h"
 #include "dvbdev.h"
@@ -742,6 +743,7 @@ restart:
if (semheld)
up(&fepriv->sem);
dvb_frontend_wakeup(fe);
+   media_put_tuner_tkn(fe->dvb->device, MEDIA_MODE_DVB);
return 0;
 }
 
@@ -836,6 +838,13 @@ static int dvb_frontend_start(struct dvb_frontend *fe)
fepriv->state = FESTATE_IDLE;
fe->exit = DVB_FE_NO_EXIT;
fepriv->thread = NULL;
+
+   ret = media_get_tuner_tkn(fe->dvb->device, MEDIA_MODE_DVB);
+   if (ret == -EBUSY) {
+   dev_info(fe->dvb->device, "dvb: Tuner is busy\n");
+   return ret;
+   }
+
mb();
 
fe_thread = kthread_run(dvb_frontend_thread, fe,
@@ -846,6 +855,7 @@ static int dvb_frontend_start(struct dvb_frontend *fe)
"dvb_frontend_start: failed to start kthread 
(%d)\n",
ret);
up(&fepriv->sem);
+   media_put_tuner_tkn(fe->dvb->device, MEDIA_MODE_DVB);
return ret;
}
fepriv->thread = fe_thread;
-- 
1.7.10.4

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


randconfig build error with next-20140922, in drivers/media/rc/st_rc.c

2014-09-22 Thread Jim Davis
Building with the attached random configuration file,

drivers/media/rc/st_rc.c: In function ‘st_rc_probe’:
drivers/media/rc/st_rc.c:281:2: error: implicit declaration of
function ‘reset_control_get’ [-Werror=implicit-function-declaration]
  rc_dev->rstc = reset_control_get(dev, NULL);
  ^
drivers/media/rc/st_rc.c:281:15: warning: assignment makes pointer
from integer without a cast [enabled by default]
  rc_dev->rstc = reset_control_get(dev, NULL);
   ^
cc1: some warnings being treated as errors
make[3]: *** [drivers/media/rc/st_rc.o] Error 1
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 3.17.0-rc6 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_MMU=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ARCH_HAS_CPU_RELAX=y
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
CONFIG_ZONE_DMA32=y
CONFIG_AUDIT_ARCH=y
CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx 
-fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 
-fcall-saved-r11"
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_CONSTRUCTORS=y
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_EXTABLE_SORT=y

#
# General setup
#
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
CONFIG_COMPILE_TEST=y
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
CONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SYSVIPC=y
# CONFIG_CROSS_MEMORY_ATTACH is not set
# CONFIG_FHANDLE is not set
CONFIG_USELIB=y
CONFIG_HAVE_ARCH_AUDITSYSCALL=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_LEGACY_ALLOC_HWIRQ=y
CONFIG_GENERIC_IRQ_CHIP=y
CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_DOMAIN_DEBUG=y
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_ARCH_CLOCKSOURCE_DATA=y
CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
CONFIG_GENERIC_CMOS_UPDATE=y

#
# Timers subsystem
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ_COMMON=y
# CONFIG_HZ_PERIODIC is not set
CONFIG_NO_HZ_IDLE=y
CONFIG_NO_HZ=y
# CONFIG_HIGH_RES_TIMERS is not set

#
# CPU/Task time and stats accounting
#
CONFIG_TICK_CPU_ACCOUNTING=y
# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set
# CONFIG_IRQ_TIME_ACCOUNTING is not set
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y

#
# RCU Subsystem
#
CONFIG_TINY_RCU=y
# CONFIG_PREEMPT_RCU is not set
# CONFIG_TASKS_RCU is not set
CONFIG_RCU_STALL_COMMON=y
# CONFIG_TREE_RCU_TRACE is not set
# CONFIG_BUILD_BIN2C is not set
# CONFIG_IKCONFIG is not set
CONFIG_LOG_BUF_SHIFT=17
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y
CONFIG_ARCH_SUPPORTS_INT128=y
CONFIG_CGROUPS=y
# CONFIG_CGROUP_DEBUG is not set
CONFIG_CGROUP_FREEZER=y
# CONFIG_CGROUP_DEVICE is not set
CONFIG_CPUSETS=y
# CONFIG_PROC_PID_CPUSET is not set
# CONFIG_CGROUP_CPUACCT is not set
# CONFIG_RESOURCE_COUNTERS is not set
# CONFIG_CGROUP_PERF is not set
CONFIG_CGROUP_SCHED=y
CONFIG_FAIR_GROUP_SCHED=y
CONFIG_CFS_BANDWIDTH=y
CONFIG_RT_GROUP_SCHED=y
CONFIG_CHECKPOINT_RESTORE=y
# CONFIG_NAMESPACES is not set
CONFIG_SCHED_AUTOGROUP=y
CONFIG_SYSFS_DEPRECATED=y
# CONFIG_SYSFS_DEPRECATED_V2 is not set
CONFIG_RELAY=y
# CONFIG_BLK_DEV_INITRD is not set
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
# CONFIG_LTO_MENU is not set
CONFIG_ANON_INODES=y
CONFIG_SYSCTL_EXCEPTION_TRACE=y
CONFIG_HAVE_PCSPKR_PLATFORM=y
CONFIG_EXPERT=y
CONFIG_SGETMASK_SYSCALL=y
# CONFIG_SYSFS_SYSCALL is not set
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_PCSPKR_PLATFORM=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
# CONFIG_EPOLL is not set
CONFIG_SIGNALFD=y
# CONFIG_TIMERFD is not set
# CONFIG_EVENTFD is not set
CONFIG_SHMEM=y
CONFIG_AIO=y
# CONFIG_PCI_QUIRKS is not set

Payment

2014-09-22 Thread Finance Department
Dear Recipient,

You have been awarded the sum of  8,000,000.00 (Eight Million Pounds sterling) 
with reference number 77100146 by office of the ministry of finance UK.Send us 
your personal details to deliver your funds.

Gloria Pete
--
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 decode status instead of display status on MFCv5

2014-09-22 Thread Sjoerd Simons
Commit 90c0ae50097 changed how the frame_type of a decoded frame
gets determined, by switching from the get_dec_frame_type to
get_disp_frame_type operation. Unfortunately it seems that on MFC v5 the
result of get_disp_frame_type is always 0 (no display) when decoding
(tested with H264), resulting in no frame ever being output from the
decoder.

This patch reverts MFC v5 to the previous behaviour while keeping the
new behaviour for v6 and up.

Signed-off-by: Sjoerd Simons 
---
 drivers/media/platform/s5p-mfc/s5p_mfc.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index d35b041..27ca9d0 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -264,7 +264,12 @@ static void s5p_mfc_handle_frame_new(struct s5p_mfc_ctx 
*ctx, unsigned int err)
unsigned int frame_type;
 
dspl_y_addr = s5p_mfc_hw_call(dev->mfc_ops, get_dspl_y_adr, dev);
-   frame_type = s5p_mfc_hw_call(dev->mfc_ops, get_disp_frame_type, ctx);
+   if (IS_MFCV6_PLUS(dev))
+   frame_type = s5p_mfc_hw_call(dev->mfc_ops,
+   get_disp_frame_type, ctx);
+   else
+   frame_type = s5p_mfc_hw_call(dev->mfc_ops,
+   get_dec_frame_type, dev);
 
/* If frame is same as previous then skip and do not dequeue */
if (frame_type == S5P_FIMV_DECODE_FRAME_SKIPPED) {
-- 
2.1.0

--
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] mem2mem_testdev: rename to vim2m.

2014-09-22 Thread Hans Verkuil
This is 1) *much* easier to type, and 2) is consistent with vivid
('vi' for virtual). More of such virtual drivers are planned, so keeping
the naming consistent makes sense.

Note that the old module name is retained as a module alias.

Signed-off-by: Hans Verkuil 
---
 drivers/media/platform/Kconfig |   4 +-
 drivers/media/platform/Makefile|   2 +-
 .../media/platform/{mem2mem_testdev.c => vim2m.c}  | 221 ++---
 3 files changed, 113 insertions(+), 114 deletions(-)
 rename drivers/media/platform/{mem2mem_testdev.c => vim2m.c} (81%)

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index bee9074..4c3e957 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -267,8 +267,8 @@ if V4L_TEST_DRIVERS
 
 source "drivers/media/platform/vivid/Kconfig"
 
-config VIDEO_MEM2MEM_TESTDEV
-   tristate "Virtual test device for mem2mem framework"
+config VIDEO_VIM2M
+   tristate "Virtual Memory-to-Memory Driver"
depends on VIDEO_DEV && VIDEO_V4L2
select VIDEOBUF2_VMALLOC
select V4L2_MEM2MEM_DEV
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index 8d3fcfe..a5c61b0 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -17,7 +17,7 @@ obj-$(CONFIG_VIDEO_OMAP3) += omap3isp/
 obj-$(CONFIG_VIDEO_VIU) += fsl-viu.o
 
 obj-$(CONFIG_VIDEO_VIVID)  += vivid/
-obj-$(CONFIG_VIDEO_MEM2MEM_TESTDEV) += mem2mem_testdev.o
+obj-$(CONFIG_VIDEO_VIM2M)  += vim2m.o
 
 obj-$(CONFIG_VIDEO_TI_VPE) += ti-vpe/
 
diff --git a/drivers/media/platform/mem2mem_testdev.c 
b/drivers/media/platform/vim2m.c
similarity index 81%
rename from drivers/media/platform/mem2mem_testdev.c
rename to drivers/media/platform/vim2m.c
index c1b03cf..87af47a 100644
--- a/drivers/media/platform/mem2mem_testdev.c
+++ b/drivers/media/platform/vim2m.c
@@ -31,12 +31,11 @@
 #include 
 #include 
 
-#define MEM2MEM_TEST_MODULE_NAME "mem2mem-testdev"
-
 MODULE_DESCRIPTION("Virtual device for mem2mem framework testing");
 MODULE_AUTHOR("Pawel Osciak, ");
 MODULE_LICENSE("GPL");
 MODULE_VERSION("0.1.1");
+MODULE_ALIAS("mem2mem_testdev");
 
 static unsigned debug;
 module_param(debug, uint, 0644);
@@ -52,7 +51,7 @@ MODULE_PARM_DESC(debug, "activates debug info");
 #define MEM2MEM_CAPTURE(1 << 0)
 #define MEM2MEM_OUTPUT (1 << 1)
 
-#define MEM2MEM_NAME   "m2m-testdev"
+#define MEM2MEM_NAME   "vim2m"
 
 /* Per queue */
 #define MEM2MEM_DEF_NUM_BUFS   VIDEO_MAX_FRAME
@@ -72,15 +71,15 @@ MODULE_PARM_DESC(debug, "activates debug info");
v4l2_dbg(1, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)
 
 
-static void m2mtest_dev_release(struct device *dev)
+static void vim2m_dev_release(struct device *dev)
 {}
 
-static struct platform_device m2mtest_pdev = {
+static struct platform_device vim2m_pdev = {
.name   = MEM2MEM_NAME,
-   .dev.release= m2mtest_dev_release,
+   .dev.release= vim2m_dev_release,
 };
 
-struct m2mtest_fmt {
+struct vim2m_fmt {
char*name;
u32 fourcc;
int depth;
@@ -88,7 +87,7 @@ struct m2mtest_fmt {
u32 types;
 };
 
-static struct m2mtest_fmt formats[] = {
+static struct vim2m_fmt formats[] = {
{
.name   = "RGB565 (BE)",
.fourcc = V4L2_PIX_FMT_RGB565X, /* rggg gggb */
@@ -108,12 +107,12 @@ static struct m2mtest_fmt formats[] = {
 #define NUM_FORMATS ARRAY_SIZE(formats)
 
 /* Per-queue, driver-specific private data */
-struct m2mtest_q_data {
+struct vim2m_q_data {
unsigned intwidth;
unsigned intheight;
unsigned intsizeimage;
unsigned intsequence;
-   struct m2mtest_fmt  *fmt;
+   struct vim2m_fmt*fmt;
 };
 
 enum {
@@ -124,9 +123,9 @@ enum {
 #define V4L2_CID_TRANS_TIME_MSEC   (V4L2_CID_USER_BASE + 0x1000)
 #define V4L2_CID_TRANS_NUM_BUFS(V4L2_CID_USER_BASE + 0x1001)
 
-static struct m2mtest_fmt *find_format(struct v4l2_format *f)
+static struct vim2m_fmt *find_format(struct v4l2_format *f)
 {
-   struct m2mtest_fmt *fmt;
+   struct vim2m_fmt *fmt;
unsigned int k;
 
for (k = 0; k < NUM_FORMATS; k++) {
@@ -141,7 +140,7 @@ static struct m2mtest_fmt *find_format(struct v4l2_format 
*f)
return &formats[k];
 }
 
-struct m2mtest_dev {
+struct vim2m_dev {
struct v4l2_device  v4l2_dev;
struct video_device *vfd;
 
@@ -154,9 +153,9 @@ struct m2mtest_dev {
struct v4l2_m2m_dev *m2m_dev;
 };
 
-struct m2mtest_ctx {
+struct vim2m_ctx {
struct v4l2_fh  fh;
-   struct m2mtest_dev  *dev;
+   struct vim2m_dev*dev;
 
struct v4l2_ctrl_handler hdl;
 
@@ -177,15 +176,15 @@ struct m2mtest_ctx {
enum v4l2_colorspacecolorspace;
 
/* Source and desti

RE: buffer delivery stops with cx23885

2014-09-22 Thread James Harper

> >> Is that two tuners in the same device, or two tuners in different devices?
> >
> > DViCO FusionHDTV DVB-T Dual Express2
> >
> > 2 tuners on one card
> 
> Any idea if there were changes or are issues with i2c access when there are
> two tuners in the same device?
> 
> That's not really my expertise but you might know something about that.
> 

041ad449683bb2d54a7f082d78ec15bbc958a175 introduced stats gathering into the 
dib7000p code which seems to generate a lot more i2c traffic which would 
exacerbate the problem, if one existed. The timing (May/June) very roughly 
matches what I remember too. When my recording stops, so do the "Next all 
layers stats available in..." messages, although that could be for other 
reasons.

Anyway, I'll comment out the call to dib7000p_get_stats and see if it makes a 
difference.

James

N�r��yb�X��ǧv�^�)޺{.n�+{���bj)w*jg����ݢj/���z�ޖ��2�ޙ&�)ߡ�a�����G���h��j:+v���w��٥

[GIT PULL FOR v3.18] v4l2-ioctl.c fix + saa7134 improvements

2014-09-22 Thread Hans Verkuil
The following changes since commit f5281fc81e9a0a3e80b78720c5ae2ed06da3bfae:

  [media] vpif: Fix compilation with allmodconfig (2014-09-09 18:08:08 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v3.18d

for you to fetch changes up to 6b167cb4cc6a3b69928dfcc9dbef847a0d937500:

  saa7134: add saa7134-go7007 (2014-09-22 12:10:17 +0200)


Hans Verkuil (3):
  v4l2-ioctl.c: fix inverted condition
  saa7134: also capture the WSS signal for 50 Hz VBI capture
  saa7134: add saa7134-go7007

 drivers/media/pci/saa7134/Makefile |   3 +-
 drivers/media/pci/saa7134/saa7134-cards.c  |  29 +
 drivers/media/pci/saa7134/saa7134-core.c   |  10 +-
 drivers/media/pci/saa7134/saa7134-go7007.c | 532 
+
 drivers/media/pci/saa7134/saa7134-vbi.c|   2 +-
 drivers/media/pci/saa7134/saa7134-video.c  |   2 +-
 drivers/media/pci/saa7134/saa7134.h|   5 +
 drivers/media/v4l2-core/v4l2-ioctl.c   |   2 +-
 8 files changed, 579 insertions(+), 6 deletions(-)
 create mode 100644 drivers/media/pci/saa7134/saa7134-go7007.c
--
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: buffer delivery stops with cx23885

2014-09-22 Thread Hans Verkuil
Mauro,

On 09/22/2014 11:58 AM, James Harper wrote:
>
> Any hints on what I can do to figure out what layer it's stalling at?

 I have no idea. I would do a git bisect to try and narrow it down.

>>>
>>> Problem with the bisect is that I can't be sure what version it actually
>> worked on. It certainly predates when my patch for my card was committed.
>>>
>>> I have a hunch that it might be the two tuners stomping on each other,
>> possibly in the i2c code. Sometimes recording just stops, other times I get 
>> i2c
>> errors.
>>
>> Is that two tuners in the same device, or two tuners in different devices?
>>
> 
> DViCO FusionHDTV DVB-T Dual Express2
> 
> 2 tuners on one card

Any idea if there were changes or are issues with i2c access when there are
two tuners in the same device?

That's not really my expertise but you might know something about that.

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: buffer delivery stops with cx23885

2014-09-22 Thread James Harper
> >>>
> >>> Any hints on what I can do to figure out what layer it's stalling at?
> >>
> >> I have no idea. I would do a git bisect to try and narrow it down.
> >>
> >
> > Problem with the bisect is that I can't be sure what version it actually
> worked on. It certainly predates when my patch for my card was committed.
> >
> > I have a hunch that it might be the two tuners stomping on each other,
> possibly in the i2c code. Sometimes recording just stops, other times I get 
> i2c
> errors.
> 
> Is that two tuners in the same device, or two tuners in different devices?
> 

DViCO FusionHDTV DVB-T Dual Express2

2 tuners on one card

James
N�r��yb�X��ǧv�^�)޺{.n�+{���bj)w*jg����ݢj/���z�ޖ��2�ޙ&�)ߡ�a�����G���h��j:+v���w��٥

Re: buffer delivery stops with cx23885

2014-09-22 Thread Hans Verkuil
On 09/22/2014 11:46 AM, James Harper wrote:
>>
>>>
>>> Any hints on what I can do to figure out what layer it's stalling at?
>>
>> I have no idea. I would do a git bisect to try and narrow it down.
>>
> 
> Problem with the bisect is that I can't be sure what version it actually 
> worked on. It certainly predates when my patch for my card was committed.
> 
> I have a hunch that it might be the two tuners stomping on each other, 
> possibly in the i2c code. Sometimes recording just stops, other times I get 
> i2c errors.

Is that two tuners in the same device, or two tuners in different devices?

Hans

> 
> With one tuner disabled in MythTV I can't seem to reproduce the problem 
> anymore. I haven't let it run for long enough to be sure, but it normally 
> would have crashed by now.
> 
> James

--
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: buffer delivery stops with cx23885

2014-09-22 Thread James Harper
> 
> >
> > Any hints on what I can do to figure out what layer it's stalling at?
> 
> I have no idea. I would do a git bisect to try and narrow it down.
> 

Problem with the bisect is that I can't be sure what version it actually worked 
on. It certainly predates when my patch for my card was committed.

I have a hunch that it might be the two tuners stomping on each other, possibly 
in the i2c code. Sometimes recording just stops, other times I get i2c errors.

With one tuner disabled in MythTV I can't seem to reproduce the problem 
anymore. I haven't let it run for long enough to be sure, but it normally would 
have crashed by now.

James


Re: buffer delivery stops with cx23885

2014-09-22 Thread Hans Verkuil
On 09/22/2014 10:30 AM, James Harper wrote:
>>
>> I'll test out the downgrade to 73d8102298719863d54264f62521362487f84256
>> just to be sure, then see if I can take it further back.
>>
> 
> 73d8102298719863d54264f62521362487f84256 still breaks for me, so it's 
> definitely not related to the conversion.

Good.

> 
> Any hints on what I can do to figure out what layer it's stalling at?

I have no idea. I would do a git bisect to try and narrow it down.

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: buffer delivery stops with cx23885

2014-09-22 Thread James Harper
> 
> I'll test out the downgrade to 73d8102298719863d54264f62521362487f84256
> just to be sure, then see if I can take it further back.
> 

73d8102298719863d54264f62521362487f84256 still breaks for me, so it's 
definitely not related to the conversion.

Any hints on what I can do to figure out what layer it's stalling at?

Thanks

James


Re: Running Technisat DVB-S2 on ARM-NAS

2014-09-22 Thread Jan Tisje


Am 21.09.2014 um 22:45 schrieb Jannis:
> Am 21.09.2014 um 19:28 schrieb JPT:
>> Tommorrow I'll swap the sat cable just to make sure this isn't the cause.
> 
> Hi Jan,
> 
> Are we talking about this device:
> http://www.linuxtv.org/wiki/index.php/Technisat_SkyStar_USB_HD

Yes, exactly.

> (You never mentioned the actual model AFAIK)?

No, I didn't. I'm sorry.

> If so, it has two LEDs. A red one for "power" and a green one for
> "tuned"/"locked". So if the green one lights up, the sat cable should be
> okay.

Swapped cables: now it works. :)
I have to check why this cable is bad :(

Recording works fine, too.

> I remember having tested my one with the RaspberryPi and it worked. So
> it is not a general problem of the DVB-S2 device and ARM but rather the
> specific board you are working with.
> Just found the link where I reported success:
> https://github.com/raspberrypi/linux/issues/82#issuecomment-27253775

That's great to hear. Thanks!
I didn't expect anyone tried DVB on ARM yet. The Linux community is
great. I'm so glad I don't need Win any more (in general).


Thank you very much to both of you, and to all that people who wrote the
code!

Jan
--
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] davinci: remove an unneeded check

2014-09-22 Thread Dan Carpenter
We don't need to check "ret", we know it's zero.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/media/platform/davinci/vpfe_capture.c 
b/drivers/media/platform/davinci/vpfe_capture.c
index c557eb5..3eb6e4b 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -442,11 +442,10 @@ static int vpfe_config_image_format(struct vpfe_device 
*vpfe_dev,
return ret;
 
/* Update the values of sizeimage and bytesperline */
-   if (!ret) {
-   pix->bytesperline = ccdc_dev->hw_ops.get_line_length();
-   pix->sizeimage = pix->bytesperline * pix->height;
-   }
-   return ret;
+   pix->bytesperline = ccdc_dev->hw_ops.get_line_length();
+   pix->sizeimage = pix->bytesperline * pix->height;
+
+   return 0;
 }
 
 static int vpfe_initialize_device(struct vpfe_device *vpfe_dev)
--
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] as102: remove some unneeded checks

2014-09-22 Thread Dan Carpenter
We know "ret" is zero so we don't need to test for it.  It upsets the
static checkers when we test stuff but we know the answer.

drivers/media/usb/as102/as102_usb_drv.c:164 as102_send_ep1() warn: we tested 
'ret' before and it was 'false'
drivers/media/usb/as102/as102_usb_drv.c:189 as102_read_ep2() warn: we tested 
'ret' before and it was 'false'

Also, we don't need to initialize "ret".

Signed-off-by: Dan Carpenter 

diff --git a/drivers/media/usb/as102/as102_usb_drv.c 
b/drivers/media/usb/as102/as102_usb_drv.c
index 43133df..3f66906 100644
--- a/drivers/media/usb/as102/as102_usb_drv.c
+++ b/drivers/media/usb/as102/as102_usb_drv.c
@@ -145,7 +145,7 @@ static int as102_send_ep1(struct as10x_bus_adapter_t 
*bus_adap,
  int send_buf_len,
  int swap32)
 {
-   int ret = 0, actual_len;
+   int ret, actual_len;
 
ret = usb_bulk_msg(bus_adap->usb_dev,
   usb_sndbulkpipe(bus_adap->usb_dev, 1),
@@ -161,13 +161,13 @@ static int as102_send_ep1(struct as10x_bus_adapter_t 
*bus_adap,
actual_len, send_buf_len);
return -1;
}
-   return ret ? ret : actual_len;
+   return actual_len;
 }
 
 static int as102_read_ep2(struct as10x_bus_adapter_t *bus_adap,
   unsigned char *recv_buf, int recv_buf_len)
 {
-   int ret = 0, actual_len;
+   int ret, actual_len;
 
if (recv_buf == NULL)
return -EINVAL;
@@ -186,7 +186,7 @@ static int as102_read_ep2(struct as10x_bus_adapter_t 
*bus_adap,
actual_len, recv_buf_len);
return -1;
}
-   return ret ? ret : actual_len;
+   return actual_len;
 }
 
 static struct as102_priv_ops_t as102_priv_ops = {
--
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