Re: [PATCH/RFC v3 5/5] media: Add registration helpers for V4L2 flash sub-devices
Hi Sakari, Thanks for the review. On 04/16/2014 08:21 PM, Sakari Ailus wrote: Hi Jacek, Thanks for the update! [...] +static inline enum led_brightness v4l2_flash_intensity_to_led_brightness( + struct led_ctrl *config, + u32 intensity) Fits on a single line. +{ + return intensity / config-step; Shouldn't you first decrement the minimum before the division? Brightness level 0 means that led is off. Let's consider following case: intensity - 15625 config-step - 15625 intensity / config-step = 1 (the lowest possible current level) +} + +static inline u32 v4l2_flash_led_brightness_to_intensity( + struct led_ctrl *config, + enum led_brightness brightness) +{ + return brightness * config-step; And do the opposite here? +} + +static int v4l2_flash_g_volatile_ctrl(struct v4l2_ctrl *c) + +{ + struct v4l2_flash *v4l2_flash = v4l2_ctrl_to_v4l2_flash(c); + struct led_classdev *led_cdev = v4l2_flash-led_cdev; + struct led_flash *flash = led_cdev-flash; + struct v4l2_flash_ctrl *ctrl = v4l2_flash-ctrl; + u32 fault; + int ret; + + switch (c-id) { + case V4L2_CID_FLASH_TORCH_INTENSITY: + if (ctrl-led_mode-val == V4L2_FLASH_LED_MODE_TORCH) { + ret = v4l2_call_flash_op(brightness_update, led_cdev); + if (ret 0) + return ret; + ctrl-torch_intensity-val = + v4l2_flash_led_brightness_to_intensity( + led_cdev-brightness_ctrl, + led_cdev-brightness); + } + return 0; + case V4L2_CID_FLASH_INTENSITY: + ret = v4l2_call_flash_op(flash_brightness_update, led_cdev); + if (ret 0) + return ret; + /* no conversion is needed */ + c-val = flash-brightness.val; + return 0; + case V4L2_CID_FLASH_INDICATOR_INTENSITY: + ret = v4l2_call_flash_op(indicator_brightness_update, led_cdev); + if (ret 0) + return ret; + /* no conversion is needed */ + c-val = flash-indicator_brightness-val; + return 0; + case V4L2_CID_FLASH_STROBE_STATUS: + ret = v4l2_call_flash_op(strobe_get, led_cdev); + if (ret 0) + return ret; + c-val = !!ret; + return 0; + case V4L2_CID_FLASH_FAULT: + /* led faults map directly to V4L2 flash faults */ + ret = v4l2_call_flash_op(fault_get, led_cdev, fault); + if (!ret) The return value seems to come all the way from regmap_read() and the bus related implementatio. I would just consider negative values errors, as above. I think that ret would be returned if it wasn't equal to 0. But indeed it should be done the same way as for the other cases. + c-val = fault; + return ret; + default: + return -EINVAL; + } +} + +static int v4l2_flash_s_ctrl(struct v4l2_ctrl *c) +{ + struct v4l2_flash *v4l2_flash = v4l2_ctrl_to_v4l2_flash(c); + struct led_classdev *led_cdev = v4l2_flash-led_cdev; + struct v4l2_flash_ctrl *ctrl = v4l2_flash-ctrl; + enum led_brightness torch_brightness; + bool external_strobe; + int ret; + + switch (c-id) { + case V4L2_CID_FLASH_LED_MODE: + switch (c-val) { + case V4L2_FLASH_LED_MODE_NONE: + v4l2_call_flash_op(brightness_set, led_cdev, 0); + return v4l2_call_flash_op(strobe_set, led_cdev, false); + case V4L2_FLASH_LED_MODE_FLASH: + /* Turn off torch LED */ + v4l2_call_flash_op(brightness_set, led_cdev, 0); + external_strobe = (ctrl-source-val == + V4L2_FLASH_STROBE_SOURCE_EXTERNAL); + return v4l2_call_flash_op(external_strobe_set, led_cdev, + external_strobe); + case V4L2_FLASH_LED_MODE_TORCH: + /* Stop flash strobing */ + ret = v4l2_call_flash_op(strobe_set, led_cdev, false); + if (ret) + return ret; + /* torch is always triggered by software */ + ret = v4l2_call_flash_op(external_strobe_set, led_cdev, + false); Does the LED API not assume this at the moment? I'm not saying it should, though. :-) Actually strobe
Re: Hauppauge ImpactVCB-e 01385
On 16/04/14 19:15, Steve Cookson wrote: For no good reason AFAICT the initial resolution is set to 320x240. But you can just set it to 640x480 (or more likely, 720x480 for NTSC or 720x576 for PAL): v4l2-ctl -v width=640,height=480 Hi Guys, The attachments here are sent using tinypic.com. It's the first time I've used it, so I hope it works OK. I'm using the qv4l utility, but I did try it on v4l2-ctl and gst-launch and the results are the same as the one's I shall post here. Firstly, here is stk1160 s-video for a baseline comparison. Look at the word File in the file menu: - http://tinypic.com/m/i50k8z/2 Now here is ImpactVCB-e composite. Again look at the word File in the file menu: - http://tinypic.com/m/i50k8n/2 The quality is a little worse, but maybe that is just Composite/S-Video. Composite is not working on my stk1160, so I can't do a direct comparison. Now let's look at ImpactVCB-e s-video: - http://tinypic.com/m/i50k8w/2 It looks like every other line is missing. I'd guess it's 640x240. I've tried v4l2-ctl -v width=640,height=480 etc, but no difference. You can see it too with images but it's just not so obvious as with text. Now when I switch back to ImpactVCB-e composite, I get the same problem, but after a restart it goes away. What do you think? Regards Stev -- 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] vb2: Update buffer state flags after __vb2_dqbuf
Hi Nicolas, On Wednesday 16 April 2014 15:34:06 Nicolas Dufresne wrote: Previously we where updating the buffer state using __fill_v4l2_buffer before the state transition was completed through __vb2_dqbuf. This would cause the V4L2_BUF_FLAG_DONE to be set, which would mean it still queued. The spec says the dqbuf should clean the DONE flag, right not it alway set it. Signed-off-by: Nicolas Dufresne nicolas.dufre...@collabora.com This looks fine to me, thanks for catching and fixing the problem. Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/v4l2-core/videobuf2-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index f9059bb..ac5026a 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -1943,14 +1943,15 @@ static int vb2_internal_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool n call_vb_qop(vb, buf_finish, vb); - /* Fill buffer information for the userspace */ - __fill_v4l2_buffer(vb, b); /* Remove from videobuf queue */ list_del(vb-queued_entry); q-queued_count--; /* go back to dequeued state */ __vb2_dqbuf(vb); + /* Fill buffer information for the userspace */ + __fill_v4l2_buffer(vb, b); + dprintk(1, dqbuf of buffer %d, with state %d\n, vb-v4l2_buf.index, vb-state); -- Regards, Laurent Pinchart signature.asc Description: This is a digitally signed message part.
[PATCHv4 0/3] vb2: stop_streaming should return void
Split off the removal of the vb2_is_streaming check as requested. Note that the davinci drivers still have this unnecessary check, but Prabhakar will remove that himself. Also fix a compiler warning that I got during the daily build. 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
[PATCHv4 3/3] vb2: fix compiler warning
From: Hans Verkuil hans.verk...@cisco.com When compiling this for older kernels using the compatibility build the compiler complains about uninitialized variables: In file included from include/linux/kernel.h:20:0, from include/linux/cache.h:4, from include/linux/time.h:7, from include/linux/input.h:13, from /home/hans/work/build/media_build/v4l/compat.h:9, from command-line:0: /home/hans/work/build/media_build/v4l/videobuf2-core.c: In function 'vb2_mmap': include/linux/dynamic_debug.h:60:9: warning: 'plane' may be used uninitialized in this function [-Wmaybe-uninitialized] printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ ^ /home/hans/work/build/media_build/v4l/videobuf2-core.c:2381:23: note: 'plane' was declared here unsigned int buffer, plane; ^ In file included from include/linux/kernel.h:20:0, from include/linux/cache.h:4, from include/linux/time.h:7, from include/linux/input.h:13, from /home/hans/work/build/media_build/v4l/compat.h:9, from command-line:0: include/linux/dynamic_debug.h:60:9: warning: 'buffer' may be used uninitialized in this function [-Wmaybe-uninitialized] printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ ^ /home/hans/work/build/media_build/v4l/videobuf2-core.c:2381:15: note: 'buffer' was declared here unsigned int buffer, plane; ^ While these warnings are bogus (the call to __find_plane_by_offset will set buffer and plane), it doesn't hurt to initialize these variables. Signed-off-by: Hans Verkuil hans.verk...@cisco.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 f8f694a..40024d7 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -2378,7 +2378,7 @@ int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma) { unsigned long off = vma-vm_pgoff PAGE_SHIFT; struct vb2_buffer *vb; - unsigned int buffer, plane; + unsigned int buffer = 0, plane = 0; int ret; unsigned long length; -- 1.9.2 -- 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
[PATCHv4 2/3] bfin_capture: drop unnecessary vb2_is_streaming check.
From: Hans Verkuil hans.verk...@cisco.com The stop_streaming op is only called if streaming is in progress, so drop the unnecessary 'if (!vb2_is_streaming(vq))' check. Signed-off-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Pawel Osciak pa...@osciak.com Acked-by: Sakari Ailus sakari.ai...@linux.intel.com --- drivers/media/platform/blackfin/bfin_capture.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/media/platform/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c index dfb09d4..16f643c 100644 --- a/drivers/media/platform/blackfin/bfin_capture.c +++ b/drivers/media/platform/blackfin/bfin_capture.c @@ -433,9 +433,6 @@ static void bcap_stop_streaming(struct vb2_queue *vq) struct ppi_if *ppi = bcap_dev-ppi; int ret; - if (!vb2_is_streaming(vq)) - return 0; - bcap_dev-stop = true; wait_for_completion(bcap_dev-comp); ppi-ops-stop(ppi); -- 1.9.2 -- 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.16] vb fixes: stop_streaming should return void
The following changes since commit 701b57ee3387b8e3749845b02310b5625fbd8da0: [media] vb2: Add videobuf2-dvb support (2014-04-16 18:59:29 -0300) are available in the git repository at: git://linuxtv.org/hverkuil/media_tree.git for-v3.16b for you to fetch changes up to faaec8bdaceac06587c95df4f71159b2c6f8ed01: vb2: fix compiler warning (2014-04-17 08:17:08 +0200) Hans Verkuil (3): vb2: stop_streaming should return void bfin_capture: drop unnecessary vb2_is_streaming check. vb2: fix compiler warning Documentation/video4linux/v4l2-pci-skeleton.c| 3 +-- drivers/media/pci/sta2x11/sta2x11_vip.c | 3 +-- drivers/media/platform/blackfin/bfin_capture.c | 6 +- drivers/media/platform/coda.c| 4 +--- drivers/media/platform/davinci/vpbe_display.c| 5 ++--- drivers/media/platform/davinci/vpif_capture.c| 6 ++ drivers/media/platform/davinci/vpif_display.c| 6 ++ drivers/media/platform/exynos-gsc/gsc-m2m.c | 4 +--- drivers/media/platform/exynos4-is/fimc-capture.c | 6 +++--- drivers/media/platform/exynos4-is/fimc-isp-video.c | 5 ++--- drivers/media/platform/exynos4-is/fimc-lite.c| 6 +++--- drivers/media/platform/exynos4-is/fimc-m2m.c | 3 +-- drivers/media/platform/marvell-ccic/mcam-core.c | 7 +++ drivers/media/platform/mem2mem_testdev.c | 5 ++--- drivers/media/platform/s3c-camif/camif-capture.c | 4 ++-- drivers/media/platform/s5p-jpeg/jpeg-core.c | 4 +--- drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 3 +-- drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 3 +-- drivers/media/platform/s5p-tv/mixer_video.c | 3 +-- drivers/media/platform/soc_camera/atmel-isi.c| 6 ++ drivers/media/platform/soc_camera/mx2_camera.c | 4 +--- drivers/media/platform/soc_camera/mx3_camera.c | 4 +--- drivers/media/platform/soc_camera/rcar_vin.c | 4 +--- drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c | 4 ++-- drivers/media/platform/vivi.c| 3 +-- drivers/media/platform/vsp1/vsp1_video.c | 4 +--- drivers/media/usb/em28xx/em28xx-v4l.h| 2 +- drivers/media/usb/em28xx/em28xx-video.c | 8 ++-- drivers/media/usb/pwc/pwc-if.c | 7 ++- drivers/media/usb/s2255/s2255drv.c | 5 ++--- drivers/media/usb/stk1160/stk1160-v4l.c | 4 ++-- drivers/media/usb/usbtv/usbtv-video.c| 9 +++-- drivers/media/v4l2-core/videobuf2-core.c | 4 ++-- drivers/staging/media/davinci_vpfe/vpfe_video.c | 3 +-- drivers/staging/media/dt3155v4l/dt3155v4l.c | 3 +-- drivers/staging/media/go7007/go7007-v4l2.c | 3 +-- drivers/staging/media/msi3101/sdr-msi3101.c | 24 drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c | 7 ++- drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c | 3 +-- drivers/staging/media/solo6x10/solo6x10-v4l2.c | 3 +-- include/media/videobuf2-core.h | 2 +- 41 files changed, 70 insertions(+), 132 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
[PATCHv4 1/3] vb2: stop_streaming should return void
From: Hans Verkuil hans.verk...@cisco.com The vb2 core ignores any return code from the stop_streaming op. And there really isn't anything it can do anyway in case of an error. So change the return type to void and update any drivers that implement it. The int return gave drivers the idea that this operation could actually fail, but that's really not the case. The pwc amd sdr-msi3101 drivers both had this construction: if (mutex_lock_interruptible(s-v4l2_lock)) return -ERESTARTSYS; This has been updated to just call mutex_lock(). The stop_streaming op expects this to really stop streaming and I very much doubt this will work reliably if stop_streaming just returns without really stopping the DMA. Signed-off-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Pawel Osciak pa...@osciak.com Acked-by: Sakari Ailus sakari.ai...@linux.intel.com --- Documentation/video4linux/v4l2-pci-skeleton.c | 3 +-- drivers/media/pci/sta2x11/sta2x11_vip.c| 3 +-- drivers/media/platform/blackfin/bfin_capture.c | 3 +-- drivers/media/platform/coda.c | 4 +--- drivers/media/platform/davinci/vpbe_display.c | 5 ++--- drivers/media/platform/davinci/vpif_capture.c | 6 ++ drivers/media/platform/davinci/vpif_display.c | 6 ++ drivers/media/platform/exynos-gsc/gsc-m2m.c| 4 +--- drivers/media/platform/exynos4-is/fimc-capture.c | 6 +++--- drivers/media/platform/exynos4-is/fimc-isp-video.c | 5 ++--- drivers/media/platform/exynos4-is/fimc-lite.c | 6 +++--- drivers/media/platform/exynos4-is/fimc-m2m.c | 3 +-- drivers/media/platform/marvell-ccic/mcam-core.c| 7 +++ drivers/media/platform/mem2mem_testdev.c | 5 ++--- drivers/media/platform/s3c-camif/camif-capture.c | 4 ++-- drivers/media/platform/s5p-jpeg/jpeg-core.c| 4 +--- drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 3 +-- drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 3 +-- drivers/media/platform/s5p-tv/mixer_video.c| 3 +-- drivers/media/platform/soc_camera/atmel-isi.c | 6 ++ drivers/media/platform/soc_camera/mx2_camera.c | 4 +--- drivers/media/platform/soc_camera/mx3_camera.c | 4 +--- drivers/media/platform/soc_camera/rcar_vin.c | 4 +--- .../platform/soc_camera/sh_mobile_ceu_camera.c | 4 ++-- drivers/media/platform/vivi.c | 3 +-- drivers/media/platform/vsp1/vsp1_video.c | 4 +--- drivers/media/usb/em28xx/em28xx-v4l.h | 2 +- drivers/media/usb/em28xx/em28xx-video.c| 8 ++-- drivers/media/usb/pwc/pwc-if.c | 7 ++- drivers/media/usb/s2255/s2255drv.c | 5 ++--- drivers/media/usb/stk1160/stk1160-v4l.c| 4 ++-- drivers/media/usb/usbtv/usbtv-video.c | 9 +++- drivers/media/v4l2-core/videobuf2-core.c | 2 +- drivers/staging/media/davinci_vpfe/vpfe_video.c| 3 +-- drivers/staging/media/dt3155v4l/dt3155v4l.c| 3 +-- drivers/staging/media/go7007/go7007-v4l2.c | 3 +-- drivers/staging/media/msi3101/sdr-msi3101.c| 24 -- drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c | 7 ++- drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c | 3 +-- drivers/staging/media/solo6x10/solo6x10-v4l2.c | 3 +-- include/media/videobuf2-core.h | 2 +- 41 files changed, 69 insertions(+), 128 deletions(-) diff --git a/Documentation/video4linux/v4l2-pci-skeleton.c b/Documentation/video4linux/v4l2-pci-skeleton.c index 80251dc..53dd346 100644 --- a/Documentation/video4linux/v4l2-pci-skeleton.c +++ b/Documentation/video4linux/v4l2-pci-skeleton.c @@ -269,7 +269,7 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) * Stop the DMA engine. Any remaining buffers in the DMA queue are dequeued * and passed on to the vb2 framework marked as STATE_ERROR. */ -static int stop_streaming(struct vb2_queue *vq) +static void stop_streaming(struct vb2_queue *vq) { struct skeleton *skel = vb2_get_drv_priv(vq); @@ -277,7 +277,6 @@ static int stop_streaming(struct vb2_queue *vq) /* Release all active buffers */ return_all_buffers(skel, VB2_BUF_STATE_ERROR); - return 0; } /* diff --git a/drivers/media/pci/sta2x11/sta2x11_vip.c b/drivers/media/pci/sta2x11/sta2x11_vip.c index bb11443..7559951 100644 --- a/drivers/media/pci/sta2x11/sta2x11_vip.c +++ b/drivers/media/pci/sta2x11/sta2x11_vip.c @@ -357,7 +357,7 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) } /* abort streaming and wait for last buffer */ -static int stop_streaming(struct vb2_queue *vq) +static void stop_streaming(struct vb2_queue *vq) { struct sta2x11_vip *vip = vb2_get_drv_priv(vq); struct vip_buffer *vip_buf, *node; @@ -374,7 +374,6 @@ static int stop_streaming(struct vb2_queue *vq)
Re: [PATCH/RFC v3 3/5] leds: Add support for max77693 mfd flash cell
Hi Sakari, Thanks for the review. On 04/16/2014 07:26 PM, Sakari Ailus wrote: Hi Jacek, Thanks for the patch! Comments below. On Fri, Apr 11, 2014 at 04:56:54PM +0200, Jacek Anaszewski wrote: This patch adds led-flash support to Maxim max77693 chipset. A device can be exposed to user space through LED subsystem sysfs interface or through V4L2 subdevice when the support for V4L2 Flash sub-devices is enabled. Device supports up to two leds which can work in flash and torch mode. Leds can be triggered externally or by software. Signed-off-by: Andrzej Hajda a.ha...@samsung.com Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com Acked-by: Kyungmin Park kyungmin.p...@samsung.com Cc: Bryan Wu coolo...@gmail.com Cc: Richard Purdie rpur...@rpsys.net Cc: SangYoung Son hello@smasung.com Cc: Samuel Ortiz sa...@linux.intel.com Cc: Lee Jones lee.jo...@linaro.org --- drivers/leds/Kconfig | 10 + drivers/leds/Makefile|1 + drivers/leds/leds-max77693.c | 794 ++ drivers/mfd/max77693.c |2 +- include/linux/mfd/max77693.h | 38 ++ 5 files changed, 844 insertions(+), 1 deletion(-) create mode 100644 drivers/leds/leds-max77693.c diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 1e1c81f..b2152a6 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -462,6 +462,16 @@ config LEDS_TCA6507 LED driver chips accessed via the I2C bus. Driver support brightness control and hardware-assisted blinking. +config LEDS_MAX77693 + tristate LED support for MAX77693 Flash + depends on LEDS_CLASS_FLASH + depends on MFD_MAX77693 + depends on OF + help + This option enables support for the flash part of the MAX77693 + multifunction device. It has build in control for two leds in flash + and torch mode. + config LEDS_MAX8997 tristate LED support for MAX8997 PMIC depends on LEDS_CLASS MFD_MAX8997 diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 8861b86..64f6234 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_LEDS_MC13783)+= leds-mc13783.o obj-$(CONFIG_LEDS_NS2)+= leds-ns2.o obj-$(CONFIG_LEDS_NETXBIG)+= leds-netxbig.o obj-$(CONFIG_LEDS_ASIC3) += leds-asic3.o +obj-$(CONFIG_LEDS_MAX77693)+= leds-max77693.o obj-$(CONFIG_LEDS_MAX8997)+= leds-max8997.o obj-$(CONFIG_LEDS_LM355x) += leds-lm355x.o obj-$(CONFIG_LEDS_BLINKM) += leds-blinkm.o diff --git a/drivers/leds/leds-max77693.c b/drivers/leds/leds-max77693.c new file mode 100644 index 000..979736c --- /dev/null +++ b/drivers/leds/leds-max77693.c @@ -0,0 +1,794 @@ +/* + * Copyright (C) 2014, Samsung Electronics Co., Ltd. + * + * Authors: Andrzej Hajda a.ha...@samsung.com + * 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. + */ + +#include asm/div64.h +#include linux/leds_flash.h +#include linux/module.h +#include linux/mutex.h +#include linux/platform_device.h +#include linux/slab.h +#include media/v4l2-flash.h I guess this should be last in the list. +#include linux/workqueue.h +#include linux/mfd/max77693.h +#include linux/mfd/max77693-private.h + +#define MAX77693_LED_NAME max77693-flash + +#define MAX77693_TORCH_IOUT_BITS 4 + +#define MAX77693_TORCH_NO_TIMER0x40 +#define MAX77693_FLASH_TIMER_LEVEL 0x80 + +#define MAX77693_FLASH_EN_OFF 0 +#define MAX77693_FLASH_EN_FLASH1 +#define MAX77693_FLASH_EN_TORCH2 +#define MAX77693_FLASH_EN_ON 3 + +#define MAX77693_FLASH_EN1_SHIFT 6 +#define MAX77693_FLASH_EN2_SHIFT 4 +#define MAX77693_TORCH_EN1_SHIFT 2 +#define MAX77693_TORCH_EN2_SHIFT 0 + +#define MAX77693_FLASH_LOW_BATTERY_EN 0x80 + +#define MAX77693_FLASH_BOOST_FIXED 0x04 +#define MAX77693_FLASH_BOOST_LEDNUM_2 0x80 + +#define MAX77693_FLASH_TIMEOUT_MIN 62500 +#define MAX77693_FLASH_TIMEOUT_MAX 100 +#define MAX77693_FLASH_TIMEOUT_STEP62500 + +#define MAX77693_TORCH_TIMEOUT_MIN 262000 +#define MAX77693_TORCH_TIMEOUT_MAX 15728000 + +#define MAX77693_FLASH_IOUT_MIN15625 +#define MAX77693_FLASH_IOUT_MAX_1LED 100 +#define MAX77693_FLASH_IOUT_MAX_2LEDS 625000 +#define MAX77693_FLASH_IOUT_STEP 15625 + +#define MAX77693_TORCH_IOUT_MIN15625 +#define MAX77693_TORCH_IOUT_MAX25 +#define MAX77693_TORCH_IOUT_STEP 15625 + +#define MAX77693_FLASH_VSYS_MIN2400 +#define MAX77693_FLASH_VSYS_MAX3400 +#define MAX77693_FLASH_VSYS_STEP 33 + +#define MAX77693_FLASH_VOUT_MIN
Re: [PATCH 4/5] exynos4-is: Remove requirement for simple-bus compatible
(restoring the Cc list I cleared accidentally in previous reply) On 16/04/14 21:29, Rob Herring wrote: On Wed, Apr 16, 2014 at 12:19 PM, Sylwester Nawrocki s.nawro...@samsung.com wrote: On 16/04/14 17:34, Rob Herring wrote: On Tue, Apr 15, 2014 at 12:34 PM, Sylwester Nawrocki s.nawro...@samsung.com wrote: This patch makes the driver instantiating its child devices itself, rather than relying on an OS to instantiate devices as children of simple-bus. This removes an incorrect usage of simple-bus compatible. Good, but why can't you use of_platform_populate with the root being the samsung,fimc node? The code to instantiate the devices belongs in the core OF code. As I mentioned in other thread, I couldn't see anything like of_platform_unpopulate(), which would allow to destroy any created devices. I can't have of_platform_populate() called as last thing in probe() as some drivers do, so at least deferred probe works. Anyway, it wouldn't be a solution since on a driver removal the created devices must be unregistered. I think the deferred probe will get fixed in 3.16, but I'm not following how deferred probe is relevant here. What I meant was that when something fails in the middle of probe() callback and of_platform_populate() was already called any devices created by it must be destroyed before returning an error from probe(). And some drivers seem to never free their devices created by of_platform_populate(). I read through thread [1] and I didn't immediately have an idea how to fix the core OF code. So I thought I'd come up with this partial solution. I was wondering if creating functions like of_platform_device_delete(), of_amba_device_delete() and a function that would walk device tree and call them would be a way to go ? I could spend some time on that, any suggestions would be appreciated. I need to look at the other removal case, but perhaps the way you did using children of the struct device parent is the right way. I'm fine with that, but I just want to see this in the core code. All right, I'll have a closer look then if it can be done that way. Rob -- Regards, Sylwester [1] http://www.spinics.net/lists/linux-omap/msg94484.html -- Thanks, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [REVIEW PATCH 3/3] saa7134: convert to vb2
On 04/17/2014 04:17 AM, Mauro Carvalho Chehab wrote: Em Thu, 17 Apr 2014 00:33:55 +0200 Hans Verkuil hverk...@xs4all.nl escreveu: On 04/17/2014 12:23 AM, Mauro Carvalho Chehab wrote: Em Mon, 10 Mar 2014 13:20:49 +0100 Hans Verkuil hverk...@xs4all.nl escreveu: From: Hans Verkuil hans.verk...@cisco.com Convert the saa7134 driver to vb2. Note that while this uses the vb2-dma-sg version, the VB2_USERPTR mode is disabled. The DMA hardware only supports DMAing full pages, and in the USERPTR memory model the first and last scatter-gather buffer is almost never a full page. In practice this means that we can't use the VB2_USERPTR mode. Why not? Provided that the buffer is equal or bigger than the number of pages required by saa7134, that should be OK. All the driver needs to do is to check if the USERPTR buffer condition is met, returning an error otherwise (and likely printing a msg at dmesg). Yuck. Well, I'll take a look at this. It has in my view the same problem as abusing USERPTR to pass pointers to physically contiguous memory: yes, it 'supports' USERPTR, but it has additional requirements which userspace has no way of knowing or detecting. It's really not USERPTR at all, it is PAGE_ALIGNED_USERPTR. Quite different. Hmm... If I remember well, mmapped memory (being userptr or not) are always page aligned, at least on systems with MMU. Not malloc()ed memory. That's what userptr is about. I would prefer that you have to enable it explicitly through e.g. a module option. That way you can still do it, but you really have to know what you are doing. I suspect that this change will break some userspace programs used for video surveillance equipment. This has been tested with raw video, compressed video, VBI, radio, DVB and video overlays. Unfortunately, a vb2 conversion is one of those things you cannot split up in smaller patches, it's all or nothing. This patch switches the whole driver over to vb2, using the vb2 ioctl and fop helper functions. Not quite true. This patch contains lots of non-vb2 stuff, like: - Coding Style fixes; - Removal of res_get/res_set/res_free; - Functions got moved from one place to another one. I will see if there is anything sensible that I can split up. I'm not aware of any particular coding style issues, but I'll review it. There are several, like: - dprintk(buffer_finish %p\n,q-curr); + dprintk(buffer_finish %p\n, q-curr); Also, it seems that you moved some functions, like: ts_reset_encoder(struct saa7134_dev* dev) that was moved to some other part of the code and renamed as stop_streaming(). There are several of such cases, with makes hard to really see the VB2 changes, and what it might be some code dropped by mistake. The removal of the resource functions is not something I can split up. It is replaced by the resource handling that's built into the vb2 helper functions. Well, currently, it is really hard to see that all the checks between empress and normal video streams are still done right, as the patch become big and messy. The original checks were never correct. This driver was buggy as hell once you tried to use multiple streams at the same time. I have split it up some more, but the actual vb2 conversion remains a big patch. Regards, Hans Please try to break it into a more granular set of patches that would help to check if everything is there. Thanks, Mauro Regards, Hans It is really hard to review it, as is, as the real changes are mixed with the above code cleanups/changes. Please split this patch in a way that it allows reviewing the changes there. -- 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: Hauppauge ImpactVCB-e 01385
On 04/17/2014 11:18 AM, Steve Cookson wrote: On 16/04/14 19:15, Steve Cookson wrote: For no good reason AFAICT the initial resolution is set to 320x240. But you can just set it to 640x480 (or more likely, 720x480 for NTSC or 720x576 for PAL): v4l2-ctl -v width=640,height=480 Hi Guys, The attachments here are sent using tinypic.com. It's the first time I've used it, so I hope it works OK. I'm using the qv4l utility, but I did try it on v4l2-ctl and gst-launch and the results are the same as the one's I shall post here. Firstly, here is stk1160 s-video for a baseline comparison. Look at the word File in the file menu: - http://tinypic.com/m/i50k8z/2 Now here is ImpactVCB-e composite. Again look at the word File in the file menu: - http://tinypic.com/m/i50k8n/2 The quality is a little worse, but maybe that is just Composite/S-Video. Composite is not working on my stk1160, so I can't do a direct comparison. Now let's look at ImpactVCB-e s-video: - http://tinypic.com/m/i50k8w/2 It looks like every other line is missing. I'd guess it's 640x240. I've tried v4l2-ctl -v width=640,height=480 etc, but no difference. You can see it too with images but it's just not so obvious as with text. Now when I switch back to ImpactVCB-e composite, I get the same problem, but after a restart it goes away. What do you think? Looks like a driver bug to me. This driver needs some TLC, which I plan on giving, but I need to finish a bunch of other stuff first. Just use composite in the meantime. 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] vb2: Update buffer state flags after __vb2_dqbuf
On 04/16/2014 09:34 PM, Nicolas Dufresne wrote: Previously we where updating the buffer state using __fill_v4l2_buffer before the state transition was completed through __vb2_dqbuf. This would cause the V4L2_BUF_FLAG_DONE to be set, which would mean it still queued. The spec says the dqbuf should clean the DONE flag, right not it alway set it. Signed-off-by: Nicolas Dufresne nicolas.dufre...@collabora.com Nack: this will break the V4L2_BUF_FLAG_ERROR support. I would recommend just clearing the DONE flag explicitly. Looking at the code I believe the flags are also set incorrectly after QBUF (and PREPARE_BUF might have problems as well). This needs some careful checking and I need to add v4l2-compliance checks for this. I don't really have time to look into this at the moment, though. Regards, Hans --- drivers/media/v4l2-core/videobuf2-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index f9059bb..ac5026a 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -1943,14 +1943,15 @@ static int vb2_internal_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool n call_vb_qop(vb, buf_finish, vb); - /* Fill buffer information for the userspace */ - __fill_v4l2_buffer(vb, b); /* Remove from videobuf queue */ list_del(vb-queued_entry); q-queued_count--; /* go back to dequeued state */ __vb2_dqbuf(vb); + /* Fill buffer information for the userspace */ + __fill_v4l2_buffer(vb, b); + dprintk(1, dqbuf of buffer %d, with state %d\n, vb-v4l2_buf.index, vb-state); -- 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
[REVIEWv2 PATCH 11/11] saa7134: add saa7134_userptr module option to enable USERPTR
From: Hans Verkuil hans.verk...@cisco.com If the saa7134 module is loaded with the saa7134_userptr set to 1, then USERPTR support is enabled. A check in buffer_prepare verifies that the pointer is page-aligned. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/saa7134/saa7134-core.c | 4 drivers/media/pci/saa7134/saa7134-vbi.c | 4 drivers/media/pci/saa7134/saa7134-video.c | 16 +--- drivers/media/pci/saa7134/saa7134.h | 1 + 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/drivers/media/pci/saa7134/saa7134-core.c b/drivers/media/pci/saa7134/saa7134-core.c index f4ea0ec..be19a05 100644 --- a/drivers/media/pci/saa7134/saa7134-core.c +++ b/drivers/media/pci/saa7134/saa7134-core.c @@ -69,6 +69,10 @@ module_param_named(no_overlay, saa7134_no_overlay, int, 0444); MODULE_PARM_DESC(no_overlay,allow override overlay default (0 disables, 1 enables) [some VIA/SIS chipsets are known to have problem with overlay]); +bool saa7134_userptr; +module_param(saa7134_userptr, bool, 0644); +MODULE_PARM_DESC(saa7134_userptr, enable page-aligned userptr support); + static unsigned int video_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET }; static unsigned int vbi_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET }; static unsigned int radio_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET }; diff --git a/drivers/media/pci/saa7134/saa7134-vbi.c b/drivers/media/pci/saa7134/saa7134-vbi.c index 4479af5..c06dbe1 100644 --- a/drivers/media/pci/saa7134/saa7134-vbi.c +++ b/drivers/media/pci/saa7134/saa7134-vbi.c @@ -122,6 +122,10 @@ static int buffer_prepare(struct vb2_buffer *vb2) unsigned int size; int ret; + if (dma-sgl-offset) { + pr_err(The buffer is not page-aligned\n); + return -EINVAL; + } size = dev-vbi_hlen * dev-vbi_vlen * 2; if (vb2_plane_size(vb2, 0) size) return -EINVAL; diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c index e50c950..828910c 100644 --- a/drivers/media/pci/saa7134/saa7134-video.c +++ b/drivers/media/pci/saa7134/saa7134-video.c @@ -878,6 +878,10 @@ static int buffer_prepare(struct vb2_buffer *vb2) unsigned int size; int ret; + if (dma-sgl-offset) { + pr_err(The buffer is not page-aligned\n); + return -EINVAL; + } size = (dev-width * dev-height * dev-fmt-depth) 3; if (vb2_plane_size(vb2, 0) size) return -EINVAL; @@ -2055,11 +2059,15 @@ int saa7134_video_init1(struct saa7134_dev *dev) q = dev-video_vbq; q-type = V4L2_BUF_TYPE_VIDEO_CAPTURE; /* -* Do not add VB2_USERPTR: the saa7134 DMA engine cannot handle -* transfers that do not start at the beginning of a page. A USERPTR -* can start anywhere in a page, so USERPTR support is a no-go. +* Do not add VB2_USERPTR unless explicitly requested: the saa7134 DMA +* engine cannot handle transfers that do not start at the beginning +* of a page. A user-provided pointer can start anywhere in a page, so +* USERPTR support is a no-go unless the application knows about these +* limitations and has special support for this. */ q-io_modes = VB2_MMAP | VB2_READ; + if (saa7134_userptr) + q-io_modes |= VB2_USERPTR; q-drv_priv = dev-video_q; q-ops = vb2_qops; q-gfp_flags = GFP_DMA32; @@ -2076,6 +2084,8 @@ int saa7134_video_init1(struct saa7134_dev *dev) q-type = V4L2_BUF_TYPE_VBI_CAPTURE; /* Don't add VB2_USERPTR, see comment above */ q-io_modes = VB2_MMAP | VB2_READ; + if (saa7134_userptr) + q-io_modes |= VB2_USERPTR; q-drv_priv = dev-vbi_q; q-ops = saa7134_vbi_qops; q-gfp_flags = GFP_DMA32; diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h index f3032a1..c258495 100644 --- a/drivers/media/pci/saa7134/saa7134.h +++ b/drivers/media/pci/saa7134/saa7134.h @@ -714,6 +714,7 @@ static inline bool is_empress(struct file *file) extern struct list_head saa7134_devlist; extern struct mutex saa7134_devlist_lock; extern int saa7134_no_overlay; +extern bool saa7134_userptr; void saa7134_track_gpio(struct saa7134_dev *dev, char *msg); void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value); -- 1.9.2 -- 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
[REVIEWv2 PATCH 00/11] saa7134: vb2 conversion
This patch series splits up the previous version into smaller pieces. The previous version is found here: http://www.spinics.net/lists/linux-media/msg74171.html Changes since v1: - Split up the code in smaller parts where possible. The actual conversion is still a lot of code. - Added the regression fix as the first patch to hopefully prevent merge conflicts since that should go to 3.14 and 15. - Moved the vb2_queue out of the saa7134_dmaqueue struct and back to struct saa7134_dev. On closer examination the vb2_queue does not really belong to dmaqueue. - Added a final patch to re-enable USERPTR support if explicitly enabled and it checks that the user pointer is page-aligned. 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
[REVIEWv2 PATCH 06/11] saa7134: remove fmt from saa7134_buf
From: Hans Verkuil hans.verk...@cisco.com This is already available from saa7134_dev. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/saa7134/saa7134-core.c | 3 +-- drivers/media/pci/saa7134/saa7134-video.c | 24 +++- drivers/media/pci/saa7134/saa7134.h | 1 - 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/drivers/media/pci/saa7134/saa7134-core.c b/drivers/media/pci/saa7134/saa7134-core.c index 2495a9d..f6cfbb4 100644 --- a/drivers/media/pci/saa7134/saa7134-core.c +++ b/drivers/media/pci/saa7134/saa7134-core.c @@ -392,8 +392,7 @@ int saa7134_set_dmabits(struct saa7134_dev *dev) } /* video capture -- dma 1+2 (planar modes) */ - if (dev-video_q.curr - dev-video_q.curr-fmt-planar) { + if (dev-video_q.curr dev-fmt-planar) { ctrl |= SAA7134_MAIN_CTRL_TE4 | SAA7134_MAIN_CTRL_TE5; } diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c index edf9ec3..f331501 100644 --- a/drivers/media/pci/saa7134/saa7134-video.c +++ b/drivers/media/pci/saa7134/saa7134-video.c @@ -826,24 +826,24 @@ static int buffer_activate(struct saa7134_dev *dev, set_size(dev, TASK_A, buf-vb.width, buf-vb.height, V4L2_FIELD_HAS_BOTH(buf-vb.field)); - if (buf-fmt-yuv) + if (dev-fmt-yuv) saa_andorb(SAA7134_DATA_PATH(TASK_A), 0x3f, 0x03); else saa_andorb(SAA7134_DATA_PATH(TASK_A), 0x3f, 0x01); - saa_writeb(SAA7134_OFMT_VIDEO_A, buf-fmt-pm); + saa_writeb(SAA7134_OFMT_VIDEO_A, dev-fmt-pm); /* DMA: setup channel 0 (= Video Task A0) */ base = saa7134_buffer_base(buf); - if (buf-fmt-planar) + if (dev-fmt-planar) bpl = buf-vb.width; else - bpl = (buf-vb.width * buf-fmt-depth) / 8; + bpl = (buf-vb.width * dev-fmt-depth) / 8; control = SAA7134_RS_CONTROL_BURST_16 | SAA7134_RS_CONTROL_ME | (buf-pt-dma 12); - if (buf-fmt-bswap) + if (dev-fmt-bswap) control |= SAA7134_RS_CONTROL_BSWAP; - if (buf-fmt-wswap) + if (dev-fmt-wswap) control |= SAA7134_RS_CONTROL_WSWAP; if (V4L2_FIELD_HAS_BOTH(buf-vb.field)) { /* interlaced */ @@ -858,13 +858,13 @@ static int buffer_activate(struct saa7134_dev *dev, } saa_writel(SAA7134_RS_CONTROL(0),control); - if (buf-fmt-planar) { + if (dev-fmt-planar) { /* DMA: setup channel 4+5 (= planar task A) */ - bpl_uv = bpl buf-fmt-hshift; - lines_uv = buf-vb.height buf-fmt-vshift; + bpl_uv = bpl dev-fmt-hshift; + lines_uv = buf-vb.height dev-fmt-vshift; base2= base + bpl * buf-vb.height; base3= base2 + bpl_uv * lines_uv; - if (buf-fmt-uvswap) + if (dev-fmt-uvswap) tmp = base2, base2 = base3, base3 = tmp; dprintk(uv: bpl=%ld lines=%ld base2/3=%ld/%ld\n, bpl_uv,lines_uv,base2,base3); @@ -924,8 +924,7 @@ static int buffer_prepare(struct videobuf_queue *q, if (buf-vb.width != dev-width || buf-vb.height != dev-height || buf-vb.size != size || - buf-vb.field != field || - buf-fmt != dev-fmt) { + buf-vb.field != field) { saa7134_dma_free(q,buf); } @@ -936,7 +935,6 @@ static int buffer_prepare(struct videobuf_queue *q, buf-vb.height = dev-height; buf-vb.size = size; buf-vb.field = field; - buf-fmt = dev-fmt; buf-pt= dev-pt_cap; dev-video_q.curr = NULL; diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h index 907568e..d2ee545 100644 --- a/drivers/media/pci/saa7134/saa7134.h +++ b/drivers/media/pci/saa7134/saa7134.h @@ -456,7 +456,6 @@ struct saa7134_buf { struct videobuf_buffer vb; /* saa7134 specific */ - struct saa7134_format *fmt; unsigned inttop_seen; int (*activate)(struct saa7134_dev *dev, struct saa7134_buf *buf, -- 1.9.2 -- 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
[REVIEWv2 PATCH 09/11] saa7134: move saa7134_pgtable to saa7134_dmaqueue
From: Hans Verkuil hans.verk...@cisco.com All dmaqueue's use saa7134_pgtable, so move it into struct saa7134_dmaqueue. The videobuf_queue priv_data field now points to the dmaqueue struct. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/saa7134/saa7134-dvb.c | 2 +- drivers/media/pci/saa7134/saa7134-empress.c | 2 +- drivers/media/pci/saa7134/saa7134-ts.c | 21 - drivers/media/pci/saa7134/saa7134-vbi.c | 14 -- drivers/media/pci/saa7134/saa7134-video.c | 26 ++ drivers/media/pci/saa7134/saa7134.h | 7 +-- 6 files changed, 37 insertions(+), 35 deletions(-) diff --git a/drivers/media/pci/saa7134/saa7134-dvb.c b/drivers/media/pci/saa7134/saa7134-dvb.c index 8b55e6d..eb48b1f 100644 --- a/drivers/media/pci/saa7134/saa7134-dvb.c +++ b/drivers/media/pci/saa7134/saa7134-dvb.c @@ -1237,7 +1237,7 @@ static int dvb_init(struct saa7134_dev *dev) V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_ALTERNATE, sizeof(struct saa7134_buf), - dev, NULL); + dev-ts_q, NULL); switch (dev-board) { case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: diff --git a/drivers/media/pci/saa7134/saa7134-empress.c b/drivers/media/pci/saa7134/saa7134-empress.c index 7d4d390..c44a7fb 100644 --- a/drivers/media/pci/saa7134/saa7134-empress.c +++ b/drivers/media/pci/saa7134/saa7134-empress.c @@ -359,7 +359,7 @@ static int empress_init(struct saa7134_dev *dev) V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_ALTERNATE, sizeof(struct saa7134_buf), - dev, NULL); + dev-ts_q, NULL); empress_signal_update(dev-empress_workqueue); return 0; diff --git a/drivers/media/pci/saa7134/saa7134-ts.c b/drivers/media/pci/saa7134/saa7134-ts.c index 240d280..8ac4fda 100644 --- a/drivers/media/pci/saa7134/saa7134-ts.c +++ b/drivers/media/pci/saa7134/saa7134-ts.c @@ -75,7 +75,8 @@ static int buffer_activate(struct saa7134_dev *dev, static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, enum v4l2_field field) { - struct saa7134_dev *dev = q-priv_data; + struct saa7134_dmaqueue *dmaq = q-priv_data; + struct saa7134_dev *dev = dmaq-dev; struct saa7134_buf *buf = container_of(vb, struct saa7134_buf, vb); unsigned int lines, llength, size; int err; @@ -102,12 +103,11 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, buf-vb.width = llength; buf-vb.height = lines; buf-vb.size = size; - buf-pt= dev-ts.pt_ts; err = videobuf_iolock(q,buf-vb,NULL); if (err) goto oops; - err = saa7134_pgtable_build(dev-pci,buf-pt, + err = saa7134_pgtable_build(dev-pci, dmaq-pt, dma-sglist, dma-sglen, saa7134_buffer_startpage(buf)); @@ -128,7 +128,8 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, static int buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size) { - struct saa7134_dev *dev = q-priv_data; + struct saa7134_dmaqueue *dmaq = q-priv_data; + struct saa7134_dev *dev = dmaq-dev; *size = TS_PACKET_SIZE * dev-ts.nr_packets; if (0 == *count) @@ -140,7 +141,8 @@ buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size) static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) { - struct saa7134_dev *dev = q-priv_data; + struct saa7134_dmaqueue *dmaq = q-priv_data; + struct saa7134_dev *dev = dmaq-dev; struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); saa7134_buffer_queue(dev,dev-ts_q,buf); @@ -149,7 +151,8 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) { struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); - struct saa7134_dev *dev = q-priv_data; + struct saa7134_dmaqueue *dmaq = q-priv_data; + struct saa7134_dev *dev = dmaq-dev; if (dev-ts_started) saa7134_ts_stop(dev); @@ -213,7 +216,7 @@ int saa7134_ts_init1(struct saa7134_dev *dev) dev-ts_q.dev = dev; dev-ts_q.need_two = 1; dev-ts_started= 0; - saa7134_pgtable_alloc(dev-pci, dev-ts.pt_ts); + saa7134_pgtable_alloc(dev-pci, dev-ts_q.pt); /* init TS hw */ saa7134_ts_init_hw(dev); @@
[REVIEWv2 PATCH 03/11] saa7134: drop abuse of low-level videobuf functions
From: Hans Verkuil hans.verk...@cisco.com saa7134-alsa used low-level videobuf functions to allocate and sync DMA buffers. Replace this with saa7134-specific code. These functions will not be available when we convert to vb2. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/saa7134/saa7134-alsa.c | 95 drivers/media/pci/saa7134/saa7134.h | 5 +- 2 files changed, 89 insertions(+), 11 deletions(-) diff --git a/drivers/media/pci/saa7134/saa7134-alsa.c b/drivers/media/pci/saa7134/saa7134-alsa.c index ff6f373..cf48987 100644 --- a/drivers/media/pci/saa7134/saa7134-alsa.c +++ b/drivers/media/pci/saa7134/saa7134-alsa.c @@ -274,6 +274,82 @@ static int snd_card_saa7134_capture_trigger(struct snd_pcm_substream * substream return err; } +static int saa7134_alsa_dma_init(struct saa7134_dev *dev, int nr_pages) +{ + struct saa7134_dmasound *dma = dev-dmasound; + struct page *pg; + int i; + + dma-vaddr = vmalloc_32(nr_pages PAGE_SHIFT); + if (NULL == dma-vaddr) { + dprintk(vmalloc_32(%d pages) failed\n, nr_pages); + return -ENOMEM; + } + + dprintk(vmalloc is at addr 0x%08lx, size=%d\n, + (unsigned long)dma-vaddr, + nr_pages PAGE_SHIFT); + + memset(dma-vaddr, 0, nr_pages PAGE_SHIFT); + dma-nr_pages = nr_pages; + + dma-sglist = vzalloc(dma-nr_pages * sizeof(*dma-sglist)); + if (NULL == dma-sglist) + goto vzalloc_err; + + sg_init_table(dma-sglist, dma-nr_pages); + for (i = 0; i dma-nr_pages; i++) { + pg = vmalloc_to_page(dma-vaddr + i * PAGE_SIZE); + if (NULL == pg) + goto vmalloc_to_page_err; + sg_set_page(dma-sglist[i], pg, PAGE_SIZE, 0); + } + return 0; + +vmalloc_to_page_err: + vfree(dma-sglist); + dma-sglist = NULL; +vzalloc_err: + vfree(dma-vaddr); + dma-vaddr = NULL; + return -ENOMEM; +} + +static int saa7134_alsa_dma_map(struct saa7134_dev *dev) +{ + struct saa7134_dmasound *dma = dev-dmasound; + + dma-sglen = dma_map_sg(dev-pci-dev, dma-sglist, + dma-nr_pages, PCI_DMA_FROMDEVICE); + + if (0 == dma-sglen) { + pr_warn(%s: saa7134_alsa_map_sg failed\n, __func__); + return -ENOMEM; + } + return 0; +} + +static int saa7134_alsa_dma_unmap(struct saa7134_dev *dev) +{ + struct saa7134_dmasound *dma = dev-dmasound; + + if (!dma-sglen) + return 0; + + dma_unmap_sg(dev-pci-dev, dma-sglist, dma-sglen, PCI_DMA_FROMDEVICE); + dma-sglen = 0; + return 0; +} + +static int saa7134_alsa_dma_free(struct saa7134_dmasound *dma) +{ + vfree(dma-sglist); + dma-sglist = NULL; + vfree(dma-vaddr); + dma-vaddr = NULL; + return 0; +} + /* * DMA buffer initialization * @@ -291,9 +367,8 @@ static int dsp_buffer_init(struct saa7134_dev *dev) BUG_ON(!dev-dmasound.bufsize); - videobuf_dma_init(dev-dmasound.dma); - err = videobuf_dma_init_kernel(dev-dmasound.dma, PCI_DMA_FROMDEVICE, - (dev-dmasound.bufsize + PAGE_SIZE) PAGE_SHIFT); + err = saa7134_alsa_dma_init(dev, + (dev-dmasound.bufsize + PAGE_SIZE) PAGE_SHIFT); if (0 != err) return err; return 0; @@ -310,7 +385,7 @@ static int dsp_buffer_free(struct saa7134_dev *dev) { BUG_ON(!dev-dmasound.blksize); - videobuf_dma_free(dev-dmasound.dma); + saa7134_alsa_dma_free(dev-dmasound); dev-dmasound.blocks = 0; dev-dmasound.blksize = 0; @@ -632,7 +707,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, /* release the old buffer */ if (substream-runtime-dma_area) { saa7134_pgtable_free(dev-pci, dev-dmasound.pt); - videobuf_dma_unmap(dev-pci-dev, dev-dmasound.dma); + saa7134_alsa_dma_unmap(dev); dsp_buffer_free(dev); substream-runtime-dma_area = NULL; } @@ -648,14 +723,14 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, return err; } - err = videobuf_dma_map(dev-pci-dev, dev-dmasound.dma); + err = saa7134_alsa_dma_map(dev); if (err) { dsp_buffer_free(dev); return err; } err = saa7134_pgtable_alloc(dev-pci, dev-dmasound.pt); if (err) { - videobuf_dma_unmap(dev-pci-dev, dev-dmasound.dma); + saa7134_alsa_dma_unmap(dev); dsp_buffer_free(dev); return err; } @@ -663,7 +738,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
[REVIEWv2 PATCH 05/11] saa7134: store VBI hlen/vlen globally
From: Hans Verkuil hans.verk...@cisco.com Don't calculate this for every buffer, store it globally instead. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/saa7134/saa7134-vbi.c | 38 +++-- drivers/media/pci/saa7134/saa7134.h | 1 + 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/drivers/media/pci/saa7134/saa7134-vbi.c b/drivers/media/pci/saa7134/saa7134-vbi.c index e044539..7f28563 100644 --- a/drivers/media/pci/saa7134/saa7134-vbi.c +++ b/drivers/media/pci/saa7134/saa7134-vbi.c @@ -67,10 +67,10 @@ static void task_init(struct saa7134_dev *dev, struct saa7134_buf *buf, saa_writeb(SAA7134_VBI_PHASE_OFFSET_LUMA(task), 0x00); saa_writeb(SAA7134_VBI_PHASE_OFFSET_CHROMA(task), 0x00); - saa_writeb(SAA7134_VBI_H_LEN1(task), buf-vb.width0xff); - saa_writeb(SAA7134_VBI_H_LEN2(task), buf-vb.width8); - saa_writeb(SAA7134_VBI_V_LEN1(task), buf-vb.height 0xff); - saa_writeb(SAA7134_VBI_V_LEN2(task), buf-vb.height 8); + saa_writeb(SAA7134_VBI_H_LEN1(task), dev-vbi_hlen 0xff); + saa_writeb(SAA7134_VBI_H_LEN2(task), dev-vbi_hlen 8); + saa_writeb(SAA7134_VBI_V_LEN1(task), dev-vbi_vlen 0xff); + saa_writeb(SAA7134_VBI_V_LEN2(task), dev-vbi_vlen 8); saa_andorb(SAA7134_DATA_PATH(task), 0xc0, 0x00); } @@ -98,12 +98,12 @@ static int buffer_activate(struct saa7134_dev *dev, SAA7134_RS_CONTROL_ME | (buf-pt-dma 12); saa_writel(SAA7134_RS_BA1(2), base); - saa_writel(SAA7134_RS_BA2(2), base + buf-vb.size / 2); - saa_writel(SAA7134_RS_PITCH(2), buf-vb.width); + saa_writel(SAA7134_RS_BA2(2), base + dev-vbi_hlen * dev-vbi_vlen); + saa_writel(SAA7134_RS_PITCH(2), dev-vbi_hlen); saa_writel(SAA7134_RS_CONTROL(2), control); saa_writel(SAA7134_RS_BA1(3), base); - saa_writel(SAA7134_RS_BA2(3), base + buf-vb.size / 2); - saa_writel(SAA7134_RS_PITCH(3), buf-vb.width); + saa_writel(SAA7134_RS_BA2(3), base + dev-vbi_hlen * dev-vbi_vlen); + saa_writel(SAA7134_RS_PITCH(3), dev-vbi_hlen); saa_writel(SAA7134_RS_CONTROL(3), control); /* start DMA */ @@ -119,15 +119,10 @@ static int buffer_prepare(struct videobuf_queue *q, { struct saa7134_dev *dev = q-priv_data; struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); - struct saa7134_tvnorm *norm = dev-tvnorm; - unsigned int lines, llength, size; + unsigned int size; int err; - lines = norm-vbi_v_stop_0 - norm-vbi_v_start_0 +1; - if (lines VBI_LINE_COUNT) - lines = VBI_LINE_COUNT; - llength = VBI_LINE_LENGTH; - size = lines * llength * 2; + size = dev-vbi_hlen * dev-vbi_vlen * 2; if (0 != buf-vb.baddrbuf-vb.bsize size) return -EINVAL; @@ -137,8 +132,8 @@ static int buffer_prepare(struct videobuf_queue *q, if (VIDEOBUF_NEEDS_INIT == buf-vb.state) { struct videobuf_dmabuf *dma=videobuf_to_dma(buf-vb); - buf-vb.width = llength; - buf-vb.height = lines; + buf-vb.width = dev-vbi_hlen; + buf-vb.height = dev-vbi_vlen; buf-vb.size = size; buf-pt= dev-pt_vbi; @@ -166,11 +161,12 @@ static int buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size) { struct saa7134_dev *dev = q-priv_data; - int llength,lines; - lines = dev-tvnorm-vbi_v_stop_0 - dev-tvnorm-vbi_v_start_0 +1; - llength = VBI_LINE_LENGTH; - *size = lines * llength * 2; + dev-vbi_vlen = dev-tvnorm-vbi_v_stop_0 - dev-tvnorm-vbi_v_start_0 + 1; + if (dev-vbi_vlen VBI_LINE_COUNT) + dev-vbi_vlen = VBI_LINE_COUNT; + dev-vbi_hlen = VBI_LINE_LENGTH; + *size = dev-vbi_hlen * dev-vbi_vlen * 2; if (0 == *count) *count = vbibufs; *count = saa7134_buffer_count(*size,*count); diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h index 419f5f8..907568e 100644 --- a/drivers/media/pci/saa7134/saa7134.h +++ b/drivers/media/pci/saa7134/saa7134.h @@ -600,6 +600,7 @@ struct saa7134_dev { unsigned int vbi_fieldcount; struct saa7134_format *fmt; unsigned int width, height; + unsigned int vbi_hlen, vbi_vlen; struct pm_qos_request qos_request; /* various v4l controls */ -- 1.9.2 -- 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
[REVIEWv2 PATCH 04/11] saa7134: swap ts_init_encoder and ts_reset_encoder
From: Hans Verkuil hans.verk...@cisco.com This will make the next patch a bit easier to read. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/saa7134/saa7134-empress.c | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/media/pci/saa7134/saa7134-empress.c b/drivers/media/pci/saa7134/saa7134-empress.c index 07bd06c..393c9f1 100644 --- a/drivers/media/pci/saa7134/saa7134-empress.c +++ b/drivers/media/pci/saa7134/saa7134-empress.c @@ -48,17 +48,7 @@ MODULE_PARM_DESC(debug,enable debug messages); /* -- */ -static void ts_reset_encoder(struct saa7134_dev* dev) -{ - if (!dev-empress_started) - return; - - saa_writeb(SAA7134_SPECIAL_MODE, 0x00); - msleep(10); - saa_writeb(SAA7134_SPECIAL_MODE, 0x01); - msleep(100); - dev-empress_started = 0; -} +static void ts_reset_encoder(struct saa7134_dev* dev); static int ts_init_encoder(struct saa7134_dev* dev) { @@ -79,6 +69,18 @@ static int ts_init_encoder(struct saa7134_dev* dev) return 0; } +static void ts_reset_encoder(struct saa7134_dev* dev) +{ + if (!dev-empress_started) + return; + + saa_writeb(SAA7134_SPECIAL_MODE, 0x00); + msleep(10); + saa_writeb(SAA7134_SPECIAL_MODE, 0x01); + msleep(100); + dev-empress_started = 0; +} + /* -- */ static int ts_open(struct file *file) -- 1.9.2 -- 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
[REVIEWv2 PATCH 08/11] saa7134: rename vbi/cap to vbi_vbq/cap_vbq
From: Hans Verkuil hans.verk...@cisco.com Use consistent _vbq suffix for videobuf_queue fields. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/saa7134/saa7134-video.c | 52 +++ drivers/media/pci/saa7134/saa7134.h | 4 +-- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c index e5b2beb..9eb5564 100644 --- a/drivers/media/pci/saa7134/saa7134-video.c +++ b/drivers/media/pci/saa7134/saa7134-video.c @@ -1086,10 +1086,10 @@ static struct videobuf_queue *saa7134_queue(struct file *file) switch (vdev-vfl_type) { case VFL_TYPE_GRABBER: - q = fh-is_empress ? dev-empress_vbq : dev-cap; + q = fh-is_empress ? dev-empress_vbq : dev-video_vbq; break; case VFL_TYPE_VBI: - q = dev-vbi; + q = dev-vbi_vbq; break; default: BUG(); @@ -1174,6 +1174,7 @@ video_poll(struct file *file, struct poll_table_struct *wait) struct saa7134_dev *dev = video_drvdata(file); struct saa7134_fh *fh = file-private_data; struct videobuf_buffer *buf = NULL; + struct videobuf_queue *q = dev-video_vbq; unsigned int rc = 0; if (v4l2_event_pending(fh-fh)) @@ -1182,25 +1183,24 @@ video_poll(struct file *file, struct poll_table_struct *wait) poll_wait(file, fh-fh.wait, wait); if (vdev-vfl_type == VFL_TYPE_VBI) - return rc | videobuf_poll_stream(file, dev-vbi, wait); + return rc | videobuf_poll_stream(file, dev-vbi_vbq, wait); if (res_check(fh, RESOURCE_VIDEO)) { - mutex_lock(dev-cap.vb_lock); - if (!list_empty(dev-cap.stream)) - buf = list_entry(dev-cap.stream.next, struct videobuf_buffer, stream); + mutex_lock(q-vb_lock); + if (!list_empty(q-stream)) + buf = list_entry(q-stream.next, struct videobuf_buffer, stream); } else { - mutex_lock(dev-cap.vb_lock); - if (UNSET == dev-cap.read_off) { + mutex_lock(q-vb_lock); + if (UNSET == q-read_off) { /* need to capture a new frame */ if (res_locked(dev, RESOURCE_VIDEO)) goto err; - if (0 != dev-cap.ops-buf_prepare(dev-cap, - dev-cap.read_buf, dev-cap.field)) + if (0 != q-ops-buf_prepare(q, q-read_buf, q-field)) goto err; - dev-cap.ops-buf_queue(dev-cap, dev-cap.read_buf); - dev-cap.read_off = 0; + q-ops-buf_queue(q, q-read_buf); + q-read_off = 0; } - buf = dev-cap.read_buf; + buf = q-read_buf; } if (!buf) @@ -1209,11 +1209,11 @@ video_poll(struct file *file, struct poll_table_struct *wait) poll_wait(file, buf-done, wait); if (buf-state == VIDEOBUF_DONE || buf-state == VIDEOBUF_ERROR) rc |= POLLIN | POLLRDNORM; - mutex_unlock(dev-cap.vb_lock); + mutex_unlock(q-vb_lock); return rc; err: - mutex_unlock(dev-cap.vb_lock); + mutex_unlock(q-vb_lock); return rc | POLLERR; } @@ -1238,21 +1238,21 @@ static int video_release(struct file *file) /* stop video capture */ if (res_check(fh, RESOURCE_VIDEO)) { pm_qos_remove_request(dev-qos_request); - videobuf_streamoff(dev-cap); + videobuf_streamoff(dev-video_vbq); res_free(dev, fh, RESOURCE_VIDEO); - videobuf_mmap_free(dev-cap); + videobuf_mmap_free(dev-video_vbq); INIT_LIST_HEAD(dev-cap.stream); } - if (dev-cap.read_buf) { - buffer_release(dev-cap, dev-cap.read_buf); - kfree(dev-cap.read_buf); + if (dev-video_vbq.read_buf) { + buffer_release(dev-video_vbq, dev-video_vbq.read_buf); + kfree(dev-video_vbq.read_buf); } /* stop vbi capture */ if (res_check(fh, RESOURCE_VBI)) { - videobuf_stop(dev-vbi); + videobuf_stop(dev-vbi_vbq); res_free(dev, fh, RESOURCE_VBI); - videobuf_mmap_free(dev-vbi); + videobuf_mmap_free(dev-vbi_vbq); INIT_LIST_HEAD(dev-vbi.stream); } @@ -1338,7 +1338,7 @@ static int saa7134_g_fmt_vid_cap(struct file *file, void *priv, f-fmt.pix.width= dev-width; f-fmt.pix.height = dev-height; - f-fmt.pix.field= dev-cap.field; + f-fmt.pix.field= dev-video_vbq.field; f-fmt.pix.pixelformat =
[REVIEWv2 PATCH 07/11] saa7134: rename empress_tsq to empress_vbq
From: Hans Verkuil hans.verk...@cisco.com Create consistent _vbq suffix for videobuf_queue fields. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/saa7134/saa7134-empress.c | 12 ++-- drivers/media/pci/saa7134/saa7134-video.c | 2 +- drivers/media/pci/saa7134/saa7134.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/pci/saa7134/saa7134-empress.c b/drivers/media/pci/saa7134/saa7134-empress.c index 393c9f1..7d4d390 100644 --- a/drivers/media/pci/saa7134/saa7134-empress.c +++ b/drivers/media/pci/saa7134/saa7134-empress.c @@ -112,8 +112,8 @@ static int ts_release(struct file *file) struct saa7134_fh *fh = file-private_data; if (res_check(fh, RESOURCE_EMPRESS)) { - videobuf_stop(dev-empress_tsq); - videobuf_mmap_free(dev-empress_tsq); + videobuf_stop(dev-empress_vbq); + videobuf_mmap_free(dev-empress_vbq); /* stop the encoder */ ts_reset_encoder(dev); @@ -138,7 +138,7 @@ ts_read(struct file *file, char __user *data, size_t count, loff_t *ppos) if (!dev-empress_started) ts_init_encoder(dev); - return videobuf_read_stream(dev-empress_tsq, + return videobuf_read_stream(dev-empress_vbq, data, count, ppos, 0, file-f_flags O_NONBLOCK); } @@ -155,7 +155,7 @@ ts_poll(struct file *file, struct poll_table_struct *wait) rc = POLLPRI; else if (req_events POLLPRI) poll_wait(file, fh-fh.wait, wait); - return rc | videobuf_poll_stream(file, dev-empress_tsq, wait); + return rc | videobuf_poll_stream(file, dev-empress_vbq, wait); } @@ -164,7 +164,7 @@ ts_mmap(struct file *file, struct vm_area_struct * vma) { struct saa7134_dev *dev = video_drvdata(file); - return videobuf_mmap_mapper(dev-empress_tsq, vma); + return videobuf_mmap_mapper(dev-empress_vbq, vma); } static int empress_enum_fmt_vid_cap(struct file *file, void *priv, @@ -354,7 +354,7 @@ static int empress_init(struct saa7134_dev *dev) printk(KERN_INFO %s: registered device %s [mpeg]\n, dev-name, video_device_node_name(dev-empress_dev)); - videobuf_queue_sg_init(dev-empress_tsq, saa7134_ts_qops, + videobuf_queue_sg_init(dev-empress_vbq, saa7134_ts_qops, dev-pci-dev, dev-slock, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_ALTERNATE, diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c index f331501..e5b2beb 100644 --- a/drivers/media/pci/saa7134/saa7134-video.c +++ b/drivers/media/pci/saa7134/saa7134-video.c @@ -1086,7 +1086,7 @@ static struct videobuf_queue *saa7134_queue(struct file *file) switch (vdev-vfl_type) { case VFL_TYPE_GRABBER: - q = fh-is_empress ? dev-empress_tsq : dev-cap; + q = fh-is_empress ? dev-empress_vbq : dev-cap; break; case VFL_TYPE_VBI: q = dev-vbi; diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h index d2ee545..482489a 100644 --- a/drivers/media/pci/saa7134/saa7134.h +++ b/drivers/media/pci/saa7134/saa7134.h @@ -647,7 +647,7 @@ struct saa7134_dev { /* SAA7134_MPEG_EMPRESS only */ struct video_device*empress_dev; struct v4l2_subdev *empress_sd; - struct videobuf_queue empress_tsq; + struct videobuf_queue empress_vbq; struct work_struct empress_workqueue; intempress_started; struct v4l2_ctrl_handler empress_ctrl_handler; -- 1.9.2 -- 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
[REVIEWv2 PATCH 02/11] saa7134: coding style cleanups.
From: Hans Verkuil hans.verk...@cisco.com Just white space changes to reduce the noise in the following patches. Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/saa7134/saa7134-alsa.c| 13 drivers/media/pci/saa7134/saa7134-core.c| 47 - drivers/media/pci/saa7134/saa7134-dvb.c | 7 - drivers/media/pci/saa7134/saa7134-empress.c | 7 - drivers/media/pci/saa7134/saa7134-i2c.c | 7 - drivers/media/pci/saa7134/saa7134-reg.h | 7 - drivers/media/pci/saa7134/saa7134-ts.c | 17 +++ drivers/media/pci/saa7134/saa7134-tvaudio.c | 7 - drivers/media/pci/saa7134/saa7134-vbi.c | 37 +-- drivers/media/pci/saa7134/saa7134-video.c | 31 --- 10 files changed, 59 insertions(+), 121 deletions(-) diff --git a/drivers/media/pci/saa7134/saa7134-alsa.c b/drivers/media/pci/saa7134/saa7134-alsa.c index e04a4d5..ff6f373 100644 --- a/drivers/media/pci/saa7134/saa7134-alsa.c +++ b/drivers/media/pci/saa7134/saa7134-alsa.c @@ -648,19 +648,20 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, return err; } - if (0 != (err = videobuf_dma_map(dev-pci-dev, dev-dmasound.dma))) { + err = videobuf_dma_map(dev-pci-dev, dev-dmasound.dma); + if (err) { dsp_buffer_free(dev); return err; } - if (0 != (err = saa7134_pgtable_alloc(dev-pci,dev-dmasound.pt))) { + err = saa7134_pgtable_alloc(dev-pci, dev-dmasound.pt); + if (err) { videobuf_dma_unmap(dev-pci-dev, dev-dmasound.dma); dsp_buffer_free(dev); return err; } - if (0 != (err = saa7134_pgtable_build(dev-pci,dev-dmasound.pt, - dev-dmasound.dma.sglist, - dev-dmasound.dma.sglen, - 0))) { + err = saa7134_pgtable_build(dev-pci, dev-dmasound.pt, + dev-dmasound.sglist, dev-dmasound.sglen, 0); + if (err) { saa7134_pgtable_free(dev-pci, dev-dmasound.pt); videobuf_dma_unmap(dev-pci-dev, dev-dmasound.dma); dsp_buffer_free(dev); diff --git a/drivers/media/pci/saa7134/saa7134-core.c b/drivers/media/pci/saa7134/saa7134-core.c index 1362b4a..2495a9d 100644 --- a/drivers/media/pci/saa7134/saa7134-core.c +++ b/drivers/media/pci/saa7134/saa7134-core.c @@ -209,7 +209,7 @@ int saa7134_buffer_startpage(struct saa7134_buf *buf) unsigned long saa7134_buffer_base(struct saa7134_buf *buf) { unsigned long base; - struct videobuf_dmabuf *dma=videobuf_to_dma(buf-vb); + struct videobuf_dmabuf *dma = videobuf_to_dma(buf-vb); base = saa7134_buffer_startpage(buf) * 4096; base += dma-sglist[0].offset; @@ -237,7 +237,7 @@ int saa7134_pgtable_build(struct pci_dev *pci, struct saa7134_pgtable *pt, unsigned int startpage) { __le32*ptr; - unsigned int i,p; + unsigned int i, p; BUG_ON(NULL == pt || NULL == pt-cpu); @@ -278,22 +278,22 @@ int saa7134_buffer_queue(struct saa7134_dev *dev, struct saa7134_buf *next = NULL; assert_spin_locked(dev-slock); - dprintk(buffer_queue %p\n,buf); + dprintk(buffer_queue %p\n, buf); if (NULL == q-curr) { if (!q-need_two) { q-curr = buf; - buf-activate(dev,buf,NULL); + buf-activate(dev, buf, NULL); } else if (list_empty(q-queue)) { list_add_tail(buf-vb.queue,q-queue); buf-vb.state = VIDEOBUF_QUEUED; } else { - next = list_entry(q-queue.next,struct saa7134_buf, + next = list_entry(q-queue.next, struct saa7134_buf, vb.queue); q-curr = buf; - buf-activate(dev,buf,next); + buf-activate(dev, buf, next); } } else { - list_add_tail(buf-vb.queue,q-queue); + list_add_tail(buf-vb.queue, q-queue); buf-vb.state = VIDEOBUF_QUEUED; } return 0; @@ -304,7 +304,7 @@ void saa7134_buffer_finish(struct saa7134_dev *dev, unsigned int state) { assert_spin_locked(dev-slock); - dprintk(buffer_finish %p\n,q-curr); + dprintk(buffer_finish %p\n, q-curr); /* finish current buffer */ q-curr-vb.state = state; @@ -323,20 +323,20 @@ void saa7134_buffer_next(struct saa7134_dev *dev, if (!list_empty(q-queue)) { /* activate next one from queue */ - buf = list_entry(q-queue.next,struct saa7134_buf,vb.queue); +
Re: [PATCH v2 46/48] adv7604: Add DT support
Hi Laurent. On 11/03/14 00:15, Laurent Pinchart wrote: Parse the device tree node to populate platform data. Cc: devicet...@vger.kernel.org Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- .../devicetree/bindings/media/i2c/adv7604.txt | 56 + drivers/media/i2c/adv7604.c| 92 ++ 2 files changed, 134 insertions(+), 14 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7604.txt diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt new file mode 100644 index 000..0845c50 --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt @@ -0,0 +1,56 @@ +* Analog Devices ADV7604/11 video decoder with HDMI receiver + +The ADV7604 and ADV7611 are multiformat video decoders with an integrated HDMI +receiver. The ADV7604 has four multiplexed HDMI inputs and one analog input, +and the ADV7611 has one HDMI input and no analog input. + +Required Properties: + + - compatible: Must contain one of the following +- adi,adv7604 for the ADV7604 +- adi,adv7611 for the ADV7611 + + - reg: I2C slave address + + - hpd-gpios: References to the GPIOs that control the HDMI hot-plug +detection pins, one per HDMI input. The active flag indicates the GPIO +level that enables hot-plug detection. + +Optional Properties: + + - reset-gpios: Reference to the GPIO connected to the device's reset pin. + + - adi,default-input: Index of the input to be configured as default. Valid +values are 0..5 for the ADV7604 and 0 for the ADV7611. I have some doubts about this property. Firstly, it seems it is not needed for ADV7611 since it is always 0 for that device ? Why can't we hard code in the driver some default input ? And which inputs it refers to ? HDMI inputs A..D + analog ? If we keep this property I think exact mapping of numbers to inputs should be included in description of this property. + - adi,disable-power-down: Boolean property. When set forces the device to +ignore the power-down pin. The property is valid for the ADV7604 only as +the ADV7611 has no power-down pin. Does it refer to the !PWRDWN pin ? If so I would replace power-down with PWRDWN, so it is clear what we're talking about when someone looks only at the datasheet. + - adi,disable-cable-reset: Boolean property. When set disables the HDMI +receiver automatic reset when the HDMI cable is unplugged. Couldn't this be configured from user space with some default assumed in the driver ? +Example: + + hdmi_receiver@4c { + compatible = adi,adv7611; + reg = 0x4c; + + reset-gpios = ioexp 0 GPIO_ACTIVE_LOW; + hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH; + + adi,default-input = 0; + + #address-cells = 1; + #size-cells = 0; + + port@0 { + reg = 0; + }; + port@1 { + reg = 1; + hdmi_in: endpoint { + remote-endpoint = ccdc_in; + }; + }; + }; diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index cce140c..de44213 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -2626,13 +2626,70 @@ static const struct adv7604_chip_info adv7604_chip_info[] = { }, }; +static struct i2c_device_id adv7604_i2c_id[] = { + { adv7604, (kernel_ulong_t)adv7604_chip_info[ADV7604] }, + { adv7611, (kernel_ulong_t)adv7604_chip_info[ADV7611] }, + { } +}; +MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id); + +static struct of_device_id adv7604_of_id[] = { + { .compatible = adi,adv7604, .data = adv7604_chip_info[ADV7604] }, + { .compatible = adi,adv7611, .data = adv7604_chip_info[ADV7611] }, + { } +}; +MODULE_DEVICE_TABLE(of, adv7604_of_id); + +static int adv7604_parse_dt(struct adv7604_state *state) +{ + struct device_node *np; + int ret; + + np = state-i2c_clients[ADV7604_PAGE_IO]-dev.of_node; + + state-pdata.disable_pwrdnb = + of_property_read_bool(np, adi,disable-power-down); + state-pdata.disable_cable_det_rst = + of_property_read_bool(np, adi,disable-cable-reset); + + ret = of_property_read_u32(np, adi,default-input, +state-pdata.default_input); + if (ret 0) + state-pdata.default_input = -1; + + /* Disable the interrupt for now as no DT-based board uses it. */ + state-pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED; + + /* Use the default I2C addresses. */ + state-pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42; + state-pdata.i2c_addresses[ADV7604_PAGE_CEC] = 0x40; +
Re: [PATCH v2 48/48] adv7604: Add endpoint properties to DT bindings
Hi Laurent, On 11/03/14 00:15, Laurent Pinchart wrote: Add support for the hsync-active, vsync-active and pclk-sample properties to the DT bindings and control BT.656 mode implicitly. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- .../devicetree/bindings/media/i2c/adv7604.txt | 13 + drivers/media/i2c/adv7604.c| 31 -- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt index 0845c50..2b62c06 100644 --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt @@ -30,6 +30,19 @@ Optional Properties: - adi,disable-cable-reset: Boolean property. When set disables the HDMI receiver automatic reset when the HDMI cable is unplugged. +Optional Endpoint Properties: + + The following three properties are defined in video-interfaces.txt and are + valid for source endpoints only. + + - hsync-active: Horizontal synchronization polarity. Defaults to active low. + - vsync-active: Vertical synchronization polarity. Defaults to active low. + - pclk-sample: Pixel clock polarity. Defaults to output on the falling edge. + + If none of hsync-active, vsync-active and pclk-sample is specified the + endpoint will use embedded BT.656 synchronization. + + Example: hdmi_receiver@4c { diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 95cc911..2a92099 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -41,6 +41,7 @@ #include media/v4l2-ctrls.h #include media/v4l2-device.h #include media/v4l2-dv-timings.h +#include media/v4l2-of.h static int debug; module_param(debug, int, 0644); @@ -2643,11 +2644,39 @@ MODULE_DEVICE_TABLE(of, adv7604_of_id); static int adv7604_parse_dt(struct adv7604_state *state) { + struct v4l2_of_endpoint bus_cfg; + struct device_node *endpoint; struct device_node *np; + unsigned int flags; int ret; np = state-i2c_clients[ADV7604_PAGE_IO]-dev.of_node; + /* Parse the endpoint. */ + endpoint = v4l2_of_get_next_endpoint(np, NULL); + if (!endpoint) + return -EINVAL; Perhaps we should document this binding requires at least one endpoint node ? I guess there is no point in not having any endpoint node ? + v4l2_of_parse_endpoint(endpoint, bus_cfg); + of_node_put(endpoint); + + flags = bus_cfg.bus.parallel.flags; + + if (flags V4L2_MBUS_HSYNC_ACTIVE_HIGH) + state-pdata.inv_hs_pol = 1; + + if (flags V4L2_MBUS_VSYNC_ACTIVE_HIGH) + state-pdata.inv_vs_pol = 1; + + if (flags V4L2_MBUS_PCLK_SAMPLE_RISING) + state-pdata.inv_llc_pol = 1; + + if (bus_cfg.bus_type == V4L2_MBUS_BT656) { + state-pdata.insert_av_codes = 1; + state-pdata.op_656_range = 1; + } + + /* Parse device-specific properties. */ state-pdata.disable_pwrdnb = of_property_read_bool(np, adi,disable-power-down); state-pdata.disable_cable_det_rst = @@ -2677,9 +2706,7 @@ static int adv7604_parse_dt(struct adv7604_state *state) /* HACK: Hardcode the remaining platform data fields. */ state-pdata.blank_data = 1; - state-pdata.op_656_range = 1; state-pdata.alt_data_sat = 1; - state-pdata.insert_av_codes = 1; state-pdata.op_format_mode_sel = ADV7604_OP_FORMAT_MODE0; return 0; -- Regards, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 47/48] adv7604: Add LLC polarity configuration
On 11/03/14 00:15, Laurent Pinchart wrote: Add an inv_llc_pol field to platform data to control the clock polarity. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com --- drivers/media/i2c/adv7604.c | 3 ++- include/media/adv7604.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index de44213..95cc911 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -2429,7 +2429,8 @@ static int adv7604_core_init(struct v4l2_subdev *sd) cp_write(sd, 0x69, 0x30); /* Enable CP CSC */ /* VS, HS polarities */ - io_write(sd, 0x06, 0xa0 | pdata-inv_vs_pol 2 | pdata-inv_hs_pol 1); + io_write(sd, 0x06, 0xa0 | pdata-inv_vs_pol 2 | + pdata-inv_hs_pol 1 | pdata-inv_llc_pol); /* Adjust drive strength */ io_write(sd, 0x14, 0x40 | pdata-dr_str_data 4 | diff --git a/include/media/adv7604.h b/include/media/adv7604.h index 6d69207..7a8462f 100644 --- a/include/media/adv7604.h +++ b/include/media/adv7604.h @@ -114,6 +114,7 @@ struct adv7604_platform_data { /* IO register 0x06 */ unsigned inv_vs_pol:1; unsigned inv_hs_pol:1; + unsigned inv_llc_pol:1; /* IO register 0x14 */ enum adv7604_drive_strength dr_str_data; -- Regards, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2] media: stk1160: Avoid stack-allocated buffer for control URBs
Currently stk1160_read_reg() uses a stack-allocated char to get the read control value. This is wrong because usb_control_msg() requires a kmalloc-ed buffer. This commit fixes such issue by kmalloc'ating a 1-byte buffer to receive the read value. While here, let's remove the urb_buf array which was meant for a similar purpose, but never really used. Cc: Alan Stern st...@rowland.harvard.edu Reported-by: Sander Eikelenboom li...@eikelenboom.it Signed-off-by: Ezequiel Garcia ezequiel.gar...@free-electrons.com --- drivers/media/usb/stk1160/stk1160-core.c | 10 +- drivers/media/usb/stk1160/stk1160.h | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/stk1160/stk1160-core.c b/drivers/media/usb/stk1160/stk1160-core.c index 34a26e0..03504dc 100644 --- a/drivers/media/usb/stk1160/stk1160-core.c +++ b/drivers/media/usb/stk1160/stk1160-core.c @@ -67,17 +67,25 @@ int stk1160_read_reg(struct stk1160 *dev, u16 reg, u8 *value) { int ret; int pipe = usb_rcvctrlpipe(dev-udev, 0); + u8 *buf; *value = 0; + + buf = kmalloc(sizeof(u8), GFP_KERNEL); + if (!buf) + return -ENOMEM; ret = usb_control_msg(dev-udev, pipe, 0x00, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0x00, reg, value, sizeof(u8), HZ); + 0x00, reg, buf, sizeof(u8), HZ); if (ret 0) { stk1160_err(read failed on reg 0x%x (%d)\n, reg, ret); + kfree(buf); return ret; } + *value = *buf; + kfree(buf); return 0; } diff --git a/drivers/media/usb/stk1160/stk1160.h b/drivers/media/usb/stk1160/stk1160.h index 05b05b1..abdea48 100644 --- a/drivers/media/usb/stk1160/stk1160.h +++ b/drivers/media/usb/stk1160/stk1160.h @@ -143,7 +143,6 @@ struct stk1160 { int num_alt; struct stk1160_isoc_ctl isoc_ctl; - char urb_buf[255]; /* urb control msg buffer */ /* frame properties */ int width;/* current frame width */ -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 46/48] adv7604: Add DT support
Hi Sylwester, Thank you for the review. On Thursday 17 April 2014 12:59:22 Sylwester Nawrocki wrote: On 11/03/14 00:15, Laurent Pinchart wrote: Parse the device tree node to populate platform data. Cc: devicet...@vger.kernel.org Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- .../devicetree/bindings/media/i2c/adv7604.txt | 56 + drivers/media/i2c/adv7604.c| 92 + 2 files changed, 134 insertions(+), 14 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7604.txt diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt new file mode 100644 index 000..0845c50 --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt @@ -0,0 +1,56 @@ +* Analog Devices ADV7604/11 video decoder with HDMI receiver + +The ADV7604 and ADV7611 are multiformat video decoders with an integrated HDMI +receiver. The ADV7604 has four multiplexed HDMI inputs and one analog input, +and the ADV7611 has one HDMI input and no analog input. + +Required Properties: + + - compatible: Must contain one of the following +- adi,adv7604 for the ADV7604 +- adi,adv7611 for the ADV7611 + + - reg: I2C slave address + + - hpd-gpios: References to the GPIOs that control the HDMI hot-plug +detection pins, one per HDMI input. The active flag indicates the GPIO +level that enables hot-plug detection. + +Optional Properties: + + - reset-gpios: Reference to the GPIO connected to the device's reset pin. + + - adi,default-input: Index of the input to be configured as default. Valid +values are 0..5 for the ADV7604 and 0 for the ADV7611. I have some doubts about this property. Firstly, it seems it is not needed for ADV7611 since it is always 0 for that device ? Why can't we hard code in the driver some default input ? I've thought about hardcoding a default input in the driver as well, but Hans wasn't really keen on the idea. Hans, could you please comment on this ? And which inputs it refers to ? HDMI inputs A..D + analog ? If we keep this property I think exact mapping of numbers to inputs should be included in description of this property. + - adi,disable-power-down: Boolean property. When set forces the device to +ignore the power-down pin. The property is valid for the ADV7604 only as +the ADV7611 has no power-down pin. Does it refer to the !PWRDWN pin ? If so I would replace power-down with PWRDWN, so it is clear what we're talking about when someone looks only at the datasheet. + - adi,disable-cable-reset: Boolean property. When set disables the HDMI +receiver automatic reset when the HDMI cable is unplugged. Couldn't this be configured from user space with some default assumed in the driver ? Good question. I'm not sure what the exact use case for this is. Let's be careful not to introduce unneeded properties, I'll drop those two properties for now, we can implement support for the features later when needed. +Example: + + hdmi_receiver@4c { + compatible = adi,adv7611; + reg = 0x4c; + + reset-gpios = ioexp 0 GPIO_ACTIVE_LOW; + hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH; + + adi,default-input = 0; + + #address-cells = 1; + #size-cells = 0; + + port@0 { + reg = 0; + }; + port@1 { + reg = 1; + hdmi_in: endpoint { + remote-endpoint = ccdc_in; + }; + }; + }; diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index cce140c..de44213 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c [snip] @@ -2836,21 +2906,15 @@ static int adv7604_remove(struct i2c_client *client) /* --- */ -static struct i2c_device_id adv7604_id[] = { - { adv7604, ADV7604 }, - { adv7611, ADV7611 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, adv7604_id); - static struct i2c_driver adv7604_driver = { .driver = { .owner = THIS_MODULE, .name = adv7604, + .of_match_table = of_match_ptr(adv7604_of_id), of_match_ptr() isn't necessary here. Thanks, will fix in v3. }, .probe = adv7604_probe, .remove = adv7604_remove, - .id_table = adv7604_id, + .id_table = adv7604_i2c_id, }; module_i2c_driver(adv7604_driver); -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 48/48] adv7604: Add endpoint properties to DT bindings
Hi Sylwester, On Thursday 17 April 2014 13:17:41 Sylwester Nawrocki wrote: On 11/03/14 00:15, Laurent Pinchart wrote: Add support for the hsync-active, vsync-active and pclk-sample properties to the DT bindings and control BT.656 mode implicitly. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- .../devicetree/bindings/media/i2c/adv7604.txt | 13 + drivers/media/i2c/adv7604.c| 31 -- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt index 0845c50..2b62c06 100644 --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt @@ -30,6 +30,19 @@ Optional Properties: - adi,disable-cable-reset: Boolean property. When set disables the HDMI receiver automatic reset when the HDMI cable is unplugged. +Optional Endpoint Properties: + + The following three properties are defined in video-interfaces.txt and are + valid for source endpoints only. + + - hsync-active: Horizontal synchronization polarity. Defaults to active low. + - vsync-active: Vertical synchronization polarity. Defaults to active low. + - pclk-sample: Pixel clock polarity. Defaults to output on the falling edge. + + If none of hsync-active, vsync-active and pclk-sample is specified the + endpoint will use embedded BT.656 synchronization. + + Example: hdmi_receiver@4c { diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 95cc911..2a92099 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -41,6 +41,7 @@ #include media/v4l2-ctrls.h #include media/v4l2-device.h #include media/v4l2-dv-timings.h +#include media/v4l2-of.h static int debug; module_param(debug, int, 0644); @@ -2643,11 +2644,39 @@ MODULE_DEVICE_TABLE(of, adv7604_of_id); static int adv7604_parse_dt(struct adv7604_state *state) { + struct v4l2_of_endpoint bus_cfg; + struct device_node *endpoint; struct device_node *np; + unsigned int flags; int ret; np = state-i2c_clients[ADV7604_PAGE_IO]-dev.of_node; + /* Parse the endpoint. */ + endpoint = v4l2_of_get_next_endpoint(np, NULL); + if (!endpoint) + return -EINVAL; Perhaps we should document this binding requires at least one endpoint node ? I guess there is no point in not having any endpoint node ? I think that's pretty much implied, otherwise the device will not be connected to anything and will be unusable. I will document ports node usage though, that's currently missing in the DT bindings documentation. + v4l2_of_parse_endpoint(endpoint, bus_cfg); + of_node_put(endpoint); + + flags = bus_cfg.bus.parallel.flags; + + if (flags V4L2_MBUS_HSYNC_ACTIVE_HIGH) + state-pdata.inv_hs_pol = 1; + + if (flags V4L2_MBUS_VSYNC_ACTIVE_HIGH) + state-pdata.inv_vs_pol = 1; + + if (flags V4L2_MBUS_PCLK_SAMPLE_RISING) + state-pdata.inv_llc_pol = 1; + + if (bus_cfg.bus_type == V4L2_MBUS_BT656) { + state-pdata.insert_av_codes = 1; + state-pdata.op_656_range = 1; + } + + /* Parse device-specific properties. */ state-pdata.disable_pwrdnb = of_property_read_bool(np, adi,disable-power-down); state-pdata.disable_cable_det_rst = @@ -2677,9 +2706,7 @@ static int adv7604_parse_dt(struct adv7604_state *state) /* HACK: Hardcode the remaining platform data fields. */ state-pdata.blank_data = 1; - state-pdata.op_656_range = 1; state-pdata.alt_data_sat = 1; - state-pdata.insert_av_codes = 1; state-pdata.op_format_mode_sel = ADV7604_OP_FORMAT_MODE0; return 0; -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 48/48] adv7604: Add endpoint properties to DT bindings
On 17/04/14 13:45, Laurent Pinchart wrote: Hi Sylwester, On Thursday 17 April 2014 13:17:41 Sylwester Nawrocki wrote: On 11/03/14 00:15, Laurent Pinchart wrote: Add support for the hsync-active, vsync-active and pclk-sample properties to the DT bindings and control BT.656 mode implicitly. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- .../devicetree/bindings/media/i2c/adv7604.txt | 13 + drivers/media/i2c/adv7604.c| 31 -- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt index 0845c50..2b62c06 100644 --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt @@ -30,6 +30,19 @@ Optional Properties: - adi,disable-cable-reset: Boolean property. When set disables the HDMI receiver automatic reset when the HDMI cable is unplugged. +Optional Endpoint Properties: + + The following three properties are defined in video-interfaces.txt and are + valid for source endpoints only. + + - hsync-active: Horizontal synchronization polarity. Defaults to active low. + - vsync-active: Vertical synchronization polarity. Defaults to active low. + - pclk-sample: Pixel clock polarity. Defaults to output on the falling edge. + + If none of hsync-active, vsync-active and pclk-sample is specified the + endpoint will use embedded BT.656 synchronization. + + Example: hdmi_receiver@4c { diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 95cc911..2a92099 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -41,6 +41,7 @@ #include media/v4l2-ctrls.h #include media/v4l2-device.h #include media/v4l2-dv-timings.h +#include media/v4l2-of.h static int debug; module_param(debug, int, 0644); @@ -2643,11 +2644,39 @@ MODULE_DEVICE_TABLE(of, adv7604_of_id); static int adv7604_parse_dt(struct adv7604_state *state) { + struct v4l2_of_endpoint bus_cfg; + struct device_node *endpoint; struct device_node *np; + unsigned int flags; int ret; np = state-i2c_clients[ADV7604_PAGE_IO]-dev.of_node; + /* Parse the endpoint. */ + endpoint = v4l2_of_get_next_endpoint(np, NULL); + if (!endpoint) + return -EINVAL; Perhaps we should document this binding requires at least one endpoint node ? I guess there is no point in not having any endpoint node ? I think that's pretty much implied, otherwise the device will not be connected to anything and will be unusable. I will document ports node usage though, that's currently missing in the DT bindings documentation. Doesn't the v4l2 helper code have standard parsing for the endpoint sync configurations? -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius -- 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 48/48] adv7604: Add endpoint properties to DT bindings
Hi Ben, On Thursday 17 April 2014 14:00:15 Ben Dooks wrote: On 17/04/14 13:45, Laurent Pinchart wrote: Hi Sylwester, On Thursday 17 April 2014 13:17:41 Sylwester Nawrocki wrote: On 11/03/14 00:15, Laurent Pinchart wrote: Add support for the hsync-active, vsync-active and pclk-sample properties to the DT bindings and control BT.656 mode implicitly. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- .../devicetree/bindings/media/i2c/adv7604.txt | 13 + drivers/media/i2c/adv7604.c| 31 -- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt index 0845c50..2b62c06 100644 --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt @@ -30,6 +30,19 @@ Optional Properties: - adi,disable-cable-reset: Boolean property. When set disables the HDMI receiver automatic reset when the HDMI cable is unplugged. +Optional Endpoint Properties: + + The following three properties are defined in video-interfaces.txt and are + valid for source endpoints only. + + - hsync-active: Horizontal synchronization polarity. Defaults to active low. + - vsync-active: Vertical synchronization polarity. Defaults to active low. + - pclk-sample: Pixel clock polarity. Defaults to output on the falling edge. + + If none of hsync-active, vsync-active and pclk-sample is specified the + endpoint will use embedded BT.656 synchronization. + + Example: hdmi_receiver@4c { diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 95cc911..2a92099 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -41,6 +41,7 @@ #include media/v4l2-ctrls.h #include media/v4l2-device.h #include media/v4l2-dv-timings.h +#include media/v4l2-of.h static int debug; module_param(debug, int, 0644); @@ -2643,11 +2644,39 @@ MODULE_DEVICE_TABLE(of, adv7604_of_id); static int adv7604_parse_dt(struct adv7604_state *state) { + struct v4l2_of_endpoint bus_cfg; + struct device_node *endpoint; struct device_node *np; + unsigned int flags; int ret; np = state-i2c_clients[ADV7604_PAGE_IO]-dev.of_node; + /* Parse the endpoint. */ + endpoint = v4l2_of_get_next_endpoint(np, NULL); + if (!endpoint) + return -EINVAL; Perhaps we should document this binding requires at least one endpoint node ? I guess there is no point in not having any endpoint node ? I think that's pretty much implied, otherwise the device will not be connected to anything and will be unusable. I will document ports node usage though, that's currently missing in the DT bindings documentation. Doesn't the v4l2 helper code have standard parsing for the endpoint sync configurations? Yes it does, in the v4l2_of_parse_endpoint() function which the driver uses. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 46/48] adv7604: Add DT support
Hi Sylwester, On Thursday 17 April 2014 14:36:32 Laurent Pinchart wrote: On Thursday 17 April 2014 12:59:22 Sylwester Nawrocki wrote: On 11/03/14 00:15, Laurent Pinchart wrote: Parse the device tree node to populate platform data. Cc: devicet...@vger.kernel.org Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- .../devicetree/bindings/media/i2c/adv7604.txt | 56 + drivers/media/i2c/adv7604.c| 92 + 2 files changed, 134 insertions(+), 14 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7604.txt diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt new file mode 100644 index 000..0845c50 --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt @@ -0,0 +1,56 @@ +* Analog Devices ADV7604/11 video decoder with HDMI receiver + +The ADV7604 and ADV7611 are multiformat video decoders with an integrated HDMI +receiver. The ADV7604 has four multiplexed HDMI inputs and one analog input, +and the ADV7611 has one HDMI input and no analog input. + +Required Properties: + + - compatible: Must contain one of the following +- adi,adv7604 for the ADV7604 +- adi,adv7611 for the ADV7611 + + - reg: I2C slave address + + - hpd-gpios: References to the GPIOs that control the HDMI hot-plug +detection pins, one per HDMI input. The active flag indicates the GPIO +level that enables hot-plug detection. + +Optional Properties: + + - reset-gpios: Reference to the GPIO connected to the device's reset pin. + + - adi,default-input: Index of the input to be configured as default. Valid +values are 0..5 for the ADV7604 and 0 for the ADV7611. I have some doubts about this property. Firstly, it seems it is not needed for ADV7611 since it is always 0 for that device ? Why can't we hard code in the driver some default input ? I've thought about hardcoding a default input in the driver as well, but Hans wasn't really keen on the idea. Hans, could you please comment on this ? And which inputs it refers to ? HDMI inputs A..D + analog ? If we keep this property I think exact mapping of numbers to inputs should be included in description of this property. + - adi,disable-power-down: Boolean property. When set forces the device to +ignore the power-down pin. The property is valid for the ADV7604 only as +the ADV7611 has no power-down pin. Does it refer to the !PWRDWN pin ? If so I would replace power-down with PWRDWN, so it is clear what we're talking about when someone looks only at the datasheet. + - adi,disable-cable-reset: Boolean property. When set disables the HDMI +receiver automatic reset when the HDMI cable is unplugged. Couldn't this be configured from user space with some default assumed in the driver ? Good question. I'm not sure what the exact use case for this is. Let's be careful not to introduce unneeded properties, I'll drop those two properties for now, we can implement support for the features later when needed. +Example: + + hdmi_receiver@4c { + compatible = adi,adv7611; + reg = 0x4c; + + reset-gpios = ioexp 0 GPIO_ACTIVE_LOW; + hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH; + + adi,default-input = 0; + + #address-cells = 1; + #size-cells = 0; + + port@0 { + reg = 0; + }; + port@1 { + reg = 1; + hdmi_in: endpoint { + remote-endpoint = ccdc_in; + }; + }; + }; diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index cce140c..de44213 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c [snip] @@ -2836,21 +2906,15 @@ static int adv7604_remove(struct i2c_client *client) /* --- */ -static struct i2c_device_id adv7604_id[] = { - { adv7604, ADV7604 }, - { adv7611, ADV7611 }, - { } -}; -MODULE_DEVICE_TABLE(i2c, adv7604_id); - static struct i2c_driver adv7604_driver = { .driver = { .owner = THIS_MODULE, .name = adv7604, + .of_match_table = of_match_ptr(adv7604_of_id), of_match_ptr() isn't necessary here. Thanks, will fix in v3. On second thought, as the driver has non-DT users, keeping of_match_ptr() and marking the table as __maybe_unused will optimize the table out if neither CONFIG_OF nor CONFIG_MODULE is set. I'd thus prefer keeping of_match_ptr(). }, .probe = adv7604_probe,
Re: [REVIEW PATCH 3/3] saa7134: convert to vb2
Em Thu, 17 Apr 2014 11:49:51 +0200 Hans Verkuil hverk...@xs4all.nl escreveu: On 04/17/2014 04:17 AM, Mauro Carvalho Chehab wrote: Em Thu, 17 Apr 2014 00:33:55 +0200 Hans Verkuil hverk...@xs4all.nl escreveu: On 04/17/2014 12:23 AM, Mauro Carvalho Chehab wrote: Em Mon, 10 Mar 2014 13:20:49 +0100 Hans Verkuil hverk...@xs4all.nl escreveu: From: Hans Verkuil hans.verk...@cisco.com Convert the saa7134 driver to vb2. Note that while this uses the vb2-dma-sg version, the VB2_USERPTR mode is disabled. The DMA hardware only supports DMAing full pages, and in the USERPTR memory model the first and last scatter-gather buffer is almost never a full page. In practice this means that we can't use the VB2_USERPTR mode. Why not? Provided that the buffer is equal or bigger than the number of pages required by saa7134, that should be OK. All the driver needs to do is to check if the USERPTR buffer condition is met, returning an error otherwise (and likely printing a msg at dmesg). Yuck. Well, I'll take a look at this. It has in my view the same problem as abusing USERPTR to pass pointers to physically contiguous memory: yes, it 'supports' USERPTR, but it has additional requirements which userspace has no way of knowing or detecting. It's really not USERPTR at all, it is PAGE_ALIGNED_USERPTR. Quite different. Hmm... If I remember well, mmapped memory (being userptr or not) are always page aligned, at least on systems with MMU. Not malloc()ed memory. That's what userptr is about. Take a look at videobuf_dma_init_user_locked at drivers/media/v4l2-core/videobuf-dma-sg.c: first = (data PAGE_MASK) PAGE_SHIFT; last = ((data+size-1) PAGE_MASK) PAGE_SHIFT; dma-offset = data ~PAGE_MASK; dma-size = size; dma-nr_pages = last-first+1; dma-pages = kmalloc(dma-nr_pages * sizeof(struct page *), GFP_KERNEL); The physical memory is always page aligned, even if VM memory isn't. The offset there is actually used just to subtract the size, at videobuf_pages_to_sg(). So, with VB1, USERPTR works fine, and no special care is needed on userspace to align the offset. Btw, it seems that VB2 also does the same. Take a look at vb2_dma_sg_get_userptr(). I would prefer that you have to enable it explicitly through e.g. a module option. That way you can still do it, but you really have to know what you are doing. I suspect that this change will break some userspace programs used for video surveillance equipment. This has been tested with raw video, compressed video, VBI, radio, DVB and video overlays. Unfortunately, a vb2 conversion is one of those things you cannot split up in smaller patches, it's all or nothing. This patch switches the whole driver over to vb2, using the vb2 ioctl and fop helper functions. Not quite true. This patch contains lots of non-vb2 stuff, like: - Coding Style fixes; - Removal of res_get/res_set/res_free; - Functions got moved from one place to another one. I will see if there is anything sensible that I can split up. I'm not aware of any particular coding style issues, but I'll review it. There are several, like: - dprintk(buffer_finish %p\n,q-curr); + dprintk(buffer_finish %p\n, q-curr); Also, it seems that you moved some functions, like: ts_reset_encoder(struct saa7134_dev* dev) that was moved to some other part of the code and renamed as stop_streaming(). There are several of such cases, with makes hard to really see the VB2 changes, and what it might be some code dropped by mistake. The removal of the resource functions is not something I can split up. It is replaced by the resource handling that's built into the vb2 helper functions. Well, currently, it is really hard to see that all the checks between empress and normal video streams are still done right, as the patch become big and messy. The original checks were never correct. This driver was buggy as hell once you tried to use multiple streams at the same time. I have split it up some more, but the actual vb2 conversion remains a big patch. Ok. Regards, Hans Please try to break it into a more granular set of patches that would help to check if everything is there. Thanks, Mauro Regards, Hans It is really hard to review it, as is, as the real changes are mixed with the above code cleanups/changes. Please split this patch in a way that it allows reviewing the changes there. -- Regards, Mauro -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 46/48] adv7604: Add DT support
On 17/04/14 15:08, Laurent Pinchart wrote: static struct i2c_driver adv7604_driver = { .driver = { .owner = THIS_MODULE, .name = adv7604, +.of_match_table = of_match_ptr(adv7604_of_id), of_match_ptr() isn't necessary here. Thanks, will fix in v3. On second thought, as the driver has non-DT users, keeping of_match_ptr() and marking the table as __maybe_unused will optimize the table out if neither CONFIG_OF nor CONFIG_MODULE is set. I'd thus prefer keeping of_match_ptr(). Yes, itsounds like a good idea to me. This way we avoid unpleasant #ifdefs and do not increase size of the module for non-dt users. -- Regards, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 30/49] adv7604: Add 16-bit read functions for CP and HDMI
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7604.c | 48 ++--- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index dd0a9a9..da256dd 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -542,6 +542,11 @@ static inline int hdmi_read(struct v4l2_subdev *sd, u8 reg) return adv_smbus_read_byte_data(state-i2c_hdmi, reg); } +static u16 hdmi_read16(struct v4l2_subdev *sd, u8 reg, u16 mask) +{ + return ((hdmi_read(sd, reg) 8) | hdmi_read(sd, reg + 1)) mask; +} + static inline int hdmi_write(struct v4l2_subdev *sd, u8 reg, u8 val) { struct adv7604_state *state = to_state(sd); @@ -575,6 +580,11 @@ static inline int cp_read(struct v4l2_subdev *sd, u8 reg) return adv_smbus_read_byte_data(state-i2c_cp, reg); } +static u16 cp_read16(struct v4l2_subdev *sd, u8 reg, u16 mask) +{ + return ((cp_read(sd, reg) 8) | cp_read(sd, reg + 1)) mask; +} + static inline int cp_write(struct v4l2_subdev *sd, u8 reg, u8 val) { struct adv7604_state *state = to_state(sd); @@ -1203,8 +1213,8 @@ static int read_stdi(struct v4l2_subdev *sd, struct stdi_readback *stdi) } /* read STDI */ - stdi-bl = ((cp_read(sd, 0xb1) 0x3f) 8) | cp_read(sd, 0xb2); - stdi-lcf = ((cp_read(sd, 0xb3) 0x7) 8) | cp_read(sd, 0xb4); + stdi-bl = cp_read16(sd, 0xb1, 0x3fff); + stdi-lcf = cp_read16(sd, 0xb3, 0x7ff); stdi-lcvs = cp_read(sd, 0xb3) 3; stdi-interlaced = io_read(sd, 0x12) 0x10; @@ -1315,8 +1325,8 @@ static int adv7604_query_dv_timings(struct v4l2_subdev *sd, timings-type = V4L2_DV_BT_656_1120; - bt-width = (hdmi_read(sd, 0x07) 0x0f) * 256 + hdmi_read(sd, 0x08); - bt-height = (hdmi_read(sd, 0x09) 0x0f) * 256 + hdmi_read(sd, 0x0a); + bt-width = hdmi_read16(sd, 0x07, 0xfff); + bt-height = hdmi_read16(sd, 0x09, 0xfff); freq = (hdmi_read(sd, 0x06) * 100) + ((hdmi_read(sd, 0x3b) 0x30) 4) * 25; if (is_hdmi(sd)) { @@ -1326,29 +1336,19 @@ static int adv7604_query_dv_timings(struct v4l2_subdev *sd, freq = freq * 8 / bits_per_channel; } bt-pixelclock = freq; - bt-hfrontporch = (hdmi_read(sd, 0x20) 0x03) * 256 + - hdmi_read(sd, 0x21); - bt-hsync = (hdmi_read(sd, 0x22) 0x03) * 256 + - hdmi_read(sd, 0x23); - bt-hbackporch = (hdmi_read(sd, 0x24) 0x03) * 256 + - hdmi_read(sd, 0x25); - bt-vfrontporch = ((hdmi_read(sd, 0x2a) 0x1f) * 256 + - hdmi_read(sd, 0x2b)) / 2; - bt-vsync = ((hdmi_read(sd, 0x2e) 0x1f) * 256 + - hdmi_read(sd, 0x2f)) / 2; - bt-vbackporch = ((hdmi_read(sd, 0x32) 0x1f) * 256 + - hdmi_read(sd, 0x33)) / 2; + bt-hfrontporch = hdmi_read16(sd, 0x20, 0x3ff); + bt-hsync = hdmi_read16(sd, 0x22, 0x3ff); + bt-hbackporch = hdmi_read16(sd, 0x24, 0x3ff); + bt-vfrontporch = hdmi_read16(sd, 0x2a, 0x1fff) / 2; + bt-vsync = hdmi_read16(sd, 0x2e, 0x1fff) / 2; + bt-vbackporch = hdmi_read16(sd, 0x32, 0x1fff) / 2; bt-polarities = ((hdmi_read(sd, 0x05) 0x10) ? V4L2_DV_VSYNC_POS_POL : 0) | ((hdmi_read(sd, 0x05) 0x20) ? V4L2_DV_HSYNC_POS_POL : 0); if (bt-interlaced == V4L2_DV_INTERLACED) { - bt-height += (hdmi_read(sd, 0x0b) 0x0f) * 256 + - hdmi_read(sd, 0x0c); - bt-il_vfrontporch = ((hdmi_read(sd, 0x2c) 0x1f) * 256 + - hdmi_read(sd, 0x2d)) / 2; - bt-il_vsync = ((hdmi_read(sd, 0x30) 0x1f) * 256 + - hdmi_read(sd, 0x31)) / 2; - bt-vbackporch = ((hdmi_read(sd, 0x34) 0x1f) * 256 + - hdmi_read(sd, 0x35)) / 2; + bt-height += hdmi_read16(sd, 0x0b, 0xfff); + bt-il_vfrontporch = hdmi_read16(sd, 0x2c, 0x1fff) / 2; + bt-il_vsync = hdmi_read16(sd, 0x30, 0x1fff) / 2; + bt-vbackporch = hdmi_read16(sd, 0x34, 0x1fff) / 2; } adv7604_fill_optional_dv_timings_fields(sd, timings); } else { -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 39/49] adv7604: Inline the to_sd function
This one line function is called in a single location. Inline it. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7604.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 29bdb9e..1547909 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -340,11 +340,6 @@ static inline struct adv7604_state *to_state(struct v4l2_subdev *sd) return container_of(sd, struct adv7604_state, sd); } -static inline struct v4l2_subdev *to_sd(struct v4l2_ctrl *ctrl) -{ - return container_of(ctrl-handler, struct adv7604_state, hdl)-sd; -} - static inline unsigned hblanking(const struct v4l2_bt_timings *t) { return V4L2_DV_BT_BLANKING_WIDTH(t); @@ -1270,7 +1265,9 @@ static void set_rgb_quantization_range(struct v4l2_subdev *sd) static int adv7604_s_ctrl(struct v4l2_ctrl *ctrl) { - struct v4l2_subdev *sd = to_sd(ctrl); + struct v4l2_subdev *sd = + container_of(ctrl-handler, struct adv7604_state, hdl)-sd; + struct adv7604_state *state = to_state(sd); switch (ctrl-id) { -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 31/49] adv7604: Cache register contents when reading multiple bits
When extracting multiple bits from a single register read the register once and extract the bits on the read value. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7604.c | 33 - 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index da256dd..f9503d2 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -1207,6 +1207,8 @@ static int stdi2dv_timings(struct v4l2_subdev *sd, static int read_stdi(struct v4l2_subdev *sd, struct stdi_readback *stdi) { + u8 polarity; + if (no_lock_stdi(sd) || no_lock_sspd(sd)) { v4l2_dbg(2, debug, sd, %s: STDI and/or SSPD not locked\n, __func__); return -1; @@ -1219,11 +1221,12 @@ static int read_stdi(struct v4l2_subdev *sd, struct stdi_readback *stdi) stdi-interlaced = io_read(sd, 0x12) 0x10; /* read SSPD */ - if ((cp_read(sd, 0xb5) 0x03) == 0x01) { - stdi-hs_pol = ((cp_read(sd, 0xb5) 0x10) ? - ((cp_read(sd, 0xb5) 0x08) ? '+' : '-') : 'x'); - stdi-vs_pol = ((cp_read(sd, 0xb5) 0x40) ? - ((cp_read(sd, 0xb5) 0x20) ? '+' : '-') : 'x'); + polarity = cp_read(sd, 0xb5); + if ((polarity 0x03) == 0x01) { + stdi-hs_pol = polarity 0x10 +? (polarity 0x08 ? '+' : '-') : 'x'; + stdi-vs_pol = polarity 0x40 +? (polarity 0x20 ? '+' : '-') : 'x'; } else { stdi-hs_pol = 'x'; stdi-vs_pol = 'x'; @@ -1881,6 +1884,8 @@ static int adv7604_log_status(struct v4l2_subdev *sd) struct v4l2_dv_timings timings; struct stdi_readback stdi; u8 reg_io_0x02 = io_read(sd, 0x02); + u8 edid_enabled; + u8 cable_det; static const char * const csc_coeff_sel_rb[16] = { bypassed, YPbPr601 - RGB, reserved, YPbPr709 - RGB, @@ -1910,20 +1915,22 @@ static int adv7604_log_status(struct v4l2_subdev *sd) v4l2_info(sd, -Chip status-\n); v4l2_info(sd, Chip power: %s\n, no_power(sd) ? off : on); + edid_enabled = rep_read(sd, 0x7d); v4l2_info(sd, EDID enabled port A: %s, B: %s, C: %s, D: %s\n, - ((rep_read(sd, 0x7d) 0x01) ? Yes : No), - ((rep_read(sd, 0x7d) 0x02) ? Yes : No), - ((rep_read(sd, 0x7d) 0x04) ? Yes : No), - ((rep_read(sd, 0x7d) 0x08) ? Yes : No)); + ((edid_enabled 0x01) ? Yes : No), + ((edid_enabled 0x02) ? Yes : No), + ((edid_enabled 0x04) ? Yes : No), + ((edid_enabled 0x08) ? Yes : No)); v4l2_info(sd, CEC: %s\n, !!(cec_read(sd, 0x2a) 0x01) ? enabled : disabled); v4l2_info(sd, -Signal status-\n); + cable_det = io_read(sd, 0x6f); v4l2_info(sd, Cable detected (+5V power) port A: %s, B: %s, C: %s, D: %s\n, - ((io_read(sd, 0x6f) 0x10) ? Yes : No), - ((io_read(sd, 0x6f) 0x08) ? Yes : No), - ((io_read(sd, 0x6f) 0x04) ? Yes : No), - ((io_read(sd, 0x6f) 0x02) ? Yes : No)); + ((cable_det 0x10) ? Yes : No), + ((cable_det 0x08) ? Yes : No), + ((cable_det 0x04) ? Yes : No), + ((cable_det 0x02) ? Yes : No)); v4l2_info(sd, TMDS signal detected: %s\n, no_signal_tmds(sd) ? false : true); v4l2_info(sd, TMDS signal locked: %s\n, -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 49/49] adv7604: Mark adv7604_of_id table with __maybe_unused
The table is always declared but is unused when both CONFIG_OF and CONFIG_MODULES are not set. This results in a compile warning. Fix it by marking the table as __maybe_unused. The compiler will discard it if unused. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/i2c/adv7604.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 51029e1..1778d32 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -2672,7 +2672,7 @@ static struct i2c_device_id adv7604_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id); -static struct of_device_id adv7604_of_id[] = { +static struct of_device_id adv7604_of_id[] __maybe_unused = { { .compatible = adi,adv7611, .data = adv7604_chip_info[ADV7611] }, { } }; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 00/49] ADV7611 support
Hello, This patch set implements support for the ADV7611 in the adv7604 driver. It also comes up with new features such as output format configuration through pad format operations, hot-plug detect control through GPIO and DT support. I believe I've addressed all comments received on v3 and picked all the Acked-by, Reviewed-by and Tested-by tags from the mailing list. Changes since v3: - Dropped DT support for ADV7604 - Dropped the ADI-specific DT properties - Document port nodes in the DT bindings - Use the OF graph parsing code Changes since v2: - Use the same ioctls numbers for DV subdev and video ioctls - Accept edid == NULL when the number of blocks is 0 - Support digital bus reordering Changes since v1: - Check the edid and pad fields for various ioctls in the subdev core - Switch to the descriptor-based GPIO API - Leave enum adv7604_pad in header file - Keep the hotplug notifier - Fix compilation breakage when !CONFIG_OF due to directly dereferencing the return value of of_match_node() - Move patch v4l: subdev: Remove deprecated video-level DV timings operations later in the series to avoid bisection breakages - Document struct v4l2_enum_dv_timings reserved field as being set to 0 by both drivers and application - Document pad field of struct v4l2_enum_dv_timings and struct v4l2_dv_timings_cap as being used for subdev nodes only - Typo fixes in documentation Lars-Peter Clausen (4): adv7604: Add missing include to linux/types.h adv7604: Add support for asynchronous probing adv7604: Don't put info string arrays on the stack adv7604: Add adv7611 support Laurent Pinchart (45): v4l: Add UYVY10_2X10 and VYUY10_2X10 media bus pixel codes v4l: Add UYVY10_1X20 and VYUY10_1X20 media bus pixel codes v4l: Add 12-bit YUV 4:2:0 media bus pixel codes v4l: Add 12-bit YUV 4:2:2 media bus pixel codes v4l: Add pad-level DV timings subdev operations ad9389b: Add pad-level DV timings operations adv7511: Add pad-level DV timings operations adv7842: Add pad-level DV timings operations s5p-tv: hdmi: Add pad-level DV timings operations s5p-tv: hdmiphy: Add pad-level DV timings operations ths8200: Add pad-level DV timings operations tvp7002: Add pad-level DV timings operations media: bfin_capture: Switch to pad-level DV operations media: davinci: vpif: Switch to pad-level DV operations media: staging: davinci: vpfe: Switch to pad-level DV operations s5p-tv: mixer: Switch to pad-level DV operations ad9389b: Remove deprecated video-level DV timings operations adv7511: Remove deprecated video-level DV timings operations adv7842: Remove deprecated video-level DV timings operations s5p-tv: hdmi: Remove deprecated video-level DV timings operations s5p-tv: hdmiphy: Remove deprecated video-level DV timings operation ths8200: Remove deprecated video-level DV timings operations tvp7002: Remove deprecated video-level DV timings operations v4l: Improve readability by not wrapping ioctl number #define's v4l: Add support for DV timings ioctls on subdev nodes v4l: Validate fields in the core code for subdev EDID ioctls adv7604: Add 16-bit read functions for CP and HDMI adv7604: Cache register contents when reading multiple bits adv7604: Remove subdev control handlers adv7604: Add sink pads adv7604: Make output format configurable through pad format operations adv7604: Add pad-level DV timings support adv7604: Remove deprecated video-level DV timings operations v4l: subdev: Remove deprecated video-level DV timings operations adv7604: Inline the to_sd function adv7604: Store I2C addresses and clients in arrays adv7604: Replace *_and_or() functions with *_clr_set() adv7604: Sort headers alphabetically adv7604: Support hot-plug detect control through a GPIO adv7604: Specify the default input through platform data adv7604: Add DT support adv7604: Add LLC polarity configuration adv7604: Add endpoint properties to DT bindings adv7604: Set HPD GPIO direction to output adv7604: Mark adv7604_of_id table with __maybe_unused Documentation/DocBook/media/v4l/subdev-formats.xml | 760 ++ .../DocBook/media/v4l/vidioc-dv-timings-cap.xml| 27 +- .../DocBook/media/v4l/vidioc-enum-dv-timings.xml | 30 +- .../devicetree/bindings/media/i2c/adv7604.txt | 70 + drivers/media/i2c/ad9389b.c| 64 +- drivers/media/i2c/adv7511.c| 66 +- drivers/media/i2c/adv7604.c| 1468 ++-- drivers/media/i2c/adv7842.c| 14 +- drivers/media/i2c/ths8200.c| 10 + drivers/media/i2c/tvp7002.c|5 +- drivers/media/platform/blackfin/bfin_capture.c |4 +- drivers/media/platform/davinci/vpif_capture.c |4 +- drivers/media/platform/davinci/vpif_display.c |4 +- drivers/media/platform/s5p-tv/hdmi_drv.c | 14 +-
[PATCH v4 48/49] adv7604: Set HPD GPIO direction to output
The HPD GPIO is used as an output but its direction is never set. Fix it. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Acked-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7604.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 63f036f..51029e1 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -2798,7 +2798,7 @@ static int adv7604_probe(struct i2c_client *client, if (IS_ERR(state-hpd_gpio[i])) continue; - gpiod_set_value_cansleep(state-hpd_gpio[i], 0); + gpiod_direction_output(state-hpd_gpio[i], 0); v4l_info(client, Handling HPD %u GPIO\n, i); } -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 46/49] adv7604: Add LLC polarity configuration
Add an inv_llc_pol field to platform data to control the clock polarity. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com --- drivers/media/i2c/adv7604.c | 3 ++- include/media/adv7604.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 061794e..fd0c646 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -2466,7 +2466,8 @@ static int adv7604_core_init(struct v4l2_subdev *sd) cp_write(sd, 0x69, 0x30); /* Enable CP CSC */ /* VS, HS polarities */ - io_write(sd, 0x06, 0xa0 | pdata-inv_vs_pol 2 | pdata-inv_hs_pol 1); + io_write(sd, 0x06, 0xa0 | pdata-inv_vs_pol 2 | +pdata-inv_hs_pol 1 | pdata-inv_llc_pol); /* Adjust drive strength */ io_write(sd, 0x14, 0x40 | pdata-dr_str_data 4 | diff --git a/include/media/adv7604.h b/include/media/adv7604.h index 40b4ae0..aa1c447 100644 --- a/include/media/adv7604.h +++ b/include/media/adv7604.h @@ -131,6 +131,7 @@ struct adv7604_platform_data { /* IO register 0x06 */ unsigned inv_vs_pol:1; unsigned inv_hs_pol:1; + unsigned inv_llc_pol:1; /* IO register 0x14 */ enum adv7604_drive_strength dr_str_data; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 36/49] adv7604: Add pad-level DV timings support
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7604.c | 47 + 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 59f7bf0..684b912 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -1514,24 +1514,42 @@ static int read_stdi(struct v4l2_subdev *sd, struct stdi_readback *stdi) static int adv7604_enum_dv_timings(struct v4l2_subdev *sd, struct v4l2_enum_dv_timings *timings) { + struct adv7604_state *state = to_state(sd); + if (timings-index = ARRAY_SIZE(adv7604_timings) - 1) return -EINVAL; + + if (timings-pad = state-source_pad) + return -EINVAL; + memset(timings-reserved, 0, sizeof(timings-reserved)); timings-timings = adv7604_timings[timings-index]; return 0; } -static int adv7604_dv_timings_cap(struct v4l2_subdev *sd, - struct v4l2_dv_timings_cap *cap) +static int __adv7604_dv_timings_cap(struct v4l2_subdev *sd, + struct v4l2_dv_timings_cap *cap, + unsigned int pad) { cap-type = V4L2_DV_BT_656_1120; cap-bt.max_width = 1920; cap-bt.max_height = 1200; cap-bt.min_pixelclock = 2500; - if (is_digital_input(sd)) + + switch (pad) { + case ADV7604_PAD_HDMI_PORT_A: + case ADV7604_PAD_HDMI_PORT_B: + case ADV7604_PAD_HDMI_PORT_C: + case ADV7604_PAD_HDMI_PORT_D: cap-bt.max_pixelclock = 22500; - else + break; + case ADV7604_PAD_VGA_RGB: + case ADV7604_PAD_VGA_COMP: + default: cap-bt.max_pixelclock = 17000; + break; + } + cap-bt.standards = V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT; cap-bt.capabilities = V4L2_DV_BT_CAP_PROGRESSIVE | @@ -1539,6 +1557,25 @@ static int adv7604_dv_timings_cap(struct v4l2_subdev *sd, return 0; } +static int adv7604_dv_timings_cap(struct v4l2_subdev *sd, + struct v4l2_dv_timings_cap *cap) +{ + struct adv7604_state *state = to_state(sd); + + return __adv7604_dv_timings_cap(sd, cap, state-selected_input); +} + +static int adv7604_pad_dv_timings_cap(struct v4l2_subdev *sd, + struct v4l2_dv_timings_cap *cap) +{ + struct adv7604_state *state = to_state(sd); + + if (cap-pad = state-source_pad) + return -EINVAL; + + return __adv7604_dv_timings_cap(sd, cap, cap-pad); +} + /* Fill the optional fields .standards and .flags in struct v4l2_dv_timings if the format is listed in adv7604_timings[] */ static void adv7604_fill_optional_dv_timings_fields(struct v4l2_subdev *sd, @@ -2426,6 +2463,8 @@ static const struct v4l2_subdev_pad_ops adv7604_pad_ops = { .set_fmt = adv7604_set_format, .get_edid = adv7604_get_edid, .set_edid = adv7604_set_edid, + .dv_timings_cap = adv7604_pad_dv_timings_cap, + .enum_dv_timings = adv7604_enum_dv_timings, }; static const struct v4l2_subdev_ops adv7604_ops = { -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 16/49] s5p-tv: mixer: Switch to pad-level DV operations
The video-level enum_dv_timings and dv_timings_cap operations are deprecated in favor of the pad-level versions. All subdev drivers implement the pad-level versions, switch to them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/platform/s5p-tv/mixer_video.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/s5p-tv/mixer_video.c b/drivers/media/platform/s5p-tv/mixer_video.c index a1ce55f..fd46590 100644 --- a/drivers/media/platform/s5p-tv/mixer_video.c +++ b/drivers/media/platform/s5p-tv/mixer_video.c @@ -509,9 +509,11 @@ static int mxr_enum_dv_timings(struct file *file, void *fh, struct mxr_device *mdev = layer-mdev; int ret; + timings-pad = 0; + /* lock protects from changing sd_out */ mutex_lock(mdev-mutex); - ret = v4l2_subdev_call(to_outsd(mdev), video, enum_dv_timings, timings); + ret = v4l2_subdev_call(to_outsd(mdev), pad, enum_dv_timings, timings); mutex_unlock(mdev-mutex); return ret ? -EINVAL : 0; @@ -567,9 +569,11 @@ static int mxr_dv_timings_cap(struct file *file, void *fh, struct mxr_device *mdev = layer-mdev; int ret; + cap-pad = 0; + /* lock protects from changing sd_out */ mutex_lock(mdev-mutex); - ret = v4l2_subdev_call(to_outsd(mdev), video, dv_timings_cap, cap); + ret = v4l2_subdev_call(to_outsd(mdev), pad, dv_timings_cap, cap); mutex_unlock(mdev-mutex); return ret ? -EINVAL : 0; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 47/49] adv7604: Add endpoint properties to DT bindings
Add support for the hsync-active, vsync-active and pclk-sample properties to the DT bindings and control BT.656 mode implicitly. Cc: devicet...@vger.kernel.org Cc: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Acked-by: Hans Verkuil hans.verk...@cisco.com --- .../devicetree/bindings/media/i2c/adv7604.txt | 13 + drivers/media/i2c/adv7604.c| 34 -- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt index 2efb48f..c27cede 100644 --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt @@ -33,6 +33,19 @@ Optional Properties: - reset-gpios: Reference to the GPIO connected to the device's reset pin. +Optional Endpoint Properties: + + The following three properties are defined in video-interfaces.txt and are + valid for source endpoints only. + + - hsync-active: Horizontal synchronization polarity. Defaults to active low. + - vsync-active: Vertical synchronization polarity. Defaults to active low. + - pclk-sample: Pixel clock polarity. Defaults to output on the falling edge. + + If none of hsync-active, vsync-active and pclk-sample is specified the + endpoint will use embedded BT.656 synchronization. + + Example: hdmi_receiver@4c { diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index fd0c646..63f036f 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -41,6 +41,7 @@ #include media/v4l2-ctrls.h #include media/v4l2-device.h #include media/v4l2-dv-timings.h +#include media/v4l2-of.h static int debug; module_param(debug, int, 0644); @@ -2679,6 +2680,37 @@ MODULE_DEVICE_TABLE(of, adv7604_of_id); static int adv7604_parse_dt(struct adv7604_state *state) { + struct v4l2_of_endpoint bus_cfg; + struct device_node *endpoint; + struct device_node *np; + unsigned int flags; + + np = state-i2c_clients[ADV7604_PAGE_IO]-dev.of_node; + + /* Parse the endpoint. */ + endpoint = of_graph_get_next_endpoint(np, NULL); + if (!endpoint) + return -EINVAL; + + v4l2_of_parse_endpoint(endpoint, bus_cfg); + of_node_put(endpoint); + + flags = bus_cfg.bus.parallel.flags; + + if (flags V4L2_MBUS_HSYNC_ACTIVE_HIGH) + state-pdata.inv_hs_pol = 1; + + if (flags V4L2_MBUS_VSYNC_ACTIVE_HIGH) + state-pdata.inv_vs_pol = 1; + + if (flags V4L2_MBUS_PCLK_SAMPLE_RISING) + state-pdata.inv_llc_pol = 1; + + if (bus_cfg.bus_type == V4L2_MBUS_BT656) { + state-pdata.insert_av_codes = 1; + state-pdata.op_656_range = 1; + } + /* Disable the interrupt for now as no DT-based board uses it. */ state-pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED; @@ -2701,9 +2733,7 @@ static int adv7604_parse_dt(struct adv7604_state *state) state-pdata.disable_cable_det_rst = 0; state-pdata.default_input = -1; state-pdata.blank_data = 1; - state-pdata.op_656_range = 1; state-pdata.alt_data_sat = 1; - state-pdata.insert_av_codes = 1; state-pdata.op_format_mode_sel = ADV7604_OP_FORMAT_MODE0; state-pdata.bus_order = ADV7604_BUS_ORDER_RGB; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 41/49] adv7604: Replace *_and_or() functions with *_clr_set()
The *_and_or() functions take an 'and' bitmask to be ANDed with the register value before ORing it with th 'or' bitmask. As the functions are used to mask and set bits selectively, this requires the caller to invert the 'and' bitmask and is thus error prone. Replace those functions with a *_clr_set() variant that takes a mask of bits to be cleared instead of a mask of bits to be kept. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7604.c | 86 ++--- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index fc71c17..7a9c17c 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -429,9 +429,9 @@ static inline int io_write(struct v4l2_subdev *sd, u8 reg, u8 val) return adv_smbus_write_byte_data(state, ADV7604_PAGE_IO, reg, val); } -static inline int io_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) +static inline int io_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) { - return io_write(sd, reg, (io_read(sd, reg) mask) | val); + return io_write(sd, reg, (io_read(sd, reg) ~mask) | val); } static inline int avlink_read(struct v4l2_subdev *sd, u8 reg) @@ -462,9 +462,9 @@ static inline int cec_write(struct v4l2_subdev *sd, u8 reg, u8 val) return adv_smbus_write_byte_data(state, ADV7604_PAGE_CEC, reg, val); } -static inline int cec_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) +static inline int cec_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) { - return cec_write(sd, reg, (cec_read(sd, reg) mask) | val); + return cec_write(sd, reg, (cec_read(sd, reg) ~mask) | val); } static inline int infoframe_read(struct v4l2_subdev *sd, u8 reg) @@ -538,9 +538,9 @@ static inline int rep_write(struct v4l2_subdev *sd, u8 reg, u8 val) return adv_smbus_write_byte_data(state, ADV7604_PAGE_REP, reg, val); } -static inline int rep_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) +static inline int rep_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) { - return rep_write(sd, reg, (rep_read(sd, reg) mask) | val); + return rep_write(sd, reg, (rep_read(sd, reg) ~mask) | val); } static inline int edid_read(struct v4l2_subdev *sd, u8 reg) @@ -629,9 +629,9 @@ static inline int hdmi_write(struct v4l2_subdev *sd, u8 reg, u8 val) return adv_smbus_write_byte_data(state, ADV7604_PAGE_HDMI, reg, val); } -static inline int hdmi_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) +static inline int hdmi_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) { - return hdmi_write(sd, reg, (hdmi_read(sd, reg) mask) | val); + return hdmi_write(sd, reg, (hdmi_read(sd, reg) ~mask) | val); } static inline int test_read(struct v4l2_subdev *sd, u8 reg) @@ -667,9 +667,9 @@ static inline int cp_write(struct v4l2_subdev *sd, u8 reg, u8 val) return adv_smbus_write_byte_data(state, ADV7604_PAGE_CP, reg, val); } -static inline int cp_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) +static inline int cp_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) { - return cp_write(sd, reg, (cp_read(sd, reg) mask) | val); + return cp_write(sd, reg, (cp_read(sd, reg) ~mask) | val); } static inline int vdp_read(struct v4l2_subdev *sd, u8 reg) @@ -947,7 +947,7 @@ static int configure_predefined_video_timings(struct v4l2_subdev *sd, io_write(sd, 0x17, 0x5a); } /* disable embedded syncs for auto graphics mode */ - cp_write_and_or(sd, 0x81, 0xef, 0x00); + cp_write_clr_set(sd, 0x81, 0x10, 0x00); cp_write(sd, 0x8f, 0x00); cp_write(sd, 0x90, 0x00); cp_write(sd, 0xa2, 0x00); @@ -1005,7 +1005,7 @@ static void configure_custom_video_timings(struct v4l2_subdev *sd, io_write(sd, 0x00, 0x07); /* video std */ io_write(sd, 0x01, 0x02); /* prim mode */ /* enable embedded syncs for auto graphics mode */ - cp_write_and_or(sd, 0x81, 0xef, 0x10); + cp_write_clr_set(sd, 0x81, 0x10, 0x10); /* Should only be set in auto-graphics mode [REF_02, p. 91-92] */ /* setup PLL_DIV_MAN_EN and PLL_DIV_RATIO */ @@ -1115,21 +1115,21 @@ static void set_rgb_quantization_range(struct v4l2_subdev *sd) if (state-selected_input == ADV7604_PAD_VGA_RGB) { /* Receiving analog RGB signal * Set RGB full range (0-255) */ - io_write_and_or(sd, 0x02, 0x0f, 0x10); + io_write_clr_set(sd, 0x02, 0xf0, 0x10); break; } if (state-selected_input == ADV7604_PAD_VGA_COMP)
[PATCH v4 44/49] adv7604: Specify the default input through platform data
And set input routing when initializing the device. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7604.c | 7 +++ include/media/adv7604.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index b14dc7d..342d73d 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -2441,6 +2441,13 @@ static int adv7604_core_init(struct v4l2_subdev *sd) disable_input(sd); + if (pdata-default_input = 0 + pdata-default_input state-source_pad) { + state-selected_input = pdata-default_input; + select_input(sd); + enable_input(sd); + } + /* power */ io_write(sd, 0x0c, 0x42); /* Power up part and power down VDP */ io_write(sd, 0x0b, 0x44); /* Power down ESDP block */ diff --git a/include/media/adv7604.h b/include/media/adv7604.h index 276135b..40b4ae0 100644 --- a/include/media/adv7604.h +++ b/include/media/adv7604.h @@ -104,6 +104,8 @@ struct adv7604_platform_data { /* DIS_CABLE_DET_RST: 1 if the 5V pins are unused and unconnected */ unsigned disable_cable_det_rst:1; + int default_input; + /* Analog input muxing mode */ enum adv7604_ain_sel ain_sel; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 40/49] adv7604: Store I2C addresses and clients in arrays
This allows replacing duplicate code blocks by loops over the arrays. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7604.c | 248 +--- include/media/adv7604.h | 30 +++--- 2 files changed, 88 insertions(+), 190 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 1547909..fc71c17 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -159,18 +159,7 @@ struct adv7604_state { bool restart_stdi_once; /* i2c clients */ - struct i2c_client *i2c_avlink; - struct i2c_client *i2c_cec; - struct i2c_client *i2c_infoframe; - struct i2c_client *i2c_esdp; - struct i2c_client *i2c_dpp; - struct i2c_client *i2c_afe; - struct i2c_client *i2c_repeater; - struct i2c_client *i2c_edid; - struct i2c_client *i2c_hdmi; - struct i2c_client *i2c_test; - struct i2c_client *i2c_cp; - struct i2c_client *i2c_vdp; + struct i2c_client *i2c_clients[ADV7604_PAGE_MAX]; /* controls */ struct v4l2_ctrl *detect_tx_5v_ctrl; @@ -377,14 +366,18 @@ static s32 adv_smbus_read_byte_data_check(struct i2c_client *client, return -EIO; } -static s32 adv_smbus_read_byte_data(struct i2c_client *client, u8 command) +static s32 adv_smbus_read_byte_data(struct adv7604_state *state, + enum adv7604_page page, u8 command) { - return adv_smbus_read_byte_data_check(client, command, true); + return adv_smbus_read_byte_data_check(state-i2c_clients[page], + command, true); } -static s32 adv_smbus_write_byte_data(struct i2c_client *client, - u8 command, u8 value) +static s32 adv_smbus_write_byte_data(struct adv7604_state *state, +enum adv7604_page page, u8 command, +u8 value) { + struct i2c_client *client = state-i2c_clients[page]; union i2c_smbus_data data; int err; int i; @@ -404,9 +397,11 @@ static s32 adv_smbus_write_byte_data(struct i2c_client *client, return err; } -static s32 adv_smbus_write_i2c_block_data(struct i2c_client *client, - u8 command, unsigned length, const u8 *values) +static s32 adv_smbus_write_i2c_block_data(struct adv7604_state *state, + enum adv7604_page page, u8 command, + unsigned length, const u8 *values) { + struct i2c_client *client = state-i2c_clients[page]; union i2c_smbus_data data; if (length I2C_SMBUS_BLOCK_MAX) @@ -422,16 +417,16 @@ static s32 adv_smbus_write_i2c_block_data(struct i2c_client *client, static inline int io_read(struct v4l2_subdev *sd, u8 reg) { - struct i2c_client *client = v4l2_get_subdevdata(sd); + struct adv7604_state *state = to_state(sd); - return adv_smbus_read_byte_data(client, reg); + return adv_smbus_read_byte_data(state, ADV7604_PAGE_IO, reg); } static inline int io_write(struct v4l2_subdev *sd, u8 reg, u8 val) { - struct i2c_client *client = v4l2_get_subdevdata(sd); + struct adv7604_state *state = to_state(sd); - return adv_smbus_write_byte_data(client, reg, val); + return adv_smbus_write_byte_data(state, ADV7604_PAGE_IO, reg, val); } static inline int io_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) @@ -443,28 +438,28 @@ static inline int avlink_read(struct v4l2_subdev *sd, u8 reg) { struct adv7604_state *state = to_state(sd); - return adv_smbus_read_byte_data(state-i2c_avlink, reg); + return adv_smbus_read_byte_data(state, ADV7604_PAGE_AVLINK, reg); } static inline int avlink_write(struct v4l2_subdev *sd, u8 reg, u8 val) { struct adv7604_state *state = to_state(sd); - return adv_smbus_write_byte_data(state-i2c_avlink, reg, val); + return adv_smbus_write_byte_data(state, ADV7604_PAGE_AVLINK, reg, val); } static inline int cec_read(struct v4l2_subdev *sd, u8 reg) { struct adv7604_state *state = to_state(sd); - return adv_smbus_read_byte_data(state-i2c_cec, reg); + return adv_smbus_read_byte_data(state, ADV7604_PAGE_CEC, reg); } static inline int cec_write(struct v4l2_subdev *sd, u8 reg, u8 val) { struct adv7604_state *state = to_state(sd); - return adv_smbus_write_byte_data(state-i2c_cec, reg, val); + return adv_smbus_write_byte_data(state, ADV7604_PAGE_CEC, reg, val); } static inline int cec_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) @@ -476,70 +471,71 @@ static inline int infoframe_read(struct v4l2_subdev *sd, u8 reg) { struct adv7604_state *state = to_state(sd); - return
[PATCH v4 42/49] adv7604: Sort headers alphabetically
This helps locating duplicates and inserting new headers. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7604.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 7a9c17c..9ebe44c 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -27,19 +27,19 @@ * REF_03 - Analog devices, ADV7604, Hardware Manual, Rev. F, August 2010 */ - +#include linux/delay.h +#include linux/i2c.h #include linux/kernel.h #include linux/module.h #include linux/slab.h -#include linux/i2c.h -#include linux/delay.h +#include linux/v4l2-dv-timings.h #include linux/videodev2.h #include linux/workqueue.h -#include linux/v4l2-dv-timings.h -#include media/v4l2-device.h + +#include media/adv7604.h #include media/v4l2-ctrls.h +#include media/v4l2-device.h #include media/v4l2-dv-timings.h -#include media/adv7604.h static int debug; module_param(debug, int, 0644); -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 45/49] adv7604: Add DT support
Parse the device tree node to populate platform data. Only the ADV7611 is currently support with DT. Cc: devicet...@vger.kernel.org Cc: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Acked-by: Hans Verkuil hans.verk...@cisco.com --- .../devicetree/bindings/media/i2c/adv7604.txt | 57 +++ drivers/media/i2c/adv7604.c| 80 ++ 2 files changed, 123 insertions(+), 14 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7604.txt diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt new file mode 100644 index 000..2efb48f --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt @@ -0,0 +1,57 @@ +* Analog Devices ADV7604/11 video decoder with HDMI receiver + +The ADV7604 and ADV7611 are multiformat video decoders with an integrated HDMI +receiver. The ADV7604 has four multiplexed HDMI inputs and one analog input, +and the ADV7611 has one HDMI input and no analog input. + +These device tree bindings support the ADV7611 only at the moment. + +Required Properties: + + - compatible: Must contain one of the following +- adi,adv7611 for the ADV7611 + + - reg: I2C slave address + + - hpd-gpios: References to the GPIOs that control the HDMI hot-plug +detection pins, one per HDMI input. The active flag indicates the GPIO +level that enables hot-plug detection. + +The device node must contain one 'port' child node per device input and output +port, in accordance with the video interface bindings defined in +Documentation/devicetree/bindings/media/video-interfaces.txt. The port nodes +are numbered as follows. + + Port ADV7611 + + HDMI 0 + Digital output 1 + +The digital output port node must contain at least one endpoint. + +Optional Properties: + + - reset-gpios: Reference to the GPIO connected to the device's reset pin. + +Example: + + hdmi_receiver@4c { + compatible = adi,adv7611; + reg = 0x4c; + + reset-gpios = ioexp 0 GPIO_ACTIVE_LOW; + hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH; + + #address-cells = 1; + #size-cells = 0; + + port@0 { + reg = 0; + }; + port@1 { + reg = 1; + hdmi_in: endpoint { + remote-endpoint = ccdc_in; + }; + }; + }; diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 342d73d..061794e 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -2663,13 +2663,58 @@ static const struct adv7604_chip_info adv7604_chip_info[] = { }, }; +static struct i2c_device_id adv7604_i2c_id[] = { + { adv7604, (kernel_ulong_t)adv7604_chip_info[ADV7604] }, + { adv7611, (kernel_ulong_t)adv7604_chip_info[ADV7611] }, + { } +}; +MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id); + +static struct of_device_id adv7604_of_id[] = { + { .compatible = adi,adv7611, .data = adv7604_chip_info[ADV7611] }, + { } +}; +MODULE_DEVICE_TABLE(of, adv7604_of_id); + +static int adv7604_parse_dt(struct adv7604_state *state) +{ + /* Disable the interrupt for now as no DT-based board uses it. */ + state-pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED; + + /* Use the default I2C addresses. */ + state-pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42; + state-pdata.i2c_addresses[ADV7604_PAGE_CEC] = 0x40; + state-pdata.i2c_addresses[ADV7604_PAGE_INFOFRAME] = 0x3e; + state-pdata.i2c_addresses[ADV7604_PAGE_ESDP] = 0x38; + state-pdata.i2c_addresses[ADV7604_PAGE_DPP] = 0x3c; + state-pdata.i2c_addresses[ADV7604_PAGE_AFE] = 0x26; + state-pdata.i2c_addresses[ADV7604_PAGE_REP] = 0x32; + state-pdata.i2c_addresses[ADV7604_PAGE_EDID] = 0x36; + state-pdata.i2c_addresses[ADV7604_PAGE_HDMI] = 0x34; + state-pdata.i2c_addresses[ADV7604_PAGE_TEST] = 0x30; + state-pdata.i2c_addresses[ADV7604_PAGE_CP] = 0x22; + state-pdata.i2c_addresses[ADV7604_PAGE_VDP] = 0x24; + + /* Hardcode the remaining platform data fields. */ + state-pdata.disable_pwrdnb = 0; + state-pdata.disable_cable_det_rst = 0; + state-pdata.default_input = -1; + state-pdata.blank_data = 1; + state-pdata.op_656_range = 1; + state-pdata.alt_data_sat = 1; + state-pdata.insert_av_codes = 1; + state-pdata.op_format_mode_sel = ADV7604_OP_FORMAT_MODE0; + state-pdata.bus_order = ADV7604_BUS_ORDER_RGB; + + return 0; +} + static int adv7604_probe(struct i2c_client *client, const struct i2c_device_id *id) { static const struct
[PATCH v4 38/49] v4l: subdev: Remove deprecated video-level DV timings operations
The video enum_dv_timings and dv_timings_cap operations are deprecated and unused. Remove them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Sakari Ailus sakari.ai...@linux.intel.com Acked-by: Lad, Prabhakar prabhakar.cse...@gmail.com --- include/media/v4l2-subdev.h | 4 1 file changed, 4 deletions(-) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 341ca4d..577b3e1 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -331,12 +331,8 @@ struct v4l2_subdev_video_ops { struct v4l2_dv_timings *timings); int (*g_dv_timings)(struct v4l2_subdev *sd, struct v4l2_dv_timings *timings); - int (*enum_dv_timings)(struct v4l2_subdev *sd, - struct v4l2_enum_dv_timings *timings); int (*query_dv_timings)(struct v4l2_subdev *sd, struct v4l2_dv_timings *timings); - int (*dv_timings_cap)(struct v4l2_subdev *sd, - struct v4l2_dv_timings_cap *cap); int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index, enum v4l2_mbus_pixelcode *code); int (*enum_mbus_fsizes)(struct v4l2_subdev *sd, -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 35/49] adv7604: Make output format configurable through pad format operations
Replace the dummy video format operations by pad format operations that configure the output format. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com Tested-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7604.c | 280 include/media/adv7604.h | 56 - 2 files changed, 275 insertions(+), 61 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 79fb34d..59f7bf0 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -53,6 +53,28 @@ MODULE_LICENSE(GPL); /* ADV7604 system clock frequency */ #define ADV7604_fsc (28636360) +#define ADV7604_RGB_OUT(1 1) + +#define ADV7604_OP_FORMAT_SEL_8BIT (0 0) +#define ADV7604_OP_FORMAT_SEL_10BIT(1 0) +#define ADV7604_OP_FORMAT_SEL_12BIT(2 0) + +#define ADV7604_OP_MODE_SEL_SDR_422(0 5) +#define ADV7604_OP_MODE_SEL_DDR_422(1 5) +#define ADV7604_OP_MODE_SEL_SDR_444(2 5) +#define ADV7604_OP_MODE_SEL_DDR_444(3 5) +#define ADV7604_OP_MODE_SEL_SDR_422_2X (4 5) +#define ADV7604_OP_MODE_SEL_ADI_CM (5 5) + +#define ADV7604_OP_CH_SEL_GBR (0 5) +#define ADV7604_OP_CH_SEL_GRB (1 5) +#define ADV7604_OP_CH_SEL_BGR (2 5) +#define ADV7604_OP_CH_SEL_RGB (3 5) +#define ADV7604_OP_CH_SEL_BRG (4 5) +#define ADV7604_OP_CH_SEL_RBG (5 5) + +#define ADV7604_OP_SWAP_CB_CR (1 0) + enum adv7604_type { ADV7604, ADV7611, @@ -63,6 +85,14 @@ struct adv7604_reg_seq { u8 val; }; +struct adv7604_format_info { + enum v4l2_mbus_pixelcode code; + u8 op_ch_sel; + bool rgb_out; + bool swap_cb_cr; + u8 op_format_sel; +}; + struct adv7604_chip_info { enum adv7604_type type; @@ -78,6 +108,9 @@ struct adv7604_chip_info { unsigned int tdms_lock_mask; unsigned int fmt_change_digital_mask; + const struct adv7604_format_info *formats; + unsigned int nformats; + void (*set_termination)(struct v4l2_subdev *sd, bool enable); void (*setup_irqs)(struct v4l2_subdev *sd); unsigned int (*read_hdmi_pixelclock)(struct v4l2_subdev *sd); @@ -101,12 +134,18 @@ struct adv7604_chip_info { struct adv7604_state { const struct adv7604_chip_info *info; struct adv7604_platform_data pdata; + struct v4l2_subdev sd; struct media_pad pads[ADV7604_PAD_MAX]; unsigned int source_pad; + struct v4l2_ctrl_handler hdl; + enum adv7604_pad selected_input; + struct v4l2_dv_timings timings; + const struct adv7604_format_info *format; + struct { u8 edid[256]; u32 present; @@ -771,6 +810,93 @@ static void adv7604_write_reg_seq(struct v4l2_subdev *sd, adv7604_write_reg(sd, reg_seq[i].reg, reg_seq[i].val); } +/* - + * Format helpers + */ + +static const struct adv7604_format_info adv7604_formats[] = { + { V4L2_MBUS_FMT_RGB888_1X24, ADV7604_OP_CH_SEL_RGB, true, false, + ADV7604_OP_MODE_SEL_SDR_444 | ADV7604_OP_FORMAT_SEL_8BIT }, + { V4L2_MBUS_FMT_YUYV8_2X8, ADV7604_OP_CH_SEL_RGB, false, false, + ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_8BIT }, + { V4L2_MBUS_FMT_YVYU8_2X8, ADV7604_OP_CH_SEL_RGB, false, true, + ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_8BIT }, + { V4L2_MBUS_FMT_YUYV10_2X10, ADV7604_OP_CH_SEL_RGB, false, false, + ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_10BIT }, + { V4L2_MBUS_FMT_YVYU10_2X10, ADV7604_OP_CH_SEL_RGB, false, true, + ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_10BIT }, + { V4L2_MBUS_FMT_YUYV12_2X12, ADV7604_OP_CH_SEL_RGB, false, false, + ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_12BIT }, + { V4L2_MBUS_FMT_YVYU12_2X12, ADV7604_OP_CH_SEL_RGB, false, true, + ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_12BIT }, + { V4L2_MBUS_FMT_UYVY8_1X16, ADV7604_OP_CH_SEL_RBG, false, false, + ADV7604_OP_MODE_SEL_SDR_422_2X | ADV7604_OP_FORMAT_SEL_8BIT }, + { V4L2_MBUS_FMT_VYUY8_1X16, ADV7604_OP_CH_SEL_RBG, false, true, + ADV7604_OP_MODE_SEL_SDR_422_2X | ADV7604_OP_FORMAT_SEL_8BIT }, + { V4L2_MBUS_FMT_YUYV8_1X16, ADV7604_OP_CH_SEL_RGB, false, false, + ADV7604_OP_MODE_SEL_SDR_422_2X | ADV7604_OP_FORMAT_SEL_8BIT }, + { V4L2_MBUS_FMT_YVYU8_1X16, ADV7604_OP_CH_SEL_RGB, false, true, + ADV7604_OP_MODE_SEL_SDR_422_2X |
[PATCH v4 43/49] adv7604: Support hot-plug detect control through a GPIO
Add support for optional GPIO-controlled HPD pins in addition to the ADV7604-specific hotplug notifier. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7604.c | 37 + 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 9ebe44c..b14dc7d 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -28,6 +28,7 @@ */ #include linux/delay.h +#include linux/gpio/consumer.h #include linux/i2c.h #include linux/kernel.h #include linux/module.h @@ -135,6 +136,8 @@ struct adv7604_state { const struct adv7604_chip_info *info; struct adv7604_platform_data pdata; + struct gpio_desc *hpd_gpio[4]; + struct v4l2_subdev sd; struct media_pad pads[ADV7604_PAD_MAX]; unsigned int source_pad; @@ -598,6 +601,20 @@ static inline int edid_write_block(struct v4l2_subdev *sd, return err; } +static void adv7604_set_hpd(struct adv7604_state *state, unsigned int hpd) +{ + unsigned int i; + + for (i = 0; i state-info-num_dv_ports; ++i) { + if (IS_ERR(state-hpd_gpio[i])) + continue; + + gpiod_set_value_cansleep(state-hpd_gpio[i], hpd BIT(i)); + } + + v4l2_subdev_notify(state-sd, ADV7604_HOTPLUG, hpd); +} + static void adv7604_delayed_work_enable_hotplug(struct work_struct *work) { struct delayed_work *dwork = to_delayed_work(work); @@ -607,7 +624,7 @@ static void adv7604_delayed_work_enable_hotplug(struct work_struct *work) v4l2_dbg(2, debug, sd, %s: enable hotplug\n, __func__); - v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void *)state-edid.present); + adv7604_set_hpd(state, state-edid.present); } static inline int hdmi_read(struct v4l2_subdev *sd, u8 reg) @@ -2047,7 +2064,6 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) struct adv7604_state *state = to_state(sd); const struct adv7604_chip_info *info = state-info; int spa_loc; - int tmp = 0; int err; int i; @@ -2058,7 +2074,7 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) if (edid-blocks == 0) { /* Disable hotplug and I2C access to EDID RAM from DDC port */ state-edid.present = ~(1 edid-pad); - v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void *)state-edid.present); + adv7604_set_hpd(state, state-edid.present); rep_write_clr_set(sd, info-edid_enable_reg, 0x0f, state-edid.present); /* Fall back to a 16:9 aspect ratio */ @@ -2082,7 +2098,7 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) /* Disable hotplug and I2C access to EDID RAM from DDC port */ cancel_delayed_work_sync(state-delayed_work_enable_hotplug); - v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void *)tmp); + adv7604_set_hpd(state, 0); rep_write_clr_set(sd, info-edid_enable_reg, 0x0f, 0x00); spa_loc = get_edid_spa_location(edid-edid); @@ -2678,6 +2694,19 @@ static int adv7604_probe(struct i2c_client *client, return -ENODEV; } state-pdata = *pdata; + + /* Request GPIOs. */ + for (i = 0; i state-info-num_dv_ports; ++i) { + state-hpd_gpio[i] = + devm_gpiod_get_index(client-dev, hpd, i); + if (IS_ERR(state-hpd_gpio[i])) + continue; + + gpiod_set_value_cansleep(state-hpd_gpio[i], 0); + + v4l_info(client, Handling HPD %u GPIO\n, i); + } + state-timings = cea640x480; state-format = adv7604_format_info(state, V4L2_MBUS_FMT_YUYV8_2X8); -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 37/49] adv7604: Remove deprecated video-level DV timings operations
The video enum_dv_timings and dv_timings_cap operations are deprecated and unused. Remove them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7604.c | 35 +-- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 684b912..29bdb9e 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -1527,16 +1527,20 @@ static int adv7604_enum_dv_timings(struct v4l2_subdev *sd, return 0; } -static int __adv7604_dv_timings_cap(struct v4l2_subdev *sd, - struct v4l2_dv_timings_cap *cap, - unsigned int pad) +static int adv7604_dv_timings_cap(struct v4l2_subdev *sd, + struct v4l2_dv_timings_cap *cap) { + struct adv7604_state *state = to_state(sd); + + if (cap-pad = state-source_pad) + return -EINVAL; + cap-type = V4L2_DV_BT_656_1120; cap-bt.max_width = 1920; cap-bt.max_height = 1200; cap-bt.min_pixelclock = 2500; - switch (pad) { + switch (cap-pad) { case ADV7604_PAD_HDMI_PORT_A: case ADV7604_PAD_HDMI_PORT_B: case ADV7604_PAD_HDMI_PORT_C: @@ -1557,25 +1561,6 @@ static int __adv7604_dv_timings_cap(struct v4l2_subdev *sd, return 0; } -static int adv7604_dv_timings_cap(struct v4l2_subdev *sd, - struct v4l2_dv_timings_cap *cap) -{ - struct adv7604_state *state = to_state(sd); - - return __adv7604_dv_timings_cap(sd, cap, state-selected_input); -} - -static int adv7604_pad_dv_timings_cap(struct v4l2_subdev *sd, - struct v4l2_dv_timings_cap *cap) -{ - struct adv7604_state *state = to_state(sd); - - if (cap-pad = state-source_pad) - return -EINVAL; - - return __adv7604_dv_timings_cap(sd, cap, cap-pad); -} - /* Fill the optional fields .standards and .flags in struct v4l2_dv_timings if the format is listed in adv7604_timings[] */ static void adv7604_fill_optional_dv_timings_fields(struct v4l2_subdev *sd, @@ -2453,8 +2438,6 @@ static const struct v4l2_subdev_video_ops adv7604_video_ops = { .s_dv_timings = adv7604_s_dv_timings, .g_dv_timings = adv7604_g_dv_timings, .query_dv_timings = adv7604_query_dv_timings, - .enum_dv_timings = adv7604_enum_dv_timings, - .dv_timings_cap = adv7604_dv_timings_cap, }; static const struct v4l2_subdev_pad_ops adv7604_pad_ops = { @@ -2463,7 +2446,7 @@ static const struct v4l2_subdev_pad_ops adv7604_pad_ops = { .set_fmt = adv7604_set_format, .get_edid = adv7604_get_edid, .set_edid = adv7604_set_edid, - .dv_timings_cap = adv7604_pad_dv_timings_cap, + .dv_timings_cap = adv7604_dv_timings_cap, .enum_dv_timings = adv7604_enum_dv_timings, }; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 34/49] adv7604: Add sink pads
The ADV7604 has sink pads for its HDMI and analog inputs. Report them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7604.c | 61 ++--- include/media/adv7604.h | 23 - 2 files changed, 46 insertions(+), 38 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index ca75906..79fb34d 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -97,13 +97,15 @@ struct adv7604_chip_info { * ** */ + struct adv7604_state { const struct adv7604_chip_info *info; struct adv7604_platform_data pdata; struct v4l2_subdev sd; - struct media_pad pad; + struct media_pad pads[ADV7604_PAD_MAX]; + unsigned int source_pad; struct v4l2_ctrl_handler hdl; - enum adv7604_input_port selected_input; + enum adv7604_pad selected_input; struct v4l2_dv_timings timings; struct { u8 edid[256]; @@ -775,18 +777,18 @@ static inline bool is_analog_input(struct v4l2_subdev *sd) { struct adv7604_state *state = to_state(sd); - return state-selected_input == ADV7604_INPUT_VGA_RGB || - state-selected_input == ADV7604_INPUT_VGA_COMP; + return state-selected_input == ADV7604_PAD_VGA_RGB || + state-selected_input == ADV7604_PAD_VGA_COMP; } static inline bool is_digital_input(struct v4l2_subdev *sd) { struct adv7604_state *state = to_state(sd); - return state-selected_input == ADV7604_INPUT_HDMI_PORT_A || - state-selected_input == ADV7604_INPUT_HDMI_PORT_B || - state-selected_input == ADV7604_INPUT_HDMI_PORT_C || - state-selected_input == ADV7604_INPUT_HDMI_PORT_D; + return state-selected_input == ADV7604_PAD_HDMI_PORT_A || + state-selected_input == ADV7604_PAD_HDMI_PORT_B || + state-selected_input == ADV7604_PAD_HDMI_PORT_C || + state-selected_input == ADV7604_PAD_HDMI_PORT_D; } /* --- */ @@ -1066,14 +1068,14 @@ static void set_rgb_quantization_range(struct v4l2_subdev *sd) switch (state-rgb_quantization_range) { case V4L2_DV_RGB_RANGE_AUTO: - if (state-selected_input == ADV7604_INPUT_VGA_RGB) { + if (state-selected_input == ADV7604_PAD_VGA_RGB) { /* Receiving analog RGB signal * Set RGB full range (0-255) */ io_write_and_or(sd, 0x02, 0x0f, 0x10); break; } - if (state-selected_input == ADV7604_INPUT_VGA_COMP) { + if (state-selected_input == ADV7604_PAD_VGA_COMP) { /* Receiving analog YPbPr signal * Set automode */ io_write_and_or(sd, 0x02, 0x0f, 0xf0); @@ -1106,7 +1108,7 @@ static void set_rgb_quantization_range(struct v4l2_subdev *sd) } break; case V4L2_DV_RGB_RANGE_LIMITED: - if (state-selected_input == ADV7604_INPUT_VGA_COMP) { + if (state-selected_input == ADV7604_PAD_VGA_COMP) { /* YCrCb limited range (16-235) */ io_write_and_or(sd, 0x02, 0x0f, 0x20); break; @@ -1117,7 +1119,7 @@ static void set_rgb_quantization_range(struct v4l2_subdev *sd) break; case V4L2_DV_RGB_RANGE_FULL: - if (state-selected_input == ADV7604_INPUT_VGA_COMP) { + if (state-selected_input == ADV7604_PAD_VGA_COMP) { /* YCrCb full range (0-255) */ io_write_and_or(sd, 0x02, 0x0f, 0x60); break; @@ -1806,7 +1808,7 @@ static int adv7604_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) struct adv7604_state *state = to_state(sd); u8 *data = NULL; - if (edid-pad ADV7604_EDID_PORT_D) + if (edid-pad ADV7604_PAD_HDMI_PORT_D) return -EINVAL; if (edid-blocks == 0) return -EINVAL; @@ -1821,10 +1823,10 @@ static int adv7604_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) edid-blocks = state-edid.blocks; switch (edid-pad) { - case ADV7604_EDID_PORT_A: - case ADV7604_EDID_PORT_B: - case ADV7604_EDID_PORT_C: - case ADV7604_EDID_PORT_D: + case ADV7604_PAD_HDMI_PORT_A: + case ADV7604_PAD_HDMI_PORT_B: + case ADV7604_PAD_HDMI_PORT_C: + case ADV7604_PAD_HDMI_PORT_D: if (state-edid.present (1 edid-pad)) data = state-edid.edid; break; @@ -1878,7 +1880,7 @@ static int
[PATCH v4 32/49] adv7604: Add adv7611 support
From: Lars-Peter Clausen l...@metafoo.de This patch adds support for the Analog Devices ADV7611 HDMI receiver. The adv7611 is quite similar to the adv7604. It has only one instead of four HDMI inputs and no analog frontend though. Also some register bits have been shuffled around, but large parts of their register maps are compatible. Signed-off-by: Lars-Peter Clausen l...@metafoo.de Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7604.c | 719 +++- include/media/adv7604.h | 10 + 2 files changed, 528 insertions(+), 201 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index f9503d2..1720daf 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -53,6 +53,43 @@ MODULE_LICENSE(GPL); /* ADV7604 system clock frequency */ #define ADV7604_fsc (28636360) +enum adv7604_type { + ADV7604, + ADV7611, +}; + +struct adv7604_reg_seq { + unsigned int reg; + u8 val; +}; + +struct adv7604_chip_info { + enum adv7604_type type; + + bool has_afe; + unsigned int max_port; + unsigned int num_dv_ports; + + unsigned int edid_enable_reg; + unsigned int edid_status_reg; + unsigned int lcf_reg; + + unsigned int cable_det_mask; + unsigned int tdms_lock_mask; + unsigned int fmt_change_digital_mask; + + void (*set_termination)(struct v4l2_subdev *sd, bool enable); + void (*setup_irqs)(struct v4l2_subdev *sd); + unsigned int (*read_hdmi_pixelclock)(struct v4l2_subdev *sd); + unsigned int (*read_cable_det)(struct v4l2_subdev *sd); + + /* 0 = AFE, 1 = HDMI */ + const struct adv7604_reg_seq *recommended_settings[2]; + unsigned int num_recommended_settings[2]; + + unsigned long page_mask; +}; + /* ** * @@ -61,6 +98,7 @@ MODULE_LICENSE(GPL); ** */ struct adv7604_state { + const struct adv7604_chip_info *info; struct adv7604_platform_data pdata; struct v4l2_subdev sd; struct media_pad pad; @@ -101,6 +139,11 @@ struct adv7604_state { struct v4l2_ctrl *rgb_quantization_range_ctrl; }; +static bool adv7604_has_afe(struct adv7604_state *state) +{ + return state-info-has_afe; +} + /* Supported CEA and DMT timings */ static const struct v4l2_dv_timings adv7604_timings[] = { V4L2_DV_BT_CEA_720X480P59_94, @@ -611,6 +654,121 @@ static inline int vdp_write(struct v4l2_subdev *sd, u8 reg, u8 val) return adv_smbus_write_byte_data(state-i2c_vdp, reg, val); } +enum { + ADV7604_PAGE_IO, + ADV7604_PAGE_AVLINK, + ADV7604_PAGE_CEC, + ADV7604_PAGE_INFOFRAME, + ADV7604_PAGE_ESDP, + ADV7604_PAGE_DPP, + ADV7604_PAGE_AFE, + ADV7604_PAGE_REP, + ADV7604_PAGE_EDID, + ADV7604_PAGE_HDMI, + ADV7604_PAGE_TEST, + ADV7604_PAGE_CP, + ADV7604_PAGE_VDP, + ADV7604_PAGE_TERM, +}; + +#define ADV7604_REG(page, offset) (((page) 8) | (offset)) +#define ADV7604_REG_SEQ_TERM 0x + +#ifdef CONFIG_VIDEO_ADV_DEBUG +static int adv7604_read_reg(struct v4l2_subdev *sd, unsigned int reg) +{ + struct adv7604_state *state = to_state(sd); + unsigned int page = reg 8; + + if (!(BIT(page) state-info-page_mask)) + return -EINVAL; + + reg = 0xff; + + switch (page) { + case ADV7604_PAGE_IO: + return io_read(sd, reg); + case ADV7604_PAGE_AVLINK: + return avlink_read(sd, reg); + case ADV7604_PAGE_CEC: + return cec_read(sd, reg); + case ADV7604_PAGE_INFOFRAME: + return infoframe_read(sd, reg); + case ADV7604_PAGE_ESDP: + return esdp_read(sd, reg); + case ADV7604_PAGE_DPP: + return dpp_read(sd, reg); + case ADV7604_PAGE_AFE: + return afe_read(sd, reg); + case ADV7604_PAGE_REP: + return rep_read(sd, reg); + case ADV7604_PAGE_EDID: + return edid_read(sd, reg); + case ADV7604_PAGE_HDMI: + return hdmi_read(sd, reg); + case ADV7604_PAGE_TEST: + return test_read(sd, reg); + case ADV7604_PAGE_CP: + return cp_read(sd, reg); + case ADV7604_PAGE_VDP: + return vdp_read(sd, reg); + } + + return -EINVAL; +} +#endif + +static int adv7604_write_reg(struct v4l2_subdev *sd, unsigned int reg, u8 val) +{ + struct adv7604_state *state = to_state(sd); + unsigned int page = reg 8; + + if (!(BIT(page) state-info-page_mask)) + return -EINVAL; + + reg = 0xff; + + switch (page) { + case ADV7604_PAGE_IO: + return io_write(sd, reg, val); + case ADV7604_PAGE_AVLINK: +
[PATCH v4 33/49] adv7604: Remove subdev control handlers
Control operations are handled by the control framework and the subdev control handlers are never called directly. Remove them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7604.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 1720daf..ca75906 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -2172,13 +2172,6 @@ static const struct v4l2_ctrl_ops adv7604_ctrl_ops = { static const struct v4l2_subdev_core_ops adv7604_core_ops = { .log_status = adv7604_log_status, - .g_ext_ctrls = v4l2_subdev_g_ext_ctrls, - .try_ext_ctrls = v4l2_subdev_try_ext_ctrls, - .s_ext_ctrls = v4l2_subdev_s_ext_ctrls, - .g_ctrl = v4l2_subdev_g_ctrl, - .s_ctrl = v4l2_subdev_s_ctrl, - .queryctrl = v4l2_subdev_queryctrl, - .querymenu = v4l2_subdev_querymenu, .interrupt_service_routine = adv7604_isr, #ifdef CONFIG_VIDEO_ADV_DEBUG .g_register = adv7604_g_register, -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 18/49] adv7511: Remove deprecated video-level DV timings operations
The video enum_dv_timings and dv_timings_cap operations are deprecated and unused. Remove them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7511.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c index f4a1431..d77a1db 100644 --- a/drivers/media/i2c/adv7511.c +++ b/drivers/media/i2c/adv7511.c @@ -692,8 +692,6 @@ static const struct v4l2_subdev_video_ops adv7511_video_ops = { .s_stream = adv7511_s_stream, .s_dv_timings = adv7511_s_dv_timings, .g_dv_timings = adv7511_g_dv_timings, - .enum_dv_timings = adv7511_enum_dv_timings, - .dv_timings_cap = adv7511_dv_timings_cap, }; /* -- AUDIO OPS -- */ -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 26/49] v4l: Validate fields in the core code for subdev EDID ioctls
The subdev EDID ioctls receive a pad field that must reference an existing pad and an EDID field that must point to a buffer. Validate both fields in the core code instead of duplicating validation in all drivers. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Acked-by: Sakari Ailus sakari.ai...@linux.intel.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/ad9389b.c | 2 -- drivers/media/i2c/adv7511.c | 2 -- drivers/media/i2c/adv7604.c | 4 drivers/media/i2c/adv7842.c | 4 drivers/media/v4l2-core/v4l2-subdev.c | 24 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c index f00b3dd..fada175 100644 --- a/drivers/media/i2c/ad9389b.c +++ b/drivers/media/i2c/ad9389b.c @@ -682,8 +682,6 @@ static int ad9389b_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) return -EINVAL; if (edid-blocks == 0 || edid-blocks 256) return -EINVAL; - if (!edid-edid) - return -EINVAL; if (!state-edid.segments) { v4l2_dbg(1, debug, sd, EDID segment 0 not found\n); return -ENODATA; diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c index d77a1db..f98acf4 100644 --- a/drivers/media/i2c/adv7511.c +++ b/drivers/media/i2c/adv7511.c @@ -783,8 +783,6 @@ static int adv7511_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) return -EINVAL; if ((edid-blocks == 0) || (edid-blocks 256)) return -EINVAL; - if (!edid-edid) - return -EINVAL; if (!state-edid.segments) { v4l2_dbg(1, debug, sd, EDID segment 0 not found\n); return -ENODATA; diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 98cc540..338baa4 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -1673,8 +1673,6 @@ static int adv7604_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) return -EINVAL; if (edid-start_block == 1) edid-blocks = 1; - if (!edid-edid) - return -EINVAL; if (edid-blocks state-edid.blocks) edid-blocks = state-edid.blocks; @@ -1761,8 +1759,6 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) edid-blocks = 2; return -E2BIG; } - if (!edid-edid) - return -EINVAL; v4l2_dbg(2, debug, sd, %s: write EDID pad %d, edid.present = 0x%x\n, __func__, edid-pad, state-edid.present); diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c index c3165ea..56b127a 100644 --- a/drivers/media/i2c/adv7842.c +++ b/drivers/media/i2c/adv7842.c @@ -2036,8 +2036,6 @@ static int adv7842_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) return -EINVAL; if (edid-start_block == 1) edid-blocks = 1; - if (!edid-edid) - return -EINVAL; switch (edid-pad) { case ADV7842_EDID_PORT_A: @@ -2072,8 +2070,6 @@ static int adv7842_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *e) return -EINVAL; if (e-blocks 2) return -E2BIG; - if (!e-edid) - return -EINVAL; /* todo, per edid */ state-aspect_ratio = v4l2_calc_aspect_ratio(e-edid[0x15], diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 12f25cc..ad9aaae7 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -349,11 +349,27 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) sd, pad, set_selection, subdev_fh, sel); } - case VIDIOC_G_EDID: - return v4l2_subdev_call(sd, pad, get_edid, arg); + case VIDIOC_G_EDID: { + struct v4l2_subdev_edid *edid = arg; - case VIDIOC_S_EDID: - return v4l2_subdev_call(sd, pad, set_edid, arg); + if (edid-pad = sd-entity.num_pads) + return -EINVAL; + if (edid-blocks edid-edid == NULL) + return -EINVAL; + + return v4l2_subdev_call(sd, pad, get_edid, edid); + } + + case VIDIOC_S_EDID: { + struct v4l2_subdev_edid *edid = arg; + + if (edid-pad = sd-entity.num_pads) + return -EINVAL; + if (edid-blocks edid-edid == NULL) + return -EINVAL; + + return v4l2_subdev_call(sd, pad, set_edid, edid); + } case VIDIOC_SUBDEV_DV_TIMINGS_CAP: { struct v4l2_dv_timings_cap *cap = arg; -- 1.8.3.2 -- To unsubscribe from this list: send the line
[PATCH v4 24/49] v4l: Improve readability by not wrapping ioctl number #define's
Wrapping the #define's at a 80 columns boundary just obfuscates the code. Don't do that. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Sakari Ailus sakari.ai...@linux.intel.com --- include/uapi/linux/v4l2-subdev.h | 33 + 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/include/uapi/linux/v4l2-subdev.h b/include/uapi/linux/v4l2-subdev.h index 87e0515..db28964 100644 --- a/include/uapi/linux/v4l2-subdev.h +++ b/include/uapi/linux/v4l2-subdev.h @@ -151,26 +151,19 @@ struct v4l2_subdev_selection { /* Backwards compatibility define --- to be removed */ #define v4l2_subdev_edid v4l2_edid -#define VIDIOC_SUBDEV_G_FMT_IOWR('V', 4, struct v4l2_subdev_format) -#define VIDIOC_SUBDEV_S_FMT_IOWR('V', 5, struct v4l2_subdev_format) -#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \ - _IOWR('V', 21, struct v4l2_subdev_frame_interval) -#define VIDIOC_SUBDEV_S_FRAME_INTERVAL \ - _IOWR('V', 22, struct v4l2_subdev_frame_interval) -#define VIDIOC_SUBDEV_ENUM_MBUS_CODE \ - _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum) -#define VIDIOC_SUBDEV_ENUM_FRAME_SIZE \ - _IOWR('V', 74, struct v4l2_subdev_frame_size_enum) -#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \ - _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum) -#define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop) -#define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop) -#define VIDIOC_SUBDEV_G_SELECTION \ - _IOWR('V', 61, struct v4l2_subdev_selection) -#define VIDIOC_SUBDEV_S_SELECTION \ - _IOWR('V', 62, struct v4l2_subdev_selection) +#define VIDIOC_SUBDEV_G_FMT_IOWR('V', 4, struct v4l2_subdev_format) +#define VIDIOC_SUBDEV_S_FMT_IOWR('V', 5, struct v4l2_subdev_format) +#define VIDIOC_SUBDEV_G_FRAME_INTERVAL _IOWR('V', 21, struct v4l2_subdev_frame_interval) +#define VIDIOC_SUBDEV_S_FRAME_INTERVAL _IOWR('V', 22, struct v4l2_subdev_frame_interval) +#define VIDIOC_SUBDEV_ENUM_MBUS_CODE _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum) +#define VIDIOC_SUBDEV_ENUM_FRAME_SIZE _IOWR('V', 74, struct v4l2_subdev_frame_size_enum) +#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum) +#define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop) +#define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop) +#define VIDIOC_SUBDEV_G_SELECTION _IOWR('V', 61, struct v4l2_subdev_selection) +#define VIDIOC_SUBDEV_S_SELECTION _IOWR('V', 62, struct v4l2_subdev_selection) /* These two G/S_EDID ioctls are identical to the ioctls in videodev2.h */ -#define VIDIOC_SUBDEV_G_EDID _IOWR('V', 40, struct v4l2_edid) -#define VIDIOC_SUBDEV_S_EDID _IOWR('V', 41, struct v4l2_edid) +#define VIDIOC_SUBDEV_G_EDID _IOWR('V', 40, struct v4l2_edid) +#define VIDIOC_SUBDEV_S_EDID _IOWR('V', 41, struct v4l2_edid) #endif -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 25/49] v4l: Add support for DV timings ioctls on subdev nodes
Validate the pad field in the core code whenever specified. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- .../DocBook/media/v4l/vidioc-dv-timings-cap.xml| 27 +++ .../DocBook/media/v4l/vidioc-enum-dv-timings.xml | 30 +- drivers/media/v4l2-core/v4l2-subdev.c | 27 +++ include/uapi/linux/v4l2-subdev.h | 7 - 4 files changed, 78 insertions(+), 13 deletions(-) diff --git a/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml b/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml index cd7720d..28a8c1e 100644 --- a/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml +++ b/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml @@ -1,11 +1,12 @@ refentry id=vidioc-dv-timings-cap refmeta -refentrytitleioctl VIDIOC_DV_TIMINGS_CAP/refentrytitle +refentrytitleioctl VIDIOC_DV_TIMINGS_CAP, VIDIOC_SUBDEV_DV_TIMINGS_CAP/refentrytitle manvol; /refmeta refnamediv refnameVIDIOC_DV_TIMINGS_CAP/refname +refnameVIDIOC_SUBDEV_DV_TIMINGS_CAP/refname refpurposeThe capabilities of the Digital Video receiver/transmitter/refpurpose /refnamediv @@ -33,7 +34,7 @@ varlistentry termparameterrequest/parameter/term listitem - paraVIDIOC_DV_TIMINGS_CAP/para + paraVIDIOC_DV_TIMINGS_CAP, VIDIOC_SUBDEV_DV_TIMINGS_CAP/para /listitem /varlistentry varlistentry @@ -54,10 +55,19 @@ interface and may change in the future./para /note -paraTo query the capabilities of the DV receiver/transmitter applications can call -this ioctl and the driver will fill in the structure. Note that drivers may return +paraTo query the capabilities of the DV receiver/transmitter applications +can call the constantVIDIOC_DV_TIMINGS_CAP/constant ioctl on a video node +and the driver will fill in the structure. Note that drivers may return different values after switching the video input or output./para +paraWhen implemented by the driver DV capabilities of subdevices can be +queried by calling the constantVIDIOC_SUBDEV_DV_TIMINGS_CAP/constant ioctl +directly on a subdevice node. The capabilities are specific to inputs (for DV +receivers) or outputs (for DV transmitters), applications must specify the +desired pad number in the v4l2-dv-timings-cap; structfieldpad/structfield +field. Attempts to query capabilities on a pad that doesn't support them will +return an EINVAL;./para + table pgwide=1 frame=none id=v4l2-bt-timings-cap titlestruct structnamev4l2_bt_timings_cap/structname/title tgroup cols=3 @@ -127,7 +137,14 @@ different values after switching the video input or output./para /row row entry__u32/entry - entrystructfieldreserved/structfield[3]/entry + entrystructfieldpad/structfield/entry + entryPad number as reported by the media controller API. This field + is only used when operating on a subdevice node. When operating on a + video node applications must set this field to zero./entry + /row + row + entry__u32/entry + entrystructfieldreserved/structfield[2]/entry entryReserved for future extensions. Drivers must set the array to zero./entry /row row diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml b/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml index b3e17c1..b9fdfea 100644 --- a/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml +++ b/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml @@ -1,11 +1,12 @@ refentry id=vidioc-enum-dv-timings refmeta -refentrytitleioctl VIDIOC_ENUM_DV_TIMINGS/refentrytitle +refentrytitleioctl VIDIOC_ENUM_DV_TIMINGS, VIDIOC_SUBDEV_ENUM_DV_TIMINGS/refentrytitle manvol; /refmeta refnamediv refnameVIDIOC_ENUM_DV_TIMINGS/refname +refnameVIDIOC_SUBDEV_ENUM_DV_TIMINGS/refname refpurposeEnumerate supported Digital Video timings/refpurpose /refnamediv @@ -33,7 +34,7 @@ varlistentry termparameterrequest/parameter/term listitem - paraVIDIOC_ENUM_DV_TIMINGS/para + paraVIDIOC_ENUM_DV_TIMINGS, VIDIOC_SUBDEV_ENUM_DV_TIMINGS/para /listitem /varlistentry varlistentry @@ -61,14 +62,21 @@ standards or even custom timings that are not in this list./para paraTo query the available timings, applications initialize the structfieldindex/structfield field and zero the reserved array of v4l2-enum-dv-timings; -and call the constantVIDIOC_ENUM_DV_TIMINGS/constant ioctl with a pointer to this -structure. Drivers fill the rest of the structure or return an +and call the constantVIDIOC_ENUM_DV_TIMINGS/constant ioctl on a video node with a +pointer to this structure. Drivers fill the rest of the structure
[PATCH v4 27/49] adv7604: Add missing include to linux/types.h
From: Lars-Peter Clausen l...@metafoo.de The file is using u8 which is defined in linux/types.h. Signed-off-by: Lars-Peter Clausen l...@metafoo.de Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- include/media/adv7604.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/media/adv7604.h b/include/media/adv7604.h index d262a3a..c6b3937 100644 --- a/include/media/adv7604.h +++ b/include/media/adv7604.h @@ -21,6 +21,8 @@ #ifndef _ADV7604_ #define _ADV7604_ +#include linux/types.h + /* Analog input muxing modes (AFE register 0x02, [2:0]) */ enum adv7604_ain_sel { ADV7604_AIN1_2_3_NC_SYNC_1_2 = 0, -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 19/49] adv7842: Remove deprecated video-level DV timings operations
The video enum_dv_timings and dv_timings_cap operations are deprecated and unused. Remove them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7842.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c index 5742f6f..c3165ea 100644 --- a/drivers/media/i2c/adv7842.c +++ b/drivers/media/i2c/adv7842.c @@ -2896,8 +2896,6 @@ static const struct v4l2_subdev_video_ops adv7842_video_ops = { .s_dv_timings = adv7842_s_dv_timings, .g_dv_timings = adv7842_g_dv_timings, .query_dv_timings = adv7842_query_dv_timings, - .enum_dv_timings = adv7842_enum_dv_timings, - .dv_timings_cap = adv7842_dv_timings_cap, .enum_mbus_fmt = adv7842_enum_mbus_fmt, .g_mbus_fmt = adv7842_g_mbus_fmt, .try_mbus_fmt = adv7842_g_mbus_fmt, -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 17/49] ad9389b: Remove deprecated video-level DV timings operations
The video enum_dv_timings and dv_timings_cap operations are deprecated and unused. Remove them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/ad9389b.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c index cee0ae6..f00b3dd 100644 --- a/drivers/media/i2c/ad9389b.c +++ b/drivers/media/i2c/ad9389b.c @@ -670,8 +670,6 @@ static const struct v4l2_subdev_video_ops ad9389b_video_ops = { .s_stream = ad9389b_s_stream, .s_dv_timings = ad9389b_s_dv_timings, .g_dv_timings = ad9389b_g_dv_timings, - .enum_dv_timings = ad9389b_enum_dv_timings, - .dv_timings_cap = ad9389b_dv_timings_cap, }; /* -- PAD OPS -- */ -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 28/49] adv7604: Add support for asynchronous probing
From: Lars-Peter Clausen l...@metafoo.de Signed-off-by: Lars-Peter Clausen l...@metafoo.de Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7604.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 338baa4..7358853 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -2333,6 +2333,11 @@ static int adv7604_probe(struct i2c_client *client, goto err_entity; v4l2_info(sd, %s found @ 0x%x (%s)\n, client-name, client-addr 1, client-adapter-name); + + err = v4l2_async_register_subdev(sd); + if (err) + goto err_entity; + return 0; err_entity: @@ -2356,6 +2361,7 @@ static int adv7604_remove(struct i2c_client *client) cancel_delayed_work(state-delayed_work_enable_hotplug); destroy_workqueue(state-work_queues); + v4l2_async_unregister_subdev(sd); v4l2_device_unregister_subdev(sd); media_entity_cleanup(sd-entity); adv7604_unregister_clients(to_state(sd)); -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 21/49] s5p-tv: hdmiphy: Remove deprecated video-level DV timings operation
The video enum_dv_timings operation is deprecated and unused. Remove it. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/platform/s5p-tv/hdmiphy_drv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/platform/s5p-tv/hdmiphy_drv.c b/drivers/media/platform/s5p-tv/hdmiphy_drv.c index ff22320..c2f2e35 100644 --- a/drivers/media/platform/s5p-tv/hdmiphy_drv.c +++ b/drivers/media/platform/s5p-tv/hdmiphy_drv.c @@ -262,7 +262,6 @@ static const struct v4l2_subdev_core_ops hdmiphy_core_ops = { static const struct v4l2_subdev_video_ops hdmiphy_video_ops = { .s_dv_timings = hdmiphy_s_dv_timings, - .dv_timings_cap = hdmiphy_dv_timings_cap, .s_stream = hdmiphy_s_stream, }; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 29/49] adv7604: Don't put info string arrays on the stack
From: Lars-Peter Clausen l...@metafoo.de We do not want to modify the info string arrays ever, so no need to waste stack space for them. While we are at it also make them const. Signed-off-by: Lars-Peter Clausen l...@metafoo.de Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7604.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 7358853..dd0a9a9 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -1882,13 +1882,13 @@ static int adv7604_log_status(struct v4l2_subdev *sd) struct stdi_readback stdi; u8 reg_io_0x02 = io_read(sd, 0x02); - char *csc_coeff_sel_rb[16] = { + static const char * const csc_coeff_sel_rb[16] = { bypassed, YPbPr601 - RGB, reserved, YPbPr709 - RGB, reserved, RGB - YPbPr601, reserved, RGB - YPbPr709, reserved, YPbPr709 - YPbPr601, YPbPr601 - YPbPr709, reserved, reserved, reserved, reserved, manual }; - char *input_color_space_txt[16] = { + static const char * const input_color_space_txt[16] = { RGB limited range (16-235), RGB full range (0-255), YCbCr Bt.601 (16-235), YCbCr Bt.709 (16-235), xvYCC Bt.601, xvYCC Bt.709, @@ -1896,12 +1896,12 @@ static int adv7604_log_status(struct v4l2_subdev *sd) invalid, invalid, invalid, invalid, invalid, invalid, invalid, automatic }; - char *rgb_quantization_range_txt[] = { + static const char * const rgb_quantization_range_txt[] = { Automatic, RGB limited range (16-235), RGB full range (0-255), }; - char *deep_color_mode_txt[4] = { + static const char * const deep_color_mode_txt[4] = { 8-bits per channel, 10-bits per channel, 12-bits per channel, -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 22/49] ths8200: Remove deprecated video-level DV timings operations
The video enum_dv_timings and dv_timings_cap operations are deprecated and unused. Remove them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Lad, Prabhakar prabhakar.cse...@gmail.com --- drivers/media/i2c/ths8200.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/i2c/ths8200.c b/drivers/media/i2c/ths8200.c index c4ec8b2..656d889 100644 --- a/drivers/media/i2c/ths8200.c +++ b/drivers/media/i2c/ths8200.c @@ -432,8 +432,6 @@ static const struct v4l2_subdev_video_ops ths8200_video_ops = { .s_stream = ths8200_s_stream, .s_dv_timings = ths8200_s_dv_timings, .g_dv_timings = ths8200_g_dv_timings, - .enum_dv_timings = ths8200_enum_dv_timings, - .dv_timings_cap = ths8200_dv_timings_cap, }; static const struct v4l2_subdev_pad_ops ths8200_pad_ops = { -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 23/49] tvp7002: Remove deprecated video-level DV timings operations
The video enum_dv_timings and dv_timings_cap operations are deprecated and unused. Remove them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Lad, Prabhakar prabhakar.cse...@gmail.com --- drivers/media/i2c/tvp7002.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c index 019dbcf..11f2387 100644 --- a/drivers/media/i2c/tvp7002.c +++ b/drivers/media/i2c/tvp7002.c @@ -927,7 +927,6 @@ static const struct v4l2_subdev_core_ops tvp7002_core_ops = { static const struct v4l2_subdev_video_ops tvp7002_video_ops = { .g_dv_timings = tvp7002_g_dv_timings, .s_dv_timings = tvp7002_s_dv_timings, - .enum_dv_timings = tvp7002_enum_dv_timings, .query_dv_timings = tvp7002_query_dv_timings, .s_stream = tvp7002_s_stream, .g_mbus_fmt = tvp7002_mbus_fmt, -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 15/49] media: staging: davinci: vpfe: Switch to pad-level DV operations
The video-level enum_dv_timings and dv_timings_cap operations are deprecated in favor of the pad-level versions. All subdev drivers implement the pad-level versions, switch to them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Lad, Prabhakar prabhakar.cse...@gmail.com --- drivers/staging/media/davinci_vpfe/vpfe_video.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c index 9337d92..9ee472e 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c @@ -986,8 +986,10 @@ vpfe_enum_dv_timings(struct file *file, void *fh, struct vpfe_device *vpfe_dev = video-vpfe_dev; struct v4l2_subdev *subdev = video-current_ext_subdev-subdev; + timings-pad = 0; + v4l2_dbg(1, debug, vpfe_dev-v4l2_dev, vpfe_enum_dv_timings\n); - return v4l2_subdev_call(subdev, video, enum_dv_timings, timings); + return v4l2_subdev_call(subdev, pad, enum_dv_timings, timings); } /* -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 13/49] media: bfin_capture: Switch to pad-level DV operations
The video-level enum_dv_timings and dv_timings_cap operations are deprecated in favor of the pad-level versions. All subdev drivers implement the pad-level versions, switch to them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Scott Jiang scott.jiang.li...@gmail.com --- drivers/media/platform/blackfin/bfin_capture.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c index 200bec9..22fb701 100644 --- a/drivers/media/platform/blackfin/bfin_capture.c +++ b/drivers/media/platform/blackfin/bfin_capture.c @@ -648,7 +648,9 @@ static int bcap_enum_dv_timings(struct file *file, void *priv, { struct bcap_device *bcap_dev = video_drvdata(file); - return v4l2_subdev_call(bcap_dev-sd, video, + timings-pad = 0; + + return v4l2_subdev_call(bcap_dev-sd, pad, enum_dv_timings, timings); } -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 10/49] s5p-tv: hdmiphy: Add pad-level DV timings operations
The video enum_dv_timings operation is deprecated. Implement the pad-level version of the operation to prepare for the removal of the video version. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/platform/s5p-tv/hdmiphy_drv.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/media/platform/s5p-tv/hdmiphy_drv.c b/drivers/media/platform/s5p-tv/hdmiphy_drv.c index e19a0af..ff22320 100644 --- a/drivers/media/platform/s5p-tv/hdmiphy_drv.c +++ b/drivers/media/platform/s5p-tv/hdmiphy_drv.c @@ -225,6 +225,9 @@ static int hdmiphy_s_dv_timings(struct v4l2_subdev *sd, static int hdmiphy_dv_timings_cap(struct v4l2_subdev *sd, struct v4l2_dv_timings_cap *cap) { + if (cap-pad != 0) + return -EINVAL; + cap-type = V4L2_DV_BT_656_1120; /* The phy only determines the pixelclock, leave the other values * at 0 to signify that we have no information for them. */ @@ -263,9 +266,14 @@ static const struct v4l2_subdev_video_ops hdmiphy_video_ops = { .s_stream = hdmiphy_s_stream, }; +static const struct v4l2_subdev_pad_ops hdmiphy_pad_ops = { + .dv_timings_cap = hdmiphy_dv_timings_cap, +}; + static const struct v4l2_subdev_ops hdmiphy_ops = { .core = hdmiphy_core_ops, .video = hdmiphy_video_ops, + .pad = hdmiphy_pad_ops, }; static int hdmiphy_probe(struct i2c_client *client, -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 20/49] s5p-tv: hdmi: Remove deprecated video-level DV timings operations
The video enum_dv_timings and dv_timings_cap operations are deprecated and unused. Remove them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/platform/s5p-tv/hdmi_drv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/platform/s5p-tv/hdmi_drv.c b/drivers/media/platform/s5p-tv/hdmi_drv.c index 3db496c..754740f 100644 --- a/drivers/media/platform/s5p-tv/hdmi_drv.c +++ b/drivers/media/platform/s5p-tv/hdmi_drv.c @@ -693,7 +693,7 @@ static int hdmi_dv_timings_cap(struct v4l2_subdev *sd, return -EINVAL; /* Let the phy fill in the pixelclock range */ - v4l2_subdev_call(hdev-phy_sd, video, dv_timings_cap, cap); + v4l2_subdev_call(hdev-phy_sd, pad, dv_timings_cap, cap); cap-type = V4L2_DV_BT_656_1120; cap-bt.min_width = 720; cap-bt.max_width = 1920; @@ -712,8 +712,6 @@ static const struct v4l2_subdev_core_ops hdmi_sd_core_ops = { static const struct v4l2_subdev_video_ops hdmi_sd_video_ops = { .s_dv_timings = hdmi_s_dv_timings, .g_dv_timings = hdmi_g_dv_timings, - .enum_dv_timings = hdmi_enum_dv_timings, - .dv_timings_cap = hdmi_dv_timings_cap, .g_mbus_fmt = hdmi_g_mbus_fmt, .s_stream = hdmi_s_stream, }; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 03/49] v4l: Add 12-bit YUV 4:2:0 media bus pixel codes
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- Documentation/DocBook/media/v4l/subdev-formats.xml | 288 + include/uapi/linux/v4l2-mediabus.h | 6 +- 2 files changed, 293 insertions(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml b/Documentation/DocBook/media/v4l/subdev-formats.xml index e3cbbb4..a0fa7e0 100644 --- a/Documentation/DocBook/media/v4l/subdev-formats.xml +++ b/Documentation/DocBook/media/v4l/subdev-formats.xml @@ -2718,6 +2718,294 @@ entryvsubscript1/subscript/entry entryvsubscript0/subscript/entry /row + row id=V4L2-MBUS-FMT-UYVY12-2X12 + entryV4L2_MBUS_FMT_UYVY12_2X12/entry + entry0x201c/entry + entry/entry + dash-ent-20; + entryusubscript11/subscript/entry + entryusubscript10/subscript/entry + entryusubscript9/subscript/entry + entryusubscript8/subscript/entry + entryusubscript7/subscript/entry + entryusubscript6/subscript/entry + entryusubscript5/subscript/entry + entryusubscript4/subscript/entry + entryusubscript3/subscript/entry + entryusubscript2/subscript/entry + entryusubscript1/subscript/entry + entryusubscript0/subscript/entry + /row + row + entry/entry + entry/entry + entry/entry + dash-ent-20; + entryysubscript11/subscript/entry + entryysubscript10/subscript/entry + entryysubscript9/subscript/entry + entryysubscript8/subscript/entry + entryysubscript7/subscript/entry + entryysubscript6/subscript/entry + entryysubscript5/subscript/entry + entryysubscript4/subscript/entry + entryysubscript3/subscript/entry + entryysubscript2/subscript/entry + entryysubscript1/subscript/entry + entryysubscript0/subscript/entry + /row + row + entry/entry + entry/entry + entry/entry + dash-ent-20; + entryvsubscript11/subscript/entry + entryvsubscript10/subscript/entry + entryvsubscript9/subscript/entry + entryvsubscript8/subscript/entry + entryvsubscript7/subscript/entry + entryvsubscript6/subscript/entry + entryvsubscript5/subscript/entry + entryvsubscript4/subscript/entry + entryvsubscript3/subscript/entry + entryvsubscript2/subscript/entry + entryvsubscript1/subscript/entry + entryvsubscript0/subscript/entry + /row + row + entry/entry + entry/entry + entry/entry + dash-ent-20; + entryysubscript11/subscript/entry + entryysubscript10/subscript/entry + entryysubscript9/subscript/entry + entryysubscript8/subscript/entry + entryysubscript7/subscript/entry + entryysubscript6/subscript/entry + entryysubscript5/subscript/entry + entryysubscript4/subscript/entry + entryysubscript3/subscript/entry + entryysubscript2/subscript/entry + entryysubscript1/subscript/entry + entryysubscript0/subscript/entry + /row + row id=V4L2-MBUS-FMT-VYUY12-2X12 + entryV4L2_MBUS_FMT_VYUY12_2X12/entry + entry0x201d/entry + entry/entry + dash-ent-20; + entryvsubscript11/subscript/entry + entryvsubscript10/subscript/entry + entryvsubscript9/subscript/entry + entryvsubscript8/subscript/entry + entryvsubscript7/subscript/entry + entryvsubscript6/subscript/entry + entryvsubscript5/subscript/entry + entryvsubscript4/subscript/entry + entryvsubscript3/subscript/entry + entryvsubscript2/subscript/entry + entryvsubscript1/subscript/entry + entryvsubscript0/subscript/entry + /row + row + entry/entry + entry/entry + entry/entry + dash-ent-20; + entryysubscript11/subscript/entry + entryysubscript10/subscript/entry + entryysubscript9/subscript/entry + entryysubscript8/subscript/entry + entryysubscript7/subscript/entry + entryysubscript6/subscript/entry + entryysubscript5/subscript/entry + entryysubscript4/subscript/entry + entryysubscript3/subscript/entry + entryysubscript2/subscript/entry + entryysubscript1/subscript/entry +
[PATCH v4 11/49] ths8200: Add pad-level DV timings operations
The video enum_dv_timings and dv_timings_cap operations are deprecated. Implement the pad-level version of those operations to prepare for the removal of the video version. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Lad, Prabhakar prabhakar.cse...@gmail.com --- drivers/media/i2c/ths8200.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/media/i2c/ths8200.c b/drivers/media/i2c/ths8200.c index f72561e..c4ec8b2 100644 --- a/drivers/media/i2c/ths8200.c +++ b/drivers/media/i2c/ths8200.c @@ -410,6 +410,9 @@ static int ths8200_g_dv_timings(struct v4l2_subdev *sd, static int ths8200_enum_dv_timings(struct v4l2_subdev *sd, struct v4l2_enum_dv_timings *timings) { + if (timings-pad != 0) + return -EINVAL; + return v4l2_enum_dv_timings_cap(timings, ths8200_timings_cap, NULL, NULL); } @@ -417,6 +420,9 @@ static int ths8200_enum_dv_timings(struct v4l2_subdev *sd, static int ths8200_dv_timings_cap(struct v4l2_subdev *sd, struct v4l2_dv_timings_cap *cap) { + if (cap-pad != 0) + return -EINVAL; + *cap = ths8200_timings_cap; return 0; } @@ -430,10 +436,16 @@ static const struct v4l2_subdev_video_ops ths8200_video_ops = { .dv_timings_cap = ths8200_dv_timings_cap, }; +static const struct v4l2_subdev_pad_ops ths8200_pad_ops = { + .enum_dv_timings = ths8200_enum_dv_timings, + .dv_timings_cap = ths8200_dv_timings_cap, +}; + /* V4L2 top level operation handlers */ static const struct v4l2_subdev_ops ths8200_ops = { .core = ths8200_core_ops, .video = ths8200_video_ops, + .pad = ths8200_pad_ops, }; static int ths8200_probe(struct i2c_client *client, -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 07/49] adv7511: Add pad-level DV timings operations
The video enum_dv_timings and dv_timings_cap operations are deprecated. Implement the pad-level version of those operations to prepare for the removal of the video version. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7511.c | 66 ++--- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c index 942ca4b..f4a1431 100644 --- a/drivers/media/i2c/adv7511.c +++ b/drivers/media/i2c/adv7511.c @@ -597,34 +597,6 @@ static int adv7511_isr(struct v4l2_subdev *sd, u32 status, bool *handled) return 0; } -static int adv7511_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) -{ - struct adv7511_state *state = get_adv7511_state(sd); - - if (edid-pad != 0) - return -EINVAL; - if ((edid-blocks == 0) || (edid-blocks 256)) - return -EINVAL; - if (!edid-edid) - return -EINVAL; - if (!state-edid.segments) { - v4l2_dbg(1, debug, sd, EDID segment 0 not found\n); - return -ENODATA; - } - if (edid-start_block = state-edid.segments * 2) - return -E2BIG; - if ((edid-blocks + edid-start_block) = state-edid.segments * 2) - edid-blocks = state-edid.segments * 2 - edid-start_block; - - memcpy(edid-edid, state-edid.data[edid-start_block * 128], - 128 * edid-blocks); - return 0; -} - -static const struct v4l2_subdev_pad_ops adv7511_pad_ops = { - .get_edid = adv7511_get_edid, -}; - static const struct v4l2_subdev_core_ops adv7511_core_ops = { .log_status = adv7511_log_status, #ifdef CONFIG_VIDEO_ADV_DEBUG @@ -700,12 +672,18 @@ static int adv7511_g_dv_timings(struct v4l2_subdev *sd, static int adv7511_enum_dv_timings(struct v4l2_subdev *sd, struct v4l2_enum_dv_timings *timings) { + if (timings-pad != 0) + return -EINVAL; + return v4l2_enum_dv_timings_cap(timings, adv7511_timings_cap, NULL, NULL); } static int adv7511_dv_timings_cap(struct v4l2_subdev *sd, struct v4l2_dv_timings_cap *cap) { + if (cap-pad != 0) + return -EINVAL; + *cap = adv7511_timings_cap; return 0; } @@ -797,6 +775,38 @@ static const struct v4l2_subdev_audio_ops adv7511_audio_ops = { .s_routing = adv7511_s_routing, }; +/* PAD OPS - */ + +static int adv7511_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) +{ + struct adv7511_state *state = get_adv7511_state(sd); + + if (edid-pad != 0) + return -EINVAL; + if ((edid-blocks == 0) || (edid-blocks 256)) + return -EINVAL; + if (!edid-edid) + return -EINVAL; + if (!state-edid.segments) { + v4l2_dbg(1, debug, sd, EDID segment 0 not found\n); + return -ENODATA; + } + if (edid-start_block = state-edid.segments * 2) + return -E2BIG; + if ((edid-blocks + edid-start_block) = state-edid.segments * 2) + edid-blocks = state-edid.segments * 2 - edid-start_block; + + memcpy(edid-edid, state-edid.data[edid-start_block * 128], + 128 * edid-blocks); + return 0; +} + +static const struct v4l2_subdev_pad_ops adv7511_pad_ops = { + .get_edid = adv7511_get_edid, + .enum_dv_timings = adv7511_enum_dv_timings, + .dv_timings_cap = adv7511_dv_timings_cap, +}; + /* - SUBDEV OPS --- */ static const struct v4l2_subdev_ops adv7511_ops = { -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 06/49] ad9389b: Add pad-level DV timings operations
The video enum_dv_timings and dv_timings_cap operations are deprecated. Implement the pad-level version of those operations to prepare for the removal of the video version. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/ad9389b.c | 68 ++--- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c index 1b7ecfd..cee0ae6 100644 --- a/drivers/media/i2c/ad9389b.c +++ b/drivers/media/i2c/ad9389b.c @@ -571,35 +571,6 @@ static const struct v4l2_subdev_core_ops ad9389b_core_ops = { .interrupt_service_routine = ad9389b_isr, }; -/* -- PAD OPS -- */ - -static int ad9389b_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) -{ - struct ad9389b_state *state = get_ad9389b_state(sd); - - if (edid-pad != 0) - return -EINVAL; - if (edid-blocks == 0 || edid-blocks 256) - return -EINVAL; - if (!edid-edid) - return -EINVAL; - if (!state-edid.segments) { - v4l2_dbg(1, debug, sd, EDID segment 0 not found\n); - return -ENODATA; - } - if (edid-start_block = state-edid.segments * 2) - return -E2BIG; - if (edid-blocks + edid-start_block = state-edid.segments * 2) - edid-blocks = state-edid.segments * 2 - edid-start_block; - memcpy(edid-edid, state-edid.data[edid-start_block * 128], - 128 * edid-blocks); - return 0; -} - -static const struct v4l2_subdev_pad_ops ad9389b_pad_ops = { - .get_edid = ad9389b_get_edid, -}; - /* -- VIDEO OPS -- */ /* Enable/disable ad9389b output */ @@ -678,6 +649,9 @@ static int ad9389b_g_dv_timings(struct v4l2_subdev *sd, static int ad9389b_enum_dv_timings(struct v4l2_subdev *sd, struct v4l2_enum_dv_timings *timings) { + if (timings-pad != 0) + return -EINVAL; + return v4l2_enum_dv_timings_cap(timings, ad9389b_timings_cap, NULL, NULL); } @@ -685,6 +659,9 @@ static int ad9389b_enum_dv_timings(struct v4l2_subdev *sd, static int ad9389b_dv_timings_cap(struct v4l2_subdev *sd, struct v4l2_dv_timings_cap *cap) { + if (cap-pad != 0) + return -EINVAL; + *cap = ad9389b_timings_cap; return 0; } @@ -697,6 +674,39 @@ static const struct v4l2_subdev_video_ops ad9389b_video_ops = { .dv_timings_cap = ad9389b_dv_timings_cap, }; +/* -- PAD OPS -- */ + +static int ad9389b_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) +{ + struct ad9389b_state *state = get_ad9389b_state(sd); + + if (edid-pad != 0) + return -EINVAL; + if (edid-blocks == 0 || edid-blocks 256) + return -EINVAL; + if (!edid-edid) + return -EINVAL; + if (!state-edid.segments) { + v4l2_dbg(1, debug, sd, EDID segment 0 not found\n); + return -ENODATA; + } + if (edid-start_block = state-edid.segments * 2) + return -E2BIG; + if (edid-blocks + edid-start_block = state-edid.segments * 2) + edid-blocks = state-edid.segments * 2 - edid-start_block; + memcpy(edid-edid, state-edid.data[edid-start_block * 128], + 128 * edid-blocks); + return 0; +} + +static const struct v4l2_subdev_pad_ops ad9389b_pad_ops = { + .get_edid = ad9389b_get_edid, + .enum_dv_timings = ad9389b_enum_dv_timings, + .dv_timings_cap = ad9389b_dv_timings_cap, +}; + +/* -- AUDIO OPS -- */ + static int ad9389b_s_audio_stream(struct v4l2_subdev *sd, int enable) { v4l2_dbg(1, debug, sd, %s: %sable\n, __func__, (enable ? en : dis)); -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 12/49] tvp7002: Add pad-level DV timings operations
The video enum_dv_timings operation is deprecated. Implement the pad-level version of the operation to prepare for the removal of the video version. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Lad, Prabhakar prabhakar.cse...@gmail.com --- drivers/media/i2c/tvp7002.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c index c4e1e2c..019dbcf 100644 --- a/drivers/media/i2c/tvp7002.c +++ b/drivers/media/i2c/tvp7002.c @@ -833,6 +833,9 @@ static int tvp7002_log_status(struct v4l2_subdev *sd) static int tvp7002_enum_dv_timings(struct v4l2_subdev *sd, struct v4l2_enum_dv_timings *timings) { + if (timings-pad != 0) + return -EINVAL; + /* Check requested format index is within range */ if (timings-index = NUM_TIMINGS) return -EINVAL; @@ -938,6 +941,7 @@ static const struct v4l2_subdev_pad_ops tvp7002_pad_ops = { .enum_mbus_code = tvp7002_enum_mbus_code, .get_fmt = tvp7002_get_pad_format, .set_fmt = tvp7002_set_pad_format, + .enum_dv_timings = tvp7002_enum_dv_timings, }; /* V4L2 top level operation handlers */ -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 09/49] s5p-tv: hdmi: Add pad-level DV timings operations
The video enum_dv_timings and dv_timings_cap operations are deprecated. Implement the pad-level version of those operations to prepare for the removal of the video version. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/platform/s5p-tv/hdmi_drv.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/media/platform/s5p-tv/hdmi_drv.c b/drivers/media/platform/s5p-tv/hdmi_drv.c index 534722c..3db496c 100644 --- a/drivers/media/platform/s5p-tv/hdmi_drv.c +++ b/drivers/media/platform/s5p-tv/hdmi_drv.c @@ -674,6 +674,8 @@ static int hdmi_g_mbus_fmt(struct v4l2_subdev *sd, static int hdmi_enum_dv_timings(struct v4l2_subdev *sd, struct v4l2_enum_dv_timings *timings) { + if (timings-pad != 0) + return -EINVAL; if (timings-index = ARRAY_SIZE(hdmi_timings)) return -EINVAL; timings-timings = hdmi_timings[timings-index].dv_timings; @@ -687,6 +689,9 @@ static int hdmi_dv_timings_cap(struct v4l2_subdev *sd, { struct hdmi_device *hdev = sd_to_hdmi_dev(sd); + if (cap-pad != 0) + return -EINVAL; + /* Let the phy fill in the pixelclock range */ v4l2_subdev_call(hdev-phy_sd, video, dv_timings_cap, cap); cap-type = V4L2_DV_BT_656_1120; @@ -713,6 +718,11 @@ static const struct v4l2_subdev_video_ops hdmi_sd_video_ops = { .s_stream = hdmi_s_stream, }; +static const struct v4l2_subdev_pad_ops hdmi_sd_pad_ops = { + .enum_dv_timings = hdmi_enum_dv_timings, + .dv_timings_cap = hdmi_dv_timings_cap, +}; + static const struct v4l2_subdev_ops hdmi_sd_ops = { .core = hdmi_sd_core_ops, .video = hdmi_sd_video_ops, -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 14/49] media: davinci: vpif: Switch to pad-level DV operations
The video-level enum_dv_timings and dv_timings_cap operations are deprecated in favor of the pad-level versions. All subdev drivers implement the pad-level versions, switch to them. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com Acked-by: Lad, Prabhakar prabhakar.cse...@gmail.com --- drivers/media/platform/davinci/vpif_capture.c | 4 +++- drivers/media/platform/davinci/vpif_display.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 8dea0b8..f976438 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -1730,7 +1730,9 @@ vpif_enum_dv_timings(struct file *file, void *priv, struct channel_obj *ch = fh-channel; int ret; - ret = v4l2_subdev_call(ch-sd, video, enum_dv_timings, timings); + timings-pad = 0; + + ret = v4l2_subdev_call(ch-sd, pad, enum_dv_timings, timings); if (ret == -ENOIOCTLCMD || ret == -ENODEV) return -EINVAL; return ret; diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index aed41ed..f4bc39a 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c @@ -1386,7 +1386,9 @@ vpif_enum_dv_timings(struct file *file, void *priv, struct channel_obj *ch = fh-channel; int ret; - ret = v4l2_subdev_call(ch-sd, video, enum_dv_timings, timings); + timings-pad = 0; + + ret = v4l2_subdev_call(ch-sd, pad, enum_dv_timings, timings); if (ret == -ENOIOCTLCMD || ret == -ENODEV) return -EINVAL; return ret; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 08/49] adv7842: Add pad-level DV timings operations
The video enum_dv_timings and dv_timings_cap operations are deprecated. Implement the pad-level version of those operations to prepare for the removal of the video version. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/i2c/adv7842.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c index 06c25c3..5742f6f 100644 --- a/drivers/media/i2c/adv7842.c +++ b/drivers/media/i2c/adv7842.c @@ -1399,6 +1399,9 @@ static int read_stdi(struct v4l2_subdev *sd, struct stdi_readback *stdi) static int adv7842_enum_dv_timings(struct v4l2_subdev *sd, struct v4l2_enum_dv_timings *timings) { + if (timings-pad != 0) + return -EINVAL; + return v4l2_enum_dv_timings_cap(timings, adv7842_get_dv_timings_cap(sd), adv7842_check_dv_timings, NULL); } @@ -1406,6 +1409,9 @@ static int adv7842_enum_dv_timings(struct v4l2_subdev *sd, static int adv7842_dv_timings_cap(struct v4l2_subdev *sd, struct v4l2_dv_timings_cap *cap) { + if (cap-pad != 0) + return -EINVAL; + *cap = *adv7842_get_dv_timings_cap(sd); return 0; } @@ -2901,6 +2907,8 @@ static const struct v4l2_subdev_video_ops adv7842_video_ops = { static const struct v4l2_subdev_pad_ops adv7842_pad_ops = { .get_edid = adv7842_get_edid, .set_edid = adv7842_set_edid, + .enum_dv_timings = adv7842_enum_dv_timings, + .dv_timings_cap = adv7842_dv_timings_cap, }; static const struct v4l2_subdev_ops adv7842_ops = { -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 02/49] v4l: Add UYVY10_1X20 and VYUY10_1X20 media bus pixel codes
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- Documentation/DocBook/media/v4l/subdev-formats.xml | 104 + include/uapi/linux/v4l2-mediabus.h | 4 +- 2 files changed, 107 insertions(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml b/Documentation/DocBook/media/v4l/subdev-formats.xml index 6fb58de..e3cbbb4 100644 --- a/Documentation/DocBook/media/v4l/subdev-formats.xml +++ b/Documentation/DocBook/media/v4l/subdev-formats.xml @@ -2436,6 +2436,110 @@ entryvsubscript1/subscript/entry entryvsubscript0/subscript/entry /row + row id=V4L2-MBUS-FMT-UYVY10-1X20 + entryV4L2_MBUS_FMT_UYVY10_1X20/entry + entry0x201a/entry + entry/entry + dash-ent-12; + entryusubscript9/subscript/entry + entryusubscript8/subscript/entry + entryusubscript7/subscript/entry + entryusubscript6/subscript/entry + entryusubscript5/subscript/entry + entryusubscript4/subscript/entry + entryusubscript3/subscript/entry + entryusubscript2/subscript/entry + entryusubscript1/subscript/entry + entryusubscript0/subscript/entry + entryysubscript9/subscript/entry + entryysubscript8/subscript/entry + entryysubscript7/subscript/entry + entryysubscript6/subscript/entry + entryysubscript5/subscript/entry + entryysubscript4/subscript/entry + entryysubscript3/subscript/entry + entryysubscript2/subscript/entry + entryysubscript1/subscript/entry + entryysubscript0/subscript/entry + /row + row + entry/entry + entry/entry + entry/entry + dash-ent-12; + entryvsubscript9/subscript/entry + entryvsubscript8/subscript/entry + entryvsubscript7/subscript/entry + entryvsubscript6/subscript/entry + entryvsubscript5/subscript/entry + entryvsubscript4/subscript/entry + entryvsubscript3/subscript/entry + entryvsubscript2/subscript/entry + entryvsubscript1/subscript/entry + entryvsubscript0/subscript/entry + entryysubscript9/subscript/entry + entryysubscript8/subscript/entry + entryysubscript7/subscript/entry + entryysubscript6/subscript/entry + entryysubscript5/subscript/entry + entryysubscript4/subscript/entry + entryysubscript3/subscript/entry + entryysubscript2/subscript/entry + entryysubscript1/subscript/entry + entryysubscript0/subscript/entry + /row + row id=V4L2-MBUS-FMT-VYUY10-1X20 + entryV4L2_MBUS_FMT_VYUY10_1X20/entry + entry0x201b/entry + entry/entry + dash-ent-12; + entryvsubscript9/subscript/entry + entryvsubscript8/subscript/entry + entryvsubscript7/subscript/entry + entryvsubscript6/subscript/entry + entryvsubscript5/subscript/entry + entryvsubscript4/subscript/entry + entryvsubscript3/subscript/entry + entryvsubscript2/subscript/entry + entryvsubscript1/subscript/entry + entryvsubscript0/subscript/entry + entryysubscript9/subscript/entry + entryysubscript8/subscript/entry + entryysubscript7/subscript/entry + entryysubscript6/subscript/entry + entryysubscript5/subscript/entry + entryysubscript4/subscript/entry + entryysubscript3/subscript/entry + entryysubscript2/subscript/entry + entryysubscript1/subscript/entry + entryysubscript0/subscript/entry + /row + row + entry/entry + entry/entry + entry/entry + dash-ent-12; + entryusubscript9/subscript/entry + entryusubscript8/subscript/entry + entryusubscript7/subscript/entry + entryusubscript6/subscript/entry + entryusubscript5/subscript/entry + entryusubscript4/subscript/entry + entryusubscript3/subscript/entry + entryusubscript2/subscript/entry + entryusubscript1/subscript/entry + entryusubscript0/subscript/entry + entryysubscript9/subscript/entry + entryysubscript8/subscript/entry + entryysubscript7/subscript/entry + entryysubscript6/subscript/entry + entryysubscript5/subscript/entry + entryysubscript4/subscript/entry + entryysubscript3/subscript/entry +
[PATCH v4 05/49] v4l: Add pad-level DV timings subdev operations
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Acked-by: Lad, Prabhakar prabhakar.cse...@gmail.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- include/media/v4l2-subdev.h| 4 include/uapi/linux/videodev2.h | 10 -- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index ee1cb2d..341ca4d 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -510,6 +510,10 @@ struct v4l2_subdev_pad_ops { struct v4l2_subdev_selection *sel); int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid); int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid); + int (*dv_timings_cap)(struct v4l2_subdev *sd, + struct v4l2_dv_timings_cap *cap); + int (*enum_dv_timings)(struct v4l2_subdev *sd, + struct v4l2_enum_dv_timings *timings); #ifdef CONFIG_MEDIA_CONTROLLER int (*link_validate)(struct v4l2_subdev *sd, struct media_link *link, struct v4l2_subdev_format *source_fmt, diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index ea468ee..8e5077e 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1107,12 +1107,15 @@ struct v4l2_dv_timings { /** struct v4l2_enum_dv_timings - DV timings enumeration * @index: enumeration index + * @pad: the pad number for which to enumerate timings (used with + * v4l-subdev nodes only) * @reserved: must be zeroed * @timings: the timings for the given index */ struct v4l2_enum_dv_timings { __u32 index; - __u32 reserved[3]; + __u32 pad; + __u32 reserved[2]; struct v4l2_dv_timings timings; }; @@ -1150,11 +1153,14 @@ struct v4l2_bt_timings_cap { /** struct v4l2_dv_timings_cap - DV timings capabilities * @type: the type of the timings (same as in struct v4l2_dv_timings) + * @pad: the pad number for which to query capabilities (used with + * v4l-subdev nodes only) * @bt:the BT656/1120 timings capabilities */ struct v4l2_dv_timings_cap { __u32 type; - __u32 reserved[3]; + __u32 pad; + __u32 reserved[2]; union { struct v4l2_bt_timings_cap bt; __u32 raw_data[32]; -- 1.8.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 04/49] v4l: Add 12-bit YUV 4:2:2 media bus pixel codes
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- Documentation/DocBook/media/v4l/subdev-formats.xml | 240 + include/uapi/linux/v4l2-mediabus.h | 6 +- 2 files changed, 245 insertions(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml b/Documentation/DocBook/media/v4l/subdev-formats.xml index a0fa7e0..b2d5a03 100644 --- a/Documentation/DocBook/media/v4l/subdev-formats.xml +++ b/Documentation/DocBook/media/v4l/subdev-formats.xml @@ -3006,6 +3006,246 @@ entryusubscript1/subscript/entry entryusubscript0/subscript/entry /row + row id=V4L2-MBUS-FMT-UYVY12-1X24 + entryV4L2_MBUS_FMT_UYVY12_1X24/entry + entry0x2020/entry + entry/entry + dash-ent-8; + entryusubscript11/subscript/entry + entryusubscript10/subscript/entry + entryusubscript9/subscript/entry + entryusubscript8/subscript/entry + entryusubscript7/subscript/entry + entryusubscript6/subscript/entry + entryusubscript5/subscript/entry + entryusubscript4/subscript/entry + entryusubscript3/subscript/entry + entryusubscript2/subscript/entry + entryusubscript1/subscript/entry + entryusubscript0/subscript/entry + entryysubscript11/subscript/entry + entryysubscript10/subscript/entry + entryysubscript9/subscript/entry + entryysubscript8/subscript/entry + entryysubscript7/subscript/entry + entryysubscript6/subscript/entry + entryysubscript5/subscript/entry + entryysubscript4/subscript/entry + entryysubscript3/subscript/entry + entryysubscript2/subscript/entry + entryysubscript1/subscript/entry + entryysubscript0/subscript/entry + /row + row + entry/entry + entry/entry + entry/entry + dash-ent-8; + entryvsubscript11/subscript/entry + entryvsubscript10/subscript/entry + entryvsubscript9/subscript/entry + entryvsubscript8/subscript/entry + entryvsubscript7/subscript/entry + entryvsubscript6/subscript/entry + entryvsubscript5/subscript/entry + entryvsubscript4/subscript/entry + entryvsubscript3/subscript/entry + entryvsubscript2/subscript/entry + entryvsubscript1/subscript/entry + entryvsubscript0/subscript/entry + entryysubscript11/subscript/entry + entryysubscript10/subscript/entry + entryysubscript9/subscript/entry + entryysubscript8/subscript/entry + entryysubscript7/subscript/entry + entryysubscript6/subscript/entry + entryysubscript5/subscript/entry + entryysubscript4/subscript/entry + entryysubscript3/subscript/entry + entryysubscript2/subscript/entry + entryysubscript1/subscript/entry + entryysubscript0/subscript/entry + /row + row id=V4L2-MBUS-FMT-VYUY12-1X24 + entryV4L2_MBUS_FMT_VYUY12_1X24/entry + entry0x2021/entry + entry/entry + dash-ent-8; + entryvsubscript11/subscript/entry + entryvsubscript10/subscript/entry + entryvsubscript9/subscript/entry + entryvsubscript8/subscript/entry + entryvsubscript7/subscript/entry + entryvsubscript6/subscript/entry + entryvsubscript5/subscript/entry + entryvsubscript4/subscript/entry + entryvsubscript3/subscript/entry + entryvsubscript2/subscript/entry + entryvsubscript1/subscript/entry + entryvsubscript0/subscript/entry + entryysubscript11/subscript/entry + entryysubscript10/subscript/entry + entryysubscript9/subscript/entry + entryysubscript8/subscript/entry + entryysubscript7/subscript/entry + entryysubscript6/subscript/entry + entryysubscript5/subscript/entry + entryysubscript4/subscript/entry + entryysubscript3/subscript/entry + entryysubscript2/subscript/entry + entryysubscript1/subscript/entry + entryysubscript0/subscript/entry + /row + row + entry/entry + entry/entry + entry/entry + dash-ent-8; + entryusubscript11/subscript/entry + entryusubscript10/subscript/entry + entryusubscript9/subscript/entry + entryusubscript8/subscript/entry + entryusubscript7/subscript/entry +
[PATCH v4 01/49] v4l: Add UYVY10_2X10 and VYUY10_2X10 media bus pixel codes
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Reviewed-by: Hans Verkuil hans.verk...@cisco.com --- Documentation/DocBook/media/v4l/subdev-formats.xml | 128 + include/uapi/linux/v4l2-mediabus.h | 4 +- 2 files changed, 131 insertions(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml b/Documentation/DocBook/media/v4l/subdev-formats.xml index 7331ce1..6fb58de 100644 --- a/Documentation/DocBook/media/v4l/subdev-formats.xml +++ b/Documentation/DocBook/media/v4l/subdev-formats.xml @@ -1898,6 +1898,134 @@ entryysubscript1/subscript/entry entryysubscript0/subscript/entry /row + row id=V4L2-MBUS-FMT-UYVY10-2X10 + entryV4L2_MBUS_FMT_UYVY10_2X10/entry + entry0x2018/entry + entry/entry + dash-ent-22; + entryusubscript9/subscript/entry + entryusubscript8/subscript/entry + entryusubscript7/subscript/entry + entryusubscript6/subscript/entry + entryusubscript5/subscript/entry + entryusubscript4/subscript/entry + entryusubscript3/subscript/entry + entryusubscript2/subscript/entry + entryusubscript1/subscript/entry + entryusubscript0/subscript/entry + /row + row + entry/entry + entry/entry + entry/entry + dash-ent-22; + entryysubscript9/subscript/entry + entryysubscript8/subscript/entry + entryysubscript7/subscript/entry + entryysubscript6/subscript/entry + entryysubscript5/subscript/entry + entryysubscript4/subscript/entry + entryysubscript3/subscript/entry + entryysubscript2/subscript/entry + entryysubscript1/subscript/entry + entryysubscript0/subscript/entry + /row + row + entry/entry + entry/entry + entry/entry + dash-ent-22; + entryvsubscript9/subscript/entry + entryvsubscript8/subscript/entry + entryvsubscript7/subscript/entry + entryvsubscript6/subscript/entry + entryvsubscript5/subscript/entry + entryvsubscript4/subscript/entry + entryvsubscript3/subscript/entry + entryvsubscript2/subscript/entry + entryvsubscript1/subscript/entry + entryvsubscript0/subscript/entry + /row + row + entry/entry + entry/entry + entry/entry + dash-ent-22; + entryysubscript9/subscript/entry + entryysubscript8/subscript/entry + entryysubscript7/subscript/entry + entryysubscript6/subscript/entry + entryysubscript5/subscript/entry + entryysubscript4/subscript/entry + entryysubscript3/subscript/entry + entryysubscript2/subscript/entry + entryysubscript1/subscript/entry + entryysubscript0/subscript/entry + /row + row id=V4L2-MBUS-FMT-VYUY10-2X10 + entryV4L2_MBUS_FMT_VYUY10_2X10/entry + entry0x2019/entry + entry/entry + dash-ent-22; + entryvsubscript9/subscript/entry + entryvsubscript8/subscript/entry + entryvsubscript7/subscript/entry + entryvsubscript6/subscript/entry + entryvsubscript5/subscript/entry + entryvsubscript4/subscript/entry + entryvsubscript3/subscript/entry + entryvsubscript2/subscript/entry + entryvsubscript1/subscript/entry + entryvsubscript0/subscript/entry + /row + row + entry/entry + entry/entry + entry/entry + dash-ent-22; + entryysubscript9/subscript/entry + entryysubscript8/subscript/entry + entryysubscript7/subscript/entry + entryysubscript6/subscript/entry + entryysubscript5/subscript/entry + entryysubscript4/subscript/entry + entryysubscript3/subscript/entry + entryysubscript2/subscript/entry + entryysubscript1/subscript/entry + entryysubscript0/subscript/entry + /row + row + entry/entry + entry/entry + entry/entry + dash-ent-22; + entryusubscript9/subscript/entry + entryusubscript8/subscript/entry + entryusubscript7/subscript/entry + entryusubscript6/subscript/entry + entryusubscript5/subscript/entry + entryusubscript4/subscript/entry + entryusubscript3/subscript/entry + entryusubscript2/subscript/entry +
Re: [PATCH] uvc: update uvc_endpoint_max_bpi to handle USB_SPEED_WIRELESS devices
Hi Thomas, On Wednesday 16 April 2014 12:29:22 Thomas Pugliese wrote: On Wed, 16 Apr 2014, Laurent Pinchart wrote: Hi Thomas, (CC'ing the linux-usb mailing list) On Tuesday 15 April 2014 16:45:28 Thomas Pugliese wrote: On Tue, 15 Apr 2014, Laurent Pinchart wrote: Hi Thomas, Could you please send me a proper revert patch with the above description in the commit message and CC Mauro Carvalho Chehab m.che...@samsung.com ? Hi Laurent, I can submit a patch to revert but I should make a correction first. I had backported this change to an earlier kernel (2.6.39) which was before super speed support was added and the regression I described was based on that kernel. It was actually the addition of super speed support that broke windows compatible devices. My previous change fixed spec compliant devices but left windows compatible devices broken. Basically, the timeline of changes is this: 1. Prior to the addition of super speed support (commit 6fd90db8df379e215): all WUSB devices were treated as HIGH_SPEED devices. This is how Windows works so Windows compatible devices would work. For spec compliant WUSB devices, the max packet size would be incorrectly calculated which would result in high-bandwidth isoc streams being unable to find an alt setting that provided enough bandwidth. 2. After super speed support: all WUSB devices fell through to the default case of uvc_endpoint_max_bpi which would mask off the upper bits of the max packet size. This broke both WUSB spec compliant and non compliant devices because no endpoint with a large enough bpi would be found. 3. After 79af67e77f86404e77e: Spec compliant devices are fixed but non-spec compliant (although Windows compatible) devices are broken. Basically, this is the opposite of how it worked prior to super speed support. Given that, I can submit a patch to revert 79af67e77f86404e77e but that would go back to having all WUSB devices broken. Alternatively, the change below will revert the behavior back to scenario 1 where Windows compatible devices work but strictly spec complaint devices may not. I can send a proper patch for whichever scenario you prefer. Thank you for the explanation. Reverting 79af67e77f86404e77e doesn't seem like a very good idea, given that all WUSB devices will be broken. We thus have two options: - leaving the code as-is, with support for spec-compliant WUSB devices but not for microsoft-specific devices - applying the patch below, with support for microsoft-specific USB devices but not for spec-compliant devices This isn't the first time this kind of situation occurs. Microsoft didn't support multiple configurations before Windows 8, making vendors come up with lots of creative MS-specific solutions. I consider those devices non USB compliant, and they should not be allowed to use the USB logo, but that would require a strong political move from the USB Implementers Forum which is more or less controlled by Microsoft... Welcome to the USB mafia. Anyway, I have no experience with WUSB devices, so I don't know what's more common in the wild. What would you suggest ? I think that almost all current devices support the Windows/USB 2.0 format rather than stricty follow the WUSB spec. Even the prototype device that I initially used to test UVC with Wireless USB has been updated to use the USB 2.0 format prior to shipping in order to remain compatible with Windows. That being said, these devices are not very common at all in the consumer market. They are mostly used in embedded/industrial settings so that may factor in as to which direction you want to go. Would there be a way to support both categories of devices ? As you had mentioned previously, it should be possible to support both formats by ignoring the endpoint descriptor and looking at the bMaxBurst, bOverTheAirInterval and wOverTheAirPacketSize fields in the WUSB endpoint companion descriptor. That is a more involved change to the UVC driver and also would require changes to USB core to store the WUSB endpoint companion descriptor in struct usb_host_endpoint similar to what is done for super speed devices. It's more complex indeed, but I believe it would be worth it. Any volunteer ? ;-) In the meantime I'm fine with a patch that reverts to the previous behaviour. Please include the explanation of the problem in the commit message. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 45/49] adv7604: Add DT support
Hi Laurent, On 17/04/14 16:13, Laurent Pinchart wrote: Parse the device tree node to populate platform data. Only the ADV7611 is currently support with DT. Cc: devicet...@vger.kernel.org Cc: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Acked-by: Hans Verkuil hans.verk...@cisco.com The patch looks good to me. Acked-by: Sylwester Nawrocki s.nawro...@samsung.com Just one comment below... --- .../devicetree/bindings/media/i2c/adv7604.txt | 57 +++ drivers/media/i2c/adv7604.c| 80 ++ 2 files changed, 123 insertions(+), 14 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7604.txt diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt new file mode 100644 index 000..2efb48f --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt @@ -0,0 +1,57 @@ +* Analog Devices ADV7604/11 video decoder with HDMI receiver + +The ADV7604 and ADV7611 are multiformat video decoders with an integrated HDMI +receiver. The ADV7604 has four multiplexed HDMI inputs and one analog input, +and the ADV7611 has one HDMI input and no analog input. + +These device tree bindings support the ADV7611 only at the moment. + +Required Properties: + + - compatible: Must contain one of the following +- adi,adv7611 for the ADV7611 + + - reg: I2C slave address + + - hpd-gpios: References to the GPIOs that control the HDMI hot-plug +detection pins, one per HDMI input. The active flag indicates the GPIO +level that enables hot-plug detection. + +The device node must contain one 'port' child node per device input and output +port, in accordance with the video interface bindings defined in +Documentation/devicetree/bindings/media/video-interfaces.txt. The port nodes +are numbered as follows. + + Port ADV7611 + + HDMI 0 + Digital output 1 + +The digital output port node must contain at least one endpoint. + +Optional Properties: + + - reset-gpios: Reference to the GPIO connected to the device's reset pin. + +Example: + + hdmi_receiver@4c { + compatible = adi,adv7611; + reg = 0x4c; + + reset-gpios = ioexp 0 GPIO_ACTIVE_LOW; + hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH; + + #address-cells = 1; + #size-cells = 0; + + port@0 { + reg = 0; + }; + port@1 { + reg = 1; + hdmi_in: endpoint { + remote-endpoint = ccdc_in; + }; + }; + }; diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 342d73d..061794e 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -2663,13 +2663,58 @@ static const struct adv7604_chip_info adv7604_chip_info[] = { }, }; +static struct i2c_device_id adv7604_i2c_id[] = { + { adv7604, (kernel_ulong_t)adv7604_chip_info[ADV7604] }, + { adv7611, (kernel_ulong_t)adv7604_chip_info[ADV7611] }, + { } +}; +MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id); + +static struct of_device_id adv7604_of_id[] = { Not adding __maybe_unused attribute to this one ? + { .compatible = adi,adv7611, .data = adv7604_chip_info[ADV7611] }, + { } +}; +MODULE_DEVICE_TABLE(of, adv7604_of_id); + +static int adv7604_parse_dt(struct adv7604_state *state) +{ + /* Disable the interrupt for now as no DT-based board uses it. */ + state-pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED; + + /* Use the default I2C addresses. */ + state-pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42; + state-pdata.i2c_addresses[ADV7604_PAGE_CEC] = 0x40; + state-pdata.i2c_addresses[ADV7604_PAGE_INFOFRAME] = 0x3e; + state-pdata.i2c_addresses[ADV7604_PAGE_ESDP] = 0x38; + state-pdata.i2c_addresses[ADV7604_PAGE_DPP] = 0x3c; + state-pdata.i2c_addresses[ADV7604_PAGE_AFE] = 0x26; + state-pdata.i2c_addresses[ADV7604_PAGE_REP] = 0x32; + state-pdata.i2c_addresses[ADV7604_PAGE_EDID] = 0x36; + state-pdata.i2c_addresses[ADV7604_PAGE_HDMI] = 0x34; + state-pdata.i2c_addresses[ADV7604_PAGE_TEST] = 0x30; + state-pdata.i2c_addresses[ADV7604_PAGE_CP] = 0x22; + state-pdata.i2c_addresses[ADV7604_PAGE_VDP] = 0x24; + + /* Hardcode the remaining platform data fields. */ + state-pdata.disable_pwrdnb = 0; + state-pdata.disable_cable_det_rst = 0; + state-pdata.default_input = -1; + state-pdata.blank_data = 1; + state-pdata.op_656_range = 1; + state-pdata.alt_data_sat = 1; + state-pdata.insert_av_codes = 1; +
Re: [PATCH v4 45/49] adv7604: Add DT support
Hi Sylwester, On Thursday 17 April 2014 16:39:29 Sylwester Nawrocki wrote: On 17/04/14 16:13, Laurent Pinchart wrote: Parse the device tree node to populate platform data. Only the ADV7611 is currently support with DT. Cc: devicet...@vger.kernel.org Cc: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Acked-by: Hans Verkuil hans.verk...@cisco.com The patch looks good to me. Acked-by: Sylwester Nawrocki s.nawro...@samsung.com Thank you. Just one comment below... [snip] diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 342d73d..061794e 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -2663,13 +2663,58 @@ static const struct adv7604_chip_info adv7604_chip_info[] = { }, }; +static struct i2c_device_id adv7604_i2c_id[] = { + { adv7604, (kernel_ulong_t)adv7604_chip_info[ADV7604] }, + { adv7611, (kernel_ulong_t)adv7604_chip_info[ADV7611] }, + { } +}; +MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id); + +static struct of_device_id adv7604_of_id[] = { Not adding __maybe_unused attribute to this one ? Sure, of course. I'll squash patch 49/49 into this one. + { .compatible = adi,adv7611, .data = adv7604_chip_info[ADV7611] }, + { } +}; +MODULE_DEVICE_TABLE(of, adv7604_of_id); -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 47/49] adv7604: Add endpoint properties to DT bindings
On 17/04/14 16:13, Laurent Pinchart wrote: Add support for the hsync-active, vsync-active and pclk-sample properties to the DT bindings and control BT.656 mode implicitly. Cc: devicet...@vger.kernel.org Cc: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Acked-by: Hans Verkuil hans.verk...@cisco.com Thanks, the patch looks good to me. Acked-by: Sylwester Nawrocki s.nawro...@samsung.com --- .../devicetree/bindings/media/i2c/adv7604.txt | 13 + drivers/media/i2c/adv7604.c| 34 -- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt index 2efb48f..c27cede 100644 --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt @@ -33,6 +33,19 @@ Optional Properties: - reset-gpios: Reference to the GPIO connected to the device's reset pin. +Optional Endpoint Properties: + + The following three properties are defined in video-interfaces.txt and are + valid for source endpoints only. + + - hsync-active: Horizontal synchronization polarity. Defaults to active low. + - vsync-active: Vertical synchronization polarity. Defaults to active low. + - pclk-sample: Pixel clock polarity. Defaults to output on the falling edge. + + If none of hsync-active, vsync-active and pclk-sample is specified the + endpoint will use embedded BT.656 synchronization. + + Example: hdmi_receiver@4c { diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index fd0c646..63f036f 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -41,6 +41,7 @@ #include media/v4l2-ctrls.h #include media/v4l2-device.h #include media/v4l2-dv-timings.h +#include media/v4l2-of.h static int debug; module_param(debug, int, 0644); @@ -2679,6 +2680,37 @@ MODULE_DEVICE_TABLE(of, adv7604_of_id); static int adv7604_parse_dt(struct adv7604_state *state) { + struct v4l2_of_endpoint bus_cfg; + struct device_node *endpoint; + struct device_node *np; + unsigned int flags; + + np = state-i2c_clients[ADV7604_PAGE_IO]-dev.of_node; + + /* Parse the endpoint. */ + endpoint = of_graph_get_next_endpoint(np, NULL); + if (!endpoint) + return -EINVAL; + + v4l2_of_parse_endpoint(endpoint, bus_cfg); + of_node_put(endpoint); + + flags = bus_cfg.bus.parallel.flags; + + if (flags V4L2_MBUS_HSYNC_ACTIVE_HIGH) + state-pdata.inv_hs_pol = 1; + + if (flags V4L2_MBUS_VSYNC_ACTIVE_HIGH) + state-pdata.inv_vs_pol = 1; + + if (flags V4L2_MBUS_PCLK_SAMPLE_RISING) + state-pdata.inv_llc_pol = 1; + + if (bus_cfg.bus_type == V4L2_MBUS_BT656) { + state-pdata.insert_av_codes = 1; + state-pdata.op_656_range = 1; + } + /* Disable the interrupt for now as no DT-based board uses it. */ state-pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED; @@ -2701,9 +2733,7 @@ static int adv7604_parse_dt(struct adv7604_state *state) state-pdata.disable_cable_det_rst = 0; state-pdata.default_input = -1; state-pdata.blank_data = 1; - state-pdata.op_656_range = 1; state-pdata.alt_data_sat = 1; - state-pdata.insert_av_codes = 1; state-pdata.op_format_mode_sel = ADV7604_OP_FORMAT_MODE0; state-pdata.bus_order = ADV7604_BUS_ORDER_RGB; -- Regards, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 45/49] adv7604: Add DT support
On 17/04/14 16:39, Sylwester Nawrocki wrote: On 17/04/14 16:13, Laurent Pinchart wrote: Parse the device tree node to populate platform data. Only the ADV7611 is currently support with DT. Cc: devicet...@vger.kernel.org Cc: Sylwester Nawrocki s.nawro...@samsung.com Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Acked-by: Hans Verkuil hans.verk...@cisco.com The patch looks good to me. Acked-by: Sylwester Nawrocki s.nawro...@samsung.com Just one comment below... --- [...] +static struct of_device_id adv7604_of_id[] = { Not adding __maybe_unused attribute to this one ? I missed it's added in the last patch in this series, please ignore this comment. -- Regards, Sylwester -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] uvc: update uvc_endpoint_max_bpi to handle USB_SPEED_WIRELESS devices
On Thu, 17 Apr 2014, Laurent Pinchart wrote: Hi Thomas, On Wednesday 16 April 2014 12:29:22 Thomas Pugliese wrote: On Wed, 16 Apr 2014, Laurent Pinchart wrote: Hi Thomas, (CC'ing the linux-usb mailing list) On Tuesday 15 April 2014 16:45:28 Thomas Pugliese wrote: On Tue, 15 Apr 2014, Laurent Pinchart wrote: Hi Thomas, Could you please send me a proper revert patch with the above description in the commit message and CC Mauro Carvalho Chehab m.che...@samsung.com ? Hi Laurent, I can submit a patch to revert but I should make a correction first. I had backported this change to an earlier kernel (2.6.39) which was before super speed support was added and the regression I described was based on that kernel. It was actually the addition of super speed support that broke windows compatible devices. My previous change fixed spec compliant devices but left windows compatible devices broken. Basically, the timeline of changes is this: 1. Prior to the addition of super speed support (commit 6fd90db8df379e215): all WUSB devices were treated as HIGH_SPEED devices. This is how Windows works so Windows compatible devices would work. For spec compliant WUSB devices, the max packet size would be incorrectly calculated which would result in high-bandwidth isoc streams being unable to find an alt setting that provided enough bandwidth. 2. After super speed support: all WUSB devices fell through to the default case of uvc_endpoint_max_bpi which would mask off the upper bits of the max packet size. This broke both WUSB spec compliant and non compliant devices because no endpoint with a large enough bpi would be found. 3. After 79af67e77f86404e77e: Spec compliant devices are fixed but non-spec compliant (although Windows compatible) devices are broken. Basically, this is the opposite of how it worked prior to super speed support. Given that, I can submit a patch to revert 79af67e77f86404e77e but that would go back to having all WUSB devices broken. Alternatively, the change below will revert the behavior back to scenario 1 where Windows compatible devices work but strictly spec complaint devices may not. I can send a proper patch for whichever scenario you prefer. Thank you for the explanation. Reverting 79af67e77f86404e77e doesn't seem like a very good idea, given that all WUSB devices will be broken. We thus have two options: - leaving the code as-is, with support for spec-compliant WUSB devices but not for microsoft-specific devices - applying the patch below, with support for microsoft-specific USB devices but not for spec-compliant devices This isn't the first time this kind of situation occurs. Microsoft didn't support multiple configurations before Windows 8, making vendors come up with lots of creative MS-specific solutions. I consider those devices non USB compliant, and they should not be allowed to use the USB logo, but that would require a strong political move from the USB Implementers Forum which is more or less controlled by Microsoft... Welcome to the USB mafia. Anyway, I have no experience with WUSB devices, so I don't know what's more common in the wild. What would you suggest ? I think that almost all current devices support the Windows/USB 2.0 format rather than stricty follow the WUSB spec. Even the prototype device that I initially used to test UVC with Wireless USB has been updated to use the USB 2.0 format prior to shipping in order to remain compatible with Windows. That being said, these devices are not very common at all in the consumer market. They are mostly used in embedded/industrial settings so that may factor in as to which direction you want to go. Would there be a way to support both categories of devices ? As you had mentioned previously, it should be possible to support both formats by ignoring the endpoint descriptor and looking at the bMaxBurst, bOverTheAirInterval and wOverTheAirPacketSize fields in the WUSB endpoint companion descriptor. That is a more involved change to the UVC driver and also would require changes to USB core to store the WUSB endpoint companion descriptor in struct usb_host_endpoint similar to what is done for super speed devices. It's more complex indeed, but I believe it would be worth it. Any volunteer ? ;-) In the meantime I'm fine with a patch that reverts to the previous behaviour. Please include the explanation of the problem in the commit message. -- Regards, Laurent Pinchart I may make an attempt at the more complete fix once I finish some of the other items in my queue. For clarification, would you like a patch that reverts to the pre-super speed behavior where windows-compatible devices work not but spec
Re: [RFC PATCH 2/2] drivers/base: add managed token devres interfaces
Hi Tejun, On 04/16/2014 03:58 PM, Tejun Heo wrote: Hello, Thanks for the review. A brief description of the use-case first. Token is intended to be used as a large grain lock and once locked, it can be held in the locked state for long periods of time. For instance, application will request video to be captured and the media driver digital video function wants to lock a resource that is shared between analog and digital functions. On Wed, Apr 09, 2014 at 09:21:08AM -0600, Shuah Khan wrote: +#define TOKEN_DEVRES_FREE 0 +#define TOKEN_DEVRES_BUSY 1 + +struct token_devres { + int status; + charid[]; +}; Please just do bool busy and drop the constants. Yes bool is fine. +struct tkn_match { + int status; + const char *id; +}; + +static void __devm_token_lock(struct device *dev, void *data) +{ + struct token_devres *tptr = data; + + if (tptr tptr-status == TOKEN_DEVRES_FREE) + tptr-status = TOKEN_DEVRES_BUSY; How can this function be called with NULL @tptr and what why would you need to check tptr-status before assigning to it if the value is binary anyway? And how is this supposed to work as locking if the outcome doesn't change depending on the current value? Right. tpr null check is not needed. It is an artifact of re-arranging the code in devm_token_lock() and __devm_token_lock() and not doing the proper cleanup. It can simply be a check to see if token is still free. More on this below. if (tptr-status == TOKEN_DEVRES_FREE) tptr-status = TOKEN_DEVRES_BUSY; + + return; No need to return from void function. Right. I will remove that. +static int devm_token_match(struct device *dev, void *res, void *data) +{ + struct token_devres *tkn = res; + struct tkn_match *mptr = data; + int rc; + + if (!tkn || !data) { + WARN_ON(!tkn || !data); + return 0; + } How would the above be possible? match function and match_data are optional parameters to devres_find(). find_dr() doesn't check for match_data == null condition. There is a definite possibility that the match_data could be null. tkn won't be. Checking tkn is not necessary. + + /* compare the token data and return 1 if it matches */ + if (strcmp(tkn-id, mptr-id) == 0) + rc = 1; + else + rc = 0; + + return rc; return !strcmp(tkn-id, mptr-id); Oops! I overlooked cleaning this up after removing debug messages. +/* If token is available, lock it for the caller, If not return -EBUSY */ +int devm_token_lock(struct device *dev, const char *id) +{ + struct token_devres *tkn_ptr; + struct tkn_match tkn; + int rc = 0; + + if (!id) + return -EFAULT; The function isn't supposed to be called with NULL @id, right? I don't really think it'd be necessary to do the above. Yes that is correct that it shouldn't be called a null id, however, there is no guarantee that it won't happen. Would you suggest letting this code fail with null pointer dereference in those rare cases? It is good way to find places where the interfaces isn't used correctly. However, it is not a graceful failure. + + tkn.id = id; + + tkn_ptr = devres_find(dev, devm_token_release, devm_token_match, tkn); + if (tkn_ptr == NULL) + return -ENODEV; What guarantees that the lock is not taken by someone else inbetween? Yes someone else can grab the lock between devres_find() and devres_update(). It is handled since __devm_token_lock() checks again if token is still free. Why is devres_update() even necessary? You can just embed lock in the data part and operate on it, no? Operating on the lock should be atomic, which is what devres_update() is doing. It can be simplified as follows by holding devres_lock in devm_token_lock(). spin_lock_irqsave(dev-devres_lock, flags); if (tkn_ptr-status == TOKEN_DEVRES_FREE) tkn_ptr-status = TOKEN_DEVRES_BUSY; spin_unlock_irqrestore(dev-devres_lock, flags); Is this in-line with what you have in mind? -- Shuah -- Shuah Khan Senior Linux Kernel Developer - Open Source Group Samsung Research America(Silicon Valley) shuah...@samsung.com | (970) 672-0658 -- 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: [RFC PATCH 2/2] drivers/base: add managed token devres interfaces
On Thu, Apr 17, 2014 at 02:01:32PM -0600, Shuah Khan wrote: Operating on the lock should be atomic, which is what devres_update() is doing. It can be simplified as follows by holding devres_lock in devm_token_lock(). spin_lock_irqsave(dev-devres_lock, flags); if (tkn_ptr-status == TOKEN_DEVRES_FREE) tkn_ptr-status = TOKEN_DEVRES_BUSY; spin_unlock_irqrestore(dev-devres_lock, flags); Is this in-line with what you have in mind? How is that different from tkn_ptr-status = TOKEN_DEVRES_BUSY? -- tejun -- 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: [RFC PATCH 2/2] drivers/base: add managed token devres interfaces
On Thu, Apr 17, 2014 at 04:10:34PM -0400, Tejun Heo wrote: On Thu, Apr 17, 2014 at 02:01:32PM -0600, Shuah Khan wrote: Operating on the lock should be atomic, which is what devres_update() is doing. It can be simplified as follows by holding devres_lock in devm_token_lock(). spin_lock_irqsave(dev-devres_lock, flags); if (tkn_ptr-status == TOKEN_DEVRES_FREE) tkn_ptr-status = TOKEN_DEVRES_BUSY; spin_unlock_irqrestore(dev-devres_lock, flags); Is this in-line with what you have in mind? How is that different from tkn_ptr-status = TOKEN_DEVRES_BUSY? Let me clear it up. How could the code snippet that you wrote possibly function as a lock between two threads? You're doing the following. if (state == busy) return -EBUSY; spin_lock; if (state == free) state = busy; spin_unlock; return SUCCESS!!!11!!1!!; The above is equivalent to if (state == busy) return -EBUSY; state = busy; return SUCCESS!!!11!!1!!; Now, if you let two threads compete on it, both can return SUCCESS. Can you see that? Please consult with somebody who has basic understanding of concurrency and synchronization. Please do not implement locking primitive directly if at all avoidable. Why can't it use a mutex embedded in the data area of a devres entry? And if you for some reason have to implement it directly, at least add lockdep annotations. Anyways, I really think this needs help from somebody who knows better. Thanks. -- tejun -- 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: [RFC PATCH 2/2] drivers/base: add managed token devres interfaces
On 04/17/2014 02:10 PM, Tejun Heo wrote: On Thu, Apr 17, 2014 at 02:01:32PM -0600, Shuah Khan wrote: Operating on the lock should be atomic, which is what devres_update() is doing. It can be simplified as follows by holding devres_lock in devm_token_lock(). spin_lock_irqsave(dev-devres_lock, flags); if (tkn_ptr-status == TOKEN_DEVRES_FREE) tkn_ptr-status = TOKEN_DEVRES_BUSY; spin_unlock_irqrestore(dev-devres_lock, flags); Is this in-line with what you have in mind? How is that different from tkn_ptr-status = TOKEN_DEVRES_BUSY? I see what you are saying. The code path doesn't ensure two threads not getting the lock. I have a bug in here that my rc settings aren't protected. You probably noticed that the RFC tag on the patch and this isn't fully cooked yet. I started working on driver changes that use this token and I might have to add owner for the token as well. I hope to work these details out and send a real patch. thanks, -- Shuah -- Shuah Khan Senior Linux Kernel Developer - Open Source Group Samsung Research America(Silicon Valley) shuah...@samsung.com | (970) 672-0658 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] s2255: Do not free fw_data until timer handler has actually stopped using it
Function del_timer() does not guarantee that timer was really deleted. If the timer handler is beeing executed at the moment, the function does nothing. So, we have a race between del_timer() and kfree(), and it's possible to use already freed memory in the handler. This is compile-tested only. Please, consider applying or something like it. [Should CC stable@ ?] Signed-off-by: Kirill Tkhai tk...@yandex.ru --- drivers/media/usb/s2255/s2255drv.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index 1d4ba2b..503fd65 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -1522,7 +1522,7 @@ static void s2255_destroy(struct s2255_dev *dev) /* board shutdown stops the read pipe if it is running */ s2255_board_shutdown(dev); /* make sure firmware still not trying to load */ - del_timer(dev-timer); /* only started in .probe and .open */ + del_timer_sync(dev-timer); /* only started in .probe and .open */ if (dev-fw_data-fw_urb) { usb_kill_urb(dev-fw_data-fw_urb); usb_free_urb(dev-fw_data-fw_urb); @@ -2352,7 +2352,7 @@ errorREQFW: errorFWDATA2: usb_free_urb(dev-fw_data-fw_urb); errorFWURB: - del_timer(dev-timer); + del_timer_sync(dev-timer); errorEP: usb_put_dev(dev-udev); errorUDEV: -- 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] cx23885: add support for Hauppauge ImpactVCB-e
Hi Guys, I've been playing around with this on my Kubuntu 13.10. Apart from the issue that you know I have of the altera-stapl.ko file arriving in the wrong directory, I think it's a good basis for moving forwards. What is the process for including this in the Linux TV baseline? I feel there are some things that could be done to make it even nicer, but it doesn't alter the fact that it still needs a bit of TLC. The depth of colour could be better. Can I add a patch to the patch? How would that go? I've added a suggested modification that would make life easier for me (scroll down for my mod on 640x480). But really it would probably be more appropriate to make the change card specific to avoid regression problems for existing setups. I also have a workaround for the s-video problem I reported earlier with this card. I'll see if it could be incorporated here too. Have a good long weekend. Regards Steve. On 14/04/14 14:57, Hans Verkuil wrote: This patch adds support for the Hauppauge ImpactVCB-e card to cx23885. Tested with Composite input and S-Video. While I do get audio it is very choppy. It is not clear whether that is a general cx23885 driver problem or specific to this board. If it is specific to the board, then I might have missed something. Steven (Toth, not Cookson ;-) ), do you have an idea what it might be? Regards, Hans Signed-off-by: Hans Verkuil hans.verk...@cisco.com --- drivers/media/pci/cx23885/cx23885-cards.c | 30 +- drivers/media/pci/cx23885/cx23885-video.c | 1 + drivers/media/pci/cx23885/cx23885.h | 1 + 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c index 79f20c8..49a3711 100644 --- a/drivers/media/pci/cx23885/cx23885-cards.c +++ b/drivers/media/pci/cx23885/cx23885-cards.c @@ -649,7 +649,25 @@ struct cx23885_board cx23885_boards[] = { CX25840_NONE1_CH3, .amux = CX25840_AUDIO6, } }, - } + }, + [CX23885_BOARD_HAUPPAUGE_IMPACTVCBE] = { + .name = Hauppauge ImpactVCB-e, + .porta = CX23885_ANALOG_VIDEO, + .input = {{ + .type = CX23885_VMUX_COMPOSITE1, + .vmux = CX25840_VIN7_CH3 | + CX25840_VIN4_CH2 | + CX25840_VIN6_CH1, + .amux = CX25840_AUDIO7, + }, { + .type = CX23885_VMUX_SVIDEO, + .vmux = CX25840_VIN7_CH3 | + CX25840_VIN4_CH2 | + CX25840_VIN8_CH1 | + CX25840_SVIDEO_ON, + .amux = CX25840_AUDIO7, + } }, + }, }; const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards); @@ -897,6 +915,10 @@ struct cx23885_subid cx23885_subids[] = { .subvendor = 0x1461, .subdevice = 0xd939, .card = CX23885_BOARD_AVERMEDIA_HC81R, + }, { + .subvendor = 0x0070, + .subdevice = 0x7133, + .card = CX23885_BOARD_HAUPPAUGE_IMPACTVCBE, }, }; const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids); @@ -977,6 +999,9 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data) case 71009: /* WinTV-HVR1200 (PCIe, Retail, full height) * DVB-T and basic analog */ + case 71100: + /* WinTV-ImpactVCB-e (PCIe, Retail, half height) +* Basic analog */ case 71359: /* WinTV-HVR1200 (PCIe, OEM, half height) * DVB-T and basic analog */ @@ -1701,6 +1726,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) case CX23885_BOARD_HAUPPAUGE_HVR1850: case CX23885_BOARD_HAUPPAUGE_HVR1290: case CX23885_BOARD_HAUPPAUGE_HVR4400: + case CX23885_BOARD_HAUPPAUGE_IMPACTVCBE: if (dev-i2c_bus[0].i2c_rc == 0) hauppauge_eeprom(dev, eeprom+0xc0); break; @@ -1807,6 +1833,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) case CX23885_BOARD_HAUPPAUGE_HVR1200: case CX23885_BOARD_HAUPPAUGE_HVR1700: case CX23885_BOARD_HAUPPAUGE_HVR1400: + case CX23885_BOARD_HAUPPAUGE_IMPACTVCBE: case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: case CX23885_BOARD_LEADTEK_WINFAST_PXPVR2200: case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000: @@ -1835,6 +1862,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) break; case CX23885_BOARD_HAUPPAUGE_HVR1250: case CX23885_BOARD_HAUPPAUGE_HVR1800: + case CX23885_BOARD_HAUPPAUGE_IMPACTVCBE:
Re: [PATCH] uvc: update uvc_endpoint_max_bpi to handle USB_SPEED_WIRELESS devices
Hi Thomas, On Thursday 17 April 2014 09:53:32 Thomas Pugliese wrote: On Thu, 17 Apr 2014, Laurent Pinchart wrote: On Wednesday 16 April 2014 12:29:22 Thomas Pugliese wrote: [snip] As you had mentioned previously, it should be possible to support both formats by ignoring the endpoint descriptor and looking at the bMaxBurst, bOverTheAirInterval and wOverTheAirPacketSize fields in the WUSB endpoint companion descriptor. That is a more involved change to the UVC driver and also would require changes to USB core to store the WUSB endpoint companion descriptor in struct usb_host_endpoint similar to what is done for super speed devices. It's more complex indeed, but I believe it would be worth it. Any volunteer ? ;-) In the meantime I'm fine with a patch that reverts to the previous behaviour. Please include the explanation of the problem in the commit message. I may make an attempt at the more complete fix once I finish some of the other items in my queue. For clarification, would you like a patch that reverts to the pre-super speed behavior where windows-compatible devices work not but spec compliant devices will not (i.e. treat USB_SPEED_HIGH and USB_SPEED_WIRELESS the same)? I'll trust your judgment on that, if you believe it would be better from a user point of view, please send a patch. Otherwise we can wait until you find time to work on a proper fix. -- 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: [RFC PATCH 2/2] drivers/base: add managed token devres interfaces
On 04/17/2014 02:22 PM, Tejun Heo wrote: On Thu, Apr 17, 2014 at 04:10:34PM -0400, Tejun Heo wrote: Please do not implement locking primitive directly if at all avoidable. Why can't it use a mutex embedded in the data area of a devres entry? And if you for some reason have to implement it directly, at least add lockdep annotations. Thanks. This is helpful. Yes it does simplify the code with mutex embedded in the devres data area. I am working on a v2 patch with that change. -- Shuah -- Shuah Khan Senior Linux Kernel Developer - Open Source Group Samsung Research America(Silicon Valley) shuah...@samsung.com | (970) 672-0658 -- 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] uvcvideo: Work around buggy Logitech C920 firmware
Hi Will, On Monday 14 April 2014 11:27:00 Will Manley wrote: On Mon, 14 Apr 2014, at 1:34, Laurent Pinchart wrote: [snip] Thank you for investigating this, and sorry for the late reply. I still haven't heard back from Logitech on this issue. I've pinged them, they might be busy at the moment. Thanks for looking at my patch :). You're welcome. Given that the device notifies us that the control value changes, one possibly more clever fix would be to handle that even and set the old control value back when the auto control is disabled. However, that's probably an overengineered solution. I've still been wondering whether the quirk shouldn't restore only the control(s) that are known to be erroneously changed by the camera instead of restoring them all. Feel free to disagree, what's your opinion about that ? So that was my initial intention, but when I got into it it seemed like it was going to add a whole bunch of additional complexity (and lines of code) for questionable benefit. While uploading all the values is a bit of a sledgehammer it has the advantage that it's simple and dumb and exercises code that's already in use for suspend/resume. OTOH you could argue that a patch which explicitly contains code like: if (strcmp(param.name, Exposure (Absolute)) == 0) { blah, blah, blah } or similar documents the quirk a little more explicitly. I still didn't think it was worth the extra complexity. I'm quite willing to be convinced otherwise though :). Another more marginal advantage is that the quirk may be more applicable to other hardware. Of course this is entirely theoretical at this point so probably can be discounted. One of the things that bother me with restoring all controls right after starting the stream is that it might actually result in different unexpected behaviors. For instance, this would write the value of all manual controls even when the corresponding auto control is turned on. Some cameras might not be happy, and this could have an adverse effect from temporary glitches in the video to complete crashes. Of course the quirk should not be enabled for cameras that would then crash, so we could consider that it's good as-is for the C920. I'd like to hear from Logitech on this issue before taking a decision. I've pinged them, let's wait one more week if that's fine with you. In the meantime, there's another question that crossed my mind, have you checked whether the camera has a similar buggy behaviour for other auto controls (auto white balance for instance), or if it's limited to auto- exposure ? -- 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: [v2] media: soc-camera: OF cameras
On Mon, Apr 14, 2014 at 10:38 AM, Ben Dooks ben.do...@codethink.co.uk wrote: On 14/04/14 18:14, Bryan Wu wrote: On Thu, Apr 10, 2014 at 2:18 PM, Guennadi Liakhovetski g.liakhovet...@gmx.de wrote: Hi Bryan, On Tue, 8 Apr 2014, Bryan Wu wrote: Thanks Josh, I think I will take you point and rework my patch again. But I need Guennadi's review firstly, Guennadi, could you please help to review it? Ok, let me double check the situation: 1. We've got this patch from you, aiming at adding OF probing support to soc-camra 2. We've got an alternative patch from Ben to do the same, his last reply to a comment to his patch was Thanks, I will look into this. 3. We've got Ben's patches for rcar-vin, that presumably work with his patch from (2) above 4. We've got Josh's patches to add OF / async probing to atmel-isi and ov2640, that are not known to work with either (1) or (2) above, so, they don't work at all, right? So, to summarise, there is a core patch from Ben, that he possibly wants to adjust, and that works with his rcar-vin OF, there is a patch from you that isn't known to work with any driver, and there are patches from Josh, that don't work, because there isn't a suitable patch available for them. I will have a look at your and Ben's soc-camera OF patches to compare them and compare them with my early code (hopefully this coming weekend), but so far it looks like only Ben's solution has a complete working stack. Am I missing something? My bad. I missed the conversation and patches from Ben Dooks and you guys. I have no problem for merging Ben's patch and I will align my Tegra Camera patch with that, probably posted later. If possible, could you test the latest one? I've not had much time to actually use this and would welcome some feedback. I'm busy about other stuff, but after I finish that, I definitely try to port my driver on top of you patchset. Thanks a lot, -Bryan -- 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