[PATCH] videobuf2-core: modify the num of users
If num_users returns 1 or more than 1, that means we are not the only user of the plane's memory. Signed-off-by: panpan liu panpan1@samsung.com --- drivers/media/v4l2-core/videobuf2-core.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index c359006..d3a4b8f 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -625,7 +625,7 @@ static bool __buffer_in_use(struct vb2_queue *q, struct vb2_buffer *vb) * case anyway. If num_users() returns more than 1, * we are not the only user of the plane's memory. */ - if (mem_priv call_memop(vb, num_users, mem_priv) 1) + if (mem_priv call_memop(vb, num_users, mem_priv) = 1) return true; } return false; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 06/29] [media] coda: Add encoder/decoder support for CODA960
Jeff, On Mon, Jul 21, 2014 at 09:07:50AM +0200, Robert Schwebel wrote: On Fri, Jul 11, 2014 at 02:33:18PM +0200, Robert Schwebel wrote: On Wed, Jul 02, 2014 at 09:16:42PM +0200, Robert Schwebel wrote: It would be really nice if the firmware was available in the linux-firmware repository. Do you think this would be possible? Best wishes, -- Kamil Debski Samsung RD Institute Poland I tried to convince Freescale to put the firmware into linux-firmware for 15 months now, but recently got no reply any more. Fabio, Shawn, could you try to discuss this with the responsible folks inside FSL again? Maybe responsibilities have changed in the meantime and I might have tried to talk to the wrong people. Any news? Did you get some feedback? I didn't. Jeff, does Freescale have concerns putting the MX6 CODA firmware into the linux-firmware repository? If yes, it would be interesting to learn about those and discuss the possibilities. Support for the CODA960 has been added to the mainline kernel in 3.16, which is basically unusable without distributable firmware. Please make it possible that your customers can actually use your hardware. Best regards, Robert -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | -- 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] videobuf2-core: modify the num of users
On Thu, Aug 14, 2014 at 4:11 PM, panpan liu panpan1@samsung.com wrote: If num_users returns 1 or more than 1, that means we are not the only user of the plane's memory. Signed-off-by: panpan liu panpan1@samsung.com NACK. Please read the function documentation and how it is used. If the number of users is 1, we are the only user and should be able to free the queue. This will make us unable to do so. --- drivers/media/v4l2-core/videobuf2-core.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index c359006..d3a4b8f 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -625,7 +625,7 @@ static bool __buffer_in_use(struct vb2_queue *q, struct vb2_buffer *vb) * case anyway. If num_users() returns more than 1, * we are not the only user of the plane's memory. */ - if (mem_priv call_memop(vb, num_users, mem_priv) 1) + if (mem_priv call_memop(vb, num_users, mem_priv) = 1) return true; } return false; -- 1.7.9.5 -- Thanks, Pawel Osciak -- 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] videobuf2-core: modify the num of users
Hi, I've got a few questions: On 08/14/2014 09:11 AM, panpan liu wrote: If num_users returns 1 or more than 1, that means we are not the only user of the plane's memory. Why do think this is wrong? When the buffer is allocated the refcount is set to 1, so anyone mapping that buffer will increase the refcount making it 'in use'. Seems perfectly OK to me. So if your patch solves a problem for you, then I'd like to know what that problem is. You might be solving it in the wrong place. Signed-off-by: panpan liu panpan1@samsung.com --- drivers/media/v4l2-core/videobuf2-core.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index c359006..d3a4b8f 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -625,7 +625,7 @@ static bool __buffer_in_use(struct vb2_queue *q, struct vb2_buffer *vb) * case anyway. If num_users() returns more than 1, * we are not the only user of the plane's memory. And even if there was a bug, then your patch is incomplete because you didn't update the comment. */ - if (mem_priv call_memop(vb, num_users, mem_priv) 1) + if (mem_priv call_memop(vb, num_users, mem_priv) = 1) return true; } return false; Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH/RFC v4 15/21] media: Add registration helpers for V4L2 flash
On 08/14/2014 06:34 AM, Sakari Ailus wrote: Hi Jacek, On Mon, Aug 11, 2014 at 03:27:22PM +0200, Jacek Anaszewski wrote: ... diff --git a/include/media/v4l2-flash.h b/include/media/v4l2-flash.h new file mode 100644 index 000..effa46b --- /dev/null +++ b/include/media/v4l2-flash.h @@ -0,0 +1,137 @@ +/* + * V4L2 Flash LED sub-device registration helpers. + * + * Copyright (C) 2014 Samsung Electronics Co., Ltd + * Author: Jacek Anaszewski j.anaszew...@samsung.com + * + * 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. + */ + +#ifndef _V4L2_FLASH_H +#define _V4L2_FLASH_H + +#include media/v4l2-ctrls.h +#include media/v4l2-device.h +#include media/v4l2-dev.hle +#include media/v4l2-event.h +#include media/v4l2-ioctl.h + +struct led_classdev_flash; +struct led_classdev; +enum led_brightness; + +struct v4l2_flash_ops { + int (*torch_brightness_set)(struct led_classdev *led_cdev, + enum led_brightness brightness); + int (*torch_brightness_update)(struct led_classdev *led_cdev); + int (*flash_brightness_set)(struct led_classdev_flash *flash, + u32 brightness); + int (*flash_brightness_update)(struct led_classdev_flash *flash); + int (*strobe_set)(struct led_classdev_flash *flash, bool state); + int (*strobe_get)(struct led_classdev_flash *flash, bool *state); + int (*timeout_set)(struct led_classdev_flash *flash, u32 timeout); + int (*indicator_brightness_set)(struct led_classdev_flash *flash, + u32 brightness); + int (*indicator_brightness_update)(struct led_classdev_flash *flash); + int (*external_strobe_set)(struct led_classdev_flash *flash, + bool enable); + int (*fault_get)(struct led_classdev_flash *flash, u32 *fault); + void (*sysfs_lock)(struct led_classdev *led_cdev); + void (*sysfs_unlock)(struct led_classdev *led_cdev); These functions are not driver specific and there's going to be just one implementation (I suppose). Could you refresh my memory regarding why the LED framework functions aren't called directly? These ops are required to make possible building led-class-flash as a kernel module. Assuming you'd use the actual implementation directly, what would be the dependencies? I don't think the LED flash framework has any callbacks towards the V4L2 (LED) flash framework, does it? Please correct my understanding if I'm missing something. In Makefile format, assume all targets are .PHONY: led-flash-api: led-api v4l2-flash: led-flash-api driver: led-flash-api v4l2-flash LED Class Flash driver gains V4L2 Flash API when CONFIG_V4L2_FLASH_LED_CLASS is defined. This is accomplished in the probe function by either calling v4l2_flash_init function or the macro of this name, when the CONFIG_V4L2_FLASH_LED_CLASS macro isn't defined. If the v4l2-flash.c was to call the LED API directly, then the led-class-flash module symbols would have to be available at v4l2-flash.o linking time. Is this an issue? EXPORT_SYMBOL_GPL() for the relevant symbols should be enough. It isn't enough. If I call e.g. led_set_flash_brightness directly from v4l2-flash.c and configure led-class-flash to be built as a module then I am getting undefined reference to led_set_flash_brightness error during linking phase. It happens because the linker doesn't take into account led-flash-class.ko symbols. It is reasonable because initially the kernel boots up without led-flash-class.ko module and the processor wouldn't know the address to jump to in the result of calling a led API function. The led-class-flash.ko binary code is loaded into memory not sooner than after executing insmod led-class-flash.ko. After linking dynamically with kernel the LED API function addresses are relocated, and the LED Flash Class core can initialize the v4l2_flash_ops structure. Then every LED Flash Class driver can obtain the address of this structure with led_get_v4l2_flash_ops and pass it to the v4l2_flash_init. This requirement cannot be met if the led-class-flash is built as a module. Use of function pointers in the v4l2-flash.c allows to compile it into the kernel and enables the possibility of adding the V4L2 Flash support conditionally, during driver probing. I'd simply decide this during kernel compilation time. If you want something, just enable it. v4l2_flash_init() is called directly by the driver in any case, so unless that is also called through a wrapper the driver is still directly dependent on it. The problem is that v4l2-flash.o would have to depend on led-class-flash.o, which when built as a module isn't available during v4l2-flash.o linking time. In order to avoid v4l2-flash.o linking problem, it would have to be built as a module.
[GIT PULL FOR v3.18] tw68: add new driver for tw68xx grabber cards
The following changes since commit 0f3bf3dc1ca394a8385079a5653088672b65c5c4: [media] cx23885: fix UNSET/TUNER_ABSENT confusion (2014-08-01 15:30:59 -0300) are available in the git repository at: git://linuxtv.org/hverkuil/media_tree.git tw68 for you to fetch changes up to 64889b98f7ed20ab630a47eff4a5847c3aa0555e: MAINTAINERS: add tw68 entry (2014-08-10 10:36:10 +0200) Hans Verkuil (2): tw68: add support for Techwell tw68xx PCI grabber boards MAINTAINERS: add tw68 entry MAINTAINERS |8 + drivers/media/pci/Kconfig |1 + drivers/media/pci/Makefile |1 + drivers/media/pci/tw68/Kconfig | 10 + drivers/media/pci/tw68/Makefile |3 + drivers/media/pci/tw68/tw68-core.c | 458 ++ drivers/media/pci/tw68/tw68-reg.h | 195 drivers/media/pci/tw68/tw68-risc.c | 230 +++ drivers/media/pci/tw68/tw68-video.c | 1082 + drivers/media/pci/tw68/tw68.h | 235 10 files changed, 2223 insertions(+) create mode 100644 drivers/media/pci/tw68/Kconfig create mode 100644 drivers/media/pci/tw68/Makefile create mode 100644 drivers/media/pci/tw68/tw68-core.c create mode 100644 drivers/media/pci/tw68/tw68-reg.h create mode 100644 drivers/media/pci/tw68/tw68-risc.c create mode 100644 drivers/media/pci/tw68/tw68-video.c create mode 100644 drivers/media/pci/tw68/tw68.h -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv2 00/20] cx23885: convert to the V4L2 core frameworks
This patch series converts the cx23885 driver to the latest V4L2 core frameworks, removing about 1000 lines in the process. It now passes the v4l2-compliance tests and, frankly, feels much more robust. I have tested this with my HVR-1800 board with video (compressed and uncompressed), vbi, dvb and alsa. As usual, the vb2 conversion is a beast of a patch. But the vb2 conversion affected video, vbi, dvb and alsa, so it's all over the place. And it is all or nothing. See the commit log of that patch for some more information. Since the cx23885 code resembles the cx88 and cx25821 code closely, I will probably try to do the same for those drivers in the near future. And in fact I have already started on the cx88. Changes since v1: - Added patch 20/20 which adds vb2_is_busy checks. - altera-ci.c still included the videobuf headers for no reason. Fixed in patch 15/20. - In buffer_prepare in cx23885-video.c the buf-bpl field was used before it was set. Fixed in patch 15/20. Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv2 20/20] cx23885: Add busy checks before changing formats
From: Hans Verkuil hans.verk...@cisco.com Before you can change the standard or the capture format, make sure the various vb2_queues aren't in use since you cannot change the buffer size from underneath a a busy vb2_queue. Also make sure that the return code of cx23885_set_tvnorm is returned correctly, otherwise the -EBUSY will be lost. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885-417.c | 10 +- drivers/media/pci/cx23885/cx23885-video.c | 15 --- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-417.c b/drivers/media/pci/cx23885/cx23885-417.c index f1ef901..6973055 100644 --- a/drivers/media/pci/cx23885/cx23885-417.c +++ b/drivers/media/pci/cx23885/cx23885-417.c @@ -1248,18 +1248,18 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id) { struct cx23885_dev *dev = video_drvdata(file); unsigned int i; + int ret; for (i = 0; i ARRAY_SIZE(cx23885_tvnorms); i++) if (id cx23885_tvnorms[i].id) break; if (i == ARRAY_SIZE(cx23885_tvnorms)) return -EINVAL; - dev-encodernorm = cx23885_tvnorms[i]; - - /* Have the drier core notify the subdevices */ - cx23885_set_tvnorm(dev, id); - return 0; + ret = cx23885_set_tvnorm(dev, id); + if (!ret) + dev-encodernorm = cx23885_tvnorms[i]; + return ret; } static int vidioc_enum_input(struct file *file, void *priv, diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index defdf74..f0ea904 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -119,6 +119,12 @@ int cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm) (unsigned int)norm, v4l2_norm_to_name(norm)); + if (dev-tvnorm != norm) { + if (vb2_is_busy(dev-vb2_vidq) || vb2_is_busy(dev-vb2_vbiq) || + vb2_is_busy(dev-vb2_mpegq)) + return -EBUSY; + } + dev-tvnorm = norm; call_all(dev, video, s_std, norm); @@ -591,6 +597,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, if (0 != err) return err; + + if (vb2_is_busy(dev-vb2_vidq) || vb2_is_busy(dev-vb2_vbiq) || + vb2_is_busy(dev-vb2_mpegq)) + return -EBUSY; + dev-fmt= format_by_fourcc(f-fmt.pix.pixelformat); dev-width = f-fmt.pix.width; dev-height = f-fmt.pix.height; @@ -654,9 +665,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms) struct cx23885_dev *dev = video_drvdata(file); dprintk(1, %s()\n, __func__); - cx23885_set_tvnorm(dev, tvnorms); - - return 0; + return cx23885_set_tvnorm(dev, tvnorms); } int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i) -- 2.1.0.rc1 -- 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
[PATCHv2 13/20] cx23885: drop videobuf abuse in cx23885-alsa
From: Hans Verkuil hans.verk...@cisco.com The alsa driver uses videobuf low-level functions that are not available in vb2, so replace them by driver-specific functions. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885-alsa.c | 96 drivers/media/pci/cx23885/cx23885.h | 7 ++- 2 files changed, 88 insertions(+), 15 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-alsa.c b/drivers/media/pci/cx23885/cx23885-alsa.c index 554798d..31dbf0c 100644 --- a/drivers/media/pci/cx23885/cx23885-alsa.c +++ b/drivers/media/pci/cx23885/cx23885-alsa.c @@ -84,6 +84,82 @@ MODULE_PARM_DESC(audio_debug, enable debug messages [analog audio]); #define AUD_INT_MCHG_IRQ(1 21) #define GP_COUNT_CONTROL_RESET 0x3 +static int cx23885_alsa_dma_init(struct cx23885_audio_dev *chip, int nr_pages) +{ + struct cx23885_audio_buffer *buf = chip-buf; + struct page *pg; + int i; + + buf-vaddr = vmalloc_32(nr_pages PAGE_SHIFT); + if (NULL == buf-vaddr) { + dprintk(1, vmalloc_32(%d pages) failed\n, nr_pages); + return -ENOMEM; + } + + dprintk(1, vmalloc is at addr 0x%08lx, size=%d\n, + (unsigned long)buf-vaddr, + nr_pages PAGE_SHIFT); + + memset(buf-vaddr, 0, nr_pages PAGE_SHIFT); + buf-nr_pages = nr_pages; + + buf-sglist = vzalloc(buf-nr_pages * sizeof(*buf-sglist)); + if (NULL == buf-sglist) + goto vzalloc_err; + + sg_init_table(buf-sglist, buf-nr_pages); + for (i = 0; i buf-nr_pages; i++) { + pg = vmalloc_to_page(buf-vaddr + i * PAGE_SIZE); + if (NULL == pg) + goto vmalloc_to_page_err; + sg_set_page(buf-sglist[i], pg, PAGE_SIZE, 0); + } + return 0; + +vmalloc_to_page_err: + vfree(buf-sglist); + buf-sglist = NULL; +vzalloc_err: + vfree(buf-vaddr); + buf-vaddr = NULL; + return -ENOMEM; +} + +static int cx23885_alsa_dma_map(struct cx23885_audio_dev *dev) +{ + struct cx23885_audio_buffer *buf = dev-buf; + + buf-sglen = dma_map_sg(dev-pci-dev, buf-sglist, + buf-nr_pages, PCI_DMA_FROMDEVICE); + + if (0 == buf-sglen) { + pr_warn(%s: cx23885_alsa_map_sg failed\n, __func__); + return -ENOMEM; + } + return 0; +} + +static int cx23885_alsa_dma_unmap(struct cx23885_audio_dev *dev) +{ + struct cx23885_audio_buffer *buf = dev-buf; + + if (!buf-sglen) + return 0; + + dma_unmap_sg(dev-pci-dev, buf-sglist, buf-sglen, PCI_DMA_FROMDEVICE); + buf-sglen = 0; + return 0; +} + +static int cx23885_alsa_dma_free(struct cx23885_audio_buffer *buf) +{ + vfree(buf-sglist); + buf-sglist = NULL; + vfree(buf-vaddr); + buf-vaddr = NULL; + return 0; +} + /* * BOARD Specific: Sets audio DMA */ @@ -201,12 +277,12 @@ static int dsp_buffer_free(struct cx23885_audio_dev *chip) BUG_ON(!chip-dma_size); dprintk(2, Freeing buffer\n); - videobuf_dma_unmap(chip-pci-dev, chip-dma_risc); - videobuf_dma_free(chip-dma_risc); + cx23885_alsa_dma_unmap(chip); + cx23885_alsa_dma_free(chip-buf); btcx_riscmem_free(chip-pci, chip-buf-risc); kfree(chip-buf); - chip-dma_risc = NULL; + chip-buf = NULL; chip-dma_size = 0; return 0; @@ -289,6 +365,7 @@ static int snd_cx23885_close(struct snd_pcm_substream *substream) return 0; } + /* * hw_params callback */ @@ -296,8 +373,6 @@ static int snd_cx23885_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) { struct cx23885_audio_dev *chip = snd_pcm_substream_chip(substream); - struct videobuf_dmabuf *dma; - struct cx23885_audio_buffer *buf; int ret; @@ -319,18 +394,16 @@ static int snd_cx23885_hw_params(struct snd_pcm_substream *substream, buf-bpl = chip-period_size; - dma = buf-dma; - videobuf_dma_init(dma); - ret = videobuf_dma_init_kernel(dma, PCI_DMA_FROMDEVICE, + ret = cx23885_alsa_dma_init(chip, (PAGE_ALIGN(chip-dma_size) PAGE_SHIFT)); if (ret 0) goto error; - ret = videobuf_dma_map(chip-pci-dev, dma); + ret = cx23885_alsa_dma_map(chip); if (ret 0) goto error; - ret = cx23885_risc_databuffer(chip-pci, buf-risc, dma-sglist, + ret = cx23885_risc_databuffer(chip-pci, buf-risc, buf-sglist, chip-period_size, chip-num_periods, 1); if (ret 0) goto error; @@ -341,9 +414,8 @@ static int snd_cx23885_hw_params(struct snd_pcm_substream *substream, buf-risc.jmp[2] = cpu_to_le32(0); /* bits 63-32 */ chip-buf
[PATCHv2 19/20] cx23885: remove btcx-risc dependency
From: Hans Verkuil hans.verk...@cisco.com It's just as easy to do it in the driver. This dependency only uses a fraction of the btcx-risc module and doing it directly in the driver adds only a few lines. The btcx-risc module is really meant for the bttv driver, not for other drivers. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/Kconfig| 1 - drivers/media/pci/cx23885/Makefile | 1 - drivers/media/pci/cx23885/cx23885-alsa.c | 5 - drivers/media/pci/cx23885/cx23885-core.c | 36 +--- drivers/media/pci/cx23885/cx23885.h | 18 ++-- 5 files changed, 35 insertions(+), 26 deletions(-) diff --git a/drivers/media/pci/cx23885/Kconfig b/drivers/media/pci/cx23885/Kconfig index 38c3b7b..a883ea4 100644 --- a/drivers/media/pci/cx23885/Kconfig +++ b/drivers/media/pci/cx23885/Kconfig @@ -3,7 +3,6 @@ config VIDEO_CX23885 depends on DVB_CORE VIDEO_DEV PCI I2C INPUT SND select SND_PCM select I2C_ALGOBIT - select VIDEO_BTCX select VIDEO_TUNER select VIDEO_TVEEPROM depends on RC_CORE diff --git a/drivers/media/pci/cx23885/Makefile b/drivers/media/pci/cx23885/Makefile index 2a2cafb..a2cbdcf 100644 --- a/drivers/media/pci/cx23885/Makefile +++ b/drivers/media/pci/cx23885/Makefile @@ -8,7 +8,6 @@ obj-$(CONFIG_VIDEO_CX23885) += cx23885.o obj-$(CONFIG_MEDIA_ALTERA_CI) += altera-ci.o ccflags-y += -Idrivers/media/i2c -ccflags-y += -Idrivers/media/common ccflags-y += -Idrivers/media/tuners ccflags-y += -Idrivers/media/dvb-core ccflags-y += -Idrivers/media/dvb-frontends diff --git a/drivers/media/pci/cx23885/cx23885-alsa.c b/drivers/media/pci/cx23885/cx23885-alsa.c index 1b162ee..ae7c2e8 100644 --- a/drivers/media/pci/cx23885/cx23885-alsa.c +++ b/drivers/media/pci/cx23885/cx23885-alsa.c @@ -270,12 +270,15 @@ int cx23885_audio_irq(struct cx23885_dev *dev, u32 status, u32 mask) static int dsp_buffer_free(struct cx23885_audio_dev *chip) { + struct cx23885_riscmem *risc; + BUG_ON(!chip-dma_size); dprintk(2, Freeing buffer\n); cx23885_alsa_dma_unmap(chip); cx23885_alsa_dma_free(chip-buf); - btcx_riscmem_free(chip-pci, chip-buf-risc); + risc = chip-buf-risc; + pci_free_consistent(chip-pci, risc-size, risc-cpu, risc-dma); kfree(chip-buf); chip-buf = NULL; diff --git a/drivers/media/pci/cx23885/cx23885-core.c b/drivers/media/pci/cx23885/cx23885-core.c index 8663f7b..331edda 100644 --- a/drivers/media/pci/cx23885/cx23885-core.c +++ b/drivers/media/pci/cx23885/cx23885-core.c @@ -570,7 +570,7 @@ void cx23885_sram_channel_dump(struct cx23885_dev *dev, } static void cx23885_risc_disasm(struct cx23885_tsport *port, - struct btcx_riscmem *risc) + struct cx23885_riscmem *risc) { struct cx23885_dev *dev = port-dev; unsigned int i, j, n; @@ -1121,14 +1121,13 @@ static __le32 *cx23885_risc_field(__le32 *rp, struct scatterlist *sglist, return rp; } -int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, +int cx23885_risc_buffer(struct pci_dev *pci, struct cx23885_riscmem *risc, struct scatterlist *sglist, unsigned int top_offset, unsigned int bottom_offset, unsigned int bpl, unsigned int padding, unsigned int lines) { u32 instructions, fields; __le32 *rp; - int rc; fields = 0; if (UNSET != top_offset) @@ -1144,9 +1143,10 @@ int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + lines); instructions += 5; - rc = btcx_riscmem_alloc(pci, risc, instructions*12); - if (rc 0) - return rc; + risc-size = instructions * 12; + risc-cpu = pci_alloc_consistent(pci, risc-size, risc-dma); + if (risc-cpu == NULL) + return -ENOMEM; /* write risc instructions */ rp = risc-cpu; @@ -1164,14 +1164,13 @@ int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, } int cx23885_risc_databuffer(struct pci_dev *pci, - struct btcx_riscmem *risc, + struct cx23885_riscmem *risc, struct scatterlist *sglist, unsigned int bpl, unsigned int lines, unsigned int lpi) { u32 instructions; __le32 *rp; - int rc; /* estimate risc mem: worst case is one write per page border + one write per scan line + syncs + jump (all 2 dwords). Here @@ -1181,9 +1180,10 @@ int cx23885_risc_databuffer(struct pci_dev *pci, instructions = 1 + (bpl * lines) / PAGE_SIZE + lines; instructions += 4; -
[PATCHv2 11/20] cx23885: drop unused clip fields from struct cx23885_fh
From: Hans Verkuil hans.verk...@cisco.com There is no overlay support, so drop these unused fields. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885.h | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885.h b/drivers/media/pci/cx23885/cx23885.h index aba1e6a..a88e951 100644 --- a/drivers/media/pci/cx23885/cx23885.h +++ b/drivers/media/pci/cx23885/cx23885.h @@ -145,11 +145,6 @@ struct cx23885_fh { struct cx23885_dev *dev; u32resources; - /* video overlay */ - struct v4l2_window win; - struct v4l2_clip *clips; - unsigned int nclips; - /* video capture */ struct cx23885_fmt *fmt; unsigned int width, height; -- 2.1.0.rc1 -- 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
[PATCHv2 08/20] cx23885: map invalid fields to a valid field.
From: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885-video.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index ad02912..9bb19fd 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -948,7 +948,8 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, case V4L2_FIELD_INTERLACED: break; default: - return -EINVAL; + field = V4L2_FIELD_INTERLACED; + break; } f-fmt.pix.field = field; -- 2.1.0.rc1 -- 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
[PATCHv2 15/20] cx23885: convert to vb2
From: Hans Verkuil hans.verk...@cisco.com As usual, this patch is very large due to the fact that half a vb2 conversion isn't possible. And since this affects 417, alsa, core, dvb, vbi and video the changes are all over. What made this more difficult was the peculiar way the risc program was setup. The driver allowed for running out of buffers in which case the DMA would stop and restart when the next buffer was queued. There was also a complicated timeout system for when buffers weren't filled. This was replaced by a much simpler scheme where there is always one buffer around and the DMA will just cycle that buffer until a new buffer is queued. In that case the previous buffer will be chained to the new buffer. An interrupt is generated at the start of the new buffer telling the driver that the previous buffer can be passed on to userspace. Much simpler and more robust. The old code seems to be copied from the cx88 driver. But it didn't fit the vb2 ops very well and replacing it with the new scheme made the code easier to understand. Not to mention that this patch removes 600 lines of code. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/Kconfig | 4 +- drivers/media/pci/cx23885/altera-ci.c | 4 +- drivers/media/pci/cx23885/cx23885-417.c | 312 +--- drivers/media/pci/cx23885/cx23885-alsa.c | 4 +- drivers/media/pci/cx23885/cx23885-core.c | 309 drivers/media/pci/cx23885/cx23885-dvb.c | 131 +++-- drivers/media/pci/cx23885/cx23885-vbi.c | 275 +- drivers/media/pci/cx23885/cx23885-video.c | 810 -- drivers/media/pci/cx23885/cx23885.h | 61 +-- 9 files changed, 657 insertions(+), 1253 deletions(-) diff --git a/drivers/media/pci/cx23885/Kconfig b/drivers/media/pci/cx23885/Kconfig index e12c006..38c3b7b 100644 --- a/drivers/media/pci/cx23885/Kconfig +++ b/drivers/media/pci/cx23885/Kconfig @@ -7,8 +7,8 @@ config VIDEO_CX23885 select VIDEO_TUNER select VIDEO_TVEEPROM depends on RC_CORE - select VIDEOBUF_DVB - select VIDEOBUF_DMA_SG + select VIDEOBUF2_DVB + select VIDEOBUF2_DMA_SG select VIDEO_CX25840 select VIDEO_CX2341X select DVB_DIB7000P if MEDIA_SUBDRV_AUTOSELECT diff --git a/drivers/media/pci/cx23885/altera-ci.c b/drivers/media/pci/cx23885/altera-ci.c index 2926f7f..f57b333 100644 --- a/drivers/media/pci/cx23885/altera-ci.c +++ b/drivers/media/pci/cx23885/altera-ci.c @@ -52,8 +52,8 @@ * | DATA7| DATA6| DATA5| DATA4| DATA3| DATA2| DATA1| DATA0| * +---+---+---+---+---+---+---+---+ */ -#include media/videobuf-dma-sg.h -#include media/videobuf-dvb.h +#include dvb_demux.h +#include dvb_frontend.h #include altera-ci.h #include dvb_ca_en50221.h diff --git a/drivers/media/pci/cx23885/cx23885-417.c b/drivers/media/pci/cx23885/cx23885-417.c index 0948b44..a17238a 100644 --- a/drivers/media/pci/cx23885/cx23885-417.c +++ b/drivers/media/pci/cx23885/cx23885-417.c @@ -1142,47 +1142,100 @@ static int cx23885_initialize_codec(struct cx23885_dev *dev, int startencoder) /* -- */ -static int bb_buf_setup(struct videobuf_queue *q, - unsigned int *count, unsigned int *size) +static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt, + unsigned int *num_buffers, unsigned int *num_planes, + unsigned int sizes[], void *alloc_ctxs[]) { - struct cx23885_fh *fh = q-priv_data; + struct cx23885_dev *dev = q-drv_priv; - fh-q_dev-ts1.ts_packet_size = mpeglinesize; - fh-q_dev-ts1.ts_packet_count = mpeglines; + dev-ts1.ts_packet_size = mpeglinesize; + dev-ts1.ts_packet_count = mpeglines; + *num_planes = 1; + sizes[0] = mpeglinesize * mpeglines; + *num_buffers = mpegbufs; + return 0; +} - *size = fh-q_dev-ts1.ts_packet_size * fh-q_dev-ts1.ts_packet_count; - *count = mpegbufs; +static int buffer_prepare(struct vb2_buffer *vb) +{ + struct cx23885_dev *dev = vb-vb2_queue-drv_priv; + struct cx23885_buffer *buf = + container_of(vb, struct cx23885_buffer, vb); - return 0; + return cx23885_buf_prepare(buf, dev-ts1); } -static int bb_buf_prepare(struct videobuf_queue *q, - struct videobuf_buffer *vb, enum v4l2_field field) +static void buffer_finish(struct vb2_buffer *vb) { - struct cx23885_fh *fh = q-priv_data; - return cx23885_buf_prepare(q, fh-q_dev-ts1, - (struct cx23885_buffer *)vb, - field); + struct cx23885_dev *dev = vb-vb2_queue-drv_priv; + struct cx23885_buffer *buf = container_of(vb, + struct cx23885_buffer, vb); + struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0); + + cx23885_free_buffer(dev, buf); + + dma_unmap_sg(dev-pci-dev, sgt-sgl,
[PATCHv2 14/20] cx23885: use video_drvdata to get cx23885_dev pointer
From: Hans Verkuil hans.verk...@cisco.com Use video_drvdata(file) instead of fh-dev to get the cx23885_dev pointer. This prepares for the vb2 conversion where fh-dev (renamed to fh-q_dev in this patch) will be removed completely. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885-417.c | 56 + drivers/media/pci/cx23885/cx23885-ioctl.c | 6 ++-- drivers/media/pci/cx23885/cx23885-vbi.c | 7 ++-- drivers/media/pci/cx23885/cx23885-video.c | 60 +++ drivers/media/pci/cx23885/cx23885.h | 2 +- 5 files changed, 60 insertions(+), 71 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-417.c b/drivers/media/pci/cx23885/cx23885-417.c index 4142c15..0948b44 100644 --- a/drivers/media/pci/cx23885/cx23885-417.c +++ b/drivers/media/pci/cx23885/cx23885-417.c @@ -1147,10 +1147,10 @@ static int bb_buf_setup(struct videobuf_queue *q, { struct cx23885_fh *fh = q-priv_data; - fh-dev-ts1.ts_packet_size = mpeglinesize; - fh-dev-ts1.ts_packet_count = mpeglines; + fh-q_dev-ts1.ts_packet_size = mpeglinesize; + fh-q_dev-ts1.ts_packet_count = mpeglines; - *size = fh-dev-ts1.ts_packet_size * fh-dev-ts1.ts_packet_count; + *size = fh-q_dev-ts1.ts_packet_size * fh-q_dev-ts1.ts_packet_count; *count = mpegbufs; return 0; @@ -1160,7 +1160,7 @@ static int bb_buf_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, enum v4l2_field field) { struct cx23885_fh *fh = q-priv_data; - return cx23885_buf_prepare(q, fh-dev-ts1, + return cx23885_buf_prepare(q, fh-q_dev-ts1, (struct cx23885_buffer *)vb, field); } @@ -1169,7 +1169,7 @@ static void bb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) { struct cx23885_fh *fh = q-priv_data; - cx23885_buf_queue(fh-dev-ts1, (struct cx23885_buffer *)vb); + cx23885_buf_queue(fh-q_dev-ts1, (struct cx23885_buffer *)vb); } static void bb_buf_release(struct videobuf_queue *q, @@ -1189,8 +1189,7 @@ static struct videobuf_queue_ops cx23885_qops = { static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id) { - struct cx23885_fh *fh = file-private_data; - struct cx23885_dev *dev = fh-dev; + struct cx23885_dev *dev = video_drvdata(file); *id = dev-tvnorm; return 0; @@ -1198,8 +1197,7 @@ static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id) static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id) { - struct cx23885_fh *fh = file-private_data; - struct cx23885_dev *dev = fh-dev; + struct cx23885_dev *dev = video_drvdata(file); unsigned int i; for (i = 0; i ARRAY_SIZE(cx23885_tvnorms); i++) @@ -1218,7 +1216,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id) static int vidioc_enum_input(struct file *file, void *priv, struct v4l2_input *i) { - struct cx23885_dev *dev = ((struct cx23885_fh *)priv)-dev; + struct cx23885_dev *dev = video_drvdata(file); dprintk(1, %s()\n, __func__); return cx23885_enum_input(dev, i); } @@ -1236,8 +1234,7 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i) static int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) { - struct cx23885_fh *fh = file-private_data; - struct cx23885_dev *dev = fh-dev; + struct cx23885_dev *dev = video_drvdata(file); if (dev-tuner_type == TUNER_ABSENT) return -EINVAL; @@ -1254,8 +1251,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, static int vidioc_s_tuner(struct file *file, void *priv, const struct v4l2_tuner *t) { - struct cx23885_fh *fh = file-private_data; - struct cx23885_dev *dev = fh-dev; + struct cx23885_dev *dev = video_drvdata(file); if (dev-tuner_type == TUNER_ABSENT) return -EINVAL; @@ -1269,8 +1265,7 @@ static int vidioc_s_tuner(struct file *file, void *priv, static int vidioc_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { - struct cx23885_fh *fh = file-private_data; - struct cx23885_dev *dev = fh-dev; + struct cx23885_dev *dev = video_drvdata(file); if (dev-tuner_type == TUNER_ABSENT) return -EINVAL; @@ -1291,8 +1286,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - struct cx23885_fh *fh = file-private_data; - struct cx23885_dev *dev = fh-dev; + struct cx23885_dev *dev = video_drvdata(file); struct cx23885_tsport *tsport = dev-ts1; strlcpy(cap-driver, dev-name,
[PATCHv2 06/20] cx23885: convert 417 to the control framework
From: Hans Verkuil hans.verk...@cisco.com Convert the -417 source to the control framework as well. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885-417.c | 133 +- drivers/media/pci/cx23885/cx23885-video.c | 6 -- drivers/media/pci/cx23885/cx23885.h | 2 +- 3 files changed, 20 insertions(+), 121 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-417.c b/drivers/media/pci/cx23885/cx23885-417.c index d44395c..4142c15 100644 --- a/drivers/media/pci/cx23885/cx23885-417.c +++ b/drivers/media/pci/cx23885/cx23885-417.c @@ -865,6 +865,11 @@ static int cx23885_api_cmd(struct cx23885_dev *dev, return err; } +static int cx23885_api_func(void *priv, u32 cmd, int in, int out, u32 data[CX2341X_MBOX_MAX_DATA]) +{ + return cx23885_mbox_func(priv, cmd, in, out, data); +} + static int cx23885_find_mailbox(struct cx23885_dev *dev) { u32 signature[4] = { @@ -1033,12 +1038,12 @@ static void cx23885_codec_settings(struct cx23885_dev *dev) cx23885_api_cmd(dev, CX2341X_ENC_SET_FRAME_SIZE, 2, 0, dev-ts1.height, dev-ts1.width); - dev-mpeg_params.width = dev-ts1.width; - dev-mpeg_params.height = dev-ts1.height; - dev-mpeg_params.is_50hz = + dev-cxhdl.width = dev-ts1.width; + dev-cxhdl.height = dev-ts1.height; + dev-cxhdl.is_50hz = (dev-encodernorm.id V4L2_STD_625_50) != 0; - cx2341x_update(dev, cx23885_mbox_func, NULL, dev-mpeg_params); + cx2341x_handler_setup(dev-cxhdl); cx23885_api_cmd(dev, CX2341X_ENC_MISC, 2, 0, 3, 1); cx23885_api_cmd(dev, CX2341X_ENC_MISC, 2, 0, 4, 1); @@ -1182,36 +1187,6 @@ static struct videobuf_queue_ops cx23885_qops = { /* -- */ -static const u32 *ctrl_classes[] = { - cx2341x_mpeg_ctrls, - NULL -}; - -static int cx23885_queryctrl(struct cx23885_dev *dev, - struct v4l2_queryctrl *qctrl) -{ - qctrl-id = v4l2_ctrl_next(ctrl_classes, qctrl-id); - if (qctrl-id == 0) - return -EINVAL; - - /* MPEG V4L2 controls */ - if (cx2341x_ctrl_query(dev-mpeg_params, qctrl)) - qctrl-flags |= V4L2_CTRL_FLAG_DISABLED; - - return 0; -} - -static int cx23885_querymenu(struct cx23885_dev *dev, - struct v4l2_querymenu *qmenu) -{ - struct v4l2_queryctrl qctrl; - - qctrl.id = qmenu-id; - cx23885_queryctrl(dev, qctrl); - return v4l2_ctrl_query_menu(qmenu, qctrl, - cx2341x_ctrl_get_menu(dev-mpeg_params, qmenu-id)); -} - static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id) { struct cx23885_fh *fh = file-private_data; @@ -1445,55 +1420,6 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) return videobuf_streamoff(fh-mpegq); } -static int vidioc_g_ext_ctrls(struct file *file, void *priv, - struct v4l2_ext_controls *f) -{ - struct cx23885_fh *fh = priv; - struct cx23885_dev *dev = fh-dev; - - if (f-ctrl_class != V4L2_CTRL_CLASS_MPEG) - return -EINVAL; - return cx2341x_ext_ctrls(dev-mpeg_params, 0, f, VIDIOC_G_EXT_CTRLS); -} - -static int vidioc_s_ext_ctrls(struct file *file, void *priv, - struct v4l2_ext_controls *f) -{ - struct cx23885_fh *fh = priv; - struct cx23885_dev *dev = fh-dev; - struct cx2341x_mpeg_params p; - int err; - - if (f-ctrl_class != V4L2_CTRL_CLASS_MPEG) - return -EINVAL; - - p = dev-mpeg_params; - err = cx2341x_ext_ctrls(p, 0, f, VIDIOC_S_EXT_CTRLS); - - if (err == 0) { - err = cx2341x_update(dev, cx23885_mbox_func, - dev-mpeg_params, p); - dev-mpeg_params = p; - } - return err; -} - -static int vidioc_try_ext_ctrls(struct file *file, void *priv, - struct v4l2_ext_controls *f) -{ - struct cx23885_fh *fh = priv; - struct cx23885_dev *dev = fh-dev; - struct cx2341x_mpeg_params p; - int err; - - if (f-ctrl_class != V4L2_CTRL_CLASS_MPEG) - return -EINVAL; - - p = dev-mpeg_params; - err = cx2341x_ext_ctrls(p, 0, f, VIDIOC_TRY_EXT_CTRLS); - return err; -} - static int vidioc_log_status(struct file *file, void *priv) { struct cx23885_fh *fh = priv; @@ -1501,35 +1427,11 @@ static int vidioc_log_status(struct file *file, void *priv) char name[32 + 2]; snprintf(name, sizeof(name), %s/2, dev-name); - printk(KERN_INFO - %s/2: START LOG STATUS \n, - dev-name); call_all(dev, core, log_status); - cx2341x_log_status(dev-mpeg_params, name); - printk(KERN_INFO - %s/2: = END LOG
[PATCHv2 03/20] cx23885: support v4l2_fh and g/s_priority
From: Hans Verkuil hans.verk...@cisco.com Add support for struct v4l2_fh and priority handling. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885-417.c | 5 + drivers/media/pci/cx23885/cx23885-video.c | 6 +- drivers/media/pci/cx23885/cx23885.h | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/cx23885/cx23885-417.c b/drivers/media/pci/cx23885/cx23885-417.c index bf89fc8..b65de33 100644 --- a/drivers/media/pci/cx23885/cx23885-417.c +++ b/drivers/media/pci/cx23885/cx23885-417.c @@ -1550,6 +1550,7 @@ static int vidioc_queryctrl(struct file *file, void *priv, static int mpeg_open(struct file *file) { + struct video_device *vdev = video_devdata(file); struct cx23885_dev *dev = video_drvdata(file); struct cx23885_fh *fh; @@ -1560,6 +1561,7 @@ static int mpeg_open(struct file *file) if (!fh) return -ENOMEM; + v4l2_fh_init(fh-fh, vdev); file-private_data = fh; fh-dev = dev; @@ -1569,6 +1571,7 @@ static int mpeg_open(struct file *file) V4L2_FIELD_INTERLACED, sizeof(struct cx23885_buffer), fh, NULL); + v4l2_fh_add(fh-fh); return 0; } @@ -1601,6 +1604,8 @@ static int mpeg_release(struct file *file) videobuf_read_stop(fh-mpegq); videobuf_mmap_free(fh-mpegq); + v4l2_fh_del(fh-fh); + v4l2_fh_exit(fh-fh); file-private_data = NULL; kfree(fh); diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index 79de4ac..d575bfc 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -883,7 +883,8 @@ static int video_open(struct file *file) if (NULL == fh) return -ENOMEM; - file-private_data = fh; + v4l2_fh_init(fh-fh, vdev); + file-private_data = fh-fh; fh-dev = dev; fh-radio= radio; fh-type = type; @@ -905,6 +906,7 @@ static int video_open(struct file *file) sizeof(struct cx23885_buffer), fh, NULL); + v4l2_fh_add(fh-fh); dprintk(1, post videobuf_queue_init()\n); @@ -1003,6 +1005,8 @@ static int video_release(struct file *file) videobuf_mmap_free(fh-vidq); videobuf_mmap_free(fh-vbiq); + v4l2_fh_del(fh-fh); + v4l2_fh_exit(fh-fh); file-private_data = NULL; kfree(fh); diff --git a/drivers/media/pci/cx23885/cx23885.h b/drivers/media/pci/cx23885/cx23885.h index 0e086c0..de164c9 100644 --- a/drivers/media/pci/cx23885/cx23885.h +++ b/drivers/media/pci/cx23885/cx23885.h @@ -25,6 +25,7 @@ #include linux/slab.h #include media/v4l2-device.h +#include media/v4l2-fh.h #include media/tuner.h #include media/tveeprom.h #include media/videobuf-dma-sg.h @@ -147,6 +148,7 @@ struct cx23885_tvnorm { }; struct cx23885_fh { + struct v4l2_fh fh; struct cx23885_dev *dev; enum v4l2_buf_type type; intradio; -- 2.1.0.rc1 -- 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
[PATCHv2 18/20] cx23885: remove FSF address as per checkpatch
From: Hans Verkuil hans.verk...@cisco.com These addresses are usually out-of-date and the top-level license will always have the right address. So drop it from these sources. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/altera-ci.c | 4 drivers/media/pci/cx23885/altera-ci.h | 4 drivers/media/pci/cx23885/cimax2.c| 4 drivers/media/pci/cx23885/cimax2.h| 4 drivers/media/pci/cx23885/cx23885-417.c | 4 drivers/media/pci/cx23885/cx23885-alsa.c | 4 drivers/media/pci/cx23885/cx23885-av.c| 5 - drivers/media/pci/cx23885/cx23885-av.h| 5 - drivers/media/pci/cx23885/cx23885-cards.c | 6 -- drivers/media/pci/cx23885/cx23885-core.c | 4 drivers/media/pci/cx23885/cx23885-dvb.c | 5 - drivers/media/pci/cx23885/cx23885-f300.c | 4 drivers/media/pci/cx23885/cx23885-i2c.c | 12 drivers/media/pci/cx23885/cx23885-input.c | 5 - drivers/media/pci/cx23885/cx23885-input.h | 5 - drivers/media/pci/cx23885/cx23885-ioctl.c | 4 drivers/media/pci/cx23885/cx23885-ioctl.h | 4 drivers/media/pci/cx23885/cx23885-ir.c| 5 - drivers/media/pci/cx23885/cx23885-ir.h| 5 - drivers/media/pci/cx23885/cx23885-reg.h | 4 drivers/media/pci/cx23885/cx23885-vbi.c | 4 drivers/media/pci/cx23885/cx23885-video.c | 5 - drivers/media/pci/cx23885/cx23885-video.h | 5 - drivers/media/pci/cx23885/cx23885.h | 4 drivers/media/pci/cx23885/cx23888-ir.c| 5 - drivers/media/pci/cx23885/cx23888-ir.h| 5 - drivers/media/pci/cx23885/netup-eeprom.c | 4 drivers/media/pci/cx23885/netup-eeprom.h | 4 drivers/media/pci/cx23885/netup-init.c| 4 drivers/media/pci/cx23885/netup-init.h| 4 30 files changed, 141 deletions(-) diff --git a/drivers/media/pci/cx23885/altera-ci.c b/drivers/media/pci/cx23885/altera-ci.c index f57b333..2bbbf54 100644 --- a/drivers/media/pci/cx23885/altera-ci.c +++ b/drivers/media/pci/cx23885/altera-ci.c @@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* diff --git a/drivers/media/pci/cx23885/altera-ci.h b/drivers/media/pci/cx23885/altera-ci.h index 4998c96..5028f0c 100644 --- a/drivers/media/pci/cx23885/altera-ci.h +++ b/drivers/media/pci/cx23885/altera-ci.h @@ -16,10 +16,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __ALTERA_CI_H #define __ALTERA_CI_H diff --git a/drivers/media/pci/cx23885/cimax2.c b/drivers/media/pci/cx23885/cimax2.c index 16fa7ea..631e4f2 100644 --- a/drivers/media/pci/cx23885/cimax2.c +++ b/drivers/media/pci/cx23885/cimax2.c @@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include cx23885.h diff --git a/drivers/media/pci/cx23885/cimax2.h b/drivers/media/pci/cx23885/cimax2.h index 518744a..565e958 100644 --- a/drivers/media/pci/cx23885/cimax2.h +++ b/drivers/media/pci/cx23885/cimax2.h @@ -17,10 +17,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef CIMAX2_H diff --git a/drivers/media/pci/cx23885/cx23885-417.c b/drivers/media/pci/cx23885/cx23885-417.c index a17238a..f1ef901 100644 --- a/drivers/media/pci/cx23885/cx23885-417.c +++ b/drivers/media/pci/cx23885/cx23885-417.c @@ -18,10 +18,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include linux/module.h diff --git a/drivers/media/pci/cx23885/cx23885-alsa.c b/drivers/media/pci/cx23885/cx23885-alsa.c index cbbf9ad..1b162ee 100644 --- a/drivers/media/pci/cx23885/cx23885-alsa.c +++
[PATCHv2 12/20] cx23885: fmt, width and height are global, not per-fh.
From: Hans Verkuil hans.verk...@cisco.com Move these fields from cx23885_fh to cx23885_dev. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885-video.c | 125 +++--- drivers/media/pci/cx23885/cx23885.h | 8 +- 2 files changed, 34 insertions(+), 99 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index a68ab59..3dcee0a 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -77,77 +77,14 @@ MODULE_PARM_DESC(vid_limit, capture memory limit in megabytes); /* static data */ #define FORMAT_FLAGS_PACKED 0x01 -#if 0 static struct cx23885_fmt formats[] = { { - .name = 8 bpp, gray, - .fourcc = V4L2_PIX_FMT_GREY, - .depth= 8, - .flags= FORMAT_FLAGS_PACKED, - }, { - .name = 15 bpp RGB, le, - .fourcc = V4L2_PIX_FMT_RGB555, - .depth= 16, - .flags= FORMAT_FLAGS_PACKED, - }, { - .name = 15 bpp RGB, be, - .fourcc = V4L2_PIX_FMT_RGB555X, - .depth= 16, - .flags= FORMAT_FLAGS_PACKED, - }, { - .name = 16 bpp RGB, le, - .fourcc = V4L2_PIX_FMT_RGB565, - .depth= 16, - .flags= FORMAT_FLAGS_PACKED, - }, { - .name = 16 bpp RGB, be, - .fourcc = V4L2_PIX_FMT_RGB565X, - .depth= 16, - .flags= FORMAT_FLAGS_PACKED, - }, { - .name = 24 bpp RGB, le, - .fourcc = V4L2_PIX_FMT_BGR24, - .depth= 24, - .flags= FORMAT_FLAGS_PACKED, - }, { - .name = 32 bpp RGB, le, - .fourcc = V4L2_PIX_FMT_BGR32, - .depth= 32, - .flags= FORMAT_FLAGS_PACKED, - }, { - .name = 32 bpp RGB, be, - .fourcc = V4L2_PIX_FMT_RGB32, - .depth= 32, - .flags= FORMAT_FLAGS_PACKED, - }, { - .name = 4:2:2, packed, YUYV, - .fourcc = V4L2_PIX_FMT_YUYV, - .depth= 16, - .flags= FORMAT_FLAGS_PACKED, - }, { - .name = 4:2:2, packed, UYVY, - .fourcc = V4L2_PIX_FMT_UYVY, - .depth= 16, - .flags= FORMAT_FLAGS_PACKED, - }, -}; -#else -static struct cx23885_fmt formats[] = { - { -#if 0 - .name = 4:2:2, packed, UYVY, - .fourcc = V4L2_PIX_FMT_UYVY, - .depth= 16, - .flags= FORMAT_FLAGS_PACKED, - }, { -#endif .name = 4:2:2, packed, YUYV, .fourcc = V4L2_PIX_FMT_YUYV, .depth= 16, .flags= FORMAT_FLAGS_PACKED, } }; -#endif static struct cx23885_fmt *format_by_fourcc(unsigned int fourcc) { @@ -156,13 +93,6 @@ static struct cx23885_fmt *format_by_fourcc(unsigned int fourcc) for (i = 0; i ARRAY_SIZE(formats); i++) if (formats[i].fourcc == fourcc) return formats+i; - - printk(KERN_ERR %s(%c%c%c%c) NOT FOUND\n, __func__, - (fourcc 0xff), - ((fourcc 8) 0xff), - ((fourcc 16) 0xff), - ((fourcc 24) 0xff) - ); return NULL; } @@ -502,8 +432,9 @@ static int buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size) { struct cx23885_fh *fh = q-priv_data; + struct cx23885_dev *dev = fh-dev; - *size = fh-fmt-depth*fh-width*fh-height 3; + *size = (dev-fmt-depth * dev-width * dev-height) 3; if (0 == *count) *count = 32; if (*size * *count vid_limit * 1024 * 1024) @@ -523,21 +454,23 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, struct videobuf_dmabuf *dma = videobuf_to_dma(buf-vb); int field_tff; - BUG_ON(NULL == fh-fmt); - if (fh-width 48 || fh-width norm_maxw(dev-tvnorm) || - fh-height 32 || fh-height norm_maxh(dev-tvnorm)) + if (WARN_ON(NULL == dev-fmt)) + return -EINVAL; + + if (dev-width 48 || dev-width norm_maxw(dev-tvnorm) || + dev-height 32 || dev-height norm_maxh(dev-tvnorm)) return -EINVAL; - buf-vb.size = (fh-width * fh-height * fh-fmt-depth) 3; + buf-vb.size = (dev-width * dev-height * dev-fmt-depth) 3; if (0 != buf-vb.baddrbuf-vb.bsize buf-vb.size) return -EINVAL; - if (buf-fmt != fh-fmt|| -
[PATCHv2 16/20] cx23885: fix field handling
From: Hans Verkuil hans.verk...@cisco.com Add missing SEQ_BT/TB support, bottom field is first for all 60 Hz formats, not just NTSC, restore an overwritten field value and initialize dev-field correctly. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885-video.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index 16fcdfc..ff45417 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -356,7 +356,7 @@ static int buffer_prepare(struct vb2_buffer *vb) buf-bpl, 0, dev-height); break; case V4L2_FIELD_INTERLACED: - if (dev-tvnorm V4L2_STD_NTSC) + if (dev-tvnorm V4L2_STD_525_60) /* NTSC or */ field_tff = 1; else @@ -563,6 +563,8 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, maxh = maxh / 2; break; case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: break; default: field = V4L2_FIELD_INTERLACED; @@ -602,6 +604,8 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, v4l2_fill_mbus_format(mbus_fmt, f-fmt.pix, V4L2_MBUS_FMT_FIXED); call_all(dev, video, s_mbus_fmt, mbus_fmt); v4l2_fill_pix_format(f-fmt.pix, mbus_fmt); + /* s_mbus_fmt overwrites f-fmt.pix.field, restore it */ + f-fmt.pix.field = dev-field; return 0; } @@ -1144,6 +1148,7 @@ int cx23885_video_register(struct cx23885_dev *dev) dev-tvnorm = V4L2_STD_NTSC_M; dev-fmt = format_by_fourcc(V4L2_PIX_FMT_YUYV); + dev-field = V4L2_FIELD_INTERLACED; dev-width = norm_maxw(dev-tvnorm); dev-height = norm_maxh(dev-tvnorm); -- 2.1.0.rc1 -- 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
[PATCHv2 01/20] cx23885: fix querycap
From: Hans Verkuil hans.verk...@cisco.com Set device_caps to fix the v4l2-compliance QUERYCAP complaints. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885-video.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index 91e4cb4..2666ac4 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -1146,19 +1146,22 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { + struct video_device *vdev = video_devdata(file); struct cx23885_dev *dev = ((struct cx23885_fh *)priv)-dev; strcpy(cap-driver, cx23885); strlcpy(cap-card, cx23885_boards[dev-board].name, sizeof(cap-card)); sprintf(cap-bus_info, PCIe:%s, pci_name(dev-pci)); - cap-capabilities = - V4L2_CAP_VIDEO_CAPTURE | - V4L2_CAP_READWRITE | - V4L2_CAP_STREAMING | - V4L2_CAP_VBI_CAPTURE; + cap-device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; if (dev-tuner_type != TUNER_ABSENT) - cap-capabilities |= V4L2_CAP_TUNER; + cap-device_caps |= V4L2_CAP_TUNER; + if (vdev-vfl_type == VFL_TYPE_VBI) + cap-device_caps |= V4L2_CAP_VBI_CAPTURE; + else + cap-device_caps |= V4L2_CAP_VIDEO_CAPTURE; + cap-capabilities = cap-device_caps | V4L2_CAP_VBI_CAPTURE | + V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_DEVICE_CAPS; return 0; } -- 2.1.0.rc1 -- 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
[PATCHv2 04/20] cx23885: use core locking, switch to unlocked_ioctl.
From: Hans Verkuil hans.verk...@cisco.com Enable core locking which allows us to safely switch to unlocked_ioctl. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885-417.c | 5 ++-- drivers/media/pci/cx23885/cx23885-video.c | 43 +++ 2 files changed, 12 insertions(+), 36 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-417.c b/drivers/media/pci/cx23885/cx23885-417.c index b65de33..395f7a9 100644 --- a/drivers/media/pci/cx23885/cx23885-417.c +++ b/drivers/media/pci/cx23885/cx23885-417.c @@ -1235,9 +1235,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id) dev-encodernorm = cx23885_tvnorms[i]; /* Have the drier core notify the subdevices */ - mutex_lock(dev-lock); cx23885_set_tvnorm(dev, id); - mutex_unlock(dev-lock); return 0; } @@ -1661,7 +1659,7 @@ static struct v4l2_file_operations mpeg_fops = { .read = mpeg_read, .poll = mpeg_poll, .mmap = mpeg_mmap, - .ioctl = video_ioctl2, + .unlocked_ioctl = video_ioctl2, }; static const struct v4l2_ioctl_ops mpeg_ioctl_ops = { @@ -1770,6 +1768,7 @@ int cx23885_417_register(struct cx23885_dev *dev) dev-v4l_device = cx23885_video_dev_alloc(tsport, dev-pci, cx23885_mpeg_template, mpeg); video_set_drvdata(dev-v4l_device, dev); + dev-v4l_device-lock = dev-lock; err = video_register_device(dev-v4l_device, VFL_TYPE_GRABBER, -1); if (err 0) { diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index d575bfc..ba93e29 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -345,6 +345,7 @@ static struct video_device *cx23885_vdev_init(struct cx23885_dev *dev, *vfd = *template; vfd-v4l2_dev = dev-v4l2_dev; vfd-release = video_device_release; + vfd-lock = dev-lock; snprintf(vfd-name, sizeof(vfd-name), %s (%s), cx23885_boards[dev-board].name, type); video_set_drvdata(vfd, dev); @@ -381,17 +382,14 @@ static int res_get(struct cx23885_dev *dev, struct cx23885_fh *fh, return 1; /* is it free? */ - mutex_lock(dev-lock); if (dev-resources bit) { /* no, someone else uses it */ - mutex_unlock(dev-lock); return 0; } /* it's free, grab it */ fh-resources |= bit; dev-resources |= bit; dprintk(1, res: get %d\n, bit); - mutex_unlock(dev-lock); return 1; } @@ -411,11 +409,9 @@ static void res_free(struct cx23885_dev *dev, struct cx23885_fh *fh, BUG_ON((fh-resources bits) != bits); dprintk(1, %s()\n, __func__); - mutex_lock(dev-lock); fh-resources = ~bits; dev-resources = ~bits; dprintk(1, res: put %d\n, bits); - mutex_unlock(dev-lock); } int cx23885_flatiron_write(struct cx23885_dev *dev, u8 reg, u8 data) @@ -1272,9 +1268,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms) struct cx23885_dev *dev = ((struct cx23885_fh *)priv)-dev; dprintk(1, %s()\n, __func__); - mutex_lock(dev-lock); cx23885_set_tvnorm(dev, tvnorms); - mutex_unlock(dev-lock); return 0; } @@ -1364,13 +1358,11 @@ int cx23885_set_input(struct file *file, void *priv, unsigned int i) if (INPUT(i)-type == 0) return -EINVAL; - mutex_lock(dev-lock); cx23885_video_mux(dev, i); /* By default establish the default audio input for the card also */ /* Caller is free to use VIDIOC_S_AUDIO to override afterwards */ cx23885_audio_mux(dev, i); - mutex_unlock(dev-lock); return 0; } @@ -1544,7 +1536,6 @@ static int cx23885_set_freq(struct cx23885_dev *dev, const struct v4l2_frequency if (unlikely(f-tuner != 0)) return -EINVAL; - mutex_lock(dev-lock); dev-freq = f-frequency; /* I need to mute audio here */ @@ -1561,8 +1552,6 @@ static int cx23885_set_freq(struct cx23885_dev *dev, const struct v4l2_frequency ctrl.value = 0; cx23885_set_control(dev, ctrl); - mutex_unlock(dev-lock); - return 0; } @@ -1580,7 +1569,6 @@ static int cx23885_set_freq_via_ops(struct cx23885_dev *dev, .frequency = f-frequency }; - mutex_lock(dev-lock); dev-freq = f-frequency; /* I need to mute audio here */ @@ -1594,7 +1582,6 @@ static int cx23885_set_freq_via_ops(struct cx23885_dev *dev, vfe = videobuf_dvb_get_frontend(dev-ts2.frontends, 1); if (!vfe) { - mutex_unlock(dev-lock); return -EINVAL; } @@ -1619,8 +1606,6 @@ static int
[PATCHv2 07/20] cx23885: fix format colorspace compliance error
From: Hans Verkuil hans.verk...@cisco.com Fix v4l2-compliance failure relating to formatting. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885-video.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index 116ce34..ad02912 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -913,6 +913,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, (f-fmt.pix.width * fh-fmt-depth) 3; f-fmt.pix.sizeimage = f-fmt.pix.height * f-fmt.pix.bytesperline; + f-fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; return 0; } @@ -957,6 +958,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, (f-fmt.pix.width * fmt-depth) 3; f-fmt.pix.sizeimage = f-fmt.pix.height * f-fmt.pix.bytesperline; + f-fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; return 0; } -- 2.1.0.rc1 -- 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
[PATCHv2 17/20] cx23885: fix weird sizes.
From: Hans Verkuil hans.verk...@cisco.com These values make no sense. All SDTV standards have the same width. This seems to be copied from the cx88 driver. Just drop these weird values. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885.h b/drivers/media/pci/cx23885/cx23885.h index 99a5fe0..f542ced 100644 --- a/drivers/media/pci/cx23885/cx23885.h +++ b/drivers/media/pci/cx23885/cx23885.h @@ -610,15 +610,15 @@ extern int cx23885_risc_databuffer(struct pci_dev *pci, static inline unsigned int norm_maxw(v4l2_std_id norm) { - return (norm (V4L2_STD_MN ~V4L2_STD_PAL_Nc)) ? 720 : 768; + return 720; } static inline unsigned int norm_maxh(v4l2_std_id norm) { - return (norm V4L2_STD_625_50) ? 576 : 480; + return (norm V4L2_STD_525_60) ? 480 : 576; } static inline unsigned int norm_swidth(v4l2_std_id norm) { - return (norm (V4L2_STD_MN ~V4L2_STD_PAL_Nc)) ? 754 : 922; + return 754; } -- 2.1.0.rc1 -- 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
[PATCHv2 02/20] cx23885: fix audio input handling
From: Hans Verkuil hans.verk...@cisco.com Fix a bunch of v4l2-compliance errors relating to audio input handling. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885-video.c | 31 --- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index 2666ac4..79de4ac 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -1153,7 +1153,7 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(cap-card, cx23885_boards[dev-board].name, sizeof(cap-card)); sprintf(cap-bus_info, PCIe:%s, pci_name(dev-pci)); - cap-device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; + cap-device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING | V4L2_CAP_AUDIO; if (dev-tuner_type != TUNER_ABSENT) cap-device_caps |= V4L2_CAP_TUNER; if (vdev-vfl_type == VFL_TYPE_VBI) @@ -1302,16 +1302,16 @@ int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i) i-index = n; i-type = V4L2_INPUT_TYPE_CAMERA; strcpy(i-name, iname[INPUT(n)-type]); + i-std = CX23885_NORMS; if ((CX23885_VMUX_TELEVISION == INPUT(n)-type) || (CX23885_VMUX_CABLE == INPUT(n)-type)) { i-type = V4L2_INPUT_TYPE_TUNER; - i-std = CX23885_NORMS; + i-audioset = 4; + } else { + /* Two selectable audio inputs for non-tv inputs */ + i-audioset = 3; } - /* Two selectable audio inputs for non-tv inputs */ - if (INPUT(n)-type != CX23885_VMUX_TELEVISION) - i-audioset = 0x3; - if (dev-input == n) { /* enum'd input matches our configured input. * Ask the video decoder to process the call @@ -1397,19 +1397,19 @@ static int cx23885_query_audinput(struct file *file, void *priv, static const char *iname[] = { [0] = Baseband L/R 1, [1] = Baseband L/R 2, + [2] = TV, }; unsigned int n; dprintk(1, %s()\n, __func__); n = i-index; - if (n = 2) + if (n = 3) return -EINVAL; memset(i, 0, sizeof(*i)); i-index = n; strcpy(i-name, iname[n]); - i-capability = V4L2_AUDCAP_STEREO; - i-mode = V4L2_AUDMODE_AVL; + i-capability = V4L2_AUDCAP_STEREO; return 0; } @@ -1425,7 +1425,11 @@ static int vidioc_g_audinput(struct file *file, void *priv, { struct cx23885_dev *dev = ((struct cx23885_fh *)priv)-dev; - i-index = dev-audinput; + if ((CX23885_VMUX_TELEVISION == INPUT(dev-input)-type) || + (CX23885_VMUX_CABLE == INPUT(dev-input)-type)) + i-index = 2; + else + i-index = dev-audinput; dprintk(1, %s(input=%d)\n, __func__, i-index); return cx23885_query_audinput(file, priv, i); @@ -1435,7 +1439,12 @@ static int vidioc_s_audinput(struct file *file, void *priv, const struct v4l2_audio *i) { struct cx23885_dev *dev = ((struct cx23885_fh *)priv)-dev; - if (i-index = 2) + + if ((CX23885_VMUX_TELEVISION == INPUT(dev-input)-type) || + (CX23885_VMUX_CABLE == INPUT(dev-input)-type)) { + return i-index != 2 ? -EINVAL : 0; + } + if (i-index 1) return -EINVAL; dprintk(1, %s(%d)\n, __func__, i-index); -- 2.1.0.rc1 -- 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
[PATCHv2 09/20] cx23885: drop radio-related dead code
From: Hans Verkuil hans.verk...@cisco.com Currently no radio device nodes are ever created, so remove the dead radio code. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885-video.c | 15 +++ drivers/media/pci/cx23885/cx23885.h | 3 --- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index 9bb19fd..50694c6 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -49,15 +49,12 @@ MODULE_LICENSE(GPL); static unsigned int video_nr[] = {[0 ... (CX23885_MAXBOARDS - 1)] = UNSET }; static unsigned int vbi_nr[] = {[0 ... (CX23885_MAXBOARDS - 1)] = UNSET }; -static unsigned int radio_nr[] = {[0 ... (CX23885_MAXBOARDS - 1)] = UNSET }; module_param_array(video_nr, int, NULL, 0444); module_param_array(vbi_nr, int, NULL, 0444); -module_param_array(radio_nr, int, NULL, 0444); MODULE_PARM_DESC(video_nr, video device numbers); MODULE_PARM_DESC(vbi_nr, vbi device numbers); -MODULE_PARM_DESC(radio_nr, radio device numbers); static unsigned int video_debug; module_param(video_debug, int, 0644); @@ -727,7 +724,6 @@ static int video_open(struct file *file) struct cx23885_dev *dev = video_drvdata(file); struct cx23885_fh *fh; enum v4l2_buf_type type = 0; - int radio = 0; switch (vdev-vfl_type) { case VFL_TYPE_GRABBER: @@ -736,13 +732,10 @@ static int video_open(struct file *file) case VFL_TYPE_VBI: type = V4L2_BUF_TYPE_VBI_CAPTURE; break; - case VFL_TYPE_RADIO: - radio = 1; - break; } - dprintk(1, open dev=%s radio=%d type=%s\n, - video_device_node_name(vdev), radio, v4l2_type_names[type]); + dprintk(1, open dev=%s type=%s\n, + video_device_node_name(vdev), v4l2_type_names[type]); /* allocate + initialize per filehandle data */ fh = kzalloc(sizeof(*fh), GFP_KERNEL); @@ -752,7 +745,6 @@ static int video_open(struct file *file) v4l2_fh_init(fh-fh, vdev); file-private_data = fh-fh; fh-dev = dev; - fh-radio= radio; fh-type = type; fh-width= 320; fh-height = 240; @@ -1333,8 +1325,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, if (dev-tuner_type == TUNER_ABSENT) return -EINVAL; - /* f-type = fh-radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; */ - f-type = fh-radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; + f-type = V4L2_TUNER_ANALOG_TV; f-frequency = dev-freq; call_all(dev, tuner, g_frequency, f); diff --git a/drivers/media/pci/cx23885/cx23885.h b/drivers/media/pci/cx23885/cx23885.h index 2d57af7..94ab000 100644 --- a/drivers/media/pci/cx23885/cx23885.h +++ b/drivers/media/pci/cx23885/cx23885.h @@ -144,7 +144,6 @@ struct cx23885_fh { struct v4l2_fh fh; struct cx23885_dev *dev; enum v4l2_buf_type type; - intradio; u32resources; /* video overlay */ @@ -413,7 +412,6 @@ struct cx23885_dev { unsigned int tuner_bus; unsigned int radio_type; unsigned char radio_addr; - unsigned int has_radio; struct v4l2_subdev *sd_cx25840; struct work_struct cx25840_work; @@ -431,7 +429,6 @@ struct cx23885_dev { u32freq; struct video_device*video_dev; struct video_device*vbi_dev; - struct video_device*radio_dev; struct cx23885_dmaqueuevidq; struct cx23885_dmaqueuevbiq; -- 2.1.0.rc1 -- 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
[PATCHv2 10/20] cx23885: drop type field from struct cx23885_fh
From: Hans Verkuil hans.verk...@cisco.com This information is available elsewhere as well. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885-video.c | 89 ++- drivers/media/pci/cx23885/cx23885.h | 1 - 2 files changed, 40 insertions(+), 50 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index 50694c6..a68ab59 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -692,28 +692,31 @@ static struct videobuf_queue_ops cx23885_video_qops = { .buf_release = buffer_release, }; -static struct videobuf_queue *get_queue(struct cx23885_fh *fh) +static struct videobuf_queue *get_queue(struct file *file) { - switch (fh-type) { - case V4L2_BUF_TYPE_VIDEO_CAPTURE: + struct video_device *vdev = video_devdata(file); + struct cx23885_fh *fh = file-private_data; + + switch (vdev-vfl_type) { + case VFL_TYPE_GRABBER: return fh-vidq; - case V4L2_BUF_TYPE_VBI_CAPTURE: + case VFL_TYPE_VBI: return fh-vbiq; default: - BUG(); + WARN_ON(1); return NULL; } } -static int get_resource(struct cx23885_fh *fh) +static int get_resource(u32 type) { - switch (fh-type) { + switch (type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: return RESOURCE_VIDEO; case V4L2_BUF_TYPE_VBI_CAPTURE: return RESOURCE_VBI; default: - BUG(); + WARN_ON(1); return 0; } } @@ -723,19 +726,9 @@ static int video_open(struct file *file) struct video_device *vdev = video_devdata(file); struct cx23885_dev *dev = video_drvdata(file); struct cx23885_fh *fh; - enum v4l2_buf_type type = 0; - switch (vdev-vfl_type) { - case VFL_TYPE_GRABBER: - type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - break; - case VFL_TYPE_VBI: - type = V4L2_BUF_TYPE_VBI_CAPTURE; - break; - } - - dprintk(1, open dev=%s type=%s\n, - video_device_node_name(vdev), v4l2_type_names[type]); + dprintk(1, open dev=%s\n, + video_device_node_name(vdev)); /* allocate + initialize per filehandle data */ fh = kzalloc(sizeof(*fh), GFP_KERNEL); @@ -745,7 +738,6 @@ static int video_open(struct file *file) v4l2_fh_init(fh-fh, vdev); file-private_data = fh-fh; fh-dev = dev; - fh-type = type; fh-width= 320; fh-height = 240; fh-fmt = format_by_fourcc(V4L2_PIX_FMT_YUYV); @@ -774,28 +766,29 @@ static int video_open(struct file *file) static ssize_t video_read(struct file *file, char __user *data, size_t count, loff_t *ppos) { + struct video_device *vdev = video_devdata(file); struct cx23885_fh *fh = file-private_data; - switch (fh-type) { - case V4L2_BUF_TYPE_VIDEO_CAPTURE: + switch (vdev-vfl_type) { + case VFL_TYPE_GRABBER: if (res_locked(fh-dev, RESOURCE_VIDEO)) return -EBUSY; return videobuf_read_one(fh-vidq, data, count, ppos, file-f_flags O_NONBLOCK); - case V4L2_BUF_TYPE_VBI_CAPTURE: + case VFL_TYPE_VBI: if (!res_get(fh-dev, fh, RESOURCE_VBI)) return -EBUSY; return videobuf_read_stream(fh-vbiq, data, count, ppos, 1, file-f_flags O_NONBLOCK); default: - BUG(); - return 0; + return -EINVAL; } } static unsigned int video_poll(struct file *file, struct poll_table_struct *wait) { + struct video_device *vdev = video_devdata(file); struct cx23885_fh *fh = file-private_data; struct cx23885_buffer *buf; unsigned long req_events = poll_requested_events(wait); @@ -808,7 +801,7 @@ static unsigned int video_poll(struct file *file, if (!(req_events (POLLIN | POLLRDNORM))) return rc; - if (V4L2_BUF_TYPE_VBI_CAPTURE == fh-type) { + if (vdev-vfl_type == VFL_TYPE_VBI) { if (!res_get(fh-dev, fh, RESOURCE_VBI)) return rc | POLLERR; return rc | videobuf_poll_stream(file, fh-vbiq, wait); @@ -884,9 +877,7 @@ static int video_release(struct file *file) static int video_mmap(struct file *file, struct vm_area_struct *vma) { - struct cx23885_fh *fh = file-private_data; - - return videobuf_mmap_mapper(get_queue(fh), vma); + return videobuf_mmap_mapper(get_queue(file), vma); } /* -- */ @@ -1019,73 +1010,73 @@ static int
[PATCHv2 05/20] cx23885: convert to the control framework
From: Hans Verkuil hans.verk...@cisco.com This is part 1, converting the uncompressed video/vbi nodes to use the control framework. The next patch converts the compressed video node as well. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885-417.c | 20 --- drivers/media/pci/cx23885/cx23885-core.c | 17 ++- drivers/media/pci/cx23885/cx23885-video.c | 246 +- drivers/media/pci/cx23885/cx23885.h | 12 +- 4 files changed, 51 insertions(+), 244 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-417.c b/drivers/media/pci/cx23885/cx23885-417.c index 395f7a9..d44395c 100644 --- a/drivers/media/pci/cx23885/cx23885-417.c +++ b/drivers/media/pci/cx23885/cx23885-417.c @@ -1313,22 +1313,6 @@ static int vidioc_s_frequency(struct file *file, void *priv, return cx23885_set_frequency(file, priv, f); } -static int vidioc_g_ctrl(struct file *file, void *priv, - struct v4l2_control *ctl) -{ - struct cx23885_dev *dev = ((struct cx23885_fh *)priv)-dev; - - return cx23885_get_control(dev, ctl); -} - -static int vidioc_s_ctrl(struct file *file, void *priv, - struct v4l2_control *ctl) -{ - struct cx23885_dev *dev = ((struct cx23885_fh *)priv)-dev; - - return cx23885_set_control(dev, ctl); -} - static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { @@ -1672,8 +1656,6 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = { .vidioc_s_tuner = vidioc_s_tuner, .vidioc_g_frequency = vidioc_g_frequency, .vidioc_s_frequency = vidioc_s_frequency, - .vidioc_s_ctrl = vidioc_s_ctrl, - .vidioc_g_ctrl = vidioc_g_ctrl, .vidioc_querycap = vidioc_querycap, .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, .vidioc_g_fmt_vid_cap= vidioc_g_fmt_vid_cap, @@ -1689,8 +1671,6 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = { .vidioc_s_ext_ctrls = vidioc_s_ext_ctrls, .vidioc_try_ext_ctrls= vidioc_try_ext_ctrls, .vidioc_log_status = vidioc_log_status, - .vidioc_querymenu= vidioc_querymenu, - .vidioc_queryctrl= vidioc_queryctrl, #ifdef CONFIG_VIDEO_ADV_DEBUG .vidioc_g_chip_info = cx23885_g_chip_info, .vidioc_g_register = cx23885_g_register, diff --git a/drivers/media/pci/cx23885/cx23885-core.c b/drivers/media/pci/cx23885/cx23885-core.c index edcd79d..075b28e 100644 --- a/drivers/media/pci/cx23885/cx23885-core.c +++ b/drivers/media/pci/cx23885/cx23885-core.c @@ -2087,6 +2087,7 @@ static int cx23885_initdev(struct pci_dev *pci_dev, const struct pci_device_id *pci_id) { struct cx23885_dev *dev; + struct v4l2_ctrl_handler *hdl; int err; dev = kzalloc(sizeof(*dev), GFP_KERNEL); @@ -2097,6 +2098,14 @@ static int cx23885_initdev(struct pci_dev *pci_dev, if (err 0) goto fail_free; + hdl = dev-ctrl_handler; + v4l2_ctrl_handler_init(hdl, 6); + if (hdl-error) { + err = hdl-error; + goto fail_ctrl; + } + dev-v4l2_dev.ctrl_handler = hdl; + /* Prepare to handle notifications from subdevices */ cx23885_v4l2_dev_notify_init(dev); @@ -2104,12 +2113,12 @@ static int cx23885_initdev(struct pci_dev *pci_dev, dev-pci = pci_dev; if (pci_enable_device(pci_dev)) { err = -EIO; - goto fail_unreg; + goto fail_ctrl; } if (cx23885_dev_setup(dev) 0) { err = -EINVAL; - goto fail_unreg; + goto fail_ctrl; } /* print pci info */ @@ -2157,7 +2166,8 @@ static int cx23885_initdev(struct pci_dev *pci_dev, fail_irq: cx23885_dev_unregister(dev); -fail_unreg: +fail_ctrl: + v4l2_ctrl_handler_free(hdl); v4l2_device_unregister(dev-v4l2_dev); fail_free: kfree(dev); @@ -2180,6 +2190,7 @@ static void cx23885_finidev(struct pci_dev *pci_dev) free_irq(pci_dev-irq, dev); cx23885_dev_unregister(dev); + v4l2_ctrl_handler_free(dev-ctrl_handler); v4l2_device_unregister(v4l2_dev); kfree(dev); } diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index ba93e29..090d48b 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -35,6 +35,7 @@ #include cx23885-video.h #include media/v4l2-common.h #include media/v4l2-ioctl.h +#include media/v4l2-event.h #include cx23885-ioctl.h #include tuner-xc2028.h @@ -170,119 +171,6 @@ static struct cx23885_fmt *format_by_fourcc(unsigned int fourcc) /* --- */ -static const struct v4l2_queryctrl no_ctl = { - .name
[GIT PULL FOR v3.18] cx23885: convert to the latest frameworks, including vb2.
This pull request converts the cx23885 driver to the latest V4L2 core frameworks, removing about 1000 lines in the process. It now passes the v4l2-compliance tests and, frankly, feels much more robust. I have tested this with my HVR-1800 board with video (compressed and uncompressed), vbi, dvb and alsa. As usual, the vb2 conversion is a beast of a patch. But the vb2 conversion affected video, vbi, dvb and alsa, so it's all over the place. And it is all or nothing. See the commit log of that patch for some more information. It also changed the risc code to simplify the code and to get rid of all the timeouts that were copied-and-pasted from cx88. If anyone knows of a reason for these timeouts, please let me know. I have tried to separate the risc code changes from the vb2 changes, but that was impossible to get to work with vb1. Regards, Hans The following changes since commit 0f3bf3dc1ca394a8385079a5653088672b65c5c4: [media] cx23885: fix UNSET/TUNER_ABSENT confusion (2014-08-01 15:30:59 -0300) are available in the git repository at: git://linuxtv.org/hverkuil/media_tree.git cx23b for you to fetch changes up to 295df1a7021a09ccaa3a478acbb4ed1e9fb4a023: cx23885: Add busy checks before changing formats (2014-08-14 11:43:36 +0200) Hans Verkuil (21): vb2: fix wrong gfp flags cx23885: fix querycap cx23885: fix audio input handling cx23885: support v4l2_fh and g/s_priority cx23885: use core locking, switch to unlocked_ioctl. cx23885: convert to the control framework cx23885: convert 417 to the control framework cx23885: fix format colorspace compliance error cx23885: map invalid fields to a valid field. cx23885: drop radio-related dead code cx23885: drop type field from struct cx23885_fh cx23885: drop unused clip fields from struct cx23885_fh cx23885: fmt, width and height are global, not per-fh. cx23885: drop videobuf abuse in cx23885-alsa cx23885: use video_drvdata to get cx23885_dev pointer cx23885: convert to vb2 cx23885: fix field handling cx23885: fix weird sizes. cx23885: remove FSF address as per checkpatch cx23885: remove btcx-risc dependency cx23885: Add busy checks before changing formats drivers/media/pci/cx23885/Kconfig |5 +- drivers/media/pci/cx23885/Makefile |1 - drivers/media/pci/cx23885/altera-ci.c |8 +- drivers/media/pci/cx23885/altera-ci.h |4 - drivers/media/pci/cx23885/cimax2.c |4 - drivers/media/pci/cx23885/cimax2.h |4 - drivers/media/pci/cx23885/cx23885-417.c| 501 ++-- drivers/media/pci/cx23885/cx23885-alsa.c | 109 +-- drivers/media/pci/cx23885/cx23885-av.c |5 - drivers/media/pci/cx23885/cx23885-av.h |5 - drivers/media/pci/cx23885/cx23885-cards.c |6 - drivers/media/pci/cx23885/cx23885-core.c | 362 --- drivers/media/pci/cx23885/cx23885-dvb.c| 136 ++--- drivers/media/pci/cx23885/cx23885-f300.c |4 - drivers/media/pci/cx23885/cx23885-i2c.c| 12 - drivers/media/pci/cx23885/cx23885-input.c |5 - drivers/media/pci/cx23885/cx23885-input.h |5 - drivers/media/pci/cx23885/cx23885-ioctl.c | 10 +- drivers/media/pci/cx23885/cx23885-ioctl.h |4 - drivers/media/pci/cx23885/cx23885-ir.c |5 - drivers/media/pci/cx23885/cx23885-ir.h |5 - drivers/media/pci/cx23885/cx23885-reg.h|4 - drivers/media/pci/cx23885/cx23885-vbi.c| 282 +- drivers/media/pci/cx23885/cx23885-video.c | 1294 +- drivers/media/pci/cx23885/cx23885-video.h |5 - drivers/media/pci/cx23885/cx23885.h| 127 +++- drivers/media/pci/cx23885/cx23888-ir.c |5 - drivers/media/pci/cx23885/cx23888-ir.h |5 - drivers/media/pci/cx23885/netup-eeprom.c |4 - drivers/media/pci/cx23885/netup-eeprom.h |4 - drivers/media/pci/cx23885/netup-init.c |4 - drivers/media/pci/cx23885/netup-init.h |4 - drivers/media/v4l2-core/videobuf2-dma-sg.c |2 +- 33 files changed, 952 insertions(+), 1988 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: 3.15.6 USB issue with pwc cam
Hi, On 08/12/2014 05:29 PM, Udo van den Heuvel wrote: On 2014-08-12 17:07, Hans de Goede wrote: lspci -nn # lspci -nn 00:00.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) Processor Root Complex [1022:1410] 00:00.2 IOMMU [0806]: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) I/O Memory Management Unit [1022:1419] 00:01.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Trinity [Radeon HD 7660D] [1002:9901] 00:01.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Trinity HDMI Audio Controller [1002:9902] 00:04.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) Processor Root Port [1022:1414] 00:07.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) Processor Root Port [1022:1417] 00:10.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] FCH USB XHCI Controller [1022:7812] (rev 03) 00:10.1 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] FCH USB XHCI Controller [1022:7812] (rev 03) 00:11.0 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] [1022:7801] (rev 40) 00:12.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] FCH USB OHCI Controller [1022:7807] (rev 11) 00:12.2 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller [1022:7808] (rev 11) 00:13.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] FCH USB OHCI Controller [1022:7807] (rev 11) 00:13.2 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller [1022:7808] (rev 11) 00:14.0 SMBus [0c05]: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller [1022:780b] (rev 14) 00:14.2 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] FCH Azalia Controller [1022:780d] (rev 01) 00:14.3 ISA bridge [0601]: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge [1022:780e] (rev 11) 00:14.4 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] FCH PCI Bridge [1022:780f] (rev 40) 00:14.5 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] FCH USB OHCI Controller [1022:7809] (rev 11) 00:18.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) Processor Function 0 [1022:1400] 00:18.1 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) Processor Function 1 [1022:1401] 00:18.2 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) Processor Function 2 [1022:1402] 00:18.3 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) Processor Function 3 [1022:1403] 00:18.4 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) Processor Function 4 [1022:1404] 00:18.5 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) Processor Function 5 [1022:1405] 01:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 06) 02:00.0 USB controller [0c03]: Etron Technology, Inc. EJ168 USB 3.0 Host Controller [1b6f:7023] (rev 01) 03:06.0 Serial controller [0700]: MosChip Semiconductor Technology Ltd. PCI 9835 Multi-I/O Controller [9710:9835] (rev 01) Hmm, so you've both an amd xhci and an etron xhci chip. Do you know to which xhci the port you're trying to use belongs ? And can you try with a different usb-3 port ? I've access to an Etron EJ168 controller, since I specifically bought one to try and deal with the fact that there quality is, erm, somewhat lacking. So if this is with the Etron controller I can try to reproduce. Note I'm about to drop of the internet as I'm going on vacation, I'll be back Mon 25 Aug. Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Fixed reference counting int saa716x drivers
Hi Matthias, This is an out-of-tree driver, so until that driver is merged into the kernel I can't do anything with this patch. Sorry, Hans On 08/11/2014 04:50 PM, Matthias Waechter wrote: Without this patch applied, saa716x_core takes all reference counts and leaves the specific modules like saa716x_budget without a use tick. This leads to the situation that while the application is running, saa716x_budget still has a reference count of zero and can be unloaded, which freezes the kernel immediately. It is necessary for dvb_register_adapter to get a reference to the real adapter-specific module to avoid this case. --- drivers/media/pci/saa716x/saa716x_adap.c| 2 +- drivers/media/pci/saa716x/saa716x_budget.c | 1 + drivers/media/pci/saa716x/saa716x_ff_main.c | 1 + drivers/media/pci/saa716x/saa716x_hybrid.c | 1 + drivers/media/pci/saa716x/saa716x_priv.h| 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/saa716x/saa716x_adap.c b/drivers/media/pci/saa716x/saa716x_adap.c index 0550a4d..807ab83 100644 --- a/drivers/media/pci/saa716x/saa716x_adap.c +++ b/drivers/media/pci/saa716x/saa716x_adap.c @@ -99,7 +99,7 @@ int saa716x_dvb_init(struct saa716x_dev *saa716x) dprintk(SAA716x_DEBUG, 1, dvb_register_adapter); if (dvb_register_adapter(saa716x_adap-dvb_adapter, SAA716x dvb adapter, -THIS_MODULE, +saa716x-module, saa716x-pdev-dev, adapter_nr) 0) { diff --git a/drivers/media/pci/saa716x/saa716x_budget.c b/drivers/media/pci/saa716x/saa716x_budget.c index 9f46c61..c8efc05 100644 --- a/drivers/media/pci/saa716x/saa716x_budget.c +++ b/drivers/media/pci/saa716x/saa716x_budget.c @@ -73,6 +73,7 @@ static int saa716x_budget_pci_probe(struct pci_dev *pdev, const struct pci_devic saa716x-verbose = verbose; saa716x-int_type= int_type; saa716x-pdev= pdev; + saa716x-module = THIS_MODULE; saa716x-config = (struct saa716x_config *) pci_id-driver_data; err = saa716x_pci_init(saa716x); diff --git a/drivers/media/pci/saa716x/saa716x_ff_main.c b/drivers/media/pci/saa716x/saa716x_ff_main.c index 5916c80..04538ab 100644 --- a/drivers/media/pci/saa716x/saa716x_ff_main.c +++ b/drivers/media/pci/saa716x/saa716x_ff_main.c @@ -986,6 +986,7 @@ static int saa716x_ff_pci_probe(struct pci_dev *pdev, const struct pci_device_id saa716x-verbose = verbose; saa716x-int_type= int_type; saa716x-pdev= pdev; + saa716x-module = THIS_MODULE; saa716x-config = (struct saa716x_config *) pci_id-driver_data; err = saa716x_pci_init(saa716x); diff --git a/drivers/media/pci/saa716x/saa716x_hybrid.c b/drivers/media/pci/saa716x/saa716x_hybrid.c index 0229419..f76b123 100644 --- a/drivers/media/pci/saa716x/saa716x_hybrid.c +++ b/drivers/media/pci/saa716x/saa716x_hybrid.c @@ -63,6 +63,7 @@ static int saa716x_hybrid_pci_probe(struct pci_dev *pdev, const struct pci_devic saa716x-verbose = verbose; saa716x-int_type= int_type; saa716x-pdev= pdev; + saa716x-module = THIS_MODULE; saa716x-config = (struct saa716x_config *) pci_id-driver_data; err = saa716x_pci_init(saa716x); diff --git a/drivers/media/pci/saa716x/saa716x_priv.h b/drivers/media/pci/saa716x/saa716x_priv.h index 0c9355b..1665fe3 100644 --- a/drivers/media/pci/saa716x/saa716x_priv.h +++ b/drivers/media/pci/saa716x/saa716x_priv.h @@ -127,6 +127,7 @@ struct saa716x_adapter { struct saa716x_dev { struct saa716x_config *config; struct pci_dev *pdev; + struct module *module; int num; /* device count */ int verbose; -- 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 v4 00/21] LED / flash API integration
On 08/14/2014 07:03 AM, Sakari Ailus wrote: Hi Jacek, On Thu, Aug 07, 2014 at 10:21:14AM +0200, Jacek Anaszewski wrote: On 08/06/2014 08:53 AM, Sakari Ailus wrote: Hi Jacek, On Fri, Jul 11, 2014 at 04:04:03PM +0200, Jacek Anaszewski wrote: ... 1) Who should register V4L2 Flash sub-device? LED Flash Class devices, after introduction of the Flash Manager, are not tightly coupled with any media controller. They are maintained by the Flash Manager and made available for dynamic assignment to any media system they are connected to through multiplexing devices. In the proposed rough solution, when support for V4L2 Flash sub-devices is enabled, there is a v4l2_device created for them to register in. This however implies that V4L2 Flash device will not be available in any media controller, which calls its existence into question. Therefore I'd like to consult possible ways of solving this issue. The option I see is implementing a mechanism for moving V4L2 Flash sub-devices between media controllers. A V4L2 Flash sub-device would initially be assigned to one media system in the relevant device tree binding, but it could be dynamically reassigned to the other one. However I'm not sure if media controller design is prepared for dynamic modifications of its graph and how many modifications in the existing drivers this solution would require. Do you have a use case where you would need to strobe a flash from multiple media devices at different times, or is this entirely theoretical? Typically flash controllers are connected to a single source of hardware strobe (if there's one) since the flash LEDs are in fact mounted next to a specific camera sensor. I took into account such arrangements in response to your message [1], where you were considering configurations like one flash but two cameras, one camera and two flashes. And you also called for proposing generic solution. One flash and two (or more) cameras case is easily conceivable - You even mentioned stereo cameras. One camera and many flashes arrangement might be useful in case of some professional devices which might be designed so that they would be able to apply different scene lighting. I haven't heard about such devices, but as you said such a configuration isn't unthinkable. If this is a real issue the way to solve it would be to have a single media device instead of many. I was considering adding media device, that would be a representation of a flash manager, gathering all the registered flashes. Nonetheless, finally I came to conclusion that a v4l2-device alone should suffice, just to provide a Flash Manager representation allowing for v4l2-flash sub-devices to register in. All the features provided by the media device are useless in case of a set of V4L2 Flash sub-devices. They couldn't have any linkage in such a device. The only benefit from having media device gathering V4L2 Flash devices would be possibility of listing them. Not quite so. The flash is associated to the sensor (and lens) using the group ID in the Media controller. The user space doesn't need to know this association. More complex use cases such as the above may need extensions to the Media controller API. I think that I have unnecessarily complicated the issue. Generally there will be always one media controller created for all camera sensors available in the system. If there is a single media controller then we can easily use async subdev registration API. A media-dev driver would have to parse list of flash device phandles from the ISP device's DT node and register them as async sub-devices. Best Regards, Jacek Anaszewski -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT PULL FOR v3.18] Various fixes
Hi Mauro, Various fixes for v3.18. Please take a good look at the 'videobuf2: fix lockdep warning'. Locking issues are always complex and an extra pair of eyeballs doesn't hurt. I also have been in two minds whether it should go into 3.17 or 3.18, but I think it is better to have it go through a longer test period. But I can be convinced to go for 3.17 as well :-) Regards, Hans The following changes since commit 0f3bf3dc1ca394a8385079a5653088672b65c5c4: [media] cx23885: fix UNSET/TUNER_ABSENT confusion (2014-08-01 15:30:59 -0300) are available in the git repository at: git://linuxtv.org/hverkuil/media_tree.git for-v3.18a for you to fetch changes up to 481a56ce8ef5dc6670ffcd87e58903323d23d0f3: usbtv: add audio support (2014-08-14 12:29:39 +0200) Andreas Ruprecht (1): drivers: media: pci: Makefile: Remove duplicate subdirectory from obj-y Axel Lin (1): saa6752hs: Convert to devm_kzalloc() Dan Carpenter (1): vmalloc_sg: off by one in error handling Federico Simoncelli (1): usbtv: add audio support Geert Uytterhoeven (2): cx25840: Spelling s/compuations/computations/ cx23885: Spelling s/compuations/computations/ Hans Verkuil (3): videobuf2: fix lockdep warning DocBook media: fix order of v4l2_edid fields vb2: use pr_info instead of pr_debug Documentation/DocBook/media/v4l/vidioc-g-edid.xml | 12 +-- drivers/media/i2c/cx25840/cx25840-ir.c| 2 +- drivers/media/i2c/saa6752hs.c | 6 +- drivers/media/pci/Makefile| 1 - drivers/media/pci/cx23885/cx23888-ir.c| 2 +- drivers/media/usb/usbtv/Makefile | 3 +- drivers/media/usb/usbtv/usbtv-audio.c | 384 drivers/media/usb/usbtv/usbtv-core.c | 16 +++- drivers/media/usb/usbtv/usbtv-video.c | 9 +- drivers/media/usb/usbtv/usbtv.h | 21 - drivers/media/v4l2-core/videobuf-dma-sg.c | 6 +- drivers/media/v4l2-core/videobuf2-core.c | 58 include/media/videobuf2-core.h| 2 + 13 files changed, 460 insertions(+), 62 deletions(-) create mode 100644 drivers/media/usb/usbtv/usbtv-audio.c -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [media-workshop] [ANNOUNCE] Linux Kernel Media mini-summit on Oct, 16-17 in Düsseldorf, Germany
Hi Mauro, On Wednesday 13 August 2014 10:14:11 Mauro Carvalho Chehab wrote: Hi, As there are still too things to be discussed in order to improve media stuff, and most of the developers nowadays are located in Europe and usually go to ELCE, we're scheduling a two day mini-summit in Düsseldorf, Germany, on Thrusday/Friday. There is a perfect opportunity to discuss the media Kernel-Userspace API improvements that are required for newer devices to work. So, we hope to have there the major Kernel contributors to the media subsystem, and some people working on userspace, in order to be sure that we'll match the needs required on userspace. In order to properly organize the event, I need the name of the developers interested on joining us, plus the themes proposed for discussions. As usual, we'll be using the media-works...@linuxtv.org ML for specific discussions about that, so the ones interested on participate are requested to subscribe it. Thank you for organizing this. I'll be in Düsseldorf the whole week for ELCE and LPC, and I will need to attend the IOMMU microconference at LPC on Friday the 17th in the afternoon. Apart from that I'm interested and happy to participate in the media mini-summit. Regarding topics, I'm thinking about runtime reconfiguration of pipelines, but it's a bit early to tell. I have customer demand for that, but no exact schedule yet, so it might be too early. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GIT PULL FOR v3.18] tw68: add new driver for tw68xx grabber cards
Em Thu, 14 Aug 2014 11:32:48 +0200 Hans Verkuil hansv...@cisco.com escreveu: The following changes since commit 0f3bf3dc1ca394a8385079a5653088672b65c5c4: [media] cx23885: fix UNSET/TUNER_ABSENT confusion (2014-08-01 15:30:59 -0300) are available in the git repository at: git://linuxtv.org/hverkuil/media_tree.git tw68 for you to fetch changes up to 64889b98f7ed20ab630a47eff4a5847c3aa0555e: MAINTAINERS: add tw68 entry (2014-08-10 10:36:10 +0200) Hans Verkuil (2): tw68: add support for Techwell tw68xx PCI grabber boards NACK. This patch breaks compilation with allyesconfig: drivers/media/pci/tw68/tw68-video.c: In function 'tw68_s_input': drivers/media/pci/tw68/tw68-video.c:751:2: warning: comparison of unsigned expression 0 is always false [-Wtype-limits] if (i 0 || i = TW68_INPUT_MAX) ^ drivers/media/pci/tw68/built-in.o:(.bss+0x568): multiple definition of `video_debug' drivers/media/pci/saa7134/built-in.o:(.bss+0x3b08): first defined here make[2]: *** [drivers/media/pci/built-in.o] Error 1 make[1]: *** [drivers/media/pci] Error 2 make: *** [_module_drivers/media] Error 2 PS.: It likely makes sense to also rename video_debug at saa7134, or to get rid of both, in favor of using dynamic debug printks. 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 for v3.17] videobuf2-dma-sg: fix for wrong GFP mask to sg_alloc_table_from_pages
Hi Hans, Please re-check your git pull request for this tree: git://linuxtv.org/hverkuil/media_tree.git cx23b You added this patch, but with a different (bad) subject, without any comments, without c/c to stable and without Marek's ack. So, there's something wrong there. Also, I think we should first merge this patch for 3.17 before pulling the cx23885 patchset. Regards, Mauro Em Fri, 01 Aug 2014 14:18:50 +0200 Hans Verkuil hverk...@xs4all.nl escreveu: sg_alloc_table_from_pages() only allocates a sg_table, so it should just use GFP_KERNEL, not gfp_flags. If gfp_flags contains __GFP_DMA32 then mm/sl[au]b.c will call BUG_ON: [ 358.027515] [ cut here ] [ 358.027546] kernel BUG at mm/slub.c:1416! [ 358.027558] invalid opcode: [#1] PREEMPT SMP [ 358.027576] Modules linked in: mt2131 s5h1409 tda8290 tuner cx25840 cx23885 btcx_risc altera_ci tda18271 altera_stapl videobuf2_dvb tveeprom cx2341x videobuf2_dma_sg dvb_core rc_core videobuf2_memops videobuf2_core nouveau zr36067 videocodec v4l2_common videodev media x86_pkg_temp_thermal cfbfillrect cfbimgblt cfbcopyarea ttm drm_kms_helper processor button isci [ 358.027712] CPU: 19 PID: 3654 Comm: cat Not tainted 3.16.0-rc6-telek #167 [ 358.027723] Hardware name: ASUSTeK COMPUTER INC. Z9PE-D8 WS/Z9PE-D8 WS, BIOS 5404 02/10/2014 [ 358.027741] task: 880897c7d960 ti: 88089b4d4000 task.ti: 88089b4d4000 [ 358.027753] RIP: 0010:[81196040] [81196040] new_slab+0x280/0x320 [ 358.027776] RSP: 0018:88089b4d7ae8 EFLAGS: 00010002 [ 358.027787] RAX: 880897c7d960 RBX: RCX: 88089b4d7b50 [ 358.027798] RDX: RSI: 0004 RDI: 88089f803b00 [ 358.027809] RBP: 88089b4d7bb8 R08: R09: 000100400040 [ 358.027821] R10: 1600 R11: 88109bc02c40 R12: 0001 [ 358.027832] R13: 88089f8000c0 R14: 88089f803b00 R15: 8810bfcf4be0 [ 358.027845] FS: 7f83fe5c0700() GS:8810bfce() knlGS: [ 358.027858] CS: 0010 DS: ES: CR0: 80050033 [ 358.027868] CR2: 01dfd568 CR3: 001097d5a000 CR4: 000407e0 [ 358.027878] Stack: [ 358.027885] 81198860 8810bfcf4be0 880897c7d960 1b00 [ 358.027905] 880897c7d960 8810bfcf4bf0 [ 358.027924] 00010100 813ef84a 0004 [ 358.027944] Call Trace: [ 358.027956] [81198860] ? __slab_alloc+0x400/0x4e0 [ 358.027973] [813ef84a] ? sg_kmalloc+0x1a/0x30 [ 358.027985] [81198f17] __kmalloc+0x127/0x150 [ 358.027997] [813ef84a] ? sg_kmalloc+0x1a/0x30 [ 358.028009] [813ef84a] sg_kmalloc+0x1a/0x30 [ 358.028023] [813eff84] __sg_alloc_table+0x74/0x180 [ 358.028035] [813ef830] ? sg_kfree+0x20/0x20 [ 358.028048] [813f00af] sg_alloc_table+0x1f/0x60 [ 358.028061] [813f0174] sg_alloc_table_from_pages+0x84/0x1f0 [ 358.028077] [a007c3f9] vb2_dma_sg_alloc+0x159/0x230 [videobuf2_dma_sg] [ 358.028095] [a003d55a] __vb2_queue_alloc+0x10a/0x680 [videobuf2_core] [ 358.028113] [a003e110] __reqbufs.isra.14+0x220/0x3e0 [videobuf2_core] [ 358.028130] [a003e79d] __vb2_init_fileio+0xbd/0x380 [videobuf2_core] [ 358.028147] [a003f563] __vb2_perform_fileio+0x5b3/0x6e0 [videobuf2_core] [ 358.028164] [a003f871] vb2_fop_read+0xb1/0x100 [videobuf2_core] [ 358.028184] [a06dd2e5] v4l2_read+0x65/0xb0 [videodev] [ 358.028198] [811a243f] vfs_read+0x8f/0x170 [ 358.028210] [811a30a1] SyS_read+0x41/0xb0 [ 358.028224] [818f02e9] system_call_fastpath+0x16/0x1b [ 358.028234] Code: 66 90 e9 dc fd ff ff 0f 1f 40 00 41 8b 4d 68 e9 d5 fe ff ff 0f 1f 80 00 00 00 00 f0 41 80 4d 00 40 e9 03 ff ff ff 0f 1f 44 00 00 0f 0b 66 0f 1f 44 00 00 44 89 c6 4c 89 45 d0 e8 0c 82 ff ff 48 [ 358.028415] RIP [81196040] new_slab+0x280/0x320 [ 358.028432] RSP 88089b4d7ae8 [ 358.032208] ---[ end trace 6443240199c706e4 ]--- Signed-off-by: Hans Verkuil hans.verk...@cisco.com Cc: sta...@vger.kernel.org # for v3.13 and up diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c b/drivers/media/v4l2-core/videobuf2-dma-sg.c index adefc31..9b163a4 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-sg.c +++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c @@ -113,7 +113,7 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size, gfp_t gfp_fla goto fail_pages_alloc; ret = sg_alloc_table_from_pages(buf-sg_table, buf-pages, - buf-num_pages, 0, size, gfp_flags); + buf-num_pages, 0, size, GFP_KERNEL); if (ret) goto fail_table_alloc; -- To unsubscribe from
Re: [PATCH for v3.17] videobuf2-dma-sg: fix for wrong GFP mask to sg_alloc_table_from_pages
My apologies, I forgot about that one. I agree, let's wait until the 3.17 fixes are merged and I'll respin this series then. Regards, Hans On 08/14/2014 02:09 PM, Mauro Carvalho Chehab wrote: Hi Hans, Please re-check your git pull request for this tree: git://linuxtv.org/hverkuil/media_tree.git cx23b You added this patch, but with a different (bad) subject, without any comments, without c/c to stable and without Marek's ack. So, there's something wrong there. Also, I think we should first merge this patch for 3.17 before pulling the cx23885 patchset. Regards, Mauro Em Fri, 01 Aug 2014 14:18:50 +0200 Hans Verkuil hverk...@xs4all.nl escreveu: sg_alloc_table_from_pages() only allocates a sg_table, so it should just use GFP_KERNEL, not gfp_flags. If gfp_flags contains __GFP_DMA32 then mm/sl[au]b.c will call BUG_ON: [ 358.027515] [ cut here ] [ 358.027546] kernel BUG at mm/slub.c:1416! [ 358.027558] invalid opcode: [#1] PREEMPT SMP [ 358.027576] Modules linked in: mt2131 s5h1409 tda8290 tuner cx25840 cx23885 btcx_risc altera_ci tda18271 altera_stapl videobuf2_dvb tveeprom cx2341x videobuf2_dma_sg dvb_core rc_core videobuf2_memops videobuf2_core nouveau zr36067 videocodec v4l2_common videodev media x86_pkg_temp_thermal cfbfillrect cfbimgblt cfbcopyarea ttm drm_kms_helper processor button isci [ 358.027712] CPU: 19 PID: 3654 Comm: cat Not tainted 3.16.0-rc6-telek #167 [ 358.027723] Hardware name: ASUSTeK COMPUTER INC. Z9PE-D8 WS/Z9PE-D8 WS, BIOS 5404 02/10/2014 [ 358.027741] task: 880897c7d960 ti: 88089b4d4000 task.ti: 88089b4d4000 [ 358.027753] RIP: 0010:[81196040] [81196040] new_slab+0x280/0x320 [ 358.027776] RSP: 0018:88089b4d7ae8 EFLAGS: 00010002 [ 358.027787] RAX: 880897c7d960 RBX: RCX: 88089b4d7b50 [ 358.027798] RDX: RSI: 0004 RDI: 88089f803b00 [ 358.027809] RBP: 88089b4d7bb8 R08: R09: 000100400040 [ 358.027821] R10: 1600 R11: 88109bc02c40 R12: 0001 [ 358.027832] R13: 88089f8000c0 R14: 88089f803b00 R15: 8810bfcf4be0 [ 358.027845] FS: 7f83fe5c0700() GS:8810bfce() knlGS: [ 358.027858] CS: 0010 DS: ES: CR0: 80050033 [ 358.027868] CR2: 01dfd568 CR3: 001097d5a000 CR4: 000407e0 [ 358.027878] Stack: [ 358.027885] 81198860 8810bfcf4be0 880897c7d960 1b00 [ 358.027905] 880897c7d960 8810bfcf4bf0 [ 358.027924] 00010100 813ef84a 0004 [ 358.027944] Call Trace: [ 358.027956] [81198860] ? __slab_alloc+0x400/0x4e0 [ 358.027973] [813ef84a] ? sg_kmalloc+0x1a/0x30 [ 358.027985] [81198f17] __kmalloc+0x127/0x150 [ 358.027997] [813ef84a] ? sg_kmalloc+0x1a/0x30 [ 358.028009] [813ef84a] sg_kmalloc+0x1a/0x30 [ 358.028023] [813eff84] __sg_alloc_table+0x74/0x180 [ 358.028035] [813ef830] ? sg_kfree+0x20/0x20 [ 358.028048] [813f00af] sg_alloc_table+0x1f/0x60 [ 358.028061] [813f0174] sg_alloc_table_from_pages+0x84/0x1f0 [ 358.028077] [a007c3f9] vb2_dma_sg_alloc+0x159/0x230 [videobuf2_dma_sg] [ 358.028095] [a003d55a] __vb2_queue_alloc+0x10a/0x680 [videobuf2_core] [ 358.028113] [a003e110] __reqbufs.isra.14+0x220/0x3e0 [videobuf2_core] [ 358.028130] [a003e79d] __vb2_init_fileio+0xbd/0x380 [videobuf2_core] [ 358.028147] [a003f563] __vb2_perform_fileio+0x5b3/0x6e0 [videobuf2_core] [ 358.028164] [a003f871] vb2_fop_read+0xb1/0x100 [videobuf2_core] [ 358.028184] [a06dd2e5] v4l2_read+0x65/0xb0 [videodev] [ 358.028198] [811a243f] vfs_read+0x8f/0x170 [ 358.028210] [811a30a1] SyS_read+0x41/0xb0 [ 358.028224] [818f02e9] system_call_fastpath+0x16/0x1b [ 358.028234] Code: 66 90 e9 dc fd ff ff 0f 1f 40 00 41 8b 4d 68 e9 d5 fe ff ff 0f 1f 80 00 00 00 00 f0 41 80 4d 00 40 e9 03 ff ff ff 0f 1f 44 00 00 0f 0b 66 0f 1f 44 00 00 44 89 c6 4c 89 45 d0 e8 0c 82 ff ff 48 [ 358.028415] RIP [81196040] new_slab+0x280/0x320 [ 358.028432] RSP 88089b4d7ae8 [ 358.032208] ---[ end trace 6443240199c706e4 ]--- Signed-off-by: Hans Verkuil hans.verk...@cisco.com Cc: sta...@vger.kernel.org # for v3.13 and up diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c b/drivers/media/v4l2-core/videobuf2-dma-sg.c index adefc31..9b163a4 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-sg.c +++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c @@ -113,7 +113,7 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size, gfp_t gfp_fla goto fail_pages_alloc; ret = sg_alloc_table_from_pages(buf-sg_table, buf-pages, - buf-num_pages, 0, size, gfp_flags); +
[PATCHv2 2/2] MAINTAINERS: add tw68 entry
From: Hans Verkuil hans.verk...@cisco.com Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- MAINTAINERS | 8 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 4cdf24c..2b06a8e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9199,6 +9199,14 @@ T: git git://linuxtv.org/media_tree.git S: Odd fixes F: drivers/media/usb/tm6000/ +TW68 VIDEO4LINUX DRIVER +M: Hans Verkuil hverk...@xs4all.nl +L: linux-media@vger.kernel.org +T: git git://linuxtv.org/media_tree.git +W: http://linuxtv.org +S: Odd Fixes +F: drivers/media/pci/tw68/ + TPM DEVICE DRIVER M: Peter Huewe peterhu...@gmx.de M: Ashley Lai ash...@ashleylai.com -- 2.1.0.rc1 -- 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
[PATCHv2 0/2] Add driver for tw68xx PCI grabber boards
Changes since v1: - Fix warning that Mauro found (and why didn't I get that warning?) - Replaced dprintk by either dev_dbg or dev_err. But this means I need to retest the driver when I'm back from the LinuxCon to be sure I'm not getting any spurious DMA errors. Add support for the tw68 driver. The driver has been out-of-tree for many years on gitorious: https://gitorious.org/tw68/tw68-v2 I have refactored and ported that driver to the latest V4L2 core frameworks. Tested with my Techwell tw6805a and tw6816 grabber boards. Note that there is no audio support. If anyone is interested in adding alsa support, please contact me. It's definitely doable. These devices are quite common and people are using the out-of-tree driver, so it would be nice to have proper support for this in the mainline kernel. Regards, Hans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv2 1/2] tw68: add support for Techwell tw68xx PCI grabber boards
From: Hans Verkuil hans.verk...@cisco.com Add support for the tw68 driver. The driver has been out-of-tree for many years on gitorious: https://gitorious.org/tw68/tw68-v2 I have refactored and ported that driver to the latest V4L2 core frameworks. Tested with my Techwell tw6805a and tw6816 grabber boards. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/Kconfig |1 + drivers/media/pci/Makefile |1 + drivers/media/pci/tw68/Kconfig | 10 + drivers/media/pci/tw68/Makefile |3 + drivers/media/pci/tw68/tw68-core.c | 448 +++ drivers/media/pci/tw68/tw68-reg.h | 195 +++ drivers/media/pci/tw68/tw68-risc.c | 230 drivers/media/pci/tw68/tw68-video.c | 1062 +++ drivers/media/pci/tw68/tw68.h | 233 9 files changed, 2183 insertions(+) create mode 100644 drivers/media/pci/tw68/Kconfig create mode 100644 drivers/media/pci/tw68/Makefile create mode 100644 drivers/media/pci/tw68/tw68-core.c create mode 100644 drivers/media/pci/tw68/tw68-reg.h create mode 100644 drivers/media/pci/tw68/tw68-risc.c create mode 100644 drivers/media/pci/tw68/tw68-video.c create mode 100644 drivers/media/pci/tw68/tw68.h diff --git a/drivers/media/pci/Kconfig b/drivers/media/pci/Kconfig index 5c16c9c..9332807 100644 --- a/drivers/media/pci/Kconfig +++ b/drivers/media/pci/Kconfig @@ -20,6 +20,7 @@ source drivers/media/pci/ivtv/Kconfig source drivers/media/pci/zoran/Kconfig source drivers/media/pci/saa7146/Kconfig source drivers/media/pci/solo6x10/Kconfig +source drivers/media/pci/tw68/Kconfig endif if MEDIA_ANALOG_TV_SUPPORT || MEDIA_DIGITAL_TV_SUPPORT diff --git a/drivers/media/pci/Makefile b/drivers/media/pci/Makefile index e5b53fb..e7f8060 100644 --- a/drivers/media/pci/Makefile +++ b/drivers/media/pci/Makefile @@ -22,6 +22,7 @@ obj-$(CONFIG_VIDEO_CX88) += cx88/ obj-$(CONFIG_VIDEO_BT848) += bt8xx/ obj-$(CONFIG_VIDEO_SAA7134) += saa7134/ obj-$(CONFIG_VIDEO_SAA7164) += saa7164/ +obj-$(CONFIG_VIDEO_TW68) += tw68/ obj-$(CONFIG_VIDEO_MEYE) += meye/ obj-$(CONFIG_STA2X11_VIP) += sta2x11/ obj-$(CONFIG_VIDEO_SOLO6X10) += solo6x10/ diff --git a/drivers/media/pci/tw68/Kconfig b/drivers/media/pci/tw68/Kconfig new file mode 100644 index 000..5425ba1 --- /dev/null +++ b/drivers/media/pci/tw68/Kconfig @@ -0,0 +1,10 @@ +config VIDEO_TW68 + tristate Techwell tw68x Video For Linux + depends on VIDEO_DEV PCI VIDEO_V4L2 + select I2C_ALGOBIT + select VIDEOBUF2_DMA_SG + ---help--- + Support for Techwell tw68xx based frame grabber boards. + + To compile this driver as a module, choose M here: the + module will be called tw68. diff --git a/drivers/media/pci/tw68/Makefile b/drivers/media/pci/tw68/Makefile new file mode 100644 index 000..3d02f28 --- /dev/null +++ b/drivers/media/pci/tw68/Makefile @@ -0,0 +1,3 @@ +tw68-objs := tw68-core.o tw68-video.o tw68-risc.o + +obj-$(CONFIG_VIDEO_TW68) += tw68.o diff --git a/drivers/media/pci/tw68/tw68-core.c b/drivers/media/pci/tw68/tw68-core.c new file mode 100644 index 000..2158646 --- /dev/null +++ b/drivers/media/pci/tw68/tw68-core.c @@ -0,0 +1,448 @@ +/* + * tw68-core.c + * Core functions for the Techwell 68xx driver + * + * Much of this code is derived from the cx88 and sa7134 drivers, which + * were in turn derived from the bt87x driver. The original work was by + * Gerd Knorr; more recently the code was enhanced by Mauro Carvalho Chehab, + * Hans Verkuil, Andy Walls and many others. Their work is gratefully + * acknowledged. Full credit goes to them - any problems within this code + * are mine. + * + * Copyright (C) 2009 William M. Brack wbr...@mmm.com.hk + * + * Refactored and updated to the latest v4l core frameworks: + * + * Copyright (C) 2014 Hans Verkuil hverk...@xs4all.nl + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include linux/init.h +#include linux/list.h +#include linux/module.h +#include linux/kernel.h +#include linux/slab.h +#include linux/kmod.h +#include linux/sound.h +#include linux/interrupt.h +#include linux/delay.h +#include linux/mutex.h +#include linux/dma-mapping.h +#include linux/pm.h + +#include media/v4l2-dev.h +#include tw68.h +#include tw68-reg.h + +MODULE_DESCRIPTION(v4l2 driver module for tw6800 based video capture cards); +MODULE_AUTHOR(William M. Brack wbr...@mmm.com.hk); +MODULE_LICENSE(GPL); + +static unsigned int latency = UNSET; +module_param(latency, int,
Re: 3.15.6 USB issue with pwc cam
On 08/12/2014 07:31 PM, Udo van den Heuvel wrote: On 2014-08-12 18:27, Hans Verkuil wrote: It was a bit confusing, but he has two problems: one pwc, one (the warning) for uvc. Indeed. Do I need to provide additional info to help find the root cause(s)? Could you help me take a look at the xhci side. The error: [53009.847233] xhci_hcd :02:00.0: ERROR: unexpected command completion code 0x11. Means we got a parameter error, one of the values the xhci driver sends to the controller in the configure endpoint command is invalid. This error is causing the Not enough bandwidth entries in the log as well, not really a bandwidth error. Can you add dynamic debugging, mount debugfs, and do: echo -n 'module xhci_hcd =p' /sys/kernel/debug/dynamic_debug/control Then plug in your usb, and send me the output. It should print out the whole input context (all parameters) used in the configure endpoint command -Mathias -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[linuxtv-media:devel 489/499] drivers/media/usb/as102/as10x_cmd.c:45:40: sparse: incorrect type in assignment (different base types)
tree: git://linuxtv.org/media_tree.git devel head: e5c52c1b504e5620c16b4b87f9c092f719f4706e commit: af2f93f4f7f45050e042c62041e3dce06d3099c3 [489/499] [media] as102: promote it out of staging reproduce: make C=1 CF=-D__CHECK_ENDIAN__ sparse warnings: (new ones prefixed by ) drivers/media/usb/as102/as10x_cmd.c:45:40: sparse: incorrect type in assignment (different base types) drivers/media/usb/as102/as10x_cmd.c:45:40:expected unsigned short [unsigned] [usertype] proc_id drivers/media/usb/as102/as10x_cmd.c:45:40:got restricted __le16 [usertype] noident drivers/media/usb/as102/as10x_cmd.c:86:41: sparse: incorrect type in assignment (different base types) drivers/media/usb/as102/as10x_cmd.c:86:41:expected unsigned short [unsigned] [usertype] proc_id drivers/media/usb/as102/as10x_cmd.c:86:41:got restricted __le16 [usertype] noident drivers/media/usb/as102/as10x_cmd.c:128:41: sparse: incorrect type in assignment (different base types) drivers/media/usb/as102/as10x_cmd.c:128:41:expected unsigned short [unsigned] [usertype] proc_id drivers/media/usb/as102/as10x_cmd.c:128:41:got restricted __le16 [usertype] noident drivers/media/usb/as102/as10x_cmd.c:129:43: sparse: incorrect type in assignment (different base types) drivers/media/usb/as102/as10x_cmd.c:129:43:expected unsigned int [unsigned] [usertype] freq drivers/media/usb/as102/as10x_cmd.c:129:43:got restricted __le32 [usertype] noident drivers/media/usb/as102/as10x_cmd.c:183:48: sparse: incorrect type in assignment (different base types) drivers/media/usb/as102/as10x_cmd.c:183:48:expected unsigned short [unsigned] [usertype] proc_id drivers/media/usb/as102/as10x_cmd.c:183:48:got restricted __le16 [usertype] noident drivers/media/usb/as102/as10x_cmd.c:207:17: sparse: cast to restricted __le16 drivers/media/usb/as102/as10x_cmd.c:208:24: sparse: cast to restricted __le16 drivers/media/usb/as102/as10x_cmd.c:209:24: sparse: cast to restricted __le16 drivers/media/usb/as102/as10x_cmd.c:235:48: sparse: incorrect type in assignment (different base types) drivers/media/usb/as102/as10x_cmd.c:235:48:expected unsigned short [unsigned] [usertype] proc_id drivers/media/usb/as102/as10x_cmd.c:235:48:got restricted __le16 [usertype] noident drivers/media/usb/as102/as10x_cmd.c:267:25: sparse: cast to restricted __le16 drivers/media/usb/as102/as10x_cmd.c:294:48: sparse: incorrect type in assignment (different base types) drivers/media/usb/as102/as10x_cmd.c:294:48:expected unsigned short [unsigned] [usertype] proc_id drivers/media/usb/as102/as10x_cmd.c:294:48:got restricted __le16 [usertype] noident drivers/media/usb/as102/as10x_cmd.c:318:17: sparse: cast to restricted __le32 drivers/media/usb/as102/as10x_cmd.c:320:17: sparse: cast to restricted __le32 drivers/media/usb/as102/as10x_cmd.c:322:17: sparse: cast to restricted __le32 drivers/media/usb/as102/as10x_cmd.c:324:17: sparse: cast to restricted __le16 drivers/media/usb/as102/as10x_cmd.c:354:48: sparse: incorrect type in assignment (different base types) drivers/media/usb/as102/as10x_cmd.c:354:48:expected unsigned short [unsigned] [usertype] proc_id drivers/media/usb/as102/as10x_cmd.c:354:48:got restricted __le16 [usertype] noident drivers/media/usb/as102/as10x_cmd.c:392:29: sparse: incorrect type in assignment (different base types) drivers/media/usb/as102/as10x_cmd.c:392:29:expected unsigned short [unsigned] [usertype] req_id drivers/media/usb/as102/as10x_cmd.c:392:29:got restricted __le16 [usertype] noident drivers/media/usb/as102/as10x_cmd.c:393:27: sparse: incorrect type in assignment (different base types) drivers/media/usb/as102/as10x_cmd.c:393:27:expected unsigned short [unsigned] [usertype] prog drivers/media/usb/as102/as10x_cmd.c:393:27:got restricted __le16 [usertype] noident drivers/media/usb/as102/as10x_cmd.c:394:30: sparse: incorrect type in assignment (different base types) drivers/media/usb/as102/as10x_cmd.c:394:30:expected unsigned short [unsigned] [usertype] version drivers/media/usb/as102/as10x_cmd.c:394:30:got restricted __le16 [usertype] noident drivers/media/usb/as102/as10x_cmd.c:395:31: sparse: incorrect type in assignment (different base types) drivers/media/usb/as102/as10x_cmd.c:395:31:expected unsigned short [unsigned] [usertype] data_len drivers/media/usb/as102/as10x_cmd.c:395:31:got restricted __le16 [usertype] noident drivers/media/usb/as102/as10x_cmd.c:413:14: sparse: cast to restricted __le16 -- drivers/media/usb/as102/as10x_cmd_stream.c:45:47: sparse: incorrect type in assignment (different base types) drivers/media/usb/as102/as10x_cmd_stream.c:45:47:expected unsigned short [unsigned] [usertype] proc_id drivers/media/usb/as102/as10x_cmd_stream.c:45:47:got restricted __le16 [usertype] noident
NOTICE
Top of the day to you all from the Head Quarter Western Union and Money Gram Transfer. Dear User This is to inform all our users that the high rate of scam has been coming so much and we are receive complains from beach Transfer office that our customer has been send money to differed country as a result of scam. So we have decided to upgrade our system for security reasons. Dear customer for security reason if any payment is been made via Western Union or MoneyGram you are been advise to send us the scan copy of the payment slip and the information of the payment for verification. For Western Union or MoneyGarm verification: Name of sender: Name of Receiver: Address of sender: Address of Receiver: Amount sent: MTCN (Money Transfer Control Number) OR Reference number: Country from which payment was made: Country from which payment is about to be receive: Test question and answer if any required: Once this informations are receive verification take place and we will get back to you as soon as the payment is been verified. Thanks for your understanding and we look forward to serve you better. -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
cron job: media_tree daily build: WARNINGS
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: Fri Aug 15 04:00:19 CEST 2014 git branch: test git hash: 0f3bf3dc1ca394a8385079a5653088672b65c5c4 gcc version:i686-linux-gcc (GCC) 4.9.1 sparse version: v0.5.0-16-g1db35d0 host hardware: x86_64 host os:3.16-0.slh.2-amd64 linux-git-arm-at91: OK linux-git-arm-davinci: OK linux-git-arm-exynos: OK linux-git-arm-mx: OK linux-git-arm-omap: OK linux-git-arm-omap1: OK linux-git-arm-pxa: OK linux-git-blackfin: OK linux-git-i686: OK linux-git-m32r: OK linux-git-mips: OK linux-git-powerpc64: OK linux-git-sh: OK linux-git-x86_64: OK linux-2.6.32.27-i686: OK linux-2.6.33.7-i686: OK linux-2.6.34.7-i686: OK linux-2.6.35.9-i686: OK linux-2.6.36.4-i686: OK linux-2.6.37.6-i686: OK linux-2.6.38.8-i686: OK linux-2.6.39.4-i686: OK linux-3.0.60-i686: OK linux-3.1.10-i686: OK linux-3.2.37-i686: OK linux-3.3.8-i686: OK linux-3.4.27-i686: OK linux-3.5.7-i686: OK linux-3.6.11-i686: OK linux-3.7.4-i686: OK linux-3.8-i686: OK linux-3.9.2-i686: OK linux-3.10.1-i686: OK linux-3.11.1-i686: OK linux-3.12.23-i686: OK linux-3.13.11-i686: OK linux-3.14.9-i686: OK linux-3.15.2-i686: OK linux-3.16-i686: OK linux-2.6.32.27-x86_64: OK linux-2.6.33.7-x86_64: OK linux-2.6.34.7-x86_64: OK linux-2.6.35.9-x86_64: OK linux-2.6.36.4-x86_64: OK linux-2.6.37.6-x86_64: OK linux-2.6.38.8-x86_64: OK linux-2.6.39.4-x86_64: OK linux-3.0.60-x86_64: OK linux-3.1.10-x86_64: OK linux-3.2.37-x86_64: OK linux-3.3.8-x86_64: OK linux-3.4.27-x86_64: OK linux-3.5.7-x86_64: OK linux-3.6.11-x86_64: OK linux-3.7.4-x86_64: OK linux-3.8-x86_64: OK linux-3.9.2-x86_64: OK linux-3.10.1-x86_64: OK linux-3.11.1-x86_64: OK linux-3.12.23-x86_64: OK linux-3.13.11-x86_64: OK linux-3.14.9-x86_64: OK linux-3.15.2-x86_64: OK linux-3.16-x86_64: OK apps: WARNINGS spec-git: OK sparse: WARNINGS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Friday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Friday.tar.bz2 The Media Infrastructure API from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/media.html -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH/RFC v4 00/21] LED / flash API integration
On Thu, Aug 14, 2014 at 12:35:05PM +0200, Jacek Anaszewski wrote: On 08/14/2014 07:03 AM, Sakari Ailus wrote: Hi Jacek, On Thu, Aug 07, 2014 at 10:21:14AM +0200, Jacek Anaszewski wrote: On 08/06/2014 08:53 AM, Sakari Ailus wrote: Hi Jacek, On Fri, Jul 11, 2014 at 04:04:03PM +0200, Jacek Anaszewski wrote: ... 1) Who should register V4L2 Flash sub-device? LED Flash Class devices, after introduction of the Flash Manager, are not tightly coupled with any media controller. They are maintained by the Flash Manager and made available for dynamic assignment to any media system they are connected to through multiplexing devices. In the proposed rough solution, when support for V4L2 Flash sub-devices is enabled, there is a v4l2_device created for them to register in. This however implies that V4L2 Flash device will not be available in any media controller, which calls its existence into question. Therefore I'd like to consult possible ways of solving this issue. The option I see is implementing a mechanism for moving V4L2 Flash sub-devices between media controllers. A V4L2 Flash sub-device would initially be assigned to one media system in the relevant device tree binding, but it could be dynamically reassigned to the other one. However I'm not sure if media controller design is prepared for dynamic modifications of its graph and how many modifications in the existing drivers this solution would require. Do you have a use case where you would need to strobe a flash from multiple media devices at different times, or is this entirely theoretical? Typically flash controllers are connected to a single source of hardware strobe (if there's one) since the flash LEDs are in fact mounted next to a specific camera sensor. I took into account such arrangements in response to your message [1], where you were considering configurations like one flash but two cameras, one camera and two flashes. And you also called for proposing generic solution. One flash and two (or more) cameras case is easily conceivable - You even mentioned stereo cameras. One camera and many flashes arrangement might be useful in case of some professional devices which might be designed so that they would be able to apply different scene lighting. I haven't heard about such devices, but as you said such a configuration isn't unthinkable. If this is a real issue the way to solve it would be to have a single media device instead of many. I was considering adding media device, that would be a representation of a flash manager, gathering all the registered flashes. Nonetheless, finally I came to conclusion that a v4l2-device alone should suffice, just to provide a Flash Manager representation allowing for v4l2-flash sub-devices to register in. All the features provided by the media device are useless in case of a set of V4L2 Flash sub-devices. They couldn't have any linkage in such a device. The only benefit from having media device gathering V4L2 Flash devices would be possibility of listing them. Not quite so. The flash is associated to the sensor (and lens) using the group ID in the Media controller. The user space doesn't need to know this association. More complex use cases such as the above may need extensions to the Media controller API. I think that I have unnecessarily complicated the issue. Generally there will be always one media controller created for all camera sensors available in the system. If there is a single media controller then we can easily use async subdev registration API. A media-dev driver would have to parse list of flash device phandles from the ISP device's DT node and register them as async sub-devices. Currently the media device is created by a driver which is most of the time the ISP driver on embedded systems. This driver is also responsible for registering the flash device (nodes) to the media device. So will is the word, I think. -- Sakari Ailus e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html