Re: [RFC 06/10] video: ARM CLCD: Add DT CDF support
On Wed, Apr 17, 2013 at 04:17:18PM +0100, Pawel Moll wrote: +#if defined(CONFIG_OF) +static int clcdfb_of_get_tft_parallel_panel(struct clcd_panel *panel, + struct display_entity_interface_params *params) +{ + int r = params-p.tft_parallel.r_bits; + int g = params-p.tft_parallel.g_bits; + int b = params-p.tft_parallel.b_bits; + + /* Bypass pixel clock divider, data output on the falling edge */ + panel-tim2 = TIM2_BCD | TIM2_IPC; + + /* TFT display, vert. comp. interrupt at the start of the back porch */ + panel-cntl |= CNTL_LCDTFT | CNTL_LCDVCOMP(1); + + if (params-p.tft_parallel.r_b_swapped) + panel-cntl |= CNTL_BGR; NAK. Do not set this explicitly. Note the driver talks about this being the old way - this should not be used with the panel capabilities - and in fact it will be overwritten. Instead, you need to encode this into the capabilities by masking the below with CLCD_CAP_RGB or CLCD_CAP_BGR depending on the ordering. -- 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: davinci: vpif: align the buffers size to page page size boundary
Em Thu, 18 Apr 2013 10:17:14 +0530 Prabhakar Lad prabhakar.cse...@gmail.com escreveu: Hi Marek, On Tue, Apr 16, 2013 at 4:48 PM, Laurent Pinchart laurent.pinch...@ideasonboard.com wrote: Hi Prabhakar, ... *nbuffers = config_params.min_numbuffers; *nplanes = 1; + size = PAGE_ALIGN(size); I wonder if that's the best fix. The queue_setup operation is supposed to return the size required by the driver for each plane. Depending on the hardware requirements, that size might not be a multiple of the page size. As we can't mmap() a fraction of a page, the allocated plane size needs to be rounded up to the next page boundary to allow mmap() support. The dma-contig and dma-sg allocators already do so in their alloc operation, but the vmalloc allocator doesn't. The recent media: vb2: add length check for mmap patch verifies that the mmap() size requested by userspace doesn't exceed the buffer size. As the mmap() size is rounded up to the next page boundary the check will fail for buffer sizes that are not multiple of the page size. Your fix will not result in overallocation (as the allocator already rounds the size up), but will prevent the driver from importing a buffer large enough for the hardware but not rounded up to the page size. A better fix might be to round up the buffer size in the buffer size check at mmap() time, and fix the vmalloc allocator to round up the size. That the allocator, not drivers, is responsible for buffer size alignment should be documented in videobuf2-core.h. Do you plan to post a patch fixing it as per Laurent's suggestion ? I agree with Laurent: page size roundup should be done at VB2 core code, for memory allocated there, and not at driver's level. Yet, looking at VB2 code, it already does page size align at __setup_offsets(), but it doesn't do if for the size field; just for the offset. The adjusted size should be stored at the VB2 size field, and the check for buffer overflow, added on changeset 068a0df76023926af958a336a78bef60468d2033 should be kept. IMO, it also makes sense to enforce that the USERPTR memory is multiple of the page size, as otherwise the DMA transfer may overwrite some area that is outside the allocated range. So, the size from USERPTR should be round down. That change, however, will break userspace, as it uses the picture sizeimage to allocate the buffers. So, sizeimage needs to be PAGE_SIZE roundup before passing it to userspace. Instead of modifying all drivers, the better seems to patch v4l_g_fmt() and v4l_try_fmt() to return a roundup value for sizeimage. As usual, uvcvideo requires a separate patch, because it doesn't use vidio_ioctl2. 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 v2] media: davinci: vpif: align the buffers size to page page size boundary
Em Thu, 18 Apr 2013 08:21:21 -0300 Mauro Carvalho Chehab mche...@redhat.com escreveu: Em Thu, 18 Apr 2013 10:17:14 +0530 Prabhakar Lad prabhakar.cse...@gmail.com escreveu: Hi Marek, On Tue, Apr 16, 2013 at 4:48 PM, Laurent Pinchart laurent.pinch...@ideasonboard.com wrote: Hi Prabhakar, ... *nbuffers = config_params.min_numbuffers; *nplanes = 1; + size = PAGE_ALIGN(size); I wonder if that's the best fix. The queue_setup operation is supposed to return the size required by the driver for each plane. Depending on the hardware requirements, that size might not be a multiple of the page size. As we can't mmap() a fraction of a page, the allocated plane size needs to be rounded up to the next page boundary to allow mmap() support. The dma-contig and dma-sg allocators already do so in their alloc operation, but the vmalloc allocator doesn't. The recent media: vb2: add length check for mmap patch verifies that the mmap() size requested by userspace doesn't exceed the buffer size. As the mmap() size is rounded up to the next page boundary the check will fail for buffer sizes that are not multiple of the page size. Your fix will not result in overallocation (as the allocator already rounds the size up), but will prevent the driver from importing a buffer large enough for the hardware but not rounded up to the page size. A better fix might be to round up the buffer size in the buffer size check at mmap() time, and fix the vmalloc allocator to round up the size. That the allocator, not drivers, is responsible for buffer size alignment should be documented in videobuf2-core.h. Do you plan to post a patch fixing it as per Laurent's suggestion ? I agree with Laurent: page size roundup should be done at VB2 core code, for memory allocated there, and not at driver's level. Yet, looking at VB2 code, it already does page size align at __setup_offsets(), but it doesn't do if for the size field; just for the offset. The adjusted size should be stored at the VB2 size field, and the check for buffer overflow, added on changeset 068a0df76023926af958a336a78bef60468d2033 should be kept. IMO, it also makes sense to enforce that the USERPTR memory is multiple of the page size, as otherwise the DMA transfer may overwrite some area that is outside the allocated range. So, the size from USERPTR should be round down. That change, however, will break userspace, as it uses the picture sizeimage to allocate the buffers. So, sizeimage needs to be PAGE_SIZE roundup before passing it to userspace. Instead of modifying all drivers, the better seems to patch v4l_g_fmt() and v4l_try_fmt() to return a roundup value for sizeimage. As usual, uvcvideo requires a separate patch, because it doesn't use vidio_ioctl2. Hmm... PAGE_SIZE alignment is not needed on all places. It is needed only when DMA is done directly into the buffer, e. g. videobuf2-dma-contig and videobuf2-dma-sg. It means that we'll need an extra function for the VB2 memory allocation drivers to do do the memory-dependent roundups, and a new ancillary function at VB2 core for the VB2 clients to call to round sizeimage if needed. 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 v2] media: davinci: vpif: align the buffers size to page page size boundary
Hi Mauro, On Thursday 18 April 2013 08:35:47 Mauro Carvalho Chehab wrote: Em Thu, 18 Apr 2013 08:21:21 -0300 Mauro Carvalho Chehab escreveu: Em Thu, 18 Apr 2013 10:17:14 +0530 Prabhakar Lad escreveu: On Tue, Apr 16, 2013 at 4:48 PM, Laurent Pinchart wrote: Hi Prabhakar, ... *nbuffers = config_params.min_numbuffers; *nplanes = 1; + size = PAGE_ALIGN(size); I wonder if that's the best fix. The queue_setup operation is supposed to return the size required by the driver for each plane. Depending on the hardware requirements, that size might not be a multiple of the page size. As we can't mmap() a fraction of a page, the allocated plane size needs to be rounded up to the next page boundary to allow mmap() support. The dma-contig and dma-sg allocators already do so in their alloc operation, but the vmalloc allocator doesn't. The recent media: vb2: add length check for mmap patch verifies that the mmap() size requested by userspace doesn't exceed the buffer size. As the mmap() size is rounded up to the next page boundary the check will fail for buffer sizes that are not multiple of the page size. Your fix will not result in overallocation (as the allocator already rounds the size up), but will prevent the driver from importing a buffer large enough for the hardware but not rounded up to the page size. A better fix might be to round up the buffer size in the buffer size check at mmap() time, and fix the vmalloc allocator to round up the size. That the allocator, not drivers, is responsible for buffer size alignment should be documented in videobuf2-core.h. Do you plan to post a patch fixing it as per Laurent's suggestion ? I agree with Laurent: page size roundup should be done at VB2 core code, for memory allocated there, and not at driver's level. Yet, looking at VB2 code, it already does page size align at __setup_offsets(), but it doesn't do if for the size field; just for the offset. The adjusted size should be stored at the VB2 size field, and the check for buffer overflow, added on changeset 068a0df76023926af958a336a78bef60468d2033 should be kept. IMO, it also makes sense to enforce that the USERPTR memory is multiple of the page size, as otherwise the DMA transfer may overwrite some area that is outside the allocated range. So, the size from USERPTR should be round down. I don't think that's needed. You can transfer a number of bytes not multiple of the page size using DMA. This is true for DMABUF as well, an imported buffer might have a size not aligned on a page boundary. That change, however, will break userspace, as it uses the picture sizeimage to allocate the buffers. So, sizeimage needs to be PAGE_SIZE roundup before passing it to userspace. Instead of modifying all drivers, the better seems to patch v4l_g_fmt() and v4l_try_fmt() to return a roundup value for sizeimage. As usual, uvcvideo requires a separate patch, because it doesn't use vidio_ioctl2. Hmm... PAGE_SIZE alignment is not needed on all places. It is needed only when DMA is done directly into the buffer, e. g. videobuf2-dma-contig and videobuf2-dma-sg. It means that we'll need an extra function for the VB2 memory allocation drivers to do do the memory-dependent roundups, and a new ancillary function at VB2 core for the VB2 clients to call to round sizeimage if needed. Can't we just round the size up at allocation time and when checking the size in mmap() ? That's a simple fix, local to vb2, and won't require new vb2 memops. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/4] ARM: shmobile: Marzen: enable VIN and ADV7180 in defconfig
On Thu, Apr 18, 2013 at 02:17:27AM +0400, Sergei Shtylyov wrote: From: Vladimir Barinov vladimir.bari...@cogentembedded.com Add the VIN and ADV7180 drivers to 'marzen_defconfig'. Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com --- arch/arm/configs/marzen_defconfig |7 +++ 1 file changed, 7 insertions(+) Thanks, queued-up for v3.11 in the defconfig-marzen branch. -- 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: mt9v034 driver
Hi Igor, On Wednesday 17 April 2013 16:15:59 Guennadi Liakhovetski wrote: On Wed, 17 Apr 2013, Igor Kugasyan wrote: Dear Mr. Guennadi, Please tell me can I use the soc_camera_ (soc_camera.h, soc_camera.c) interface for a mt9v034 driver as a mt9v022 driver or not? I don't know anything about mt9v034. It might or might not be compatible with one of supported cameras. If it isn't, a new driver has to be developed. I've put someone on that, so we should get mt9v034 support in mainline in the not too distant future. I've read your Video4Linux soc-camera subsystem document and not found a mt9v034 among client drivers. I have the Leopard Board 368 (LI-TB02) with the WVGA camera No, you cannot use soc-camera with Leopard Board. Its camera interface might be supported by some other driver, but I'm not sure about that. LI-VM34LP but I haven't a mt9v034 driver for my camera for the linux-2.6.32 kernel with RidgeRun Don't think there's anything that can be done with any kernel apart from the current -next, i.e. the forthcoming 3.10. 2011Q2 SDK for LeopardBoardDM365 and dvsdk_dm365-evm_4_02_00_06. I haven't sufficient experience for comprehension but I learn... The only possibility I see is to use a current kernel, adapt an existing or write a new camera sensor driver for mt9v034 and use it with the appropriate SoC camera interface driver. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] media: davinci: vpif: align the buffers size to page page size boundary
Em Thu, 18 Apr 2013 15:22:16 +0200 Laurent Pinchart laurent.pinch...@ideasonboard.com escreveu: Hi Mauro, On Thursday 18 April 2013 08:35:47 Mauro Carvalho Chehab wrote: Em Thu, 18 Apr 2013 08:21:21 -0300 Mauro Carvalho Chehab escreveu: Em Thu, 18 Apr 2013 10:17:14 +0530 Prabhakar Lad escreveu: On Tue, Apr 16, 2013 at 4:48 PM, Laurent Pinchart wrote: Hi Prabhakar, ... *nbuffers = config_params.min_numbuffers; *nplanes = 1; + size = PAGE_ALIGN(size); I wonder if that's the best fix. The queue_setup operation is supposed to return the size required by the driver for each plane. Depending on the hardware requirements, that size might not be a multiple of the page size. As we can't mmap() a fraction of a page, the allocated plane size needs to be rounded up to the next page boundary to allow mmap() support. The dma-contig and dma-sg allocators already do so in their alloc operation, but the vmalloc allocator doesn't. The recent media: vb2: add length check for mmap patch verifies that the mmap() size requested by userspace doesn't exceed the buffer size. As the mmap() size is rounded up to the next page boundary the check will fail for buffer sizes that are not multiple of the page size. Your fix will not result in overallocation (as the allocator already rounds the size up), but will prevent the driver from importing a buffer large enough for the hardware but not rounded up to the page size. A better fix might be to round up the buffer size in the buffer size check at mmap() time, and fix the vmalloc allocator to round up the size. That the allocator, not drivers, is responsible for buffer size alignment should be documented in videobuf2-core.h. Do you plan to post a patch fixing it as per Laurent's suggestion ? I agree with Laurent: page size roundup should be done at VB2 core code, for memory allocated there, and not at driver's level. Yet, looking at VB2 code, it already does page size align at __setup_offsets(), but it doesn't do if for the size field; just for the offset. The adjusted size should be stored at the VB2 size field, and the check for buffer overflow, added on changeset 068a0df76023926af958a336a78bef60468d2033 should be kept. IMO, it also makes sense to enforce that the USERPTR memory is multiple of the page size, as otherwise the DMA transfer may overwrite some area that is outside the allocated range. So, the size from USERPTR should be round down. I don't think that's needed. You can transfer a number of bytes not multiple of the page size using DMA. This is true for DMABUF as well, an imported buffer might have a size not aligned on a page boundary. Are you sure that, on all supported archs/buses, the DMA transfers are byte-aligned? That change, however, will break userspace, as it uses the picture sizeimage to allocate the buffers. So, sizeimage needs to be PAGE_SIZE roundup before passing it to userspace. Instead of modifying all drivers, the better seems to patch v4l_g_fmt() and v4l_try_fmt() to return a roundup value for sizeimage. As usual, uvcvideo requires a separate patch, because it doesn't use vidio_ioctl2. Hmm... PAGE_SIZE alignment is not needed on all places. It is needed only when DMA is done directly into the buffer, e. g. videobuf2-dma-contig and videobuf2-dma-sg. It means that we'll need an extra function for the VB2 memory allocation drivers to do do the memory-dependent roundups, and a new ancillary function at VB2 core for the VB2 clients to call to round sizeimage if needed. Can't we just round the size up at allocation time and when checking the size in mmap() ? That's a simple fix, local to vb2, and won't require new vb2 memops. That's not needed for videobuf2-vmalloc. We shouldn't bloat the core VB2 with memops specific stuff. Ok, in this specific case, this is a simple trivial patch, so perhaps we could do it there. -- Cheers, 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 v2] media: davinci: vpif: align the buffers size to page page size boundary
On Thursday 18 April 2013 11:08:28 Mauro Carvalho Chehab wrote: Em Thu, 18 Apr 2013 15:22:16 +0200 Laurent Pinchart escreveu: On Thursday 18 April 2013 08:35:47 Mauro Carvalho Chehab wrote: Em Thu, 18 Apr 2013 08:21:21 -0300 Mauro Carvalho Chehab escreveu: Em Thu, 18 Apr 2013 10:17:14 +0530 Prabhakar Lad escreveu: On Tue, Apr 16, 2013 at 4:48 PM, Laurent Pinchart wrote: Hi Prabhakar, ... *nbuffers = config_params.min_numbuffers; *nplanes = 1; + size = PAGE_ALIGN(size); I wonder if that's the best fix. The queue_setup operation is supposed to return the size required by the driver for each plane. Depending on the hardware requirements, that size might not be a multiple of the page size. As we can't mmap() a fraction of a page, the allocated plane size needs to be rounded up to the next page boundary to allow mmap() support. The dma-contig and dma-sg allocators already do so in their alloc operation, but the vmalloc allocator doesn't. The recent media: vb2: add length check for mmap patch verifies that the mmap() size requested by userspace doesn't exceed the buffer size. As the mmap() size is rounded up to the next page boundary the check will fail for buffer sizes that are not multiple of the page size. Your fix will not result in overallocation (as the allocator already rounds the size up), but will prevent the driver from importing a buffer large enough for the hardware but not rounded up to the page size. A better fix might be to round up the buffer size in the buffer size check at mmap() time, and fix the vmalloc allocator to round up the size. That the allocator, not drivers, is responsible for buffer size alignment should be documented in videobuf2-core.h. Do you plan to post a patch fixing it as per Laurent's suggestion ? I agree with Laurent: page size roundup should be done at VB2 core code, for memory allocated there, and not at driver's level. Yet, looking at VB2 code, it already does page size align at __setup_offsets(), but it doesn't do if for the size field; just for the offset. The adjusted size should be stored at the VB2 size field, and the check for buffer overflow, added on changeset 068a0df76023926af958a336a78bef60468d2033 should be kept. IMO, it also makes sense to enforce that the USERPTR memory is multiple of the page size, as otherwise the DMA transfer may overwrite some area that is outside the allocated range. So, the size from USERPTR should be round down. I don't think that's needed. You can transfer a number of bytes not multiple of the page size using DMA. This is true for DMABUF as well, an imported buffer might have a size not aligned on a page boundary. Are you sure that, on all supported archs/buses, the DMA transfers are byte-aligned? They're most probably not byte-aligned, but they're not page-aligned either. That's something the driver should know, and that information will be passed throught the plane sizes by the queue_setup operation. That change, however, will break userspace, as it uses the picture sizeimage to allocate the buffers. So, sizeimage needs to be PAGE_SIZE roundup before passing it to userspace. Instead of modifying all drivers, the better seems to patch v4l_g_fmt() and v4l_try_fmt() to return a roundup value for sizeimage. As usual, uvcvideo requires a separate patch, because it doesn't use vidio_ioctl2. Hmm... PAGE_SIZE alignment is not needed on all places. It is needed only when DMA is done directly into the buffer, e. g. videobuf2-dma- contig and videobuf2-dma-sg. It means that we'll need an extra function for the VB2 memory allocation drivers to do do the memory-dependent roundups, and a new ancillary function at VB2 core for the VB2 clients to call to round sizeimage if needed. Can't we just round the size up at allocation time and when checking the size in mmap() ? That's a simple fix, local to vb2, and won't require new vb2 memops. That's not needed for videobuf2-vmalloc. Yes it is, as mmap() works on a page basis. Every buffer that will be mmap()ed to userspace needs to be aligned to the page size. We shouldn't bloat the core VB2 with memops specific stuff. Ok, in this specific case, this is a simple trivial patch, so perhaps we could do it there. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/4] ARM: shmobile: Marzen: enable VIN and ADV7180 in defconfig
On 18-04-2013 17:30, Simon Horman wrote: From: Vladimir Barinov vladimir.bari...@cogentembedded.com Add the VIN and ADV7180 drivers to 'marzen_defconfig'. Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com --- arch/arm/configs/marzen_defconfig |7 +++ 1 file changed, 7 insertions(+) Thanks, queued-up for v3.11 in the defconfig-marzen branch. That seems somewhat premature as CONFIG_VIDEO_RCAR_VIN is not defined yet (it's defined in the patch #1 of this series). WBR, Sergei -- 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 3/4] ARM: shmobile: Marzen: add VIN and ADV7180 support
On 18-04-2013 2:15, I wrote: From: Vladimir Barinov vladimir.bari...@cogentembedded.com Add ADV7180 platform devices on the Marzen board, configure VIN1/3 pins, and register VIN1/3 devices with the ADV7180 specific platform data. Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com I'm going to repost this patch recasted using a macro for camera sensor data. WBR, Sergei -- 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/4] V4L2: soc_camera: Renesas R-Car VIN driver
On 18-04-2013 2:11, Sergei Shtylyov wrote: From: Vladimir Barinov vladimir.bari...@cogentembedded.com Add Renesas R-Car VIN (Video In) V4L2 driver. Based on the patch by Phil Edworthy phil.edwor...@renesas.com. Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com [Sergei: some formatting cleanup] Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com [...] +static int rcar_vin_probe(struct platform_device *pdev) +{ [...] + ret = devm_request_irq(pdev-dev, irq, rcar_vin_irq, IRQF_DISABLED, I forgot that this flag is deprecated now. Also we need to pass IRQF_SHARED for the VIN driver to work on R8A7778 where VIN0/1 share the IRQ. WBR, Sergei -- 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] solo6x10: Fix pixelformat accepted/reported by the encoder
The 6010 produces MPEG-4 part 2, while 6110 produces H.264. Signed-off-by: Ismael Luceno ismael.luc...@corp.bluecherry.net --- drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c | 43 -- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c index d132d3b..a4c5896 100644 --- a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c +++ b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c @@ -519,10 +519,15 @@ static int solo_enc_fillbuf(struct solo_enc_dev *solo_enc, vb-v4l2_buf.flags |= V4L2_BUF_FLAG_MOTION_DETECTED; } - if (solo_enc-fmt == V4L2_PIX_FMT_MPEG4) + switch (solo_enc-fmt) { + case V4L2_PIX_FMT_MPEG4: + case V4L2_PIX_FMT_H264: ret = solo_fill_mpeg(solo_enc, vb, vh); - else + break; + default: /* V4L2_PIX_FMT_MJPEG */ ret = solo_fill_jpeg(solo_enc, vb, vh); + break; + } if (!ret) { vb-v4l2_buf.sequence = solo_enc-sequence++; @@ -780,10 +785,21 @@ static int solo_enc_get_input(struct file *file, void *priv, static int solo_enc_enum_fmt_cap(struct file *file, void *priv, struct v4l2_fmtdesc *f) { + struct solo_enc_dev *solo_enc = video_drvdata(file); + int dev_type = solo_enc-solo_dev-type; + switch (f-index) { case 0: - f-pixelformat = V4L2_PIX_FMT_MPEG4; - strcpy(f-description, MPEG-4 AVC); + switch (dev_type) { + case SOLO_DEV_6010: + f-pixelformat = V4L2_PIX_FMT_MPEG4; + strcpy(f-description, MPEG-4 part 2); + break; + case SOLO_DEV_6110: + f-pixelformat = V4L2_PIX_FMT_H264; + strcpy(f-description, H.264); + break; + } break; case 1: f-pixelformat = V4L2_PIX_FMT_MJPEG; @@ -798,6 +814,13 @@ static int solo_enc_enum_fmt_cap(struct file *file, void *priv, return 0; } +static inline int solo_valid_pixfmt(u32 pixfmt, int dev_type) +{ + return (pixfmt == V4L2_PIX_FMT_H264 dev_type == SOLO_DEV_6110) + || (pixfmt == V4L2_PIX_FMT_MPEG4 dev_type == SOLO_DEV_6010) + || pixfmt == V4L2_PIX_FMT_MJPEG ? 0 : -EINVAL; +} + static int solo_enc_try_fmt_cap(struct file *file, void *priv, struct v4l2_format *f) { @@ -805,8 +828,7 @@ static int solo_enc_try_fmt_cap(struct file *file, void *priv, struct solo_dev *solo_dev = solo_enc-solo_dev; struct v4l2_pix_format *pix = f-fmt.pix; - if (pix-pixelformat != V4L2_PIX_FMT_MPEG4 - pix-pixelformat != V4L2_PIX_FMT_MJPEG) + if (solo_valid_pixfmt(pix-pixelformat, solo_dev-type)) return -EINVAL; if (pix-width solo_dev-video_hsize || @@ -919,8 +941,7 @@ static int solo_enum_framesizes(struct file *file, void *priv, struct solo_enc_dev *solo_enc = video_drvdata(file); struct solo_dev *solo_dev = solo_enc-solo_dev; - if (fsize-pixel_format != V4L2_PIX_FMT_MPEG4 - fsize-pixel_format != V4L2_PIX_FMT_MJPEG) + if (solo_valid_pixfmt(fsize-pixel_format, solo_dev-type)) return -EINVAL; switch (fsize-index) { @@ -947,8 +968,7 @@ static int solo_enum_frameintervals(struct file *file, void *priv, struct solo_enc_dev *solo_enc = video_drvdata(file); struct solo_dev *solo_dev = solo_enc-solo_dev; - if (fintv-pixel_format != V4L2_PIX_FMT_MPEG4 - fintv-pixel_format != V4L2_PIX_FMT_MJPEG) + if (solo_valid_pixfmt(fintv-pixel_format, solo_dev-type)) return -EINVAL; if (fintv-index) return -EINVAL; @@ -1217,7 +1237,8 @@ static struct solo_enc_dev *solo_enc_alloc(struct solo_dev *solo_dev, mutex_init(solo_enc-lock); spin_lock_init(solo_enc-av_lock); INIT_LIST_HEAD(solo_enc-vidq_active); - solo_enc-fmt = V4L2_PIX_FMT_MPEG4; + solo_enc-fmt = (solo_dev-type == SOLO_DEV_6010) ? + V4L2_PIX_FMT_MPEG4 : V4L2_PIX_FMT_H264; solo_enc-type = SOLO_ENC_TYPE_STD; solo_enc-qp = SOLO_DEFAULT_QP; -- 1.8.2.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
AT91SAM9M10: Problem porting driver for MT9P031 sensor
Hi I am porting the MT9P031 sensor device driver for a custom designed board based at the AT91SAM9M45-EK development board and Linux 3.6.9. The driver detects the sensor but does not create /dev/video1. Can anybody help me? Thanks Marcio This is the probe code fo the driver if this can help: /* --- -- * Driver initialization and probing */ static int mt9p031_probe(struct i2c_client *client, const struct i2c_device_id *did) { struct mt9p031_platform_data *pdata = client-dev.platform_data; struct i2c_adapter *adapter = to_i2c_adapter(client-dev.parent); struct mt9p031 *mt9p031; unsigned int i; int ret; if (pdata == NULL) { dev_err(client-dev, No platform data\n); return -EINVAL; } if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) { dev_warn(client-dev, I2C-Adapter doesn't support I2C_FUNC_SMBUS_WORD\n); return -EIO; } mt9p031 = kzalloc(sizeof(*mt9p031), GFP_KERNEL); if (mt9p031 == NULL) return -ENOMEM; mt9p031-pdata = pdata; mt9p031-output_control = MT9P031_OUTPUT_CONTROL_DEF; mt9p031-mode2 = MT9P031_READ_MODE_2_ROW_BLC; v4l2_ctrl_handler_init(mt9p031-ctrls, ARRAY_SIZE(mt9p031_ctrls) + 4); v4l2_ctrl_new_std(mt9p031-ctrls, mt9p031_ctrl_ops, V4L2_CID_EXPOSURE, MT9P031_SHUTTER_WIDTH_MIN, MT9P031_SHUTTER_WIDTH_MAX, 1, MT9P031_SHUTTER_WIDTH_DEF); v4l2_ctrl_new_std(mt9p031-ctrls, mt9p031_ctrl_ops, V4L2_CID_GAIN, MT9P031_GLOBAL_GAIN_MIN, MT9P031_GLOBAL_GAIN_MAX, 1, MT9P031_GLOBAL_GAIN_DEF); v4l2_ctrl_new_std(mt9p031-ctrls, mt9p031_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0); v4l2_ctrl_new_std(mt9p031-ctrls, mt9p031_ctrl_ops, V4L2_CID_VFLIP, 0, 1, 1, 0); for (i = 0; i ARRAY_SIZE(mt9p031_ctrls); ++i) v4l2_ctrl_new_custom(mt9p031-ctrls, mt9p031_ctrls[i], NULL); mt9p031-subdev.ctrl_handler = mt9p031-ctrls; if (mt9p031-ctrls.error) printk(KERN_INFO %s: control initialization error %d\n, __func__, mt9p031-ctrls.error); mutex_init(mt9p031-power_lock); v4l2_i2c_subdev_init(mt9p031-subdev, client, mt9p031_subdev_ops); mt9p031-subdev.internal_ops = mt9p031_subdev_internal_ops; mt9p031-pad.flags = MEDIA_PAD_FL_SOURCE; ret = media_entity_init(mt9p031-subdev.entity, 1, mt9p031-pad, 0); if (ret 0) goto done; mt9p031-subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; mt9p031-crop.width = MT9P031_WINDOW_WIDTH_DEF; mt9p031-crop.height = MT9P031_WINDOW_HEIGHT_DEF; mt9p031-crop.left = MT9P031_COLUMN_START_DEF; mt9p031-crop.top = MT9P031_ROW_START_DEF; if (mt9p031-pdata-version == MT9P031_MONOCHROME_VERSION) mt9p031-format.code = V4L2_MBUS_FMT_Y12_1X12; else mt9p031-format.code = V4L2_MBUS_FMT_SGRBG12_1X12; mt9p031-format.width = MT9P031_WINDOW_WIDTH_DEF; mt9p031-format.height = MT9P031_WINDOW_HEIGHT_DEF; mt9p031-format.field = V4L2_FIELD_NONE; mt9p031-format.colorspace = V4L2_COLORSPACE_SRGB; isi_set_clk(); mt9p031-pdata-ext_freq=2100; mt9p031-pdata-target_freq=4800; ret = mt9p031_pll_get_divs(mt9p031); done: if (ret 0) { v4l2_ctrl_handler_free(mt9p031-ctrls); media_entity_cleanup(mt9p031-subdev.entity); kfree(mt9p031); } return ret; } -- 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 04/28] proc: Supply PDE attribute setting accessor functions [RFC]
On Tue, Apr 16, 2013 at 12:26 PM, David Howells dhowe...@redhat.com wrote: Supply accessor functions to set attributes in proc_dir_entry structs. The following are supplied: proc_set_size() and proc_set_user(). Signed-off-by: David Howells dhowe...@redhat.com cc: linuxppc-...@lists.ozlabs.org cc: linux-media@vger.kernel.org cc: net...@vger.kernel.org cc: linux-wirel...@vger.kernel.org cc: linux-...@vger.kernel.org cc: netfilter-de...@vger.kernel.org cc: alsa-de...@alsa-project.org --- arch/powerpc/kernel/proc_powerpc.c|2 +- arch/powerpc/platforms/pseries/reconfig.c |2 +- drivers/media/pci/ttpci/av7110_ir.c |2 +- drivers/net/irda/vlsi_ir.c|2 +- drivers/net/wireless/airo.c | 34 + drivers/pci/proc.c|2 +- For the drivers/pci part: Acked-by: Bjorn Helgaas bhelg...@google.com fs/proc/generic.c | 13 +++ include/linux/proc_fs.h |5 kernel/configs.c |2 +- kernel/profile.c |2 +- net/netfilter/xt_recent.c |3 +-- sound/core/info.c |2 +- 12 files changed, 38 insertions(+), 33 deletions(-) diff --git a/arch/powerpc/kernel/proc_powerpc.c b/arch/powerpc/kernel/proc_powerpc.c index 41d8ee9..feb8580 100644 --- a/arch/powerpc/kernel/proc_powerpc.c +++ b/arch/powerpc/kernel/proc_powerpc.c @@ -83,7 +83,7 @@ static int __init proc_ppc64_init(void) page_map_fops, vdso_data); if (!pde) return 1; - pde-size = PAGE_SIZE; + proc_set_size(pde, PAGE_SIZE); return 0; } diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c index d6491bd..f93cdf5 100644 --- a/arch/powerpc/platforms/pseries/reconfig.c +++ b/arch/powerpc/platforms/pseries/reconfig.c @@ -452,7 +452,7 @@ static int proc_ppc64_create_ofdt(void) ent = proc_create(powerpc/ofdt, S_IWUSR, NULL, ofdt_fops); if (ent) - ent-size = 0; + proc_set_size(ent, 0); return 0; } diff --git a/drivers/media/pci/ttpci/av7110_ir.c b/drivers/media/pci/ttpci/av7110_ir.c index eb82286..0e763a7 100644 --- a/drivers/media/pci/ttpci/av7110_ir.c +++ b/drivers/media/pci/ttpci/av7110_ir.c @@ -375,7 +375,7 @@ int av7110_ir_init(struct av7110 *av7110) if (av_cnt == 1) { e = proc_create(av7110_ir, S_IWUSR, NULL, av7110_ir_proc_fops); if (e) - e-size = 4 + 256 * sizeof(u16); + proc_set_size(e, 4 + 256 * sizeof(u16)); } tasklet_init(av7110-ir.ir_tasklet, av7110_emit_key, (unsigned long) av7110-ir); diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c index e22cd4e..5f47584 100644 --- a/drivers/net/irda/vlsi_ir.c +++ b/drivers/net/irda/vlsi_ir.c @@ -1678,7 +1678,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id) IRDA_WARNING(%s: failed to create proc entry\n, __func__); } else { - ent-size = 0; + proc_set_size(ent, 0); } idev-proc_entry = ent; } diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 66e398d..21d0233 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -4507,73 +4507,63 @@ static int setup_proc_entry( struct net_device *dev, airo_entry); if (!apriv-proc_entry) goto fail; - apriv-proc_entry-uid = proc_kuid; - apriv-proc_entry-gid = proc_kgid; + proc_set_user(apriv-proc_entry, proc_kuid, proc_kgid); /* Setup the StatsDelta */ entry = proc_create_data(StatsDelta, S_IRUGO proc_perm, apriv-proc_entry, proc_statsdelta_ops, dev); if (!entry) goto fail_stats_delta; - entry-uid = proc_kuid; - entry-gid = proc_kgid; + proc_set_user(entry, proc_kuid, proc_kgid); /* Setup the Stats */ entry = proc_create_data(Stats, S_IRUGO proc_perm, apriv-proc_entry, proc_stats_ops, dev); if (!entry) goto fail_stats; - entry-uid = proc_kuid; - entry-gid = proc_kgid; + proc_set_user(entry, proc_kuid, proc_kgid); /* Setup the Status */ entry = proc_create_data(Status, S_IRUGO proc_perm, apriv-proc_entry, proc_status_ops, dev); if (!entry) goto fail_status; - entry-uid = proc_kuid; - entry-gid = proc_kgid; + proc_set_user(entry,
[PATCH v9 00/12] Driver for Si476x series of chips
Driver for Si476x series of chips This is a eight version of the patchset originaly posted here: https://lkml.org/lkml/2012/9/13/590 Second version of the patch was posted here: https://lkml.org/lkml/2012/10/5/598 Third version of the patch was posted here: https://lkml.org/lkml/2012/10/23/510 Fourth version of the patch was posted here: https://lkml.org/lkml/2013/2/18/572 Fifth version of the patch was posted here: https://lkml.org/lkml/2013/2/26/45 Sixth version of the patch was posted here: https://lkml.org/lkml/2013/2/26/257 Seventh version of the patch was posted here: https://lkml.org/lkml/2013/2/27/22 Eighth version of the patch was posted here: https://lkml.org/lkml/2013/3/26/891 To save everyone's time I'll repost the original description of it: This patchset contains a driver for a Silicon Laboratories 476x series of radio tuners. The driver itself is implemented as an MFD devices comprised of three parts: 1. Core device that provides all the other devices with basic functionality and locking scheme. 2. Radio device that translates between V4L2 subsystem requests into Core device commands. 3. Codec device that does similar to the earlier described task, but for ALSA SoC subsystem. v9 of this driver has following changes: - MFD part of the driver no longer depends on the header file added by the radio driver(media/si476x.h) which should potential restore the bisectability of the patches Mauro, I am not sure if you reverted changes in patches 5 - 7, so I am including them just in case. Hans, some of the patches you gave your ACK to were changed, but since the only thing changed is the location of the original code(it was rearranged into different files) I did not remove your ACKs from the new commits. I hope you don't mind, but if you do, let me know and I'll post an updated version of the patchset so it would be clear that it is not ready to be merged. Please note, taht patch #12 is the modified version of https://patchwork-mail.kernel.org/patch/2420751/ It _was not_ ACKEd by anyone. Samuel, I couldn't just move media/si476x.h to mfd patches because it would also break bisectability since media/si476x.h depends on patch #8 in this patchset(whcih is the change that should go through 'media' tree) But I rearranged definitions and there shouldn't be any dependencies on media patches in MFD part. Andrey Smirnov (10): mfd: Add commands abstraction layer for SI476X MFD mfd: Add the main bulk of core driver for SI476x code mfd: Add chip properties handling code for SI476X MFD mfd: Add header files and Kbuild plumbing for SI476x MFD core v4l2: Fix the type of V4L2_CID_TUNE_PREEMPHASIS in the documentation v4l2: Add standard controls for FM receivers v4l2: Add documentation for the FM RX controls v4l2: Add private controls base for SI476X v4l2: Add a V4L2 driver for SI476X MFD radio-si476x: Fix incorrect pointer checking Hans Verkuil (1): si476x: Fix some config dependencies and a compile warnings Mauro Carvalho Chehab (1): radio-si476x: vidioc_s* now uses a const parameter Documentation/DocBook/media/v4l/compat.xml |3 + Documentation/DocBook/media/v4l/controls.xml | 74 +- .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml |9 + Documentation/video4linux/si476x.txt | 187 +++ drivers/media/radio/Kconfig| 17 + drivers/media/radio/Makefile |1 + drivers/media/radio/radio-si476x.c | 1575 drivers/media/v4l2-core/v4l2-ctrls.c | 14 +- drivers/mfd/Kconfig| 13 + drivers/mfd/Makefile |4 + drivers/mfd/si476x-cmd.c | 1553 +++ drivers/mfd/si476x-i2c.c | 886 +++ drivers/mfd/si476x-prop.c | 242 +++ include/linux/mfd/si476x-core.h| 533 +++ include/linux/mfd/si476x-platform.h| 267 include/linux/mfd/si476x-reports.h | 163 ++ include/media/si476x.h | 37 + include/uapi/linux/v4l2-controls.h | 17 + 18 files changed, 5591 insertions(+), 4 deletions(-) create mode 100644 Documentation/video4linux/si476x.txt create mode 100644 drivers/media/radio/radio-si476x.c create mode 100644 drivers/mfd/si476x-cmd.c create mode 100644 drivers/mfd/si476x-i2c.c create mode 100644 drivers/mfd/si476x-prop.c create mode 100644 include/linux/mfd/si476x-core.h create mode 100644 include/linux/mfd/si476x-platform.h create mode 100644 include/linux/mfd/si476x-reports.h create mode 100644 include/media/si476x.h -- 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 09/12] v4l2: Add a V4L2 driver for SI476X MFD
From: Andrey Smirnov andreysm@charmander.(none) This commit adds a driver that exposes all the radio related functionality of the Si476x series of chips via the V4L2 subsystem. Acked-by: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Andrey Smirnov andrew.smir...@gmail.com --- Documentation/video4linux/si476x.txt | 187 drivers/media/radio/Kconfig | 17 + drivers/media/radio/Makefile |1 + drivers/media/radio/radio-si476x.c | 1599 ++ include/media/si476x.h | 37 + 5 files changed, 1841 insertions(+) create mode 100644 Documentation/video4linux/si476x.txt create mode 100644 drivers/media/radio/radio-si476x.c create mode 100644 include/media/si476x.h diff --git a/Documentation/video4linux/si476x.txt b/Documentation/video4linux/si476x.txt new file mode 100644 index 000..d1a08db --- /dev/null +++ b/Documentation/video4linux/si476x.txt @@ -0,0 +1,187 @@ +SI476x Driver Readme + + Copyright (C) 2013 Andrey Smirnov andrew.smir...@gmail.com + +TODO for the driver +-- + +- According to the SiLabs' datasheet it is possible to update the + firmware of the radio chip in the run-time, thus bringing it to the + most recent version. Unfortunately I couldn't find any mentioning of + the said firmware update for the old chips that I tested the driver + against, so for chips like that the driver only exposes the old + functionality. + + +Parameters exposed over debugfs +--- +SI476x allow user to get multiple characteristics that can be very +useful for EoL testing/RF performance estimation, parameters that have +very little to do with V4L2 subsystem. Such parameters are exposed via +debugfs and can be accessed via regular file I/O operations. + +The drivers exposes following files: + +* /sys/kernel/debug/device-name/acf + This file contains ACF(Automatically Controlled Features) status + information. The contents of the file is binary data of the + following layout: + + Offset | Name | Description + + 0x00 | blend_int | Flag, set when stereo separation has + | | crossed below the blend threshold + + 0x01 | hblend_int| Flag, set when HiBlend cutoff + | | frequency is lower than threshold + + 0x02 | hicut_int | Flag, set when HiCut cutoff + | | frequency is lower than threshold + + 0x03 | chbw_int | Flag, set when channel filter + | | bandwidth is less than threshold + + 0x04 | softmute_int | Flag indicating that softmute + | | attenuation has increased above + | | softmute threshold + + 0x05 | smute | 0 - Audio is not soft muted + | | 1 - Audio is soft muted + + 0x06 | smattn| Soft mute attenuation level in dB + + 0x07 | chbw | Channel filter bandwidth in kHz + + 0x08 | hicut | HiCut cutoff frequency in units of + | | 100Hz + + 0x09 | hiblend | HiBlend cutoff frequency in units + | | of 100 Hz + + 0x10 | pilot | 0 - Stereo pilot is not present + | | 1 - Stereo pilot is present + + 0x11 | stblend | Stereo blend in % + + + +* /sys/kernel/debug/device-name/rds_blckcnt + This file contains statistics about RDS receptions. It's binary data + has the following layout: + + Offset | Name | Description + + 0x00 | expected | Number of expected RDS blocks + + 0x02 | received | Number of received RDS blocks + + 0x04
[PATCH 12/12] radio-si476x: Fix incorrect pointer checking
Fix incorrect pointer checking and make some minor code improvements: * Remove unnecessary elements from function pointer table(vtable), that includes all the elements that are FM-only, this allows for not checking of the fucntion pointer and calling of the function directly(THe check if the tuner is in FM mode has to be done anyway) * Fix incorrect function pointer checking where the code would check one pointer to be non-NULL, but would use other pointer, which would not be checked. * Remove code duplication in si476x_radio_read_rsq_blob and si476x_radio_read_rsq_primary_blob. * Add some BUG_ON statements for function pointers that should never be NULL Signed-off-by: Andrey Smirnov andrew.smir...@gmail.com Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- drivers/media/radio/radio-si476x.c | 90 +--- 1 file changed, 33 insertions(+), 57 deletions(-) diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c index 9430c6a..378c7f0 100644 --- a/drivers/media/radio/radio-si476x.c +++ b/drivers/media/radio/radio-si476x.c @@ -270,8 +270,6 @@ struct si476x_radio; * @seek_start: Star station seeking * @rsq_status: Get Recieved Signal Quality(RSQ) status * @rds_blckcnt: Get recived RDS blocks count - * @phase_diversity: Change phase diversity mode of the tuner - * @phase_div_status: Get phase diversity mode status * @acf_status: Get the status of Automatically Controlled * Features(ACF) * @agc_status: Get Automatic Gain Control(AGC) status @@ -281,16 +279,8 @@ struct si476x_radio_ops { int (*seek_start)(struct si476x_core *, bool, bool); int (*rsq_status)(struct si476x_core *, struct si476x_rsq_status_args *, struct si476x_rsq_status_report *); - int (*rds_blckcnt)(struct si476x_core *, bool, - struct si476x_rds_blockcount_report *); - - int (*phase_diversity)(struct si476x_core *, - enum si476x_phase_diversity_mode); - int (*phase_div_status)(struct si476x_core *); int (*acf_status)(struct si476x_core *, struct si476x_acf_status_report *); - int (*agc_status)(struct si476x_core *, - struct si476x_agc_status_report *); }; /** @@ -495,22 +485,14 @@ static int si476x_radio_init_vtable(struct si476x_radio *radio, .tune_freq = si476x_core_cmd_fm_tune_freq, .seek_start = si476x_core_cmd_fm_seek_start, .rsq_status = si476x_core_cmd_fm_rsq_status, - .rds_blckcnt= si476x_core_cmd_fm_rds_blockcount, - .phase_diversity= si476x_core_cmd_fm_phase_diversity, - .phase_div_status = si476x_core_cmd_fm_phase_div_status, .acf_status = si476x_core_cmd_fm_acf_status, - .agc_status = si476x_core_cmd_agc_status, }; static const struct si476x_radio_ops am_ops = { .tune_freq = si476x_core_cmd_am_tune_freq, .seek_start = si476x_core_cmd_am_seek_start, .rsq_status = si476x_core_cmd_am_rsq_status, - .rds_blckcnt= NULL, - .phase_diversity= NULL, - .phase_div_status = NULL, .acf_status = si476x_core_cmd_am_acf_status, - .agc_status = NULL, }; switch (func) { @@ -545,11 +527,15 @@ static int si476x_radio_pretune(struct si476x_radio *radio, case SI476X_FUNC_FM_RECEIVER: args.freq = v4l2_to_si476x(radio-core, 92 * FREQ_MUL); + + BUG_ON(!radio-ops-tune_freq); retval = radio-ops-tune_freq(radio-core, args); break; case SI476X_FUNC_AM_RECEIVER: args.freq = v4l2_to_si476x(radio-core, 0.6 * FREQ_MUL); + + BUG_ON(!radio-ops-tune_freq); retval = radio-ops-tune_freq(radio-core, args); break; default: @@ -599,7 +585,7 @@ static int si476x_radio_do_post_powerup_init(struct si476x_radio *radio, if (err 0) return err; - if (func == SI476X_FUNC_FM_RECEIVER) { + if (!si476x_core_is_in_am_receiver_mode(radio-core)) { if (si476x_core_has_diversity(radio-core)) { err = si476x_core_cmd_fm_phase_diversity(radio-core, radio-core-diversity_mode); @@ -743,6 +729,7 @@ static int si476x_radio_s_frequency(struct file *file, void *priv, args.smoothmetrics = SI476X_SM_INITIALIZE_AUDIO; args.antcap = 0; + BUG_ON(!radio-ops-tune_freq);
[PATCH 07/12] v4l2: Add documentation for the FM RX controls
Add appropriate documentation for all the newly added standard controls. Based on the patch by Manjunatha Halli [1] [1] http://lists-archives.com/linux-kernel/27641303-media-update-docs-for-v4l2-fm-new-features.html Acked-by: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Andrey Smirnov andrew.smir...@gmail.com --- Documentation/DocBook/media/v4l/compat.xml |3 + Documentation/DocBook/media/v4l/controls.xml | 72 .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml |9 +++ 3 files changed, 84 insertions(+) diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index 104a1a2..f418bc3 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml @@ -2310,6 +2310,9 @@ more information./para listitem paraAdded FM Modulator (FM TX) Extended Control Class: constantV4L2_CTRL_CLASS_FM_TX/constant and their Control IDs./para /listitem +listitem + paraAdded FM Receiver (FM RX) Extended Control Class: constantV4L2_CTRL_CLASS_FM_RX/constant and their Control IDs./para + /listitem listitem paraAdded Remote Controller chapter, describing the default Remote Controller mapping for media devices./para /listitem diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index 1ad20cc..6aa647a 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -4687,4 +4687,76 @@ interface and may change in the future./para /table /section + +section id=fm-rx-controls + titleFM Receiver Control Reference/title + + paraThe FM Receiver (FM_RX) class includes controls for common features of + FM Reception capable devices./para + + table pgwide=1 frame=none id=fm-rx-control-id + titleFM_RX Control IDs/title + + tgroup cols=4 +colspec colname=c1 colwidth=1* / +colspec colname=c2 colwidth=6* / +colspec colname=c3 colwidth=2* / +colspec colname=c4 colwidth=6* / +spanspec namest=c1 nameend=c2 spanname=id / +spanspec namest=c2 nameend=c4 spanname=descr / +thead + row +entry spanname=id align=leftID/entry +entry align=leftType/entry + /rowrow rowsep=1entry spanname=descr align=leftDescription/entry + /row +/thead +tbody valign=top + rowentry/entry/row + row +entry spanname=idconstantV4L2_CID_FM_RX_CLASS/constantnbsp;/entry +entryclass/entry + /rowrowentry spanname=descrThe FM_RX class +descriptor. Calling VIDIOC-QUERYCTRL; for this control will return a +description of this control class./entry + /row + row +entry spanname=idconstantV4L2_CID_RDS_RECEPTION/constantnbsp;/entry +entryboolean/entry + /rowrowentry spanname=descrEnables/disables RDS + reception by the radio tuner/entry + /row + row + entry spanname=idconstantV4L2_CID_TUNE_DEEMPHASIS/constantnbsp;/entry + entryenum v4l2_deemphasis/entry + /row + row id=v4l2-deemphasisentry spanname=descrConfigures the de-emphasis value for reception. +A de-emphasis filter is applied to the broadcast to accentuate the high audio frequencies. +Depending on the region, a time constant of either 50 or 75 useconds is used. The enumnbsp;v4l2_deemphasis +defines possible values for de-emphasis. Here they are:/entry + /rowrow + entrytbl spanname=descr cols=2 + tbody valign=top + row + entryconstantV4L2_DEEMPHASIS_DISABLED/constantnbsp;/entry + entryNo de-emphasis is applied./entry + /row + row + entryconstantV4L2_DEEMPHASIS_50_uS/constantnbsp;/entry + entryA de-emphasis of 50 uS is used./entry + /row + row + entryconstantV4L2_DEEMPHASIS_75_uS/constantnbsp;/entry + entryA de-emphasis of 75 uS is used./entry + /row + /tbody + /entrytbl + + /row + rowentry/entry/row +/tbody + /tgroup + /table + + /section /section diff --git a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml index 4e16112..b3bb957 100644 --- a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml +++ b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml @@ -319,6 +319,15 @@ These controls are described in xref processing controls. These controls are described in xref linkend=image-process-controls /./entry /row + + row +
[PATCH 10/12] radio-si476x: vidioc_s* now uses a const parameter
From: Mauro Carvalho Chehab mche...@redhat.com vidioc_s_tuner, vidioc_s_frequency and vidioc_s_register now uses a constant argument. So, the driver reports warnings: drivers/media/radio/radio-si476x.c:1196:2: warning: initialization from incompatible pointer type [enabled by default] drivers/media/radio/radio-si476x.c:1196:2: warning: (near initialization for 'si4761_ioctl_ops.vidioc_s_tuner') [enabled by default] drivers/media/radio/radio-si476x.c:1199:2: warning: initialization from incompatible pointer type [enabled by default] drivers/media/radio/radio-si476x.c:1199:2: warning: (near initialization for 'si4761_ioctl_ops.vidioc_s_frequency') [enabled by default] drivers/media/radio/radio-si476x.c:1209:2: warning: initialization from incompatible pointer type [enabled by default] drivers/media/radio/radio-si476x.c:1209:2: warning: (near initialization for 'si4761_ioctl_ops.vidioc_s_register') [enabled by default] This is due to a (soft) merge conflict, as both this driver and the const patches were applied for the same Kernel version. Acked-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Andrey Smirnov andrew.smir...@gmail.com Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com --- drivers/media/radio/radio-si476x.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c index 0895a0c..9430c6a 100644 --- a/drivers/media/radio/radio-si476x.c +++ b/drivers/media/radio/radio-si476x.c @@ -472,7 +472,7 @@ static int si476x_radio_g_tuner(struct file *file, void *priv, } static int si476x_radio_s_tuner(struct file *file, void *priv, - struct v4l2_tuner *tuner) + const struct v4l2_tuner *tuner) { struct si476x_radio *radio = video_drvdata(file); @@ -699,15 +699,16 @@ static int si476x_radio_g_frequency(struct file *file, void *priv, } static int si476x_radio_s_frequency(struct file *file, void *priv, - struct v4l2_frequency *f) + const struct v4l2_frequency *f) { int err; + u32 freq = f-frequency; struct si476x_tune_freq_args args; struct si476x_radio *radio = video_drvdata(file); const u32 midrange = (si476x_bands[SI476X_BAND_AM].rangehigh + si476x_bands[SI476X_BAND_FM].rangelow) / 2; - const int band = (f-frequency midrange) ? + const int band = (freq midrange) ? SI476X_BAND_FM : SI476X_BAND_AM; const enum si476x_func func = (band == SI476X_BAND_AM) ? SI476X_FUNC_AM_RECEIVER : SI476X_FUNC_FM_RECEIVER; @@ -718,11 +719,11 @@ static int si476x_radio_s_frequency(struct file *file, void *priv, si476x_core_lock(radio-core); - f-frequency = clamp(f-frequency, -si476x_bands[band].rangelow, -si476x_bands[band].rangehigh); + freq = clamp(freq, +si476x_bands[band].rangelow, +si476x_bands[band].rangehigh); - if (si476x_radio_freq_is_inside_of_the_band(f-frequency, + if (si476x_radio_freq_is_inside_of_the_band(freq, SI476X_BAND_AM) (!si476x_core_has_am(radio-core) || si476x_core_is_a_secondary_tuner(radio-core))) { @@ -737,8 +738,7 @@ static int si476x_radio_s_frequency(struct file *file, void *priv, args.zifsr = false; args.hd = false; args.injside= SI476X_INJSIDE_AUTO; - args.freq = v4l2_to_si476x(radio-core, -f-frequency); + args.freq = v4l2_to_si476x(radio-core, freq); args.tunemode = SI476X_TM_VALIDATED_NORMAL_TUNE; args.smoothmetrics = SI476X_SM_INITIALIZE_AUDIO; args.antcap = 0; @@ -1046,7 +1046,7 @@ static int si476x_radio_g_register(struct file *file, void *fh, return err; } static int si476x_radio_s_register(struct file *file, void *fh, - struct v4l2_dbg_register *reg) + const struct v4l2_dbg_register *reg) { int err; -- 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 11/12] si476x: Fix some config dependencies and a compile warnings
From: Hans Verkuil hverk...@xs4all.nl radio-si476x depends on SND and SND_SOC, the mfd driver should select REGMAP_I2C. Also fix a small compile warning in a debug message: drivers/mfd/si476x-i2c.c: In function ‘si476x_core_drain_rds_fifo’: drivers/mfd/si476x-i2c.c:391:4: warning: field width specifier ‘*’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat] Acked-by: Andrey Smirnov andrew.smir...@gmail.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/radio/Kconfig |2 +- drivers/mfd/Kconfig |1 + drivers/mfd/si476x-i2c.c|2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig index 170460d..181a25f 100644 --- a/drivers/media/radio/Kconfig +++ b/drivers/media/radio/Kconfig @@ -20,7 +20,7 @@ source drivers/media/radio/si470x/Kconfig config RADIO_SI476X tristate Silicon Laboratories Si476x I2C FM Radio - depends on I2C VIDEO_V4L2 + depends on I2C VIDEO_V4L2 SND SND_SOC select MFD_CORE select MFD_SI476X_CORE select SND_SOC_SI476X diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 3cd8f21..606e549 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -974,6 +974,7 @@ config MFD_SI476X_CORE tristate Support for Silicon Laboratories 4761/64/68 AM/FM radio. depends on I2C select MFD_CORE + select REGMAP_I2C help This is the core driver for the SI476x series of AM/FM radio. This MFD driver connects the radio-si476x V4L2 module diff --git a/drivers/mfd/si476x-i2c.c b/drivers/mfd/si476x-i2c.c index 118c6b1..f5bc8e4 100644 --- a/drivers/mfd/si476x-i2c.c +++ b/drivers/mfd/si476x-i2c.c @@ -389,7 +389,7 @@ static void si476x_core_drain_rds_fifo(struct work_struct *work) kfifo_in(core-rds_fifo, report.rds, sizeof(report.rds)); dev_dbg(core-client-dev, RDS data:\n %*ph\n, - sizeof(report.rds), report.rds); + (int)sizeof(report.rds), report.rds); } dev_dbg(core-client-dev, Dained!\n); wake_up_interruptible(core-rds_read_queue); -- 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 08/12] v4l2: Add private controls base for SI476X
Add a base to be used for allocation of all the SI476X specific controls in the corresponding driver. Acked-by: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Andrey Smirnov andrew.smir...@gmail.com --- include/uapi/linux/v4l2-controls.h |4 1 file changed, 4 insertions(+) diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 3e985be..22e5170 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -147,6 +147,10 @@ enum v4l2_colorfx { * of controls. We reserve 16 controls for this driver. */ #define V4L2_CID_USER_MEYE_BASE(V4L2_CID_USER_BASE + 0x1000) +/* The base for the si476x driver controls. See include/media/si476x.h for the list + * of controls. Total of 16 controls is reserved for that driver */ +#define V4L2_CID_USER_SI476X_BASE (V4L2_CID_USER_BASE + 0x1010) + /* MPEG-class control IDs */ #define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) -- 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 03/12] mfd: Add chip properties handling code for SI476X MFD
From: Andrey Smirnov andreysm@charmander.(none) This patch adds code related to manipulation of the properties of SI476X chips. Acked-by: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Andrey Smirnov andrew.smir...@gmail.com --- drivers/mfd/si476x-prop.c | 241 + 1 file changed, 241 insertions(+) create mode 100644 drivers/mfd/si476x-prop.c diff --git a/drivers/mfd/si476x-prop.c b/drivers/mfd/si476x-prop.c new file mode 100644 index 000..cfeffa6 --- /dev/null +++ b/drivers/mfd/si476x-prop.c @@ -0,0 +1,241 @@ +/* + * drivers/mfd/si476x-prop.c -- Subroutines to access + * properties of si476x chips + * + * Copyright (C) 2012 Innovative Converged Devices(ICD) + * Copyright (C) 2013 Andrey Smirnov + * + * Author: Andrey Smirnov andrew.smir...@gmail.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + */ +#include linux/module.h + +#include linux/mfd/si476x-core.h + +struct si476x_property_range { + u16 low, high; +}; + +static bool si476x_core_element_is_in_array(u16 element, + const u16 array[], + size_t size) +{ + int i; + + for (i = 0; i size; i++) + if (element == array[i]) + return true; + + return false; +} + +static bool si476x_core_element_is_in_range(u16 element, + const struct si476x_property_range range[], + size_t size) +{ + int i; + + for (i = 0; i size; i++) + if (element = range[i].high element = range[i].low) + return true; + + return false; +} + +static bool si476x_core_is_valid_property_a10(struct si476x_core *core, + u16 property) +{ + static const u16 valid_properties[] = { + 0x, + 0x0500, 0x0501, + 0x0600, + 0x0709, 0x070C, 0x070D, 0x70E, 0x710, + 0x0718, + 0x1207, 0x1208, + 0x2007, + 0x2300, + }; + + static const struct si476x_property_range valid_ranges[] = { + { 0x0200, 0x0203 }, + { 0x0300, 0x0303 }, + { 0x0400, 0x0404 }, + { 0x0700, 0x0707 }, + { 0x1100, 0x1102 }, + { 0x1200, 0x1204 }, + { 0x1300, 0x1306 }, + { 0x2000, 0x2005 }, + { 0x2100, 0x2104 }, + { 0x2106, 0x2106 }, + { 0x2200, 0x220E }, + { 0x3100, 0x3104 }, + { 0x3207, 0x320F }, + { 0x3300, 0x3304 }, + { 0x3500, 0x3517 }, + { 0x3600, 0x3617 }, + { 0x3700, 0x3717 }, + { 0x4000, 0x4003 }, + }; + + return si476x_core_element_is_in_range(property, valid_ranges, + ARRAY_SIZE(valid_ranges)) || + si476x_core_element_is_in_array(property, valid_properties, + ARRAY_SIZE(valid_properties)); +} + +static bool si476x_core_is_valid_property_a20(struct si476x_core *core, + u16 property) +{ + static const u16 valid_properties[] = { + 0x071B, + 0x1006, + 0x2210, + 0x3401, + }; + + static const struct si476x_property_range valid_ranges[] = { + { 0x2215, 0x2219 }, + }; + + return si476x_core_is_valid_property_a10(core, property) || + si476x_core_element_is_in_range(property, valid_ranges, + ARRAY_SIZE(valid_ranges)) || + si476x_core_element_is_in_array(property, valid_properties, + ARRAY_SIZE(valid_properties)); +} + +static bool si476x_core_is_valid_property_a30(struct si476x_core *core, + u16 property) +{ + static const u16 valid_properties[] = { + 0x071C, 0x071D, + 0x1007, 0x1008, + 0x220F, 0x2214, + 0x2301, + 0x3105, 0x3106, + 0x3402, + }; + + static const struct si476x_property_range valid_ranges[] = { + { 0x0405, 0x0411 }, + { 0x2008, 0x200B }, + { 0x2220, 0x2223 }, + { 0x3100, 0x3106 }, +
[PATCH 02/12] mfd: Add the main bulk of core driver for SI476x code
From: Andrey Smirnov andreysm@charmander.(none) This patch adds main part(out of three) of the I2C driver for the core of MFD device. Acked-by: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Andrey Smirnov andrew.smir...@gmail.com --- drivers/mfd/si476x-i2c.c | 886 ++ 1 file changed, 886 insertions(+) create mode 100644 drivers/mfd/si476x-i2c.c diff --git a/drivers/mfd/si476x-i2c.c b/drivers/mfd/si476x-i2c.c new file mode 100644 index 000..118c6b1 --- /dev/null +++ b/drivers/mfd/si476x-i2c.c @@ -0,0 +1,886 @@ +/* + * drivers/mfd/si476x-i2c.c -- Core device driver for si476x MFD + * device + * + * Copyright (C) 2012 Innovative Converged Devices(ICD) + * Copyright (C) 2013 Andrey Smirnov + * + * Author: Andrey Smirnov andrew.smir...@gmail.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + */ +#include linux/module.h + +#include linux/slab.h +#include linux/interrupt.h +#include linux/delay.h +#include linux/gpio.h +#include linux/regulator/consumer.h +#include linux/i2c.h +#include linux/err.h + +#include linux/mfd/si476x-core.h + +#define SI476X_MAX_IO_ERRORS 10 +#define SI476X_DRIVER_RDS_FIFO_DEPTH 128 + +/** + * si476x_core_config_pinmux() - pin function configuration function + * + * @core: Core device structure + * + * Configure the functions of the pins of the radio chip. + * + * The function returns zero in case of succes or negative error code + * otherwise. + */ +static int si476x_core_config_pinmux(struct si476x_core *core) +{ + int err; + dev_dbg(core-client-dev, Configuring pinmux\n); + err = si476x_core_cmd_dig_audio_pin_cfg(core, + core-pinmux.dclk, + core-pinmux.dfs, + core-pinmux.dout, + core-pinmux.xout); + if (err 0) { + dev_err(core-client-dev, + Failed to configure digital audio pins(err = %d)\n, + err); + return err; + } + + err = si476x_core_cmd_zif_pin_cfg(core, + core-pinmux.iqclk, + core-pinmux.iqfs, + core-pinmux.iout, + core-pinmux.qout); + if (err 0) { + dev_err(core-client-dev, + Failed to configure ZIF pins(err = %d)\n, + err); + return err; + } + + err = si476x_core_cmd_ic_link_gpo_ctl_pin_cfg(core, + core-pinmux.icin, + core-pinmux.icip, + core-pinmux.icon, + core-pinmux.icop); + if (err 0) { + dev_err(core-client-dev, + Failed to configure IC-Link/GPO pins(err = %d)\n, + err); + return err; + } + + err = si476x_core_cmd_ana_audio_pin_cfg(core, + core-pinmux.lrout); + if (err 0) { + dev_err(core-client-dev, + Failed to configure analog audio pins(err = %d)\n, + err); + return err; + } + + err = si476x_core_cmd_intb_pin_cfg(core, + core-pinmux.intb, + core-pinmux.a1); + if (err 0) { + dev_err(core-client-dev, + Failed to configure interrupt pins(err = %d)\n, + err); + return err; + } + + return 0; +} + +static inline void si476x_core_schedule_polling_work(struct si476x_core *core) +{ + schedule_delayed_work(core-status_monitor, + usecs_to_jiffies(SI476X_STATUS_POLL_US)); +} + +/** + * si476x_core_start() - early chip startup function + * @core: Core device structure + * @soft: When set, this flag forces soft startup, where soft + * power down is the one done by sending appropriate command instead + * of using reset pin of the tuner + * + * Perform required startup sequence to correctly power + * up the chip and perform initial configuration. It does the + * following sequence of actions: + * 1. Claims and enables the power
[PATCH 05/12] v4l2: Fix the type of V4L2_CID_TUNE_PREEMPHASIS in the documentation
Change the type of V4L2_CID_TUNE_PREEMPHASIS from 'integer' to 'enum v4l2_preemphasis' Acked-by: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Andrey Smirnov andrew.smir...@gmail.com --- Documentation/DocBook/media/v4l/controls.xml |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml index 9e8f854..1ad20cc 100644 --- a/Documentation/DocBook/media/v4l/controls.xml +++ b/Documentation/DocBook/media/v4l/controls.xml @@ -3848,7 +3848,7 @@ in Hz. The range and step are driver-specific./entry /row row entry spanname=idconstantV4L2_CID_TUNE_PREEMPHASIS/constantnbsp;/entry - entryinteger/entry + entryenum v4l2_preemphasis/entry /row row id=v4l2-preemphasisentry spanname=descrConfigures the pre-emphasis value for broadcasting. A pre-emphasis filter is applied to the broadcast to accentuate the high audio frequencies. -- 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 06/12] v4l2: Add standard controls for FM receivers
This commit introduces new class of standard controls V4L2_CTRL_CLASS_FM_RX. This class is intended to all controls pertaining to FM receiver chips. Also, two controls belonging to said class are added as a part of this commit: V4L2_CID_TUNE_DEEMPHASIS and V4L2_CID_RDS_RECEPTION. This patch is based on the code found in the patch by Manjunatha Halli [1] [1] http://lists-archives.com/linux-kernel/27641307-new-control-class-and-features-for-fm-rx.html Acked-by: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Andrey Smirnov andrew.smir...@gmail.com --- drivers/media/v4l2-core/v4l2-ctrls.c | 14 +++--- include/uapi/linux/v4l2-controls.h | 13 + 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 6b28b58..8b89fb8 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -297,8 +297,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id) Text, NULL }; - static const char * const tune_preemphasis[] = { - No Preemphasis, + static const char * const tune_emphasis[] = { + None, 50 Microseconds, 75 Microseconds, NULL, @@ -508,7 +508,9 @@ const char * const *v4l2_ctrl_get_menu(u32 id) case V4L2_CID_SCENE_MODE: return scene_mode; case V4L2_CID_TUNE_PREEMPHASIS: - return tune_preemphasis; + return tune_emphasis; + case V4L2_CID_TUNE_DEEMPHASIS: + return tune_emphasis; case V4L2_CID_FLASH_LED_MODE: return flash_led_mode; case V4L2_CID_FLASH_STROBE_SOURCE: @@ -799,6 +801,9 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_DV_RX_POWER_PRESENT: return Power Present; case V4L2_CID_DV_RX_RGB_RANGE: return Rx RGB Quantization Range; + case V4L2_CID_FM_RX_CLASS: return FM Radio Receiver Controls; + case V4L2_CID_TUNE_DEEMPHASIS: return De-Emphasis; + case V4L2_CID_RDS_RECEPTION:return RDS Reception; default: return NULL; } @@ -846,6 +851,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL: case V4L2_CID_WIDE_DYNAMIC_RANGE: case V4L2_CID_IMAGE_STABILIZATION: + case V4L2_CID_RDS_RECEPTION: *type = V4L2_CTRL_TYPE_BOOLEAN; *min = 0; *max = *step = 1; @@ -904,6 +910,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_DV_TX_RGB_RANGE: case V4L2_CID_DV_RX_RGB_RANGE: case V4L2_CID_TEST_PATTERN: + case V4L2_CID_TUNE_DEEMPHASIS: *type = V4L2_CTRL_TYPE_MENU; break; case V4L2_CID_LINK_FREQ: @@ -926,6 +933,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_IMAGE_SOURCE_CLASS: case V4L2_CID_IMAGE_PROC_CLASS: case V4L2_CID_DV_CLASS: + case V4L2_CID_FM_RX_CLASS: *type = V4L2_CTRL_TYPE_CTRL_CLASS; /* You can neither read not write these */ *flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index dcd6374..3e985be 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -59,6 +59,7 @@ #define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e /* Image source controls */ #define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f /* Image processing controls */ #define V4L2_CTRL_CLASS_DV 0x00a0 /* Digital Video controls */ +#define V4L2_CTRL_CLASS_FM_RX 0x00a1 /* Digital Video controls */ /* User-class control IDs */ @@ -825,4 +826,16 @@ enum v4l2_dv_rgb_range { #defineV4L2_CID_DV_RX_POWER_PRESENT(V4L2_CID_DV_CLASS_BASE + 100) #define V4L2_CID_DV_RX_RGB_RANGE (V4L2_CID_DV_CLASS_BASE + 101) +#define V4L2_CID_FM_RX_CLASS_BASE (V4L2_CTRL_CLASS_FM_RX | 0x900) +#define V4L2_CID_FM_RX_CLASS (V4L2_CTRL_CLASS_FM_RX | 1) + +#define V4L2_CID_TUNE_DEEMPHASIS (V4L2_CID_FM_RX_CLASS_BASE + 1) +enum v4l2_deemphasis { + V4L2_DEEMPHASIS_DISABLED= V4L2_PREEMPHASIS_DISABLED, + V4L2_DEEMPHASIS_50_uS = V4L2_PREEMPHASIS_50_uS, + V4L2_DEEMPHASIS_75_uS = V4L2_PREEMPHASIS_75_uS, +}; + +#define V4L2_CID_RDS_RECEPTION (V4L2_CID_FM_RX_CLASS_BASE + 2) + #endif -- 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 04/12] mfd: Add header files and Kbuild plumbing for SI476x MFD core
From: Andrey Smirnov andreysm@charmander.(none) This patch adds all necessary header files and Kbuild plumbing for the core driver for Silicon Laboratories Si476x series of AM/FM tuner chips. The driver as a whole is implemented as an MFD device and this patch adds a core portion of it that provides all the necessary functionality to the two other drivers that represent radio and audio codec subsystems of the chip. Acked-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Sam Ravnborg s...@ravnborg.org Signed-off-by: Andrey Smirnov andrew.smir...@gmail.com --- drivers/mfd/Kconfig | 12 + drivers/mfd/Makefile|4 + include/linux/mfd/si476x-core.h | 533 +++ include/linux/mfd/si476x-platform.h | 267 ++ include/linux/mfd/si476x-reports.h | 163 +++ 5 files changed, 979 insertions(+) create mode 100644 include/linux/mfd/si476x-core.h create mode 100644 include/linux/mfd/si476x-platform.h create mode 100644 include/linux/mfd/si476x-reports.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 1c0abd4..3cd8f21 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -970,6 +970,18 @@ config MFD_WL1273_CORE driver connects the radio-wl1273 V4L2 module and the wl1273 audio codec. +config MFD_SI476X_CORE + tristate Support for Silicon Laboratories 4761/64/68 AM/FM radio. + depends on I2C + select MFD_CORE + help + This is the core driver for the SI476x series of AM/FM + radio. This MFD driver connects the radio-si476x V4L2 module + and the si476x audio codec. + + To compile this driver as a module, choose M here: the + module will be called si476x-core. + config MFD_OMAP_USB_HOST bool Support OMAP USBHS core and TLL driver depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3 diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 8b977f8..ca87ae8 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -131,6 +131,10 @@ obj-$(CONFIG_MFD_JZ4740_ADC) += jz4740-adc.o obj-$(CONFIG_MFD_TPS6586X) += tps6586x.o obj-$(CONFIG_MFD_VX855)+= vx855.o obj-$(CONFIG_MFD_WL1273_CORE) += wl1273-core.o + +si476x-core-y := si476x-cmd.o si476x-prop.o si476x-i2c.o +obj-$(CONFIG_MFD_SI476X_CORE) += si476x-core.o + obj-$(CONFIG_MFD_CS5535) += cs5535-mfd.o obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o omap-usb-tll.o obj-$(CONFIG_MFD_PM8921_CORE) += pm8921-core.o diff --git a/include/linux/mfd/si476x-core.h b/include/linux/mfd/si476x-core.h new file mode 100644 index 000..ede3022 --- /dev/null +++ b/include/linux/mfd/si476x-core.h @@ -0,0 +1,533 @@ +/* + * include/media/si476x-core.h -- Common definitions for si476x core + * device + * + * Copyright (C) 2012 Innovative Converged Devices(ICD) + * Copyright (C) 2013 Andrey Smirnov + * + * Author: Andrey Smirnov andrew.smir...@gmail.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + */ + +#ifndef SI476X_CORE_H +#define SI476X_CORE_H + +#include linux/kfifo.h +#include linux/atomic.h +#include linux/i2c.h +#include linux/regmap.h +#include linux/mutex.h +#include linux/mfd/core.h +#include linux/videodev2.h +#include linux/regulator/consumer.h + +#include linux/mfd/si476x-platform.h +#include linux/mfd/si476x-reports.h + +/* Command Timeouts */ +#define SI476X_DEFAULT_TIMEOUT 10 +#define SI476X_TIMEOUT_TUNE70 +#define SI476X_TIMEOUT_POWER_UP33 +#define SI476X_STATUS_POLL_US 0 + +/* si476x-i2c.c --- */ + +enum si476x_freq_supported_chips { + SI476X_CHIP_SI4761 = 1, + SI476X_CHIP_SI4764, + SI476X_CHIP_SI4768, +}; + +enum si476x_part_revisions { + SI476X_REVISION_A10 = 0, + SI476X_REVISION_A20 = 1, + SI476X_REVISION_A30 = 2, +}; + +enum si476x_mfd_cells { + SI476X_RADIO_CELL = 0, + SI476X_CODEC_CELL, + SI476X_MFD_CELLS, +}; + +/** + * enum si476x_power_state - possible power state of the si476x + * device. + * + * @SI476X_POWER_DOWN: In this state all regulators are turned off + * and the reset line is pulled low. The device is completely + * inactive. + * @SI476X_POWER_UP_FULL: In this state all the power regualtors are + * turned on, reset line pulled high, IRQ line is enabled(polling is + * active for polling use scenario) and device is turned on with + * POWER_UP command. The device is ready to be used. + * @SI476X_POWER_INCONSISTENT: This state indicates that previous +
[PATCH 01/12] mfd: Add commands abstraction layer for SI476X MFD
From: Andrey Smirnov andreysm@charmander.(none) This patch adds all the functions used for exchanging commands with the chip. Acked-by: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Andrey Smirnov andrew.smir...@gmail.com --- drivers/mfd/si476x-cmd.c | 1553 ++ 1 file changed, 1553 insertions(+) create mode 100644 drivers/mfd/si476x-cmd.c diff --git a/drivers/mfd/si476x-cmd.c b/drivers/mfd/si476x-cmd.c new file mode 100644 index 000..de48b4e --- /dev/null +++ b/drivers/mfd/si476x-cmd.c @@ -0,0 +1,1553 @@ +/* + * drivers/mfd/si476x-cmd.c -- Subroutines implementing command + * protocol of si476x series of chips + * + * Copyright (C) 2012 Innovative Converged Devices(ICD) + * Copyright (C) 2013 Andrey Smirnov + * + * Author: Andrey Smirnov andrew.smir...@gmail.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + */ + +#include linux/module.h +#include linux/completion.h +#include linux/delay.h +#include linux/atomic.h +#include linux/i2c.h +#include linux/device.h +#include linux/gpio.h +#include linux/videodev2.h + +#include linux/mfd/si476x-core.h + +#define msb(x) ((u8)((u16) x 8)) +#define lsb(x) ((u8)((u16) x 0x00FF)) + + + +#define CMD_POWER_UP 0x01 +#define CMD_POWER_UP_A10_NRESP 1 +#define CMD_POWER_UP_A10_NARGS 5 + +#define CMD_POWER_UP_A20_NRESP 1 +#define CMD_POWER_UP_A20_NARGS 5 + +#define POWER_UP_DELAY_MS 110 + +#define CMD_POWER_DOWN 0x11 +#define CMD_POWER_DOWN_A10_NRESP 1 + +#define CMD_POWER_DOWN_A20_NRESP 1 +#define CMD_POWER_DOWN_A20_NARGS 1 + +#define CMD_FUNC_INFO 0x12 +#define CMD_FUNC_INFO_NRESP7 + +#define CMD_SET_PROPERTY 0x13 +#define CMD_SET_PROPERTY_NARGS 5 +#define CMD_SET_PROPERTY_NRESP 1 + +#define CMD_GET_PROPERTY 0x14 +#define CMD_GET_PROPERTY_NARGS 3 +#define CMD_GET_PROPERTY_NRESP 4 + +#define CMD_AGC_STATUS 0x17 +#define CMD_AGC_STATUS_NRESP_A10 2 +#define CMD_AGC_STATUS_NRESP_A206 + +#define PIN_CFG_BYTE(x) (0x7F (x)) +#define CMD_DIG_AUDIO_PIN_CFG 0x18 +#define CMD_DIG_AUDIO_PIN_CFG_NARGS4 +#define CMD_DIG_AUDIO_PIN_CFG_NRESP5 + +#define CMD_ZIF_PIN_CFG0x19 +#define CMD_ZIF_PIN_CFG_NARGS 4 +#define CMD_ZIF_PIN_CFG_NRESP 5 + +#define CMD_IC_LINK_GPO_CTL_PIN_CFG0x1A +#define CMD_IC_LINK_GPO_CTL_PIN_CFG_NARGS 4 +#define CMD_IC_LINK_GPO_CTL_PIN_CFG_NRESP 5 + +#define CMD_ANA_AUDIO_PIN_CFG 0x1B +#define CMD_ANA_AUDIO_PIN_CFG_NARGS1 +#define CMD_ANA_AUDIO_PIN_CFG_NRESP2 + +#define CMD_INTB_PIN_CFG 0x1C +#define CMD_INTB_PIN_CFG_NARGS 2 +#define CMD_INTB_PIN_CFG_A10_NRESP 6 +#define CMD_INTB_PIN_CFG_A20_NRESP 3 + +#define CMD_FM_TUNE_FREQ 0x30 +#define CMD_FM_TUNE_FREQ_A10_NARGS 5 +#define CMD_FM_TUNE_FREQ_A20_NARGS 3 +#define CMD_FM_TUNE_FREQ_NRESP 1 + +#define CMD_FM_RSQ_STATUS 0x32 + +#define CMD_FM_RSQ_STATUS_A10_NARGS1 +#define CMD_FM_RSQ_STATUS_A10_NRESP17 +#define CMD_FM_RSQ_STATUS_A30_NARGS1 +#define CMD_FM_RSQ_STATUS_A30_NRESP23 + + +#define CMD_FM_SEEK_START 0x31 +#define CMD_FM_SEEK_START_NARGS1 +#define CMD_FM_SEEK_START_NRESP1 + +#define CMD_FM_RDS_STATUS 0x36 +#define CMD_FM_RDS_STATUS_NARGS1 +#define CMD_FM_RDS_STATUS_NRESP16 + +#define CMD_FM_RDS_BLOCKCOUNT 0x37 +#define CMD_FM_RDS_BLOCKCOUNT_NARGS1 +#define CMD_FM_RDS_BLOCKCOUNT_NRESP8 + +#define CMD_FM_PHASE_DIVERSITY 0x38 +#define CMD_FM_PHASE_DIVERSITY_NARGS 1 +#define CMD_FM_PHASE_DIVERSITY_NRESP 1 + +#define CMD_FM_PHASE_DIV_STATUS0x39 +#define CMD_FM_PHASE_DIV_STATUS_NRESP 2 + +#define CMD_AM_TUNE_FREQ 0x40 +#define CMD_AM_TUNE_FREQ_NARGS 3 +#define CMD_AM_TUNE_FREQ_NRESP
Re: [PATCH v9 00/12] Driver for Si476x series of chips
Em Thu, 18 Apr 2013 09:58:26 -0700 Andrey Smirnov andrew.smir...@gmail.com escreveu: Driver for Si476x series of chips This is a eight version of the patchset originaly posted here: https://lkml.org/lkml/2012/9/13/590 Second version of the patch was posted here: https://lkml.org/lkml/2012/10/5/598 Third version of the patch was posted here: https://lkml.org/lkml/2012/10/23/510 Fourth version of the patch was posted here: https://lkml.org/lkml/2013/2/18/572 Fifth version of the patch was posted here: https://lkml.org/lkml/2013/2/26/45 Sixth version of the patch was posted here: https://lkml.org/lkml/2013/2/26/257 Seventh version of the patch was posted here: https://lkml.org/lkml/2013/2/27/22 Eighth version of the patch was posted here: https://lkml.org/lkml/2013/3/26/891 To save everyone's time I'll repost the original description of it: This patchset contains a driver for a Silicon Laboratories 476x series of radio tuners. The driver itself is implemented as an MFD devices comprised of three parts: 1. Core device that provides all the other devices with basic functionality and locking scheme. 2. Radio device that translates between V4L2 subsystem requests into Core device commands. 3. Codec device that does similar to the earlier described task, but for ALSA SoC subsystem. v9 of this driver has following changes: - MFD part of the driver no longer depends on the header file added by the radio driver(media/si476x.h) which should potential restore the bisectability of the patches Mauro, I am not sure if you reverted changes in patches 5 - 7, so I am including them just in case. No, I didn't revert all patches. I just reverted two patches: the last one, and the one that Samuel asked me. Please rebase the remaining drivers/media patch(es) on the top of my tree, or on the top of linux-next. Regards, Mauro Hans, some of the patches you gave your ACK to were changed, but since the only thing changed is the location of the original code(it was rearranged into different files) I did not remove your ACKs from the new commits. I hope you don't mind, but if you do, let me know and I'll post an updated version of the patchset so it would be clear that it is not ready to be merged. Please note, taht patch #12 is the modified version of https://patchwork-mail.kernel.org/patch/2420751/ It _was not_ ACKEd by anyone. Samuel, I couldn't just move media/si476x.h to mfd patches because it would also break bisectability since media/si476x.h depends on patch #8 in this patchset(whcih is the change that should go through 'media' tree) But I rearranged definitions and there shouldn't be any dependencies on media patches in MFD part. Andrey Smirnov (10): mfd: Add commands abstraction layer for SI476X MFD mfd: Add the main bulk of core driver for SI476x code mfd: Add chip properties handling code for SI476X MFD mfd: Add header files and Kbuild plumbing for SI476x MFD core v4l2: Fix the type of V4L2_CID_TUNE_PREEMPHASIS in the documentation v4l2: Add standard controls for FM receivers v4l2: Add documentation for the FM RX controls v4l2: Add private controls base for SI476X v4l2: Add a V4L2 driver for SI476X MFD radio-si476x: Fix incorrect pointer checking Hans Verkuil (1): si476x: Fix some config dependencies and a compile warnings Mauro Carvalho Chehab (1): radio-si476x: vidioc_s* now uses a const parameter Documentation/DocBook/media/v4l/compat.xml |3 + Documentation/DocBook/media/v4l/controls.xml | 74 +- .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml |9 + Documentation/video4linux/si476x.txt | 187 +++ drivers/media/radio/Kconfig| 17 + drivers/media/radio/Makefile |1 + drivers/media/radio/radio-si476x.c | 1575 drivers/media/v4l2-core/v4l2-ctrls.c | 14 +- drivers/mfd/Kconfig| 13 + drivers/mfd/Makefile |4 + drivers/mfd/si476x-cmd.c | 1553 +++ drivers/mfd/si476x-i2c.c | 886 +++ drivers/mfd/si476x-prop.c | 242 +++ include/linux/mfd/si476x-core.h| 533 +++ include/linux/mfd/si476x-platform.h| 267 include/linux/mfd/si476x-reports.h | 163 ++ include/media/si476x.h | 37 + include/uapi/linux/v4l2-controls.h | 17 + 18 files changed, 5591 insertions(+), 4 deletions(-) create mode 100644 Documentation/video4linux/si476x.txt create mode 100644 drivers/media/radio/radio-si476x.c create mode 100644 drivers/mfd/si476x-cmd.c create mode 100644 drivers/mfd/si476x-i2c.c create mode 100644 drivers/mfd/si476x-prop.c create mode
[RFC v2] video: ARM CLCD: Add DT CDF support
This patch adds basic DT bindings for the PL11x CLCD cells and make their fbdev driver use them, together with the Common Display Framework. The DT provides information about the hardware configuration and limitations (eg. the largest supported resolution) but the video modes come exclusively from the Common Display Framework drivers, referenced to by the standard CDF binding. Signed-off-by: Pawel Moll pawel.m...@arm.com --- .../devicetree/bindings/video/arm,pl11x.txt| 35 +++ drivers/video/Kconfig |1 + drivers/video/amba-clcd.c | 247 include/linux/amba/clcd.h |2 + 4 files changed, 285 insertions(+) create mode 100644 Documentation/devicetree/bindings/video/arm,pl11x.txt diff --git a/Documentation/devicetree/bindings/video/arm,pl11x.txt b/Documentation/devicetree/bindings/video/arm,pl11x.txt new file mode 100644 index 000..ee9534a --- /dev/null +++ b/Documentation/devicetree/bindings/video/arm,pl11x.txt @@ -0,0 +1,35 @@ +* ARM PrimeCell Color LCD Controller (CLCD) PL110/PL111 + +Required properties: + +- compatible : must be one of: + arm,pl110, arm,primecell + arm,pl111, arm,primecell +- reg : base address and size of the control registers block +- interrupts : the combined interrupt +- clocks : phandles to the CLCD (pixel) clock and the APB clocks +- clock-names : clcdclk, apb_pclk +- display : phandle to the display entity connected to the controller + +Optional properties: + +- label : string describing the controller location and/or usage +- video-ram : phandle to DT node of the specialized video RAM to be used +- max-hactive : maximum frame buffer width in pixels +- max-vactive : maximum frame buffer height in pixels +- max-bpp : maximum number of bits per pixel +- big-endian-pixels : defining this property makes the pixel bytes being + accessed in Big Endian organization + +Example: + + clcd@1f { + compatible = arm,pl111, arm,primecell; + reg = 0x1f 0x1000; + interrupts = 14; + clocks = v2m_oscclk1, smbclk; + clock-names = clcdclk, apb_pclk; + label = IOFPGA CLCD; + video-ram = v2m_vram; + display = v2m_muxfpga; + }; diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 281e548..bad8166 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -340,6 +340,7 @@ config FB_ARMCLCD select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_MODE_HELPERS if OF help This framebuffer device driver is for the ARM PrimeCell PL110 Colour LCD controller. ARM PrimeCells provide the building diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c index 0a2cce7..853f74c 100644 --- a/drivers/video/amba-clcd.c +++ b/drivers/video/amba-clcd.c @@ -25,6 +25,11 @@ #include linux/amba/clcd.h #include linux/clk.h #include linux/hardirq.h +#include linux/dma-mapping.h +#include linux/of.h +#include linux/of_address.h +#include video/display.h +#include video/videomode.h #include asm/sizes.h @@ -62,6 +67,10 @@ static void clcdfb_disable(struct clcd_fb *fb) { u32 val; + if (fb-panel-display) + display_entity_set_state(fb-panel-display, + DISPLAY_ENTITY_STATE_OFF); + if (fb-board-disable) fb-board-disable(fb); @@ -115,6 +124,11 @@ static void clcdfb_enable(struct clcd_fb *fb, u32 cntl) */ if (fb-board-enable) fb-board-enable(fb); + + if (fb-panel-display) + display_entity_set_state(fb-panel-display, + DISPLAY_ENTITY_STATE_ON); + } static int @@ -304,6 +318,13 @@ static int clcdfb_set_par(struct fb_info *info) clcdfb_enable(fb, regs.cntl); + if (fb-panel-display) { + struct videomode mode; + + videomode_from_fb_var_screeninfo(fb-fb.var, mode); + display_entity_update(fb-panel-display, mode); + } + #ifdef DEBUG printk(KERN_INFO CLCD: Registers set to\n @@ -542,6 +563,229 @@ static int clcdfb_register(struct clcd_fb *fb) return ret; } +#if defined(CONFIG_OF) +static int clcdfb_of_get_tft_parallel_panel(struct clcd_panel *panel, + struct display_entity_interface_params *params) +{ + int r = params-p.tft_parallel.r_bits; + int g = params-p.tft_parallel.g_bits; + int b = params-p.tft_parallel.b_bits; + + /* Bypass pixel clock divider, data output on the falling edge */ + panel-tim2 = TIM2_BCD | TIM2_IPC; + + /*
Re: [PATCH v2 2/3] mutex: add support for reservation style locks, v2
On Wed, Apr 17, 2013 at 09:08:17PM +0200, Daniel Vetter wrote: On Wed, Apr 10, 2013 at 12:28 AM, Steven Rostedt rost...@goodmis.org wrote: On Thu, Apr 04, 2013 at 06:41:02PM +0200, Peter Zijlstra wrote: On Thu, 2013-04-04 at 15:31 +0200, Daniel Vetter wrote: The thing is now that you're not expected to hold these locks for a long time - if you need to synchronously stall while holding a lock performance will go down the gutters anyway. And since most current gpus/co-processors still can't really preempt fairness isn't that high a priority, either. So we didn't think too much about that. Yeah but you're proposing a new synchronization primitive for the core kernel.. all such 'fun' details need to be considered, not only those few that bear on the one usecase. Which bares the question, what other use cases are there? Just stumbled over one I think: If we have a big graph of connected things (happens really often for video pipelines). And we want multiple users to use them in parallel. But sometimes a configuration change could take way too long and so would unduly stall a 2nd thread with just a global mutex, then per-object ww_mutexes would be a fit: You'd start with grabbing all the locks for the objects you want to change anything with, then grab anything in the graph that you also need to check. Thanks to loop detection and self-recursion this would all nicely work out, even for cyclic graphs of objects. Indeed, that would make the locking for atomic modeset/page flip very easy to handle, while still allowing the use of suitable fine grained locks. I like the idea. -- Ville Syrjälä Intel OTC -- 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 00/31] Add r820t support at rtl28xxu
In article 516df31a.3030...@iki.fi you write: Tested-by: Antti Palosaari cr...@iki.fi Tested-by: Juergen Lock n...@jelal.kn-bremen.de On 04/17/2013 03:42 AM, Mauro Carvalho Chehab wrote: Add a tuner driver for Rafael Micro R820T silicon tuner. This tuner seems to be popular those days. Add support for it at rtl28xxu. This tuner was written from scratch, based on rtl-sdr driver. Mauro Carvalho Chehab (31): [media] r820t: Add a tuner driver for Rafael Micro R820T silicon tuner [media] rtl28xxu: add support for Rafael Micro r820t [media] r820t: Give a better estimation of the signal strength [media] r820t: Set gain mode to auto [media] rtl28xxu: use r820t to obtain the signal strength [media] r820t: proper lock and set the I2C gate [media] rtl820t: Add a debug msg when PLL gets locked [media] r820t: Fix IF scale [media] rtl2832: add code to bind r820t on it [media] r820t: use the right IF for the selected TV standard [media] rtl2832: properly set en_bbin for r820t [media] r820t: Invert bits for read ops [media] r820t: use the second table for 7MHz [media] r820t: Show the read data in the bit-reversed order [media] r820t: add support for diplexer [media] r820t: better report signal strength [media] r820t: split the function that read cached regs [media] r820t: fix prefix of the r820t_read() function [media] r820t: use usleep_range() [media] r820t: proper initialize the PLL register [media] r820t: add IMR calibrate code [media] r820t: add a commented code for GPIO [media] r820t: Allow disabling IMR callibration [media] r820t: avoid rewrite all regs when not needed [media] r820t: Don't put it in standby if not initialized yet [media] r820t: fix PLL calculus [media] r820t: Fix hp_cor filter mask [media] r820t: put it into automatic gain mode [media] rtl2832: Fix IF calculus [media] r820t: disable auto gain/VGA setting [media] r820t: Don't divide the IF by two drivers/media/dvb-frontends/rtl2832.c | 85 +- drivers/media/dvb-frontends/rtl2832.h |1 + drivers/media/dvb-frontends/rtl2832_priv.h | 28 + drivers/media/tuners/Kconfig |7 + drivers/media/tuners/Makefile |1 + drivers/media/tuners/r820t.c | 2352 drivers/media/tuners/r820t.h | 58 + drivers/media/usb/dvb-usb-v2/Kconfig |1 + drivers/media/usb/dvb-usb-v2/rtl28xxu.c| 34 + drivers/media/usb/dvb-usb-v2/rtl28xxu.h|1 + 10 files changed, 2548 insertions(+), 20 deletions(-) create mode 100644 drivers/media/tuners/r820t.c create mode 100644 drivers/media/tuners/r820t.h -- http://palosaari.fi/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
cron job: media_tree daily build: ERRORS
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: Thu Apr 18 19:00:21 CEST 2013 git branch: test git hash: 6695be6863b75620ffa6d422965680ce785cb7c8 gcc version:i686-linux-gcc (GCC) 4.7.2 host hardware: x86_64 host os:3.8-3.slh.2-amd64 linux-git-arm-davinci: OK linux-git-arm-exynos: WARNINGS linux-git-arm-omap: WARNINGS linux-git-blackfin: WARNINGS linux-git-i686: OK linux-git-m32r: OK linux-git-mips: OK linux-git-powerpc64: OK linux-git-sh: OK linux-git-x86_64: OK linux-2.6.31.14-i686: ERRORS linux-2.6.32.27-i686: ERRORS linux-2.6.33.7-i686: ERRORS linux-2.6.34.7-i686: ERRORS linux-2.6.35.9-i686: ERRORS linux-2.6.36.4-i686: ERRORS linux-2.6.37.6-i686: ERRORS linux-2.6.38.8-i686: ERRORS linux-2.6.39.4-i686: ERRORS linux-3.0.60-i686: ERRORS linux-3.1.10-i686: ERRORS linux-3.2.37-i686: ERRORS linux-3.3.8-i686: ERRORS linux-3.4.27-i686: ERRORS linux-3.5.7-i686: WARNINGS linux-3.6.11-i686: WARNINGS linux-3.7.4-i686: WARNINGS linux-3.8-i686: OK linux-3.9-rc1-i686: OK linux-2.6.31.14-x86_64: ERRORS linux-2.6.32.27-x86_64: ERRORS linux-2.6.33.7-x86_64: ERRORS linux-2.6.34.7-x86_64: ERRORS linux-2.6.35.9-x86_64: ERRORS linux-2.6.36.4-x86_64: ERRORS linux-2.6.37.6-x86_64: ERRORS linux-2.6.38.8-x86_64: ERRORS linux-2.6.39.4-x86_64: ERRORS linux-3.0.60-x86_64: ERRORS linux-3.1.10-x86_64: ERRORS linux-3.2.37-x86_64: ERRORS linux-3.3.8-x86_64: ERRORS linux-3.4.27-x86_64: ERRORS linux-3.5.7-x86_64: WARNINGS linux-3.6.11-x86_64: WARNINGS linux-3.7.4-x86_64: WARNINGS linux-3.8-x86_64: OK linux-3.9-rc1-x86_64: OK apps: WARNINGS spec-git: OK sparse: ERRORS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Thursday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Thursday.tar.bz2 The Media Infrastructure API from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/media.html -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v9 00/12] Driver for Si476x series of chips
On Thu, Apr 18, 2013 at 02:28:00PM -0300, Mauro Carvalho Chehab wrote: Em Thu, 18 Apr 2013 09:58:26 -0700 Andrey Smirnov andrew.smir...@gmail.com escreveu: Driver for Si476x series of chips This is a eight version of the patchset originaly posted here: https://lkml.org/lkml/2012/9/13/590 Second version of the patch was posted here: https://lkml.org/lkml/2012/10/5/598 Third version of the patch was posted here: https://lkml.org/lkml/2012/10/23/510 Fourth version of the patch was posted here: https://lkml.org/lkml/2013/2/18/572 Fifth version of the patch was posted here: https://lkml.org/lkml/2013/2/26/45 Sixth version of the patch was posted here: https://lkml.org/lkml/2013/2/26/257 Seventh version of the patch was posted here: https://lkml.org/lkml/2013/2/27/22 Eighth version of the patch was posted here: https://lkml.org/lkml/2013/3/26/891 To save everyone's time I'll repost the original description of it: This patchset contains a driver for a Silicon Laboratories 476x series of radio tuners. The driver itself is implemented as an MFD devices comprised of three parts: 1. Core device that provides all the other devices with basic functionality and locking scheme. 2. Radio device that translates between V4L2 subsystem requests into Core device commands. 3. Codec device that does similar to the earlier described task, but for ALSA SoC subsystem. v9 of this driver has following changes: - MFD part of the driver no longer depends on the header file added by the radio driver(media/si476x.h) which should potential restore the bisectability of the patches Mauro, I am not sure if you reverted changes in patches 5 - 7, so I am including them just in case. No, I didn't revert all patches. I just reverted two patches: the last one, and the one that Samuel asked me. Sorry I didn't have time to check your email from yesterday, but I was actually hoping you would revert the whole patchset, then pull from my mfd-next/topic/si476x branch to fetch the MFD bits and then apply the v4l2/media ones (From patchset v9) on top of that. Does that make sense to you ? Cheers, Samuel. -- Intel Open Source Technology Centre http://oss.intel.com/ -- 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 12/12] radio-si476x: Fix incorrect pointer checking
On Thu, Apr 18, 2013 at 09:58:38AM -0700, Andrey Smirnov wrote: Fix incorrect pointer checking and make some minor code improvements: * Remove unnecessary elements from function pointer table(vtable), that includes all the elements that are FM-only, this allows for not checking of the fucntion pointer and calling of the function directly(THe check if the tuner is in FM mode has to be done anyway) * Fix incorrect function pointer checking where the code would check one pointer to be non-NULL, but would use other pointer, which would not be checked. * Remove code duplication in si476x_radio_read_rsq_blob and si476x_radio_read_rsq_primary_blob. * Add some BUG_ON statements for function pointers that should never be NULL Signed-off-by: Andrey Smirnov andrew.smir...@gmail.com Signed-off-by: Dan Carpenter dan.carpen...@oracle.com This should be a Reported-by for me, probably. regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 11/12] si476x: Fix some config dependencies and a compile warnings
On Thu, Apr 18, 2013 at 09:58:37AM -0700, Andrey Smirnov wrote: From: Hans Verkuil hverk...@xs4all.nl radio-si476x depends on SND and SND_SOC, the mfd driver should select REGMAP_I2C. Also fix a small compile warning in a debug message: drivers/mfd/si476x-i2c.c: In function ‘si476x_core_drain_rds_fifo’: drivers/mfd/si476x-i2c.c:391:4: warning: field width specifier ‘*’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat] Acked-by: Andrey Smirnov andrew.smir...@gmail.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/radio/Kconfig |2 +- drivers/mfd/Kconfig |1 + drivers/mfd/si476x-i2c.c|2 +- You should have merged the MFD bits from this patch into one of the first 4 patches, that are MFD related. Or at least separated those 2 changes into 2 patches... Cheers, Samuel. -- Intel Open Source Technology Centre http://oss.intel.com/ -- 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 v9 00/12] Driver for Si476x series of chips
Em Thu, 18 Apr 2013 19:45:47 +0200 Samuel Ortiz sa...@linux.intel.com escreveu: On Thu, Apr 18, 2013 at 02:28:00PM -0300, Mauro Carvalho Chehab wrote: Em Thu, 18 Apr 2013 09:58:26 -0700 Andrey Smirnov andrew.smir...@gmail.com escreveu: Driver for Si476x series of chips This is a eight version of the patchset originaly posted here: https://lkml.org/lkml/2012/9/13/590 Second version of the patch was posted here: https://lkml.org/lkml/2012/10/5/598 Third version of the patch was posted here: https://lkml.org/lkml/2012/10/23/510 Fourth version of the patch was posted here: https://lkml.org/lkml/2013/2/18/572 Fifth version of the patch was posted here: https://lkml.org/lkml/2013/2/26/45 Sixth version of the patch was posted here: https://lkml.org/lkml/2013/2/26/257 Seventh version of the patch was posted here: https://lkml.org/lkml/2013/2/27/22 Eighth version of the patch was posted here: https://lkml.org/lkml/2013/3/26/891 To save everyone's time I'll repost the original description of it: This patchset contains a driver for a Silicon Laboratories 476x series of radio tuners. The driver itself is implemented as an MFD devices comprised of three parts: 1. Core device that provides all the other devices with basic functionality and locking scheme. 2. Radio device that translates between V4L2 subsystem requests into Core device commands. 3. Codec device that does similar to the earlier described task, but for ALSA SoC subsystem. v9 of this driver has following changes: - MFD part of the driver no longer depends on the header file added by the radio driver(media/si476x.h) which should potential restore the bisectability of the patches Mauro, I am not sure if you reverted changes in patches 5 - 7, so I am including them just in case. No, I didn't revert all patches. I just reverted two patches: the last one, and the one that Samuel asked me. Sorry I didn't have time to check your email from yesterday, but I was actually hoping you would revert the whole patchset, then pull from my mfd-next/topic/si476x branch to fetch the MFD bits and then apply the v4l2/media ones (From patchset v9) on top of that. Does that make sense to you ? I don't rebase my tree, as this would cause troubles for everybody that relies on it. Reverting the entire patchset is hard, as there are lots of patches after them, and some patches touch at V4L2 core. Even reverting those two patches hit conflicts, that I needed to manage, in order to avoid compilation breakages. So, I really prefer to confine the patch reversion to the absolute minimum. -- Cheers, 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 v9 00/12] Driver for Si476x series of chips
On Thu, Apr 18, 2013 at 02:57:53PM -0300, Mauro Carvalho Chehab wrote: Em Thu, 18 Apr 2013 19:45:47 +0200 Samuel Ortiz sa...@linux.intel.com escreveu: On Thu, Apr 18, 2013 at 02:28:00PM -0300, Mauro Carvalho Chehab wrote: Em Thu, 18 Apr 2013 09:58:26 -0700 Andrey Smirnov andrew.smir...@gmail.com escreveu: Driver for Si476x series of chips This is a eight version of the patchset originaly posted here: https://lkml.org/lkml/2012/9/13/590 Second version of the patch was posted here: https://lkml.org/lkml/2012/10/5/598 Third version of the patch was posted here: https://lkml.org/lkml/2012/10/23/510 Fourth version of the patch was posted here: https://lkml.org/lkml/2013/2/18/572 Fifth version of the patch was posted here: https://lkml.org/lkml/2013/2/26/45 Sixth version of the patch was posted here: https://lkml.org/lkml/2013/2/26/257 Seventh version of the patch was posted here: https://lkml.org/lkml/2013/2/27/22 Eighth version of the patch was posted here: https://lkml.org/lkml/2013/3/26/891 To save everyone's time I'll repost the original description of it: This patchset contains a driver for a Silicon Laboratories 476x series of radio tuners. The driver itself is implemented as an MFD devices comprised of three parts: 1. Core device that provides all the other devices with basic functionality and locking scheme. 2. Radio device that translates between V4L2 subsystem requests into Core device commands. 3. Codec device that does similar to the earlier described task, but for ALSA SoC subsystem. v9 of this driver has following changes: - MFD part of the driver no longer depends on the header file added by the radio driver(media/si476x.h) which should potential restore the bisectability of the patches Mauro, I am not sure if you reverted changes in patches 5 - 7, so I am including them just in case. No, I didn't revert all patches. I just reverted two patches: the last one, and the one that Samuel asked me. Sorry I didn't have time to check your email from yesterday, but I was actually hoping you would revert the whole patchset, then pull from my mfd-next/topic/si476x branch to fetch the MFD bits and then apply the v4l2/media ones (From patchset v9) on top of that. Does that make sense to you ? I don't rebase my tree, as this would cause troubles for everybody that relies on it. Reverting the entire patchset is hard, as there are lots of patches after them, and some patches touch at V4L2 core. Even reverting those two patches hit conflicts, that I needed to manage, in order to avoid compilation breakages. So, I really prefer to confine the patch reversion to the absolute minimum. In that case we're left with only one solution: Leave your tree as it is (with both patches reverted) and push the mfd/Kconfig and mfd/Makefile changes as a 3.10 fix. radio/radio-si476x.c should not build without the MFD Kconfig symbol so we should be safe. The radio/radio-si476x.c Kconfig dependency is not correct btw, I'll send you a patch for that. This is an ugly solution, but the only one I can think about. I would have appreciated some sync before you merged this jumbo patch, especially since the bulk of it is an MFD driver. Cheers, Samuel. -- Intel Open Source Technology Centre http://oss.intel.com/ -- 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 v9 00/12] Driver for Si476x series of chips
On Thu, Apr 18, 2013 at 08:17:18PM +0200, Samuel Ortiz wrote: On Thu, Apr 18, 2013 at 02:57:53PM -0300, Mauro Carvalho Chehab wrote: Em Thu, 18 Apr 2013 19:45:47 +0200 Samuel Ortiz sa...@linux.intel.com escreveu: On Thu, Apr 18, 2013 at 02:28:00PM -0300, Mauro Carvalho Chehab wrote: Em Thu, 18 Apr 2013 09:58:26 -0700 Andrey Smirnov andrew.smir...@gmail.com escreveu: Driver for Si476x series of chips This is a eight version of the patchset originaly posted here: https://lkml.org/lkml/2012/9/13/590 Second version of the patch was posted here: https://lkml.org/lkml/2012/10/5/598 Third version of the patch was posted here: https://lkml.org/lkml/2012/10/23/510 Fourth version of the patch was posted here: https://lkml.org/lkml/2013/2/18/572 Fifth version of the patch was posted here: https://lkml.org/lkml/2013/2/26/45 Sixth version of the patch was posted here: https://lkml.org/lkml/2013/2/26/257 Seventh version of the patch was posted here: https://lkml.org/lkml/2013/2/27/22 Eighth version of the patch was posted here: https://lkml.org/lkml/2013/3/26/891 To save everyone's time I'll repost the original description of it: This patchset contains a driver for a Silicon Laboratories 476x series of radio tuners. The driver itself is implemented as an MFD devices comprised of three parts: 1. Core device that provides all the other devices with basic functionality and locking scheme. 2. Radio device that translates between V4L2 subsystem requests into Core device commands. 3. Codec device that does similar to the earlier described task, but for ALSA SoC subsystem. v9 of this driver has following changes: - MFD part of the driver no longer depends on the header file added by the radio driver(media/si476x.h) which should potential restore the bisectability of the patches Mauro, I am not sure if you reverted changes in patches 5 - 7, so I am including them just in case. No, I didn't revert all patches. I just reverted two patches: the last one, and the one that Samuel asked me. Sorry I didn't have time to check your email from yesterday, but I was actually hoping you would revert the whole patchset, then pull from my mfd-next/topic/si476x branch to fetch the MFD bits and then apply the v4l2/media ones (From patchset v9) on top of that. Does that make sense to you ? I don't rebase my tree, as this would cause troubles for everybody that relies on it. Reverting the entire patchset is hard, as there are lots of patches after them, and some patches touch at V4L2 core. Even reverting those two patches hit conflicts, that I needed to manage, in order to avoid compilation breakages. So, I really prefer to confine the patch reversion to the absolute minimum. In that case we're left with only one solution: Leave your tree as it is (with both patches reverted) and push the mfd/Kconfig and mfd/Makefile changes as a 3.10 fix. radio/radio-si476x.c should not build without the MFD Kconfig symbol so we should be safe. You reverted that one, I think this was not needed as it would not build without the MFD symbol. Any other reason why you reverted it ? Cheers, Samuel. -- Intel Open Source Technology Centre http://oss.intel.com/ -- 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] r820t: precendence bug in r820t_xtal_check()
The test as written is always false. It looks like the intent was to test that the bit was not set. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c index 905a106..ba033fd 100644 --- a/drivers/media/tuners/r820t.c +++ b/drivers/media/tuners/r820t.c @@ -1378,7 +1378,7 @@ static int r820t_xtal_check(struct r820t_priv *priv) rc = r820t_read(priv, 0x00, data, sizeof(data)); if (rc 0) return rc; - if ((!data[2]) 0x40) + if (!(data[2] 0x40)) continue; val = data[2] 0x3f; -- 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] r820t: memory leak in release()
I've moved the kfree(fe-tuner_priv) one line earlier, otherwise it is a no-op. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- This is a static checker fix and I have not tested it. diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c index ba033fd..36ddbf1 100644 --- a/drivers/media/tuners/r820t.c +++ b/drivers/media/tuners/r820t.c @@ -2252,9 +2252,8 @@ static int r820t_release(struct dvb_frontend *fe) mutex_unlock(r820t_list_mutex); - fe-tuner_priv = NULL; - kfree(fe-tuner_priv); + fe-tuner_priv = NULL; return 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
Re: [PATCH RFC] [media] blackfin: add video display driver
Hi Scott, On 04/17/2013 08:57 AM, Scott Jiang wrote: Hi Sylwester , @@ -9,7 +9,18 @@ config VIDEO_BLACKFIN_CAPTURE To compile this driver as a module, choose M here: the module will be called bfin_capture. +config VIDEO_BLACKFIN_DISPLAY + tristate Blackfin Video Display Driver + depends on VIDEO_V4L2 BLACKFIN I2C + select VIDEOBUF2_DMA_CONTIG + help + V4L2 bridge driver for Blackfin video display device. Shouldn't it just be V4L2 output driver, why are you calling it bridge ? Hmm, capture-display, input-output, right? Yes, input/output from user space POV. The kernel docs called it bridge, may host sounds better. I suggested output as referring to the V4L2 output interface [1]. I guess bridge/host could just be skipped and we could simply put it as: V4L2 driver for Blackfin video display (E)PPI interface. +/* + * Analog Devices video display driver Sounds a bit too generic. + * + * Copyright (c) 2011 Analog Devices Inc. 2011 - 2013 ? Written in 2011. Since you're still actively working on it I would say it makes sense to put it as 2011 - 2013. At least this is what most people do AFAICS. But I don't really mind, it's up to you! +struct disp_fh { + struct v4l2_fh fh; + /* indicates whether this file handle is doing IO */ + bool io_allowed; +}; This structure should not be needed when you use the vb2 helpers. Please see below for more details. The only question is how the core deal with the permission that which file handle can stream off the output. I want to impose a rule that only IO handle can stop IO. I refer to priority, but current kernel driver export this to user space and let user decide it. As far as I can see there would be no change in behaviour if you used the helpers. For instance, vidioc_streamon/streamoff ioctls /* From videobuf2-core.c */ /* The queue is busy if there is a owner and you are not that owner. */ static inline bool vb2_queue_is_busy(struct video_device *vdev, struct file *file) { return vdev-queue-owner vdev-queue-owner != file-private_data; } /* vb2 ioctl helpers */ int vb2_ioctl_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *p) { struct video_device *vdev = video_devdata(file); int res = __verify_memory_type(vdev-queue, p-memory, p-type); if (res) return res; if (vb2_queue_is_busy(vdev, file)) return -EBUSY; res = __reqbufs(vdev-queue, p); /* If count == 0, then the owner has released all buffers and he is no longer owner of the queue. Otherwise we have a new owner. */ if (res == 0) vdev-queue-owner = p-count ? file-private_data : NULL; return res; } int vb2_ioctl_streamon(struct file *file, void *priv, enum v4l2_buf_type i) { struct video_device *vdev = video_devdata(file); if (vb2_queue_is_busy(vdev, file)) return -EBUSY; return vb2_streamon(vdev-queue, i); } int vb2_ioctl_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) { struct video_device *vdev = video_devdata(file); if (vb2_queue_is_busy(vdev, file)) return -EBUSY; return vb2_streamoff(vdev-queue, i); } And in your code: +static int disp_reqbufs(struct file *file, void *priv, + struct v4l2_requestbuffers *req_buf) +{ + struct disp_device *disp = video_drvdata(file); + struct vb2_queue *vq = disp-buffer_queue; + struct v4l2_fh *fh = file-private_data; + struct disp_fh *disp_fh = container_of(fh, struct disp_fh, fh); + + if (vb2_is_busy(vq)) + return -EBUSY; + + disp_fh-io_allowed = true; + + return vb2_reqbufs(vq, req_buf); +} +static int disp_streamon(struct file *file, void *priv, + enum v4l2_buf_type buf_type) +{ + struct disp_device *disp = video_drvdata(file); + struct disp_fh *fh = file-private_data; + struct ppi_if *ppi = disp-ppi; + dma_addr_t addr; + int ret; + + if (!fh-io_allowed) + return -EBUSY; + + /* call streamon to start streaming in videobuf */ + ret = vb2_streamon(disp-buffer_queue, buf_type); + if (ret) + return ret; + ... +} +static int disp_streamoff(struct file *file, void *priv, + enum v4l2_buf_type buf_type) +{ + struct disp_device *disp = video_drvdata(file); + struct disp_fh *fh = file-private_data; + + if (!fh-io_allowed) + return -EBUSY; + + return vb2_streamoff(disp-buffer_queue, buf_type); +} Please note that you really should be setting io_allowed to true only if vb2_reqbufs() succeeds. Hence I wouldn't hesitate to use the core implementation. This way we get more consistent behaviour across all drivers, which is in line with
[PATCH 02/24] imx074: fix error handling for failed async subdevice registration
If v4l2_async_register_subdev() fails, don't skip the clean up. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/i2c/soc_camera/imx074.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/media/i2c/soc_camera/imx074.c b/drivers/media/i2c/soc_camera/imx074.c index c0eed84..23de859 100644 --- a/drivers/media/i2c/soc_camera/imx074.c +++ b/drivers/media/i2c/soc_camera/imx074.c @@ -472,7 +472,9 @@ static int imx074_probe(struct i2c_client *client, if (ret 0) goto eprobe; - return v4l2_async_register_subdev(priv-subdev); + ret = v4l2_async_register_subdev(priv-subdev); + if (!ret) + return 0; epwrinit: eprobe: -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 03/24] mt9t031: fix NULL dereference during probe()
When .s_power() is called during probing, the video device isn't available yet. Fix Oops, caused by dereferencing it. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/i2c/soc_camera/mt9t031.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/soc_camera/mt9t031.c b/drivers/media/i2c/soc_camera/mt9t031.c index ea791e3..e7f0a08 100644 --- a/drivers/media/i2c/soc_camera/mt9t031.c +++ b/drivers/media/i2c/soc_camera/mt9t031.c @@ -619,9 +619,12 @@ static int mt9t031_s_power(struct v4l2_subdev *sd, int on) ret = soc_camera_power_on(client-dev, ssdd, mt9t031-clk); if (ret 0) return ret; - vdev-dev.type = mt9t031_dev_type; + if (vdev) + /* Skip during probing, when vdev isn't available yet */ + vdev-dev.type = mt9t031_dev_type; } else { - vdev-dev.type = NULL; + if (vdev) + vdev-dev.type = NULL; soc_camera_power_off(client-dev, ssdd, mt9t031-clk); } -- 1.7.2.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 22/24] V4L2: soc-camera: use the pad-operation wrapper
This patch adds support for the pad-operation wrapper to soc-camera, which allows pure pad-level subdevice drivers, e.g. mt9p031 to be used with soc-camera. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/platform/soc_camera/soc_camera.c | 19 +-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index 3113287..dfd1741 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -36,6 +36,7 @@ #include media/v4l2-common.h #include media/v4l2-ioctl.h #include media/v4l2-dev.h +#include media/v4l2-pad-wrap.h #include media/videobuf-core.h #include media/videobuf2-core.h @@ -62,7 +63,9 @@ struct soc_camera_async_client { struct v4l2_async_subdev *sensor; struct v4l2_async_notifier notifier; struct platform_device *pdev; - struct list_head list; /* needed for clean up */ + /* needed for clean up */ + struct list_head list; + struct v4l2_subdev *subdev; }; static int soc_camera_video_start(struct soc_camera_device *icd); @@ -1301,10 +1304,14 @@ static int soc_camera_probe_finish(struct soc_camera_device *icd) if (ret 0) return ret; + ret = v4l2_subdev_pad_wrap(sd); + if (ret 0 ret != -ENOSYS) + return ret; + ret = soc_camera_add_device(icd); if (ret 0) { dev_err(icd-pdev, Couldn't activate the camera: %d\n, ret); - return ret; + goto eadddev; } /* At this point client .probe() should have run already */ @@ -1329,6 +1336,8 @@ static int soc_camera_probe_finish(struct soc_camera_device *icd) return 0; +eadddev: + v4l2_subdev_pad_unwrap(sd); evidstart: soc_camera_free_user_formats(icd); eusrfmt: @@ -1693,6 +1702,8 @@ static int soc_camera_remove(struct soc_camera_device *icd) { struct soc_camera_desc *sdesc = to_soc_camera_desc(icd); struct video_device *vdev = icd-vdev; + struct v4l2_subdev *sd = icd-sasc ? icd-sasc-subdev : + soc_camera_to_subdev(icd); v4l2_ctrl_handler_free(icd-ctrl_handler); if (vdev) { @@ -1700,6 +1711,9 @@ static int soc_camera_remove(struct soc_camera_device *icd) icd-vdev = NULL; } + /* Before cleaning up the sensor subdevice */ + v4l2_subdev_pad_unwrap(sd); + if (sdesc-host_desc.board_info) { soc_camera_i2c_free(icd); } else { @@ -1867,6 +1881,7 @@ void soc_camera_host_unregister(struct soc_camera_host *ici) /* as long as we hold the device, sasc won't be freed */ get_device(icd-pdev); list_add(icd-sasc-list, notifiers); + icd-sasc-subdev = soc_camera_to_subdev(icd); } mutex_unlock(list_lock); -- 1.7.2.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 19/24] V4L2: add struct v4l2_subdev_try_buf
This patch adds struct v4l2_subdev_try_buf, used as a temporary buffer for try pad configuration data. Defining such a struct will simplify memory allocation for such buffers. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- include/media/v4l2-subdev.h | 12 +++- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index b15c6e0..4424a7c 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -618,14 +618,16 @@ static inline struct v4l2_subdev *v4l2_async_to_subdev( /* * Used for storing subdev information per file handle */ +struct v4l2_subdev_try_buf { + struct v4l2_mbus_framefmt try_fmt; + struct v4l2_rect try_crop; + struct v4l2_rect try_compose; +}; + struct v4l2_subdev_fh { struct v4l2_fh vfh; #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) - struct { - struct v4l2_mbus_framefmt try_fmt; - struct v4l2_rect try_crop; - struct v4l2_rect try_compose; - } *pad; + struct v4l2_subdev_try_buf *pad; #endif }; -- 1.7.2.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 15/24] mx3-camera: support asynchronous subdevice registration
To support asynchronous subdevice registration we only have to pass a subdevice descriptor array from driver platform data to soc-camera for camera host driver registration. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/platform/soc_camera/mx3_camera.c |6 ++ include/linux/platform_data/camera-mx3.h |3 +++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/drivers/media/platform/soc_camera/mx3_camera.c b/drivers/media/platform/soc_camera/mx3_camera.c index 94203f6..75215bc 100644 --- a/drivers/media/platform/soc_camera/mx3_camera.c +++ b/drivers/media/platform/soc_camera/mx3_camera.c @@ -19,6 +19,7 @@ #include linux/sched.h #include linux/dma/ipu-dma.h +#include media/v4l2-async.h #include media/v4l2-common.h #include media/v4l2-dev.h #include media/videobuf2-dma-contig.h @@ -1224,6 +1225,11 @@ static int mx3_camera_probe(struct platform_device *pdev) goto eallocctx; } + if (pdata-asd_sizes) { + soc_host-asd = pdata-asd; + soc_host-asd_sizes = pdata-asd_sizes; + } + err = soc_camera_host_register(soc_host); if (err) goto ecamhostreg; diff --git a/include/linux/platform_data/camera-mx3.h b/include/linux/platform_data/camera-mx3.h index f226ee3..96f0f78 100644 --- a/include/linux/platform_data/camera-mx3.h +++ b/include/linux/platform_data/camera-mx3.h @@ -33,6 +33,7 @@ #define MX3_CAMERA_DATAWIDTH_MASK (MX3_CAMERA_DATAWIDTH_4 | MX3_CAMERA_DATAWIDTH_8 | \ MX3_CAMERA_DATAWIDTH_10 | MX3_CAMERA_DATAWIDTH_15) +struct v4l2_async_subdev; /** * struct mx3_camera_pdata - i.MX3x camera platform data * @flags: MX3_CAMERA_* flags @@ -43,6 +44,8 @@ struct mx3_camera_pdata { unsigned long flags; unsigned long mclk_10khz; struct device *dma_dev; + struct v4l2_async_subdev **asd; /* Flat array, arranged in groups */ + int *asd_sizes; /* 0-terminated array pf asd group sizes */ }; #endif -- 1.7.2.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 08/24] ARM: update all soc-camera users to new platform data layout
This patch moves almost all ARM soc-camera users towards re-using subdevice drivers. Only mach-shmobile/board-mackerel.c will be updated separately, together with other soc-camera-platform users. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- arch/arm/mach-at91/board-sam9m10g45ek.c| 19 ++ arch/arm/mach-imx/mach-imx27_visstrim_m10.c| 17 ++--- arch/arm/mach-imx/mach-mx27_3ds.c | 21 +++ arch/arm/mach-imx/mach-mx31_3ds.c | 23 arch/arm/mach-imx/mach-mx35_3ds.c | 12 --- arch/arm/mach-imx/mach-pcm037.c| 28 ++- arch/arm/mach-imx/mx31moboard-marxbot.c| 17 ++--- arch/arm/mach-imx/mx31moboard-smartbot.c | 17 ++--- arch/arm/mach-omap1/board-ams-delta.c | 17 ++--- arch/arm/mach-pxa/em-x270.c| 15 +--- arch/arm/mach-pxa/ezx.c| 36 --- arch/arm/mach-pxa/mioa701.c| 11 -- arch/arm/mach-pxa/palmz72.c| 21 +++ arch/arm/mach-pxa/pcm990-baseboard.c | 44 ++- arch/arm/mach-shmobile/board-ap4evb.c |5 ++- arch/arm/mach-shmobile/board-armadillo800eva.c | 17 ++--- 16 files changed, 205 insertions(+), 115 deletions(-) diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c index 2a94896..8c768dd 100644 --- a/arch/arm/mach-at91/board-sam9m10g45ek.c +++ b/arch/arm/mach-at91/board-sam9m10g45ek.c @@ -200,7 +200,7 @@ static struct isi_platform_data __initdata isi_data = { */ #if defined(CONFIG_SOC_CAMERA_OV2640) || \ defined(CONFIG_SOC_CAMERA_OV2640_MODULE) -static unsigned long isi_camera_query_bus_param(struct soc_camera_link *link) +static unsigned long isi_camera_query_bus_param(struct soc_camera_subdev_desc *desc) { /* ISI board for ek using default 8-bits connection */ return SOCAM_DATAWIDTH_8; @@ -229,12 +229,17 @@ static struct i2c_board_info i2c_camera = { I2C_BOARD_INFO(ov2640, 0x30), }; -static struct soc_camera_link iclink_ov2640 = { - .bus_id = 0, - .board_info = i2c_camera, - .i2c_adapter_id = 0, - .power = i2c_camera_power, - .query_bus_param= isi_camera_query_bus_param, +static struct soc_camera_desc iclink_ov2640 = { + .subdev_desc= { + .sd_pdata.host_priv = iclink_ov2640, + .power = i2c_camera_power, + .query_bus_param= isi_camera_query_bus_param, + }, + .host_desc = { + .bus_id = 0, + .board_info = i2c_camera, + .i2c_adapter_id = 0, + }, }; static struct platform_device isi_ov2640 = { diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c index 29ac8ee6..686138c 100644 --- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c +++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c @@ -224,12 +224,17 @@ static struct i2c_board_info visstrim_i2c_camera = { I2C_BOARD_INFO(tvp5150, 0x5d), }; -static struct soc_camera_link iclink_tvp5150 = { - .bus_id = 0, - .board_info = visstrim_i2c_camera, - .i2c_adapter_id = 0, - .power = visstrim_camera_power, - .reset = visstrim_camera_reset, +static struct soc_camera_desc iclink_tvp5150 = { + .subdev_desc= { + .sd_pdata.host_priv = iclink_tvp5150, + .power = visstrim_camera_power, + .reset = visstrim_camera_reset, + }, + .host_desc = { + .bus_id = 0, + .board_info = visstrim_i2c_camera, + .i2c_adapter_id = 0, + }, }; static struct mx2_camera_platform_data visstrim_camera = { diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c index 25b3e4c..2c7d7e8 100644 --- a/arch/arm/mach-imx/mach-mx27_3ds.c +++ b/arch/arm/mach-imx/mach-mx27_3ds.c @@ -397,13 +397,20 @@ static struct regulator_bulk_data mx27_3ds_camera_regs[] = { { .supply = cmos_2v8 }, }; -static struct soc_camera_link iclink_ov2640 = { - .bus_id = 0, - .board_info = mx27_3ds_i2c_camera, - .i2c_adapter_id = 0, - .power = mx27_3ds_camera_power, - .regulators = mx27_3ds_camera_regs, - .num_regulators = ARRAY_SIZE(mx27_3ds_camera_regs), +static struct soc_camera_desc iclink_ov2640 = { + .subdev_desc= { + .power = mx27_3ds_camera_power, + .sd_pdata = { + .regulators = mx27_3ds_camera_regs, + .num_regulators =
[PATCH 12/24] V4L2: soc-camera: retrieve subdevice platform data from struct v4l2_subdev
Instead of expecting subdevice drivers to have a standard type as their platform data, use the new .pdata member of struct v4l2_subdev. This allows the use of arbitrary subdevice drivers with soc-camera in asynchronous mode. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/i2c/soc_camera/imx074.c |1 + drivers/media/platform/soc_camera/soc_camera.c | 10 -- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/soc_camera/imx074.c b/drivers/media/i2c/soc_camera/imx074.c index 23de859..321496a 100644 --- a/drivers/media/i2c/soc_camera/imx074.c +++ b/drivers/media/i2c/soc_camera/imx074.c @@ -457,6 +457,7 @@ static int imx074_probe(struct i2c_client *client, priv-fmt = imx074_colour_fmts[0]; priv-subdev.dev = client-dev; + priv-subdev.pdata = ssdd-sd_pdata; priv-clk = v4l2_clk_get(client-dev, mclk); if (IS_ERR(priv-clk)) { diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index c06e660..3113287 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -1363,6 +1363,11 @@ static int soc_camera_i2c_init(struct soc_camera_device *icd, return -ENODEV; } + /* +* Only soc-camera originated subdevice drivers can be used in +* synchronous mode. They all use struct soc_camera_subdev_desc for +* platform data. +*/ shd-board_info-platform_data = sdesc-subdev_desc; snprintf(clk_name, sizeof(clk_name), %d-%04x, @@ -1438,8 +1443,9 @@ static int soc_camera_async_bound(struct v4l2_async_notifier *notifier, */ if (client) { struct soc_camera_desc *sdesc = to_soc_camera_desc(icd); - struct soc_camera_subdev_desc *ssdd = - soc_camera_i2c_to_desc(client); + struct v4l2_subdev_platform_data *sd_pdata = sd-sd_pdata; + struct soc_camera_subdev_desc *ssdd = sd_pdata ? + sd_pdata-host_priv : NULL; if (ssdd) { memcpy(sdesc-subdev_desc, ssdd, sizeof(sdesc-subdev_desc)); -- 1.7.2.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 13/24] ARM: pcm037: convert custom GPIO-based power function to a regulator
Add a fixed-voltage GPIO-enabled regulator to switch the camera on and off instead of using a .power() platform callback. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- arch/arm/mach-imx/mach-pcm037.c | 54 --- 1 files changed, 39 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-imx/mach-pcm037.c b/arch/arm/mach-imx/mach-pcm037.c index ef55ac1..f138481 100644 --- a/arch/arm/mach-imx/mach-pcm037.c +++ b/arch/arm/mach-imx/mach-pcm037.c @@ -288,12 +288,39 @@ static struct at24_platform_data board_eeprom = { .flags = AT24_FLAG_ADDR16, }; -static int pcm037_camera_power(struct device *dev, int on) -{ - /* disable or enable the camera in X7 or X8 PCM970 connector */ - gpio_set_value(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), !on); - return 0; -} +/* Fixed 3.3V regulator to be used by cameras */ +static struct regulator_consumer_supply vcc_cam_consumers[] = { + REGULATOR_SUPPLY(vcc, 2-005d), +}; + +static struct regulator_init_data vcc_cam_init_data = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = ARRAY_SIZE(vcc_cam_consumers), + .consumer_supplies = vcc_cam_consumers, +}; + +static struct fixed_voltage_config vcc_cam_info = { + .supply_name = Camera Vcc, + .microvolts = 280, + .gpio = IOMUX_TO_GPIO(MX31_PIN_CSI_D5), + .init_data = vcc_cam_init_data, +}; + +static struct platform_device vcc_cam = { + .name = reg-fixed-voltage, + .id = 1, + .dev = { + .platform_data = vcc_cam_info, + }, +}; + +static struct regulator_bulk_data cam_supply[] = { + { + .supply = vcc, + }, +}; static struct i2c_board_info pcm037_i2c_camera[] = { { @@ -314,8 +341,11 @@ static struct soc_camera_desc iclink_mt9v022 = { static struct soc_camera_desc iclink_mt9t031 = { .subdev_desc= { - .sd_pdata.host_priv = iclink_mt9t031, - .power = pcm037_camera_power, + .sd_pdata = { + .num_regulators = ARRAY_SIZE(cam_supply), + .regulators = cam_supply, + .host_priv = iclink_mt9t031, + }, }, .host_desc = { .bus_id = 0,/* Must match with the camera ID */ @@ -445,6 +475,7 @@ err: static struct platform_device *devices[] __initdata = { pcm037_flash, pcm037_sram_device, + vcc_cam, pcm037_mt9t031, pcm037_mt9v022, }; @@ -656,13 +687,6 @@ static void __init pcm037_init(void) imx31_add_mx3_sdc_fb(mx3fb_pdata); /* CSI */ - /* Camera power: default - off */ - ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), mt9t031-power); - if (!ret) - gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CSI_D5), 1); - else - iclink_mt9t031.subdev_desc.power = NULL; - pcm037_init_camera(); pcm970_sja1000_resources[1].start = -- 1.7.2.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 10/24] soc-camera: update soc-camera-platform its users to a new platform data layout
This patch completes removal of struct soc_camera_link by all platforms. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- arch/arm/mach-shmobile/board-mackerel.c | 23 ++-- arch/sh/boards/mach-ap325rxa/setup.c| 43 +++--- include/media/soc_camera_platform.h |8 + 3 files changed, 43 insertions(+), 31 deletions(-) diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index db968a5..d6a88f8 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -1181,12 +1181,17 @@ static struct soc_camera_platform_info camera_info = { .set_capture = camera_set_capture, }; -static struct soc_camera_link camera_link = { - .bus_id = 0, - .add_device = mackerel_camera_add, - .del_device = mackerel_camera_del, - .module_name= soc_camera_platform, - .priv = camera_info, +static struct soc_camera_desc camera_link = { + .subdev_desc= { + .sd_pdata.host_priv = camera_link, + .drv_priv = camera_info, + }, + .host_desc = { + .bus_id = 0, + .add_device = mackerel_camera_add, + .del_device = mackerel_camera_del, + .module_name= soc_camera_platform, + }, }; static struct platform_device *camera_device; @@ -1198,13 +1203,13 @@ static void mackerel_camera_release(struct device *dev) static int mackerel_camera_add(struct soc_camera_device *icd) { - return soc_camera_platform_add(icd, camera_device, camera_link, - mackerel_camera_release, 0); + return soc_camera_platform_add(icd, camera_device, + camera_link.subdev_desc, mackerel_camera_release, 0); } static void mackerel_camera_del(struct soc_camera_device *icd) { - soc_camera_platform_del(icd, camera_device, camera_link); + soc_camera_platform_del(icd, camera_device, camera_link.subdev_desc); } static struct sh_mobile_ceu_info sh_mobile_ceu_info = { diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c index 5620e33..4a1be94 100644 --- a/arch/sh/boards/mach-ap325rxa/setup.c +++ b/arch/sh/boards/mach-ap325rxa/setup.c @@ -351,12 +351,17 @@ static struct soc_camera_platform_info camera_info = { .set_capture = camera_set_capture, }; -static struct soc_camera_link camera_link = { - .bus_id = 0, - .add_device = ap325rxa_camera_add, - .del_device = ap325rxa_camera_del, - .module_name= soc_camera_platform, - .priv = camera_info, +static struct soc_camera_desc camera_link = { + .subdev_desc= { + .sd_pdata.host_priv = camera_link, + .drv_priv = camera_info, + }, + .host_desc = { + .bus_id = 0, + .module_name= soc_camera_platform, + .add_device = ap325rxa_camera_add, + .del_device = ap325rxa_camera_del, + }, }; static struct platform_device *camera_device; @@ -368,21 +373,22 @@ static void ap325rxa_camera_release(struct device *dev) static int ap325rxa_camera_add(struct soc_camera_device *icd) { - int ret = soc_camera_platform_add(icd, camera_device, camera_link, - ap325rxa_camera_release, 0); + int ret = soc_camera_platform_add(icd, camera_device, + camera_link.subdev_desc, ap325rxa_camera_release, 0); if (ret 0) return ret; ret = camera_probe(); if (ret 0) - soc_camera_platform_del(icd, camera_device, camera_link); + soc_camera_platform_del(icd, camera_device, + camera_link.subdev_desc); return ret; } static void ap325rxa_camera_del(struct soc_camera_device *icd) { - soc_camera_platform_del(icd, camera_device, camera_link); + soc_camera_platform_del(icd, camera_device, camera_link.subdev_desc); } #endif /* CONFIG_I2C */ @@ -505,12 +511,17 @@ static struct ov772x_camera_info ov7725_info = { .edgectrl = OV772X_AUTO_EDGECTRL(0xf, 0), }; -static struct soc_camera_link ov7725_link = { - .bus_id = 0, - .power = ov7725_power, - .board_info = ap325rxa_i2c_camera[0], - .i2c_adapter_id = 0, - .priv = ov7725_info, +static struct soc_camera_desc ov7725_link = { + .subdev_desc= { + .sd_pdata.host_priv = ov7725_link, + .power = ov7725_power, + .drv_priv = ov7725_info, + }, + .host_desc = { + .bus_id = 0, + .board_info = ap325rxa_i2c_camera[0], + .i2c_adapter_id = 0, +
[PATCH 18/24] V4L2: mt9p031: power down the sensor if no supported device has been detected
The mt9p031 driver first accesses the I2C device in its .registered() method. While doing that it furst powers the device up, but if probing fails, it doesn't power the chip back down. This patch fixes that bug. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/i2c/mt9p031.c | 10 ++ 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c index eb2de22..70f4525 100644 --- a/drivers/media/i2c/mt9p031.c +++ b/drivers/media/i2c/mt9p031.c @@ -844,7 +844,7 @@ static int mt9p031_registered(struct v4l2_subdev *subdev) ret = mt9p031_power_on(mt9p031); if (ret 0) { dev_err(client-dev, MT9P031 power up failed\n); - return ret; + goto done; } /* Read out the chip version register */ @@ -852,13 +852,15 @@ static int mt9p031_registered(struct v4l2_subdev *subdev) if (data != MT9P031_CHIP_VERSION_VALUE) { dev_err(client-dev, MT9P031 not detected, wrong version 0x%04x\n, data); - return -ENODEV; + ret = -ENODEV; } +done: mt9p031_power_off(mt9p031); - dev_info(client-dev, MT9P031 detected at address 0x%02x\n, -client-addr); + if (!ret) + dev_info(client-dev, MT9P031 detected at address 0x%02x\n, +client-addr); return ret; } -- 1.7.2.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 21/24] V4L2: add a subdevice-driver pad-operation wrapper
Some subdevice drivers implement only the pad-level API, making them unusable with V4L2 camera host drivers, using the plain subdevice video API. This patch implements a wrapper to allow those two types of drivers to be used together. So far only a subset of operations is supported, the rest shall be added as needed. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/v4l2-core/Makefile|3 + drivers/media/v4l2-core/v4l2-pad-wrap.c | 329 +++ include/media/v4l2-pad-wrap.h | 23 +++ include/media/v4l2-subdev.h |2 + 4 files changed, 357 insertions(+), 0 deletions(-) create mode 100644 drivers/media/v4l2-core/v4l2-pad-wrap.c create mode 100644 include/media/v4l2-pad-wrap.h diff --git a/drivers/media/v4l2-core/Makefile b/drivers/media/v4l2-core/Makefile index 4c33b8d6..85dda29 100644 --- a/drivers/media/v4l2-core/Makefile +++ b/drivers/media/v4l2-core/Makefile @@ -13,6 +13,9 @@ endif ifeq ($(CONFIG_OF),y) videodev-objs += v4l2-of.o endif +ifeq ($(CONFIG_VIDEO_V4L2_SUBDEV_API),y) + videodev-objs += v4l2-pad-wrap.o +endif obj-$(CONFIG_VIDEO_V4L2) += videodev.o obj-$(CONFIG_VIDEO_V4L2_INT_DEVICE) += v4l2-int-device.o diff --git a/drivers/media/v4l2-core/v4l2-pad-wrap.c b/drivers/media/v4l2-core/v4l2-pad-wrap.c new file mode 100644 index 000..f45a5e7 --- /dev/null +++ b/drivers/media/v4l2-core/v4l2-pad-wrap.c @@ -0,0 +1,329 @@ +/* + * V4L2 pad operation wrapper for pure subdevice bridge drivers + * + * Copyright (C) 2013, Guennadi Liakhovetski g.liakhovet...@gmx.de + * + * 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 linux/module.h +#include linux/slab.h +#include media/v4l2-subdev.h + +struct v4l2_subdev_pad_wrapper { + struct v4l2_subdev_ops sd_ops; + struct v4l2_subdev_video_opsvideo; + struct v4l2_subdev_fh fh; + u32 pad; + const struct v4l2_subdev_ops*ops_orig; + booltouched; + struct v4l2_subdev_try_buf try[]; +}; + +/* + * It seems some subdev drivers, implementing the pad-level API, expect their + * pad devnode(s) to be opened at least once before any their operations can be + * called. This initialiser emulates such an open() / close() cycle. + */ +static int wrap_init_once(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_wrapper *wrap) +{ + int ret; + + if (wrap-touched) + return 0; + + ret = sd-internal_ops-open(sd, wrap-fh); + if (ret 0) + return ret; + + wrap-touched = true; + + return sd-internal_ops-close(sd, wrap-fh); +} + +static int wrap_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) +{ + struct v4l2_subdev_pad_wrapper *wrap = container_of(sd-ops, + struct v4l2_subdev_pad_wrapper, sd_ops); + struct v4l2_subdev_selection sel = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .pad = wrap-pad, + .target = V4L2_SEL_TGT_CROP_BOUNDS, + .flags = V4L2_SEL_FLAG_KEEP_CONFIG, + }; + struct v4l2_rect rect; + int ret = wrap_init_once(sd, wrap); + if (ret 0) + return ret; + + ret = sd-ops-pad-get_selection(sd, wrap-fh, sel); + if (ret 0) + return ret; + + rect = sel.r; + + sel.target = V4L2_SEL_TGT_CROP_DEFAULT; + + ret = sd-ops-pad-get_selection(sd, wrap-fh, sel); + if (ret 0) + return ret; + + a-bounds = rect; + a-defrect = sel.r; + a-pixelaspect.numerator = 1; + a-pixelaspect.denominator = 1; + + return 0; +} + +static int wrap_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) +{ + struct v4l2_subdev_pad_wrapper *wrap = container_of(sd-ops, + struct v4l2_subdev_pad_wrapper, sd_ops); + struct v4l2_subdev_crop crop = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .pad = wrap-pad, + }; + int ret = wrap_init_once(sd, wrap); + if (ret 0) + return ret; + + ret = sd-ops-pad-get_crop(sd, wrap-fh, crop); + if (ret 0) + return ret; + + a-c = crop.rect; + + return 0; +} + +static int wrap_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) +{ + struct v4l2_subdev_pad_wrapper *wrap = container_of(sd-ops, + struct v4l2_subdev_pad_wrapper, sd_ops); + struct v4l2_subdev_crop crop = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .pad = wrap-pad, + .rect = a-c, + }; + int ret = wrap_init_once(sd, wrap); + if (ret 0) + return ret; + + return
[PATCH 20/24] V4L2: add a subdev pointer to struct v4l2_subdev_fh
This is useful for cases, when there's no video-device associated with a V4L2 file-handle, e.g. in case of a dummy file-handle. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/v4l2-core/v4l2-subdev.c |1 + include/media/v4l2-subdev.h |4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 996c248..ec9f0d8 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -34,6 +34,7 @@ static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd) { + fh-subdev = sd; #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) fh-pad = kzalloc(sizeof(*fh-pad) * sd-entity.num_pads, GFP_KERNEL); if (fh-pad == NULL) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 4424a7c..0581781 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -626,6 +626,7 @@ struct v4l2_subdev_try_buf { struct v4l2_subdev_fh { struct v4l2_fh vfh; + struct v4l2_subdev *subdev; #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) struct v4l2_subdev_try_buf *pad; #endif @@ -640,8 +641,7 @@ struct v4l2_subdev_fh { v4l2_subdev_get_try_##fun_name(struct v4l2_subdev_fh *fh, \ unsigned int pad)\ { \ - BUG_ON(pad = vdev_to_v4l2_subdev( \ - fh-vfh.vdev)-entity.num_pads); \ + BUG_ON(pad = fh-subdev-entity.num_pads); \ return fh-pad[pad].field_name;\ } -- 1.7.2.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 17/24] V4L2: mt9p031: add support for .g_mbus_config() video operation
.g_mbus_config() subdevice video operation is required for subdevice drivers to be used with the soc-camera framework. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/i2c/mt9p031.c | 13 + 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c index 9ba38f5..eb2de22 100644 --- a/drivers/media/i2c/mt9p031.c +++ b/drivers/media/i2c/mt9p031.c @@ -390,6 +390,18 @@ static int mt9p031_set_params(struct mt9p031 *mt9p031) return ret; } +static int mt9p031_g_mbus_config(struct v4l2_subdev *sd, +struct v4l2_mbus_config *cfg) +{ + cfg-type = V4L2_MBUS_PARALLEL; + cfg-flags = V4L2_MBUS_MASTER | V4L2_MBUS_HSYNC_ACTIVE_HIGH | + V4L2_MBUS_VSYNC_ACTIVE_HIGH | + V4L2_MBUS_PCLK_SAMPLE_FALLING | + V4L2_MBUS_DATA_ACTIVE_HIGH; + + return 0; +} + static int mt9p031_s_stream(struct v4l2_subdev *subdev, int enable) { struct mt9p031 *mt9p031 = to_mt9p031(subdev); @@ -888,6 +900,7 @@ static struct v4l2_subdev_core_ops mt9p031_subdev_core_ops = { }; static struct v4l2_subdev_video_ops mt9p031_subdev_video_ops = { + .g_mbus_config = mt9p031_g_mbus_config, .s_stream = mt9p031_s_stream, }; -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/24] soc-camera: completely remove struct soc_camera_link
This updates the last user of struct soc_camera_link and finally removes it. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- Documentation/video4linux/soc-camera.txt |2 +- drivers/media/usb/em28xx/em28xx-camera.c | 12 +-- include/media/soc_camera.h | 48 -- 3 files changed, 9 insertions(+), 53 deletions(-) diff --git a/Documentation/video4linux/soc-camera.txt b/Documentation/video4linux/soc-camera.txt index f62fcdb..04da87a 100644 --- a/Documentation/video4linux/soc-camera.txt +++ b/Documentation/video4linux/soc-camera.txt @@ -85,7 +85,7 @@ respective V4L2 operations. Camera API -- -Sensor drivers can use struct soc_camera_link, typically provided by the +Sensor drivers can use struct soc_camera_desc, typically provided by the platform, and used to specify to which camera host bus the sensor is connected, and optionally provide platform .power and .reset methods for the camera. This struct is provided to the camera driver via the I2C client device platform data diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c index 73cc50a..365b601 100644 --- a/drivers/media/usb/em28xx/em28xx-camera.c +++ b/drivers/media/usb/em28xx/em28xx-camera.c @@ -43,10 +43,14 @@ static unsigned short omnivision_sensor_addrs[] = { }; -static struct soc_camera_link camlink = { - .bus_id = 0, - .flags = 0, - .module_name = em28xx, +static struct soc_camera_desc camlink = { + .subdev_desc= { + .flags = 0, + }, + .host_desc = { + .bus_id = 0, + .module_name = em28xx, + }, }; diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 1331278..a2a3b4f 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h @@ -190,54 +190,6 @@ struct soc_camera_desc { }; /* Prepare to replace this struct: don't change its layout any more! */ -struct soc_camera_link { - /* -* Subdevice part - keep at top and compatible to -* struct soc_camera_subdev_desc -*/ - - /* Per camera SOCAM_SENSOR_* bus flags */ - unsigned long flags; - - void *priv; - - /* Optional callbacks to power on or off and reset the sensor */ - int (*power)(struct device *, int); - int (*reset)(struct device *); - /* -* some platforms may support different data widths than the sensors -* native ones due to different data line routing. Let the board code -* overwrite the width flags. -*/ - int (*set_bus_param)(struct soc_camera_link *, unsigned long flags); - unsigned long (*query_bus_param)(struct soc_camera_link *); - void (*free_bus)(struct soc_camera_link *); - - /* Optional regulators that have to be managed on power on/off events */ - struct regulator_bulk_data *regulators; - int num_regulators; - - void *host_priv; - - /* -* Host part - keep at bottom and compatible to -* struct soc_camera_host_desc -*/ - - /* Camera bus id, used to match a camera and a bus */ - int bus_id; - int i2c_adapter_id; - struct i2c_board_info *board_info; - const char *module_name; - - /* -* For non-I2C devices platform has to provide methods to add a device -* to the system and to remove it -*/ - int (*add_device)(struct soc_camera_device *); - void (*del_device)(struct soc_camera_device *); -}; - static inline struct soc_camera_host *to_soc_camera_host( const struct device *dev) { -- 1.7.2.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 01/24] V4L2: (cosmetic) remove redundant use of unlikely()
BUG*() and WARN*() macros specify their conditions as unlikely, using BUG_ON(unlikely(condition)) is redundant, remove it. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- include/media/v4l2-subdev.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 21174af..eb91366 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -625,8 +625,8 @@ struct v4l2_subdev_fh { v4l2_subdev_get_try_##fun_name(struct v4l2_subdev_fh *fh, \ unsigned int pad)\ { \ - BUG_ON(unlikely(pad = vdev_to_v4l2_subdev( \ - fh-vfh.vdev)-entity.num_pads)); \ + BUG_ON(pad = vdev_to_v4l2_subdev( \ + fh-vfh.vdev)-entity.num_pads); \ return fh-pad[pad].field_name;\ } -- 1.7.2.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 16/24] V4L2: mt9p031: add support for V4L2 clock and asynchronous probing
This adds support for V4L2 clock and asynchronous subdevice probing. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/i2c/mt9p031.c | 31 +-- 1 files changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c index e328332..9ba38f5 100644 --- a/drivers/media/i2c/mt9p031.c +++ b/drivers/media/i2c/mt9p031.c @@ -23,7 +23,9 @@ #include linux/videodev2.h #include media/mt9p031.h +#include media/v4l2-async.h #include media/v4l2-chip-ident.h +#include media/v4l2-clk.h #include media/v4l2-ctrls.h #include media/v4l2-device.h #include media/v4l2-subdev.h @@ -117,6 +119,7 @@ struct mt9p031 { struct media_pad pad; struct v4l2_rect crop; /* Sensor window */ struct v4l2_mbus_framefmt format; + struct v4l2_clk *clk; struct mt9p031_platform_data *pdata; struct mutex power_lock; /* lock to protect power_count */ int power_count; @@ -258,6 +261,10 @@ static inline int mt9p031_pll_disable(struct mt9p031 *mt9p031) static int mt9p031_power_on(struct mt9p031 *mt9p031) { + int ret = v4l2_clk_enable(mt9p031-clk); + if (ret 0) + return ret; + /* Ensure RESET_BAR is low */ if (mt9p031-reset != -1) { gpio_set_value(mt9p031-reset, 0); @@ -287,6 +294,8 @@ static void mt9p031_power_off(struct mt9p031 *mt9p031) if (mt9p031-pdata-set_xclk) mt9p031-pdata-set_xclk(mt9p031-subdev, 0); + + v4l2_clk_disable(mt9p031-clk); } static int __mt9p031_set_power(struct mt9p031 *mt9p031, bool on) @@ -912,6 +921,7 @@ static int mt9p031_probe(struct i2c_client *client, { struct mt9p031_platform_data *pdata = client-dev.platform_data; struct i2c_adapter *adapter = to_i2c_adapter(client-dev.parent); + struct v4l2_clk *clk; struct mt9p031 *mt9p031; unsigned int i; int ret; @@ -927,11 +937,20 @@ static int mt9p031_probe(struct i2c_client *client, return -EIO; } + clk = v4l2_clk_get(client-dev, mclk); + if (IS_ERR(clk)) { + dev_info(client-dev, Error %ld getting clock\n, PTR_ERR(clk)); + return -EPROBE_DEFER; + } + mt9p031 = kzalloc(sizeof(*mt9p031), GFP_KERNEL); - if (mt9p031 == NULL) - return -ENOMEM; + if (mt9p031 == NULL) { + ret = -ENOMEM; + goto done; + } mt9p031-pdata = pdata; + mt9p031-clk = clk; mt9p031-output_control = MT9P031_OUTPUT_CONTROL_DEF; mt9p031-mode2 = MT9P031_READ_MODE_2_ROW_BLC; mt9p031-model = did-driver_data; @@ -1010,6 +1029,11 @@ static int mt9p031_probe(struct i2c_client *client, } ret = mt9p031_pll_setup(mt9p031); + if (ret 0) + goto done; + + mt9p031-subdev.dev = client-dev; + ret = v4l2_async_register_subdev(mt9p031-subdev); done: if (ret 0) { @@ -1019,6 +1043,7 @@ done: v4l2_ctrl_handler_free(mt9p031-ctrls); media_entity_cleanup(mt9p031-subdev.entity); kfree(mt9p031); + v4l2_clk_put(clk); } return ret; @@ -1029,11 +1054,13 @@ static int mt9p031_remove(struct i2c_client *client) struct v4l2_subdev *subdev = i2c_get_clientdata(client); struct mt9p031 *mt9p031 = to_mt9p031(subdev); + v4l2_async_unregister_subdev(subdev); v4l2_ctrl_handler_free(mt9p031-ctrls); v4l2_device_unregister_subdev(subdev); media_entity_cleanup(subdev-entity); if (mt9p031-reset != -1) gpio_free(mt9p031-reset); + v4l2_clk_put(mt9p031-clk); kfree(mt9p031); return 0; -- 1.7.2.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 23/24] V4L2: mt9p031: add struct v4l2_subdev_platform_data to platform data
Adding struct v4l2_subdev_platform_data to mt9p031's platform data allows the driver to use generic functions to manage sensor power supplies. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/i2c/mt9p031.c |1 + include/media/mt9p031.h |3 +++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c index 70f4525..ca2cc6e 100644 --- a/drivers/media/i2c/mt9p031.c +++ b/drivers/media/i2c/mt9p031.c @@ -1048,6 +1048,7 @@ static int mt9p031_probe(struct i2c_client *client, goto done; mt9p031-subdev.dev = client-dev; + mt9p031-subdev.pdata = pdata-sd_pdata; ret = v4l2_async_register_subdev(mt9p031-subdev); done: diff --git a/include/media/mt9p031.h b/include/media/mt9p031.h index 0c97b19..7bf7b53 100644 --- a/include/media/mt9p031.h +++ b/include/media/mt9p031.h @@ -1,6 +1,8 @@ #ifndef MT9P031_H #define MT9P031_H +#include media/v4l2-subdev.h + struct v4l2_subdev; /* @@ -15,6 +17,7 @@ struct mt9p031_platform_data { int reset; int ext_freq; int target_freq; + struct v4l2_subdev_platform_data sd_pdata; }; #endif -- 1.7.2.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 24/24] ARM: pcm037: support mt9p031 / mt9p006 camera sensors
We don't know how to support pluggable camera sensors yet. This is just an example, how support for an mt9p031 or mt9p006 camera sensor could be added to pcm037. not-Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- arch/arm/mach-imx/mach-pcm037.c | 44 +- 1 files changed, 42 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-imx/mach-pcm037.c b/arch/arm/mach-imx/mach-pcm037.c index f138481..18ba328 100644 --- a/arch/arm/mach-imx/mach-pcm037.c +++ b/arch/arm/mach-imx/mach-pcm037.c @@ -36,6 +36,7 @@ #include linux/regulator/fixed.h #include media/soc_camera.h +#include media/mt9p031.h #include asm/mach-types.h #include asm/mach/arch.h @@ -363,6 +364,22 @@ static struct i2c_board_info pcm037_i2c_devices[] = { } }; +static struct mt9p031_platform_data mt9p031_pdata = { + .target_freq = 2000, + .ext_freq = 2000, + .sd_pdata = { + .num_regulators = ARRAY_SIZE(cam_supply), + .regulators = cam_supply, + }, +}; + +static struct i2c_board_info pcm037_i2c2_devices[] = { + { + I2C_BOARD_INFO(mt9p031, 0x48), + .platform_data = mt9p031_pdata, + }, +}; + static struct platform_device pcm037_mt9t031 = { .name = soc-camera-pdrv, .id = 0, @@ -441,9 +458,30 @@ static const struct imxmmc_platform_data sdhc_pdata __initconst = { .exit = pcm970_sdhc1_exit, }; +static struct soc_camera_async_subdev mt9p006_sd = { + .asd.hw = { + .bus_type = V4L2_ASYNC_BUS_I2C, + .match.i2c = { + .adapter_id = 2, + .address = 0x48, + }, + }, + .role = SOCAM_SUBDEV_DATA_SOURCE, +}; + +static struct v4l2_async_subdev *cam_subdevs[] = { + /* Single 1-element group */ + mt9p006_sd.asd, +}; + +/* 0-terminated array of group-sizes */ +static int cam_subdev_sizes[] = {ARRAY_SIZE(cam_subdevs), 0}; + struct mx3_camera_pdata camera_pdata __initdata = { .flags = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10, .mclk_10khz = 2000, + .asd= cam_subdevs, + .asd_sizes = cam_subdev_sizes, }; static phys_addr_t mx3_camera_base __initdata; @@ -476,8 +514,8 @@ static struct platform_device *devices[] __initdata = { pcm037_flash, pcm037_sram_device, vcc_cam, - pcm037_mt9t031, - pcm037_mt9v022, +// pcm037_mt9t031, +// pcm037_mt9v022, }; static const struct fb_videomode fb_modedb[] = { @@ -677,6 +715,8 @@ static void __init pcm037_init(void) /* I2C adapters and devices */ i2c_register_board_info(1, pcm037_i2c_devices, ARRAY_SIZE(pcm037_i2c_devices)); + i2c_register_board_info(2, pcm037_i2c2_devices, + ARRAY_SIZE(pcm037_i2c2_devices)); imx31_add_imx_i2c1(pcm037_i2c1_data); imx31_add_imx_i2c2(pcm037_i2c2_data); -- 1.7.2.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 00/24] V4L2: subdevice pad-level API wrapper
This is the first very crude shot at the subdevice pad-level API wrapper. The actual wrapper is added in patch #21, previous 20 patches are preparation... They apply on top of the last version of my async / clock patch series, respectively, on top of the announced branch of my linuxtv git-tree. Patches 2 and 4 from this series should actually be merged into respective patches from the async series. I'm publishing this patch-series now, because I don't know when and how much time I'll have to improve it... Maybe you don't want to spend too much time reviewing implementation details, but comments to general concepts would be appreciated. Further note, that patches 8-12 aren't really required. We can keep the deprecated struct soc_camera_link for now, or use a more gentle and slow way to remove it. Guennadi Liakhovetski (24): V4L2: (cosmetic) remove redundant use of unlikely() imx074: fix error handling for failed async subdevice registration mt9t031: fix NULL dereference during probe() V4L2: fix Oops on rmmod path V4L2: allow dummy file-handle initialisation by v4l2_fh_init() V4L2: add a common V4L2 subdevice platform data type soc-camera: switch to using the new struct v4l2_subdev_platform_data ARM: update all soc-camera users to new platform data layout SH: update all soc-camera users to new platform data layout soc-camera: update soc-camera-platform its users to a new platform data layout soc-camera: completely remove struct soc_camera_link V4L2: soc-camera: retrieve subdevice platform data from struct v4l2_subdev ARM: pcm037: convert custom GPIO-based power function to a regulator mx3-camera: clean up the use of platform data, add driver owner mx3-camera: support asynchronous subdevice registration V4L2: mt9p031: add support for V4L2 clock and asynchronous probing V4L2: mt9p031: add support for .g_mbus_config() video operation V4L2: mt9p031: power down the sensor if no supported device has been detected V4L2: add struct v4l2_subdev_try_buf V4L2: add a subdev pointer to struct v4l2_subdev_fh V4L2: add a subdevice-driver pad-operation wrapper V4L2: soc-camera: use the pad-operation wrapper V4L2: mt9p031: add struct v4l2_subdev_platform_data to platform data ARM: pcm037: support mt9p031 / mt9p006 camera sensors Documentation/video4linux/soc-camera.txt |2 +- arch/arm/mach-at91/board-sam9m10g45ek.c| 19 +- arch/arm/mach-imx/mach-imx27_visstrim_m10.c| 17 +- arch/arm/mach-imx/mach-mx27_3ds.c | 21 +- arch/arm/mach-imx/mach-mx31_3ds.c | 23 +- arch/arm/mach-imx/mach-mx35_3ds.c | 12 +- arch/arm/mach-imx/mach-pcm037.c| 120 +++-- arch/arm/mach-imx/mx31moboard-marxbot.c| 17 +- arch/arm/mach-imx/mx31moboard-smartbot.c | 17 +- arch/arm/mach-omap1/board-ams-delta.c | 17 +- arch/arm/mach-pxa/em-x270.c| 15 +- arch/arm/mach-pxa/ezx.c| 36 ++- arch/arm/mach-pxa/mioa701.c| 11 +- arch/arm/mach-pxa/palmz72.c| 21 +- arch/arm/mach-pxa/pcm990-baseboard.c | 44 ++-- arch/arm/mach-shmobile/board-ap4evb.c |5 +- arch/arm/mach-shmobile/board-armadillo800eva.c | 17 +- arch/arm/mach-shmobile/board-mackerel.c| 23 +- arch/sh/boards/mach-ap325rxa/setup.c | 43 ++-- arch/sh/boards/mach-ecovec24/setup.c | 51 +++-- arch/sh/boards/mach-kfr2r09/setup.c| 15 +- arch/sh/boards/mach-migor/setup.c | 30 ++- drivers/media/i2c/mt9p031.c| 55 - drivers/media/i2c/soc_camera/imx074.c |5 +- drivers/media/i2c/soc_camera/mt9t031.c |7 +- drivers/media/platform/soc_camera/mx3_camera.c | 29 ++- drivers/media/platform/soc_camera/soc_camera.c | 49 +++- drivers/media/usb/em28xx/em28xx-camera.c | 12 +- drivers/media/v4l2-core/Makefile |3 + drivers/media/v4l2-core/v4l2-async.c | 18 +- drivers/media/v4l2-core/v4l2-fh.c |8 +- drivers/media/v4l2-core/v4l2-pad-wrap.c| 329 drivers/media/v4l2-core/v4l2-subdev.c |1 + include/linux/platform_data/camera-mx3.h |3 + include/media/mt9p031.h|3 + include/media/soc_camera.h | 53 + include/media/soc_camera_platform.h|8 +- include/media/v4l2-pad-wrap.h | 23 ++ include/media/v4l2-subdev.h| 31 ++- 39 files changed, 909 insertions(+), 304 deletions(-) create mode 100644 drivers/media/v4l2-core/v4l2-pad-wrap.c create mode 100644 include/media/v4l2-pad-wrap.h -- 1.7.2.5 Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line unsubscribe linux-media in
[PATCH 07/24] soc-camera: switch to using the new struct v4l2_subdev_platform_data
This prepares soc-camera to use struct v4l2_subdev_platform_data for its subdevice-facing API, which would allow subdevice driver re-use. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/platform/soc_camera/soc_camera.c | 20 ++-- include/media/soc_camera.h | 17 + 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index a790f81..c06e660 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -76,8 +76,8 @@ int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd, dev_err(dev, Cannot enable clock: %d\n, ret); return ret; } - ret = regulator_bulk_enable(ssdd-num_regulators, - ssdd-regulators); + ret = regulator_bulk_enable(ssdd-sd_pdata.num_regulators, + ssdd-sd_pdata.regulators); if (ret 0) { dev_err(dev, Cannot enable regulators\n); goto eregenable; @@ -95,8 +95,8 @@ int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd, return 0; epwron: - regulator_bulk_disable(ssdd-num_regulators, - ssdd-regulators); + regulator_bulk_disable(ssdd-sd_pdata.num_regulators, + ssdd-sd_pdata.regulators); eregenable: if (clk) v4l2_clk_disable(clk); @@ -120,8 +120,8 @@ int soc_camera_power_off(struct device *dev, struct soc_camera_subdev_desc *ssdd } } - err = regulator_bulk_disable(ssdd-num_regulators, -ssdd-regulators); + err = regulator_bulk_disable(ssdd-sd_pdata.num_regulators, +ssdd-sd_pdata.regulators); if (err 0) { dev_err(dev, Cannot disable regulators\n); ret = ret ? : err; @@ -137,8 +137,8 @@ EXPORT_SYMBOL(soc_camera_power_off); int soc_camera_power_init(struct device *dev, struct soc_camera_subdev_desc *ssdd) { - return devm_regulator_bulk_get(dev, ssdd-num_regulators, - ssdd-regulators); + return devm_regulator_bulk_get(dev, ssdd-sd_pdata.num_regulators, + ssdd-sd_pdata.regulators); } EXPORT_SYMBOL(soc_camera_power_init); @@ -2033,8 +2033,8 @@ static int soc_camera_pdrv_probe(struct platform_device *pdev) * in soc_camera_async_bind(). Also note, that in that case regulators * are attached to the I2C device and not to the camera platform device. */ - ret = devm_regulator_bulk_get(pdev-dev, ssdd-num_regulators, - ssdd-regulators); + ret = devm_regulator_bulk_get(pdev-dev, ssdd-sd_pdata.num_regulators, + ssdd-sd_pdata.regulators); if (ret 0) return ret; diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 2d3c939..1331278 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h @@ -146,10 +146,6 @@ struct soc_camera_subdev_desc { /* sensor driver private platform data */ void *drv_priv; - /* Optional regulators that have to be managed on power on/off events */ - struct regulator_bulk_data *regulators; - int num_regulators; - /* Optional callbacks to power on or off and reset the sensor */ int (*power)(struct device *, int); int (*reset)(struct device *); @@ -162,6 +158,9 @@ struct soc_camera_subdev_desc { int (*set_bus_param)(struct soc_camera_subdev_desc *, unsigned long flags); unsigned long (*query_bus_param)(struct soc_camera_subdev_desc *); void (*free_bus)(struct soc_camera_subdev_desc *); + + /* Optional regulators that have to be managed on power on/off events */ + struct v4l2_subdev_platform_data sd_pdata; }; struct soc_camera_host_desc { @@ -202,10 +201,6 @@ struct soc_camera_link { void *priv; - /* Optional regulators that have to be managed on power on/off events */ - struct regulator_bulk_data *regulators; - int num_regulators; - /* Optional callbacks to power on or off and reset the sensor */ int (*power)(struct device *, int); int (*reset)(struct device *); @@ -218,6 +213,12 @@ struct soc_camera_link { unsigned long (*query_bus_param)(struct soc_camera_link *); void (*free_bus)(struct soc_camera_link *); + /* Optional regulators that have to be managed on power on/off events */ + struct regulator_bulk_data *regulators; + int num_regulators; + + void *host_priv; + /* * Host part - keep at bottom and
[PATCH 09/24] SH: update all soc-camera users to new platform data layout
This patch moves almost all SH soc-camera users towards re-using subdevice drivers. Only mach-ap325rxa/setup.c will be updated separately, together with other soc-camera-platform users. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- arch/sh/boards/mach-ecovec24/setup.c | 51 ++ arch/sh/boards/mach-kfr2r09/setup.c | 15 ++--- arch/sh/boards/mach-migor/setup.c| 30 +-- 3 files changed, 63 insertions(+), 33 deletions(-) diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index aaff767..51e25e1 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -809,12 +809,17 @@ static struct tw9910_video_info tw9910_info = { .mpout = TW9910_MPO_FIELD, }; -static struct soc_camera_link tw9910_link = { - .i2c_adapter_id = 0, - .bus_id = 1, - .power = tw9910_power, - .board_info = i2c_camera[0], - .priv = tw9910_info, +static struct soc_camera_desc tw9910_link = { + .subdev_desc= { + .sd_pdata.host_priv = tw9910_link, + .power = tw9910_power, + .drv_priv = tw9910_info, + }, + .host_desc = { + .i2c_adapter_id = 0, + .bus_id = 1, + .board_info = i2c_camera[0], + }, }; /* mt9t112 */ @@ -832,12 +837,17 @@ static struct mt9t112_camera_info mt9t112_info1 = { .divider = { 0x49, 0x6, 0, 6, 0, 9, 9, 6, 0 }, /* for 24MHz */ }; -static struct soc_camera_link mt9t112_link1 = { - .i2c_adapter_id = 0, - .power = mt9t112_power1, - .bus_id = 0, - .board_info = i2c_camera[1], - .priv = mt9t112_info1, +static struct soc_camera_desc mt9t112_link1 = { + .subdev_desc= { + .sd_pdata.host_priv = mt9t112_link1, + .power = mt9t112_power1, + .drv_priv = mt9t112_info1, + }, + .host_desc = { + .i2c_adapter_id = 0, + .bus_id = 0, + .board_info = i2c_camera[1], + }, }; static int mt9t112_power2(struct device *dev, int mode) @@ -854,12 +864,17 @@ static struct mt9t112_camera_info mt9t112_info2 = { .divider = { 0x49, 0x6, 0, 6, 0, 9, 9, 6, 0 }, /* for 24MHz */ }; -static struct soc_camera_link mt9t112_link2 = { - .i2c_adapter_id = 1, - .power = mt9t112_power2, - .bus_id = 1, - .board_info = i2c_camera[2], - .priv = mt9t112_info2, +static struct soc_camera_desc mt9t112_link2 = { + .subdev_desc= { + .sd_pdata.host_priv = mt9t112_link2, + .power = mt9t112_power2, + .drv_priv = mt9t112_info2, + }, + .host_desc = { + .i2c_adapter_id = 1, + .bus_id = 1, + .board_info = i2c_camera[2], + }, }; static struct platform_device camera_devices[] = { diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c index ab502f12..5cb62c7 100644 --- a/arch/sh/boards/mach-kfr2r09/setup.c +++ b/arch/sh/boards/mach-kfr2r09/setup.c @@ -331,11 +331,16 @@ static struct rj54n1_pdata rj54n1_priv = { .ioctl_high = false, }; -static struct soc_camera_link rj54n1_link = { - .power = camera_power, - .board_info = kfr2r09_i2c_camera, - .i2c_adapter_id = 1, - .priv = rj54n1_priv, +static struct soc_camera_desc rj54n1_link = { + .subdev_desc= { + .sd_pdata.host_priv = rj54n1_link, + .power = camera_power, + .drv_priv = rj54n1_priv, + }, + .host_desc = { + .board_info = kfr2r09_i2c_camera, + .i2c_adapter_id = 1, + }, }; static struct platform_device kfr2r09_camera = { diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c index 8b73194e..5df19d7 100644 --- a/arch/sh/boards/mach-migor/setup.c +++ b/arch/sh/boards/mach-migor/setup.c @@ -447,11 +447,16 @@ static struct i2c_board_info migor_i2c_camera[] = { static struct ov772x_camera_info ov7725_info; -static struct soc_camera_link ov7725_link = { - .power = ov7725_power, - .board_info = migor_i2c_camera[0], - .i2c_adapter_id = 0, - .priv = ov7725_info, +static struct soc_camera_desc ov7725_link = { + .subdev_desc= { + .sd_pdata.host_priv = ov7725_link, + .power = ov7725_power, + .drv_priv = ov7725_info, + }, + .host_desc = { + .board_info = migor_i2c_camera[0], + .i2c_adapter_id = 0, + }, }; static struct
[PATCH 05/24] V4L2: allow dummy file-handle initialisation by v4l2_fh_init()
v4l2_fh_init() can be used to initialise dummy file-handles with vdev == NULL. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/v4l2-core/v4l2-fh.c |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-fh.c b/drivers/media/v4l2-core/v4l2-fh.c index e57c002..7ae608b 100644 --- a/drivers/media/v4l2-core/v4l2-fh.c +++ b/drivers/media/v4l2-core/v4l2-fh.c @@ -33,10 +33,12 @@ void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev) { fh-vdev = vdev; - /* Inherit from video_device. May be overridden by the driver. */ - fh-ctrl_handler = vdev-ctrl_handler; + if (vdev) { + /* Inherit from video_device. May be overridden by the driver. */ + fh-ctrl_handler = vdev-ctrl_handler; + set_bit(V4L2_FL_USES_V4L2_FH, fh-vdev-flags); + } INIT_LIST_HEAD(fh-list); - set_bit(V4L2_FL_USES_V4L2_FH, fh-vdev-flags); fh-prio = V4L2_PRIORITY_UNSET; init_waitqueue_head(fh-wait); INIT_LIST_HEAD(fh-available); -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 04/24] V4L2: fix Oops on rmmod path
v4l2_async_cleanup() clears the sd-dev pointer, avoid dereferencing it in v4l2_async_unregister(). Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- drivers/media/v4l2-core/v4l2-async.c | 18 ++ 1 files changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index 98db2e0..5d6b428 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -123,16 +123,6 @@ static void v4l2_async_cleanup(struct v4l2_async_subdev_list *asdl) sd-dev = NULL; } -static void v4l2_async_unregister(struct v4l2_async_subdev_list *asdl) -{ - struct v4l2_subdev *sd = v4l2_async_to_subdev(asdl); - - v4l2_async_cleanup(asdl); - - /* If we handled USB devices, we'd have to lock the parent too */ - device_release_driver(sd-dev); -} - int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev, struct v4l2_async_notifier *notifier) { @@ -203,9 +193,13 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier) list_for_each_entry_safe(asdl, tmp, notifier-done, list) { if (dev) { struct v4l2_subdev *sd = v4l2_async_to_subdev(asdl); - dev[i++] = get_device(sd-dev); + dev[i] = get_device(sd-dev); } - v4l2_async_unregister(asdl); + v4l2_async_cleanup(asdl); + + /* If we handled USB devices, we'd have to lock the parent too */ + if (dev) + device_release_driver(dev[i++]); if (notifier-unbind) notifier-unbind(notifier, asdl); -- 1.7.2.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/24] V4L2: add a common V4L2 subdevice platform data type
This struct shall be used by subdevice drivers to pass per-subdevice data, e.g. power supplies, to generic V4L2 methods, at the same time allowing optional host-specific extensions via the host_priv pointer. To avoid having to pass two pointers to those methods, add a pointer to this new struct to struct v4l2_subdev. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- include/media/v4l2-subdev.h | 13 + 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index eb91366..b15c6e0 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -561,6 +561,17 @@ struct v4l2_subdev_internal_ops { /* Set this flag if this subdev generates events. */ #define V4L2_SUBDEV_FL_HAS_EVENTS (1U 3) +struct regulator_bulk_data; + +struct v4l2_subdev_platform_data { + /* Optional regulators uset to power on/off the subdevice */ + struct regulator_bulk_data *regulators; + int num_regulators; + + /* Per-subdevice data, specific for a certain video host device */ + void *host_priv; +}; + /* Each instance of a subdev driver should create this struct, either stand-alone or embedded in a larger struct. */ @@ -589,6 +600,8 @@ struct v4l2_subdev { /* pointer to the physical device */ struct device *dev; struct v4l2_async_subdev_list asdl; + /* common part of subdevice platform data */ + struct v4l2_subdev_platform_data *pdata; }; static inline struct v4l2_subdev *v4l2_async_to_subdev( -- 1.7.2.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
Re: AT91SAM9M10: Problem porting driver for MT9P031 sensor
Hi Marcio On Thu, 18 Apr 2013, Marcio Campos de Lima wrote: Hi I am porting the MT9P031 sensor device driver for a custom designed board based at the AT91SAM9M45-EK development board and Linux 3.6.9. The driver detects the sensor but does not create /dev/video1. Can anybody help me? Congratulations, today is your lucky day :-) I've just posted a patch-series http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/63504 to do exactly what you need. Well, 99% of what you need :) With at91 you're using the atmel-isi soc-camera camera host driver. Shich isn't extended by this patch series to support the asynchronous subdevice registration, but it's rather easy to add, please, have a look at patch #15 for an example, based on the mx3_camera driver. Then there's a slight problem of mt9p031 only exporting 12-bit formats. You can fix it internally by substituting 8-bit formats (you are using 8 bits, right?) instead. We'll need a proper solution at some point. The last patch in the series shows how to add support for the mt9p031 sensor to a board. Anyway, give it a try, feel free to ask. Thanks Guennadi Thanks Marcio This is the probe code fo the driver if this can help: /* --- -- * Driver initialization and probing */ static int mt9p031_probe(struct i2c_client *client, const struct i2c_device_id *did) { struct mt9p031_platform_data *pdata = client-dev.platform_data; struct i2c_adapter *adapter = to_i2c_adapter(client-dev.parent); struct mt9p031 *mt9p031; unsigned int i; int ret; if (pdata == NULL) { dev_err(client-dev, No platform data\n); return -EINVAL; } if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) { dev_warn(client-dev, I2C-Adapter doesn't support I2C_FUNC_SMBUS_WORD\n); return -EIO; } mt9p031 = kzalloc(sizeof(*mt9p031), GFP_KERNEL); if (mt9p031 == NULL) return -ENOMEM; mt9p031-pdata = pdata; mt9p031-output_control = MT9P031_OUTPUT_CONTROL_DEF; mt9p031-mode2 = MT9P031_READ_MODE_2_ROW_BLC; v4l2_ctrl_handler_init(mt9p031-ctrls, ARRAY_SIZE(mt9p031_ctrls) + 4); v4l2_ctrl_new_std(mt9p031-ctrls, mt9p031_ctrl_ops, V4L2_CID_EXPOSURE, MT9P031_SHUTTER_WIDTH_MIN, MT9P031_SHUTTER_WIDTH_MAX, 1, MT9P031_SHUTTER_WIDTH_DEF); v4l2_ctrl_new_std(mt9p031-ctrls, mt9p031_ctrl_ops, V4L2_CID_GAIN, MT9P031_GLOBAL_GAIN_MIN, MT9P031_GLOBAL_GAIN_MAX, 1, MT9P031_GLOBAL_GAIN_DEF); v4l2_ctrl_new_std(mt9p031-ctrls, mt9p031_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0); v4l2_ctrl_new_std(mt9p031-ctrls, mt9p031_ctrl_ops, V4L2_CID_VFLIP, 0, 1, 1, 0); for (i = 0; i ARRAY_SIZE(mt9p031_ctrls); ++i) v4l2_ctrl_new_custom(mt9p031-ctrls, mt9p031_ctrls[i], NULL); mt9p031-subdev.ctrl_handler = mt9p031-ctrls; if (mt9p031-ctrls.error) printk(KERN_INFO %s: control initialization error %d\n, __func__, mt9p031-ctrls.error); mutex_init(mt9p031-power_lock); v4l2_i2c_subdev_init(mt9p031-subdev, client, mt9p031_subdev_ops); mt9p031-subdev.internal_ops = mt9p031_subdev_internal_ops; mt9p031-pad.flags = MEDIA_PAD_FL_SOURCE; ret = media_entity_init(mt9p031-subdev.entity, 1, mt9p031-pad, 0); if (ret 0) goto done; mt9p031-subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; mt9p031-crop.width = MT9P031_WINDOW_WIDTH_DEF; mt9p031-crop.height = MT9P031_WINDOW_HEIGHT_DEF; mt9p031-crop.left = MT9P031_COLUMN_START_DEF; mt9p031-crop.top = MT9P031_ROW_START_DEF; if (mt9p031-pdata-version == MT9P031_MONOCHROME_VERSION) mt9p031-format.code = V4L2_MBUS_FMT_Y12_1X12; else mt9p031-format.code = V4L2_MBUS_FMT_SGRBG12_1X12; mt9p031-format.width = MT9P031_WINDOW_WIDTH_DEF; mt9p031-format.height = MT9P031_WINDOW_HEIGHT_DEF; mt9p031-format.field = V4L2_FIELD_NONE; mt9p031-format.colorspace = V4L2_COLORSPACE_SRGB; isi_set_clk(); mt9p031-pdata-ext_freq=2100; mt9p031-pdata-target_freq=4800; ret = mt9p031_pll_get_divs(mt9p031); done: if (ret 0) { v4l2_ctrl_handler_free(mt9p031-ctrls); media_entity_cleanup(mt9p031-subdev.entity); kfree(mt9p031); } return ret; } -- 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 24/24] ARM: pcm037: support mt9p031 / mt9p006 camera sensors
Forgot to mention explicitly: this patch is only an example, not even nearly to be considered for applying. Thanks Guennadi On Thu, 18 Apr 2013, Guennadi Liakhovetski wrote: We don't know how to support pluggable camera sensors yet. This is just an example, how support for an mt9p031 or mt9p006 camera sensor could be added to pcm037. not-Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de --- arch/arm/mach-imx/mach-pcm037.c | 44 +- 1 files changed, 42 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-imx/mach-pcm037.c b/arch/arm/mach-imx/mach-pcm037.c index f138481..18ba328 100644 --- a/arch/arm/mach-imx/mach-pcm037.c +++ b/arch/arm/mach-imx/mach-pcm037.c @@ -36,6 +36,7 @@ #include linux/regulator/fixed.h #include media/soc_camera.h +#include media/mt9p031.h #include asm/mach-types.h #include asm/mach/arch.h @@ -363,6 +364,22 @@ static struct i2c_board_info pcm037_i2c_devices[] = { } }; +static struct mt9p031_platform_data mt9p031_pdata = { + .target_freq = 2000, + .ext_freq = 2000, + .sd_pdata = { + .num_regulators = ARRAY_SIZE(cam_supply), + .regulators = cam_supply, + }, +}; + +static struct i2c_board_info pcm037_i2c2_devices[] = { + { + I2C_BOARD_INFO(mt9p031, 0x48), + .platform_data = mt9p031_pdata, + }, +}; + static struct platform_device pcm037_mt9t031 = { .name = soc-camera-pdrv, .id = 0, @@ -441,9 +458,30 @@ static const struct imxmmc_platform_data sdhc_pdata __initconst = { .exit = pcm970_sdhc1_exit, }; +static struct soc_camera_async_subdev mt9p006_sd = { + .asd.hw = { + .bus_type = V4L2_ASYNC_BUS_I2C, + .match.i2c = { + .adapter_id = 2, + .address = 0x48, + }, + }, + .role = SOCAM_SUBDEV_DATA_SOURCE, +}; + +static struct v4l2_async_subdev *cam_subdevs[] = { + /* Single 1-element group */ + mt9p006_sd.asd, +}; + +/* 0-terminated array of group-sizes */ +static int cam_subdev_sizes[] = {ARRAY_SIZE(cam_subdevs), 0}; + struct mx3_camera_pdata camera_pdata __initdata = { .flags = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10, .mclk_10khz = 2000, + .asd= cam_subdevs, + .asd_sizes = cam_subdev_sizes, }; static phys_addr_t mx3_camera_base __initdata; @@ -476,8 +514,8 @@ static struct platform_device *devices[] __initdata = { pcm037_flash, pcm037_sram_device, vcc_cam, - pcm037_mt9t031, - pcm037_mt9v022, +// pcm037_mt9t031, +// pcm037_mt9v022, }; static const struct fb_videomode fb_modedb[] = { @@ -677,6 +715,8 @@ static void __init pcm037_init(void) /* I2C adapters and devices */ i2c_register_board_info(1, pcm037_i2c_devices, ARRAY_SIZE(pcm037_i2c_devices)); + i2c_register_board_info(2, pcm037_i2c2_devices, + ARRAY_SIZE(pcm037_i2c2_devices)); imx31_add_imx_i2c1(pcm037_i2c1_data); imx31_add_imx_i2c2(pcm037_i2c2_data); -- 1.7.2.5 --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- 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 23/24] V4L2: mt9p031: add struct v4l2_subdev_platform_data to platform data
On Thu, 18 Apr 2013, Guennadi Liakhovetski wrote: Adding struct v4l2_subdev_platform_data to mt9p031's platform data allows the driver to use generic functions to manage sensor power supplies. Signed-off-by: Guennadi Liakhovetski g.liakhovet...@gmx.de A small addition to this one too: to be absolutely honest, I also had to replace 12-bit formats with their 8-bit counterparts, because only 8 data lanes are connected to my camera host. We'll need to somehow properly solve this too. Thanks Guennadi --- drivers/media/i2c/mt9p031.c |1 + include/media/mt9p031.h |3 +++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c index 70f4525..ca2cc6e 100644 --- a/drivers/media/i2c/mt9p031.c +++ b/drivers/media/i2c/mt9p031.c @@ -1048,6 +1048,7 @@ static int mt9p031_probe(struct i2c_client *client, goto done; mt9p031-subdev.dev = client-dev; + mt9p031-subdev.pdata = pdata-sd_pdata; ret = v4l2_async_register_subdev(mt9p031-subdev); done: diff --git a/include/media/mt9p031.h b/include/media/mt9p031.h index 0c97b19..7bf7b53 100644 --- a/include/media/mt9p031.h +++ b/include/media/mt9p031.h @@ -1,6 +1,8 @@ #ifndef MT9P031_H #define MT9P031_H +#include media/v4l2-subdev.h + struct v4l2_subdev; /* @@ -15,6 +17,7 @@ struct mt9p031_platform_data { int reset; int ext_freq; int target_freq; + struct v4l2_subdev_platform_data sd_pdata; }; #endif -- 1.7.2.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 --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- 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 09/12] v4l2: Add a V4L2 driver for SI476X MFD
Hi Andrey, On Thu, Apr 18, 2013 at 09:58:35AM -0700, Andrey Smirnov wrote: diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig index ead9928..170460d 100644 --- a/drivers/media/radio/Kconfig +++ b/drivers/media/radio/Kconfig @@ -18,6 +18,23 @@ config RADIO_SI470X source drivers/media/radio/si470x/Kconfig +config RADIO_SI476X + tristate Silicon Laboratories Si476x I2C FM Radio + depends on I2C VIDEO_V4L2 + select MFD_CORE + select MFD_SI476X_CORE This is wrong. You want depends on MFD_SI476X_CORE, you should not select a symbol that has other dependencies. It also would allow us to carry the v4l2/media parts of your patchset independently from the MFD ones as the radio driver will not be buildable on a tree where the MFD part is not present. We'll try to figure something out with Mauro. Cheers, Samuel. -- Intel Open Source Technology Centre http://oss.intel.com/ -- 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: AT91SAM9M10: Problem porting driver for MT9P031 sensor
Hi Guennadi Thanks a lot for your attention. I think I cannot apply the patches. My Linux sources, downloaded from www.at91.com, does not have the V4l2-async.h header and, I suppose, many others headers. The MT9P031 sources have been modified and it is in a different tree. Can you tell me where I can download an already patched Kernel 3.6.9 which I can add theses functionality to the driver I am using? By the way, our MT9P031 sensor board has 10-bit format. I have fixed already. Regards MArcio On 18/04/13 19:44, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote: Hi Marcio On Thu, 18 Apr 2013, Marcio Campos de Lima wrote: Hi I am porting the MT9P031 sensor device driver for a custom designed board based at the AT91SAM9M45-EK development board and Linux 3.6.9. The driver detects the sensor but does not create /dev/video1. Can anybody help me? Congratulations, today is your lucky day :-) I've just posted a patch-series http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/635 04 to do exactly what you need. Well, 99% of what you need :) With at91 you're using the atmel-isi soc-camera camera host driver. Shich isn't extended by this patch series to support the asynchronous subdevice registration, but it's rather easy to add, please, have a look at patch #15 for an example, based on the mx3_camera driver. Then there's a slight problem of mt9p031 only exporting 12-bit formats. You can fix it internally by substituting 8-bit formats (you are using 8 bits, right?) instead. We'll need a proper solution at some point. The last patch in the series shows how to add support for the mt9p031 sensor to a board. Anyway, give it a try, feel free to ask. Thanks Guennadi Thanks Marcio This is the probe code fo the driver if this can help: /* - -- -- * Driver initialization and probing */ static int mt9p031_probe(struct i2c_client *client, const struct i2c_device_id *did) { struct mt9p031_platform_data *pdata = client-dev.platform_data; struct i2c_adapter *adapter = to_i2c_adapter(client-dev.parent); struct mt9p031 *mt9p031; unsigned int i; int ret; if (pdata == NULL) { dev_err(client-dev, No platform data\n); return -EINVAL; } if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) { dev_warn(client-dev, I2C-Adapter doesn't support I2C_FUNC_SMBUS_WORD\n); return -EIO; } mt9p031 = kzalloc(sizeof(*mt9p031), GFP_KERNEL); if (mt9p031 == NULL) return -ENOMEM; mt9p031-pdata = pdata; mt9p031-output_control = MT9P031_OUTPUT_CONTROL_DEF; mt9p031-mode2 = MT9P031_READ_MODE_2_ROW_BLC; v4l2_ctrl_handler_init(mt9p031-ctrls, ARRAY_SIZE(mt9p031_ctrls) + 4); v4l2_ctrl_new_std(mt9p031-ctrls, mt9p031_ctrl_ops, V4L2_CID_EXPOSURE, MT9P031_SHUTTER_WIDTH_MIN, MT9P031_SHUTTER_WIDTH_MAX, 1, MT9P031_SHUTTER_WIDTH_DEF); v4l2_ctrl_new_std(mt9p031-ctrls, mt9p031_ctrl_ops, V4L2_CID_GAIN, MT9P031_GLOBAL_GAIN_MIN, MT9P031_GLOBAL_GAIN_MAX, 1, MT9P031_GLOBAL_GAIN_DEF); v4l2_ctrl_new_std(mt9p031-ctrls, mt9p031_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0); v4l2_ctrl_new_std(mt9p031-ctrls, mt9p031_ctrl_ops, V4L2_CID_VFLIP, 0, 1, 1, 0); for (i = 0; i ARRAY_SIZE(mt9p031_ctrls); ++i) v4l2_ctrl_new_custom(mt9p031-ctrls, mt9p031_ctrls[i], NULL); mt9p031-subdev.ctrl_handler = mt9p031-ctrls; if (mt9p031-ctrls.error) printk(KERN_INFO %s: control initialization error %d\n, __func__, mt9p031-ctrls.error); mutex_init(mt9p031-power_lock); v4l2_i2c_subdev_init(mt9p031-subdev, client, mt9p031_subdev_ops); mt9p031-subdev.internal_ops = mt9p031_subdev_internal_ops; mt9p031-pad.flags = MEDIA_PAD_FL_SOURCE; ret = media_entity_init(mt9p031-subdev.entity, 1, mt9p031-pad, 0); if (ret 0) goto done; mt9p031-subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; mt9p031-crop.width = MT9P031_WINDOW_WIDTH_DEF; mt9p031-crop.height = MT9P031_WINDOW_HEIGHT_DEF; mt9p031-crop.left = MT9P031_COLUMN_START_DEF; mt9p031-crop.top = MT9P031_ROW_START_DEF; if (mt9p031-pdata-version == MT9P031_MONOCHROME_VERSION) mt9p031-format.code = V4L2_MBUS_FMT_Y12_1X12; else mt9p031-format.code = V4L2_MBUS_FMT_SGRBG12_1X12; mt9p031-format.width = MT9P031_WINDOW_WIDTH_DEF; mt9p031-format.height = MT9P031_WINDOW_HEIGHT_DEF; mt9p031-format.field = V4L2_FIELD_NONE; mt9p031-format.colorspace = V4L2_COLORSPACE_SRGB; isi_set_clk();
Re: [PATCH 4/4] ARM: shmobile: Marzen: enable VIN and ADV7180 in defconfig
On Thu, Apr 18, 2013 at 06:21:12PM +0400, Sergei Shtylyov wrote: On 18-04-2013 17:30, Simon Horman wrote: From: Vladimir Barinov vladimir.bari...@cogentembedded.com Add the VIN and ADV7180 drivers to 'marzen_defconfig'. Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com --- arch/arm/configs/marzen_defconfig |7 +++ 1 file changed, 7 insertions(+) Thanks, queued-up for v3.11 in the defconfig-marzen branch. That seems somewhat premature as CONFIG_VIDEO_RCAR_VIN is not defined yet (it's defined in the patch #1 of this series). Sorry about that, I have dropped the patch. -- 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