Re: [PATCH v7] media: vb2: Take queue or device lock in mmap-related vb2 ioctl handlers
On 08/06/2013 10:10 PM, Laurent Pinchart wrote: The vb2_fop_mmap() and vb2_fop_get_unmapped_area() functions are plug-in implementation of the mmap() and get_unmapped_area() file operations that calls vb2_mmap() and vb2_get_unmapped_area() on the queue associated with the video device. Neither the vb2_fop_mmap/vb2_fop_get_unmapped_area nor the v4l2_mmap/vb2_get_unmapped_area functions in the V4L2 core take any lock, leading to race conditions between mmap/get_unmapped_area and other buffer-related ioctls such as VIDIOC_REQBUFS. Fix it by taking the queue or device lock around the vb2_mmap() and vb2_get_unmapped_area() calls. Signed-off-by: Laurent Pinchart laurent.pinchart+rene...@ideasonboard.com Acked-by: Hans Verkuil hans.verk...@cisco.com Thanks! Hans --- drivers/media/v4l2-core/videobuf2-core.c | 18 -- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 9fc4bab..c9b50c7 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -2578,8 +2578,15 @@ EXPORT_SYMBOL_GPL(vb2_ioctl_expbuf); int vb2_fop_mmap(struct file *file, struct vm_area_struct *vma) { struct video_device *vdev = video_devdata(file); + struct mutex *lock = vdev-queue-lock ? vdev-queue-lock : vdev-lock; + int err; - return vb2_mmap(vdev-queue, vma); + if (lock mutex_lock_interruptible(lock)) + return -ERESTARTSYS; + err = vb2_mmap(vdev-queue, vma); + if (lock) + mutex_unlock(lock); + return err; } EXPORT_SYMBOL_GPL(vb2_fop_mmap); @@ -2685,8 +2692,15 @@ unsigned long vb2_fop_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { struct video_device *vdev = video_devdata(file); + struct mutex *lock = vdev-queue-lock ? vdev-queue-lock : vdev-lock; + int ret; - return vb2_get_unmapped_area(vdev-queue, addr, len, pgoff, flags); + if (lock mutex_lock_interruptible(lock)) + return -ERESTARTSYS; + ret = vb2_get_unmapped_area(vdev-queue, addr, len, pgoff, flags); + if (lock) + mutex_unlock(lock); + return ret; } EXPORT_SYMBOL_GPL(vb2_fop_get_unmapped_area); #endif -- To unsubscribe from this list: send the line unsubscribe 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/13] [media] exynos5-fimc-is: Add Exynos5 FIMC-IS device tree bindings documentation
The patch adds the DT binding documentation for Samsung Exynos5 SoC series imaging subsystem (FIMC-IS). Signed-off-by: Arun Kumar K arun...@samsung.com Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com --- .../devicetree/bindings/media/exynos5-fimc-is.txt | 52 1 file changed, 52 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/exynos5-fimc-is.txt diff --git a/Documentation/devicetree/bindings/media/exynos5-fimc-is.txt b/Documentation/devicetree/bindings/media/exynos5-fimc-is.txt new file mode 100644 index 000..5e6dee6 --- /dev/null +++ b/Documentation/devicetree/bindings/media/exynos5-fimc-is.txt @@ -0,0 +1,52 @@ +Samsung EXYNOS5 SoC series Imaging Subsystem (FIMC-IS) +-- + +The camera subsystem on Samsung Exynos5 SoC has some changes relative +to previous SoC versions. Exynos5 has almost similar MIPI-CSIS and +FIMC-LITE IPs but has a much improved version of FIMC-IS which can +handle sensor controls and camera post-processing operations. The +Exynos5 FIMC-IS has a dedicated ARM Cortex A5 processor, many +post-processing blocks (ISP, DRC, FD, ODC, DIS, 3DNR) and two +dedicated scalers (SCC and SCP). + +fimc-is node + + +Required properties: + +- compatible: must be samsung,exynos5250-fimc-is +- reg : physical base address and size of the memory mapped + registers +- interrupt-parent : parent interrupt controller +- interrupts: fimc-is interrupt to the parent combiner +- clocks: list of clock specifiers, corresponding to entries in + clock-names property; +- clock-names : must contain isp, mcu_isp, isp_div0, isp_div1, + isp_divmpwm, mcu_isp_div0, mcu_isp_div1 entries, + matching entries in the clocks property. + +pmu subnode +--- + +Required properties: + - reg : should contain PMU physical base address and size of the memory + mapped registers. + +i2c-isp (ISP I2C bus controller) nodes +-- + +Required properties: + +- compatible : should be samsung,exynos4212-i2c-isp for Exynos4212, + Exynos4412 and Exynos5250 SoCs; +- reg : physical base address and length of the registers set; +- clocks : must contain gate clock specifier for this controller; +- clock-names : must contain i2c_isp entry. + +For the i2c-isp node, it is required to specify a pinctrl state named default, +according to the pinctrl bindings defined in ../pinctrl/pinctrl-bindings.txt. + +Device tree nodes of the image sensors' controlled directly by the FIMC-IS +firmware must be child nodes of their corresponding ISP I2C bus controller node. +The data link of these image sensors must be specified using the common video +interfaces bindings, defined in video-interfaces.txt. -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 01/13] [media] exynos5-is: Adding media device driver for exynos5
From: Shaik Ameer Basha shaik.am...@samsung.com This patch adds support for media device for EXYNOS5 SoCs. The current media device supports the following ips to connect through the media controller framework. * MIPI-CSIS Support interconnection(subdev interface) between devices * FIMC-LITE Support capture interface from device(Sensor, MIPI-CSIS) to memory Support interconnection(subdev interface) between devices * FIMC-IS Camera post-processing IP having multiple sub-nodes. G-Scaler will be added later to the current media device. The media device creates two kinds of pipelines for connecting the above mentioned IPs. The pipeline0 is uses Sensor, MIPI-CSIS and FIMC-LITE which captures image data and dumps to memory. Pipeline1 uses FIMC-IS components for doing post-processing operations on the captured image and give scaled YUV output. Pipeline0 ++ +---+ +---+ ++ | Sensor | -- | MIPI-CSIS | -- | FIMC-LITE | -- | Memory | ++ +---+ +---+ ++ Pipeline1 ++ ++ +---+ +---+ | Memory | -- | ISP | -- |SCC| -- |SCP| ++ ++ +---+ +---+ Signed-off-by: Shaik Ameer Basha shaik.am...@samsung.com Signed-off-by: Arun Kumar K arun...@samsung.com --- .../devicetree/bindings/media/exynos5-mdev.txt | 148 +++ drivers/media/platform/exynos5-is/exynos5-mdev.c | 1189 drivers/media/platform/exynos5-is/exynos5-mdev.h | 164 +++ 3 files changed, 1501 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/exynos5-mdev.txt create mode 100644 drivers/media/platform/exynos5-is/exynos5-mdev.c create mode 100644 drivers/media/platform/exynos5-is/exynos5-mdev.h diff --git a/Documentation/devicetree/bindings/media/exynos5-mdev.txt b/Documentation/devicetree/bindings/media/exynos5-mdev.txt new file mode 100644 index 000..8b2ffb9 --- /dev/null +++ b/Documentation/devicetree/bindings/media/exynos5-mdev.txt @@ -0,0 +1,148 @@ +Samsung EXYNOS5 SoC Camera Subsystem + + +The Exynos5 SoC Camera subsystem comprises of multiple sub-devices +represented by separate device tree nodes. Currently this includes: FIMC-LITE, +MIPI CSIS and FIMC-IS. + +The sub-subdevices are defined as child nodes of the common 'camera' node which +also includes common properties of the whole subsystem not really specific to +any single sub-device, like common camera port pins or the CAMCLK clock outputs +for external image sensors attached to an SoC. + +Common 'camera' node + + +Required properties: + +- compatible : must be samsung,exynos5-fimc, simple-bus +- clocks : list of clock specifiers, corresponding to entries in + the clock-names property; +- clock-names : must contain sclk_bayer entry and matching clock property + entry + +The pinctrl bindings defined in ../pinctrl/pinctrl-bindings.txt must be used +to define a required pinctrl state named default and optional pinctrl states: +idle, active-a, active-b. These optional states can be used to switch the +camera port pinmux at runtime. The idle state should configure both the camera +ports A and B into high impedance state, especially the CAMCLK clock output +should be inactive. For the active-a state the camera port A must be activated +and the port B deactivated and for the state active-b it should be the other +way around. + +The 'camera' node must include at least one 'fimc-lite' child node. + +'parallel-ports' node +- + +This node should contain child 'port' nodes specifying active parallel video +input ports. It includes camera A and camera B inputs. 'reg' property in the +port nodes specifies data input - 0, 1 indicates input A, B respectively. + +Image sensor nodes +-- + +The sensor device nodes should be added to their control bus controller (e.g. +I2C0) nodes and linked to a port node in the csis or the parallel-ports node, +using the common video interfaces bindings, defined in video-interfaces.txt. +The implementation of this bindings requires clock-frequency property to be +present in the sensor device nodes. + +Example: + + aliases { + fimc-lite0 = fimc_lite_0 + }; + + /* Parallel bus IF sensor */ + i2c_0: i2c@1386 { + s5k6aa: sensor@3c { + compatible = samsung,s5k6aafx; + reg = 0x3c; + vddio-supply = ...; + + clock-frequency = 2400; + clocks = ...; + clock-names = mclk; + + port { + s5k6aa_ep: endpoint { + remote-endpoint = fimc0_ep; + bus-width = 8; +
[PATCH v4 00/13] Exynos5 IS driver
The patch series add support for Exynos5 camera subsystem. It re-uses mipi-csis and fimc-lite from exynos4-is and adds a new media device and fimc-is device drivers for exynos5. The media device supports asynchronos subdev registration for the fimc-is sensors and is based on the patch series from Sylwester for exynos4-is [1]. [1] http://www.mail-archive.com/linux-media@vger.kernel.org/msg64653.html Changes from v3 --- - Dropped the RFC tag - Addressed all review comments from Sylwester and Sachin - Removed clock provider for media dev - Added s5k4e5 sensor devicetree binding doc Changes from v2 --- - Added exynos5 media device driver from Shaik to this series - Added ISP pipeline support in media device driver - Based on Sylwester's latest exynos4-is development - Asynchronos registration of sensor subdevs - Made independent IS-sensor support - Add s5k4e5 sensor driver - Addressed review comments from Sylwester, Hans, Andrzej, Sachin Changes from v1 --- - Addressed all review comments from Sylwester - Made sensor subdevs as independent i2c devices - Lots of cleanup - Debugfs support added - Removed PMU global register access Arun Kumar K (12): [media] exynos5-fimc-is: Add Exynos5 FIMC-IS device tree bindings documentation [media] exynos5-fimc-is: Add driver core files [media] exynos5-fimc-is: Add common driver header files [media] exynos5-fimc-is: Add register definition and context header [media] exynos5-fimc-is: Add isp subdev [media] exynos5-fimc-is: Add scaler subdev [media] exynos5-fimc-is: Add sensor interface [media] exynos5-fimc-is: Add the hardware pipeline control [media] exynos5-fimc-is: Add the hardware interface module [media] exynos5-is: Add Kconfig and Makefile V4L: s5k6a3: Change sensor min/max resolutions V4L: Add driver for s5k4e5 image sensor Shaik Ameer Basha (1): [media] exynos5-is: Adding media device driver for exynos5 .../devicetree/bindings/media/exynos5-fimc-is.txt | 52 + .../devicetree/bindings/media/exynos5-mdev.txt | 148 ++ .../devicetree/bindings/media/i2c/s5k4e5.txt | 44 + drivers/media/i2c/Kconfig |8 + drivers/media/i2c/Makefile |1 + drivers/media/i2c/s5k4e5.c | 361 + drivers/media/i2c/s5k6a3.c | 21 +- drivers/media/platform/Kconfig |1 + drivers/media/platform/Makefile|1 + drivers/media/platform/exynos5-is/Kconfig | 20 + drivers/media/platform/exynos5-is/Makefile |7 + drivers/media/platform/exynos5-is/exynos5-mdev.c | 1189 ++ drivers/media/platform/exynos5-is/exynos5-mdev.h | 164 ++ drivers/media/platform/exynos5-is/fimc-is-cmd.h| 187 +++ drivers/media/platform/exynos5-is/fimc-is-core.c | 413 + drivers/media/platform/exynos5-is/fimc-is-core.h | 134 ++ drivers/media/platform/exynos5-is/fimc-is-err.h| 257 +++ .../media/platform/exynos5-is/fimc-is-interface.c | 810 ++ .../media/platform/exynos5-is/fimc-is-interface.h | 125 ++ drivers/media/platform/exynos5-is/fimc-is-isp.c| 516 ++ drivers/media/platform/exynos5-is/fimc-is-isp.h| 90 ++ .../media/platform/exynos5-is/fimc-is-metadata.h | 767 + drivers/media/platform/exynos5-is/fimc-is-param.h | 1160 ++ .../media/platform/exynos5-is/fimc-is-pipeline.c | 1691 .../media/platform/exynos5-is/fimc-is-pipeline.h | 127 ++ drivers/media/platform/exynos5-is/fimc-is-regs.h | 105 ++ drivers/media/platform/exynos5-is/fimc-is-scaler.c | 449 ++ drivers/media/platform/exynos5-is/fimc-is-scaler.h | 106 ++ drivers/media/platform/exynos5-is/fimc-is-sensor.c | 45 + drivers/media/platform/exynos5-is/fimc-is-sensor.h | 66 + drivers/media/platform/exynos5-is/fimc-is.h| 160 ++ 31 files changed, 9217 insertions(+), 8 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/exynos5-fimc-is.txt create mode 100644 Documentation/devicetree/bindings/media/exynos5-mdev.txt create mode 100644 Documentation/devicetree/bindings/media/i2c/s5k4e5.txt create mode 100644 drivers/media/i2c/s5k4e5.c create mode 100644 drivers/media/platform/exynos5-is/Kconfig create mode 100644 drivers/media/platform/exynos5-is/Makefile create mode 100644 drivers/media/platform/exynos5-is/exynos5-mdev.c create mode 100644 drivers/media/platform/exynos5-is/exynos5-mdev.h create mode 100644 drivers/media/platform/exynos5-is/fimc-is-cmd.h create mode 100644 drivers/media/platform/exynos5-is/fimc-is-core.c create mode 100644 drivers/media/platform/exynos5-is/fimc-is-core.h create mode 100644 drivers/media/platform/exynos5-is/fimc-is-err.h create mode 100644 drivers/media/platform/exynos5-is/fimc-is-interface.c create mode 100644 drivers/media/platform/exynos5-is/fimc-is-interface.h create mode 100644
[PATCH v4 11/13] [media] exynos5-is: Add Kconfig and Makefile
Adds Kconfig and Makefile for exynos5-is driver files. Signed-off-by: Shaik Ameer Basha shaik.am...@samsung.com Signed-off-by: Kilyeon Im kilyeon...@samsung.com Signed-off-by: Arun Kumar K arun...@samsung.com --- drivers/media/platform/Kconfig |1 + drivers/media/platform/Makefile|1 + drivers/media/platform/exynos5-is/Kconfig | 20 drivers/media/platform/exynos5-is/Makefile |7 +++ 4 files changed, 29 insertions(+) create mode 100644 drivers/media/platform/exynos5-is/Kconfig create mode 100644 drivers/media/platform/exynos5-is/Makefile diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 08de865..4b0475e 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -123,6 +123,7 @@ config VIDEO_S3C_CAMIF source drivers/media/platform/soc_camera/Kconfig source drivers/media/platform/exynos4-is/Kconfig +source drivers/media/platform/exynos5-is/Kconfig source drivers/media/platform/s5p-tv/Kconfig endif # V4L_PLATFORM_DRIVERS diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index eee28dd..40bf09f 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -37,6 +37,7 @@ obj-$(CONFIG_VIDEO_SAMSUNG_S5P_TV)+= s5p-tv/ obj-$(CONFIG_VIDEO_SAMSUNG_S5P_G2D)+= s5p-g2d/ obj-$(CONFIG_VIDEO_SAMSUNG_EXYNOS_GSC) += exynos-gsc/ +obj-$(CONFIG_VIDEO_SAMSUNG_EXYNOS5_CAMERA) += exynos5-is/ obj-$(CONFIG_BLACKFIN) += blackfin/ diff --git a/drivers/media/platform/exynos5-is/Kconfig b/drivers/media/platform/exynos5-is/Kconfig new file mode 100644 index 000..c872757 --- /dev/null +++ b/drivers/media/platform/exynos5-is/Kconfig @@ -0,0 +1,20 @@ +config VIDEO_SAMSUNG_EXYNOS5_CAMERA + bool Samsung Exynos5 Media Device driver + depends on VIDEO_V4L2 VIDEO_V4L2_SUBDEV_API PM_RUNTIME + depends on VIDEO_SAMSUNG_EXYNOS4_IS + help + This is a v4l2 based media controller driver for + Exynos5 SoC. + +if VIDEO_SAMSUNG_EXYNOS5_CAMERA + +config VIDEO_SAMSUNG_EXYNOS5_FIMC_IS + tristate Samsung Exynos5 SoC FIMC-IS driver + depends on I2C OF + depends on VIDEO_EXYNOS4_FIMC_IS + select VIDEOBUF2_DMA_CONTIG + help + This is a V4L2 driver for Samsung Exynos5 SoC series Imaging + Subsystem known as FIMC-IS. + +endif #VIDEO_SAMSUNG_EXYNOS5_MDEV diff --git a/drivers/media/platform/exynos5-is/Makefile b/drivers/media/platform/exynos5-is/Makefile new file mode 100644 index 000..6cdb037 --- /dev/null +++ b/drivers/media/platform/exynos5-is/Makefile @@ -0,0 +1,7 @@ +ccflags-y += -Idrivers/media/platform/exynos4-is +exynos5-fimc-is-objs := fimc-is-core.o fimc-is-isp.o fimc-is-scaler.o +exynos5-fimc-is-objs += fimc-is-pipeline.o fimc-is-interface.o fimc-is-sensor.o +exynos-mdevice-objs := exynos5-mdev.o + +obj-$(CONFIG_VIDEO_SAMSUNG_EXYNOS5_FIMC_IS) += exynos5-fimc-is.o +obj-$(CONFIG_VIDEO_SAMSUNG_EXYNOS5_CAMERA) += exynos-mdevice.o -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 08/13] [media] exynos5-fimc-is: Add sensor interface
Some sensors to be used with fimc-is are exclusively controlled by the fimc-is firmware. This minimal sensor driver provides the required info for the firmware to configure the sensors sitting on I2C bus. Signed-off-by: Arun Kumar K arun...@samsung.com --- drivers/media/platform/exynos5-is/fimc-is-sensor.c | 45 + drivers/media/platform/exynos5-is/fimc-is-sensor.h | 66 2 files changed, 111 insertions(+) create mode 100644 drivers/media/platform/exynos5-is/fimc-is-sensor.c create mode 100644 drivers/media/platform/exynos5-is/fimc-is-sensor.h diff --git a/drivers/media/platform/exynos5-is/fimc-is-sensor.c b/drivers/media/platform/exynos5-is/fimc-is-sensor.c new file mode 100644 index 000..7df2b11 --- /dev/null +++ b/drivers/media/platform/exynos5-is/fimc-is-sensor.c @@ -0,0 +1,45 @@ +/* + * Samsung EXYNOS5250 FIMC-IS (Imaging Subsystem) driver + * + * Copyright (C) 2013 Samsung Electronics Co., Ltd. + * Author: Arun Kumar K arun...@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 fimc-is-sensor.h + +static const struct sensor_drv_data s5k6a3_drvdata = { + .id = FIMC_IS_SENSOR_ID_S5K6A3, + .open_timeout = S5K6A3_OPEN_TIMEOUT, + .setfile_name = setfile_6a3.bin, +}; + +static const struct sensor_drv_data s5k4e5_drvdata = { + .id = FIMC_IS_SENSOR_ID_S5K4E5, + .open_timeout = S5K4E5_OPEN_TIMEOUT, + .setfile_name = setfile_4e5.bin, +}; + +static const struct of_device_id fimc_is_sensor_of_ids[] = { + { + .compatible = samsung,s5k6a3, + .data = s5k6a3_drvdata, + }, + { + .compatible = samsung,s5k4e5, + .data = s5k4e5_drvdata, + }, + { } +}; + +const struct sensor_drv_data *exynos5_is_sensor_get_drvdata( + struct device_node *node) +{ + const struct of_device_id *of_id; + + of_id = of_match_node(fimc_is_sensor_of_ids, node); + return of_id ? of_id-data : NULL; +} diff --git a/drivers/media/platform/exynos5-is/fimc-is-sensor.h b/drivers/media/platform/exynos5-is/fimc-is-sensor.h new file mode 100644 index 000..736ef16 --- /dev/null +++ b/drivers/media/platform/exynos5-is/fimc-is-sensor.h @@ -0,0 +1,66 @@ +/* + * Samsung EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver + * + * Copyright (C) 2013 Samsung Electronics Co., Ltd. + * + * Author: Arun Kumar K arun...@samsung.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#ifndef FIMC_IS_SENSOR_H_ +#define FIMC_IS_SENSOR_H_ + +#include linux/of.h +#include linux/types.h + +#define S5K6A3_OPEN_TIMEOUT2000 /* ms */ +#define S5K6A3_SENSOR_WIDTH1392 +#define S5K6A3_SENSOR_HEIGHT 1392 + +#define S5K4E5_OPEN_TIMEOUT2000 /* ms */ +#define S5K4E5_SENSOR_WIDTH2560 +#define S5K4E5_SENSOR_HEIGHT 1920 + +#define SENSOR_WIDTH_PADDING 16 +#define SENSOR_HEIGHT_PADDING 10 + +enum fimc_is_sensor_id { + FIMC_IS_SENSOR_ID_S5K3H2 = 1, + FIMC_IS_SENSOR_ID_S5K6A3, + FIMC_IS_SENSOR_ID_S5K4E5, + FIMC_IS_SENSOR_ID_S5K3H7, + FIMC_IS_SENSOR_ID_CUSTOM, + FIMC_IS_SENSOR_ID_END +}; + +struct sensor_drv_data { + enum fimc_is_sensor_id id; + /* sensor open timeout in ms */ + unsigned short open_timeout; + char *setfile_name; +}; + +/** + * struct fimc_is_sensor - fimc-is sensor data structure + * @drvdata: a pointer to the sensor's parameters data structure + * @i2c_bus: ISP I2C bus index (0...1) + * @width: sensor active width + * @height: sensor active height + * @pixel_width: sensor effective pixel width (width + padding) + * @pixel_height: sensor effective pixel height (height + padding) + */ +struct fimc_is_sensor { + const struct sensor_drv_data *drvdata; + unsigned int i2c_bus; + unsigned int width; + unsigned int height; + unsigned int pixel_width; + unsigned int pixel_height; +}; + +const struct sensor_drv_data *exynos5_is_sensor_get_drvdata( + struct device_node *node); + +#endif /* FIMC_IS_SENSOR_H_ */ -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 06/13] [media] exynos5-fimc-is: Add isp subdev
fimc-is driver takes video data input from the ISP video node which is added in this patch. This node accepts Bayer input buffers which is given from the IS sensors. Signed-off-by: Arun Kumar K arun...@samsung.com Signed-off-by: Kilyeon Im kilyeon...@samsung.com --- drivers/media/platform/exynos5-is/fimc-is-isp.c | 516 +++ drivers/media/platform/exynos5-is/fimc-is-isp.h | 90 2 files changed, 606 insertions(+) create mode 100644 drivers/media/platform/exynos5-is/fimc-is-isp.c create mode 100644 drivers/media/platform/exynos5-is/fimc-is-isp.h diff --git a/drivers/media/platform/exynos5-is/fimc-is-isp.c b/drivers/media/platform/exynos5-is/fimc-is-isp.c new file mode 100644 index 000..afbf4a2 --- /dev/null +++ b/drivers/media/platform/exynos5-is/fimc-is-isp.c @@ -0,0 +1,516 @@ +/* + * Samsung EXYNOS5250 FIMC-IS (Imaging Subsystem) driver + * + * Copyright (C) 2013 Samsung Electronics Co., Ltd. + * Arun Kumar K arun...@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 media/v4l2-ioctl.h +#include media/videobuf2-dma-contig.h + +#include fimc-is.h + +#define ISP_DRV_NAME fimc-is-isp + +static const struct fimc_is_fmt formats[] = { + { + .name = Bayer GR-BG 8bits, + .fourcc = V4L2_PIX_FMT_SGRBG8, + .depth = { 8 }, + .num_planes = 1, + }, + { + .name = Bayer GR-BG 10bits, + .fourcc = V4L2_PIX_FMT_SGRBG10, + .depth = { 16 }, + .num_planes = 1, + }, + { + .name = Bayer GR-BG 12bits, + .fourcc = V4L2_PIX_FMT_SGRBG12, + .depth = { 16 }, + .num_planes = 1, + }, +}; +#define NUM_FORMATS ARRAY_SIZE(formats) + +static const struct fimc_is_fmt *find_format(struct v4l2_format *f) +{ + unsigned int i; + + for (i = 0; i NUM_FORMATS; i++) + if (formats[i].fourcc == f-fmt.pix_mp.pixelformat) + return formats[i]; + return NULL; +} + +static int isp_video_output_start_streaming(struct vb2_queue *vq, + unsigned int count) +{ + struct fimc_is_isp *isp = vb2_get_drv_priv(vq); + + set_bit(STATE_RUNNING, isp-output_state); + return 0; +} + +static int isp_video_output_stop_streaming(struct vb2_queue *vq) +{ + struct fimc_is_isp *isp = vb2_get_drv_priv(vq); + struct fimc_is_buf *buf; + + /* Release un-used buffers */ + while (!list_empty(isp-wait_queue)) { + buf = fimc_is_isp_wait_queue_get(isp); + vb2_buffer_done(buf-vb, VB2_BUF_STATE_ERROR); + } + while (!list_empty(isp-run_queue)) { + buf = fimc_is_isp_run_queue_get(isp); + vb2_buffer_done(buf-vb, VB2_BUF_STATE_ERROR); + } + + clear_bit(STATE_RUNNING, isp-output_state); + return 0; +} + +static int isp_video_output_queue_setup(struct vb2_queue *vq, + const struct v4l2_format *pfmt, + unsigned int *num_buffers, unsigned int *num_planes, + unsigned int sizes[], void *allocators[]) +{ + struct fimc_is_isp *isp = vb2_get_drv_priv(vq); + const struct fimc_is_fmt *fmt = isp-fmt; + unsigned int wh, i; + + if (!fmt) + return -EINVAL; + + *num_planes = fmt-num_planes; + wh = isp-width * isp-height; + + for (i = 0; i *num_planes; i++) { + allocators[i] = isp-alloc_ctx; + sizes[i] = (wh * fmt-depth[i]) / 8; + } + return 0; +} + +static int isp_video_output_buffer_init(struct vb2_buffer *vb) +{ + struct fimc_is_buf *buf = container_of(vb, struct fimc_is_buf, vb); + + buf-paddr[0] = vb2_dma_contig_plane_dma_addr(vb, 0); + return 0; +} + +static void isp_video_output_buffer_queue(struct vb2_buffer *vb) +{ + struct vb2_queue *vq = vb-vb2_queue; + struct fimc_is_isp *isp = vb2_get_drv_priv(vq); + struct fimc_is_buf *buf = container_of(vb, struct fimc_is_buf, vb); + + fimc_is_pipeline_buf_lock(isp-pipeline); + fimc_is_isp_wait_queue_add(isp, buf); + fimc_is_pipeline_buf_unlock(isp-pipeline); + + /* Call shot command */ + fimc_is_pipeline_shot(isp-pipeline); +} + +static const struct vb2_ops isp_video_output_qops = { + .queue_setup = isp_video_output_queue_setup, + .buf_init= isp_video_output_buffer_init, + .buf_queue = isp_video_output_buffer_queue, + .wait_prepare= vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, + .start_streaming = isp_video_output_start_streaming, +
[PATCH v4 09/13] [media] exynos5-fimc-is: Add the hardware pipeline control
This patch adds the crucial hardware pipeline control for the fimc-is driver. All the subdev nodes will call this pipeline interfaces to reach the hardware. Responsibilities of this module involves configuring and maintaining the hardware pipeline involving multiple sub-ips like ISP, DRC, Scalers, ODC, 3DNR, FD etc. Signed-off-by: Arun Kumar K arun...@samsung.com Signed-off-by: Kilyeon Im kilyeon...@samsung.com --- .../media/platform/exynos5-is/fimc-is-pipeline.c | 1691 .../media/platform/exynos5-is/fimc-is-pipeline.h | 127 ++ 2 files changed, 1818 insertions(+) create mode 100644 drivers/media/platform/exynos5-is/fimc-is-pipeline.c create mode 100644 drivers/media/platform/exynos5-is/fimc-is-pipeline.h diff --git a/drivers/media/platform/exynos5-is/fimc-is-pipeline.c b/drivers/media/platform/exynos5-is/fimc-is-pipeline.c new file mode 100644 index 000..e37ce56 --- /dev/null +++ b/drivers/media/platform/exynos5-is/fimc-is-pipeline.c @@ -0,0 +1,1691 @@ +/* + * Samsung EXYNOS5 FIMC-IS (Imaging Subsystem) driver +* + * Copyright (C) 2013 Samsung Electronics Co., Ltd. + * Arun Kumar K arun...@samsung.com + * Kil-yeon Lim kilyeon...@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 fimc-is.h +#include fimc-is-pipeline.h +#include fimc-is-metadata.h +#include fimc-is-regs.h +#include fimc-is-cmd.h +#include media/videobuf2-dma-contig.h +#include linux/delay.h + +/* Default setting values */ +#define DEFAULT_PREVIEW_STILL_WIDTH1280 +#define DEFAULT_PREVIEW_STILL_HEIGHT 720 +#define DEFAULT_CAPTURE_VIDEO_WIDTH1920 +#define DEFAULT_CAPTURE_VIDEO_HEIGHT 1080 +#define DEFAULT_CAPTURE_STILL_WIDTH2560 +#define DEFAULT_CAPTURE_STILL_HEIGHT 1920 +#define DEFAULT_CAPTURE_STILL_CROP_WIDTH 2560 +#define DEFAULT_CAPTURE_STILL_CROP_HEIGHT 1440 +#define DEFAULT_PREVIEW_VIDEO_WIDTH640 +#define DEFAULT_PREVIEW_VIDEO_HEIGHT 480 + +/* Init params for pipeline devices */ +static const struct sensor_param init_sensor_param = { + .frame_rate = { + .frame_rate = 30, + }, +}; + +static const struct isp_param init_isp_param = { + .control = { + .cmd = CONTROL_COMMAND_START, + .bypass = CONTROL_BYPASS_DISABLE, + }, + .otf_input = { + .cmd = OTF_INPUT_COMMAND_DISABLE, + .width = DEFAULT_CAPTURE_STILL_WIDTH, + .height = DEFAULT_CAPTURE_STILL_HEIGHT, + .format = OTF_INPUT_FORMAT_BAYER, + .bitwidth = OTF_INPUT_BIT_WIDTH_10BIT, + .order = OTF_INPUT_ORDER_BAYER_GR_BG, + .frametime_max = 3, + }, + .dma1_input = { + .cmd = DMA_INPUT_COMMAND_DISABLE, + }, + .dma2_input = { + .cmd = DMA_INPUT_COMMAND_DISABLE, + }, + .aa = { + .cmd = ISP_AA_COMMAND_START, + .target = ISP_AA_TARGET_AF | ISP_AA_TARGET_AE | + ISP_AA_TARGET_AWB, + .mode = ISP_AF_CONTINUOUS, + }, + .flash = { + .cmd = ISP_FLASH_COMMAND_DISABLE, + .redeye = ISP_FLASH_REDEYE_DISABLE, + }, + .awb = { + .cmd = ISP_AWB_COMMAND_AUTO, + }, + .effect = { + .cmd = ISP_IMAGE_EFFECT_DISABLE, + }, + .iso = { + .cmd = ISP_ISO_COMMAND_AUTO, + }, + .adjust = { + .cmd = ISP_ADJUST_COMMAND_AUTO, + }, + .metering = { + .cmd = ISP_METERING_COMMAND_CENTER, + .win_width = DEFAULT_CAPTURE_STILL_WIDTH, + .win_height = DEFAULT_CAPTURE_STILL_HEIGHT, + }, + .afc = { + .cmd = ISP_AFC_COMMAND_AUTO, + }, + .otf_output = { + .cmd = OTF_OUTPUT_COMMAND_ENABLE, + .width = DEFAULT_CAPTURE_STILL_WIDTH, + .height = DEFAULT_CAPTURE_STILL_HEIGHT, + .format = OTF_OUTPUT_FORMAT_YUV444, + .bitwidth = OTF_OUTPUT_BIT_WIDTH_12BIT, + .order = OTF_OUTPUT_ORDER_BAYER_GR_BG, + }, + .dma1_output = { + .cmd = DMA_OUTPUT_COMMAND_DISABLE, + .width = DEFAULT_CAPTURE_STILL_WIDTH, + .height = DEFAULT_CAPTURE_STILL_HEIGHT, + .format = DMA_INPUT_FORMAT_YUV444, + .bitwidth = DMA_INPUT_BIT_WIDTH_8BIT, + .plane = 1, + .order = DMA_INPUT_ORDER_YCBCR, + }, + .dma2_output = { + .cmd = DMA_OUTPUT_COMMAND_DISABLE, + .width = DEFAULT_CAPTURE_STILL_WIDTH, + .height = DEFAULT_CAPTURE_STILL_HEIGHT, + .format = DMA_OUTPUT_FORMAT_BAYER, +
[PATCH v4 03/13] [media] exynos5-fimc-is: Add driver core files
This driver is for the FIMC-IS IP available in Samsung Exynos5 SoC onwards. This patch adds the core files for the new driver. Signed-off-by: Arun Kumar K arun...@samsung.com Signed-off-by: Kilyeon Im kilyeon...@samsung.com --- drivers/media/platform/exynos5-is/fimc-is-core.c | 413 ++ drivers/media/platform/exynos5-is/fimc-is-core.h | 134 +++ 2 files changed, 547 insertions(+) create mode 100644 drivers/media/platform/exynos5-is/fimc-is-core.c create mode 100644 drivers/media/platform/exynos5-is/fimc-is-core.h diff --git a/drivers/media/platform/exynos5-is/fimc-is-core.c b/drivers/media/platform/exynos5-is/fimc-is-core.c new file mode 100644 index 000..067dea6 --- /dev/null +++ b/drivers/media/platform/exynos5-is/fimc-is-core.c @@ -0,0 +1,413 @@ +/* + * Samsung EXYNOS5 FIMC-IS (Imaging Subsystem) driver +* + * Copyright (C) 2013 Samsung Electronics Co., Ltd. + * Arun Kumar K arun...@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 linux/bug.h +#include linux/ctype.h +#include linux/device.h +#include linux/debugfs.h +#include linux/delay.h +#include linux/errno.h +#include linux/err.h +#include linux/firmware.h +#include linux/fs.h +#include linux/gpio.h +#include linux/interrupt.h +#include linux/kernel.h +#include linux/list.h +#include linux/module.h +#include linux/types.h +#include linux/platform_device.h +#include linux/pm_runtime.h +#include linux/slab.h +#include linux/videodev2.h +#include linux/of.h +#include linux/of_gpio.h +#include linux/of_address.h +#include linux/of_platform.h +#include linux/of_irq.h +#include linux/pinctrl/consumer.h + +#include media/v4l2-device.h +#include media/v4l2-ioctl.h +#include media/v4l2-mem2mem.h +#include media/v4l2-of.h +#include media/videobuf2-core.h +#include media/videobuf2-dma-contig.h + +#include fimc-is.h +#include fimc-is-i2c.h + +#define CLK_MCU_ISP_DIV0_FREQ (200 * 100) +#define CLK_MCU_ISP_DIV1_FREQ (100 * 100) +#define CLK_ISP_DIV0_FREQ (134 * 100) +#define CLK_ISP_DIV1_FREQ (68 * 100) +#define CLK_ISP_DIVMPWM_FREQ (34 * 100) + +static char *fimc_is_clock_name[] = { + [IS_CLK_ISP]= isp, + [IS_CLK_MCU_ISP]= mcu_isp, + [IS_CLK_ISP_DIV0] = isp_div0, + [IS_CLK_ISP_DIV1] = isp_div1, + [IS_CLK_ISP_DIVMPWM]= isp_divmpwm, + [IS_CLK_MCU_ISP_DIV0] = mcu_isp_div0, + [IS_CLK_MCU_ISP_DIV1] = mcu_isp_div1, +}; + +static void fimc_is_put_clocks(struct fimc_is *is) +{ + int i; + + for (i = 0; i IS_CLK_MAX_NUM; i++) { + if (IS_ERR(is-clock[i])) + continue; + clk_unprepare(is-clock[i]); + clk_put(is-clock[i]); + is-clock[i] = NULL; + } +} + +static int fimc_is_get_clocks(struct fimc_is *is) +{ + struct device *dev = is-pdev-dev; + int i, ret; + + for (i = 0; i IS_CLK_MAX_NUM; i++) { + is-clock[i] = clk_get(dev, fimc_is_clock_name[i]); + if (IS_ERR(is-clock[i])) + goto err; + ret = clk_prepare(is-clock[i]); + if (ret 0) { + clk_put(is-clock[i]); + is-clock[i] = ERR_PTR(-EINVAL); + goto err; + } + } + return 0; +err: + fimc_is_put_clocks(is); + pr_err(Failed to get clock: %s\n, fimc_is_clock_name[i]); + return -ENXIO; +} + +static int fimc_is_configure_clocks(struct fimc_is *is) +{ + int i, ret; + + for (i = 0; i IS_CLK_MAX_NUM; i++) + is-clock[i] = ERR_PTR(-EINVAL); + + ret = fimc_is_get_clocks(is); + if (ret) + return ret; + + /* Set rates */ + ret = clk_set_rate(is-clock[IS_CLK_MCU_ISP_DIV0], + CLK_MCU_ISP_DIV0_FREQ); + if (ret) + return ret; + ret = clk_set_rate(is-clock[IS_CLK_MCU_ISP_DIV1], + CLK_MCU_ISP_DIV1_FREQ); + if (ret) + return ret; + ret = clk_set_rate(is-clock[IS_CLK_ISP_DIV0], CLK_ISP_DIV0_FREQ); + if (ret) + return ret; + ret = clk_set_rate(is-clock[IS_CLK_ISP_DIV1], CLK_ISP_DIV1_FREQ); + if (ret) + return ret; + ret = clk_set_rate(is-clock[IS_CLK_ISP_DIVMPWM], + CLK_ISP_DIVMPWM_FREQ); + return ret; +} + +static void fimc_is_pipelines_destroy(struct fimc_is *is) +{ + int i; + + for (i = 0; i is-drvdata-num_instance; i++) + fimc_is_pipeline_destroy(is-pipeline[i]); +} + +static int fimc_is_parse_sensor_config(struct fimc_is *is, unsigned int index, + struct device_node *node) +{ + struct fimc_is_sensor *sensor =
[PATCH v4 12/13] V4L: s5k6a3: Change sensor min/max resolutions
s5k6a3 sensor has actual pixel resolution of 1408x1402 against the active resolution 1392x1392. The real resolution is needed when raw sensor SRGB data is dumped to memory by fimc-lite. Signed-off-by: Arun Kumar K arun...@samsung.com --- drivers/media/i2c/s5k6a3.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/s5k6a3.c b/drivers/media/i2c/s5k6a3.c index ccbb4fc..6dec2ec 100644 --- a/drivers/media/i2c/s5k6a3.c +++ b/drivers/media/i2c/s5k6a3.c @@ -25,10 +25,14 @@ #include media/v4l2-async.h #include media/v4l2-subdev.h -#define S5K6A3_SENSOR_MAX_WIDTH1392 -#define S5K6A3_SENSOR_MAX_HEIGHT 1392 -#define S5K6A3_SENSOR_MIN_WIDTH32 -#define S5K6A3_SENSOR_MIN_HEIGHT 32 +#define S5K6A3_SENSOR_MAX_WIDTH1408 +#define S5K6A3_SENSOR_MAX_HEIGHT 1408 + +#define S5K6A3_SENSOR_ACTIVE_WIDTH 1392 +#define S5K6A3_SENSOR_ACTIVE_HEIGHT1392 + +#define S5K6A3_SENSOR_MIN_WIDTH(32 + 16) +#define S5K6A3_SENSOR_MIN_HEIGHT (32 + 10) #define S5K6A3_DEF_PIX_WIDTH 1296 #define S5K6A3_DEF_PIX_HEIGHT 732 @@ -107,10 +111,11 @@ static void s5k6a3_try_format(struct v4l2_mbus_framefmt *mf) fmt = find_sensor_format(mf); mf-code = fmt-code; - v4l_bound_align_image(mf-width, S5K6A3_SENSOR_MIN_WIDTH, - S5K6A3_SENSOR_MAX_WIDTH, 0, - mf-height, S5K6A3_SENSOR_MIN_HEIGHT, - S5K6A3_SENSOR_MAX_HEIGHT, 0, 0); + v4l_bound_align_image(mf-width, + S5K6A3_SENSOR_MIN_WIDTH, S5K6A3_SENSOR_MAX_WIDTH, 0, + mf-height, + S5K6A3_SENSOR_MIN_HEIGHT, S5K6A3_SENSOR_MAX_HEIGHT, 0, + 0); } static struct v4l2_mbus_framefmt *__s5k6a3_get_format( -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 05/13] [media] exynos5-fimc-is: Add register definition and context header
This patch adds the register definition file for the fimc-is driver and also the header file containing the main context for the driver. Signed-off-by: Arun Kumar K arun...@samsung.com Signed-off-by: Kilyeon Im kilyeon...@samsung.com --- drivers/media/platform/exynos5-is/fimc-is-regs.h | 105 ++ drivers/media/platform/exynos5-is/fimc-is.h | 160 ++ 2 files changed, 265 insertions(+) create mode 100644 drivers/media/platform/exynos5-is/fimc-is-regs.h create mode 100644 drivers/media/platform/exynos5-is/fimc-is.h diff --git a/drivers/media/platform/exynos5-is/fimc-is-regs.h b/drivers/media/platform/exynos5-is/fimc-is-regs.h new file mode 100644 index 000..06aa466 --- /dev/null +++ b/drivers/media/platform/exynos5-is/fimc-is-regs.h @@ -0,0 +1,105 @@ +/* + * Samsung Exynos5 SoC series FIMC-IS driver + * + * Copyright (c) 2013 Samsung Electronics Co., Ltd + * Arun Kumar K arun...@samsung.com + * Kil-yeon Lim kilyeon...@samsung.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef FIMC_IS_REGS_H +#define FIMC_IS_REGS_H + +/* WDT_ISP register */ +#define WDT0x0017 +/* MCUCTL register */ +#define MCUCTL 0x0018 +/* MCU Controller Register */ +#define MCUCTLR(MCUCTL+0x00) +#define MCUCTLR_AXI_ISPX_AWCACHE(x)((x) 16) +#define MCUCTLR_AXI_ISPX_ARCACHE(x)((x) 12) +#define MCUCTLR_MSWRST (1 0) +/* Boot Base OFfset Address Register */ +#define BBOAR (MCUCTL+0x04) +#define BBOAR_BBOA(x) ((x) 0) + +/* Interrupt Generation Register 0 from Host CPU to VIC */ +#define INTGR0 (MCUCTL+0x08) +#define INTGR0_INTGC(n)(1 ((n) + 16)) +#define INTGR0_INTGD(n)(1 (n)) + +/* Interrupt Clear Register 0 from Host CPU to VIC */ +#define INTCR0 (MCUCTL+0x0c) +#define INTCR0_INTCC(n)(1 ((n) + 16)) +#define INTCR0_INTCD(n)(1 (n)) + +/* Interrupt Mask Register 0 from Host CPU to VIC */ +#define INTMR0 (MCUCTL+0x10) +#define INTMR0_INTMC(n)(1 ((n) + 16)) +#define INTMR0_INTMD(n)(1 (n)) + +/* Interrupt Status Register 0 from Host CPU to VIC */ +#define INTSR0 (MCUCTL+0x14) +#define INTSR0_GET_INTSD(n, x) (((x) (n)) 0x1) +#define INTSR0_GET_INTSC(n, x) (((x) ((n) + 16)) 0x1) + +/* Interrupt Mask Status Register 0 from Host CPU to VIC */ +#define INTMSR0(MCUCTL+0x18) +#define INTMSR0_GET_INTMSD(n, x) (((x) (n)) 0x1) +#define INTMSR0_GET_INTMSC(n, x) (((x) ((n) + 16)) 0x1) + +/* Interrupt Generation Register 1 from ISP CPU to Host IC */ +#define INTGR1 (MCUCTL+0x1c) +#define INTGR1_INTGC(n)(1 (n)) + +/* Interrupt Clear Register 1 from ISP CPU to Host IC */ +#define INTCR1 (MCUCTL+0x20) +#define INTCR1_INTCC(n)(1 (n)) + +/* Interrupt Mask Register 1 from ISP CPU to Host IC */ +#define INTMR1 (MCUCTL+0x24) +#define INTMR1_INTMC(n)(1 (n)) + +/* Interrupt Status Register 1 from ISP CPU to Host IC */ +#define INTSR1 (MCUCTL+0x28) +/* Interrupt Mask Status Register 1 from ISP CPU to Host IC */ +#define INTMSR1(MCUCTL+0x2c) +/* Interrupt Clear Register 2 from ISP BLK's interrupts to Host IC */ +#define INTCR2 (MCUCTL+0x30) +#define INTCR2_INTCC(n)(1 (n)) + +/* Interrupt Mask Register 2 from ISP BLK's interrupts to Host IC */ +#define INTMR2 (MCUCTL+0x34) +#define INTMR2_INTMCIS(n) (1 (n)) + +/* Interrupt Status Register 2 from ISP BLK's interrupts to Host IC */ +#define INTSR2 (MCUCTL+0x38) +/* Interrupt Mask Status Register 2 from ISP BLK's interrupts to Host IC */ +#define INTMSR2(MCUCTL+0x3c) +/* General Purpose Output Control Register (0~17) */ +#define GPOCTLR(MCUCTL+0x40) +#define GPOCTLR_GPOG(n, x) ((x) (n)) + +/* General Purpose Pad Output Enable Register (0~17) */ +#define GPOENCTLR (MCUCTL+0x44) +#define GPOENCTLR_GPOEN0(n, x) ((x) (n)) + +/* General Purpose Input Control Register (0~17) */ +#define GPICTLR(MCUCTL+0x48) + +/* IS Shared Registers between ISP CPU and HOST CPU */ +#define ISSR(n)(MCUCTL + 0x80 + (n)) + +/* PMU for FIMC-IS*/ +#define PMUREG_CMU_RESET_ISP_SYS_PWR_REG 0x1584 +#define
[PATCH v4 07/13] [media] exynos5-fimc-is: Add scaler subdev
FIMC-IS has two hardware scalers named as scaler-codec and scaler-preview. This patch adds the common code handling the video nodes and subdevs of both the scalers. Signed-off-by: Arun Kumar K arun...@samsung.com Signed-off-by: Kilyeon Im kilyeon...@samsung.com --- drivers/media/platform/exynos5-is/fimc-is-scaler.c | 449 drivers/media/platform/exynos5-is/fimc-is-scaler.h | 106 + 2 files changed, 555 insertions(+) create mode 100644 drivers/media/platform/exynos5-is/fimc-is-scaler.c create mode 100644 drivers/media/platform/exynos5-is/fimc-is-scaler.h diff --git a/drivers/media/platform/exynos5-is/fimc-is-scaler.c b/drivers/media/platform/exynos5-is/fimc-is-scaler.c new file mode 100644 index 000..c9bd07b --- /dev/null +++ b/drivers/media/platform/exynos5-is/fimc-is-scaler.c @@ -0,0 +1,449 @@ +/* + * Samsung EXYNOS5250 FIMC-IS (Imaging Subsystem) driver + * + * Copyright (C) 2013 Samsung Electronics Co., Ltd. + * Arun Kumar K arun...@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 media/v4l2-ioctl.h +#include media/videobuf2-dma-contig.h + +#include fimc-is.h + +#define IS_SCALER_DRV_NAME fimc-is-scaler + +static const struct fimc_is_fmt formats[] = { + { + .name = YUV 4:2:0 3p MultiPlanar, + .fourcc = V4L2_PIX_FMT_YUV420M, + .depth = {8, 2, 2}, + .num_planes = 3, + }, + { + .name = YUV 4:2:0 2p MultiPlanar, + .fourcc = V4L2_PIX_FMT_NV12M, + .depth = {8, 4}, + .num_planes = 2, + }, + { + .name = YUV 4:2:2 1p MultiPlanar, + .fourcc = V4L2_PIX_FMT_NV16, + .depth = {16}, + .num_planes = 1, + }, +}; +#define NUM_FORMATS ARRAY_SIZE(formats) + +static const struct fimc_is_fmt *find_format(struct v4l2_format *f) +{ + unsigned int i; + + for (i = 0; i NUM_FORMATS; i++) { + if (formats[i].fourcc == f-fmt.pix_mp.pixelformat) + return formats[i]; + } + return NULL; +} + +static int scaler_video_capture_start_streaming(struct vb2_queue *vq, + unsigned int count) +{ + struct fimc_is_scaler *ctx = vb2_get_drv_priv(vq); + int ret; + + ret = fimc_is_pipeline_scaler_start(ctx-pipeline, + ctx-scaler_id, + vq-num_buffers, + ctx-fmt-num_planes); + if (ret) { + v4l2_err(ctx-subdev, Scaler start failed.\n); + return -EINVAL; + } + + set_bit(STATE_RUNNING, ctx-capture_state); + return 0; +} + +static int scaler_video_capture_stop_streaming(struct vb2_queue *vq) +{ + struct fimc_is_scaler *ctx = vb2_get_drv_priv(vq); + struct fimc_is_buf *buf; + int ret; + + ret = fimc_is_pipeline_scaler_stop(ctx-pipeline, ctx-scaler_id); + if (ret) + v4l2_info(ctx-subdev, Scaler already stopped.\n); + + /* Release un-used buffers */ + while (!list_empty(ctx-wait_queue)) { + buf = fimc_is_scaler_wait_queue_get(ctx); + vb2_buffer_done(buf-vb, VB2_BUF_STATE_ERROR); + } + while (!list_empty(ctx-run_queue)) { + buf = fimc_is_scaler_run_queue_get(ctx); + vb2_buffer_done(buf-vb, VB2_BUF_STATE_ERROR); + } + + clear_bit(STATE_RUNNING, ctx-capture_state); + return 0; +} + +static int scaler_video_capture_queue_setup(struct vb2_queue *vq, + const struct v4l2_format *pfmt, + unsigned int *num_buffers, unsigned int *num_planes, + unsigned int sizes[], void *allocators[]) +{ + struct fimc_is_scaler *ctx = vb2_get_drv_priv(vq); + const struct fimc_is_fmt *fmt = ctx-fmt; + unsigned int wh; + int i; + + if (!fmt) + return -EINVAL; + + *num_planes = fmt-num_planes; + wh = ctx-width * ctx-height; + + for (i = 0; i *num_planes; i++) { + allocators[i] = ctx-alloc_ctx; + sizes[i] = (wh * fmt-depth[i]) / 8; + } + return 0; +} + +static int scaler_video_capture_buffer_init(struct vb2_buffer *vb) +{ + struct vb2_queue *vq = vb-vb2_queue; + struct fimc_is_scaler *ctx = vb2_get_drv_priv(vq); + struct fimc_is_buf *buf = container_of(vb, struct fimc_is_buf, vb); + const struct fimc_is_fmt *fmt; + int i; + + fmt = ctx-fmt; + for (i = 0; i fmt-num_planes; i++) + buf-paddr[i] = vb2_dma_contig_plane_dma_addr(vb, i); + + return 0; +} + +static void
[PATCH v4 10/13] [media] exynos5-fimc-is: Add the hardware interface module
The hardware interface module finally sends the commands to the FIMC-IS firmware and runs the interrupt handler for getting the responses. Signed-off-by: Arun Kumar K arun...@samsung.com Signed-off-by: Kilyeon Im kilyeon...@samsung.com --- .../media/platform/exynos5-is/fimc-is-interface.c | 810 .../media/platform/exynos5-is/fimc-is-interface.h | 125 +++ 2 files changed, 935 insertions(+) create mode 100644 drivers/media/platform/exynos5-is/fimc-is-interface.c create mode 100644 drivers/media/platform/exynos5-is/fimc-is-interface.h diff --git a/drivers/media/platform/exynos5-is/fimc-is-interface.c b/drivers/media/platform/exynos5-is/fimc-is-interface.c new file mode 100644 index 000..9fcf89d --- /dev/null +++ b/drivers/media/platform/exynos5-is/fimc-is-interface.c @@ -0,0 +1,810 @@ +/* + * Samsung EXYNOS5 FIMC-IS (Imaging Subsystem) driver +* + * Copyright (C) 2013 Samsung Electronics Co., Ltd. + * Kil-yeon Lim kilyeon...@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 linux/debugfs.h +#include linux/seq_file.h +#include fimc-is.h +#include fimc-is-cmd.h +#include fimc-is-regs.h + +#define init_request_barrier(itf) mutex_init(itf-request_barrier) +#define enter_request_barrier(itf) mutex_lock(itf-request_barrier) +#define exit_request_barrier(itf) mutex_unlock(itf-request_barrier) + +static inline void itf_get_cmd(struct fimc_is_interface *itf, + struct fimc_is_msg *msg, unsigned int index) +{ + struct is_common_reg __iomem *com_regs = itf-com_regs; + + memset(msg, 0, sizeof(*msg)); + + switch (index) { + case INTR_GENERAL: + msg-command = com_regs-ihcmd; + msg-instance = com_regs-ihc_sensorid; + memcpy(msg-param, com_regs-ihc_param, + 4 * sizeof(msg-param[0])); + break; + case INTR_SCC_FDONE: + msg-command = IHC_FRAME_DONE; + msg-instance = com_regs-scc_sensor_id; + memcpy(msg-param, com_regs-scc_param, + 3 * sizeof(msg-param[0])); + break; + case INTR_SCP_FDONE: + msg-command = IHC_FRAME_DONE; + msg-instance = com_regs-scp_sensor_id; + memcpy(msg-param, com_regs-scp_param, + 3 * sizeof(msg-param[0])); + break; + case INTR_META_DONE: + msg-command = IHC_FRAME_DONE; + msg-instance = com_regs-meta_sensor_id; + msg-param[0] = com_regs-meta_param1; + break; + case INTR_SHOT_DONE: + msg-command = IHC_FRAME_DONE; + msg-instance = com_regs-shot_sensor_id; + memcpy(msg-param, com_regs-shot_param, + 2 * sizeof(msg-param[0])); + break; + default: + dev_err(itf-dev, %s Unknown command\n, __func__); + break; + } +} + +static inline unsigned int itf_get_intr(struct fimc_is_interface *itf) +{ + unsigned int status; + struct is_common_reg __iomem *com_regs = itf-com_regs; + + status = readl(itf-regs + INTMSR1) | com_regs-ihcmd_iflag | + com_regs-scc_iflag | + com_regs-scp_iflag | + com_regs-meta_iflag | + com_regs-shot_iflag; + + return status; +} + +static void itf_set_state(struct fimc_is_interface *itf, + unsigned long state) +{ + unsigned long flags; + spin_lock_irqsave(itf-slock_state, flags); + __set_bit(state, itf-state); + spin_unlock_irqrestore(itf-slock_state, flags); +} + +static void itf_clr_state(struct fimc_is_interface *itf, + unsigned long state) +{ + unsigned long flags; + spin_lock_irqsave(itf-slock_state, flags); + __clear_bit(state, itf-state); + spin_unlock_irqrestore(itf-slock_state, flags); +} + +static int itf_get_state(struct fimc_is_interface *itf, + unsigned long state) +{ + int ret = 0; + unsigned long flags; + + spin_lock_irqsave(itf-slock_state, flags); + ret = test_bit(state, itf-state); + spin_unlock_irqrestore(itf-slock_state, flags); + return ret; +} + +static void itf_init_wakeup(struct fimc_is_interface *itf) +{ + itf_set_state(itf, IS_IF_STATE_INIT); + wake_up(itf-irq_queue); +} + +void itf_busy_wakeup(struct fimc_is_interface *itf) +{ + itf_clr_state(itf, IS_IF_STATE_BUSY); + wake_up(itf-irq_queue); +} + +static int itf_wait_hw_ready(struct fimc_is_interface *itf) +{ + int t; + for (t = TRY_RECV_AWARE_COUNT; t = 0; t--) { + unsigned int cfg = readl(itf-regs + INTMSR0); + if (INTMSR0_GET_INTMSD(0, cfg) == 0) +
[PATCH v4 13/13] V4L: Add driver for s5k4e5 image sensor
This patch adds subdev driver for Samsung S5K4E5 raw image sensor. Like s5k6a3, it is also another fimc-is firmware controlled sensor. This minimal sensor driver doesn't do any I2C communications as its done by ISP firmware. It can be updated if needed to a regular sensor driver by adding the I2C communication. Signed-off-by: Arun Kumar K arun...@samsung.com --- .../devicetree/bindings/media/i2c/s5k4e5.txt | 44 +++ drivers/media/i2c/Kconfig |8 + drivers/media/i2c/Makefile |1 + drivers/media/i2c/s5k4e5.c | 361 4 files changed, 414 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/s5k4e5.txt create mode 100644 drivers/media/i2c/s5k4e5.c diff --git a/Documentation/devicetree/bindings/media/i2c/s5k4e5.txt b/Documentation/devicetree/bindings/media/i2c/s5k4e5.txt new file mode 100644 index 000..88dd726 --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/s5k4e5.txt @@ -0,0 +1,44 @@ +* Samsung S5K4E5 Raw Image Sensor + +S5K4E5 is a raw image sensor with maximum resolution of 2560x1920 +pixels. Data transfer is carried out via MIPI-CSI2 port and controls +via I2C bus. + +Required Properties: +- compatible : must be samsung,s5k4e5 +- reg : I2C device address +- gpios: reset gpio pin +- clocks : clock specifier for the clock-names property. +- clock-names : must contain mclk entry and matching clock property + entry. +- svdda-supply : core voltage supply +- svddio-supply: I/O voltage supply + +Optional Properties: +- clock-frequency : operating frequency for the sensor +default value will be taken if not provided. + +The device node should be added to their control bus controller (e.g. +I2C0) nodes and linked to the csis port node, using the common video +interfaces bindings, defined in video-interfaces.txt. + +Example: + + i2c-isp@1313 { + s5k4e5@20 { + compatible = samsung,s5k4e5; + reg = 0x20; + gpios = gpx1 2 1; + clock-frequency = 2400; + clocks = clock 129; + clock-names = mclk; + svdda-supply = ...; + svddio-supply = ...; + port { + is_s5k4e5_ep: endpoint { + data-lanes = 1 2 3 4; + remote-endpoint = csis0_ep; + }; + }; + }; + }; diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index f7e9147..271028b 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -572,6 +572,14 @@ config VIDEO_S5K6A3 This is a V4L2 sensor-level driver for Samsung S5K6A3 raw camera sensor. +config VIDEO_S5K4E5 + tristate Samsung S5K4E5 sensor support + depends on MEDIA_CAMERA_SUPPORT + depends on I2C VIDEO_V4L2 VIDEO_V4L2_SUBDEV_API OF + ---help--- + This is a V4L2 sensor-level driver for Samsung S5K4E5 raw + camera sensor. + config VIDEO_S5K4ECGX tristate Samsung S5K4ECGX sensor support depends on I2C VIDEO_V4L2 VIDEO_V4L2_SUBDEV_API diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index cf3cf03..0aeed8e 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -65,6 +65,7 @@ obj-$(CONFIG_VIDEO_SR030PC30) += sr030pc30.o obj-$(CONFIG_VIDEO_NOON010PC30)+= noon010pc30.o obj-$(CONFIG_VIDEO_S5K6AA) += s5k6aa.o obj-$(CONFIG_VIDEO_S5K6A3) += s5k6a3.o +obj-$(CONFIG_VIDEO_S5K4E5) += s5k4e5.o obj-$(CONFIG_VIDEO_S5K4ECGX) += s5k4ecgx.o obj-$(CONFIG_VIDEO_S5C73M3)+= s5c73m3/ obj-$(CONFIG_VIDEO_ADP1653)+= adp1653.o diff --git a/drivers/media/i2c/s5k4e5.c b/drivers/media/i2c/s5k4e5.c new file mode 100644 index 000..0a6ece6 --- /dev/null +++ b/drivers/media/i2c/s5k4e5.c @@ -0,0 +1,361 @@ +/* + * Samsung S5K4E5 image sensor driver + * + * Copyright (C) 2013 Samsung Electronics Co., Ltd. + * Author: Arun Kumar K arun...@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 linux/clk.h +#include linux/delay.h +#include linux/device.h +#include linux/errno.h +#include linux/gpio.h +#include linux/i2c.h +#include linux/kernel.h +#include linux/module.h +#include linux/of_gpio.h +#include linux/pm_runtime.h +#include linux/regulator/consumer.h +#include linux/slab.h +#include linux/videodev2.h +#include media/v4l2-async.h +#include media/v4l2-subdev.h + +#define S5K4E5_SENSOR_MAX_WIDTH2576 +#define S5K4E5_SENSOR_MAX_HEIGHT 1930 +
Re: width and height of JPEG compressed images
Hi Tom, Before replying the rest, let me first ask you a question. Does ExF define the size of the image, or does it define its maximum size? I think that may make a big difference here. -- Cheers, Sakari Ailus e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] V4L: async: Make sure subdevs are stored in a list before being moved
Subdevices have an async_list field used to store them in the global list of subdevices or in the notifier done lists. List entries are moved from the former to the latter in v4l2_async_test_notify() using list_move(). However, v4l2_async_test_notify() can be called right away when the subdev is registered with v4l2_async_register_subdev(), in which case the entry is not stored in any list. Although this behaviour is not correct, the code doesn't crash at the moment as the async_list field is initialized as a list head, despite being a list entry. Add the subdev to the global subdevs list a registration time before matching them with the notifiers to make sure the list_move() call will get a subdev that is stored in a list, and remove the list head initialization for the subdev async_list field. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/v4l2-core/v4l2-async.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index b350ab9..4485dfe 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -122,7 +122,7 @@ static void v4l2_async_cleanup(struct v4l2_subdev *sd) { v4l2_device_unregister_subdev(sd); /* Subdevice driver will reprobe and put the subdev back onto the list */ - list_del_init(sd-async_list); + list_del(sd-async_list); sd-asd = NULL; sd-dev = NULL; } @@ -238,7 +238,11 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd) mutex_lock(list_lock); - INIT_LIST_HEAD(sd-async_list); + /* +* Add the subdev to the global subdevs list. It will be moved to the +* notifier done list by v4l2_async_test_notify(). +*/ + list_add(sd-async_list, subdev_list); list_for_each_entry(notifier, notifier_list, list) { struct v4l2_async_subdev *asd = v4l2_async_belongs(notifier, sd); @@ -249,9 +253,6 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd) } } - /* None matched, wait for hot-plugging */ - list_add(sd-async_list, subdev_list); - mutex_unlock(list_lock); 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] videobuf2-core: Verify planes lengths for output buffers
On Monday 12 November 2012 12:35:35 Laurent Pinchart wrote: On Friday 09 November 2012 15:33:22 Pawel Osciak wrote: On Tue, Oct 16, 2012 at 8:37 AM, Laurent Pinchart wrote: For output buffers application provide to the kernel the number of bytes they stored in each plane of the buffer. Verify that the value is smaller than or equal to the plane length. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Acked-by: Hans Verkuil hans.verk...@cisco.com --- Acked-by: Pawel Osciak pa...@osciak.com You're listed, as well as Marek and Kyungmin, as videobuf2 maintainers. When you ack a videobuf2 patch, should we assume that you will take it in your git tree ? Ping ? I'd like to get this patch in v3.12, should I send a pull request ? drivers/media/v4l2-core/videobuf2-core.c | 39 +++ 1 files changed, 39 insertions(+), 0 deletions(-) Changes compared to v1: - Sanity check the data_offset value for each plane. diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 432df11..479337d 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -296,6 +296,41 @@ static int __verify_planes_array(struct vb2_buffer *vb, const struct v4l2_buffer } /** + * __verify_length() - Verify that the bytesused value for each plane fits in + * the plane length and that the data offset doesn't exceed the bytesused value. + */ +static int __verify_length(struct vb2_buffer *vb, const struct v4l2_buffer *b) +{ + unsigned int length; + unsigned int plane; + + if (!V4L2_TYPE_IS_OUTPUT(b-type)) + return 0; + + if (V4L2_TYPE_IS_MULTIPLANAR(b-type)) { + for (plane = 0; plane vb-num_planes; ++plane) { + length = (b-memory == V4L2_MEMORY_USERPTR) + ? b-m.planes[plane].length + : vb-v4l2_planes[plane].length; + + if (b-m.planes[plane].bytesused length) + return -EINVAL; + if (b-m.planes[plane].data_offset = + b-m.planes[plane].bytesused) + return -EINVAL; + } + } else { + length = (b-memory == V4L2_MEMORY_USERPTR) + ? b-length : vb-v4l2_planes[0].length; + + if (b-bytesused length) + return -EINVAL; + } + + return 0; +} + +/** * __buffer_in_use() - return true if the buffer is in use and * the queue cannot be freed (by the means of REQBUFS(0)) call */ @@ -975,6 +1010,10 @@ static int __buf_prepare(struct vb2_buffer *vb, const struct v4l2_buffer *b) struct vb2_queue *q = vb-vb2_queue; int ret; + ret = __verify_length(vb, b); + if (ret 0) + return ret; + switch (q-memory) { case V4L2_MEMORY_MMAP: ret = __qbuf_mmap(vb, b); -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT PULL FOR v3.12] Renesas VSP1 driver
Hi Mauro, The following changes since commit dfb9f94e8e5e7f73c8e2bcb7d4fb1de57e7c333d: [media] stk1160: Build as a module if SND is m and audio support is selected (2013-08-01 14:55:25 -0300) are available in the git repository at: git://linuxtv.org/pinchartl/media.git vsp1 for you to fetch changes up to aa41f0e9ee56108671e4af4ef075bc869c5c5746: vsp1: Use the maximum number of entities defined in platform data (2013-08-07 12:45:40 +0200) Katsuya Matsubara (2): vsp1: Fix lack of the sink entity registration for enabled links vsp1: Use the maximum number of entities defined in platform data Laurent Pinchart (8): media: Add support for circular graph traversal Documentation: media: Clarify the VIDIOC_CREATE_BUFS format requirements media: vb2: Clarify queue_setup() and buf_prepare() usage documentation media: vb2: Take queue or device lock in mmap-related vb2 ioctl handlers v4l: Fix V4L2_MBUS_FMT_YUV10_1X30 media bus pixel code value v4l: Add media format codes for ARGB and AYUV on 32-bit busses v4l: Add V4L2_PIX_FMT_NV16M and V4L2_PIX_FMT_NV61M formats v4l: Renesas R-Car VSP1 driver Documentation/DocBook/media/v4l/pixfmt-nv16m.xml | 171 Documentation/DocBook/media/v4l/pixfmt.xml |1 + Documentation/DocBook/media/v4l/subdev-formats.xml | 611 ++ Documentation/DocBook/media/v4l/vidioc-create-bufs.xml | 41 +- Documentation/DocBook/media_api.tmpl |6 + drivers/media/media-entity.c | 14 +- drivers/media/platform/Kconfig | 10 + drivers/media/platform/Makefile|2 + drivers/media/platform/vsp1/Makefile |5 + drivers/media/platform/vsp1/vsp1.h | 73 ++ drivers/media/platform/vsp1/vsp1_drv.c | 495 +++ drivers/media/platform/vsp1/vsp1_entity.c | 181 drivers/media/platform/vsp1/vsp1_entity.h | 68 ++ drivers/media/platform/vsp1/vsp1_lif.c | 238 ++ drivers/media/platform/vsp1/vsp1_lif.h | 37 + drivers/media/platform/vsp1/vsp1_regs.h| 581 + drivers/media/platform/vsp1/vsp1_rpf.c | 209 + drivers/media/platform/vsp1/vsp1_rwpf.c| 124 +++ drivers/media/platform/vsp1/vsp1_rwpf.h| 53 ++ drivers/media/platform/vsp1/vsp1_uds.c | 346 drivers/media/platform/vsp1/vsp1_uds.h | 40 + drivers/media/platform/vsp1/vsp1_video.c | 1071 +++ drivers/media/platform/vsp1/vsp1_video.h | 144 drivers/media/platform/vsp1/vsp1_wpf.c | 233 ++ drivers/media/v4l2-core/videobuf2-core.c | 18 +- include/linux/platform_data/vsp1.h | 25 + include/media/media-entity.h |4 + include/media/videobuf2-core.h | 11 +- include/uapi/linux/v4l2-mediabus.h |6 +- include/uapi/linux/videodev2.h |2 + 30 files changed, 4428 insertions(+), 392 deletions(-) create mode 100644 Documentation/DocBook/media/v4l/pixfmt-nv16m.xml create mode 100644 drivers/media/platform/vsp1/Makefile create mode 100644 drivers/media/platform/vsp1/vsp1.h create mode 100644 drivers/media/platform/vsp1/vsp1_drv.c create mode 100644 drivers/media/platform/vsp1/vsp1_entity.c create mode 100644 drivers/media/platform/vsp1/vsp1_entity.h create mode 100644 drivers/media/platform/vsp1/vsp1_lif.c create mode 100644 drivers/media/platform/vsp1/vsp1_lif.h create mode 100644 drivers/media/platform/vsp1/vsp1_regs.h create mode 100644 drivers/media/platform/vsp1/vsp1_rpf.c create mode 100644 drivers/media/platform/vsp1/vsp1_rwpf.c create mode 100644 drivers/media/platform/vsp1/vsp1_rwpf.h create mode 100644 drivers/media/platform/vsp1/vsp1_uds.c create mode 100644 drivers/media/platform/vsp1/vsp1_uds.h create mode 100644 drivers/media/platform/vsp1/vsp1_video.c create mode 100644 drivers/media/platform/vsp1/vsp1_video.h create mode 100644 drivers/media/platform/vsp1/vsp1_wpf.c create mode 100644 include/linux/platform_data/vsp1.h -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [media] exynos-gsc: fix s2r functionality
From: Prathyush K prathyus...@samsung.com When gsc is in runtime suspended state, there is no need to call m2m_suspend during suspend and similarily, there is no need to call m2m_resume during resume if already in runtime suspended state. This patch adds the necessary conditions to achieve this. Signed-off-by: Prathyush K prathyus...@samsung.com Signed-off-by: Arun Mankuzhi aru...@samsung.com Signed-off-by: Arun Kumar K arun...@samsung.com --- drivers/media/platform/exynos-gsc/gsc-core.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index 559fab2..fe69eae 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -1210,12 +1210,12 @@ static int gsc_resume(struct device *dev) spin_unlock_irqrestore(gsc-slock, flags); return 0; } - gsc_hw_set_sw_reset(gsc); - gsc_wait_reset(gsc); - spin_unlock_irqrestore(gsc-slock, flags); - return gsc_m2m_resume(gsc); + if (!pm_runtime_suspended(dev)) + return gsc_runtime_resume(dev); + + return 0; } static int gsc_suspend(struct device *dev) @@ -1227,7 +1227,10 @@ static int gsc_suspend(struct device *dev) if (test_and_set_bit(ST_SUSPEND, gsc-state)) return 0; - return gsc_m2m_suspend(gsc); + if (!pm_runtime_suspended(dev)) + return gsc_runtime_suspend(dev); + + return 0; } static const struct dev_pm_ops gsc_pm_ops = { -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC 0/1] drm/pl111: Initial drm/kms driver for pl111
On Wed, Aug 7, 2013 at 12:23 AM, John Stultz john.stu...@linaro.org wrote: On Tue, Aug 6, 2013 at 5:15 AM, Rob Clark robdcl...@gmail.com wrote: well, let's divide things up into two categories: 1) the arrangement and format of pixels.. ie. what userspace would need to know if it mmap's a buffer. This includes pixel format, stride, etc. This should be negotiated in userspace, it would be crazy to try to do this in the kernel. 2) the physical placement of the pages. Ie. whether it is contiguous or not. Which bank the pages in the buffer are placed in, etc. This is not visible to userspace. This is the purpose of the attach step, so you know all the devices involved in sharing up front before allocating the backing pages. (Or in the worst case, if you have a late attacher you at least know when no device is doing dma access to a buffer and can reallocate and move the buffer.) A long time One concern I know the Android folks have expressed previously (and correct me if its no longer an objection), is that this attach time in-kernel constraint solving / moving or reallocating buffers is likely to hurt determinism. If I understood, their perspective was that userland knows the device path the buffers will travel through, so why not leverage that knowledge, rather then having the kernel have to sort it out for itself after the fact. If you know the device path, then attach the buffer at all the devices before you start using it. Problem solved.. kernel knows all devices before pages need be allocated ;-) BR, -R -- To unsubscribe from this list: send the line unsubscribe 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] mt9v032: Use the common clock framework
Hi Laurent, On 07/26/2013 05:55 PM, Laurent Pinchart wrote: On Friday 26 July 2013 15:36:22 Sylwester Nawrocki wrote: On 07/26/2013 03:15 PM, Laurent Pinchart wrote: On Friday 26 July 2013 15:11:08 Sylwester Nawrocki wrote: On 07/05/2013 12:55 PM, Laurent Pinchart wrote: Configure the device external clock using the common clock framework instead of a board code callback function. Signed-off-by: Laurent Pinchartlaurent.pinch...@ideasonboard.com --- drivers/media/i2c/mt9v032.c | 16 ++-- include/media/mt9v032.h | 4 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c index 60c6f67..7b30640 100644 --- a/drivers/media/i2c/mt9v032.c +++ b/drivers/media/i2c/mt9v032.c @@ -12,6 +12,7 @@ * published by the Free Software Foundation. */ +#includelinux/clk.h #includelinux/delay.h #includelinux/i2c.h #includelinux/log2.h @@ -135,6 +136,8 @@ struct mt9v032 { struct mutex power_lock; int power_count; + struct clk *clk; + struct mt9v032_platform_data *pdata; u32 sysclk; @@ -219,10 +222,8 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032) struct i2c_client *client = v4l2_get_subdevdata(mt9v032-subdev); int ret; - if (mt9v032-pdata-set_clock) { - mt9v032-pdata-set_clock(mt9v032-subdev, mt9v032-sysclk); - udelay(1); - } + clk_prepare_enable(mt9v032-clk); + udelay(1); /* Reset the chip and stop data read out */ ret = mt9v032_write(client, MT9V032_RESET, 1); @@ -238,8 +239,7 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032) static void mt9v032_power_off(struct mt9v032 *mt9v032) { - if (mt9v032-pdata-set_clock) - mt9v032-pdata-set_clock(mt9v032-subdev, 0); + clk_disable_unprepare(mt9v032-clk); } static int __mt9v032_set_power(struct mt9v032 *mt9v032, bool on) @@ -748,6 +748,10 @@ static int mt9v032_probe(struct i2c_client *client, if (!mt9v032) return -ENOMEM; + mt9v032-clk = devm_clk_get(client-dev, NULL); + if (IS_ERR(mt9v032-clk)) + return PTR_ERR(mt9v032-clk); + mutex_init(mt9v032-power_lock); mt9v032-pdata = pdata; diff --git a/include/media/mt9v032.h b/include/media/mt9v032.h index 78fd39e..12175a6 100644 --- a/include/media/mt9v032.h +++ b/include/media/mt9v032.h @@ -1,13 +1,9 @@ #ifndef _MEDIA_MT9V032_H #define _MEDIA_MT9V032_H -struct v4l2_subdev; - struct mt9v032_platform_data { unsigned int clk_pol:1; - void (*set_clock)(struct v4l2_subdev *subdev, unsigned int rate); - const s64 *link_freqs; s64 link_def_freq; }; Is there clk_put() somewhere in this patch ? I would expect it somewhere around driver remove() callback, but can't see it. :-/ There's *devm_*clk_get() instead :-) Ah, I knew I must have been forgetting or overlooking something! ;) Do you rely on the fact that __clk_get()/__clk_put() doesn't get reference on the clock supplier module (to avoid locking modules in memory) ? I was planning on adding module_get()/module_put() inside __clk_get()/__clk_out() for the common clock API implementation. I'm currently relying on that, but I'm aware it's not a good idea. We need to find a solution to fix the problem in the context of the v4l2-async framework. There are few possible options I can see could be a resolution for that: 1. making the common clock API not getting reference on the clock supplier module; then dynamic clock deregistration needs to be handled, which has its own share of problems; 2. using sysfs unbind attribute of the subdev and/or the host drivers to release the circular references or create some additional sysfs entry for this - however requiring additional actions from user space to do something that worked before without them can be simply considered as an regression; 3. not keeping reference to a clock all times only when it is actively used, e.g. in subdev's s_power handler; this is in practice what v4l2-clk does, just would be coded using standard clk API calls; Any of these options isn't ideal but 3) seems to me most reasonable of them. I thought it would be better than using the v4l2-clk API, which is supposed to be a temporary measure only, for platforms that already have the common clock API support. I was wondering whether you don't need to also set the clock's frequency in this patch. I guess the sensor driver should at least call clk_get_rate() to see if current frequency is suitable for the device ? 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] V4L: Drop meaningless video_is_registered() call in v4l2_open()
Hi Hans, On 08/02/2013 03:00 PM, Hans Verkuil wrote: Hi Sylwester, The patch is good, but I have some issues with the commit message itself. Thanks a lot for the detailed explanation, I just wrote this a bit longish changelog to possibly get some feedback and to better understand what is exactly going on. Currently the v4l2-core looks like a racing disaster to me. On 08/02/2013 02:27 PM, Sylwester Nawrocki wrote: As it currently stands this code doesn't protect against any races between video device open() and its unregistration. Races could be avoided by doing the video_is_registered() check protected by the core mutex, while the video device unregistration is also done with this mutex held. The video_unregister_device() is called completely asynchronously, particularly in the case of usb drivers. So it was never the goal of the video_is_registered() to be fool proof, since that isn't possible, nor is that necessary. The goal was that the v4l2 core would use it for the various file operations and ioctls as a quick check whether the device was unregistered and to return the correct error. This prevents drivers from having to do the same thing. OK, I think I just myself used this video_is_registered() flag for some more stuff, by surrounding it with mutex_lock/mutex_unlock and putting more stuff in between, like media_entity_cleanup(). And this probably led me astray for a while, thinking that video_is_registered() was intended to be used synchronously. For example see fimc_lite_subdev_unregistered() in drivers/media/platform/ exynos4-is/fimc-lite.c. But as you said video_is_registered() is fully asynchronous. Actually I'm trying to fix a nasty race between deferred driver probing and video device open(). The problem is that video open() callback can be called after driver remove() callback was invoked. This issue is actually not only related to deferred probing. It can be also triggered by driver module removal or through driver's sysfs unbind attribute. Let's assume following scenario: - a driver module is loaded - driver probe is called, it registers video device, - udev opens /dev/video - after mutex_unlock(videodev_lock); call in v4l2_open() in v4l2-core/ v4l2-dev.c something fails in probe() and it unwinds, probe callback exits and the driver code code calls dev_set_drvdata(dev, NULL); as shown below. static int really_probe(struct device *dev, struct device_driver *drv) { ... pr_debug(bus: '%s': %s: probing driver %s with device %s\n, drv-bus-name, __func__, drv-name, dev_name(dev)); ... if (dev-bus-probe) { ret = dev-bus-probe(dev); if (ret) goto probe_failed; } else if (drv-probe) { ret = drv-probe(dev); if (ret) goto probe_failed; } ... pr_debug(bus: '%s': %s: bound device %s to driver %s\n, drv-bus-name, __func__, dev_name(dev), drv-name); goto done; probe_failed: devres_release_all(dev); driver_sysfs_remove(dev); dev-driver = NULL; dev_set_drvdata(dev, NULL); ... ret = 0; done: ... return ret; } Now we get to ret = vdev-fops-open(filp); in v4l2_open(). This calls some driver's callback, e.g. something like: static int fimc_lite_open(struct file *file) { struct fimc_lite *fimc = video_drvdata(file); struct media_entity *me = fimc-ve.vdev.entity; int ret; mutex_lock(fimc-lock); if (!video_is_registered(fimc-ve.vdev)) { ret = -ENODEV; goto unlock; } ... /* Mark video pipeline ending at this video node as in use. */ if (ret == 0) me-use_count++; ... unlock: mutex_unlock(fimc-lock); return ret; } Now what will video_drvdata(file); return ? static inline void *video_drvdata(struct file *file) { return video_get_drvdata(video_devdata(file)); } static inline void *video_get_drvdata(struct video_device *vdev) { return dev_get_drvdata(vdev-dev); } Yes, so that will be just NULL o_O, due to the dev_set_drvdata(dev, NULL); in really_probe(). drvdata is cleared similarly in __device_release_driver(), right after calling driver's remove handler. Another issue I have is that, e.g. driver/media/platform/exynos4-is/fimc-lite* driver has empty video dev release() callback. It should be implemented in the driver to kfree the whole driver's private data structure where struct video_device is embedded in (struct fimc_lite). But that freeing really needs to be synchronized with driver's remove() call, since there is e.g. freed interrupt which accesses the driver's private data. I can't use kref from struct v4l2_device as that belongs to a different driver. A driver's custom reference counting comes to mind,
Re: [PATCH] [media] exynos-gsc: fix s2r functionality
On 08/07/2013 02:53 PM, Arun Kumar K wrote: From: Prathyush K prathyus...@samsung.com When gsc is in runtime suspended state, there is no need to call m2m_suspend during suspend and similarily, there is no need to call s/similarily/similarly. I'll fix that typo when applying. m2m_resume during resume if already in runtime suspended state. This patch adds the necessary conditions to achieve this. Signed-off-by: Prathyush K prathyus...@samsung.com Signed-off-by: Arun Mankuzhi aru...@samsung.com Signed-off-by: Arun Kumar K arun...@samsung.com Thanks, that looks good. I'll queue it for 3.12. We actually have similar patch for the exynos4-is fimc-is-i2c driver. However this is sort of things that IMO should ideally be handled in the PM core. -- Sylwester Nawrocki Samsung RD Institute Poland -- To unsubscribe from this list: send the line unsubscribe 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: width and height of JPEG compressed images
It defines the exact size of the physical frame. The JPEG data is padded to this size. The size of the JPEG before it was padded is also written into the last word of the physical frame. From: Sakari Ailus [sakari.ai...@iki.fi] Sent: 07 August 2013 10:35 To: Thomas Vajzovic Cc: Sylwester Nawrocki; Sylwester Nawrocki; linux-media@vger.kernel.org; Laurent Pinchart Subject: Re: width and height of JPEG compressed images Hi Tom, Before replying the rest, let me first ask you a question. Does ExF define the size of the image, or does it define its maximum size? I think that may make a big difference here. -- Cheers, Sakari Ailus e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk Disclaimer: This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the original message and the sent message from your computer. Infrared Integrated Systems Limited Park Circle Tithe Barn Way Swan Valley Northampton NN4 9BG Registration Number: 3186364. -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] V4L: Drop meaningless video_is_registered() call in v4l2_open()
On 08/07/2013 06:49 PM, Sylwester Nawrocki wrote: Hi Hans, On 08/02/2013 03:00 PM, Hans Verkuil wrote: Hi Sylwester, The patch is good, but I have some issues with the commit message itself. Thanks a lot for the detailed explanation, I just wrote this a bit longish changelog to possibly get some feedback and to better understand what is exactly going on. Currently the v4l2-core looks like a racing disaster to me. On 08/02/2013 02:27 PM, Sylwester Nawrocki wrote: As it currently stands this code doesn't protect against any races between video device open() and its unregistration. Races could be avoided by doing the video_is_registered() check protected by the core mutex, while the video device unregistration is also done with this mutex held. The video_unregister_device() is called completely asynchronously, particularly in the case of usb drivers. So it was never the goal of the video_is_registered() to be fool proof, since that isn't possible, nor is that necessary. The goal was that the v4l2 core would use it for the various file operations and ioctls as a quick check whether the device was unregistered and to return the correct error. This prevents drivers from having to do the same thing. OK, I think I just myself used this video_is_registered() flag for some more stuff, by surrounding it with mutex_lock/mutex_unlock and putting more stuff in between, like media_entity_cleanup(). You can't do that, because there are most likely still filehandles open or even ioctls being executed. Cleanup happens in the release function(s) when the kref goes to 0. And this probably led me astray for a while, thinking that video_is_registered() was intended to be used synchronously. For example see fimc_lite_subdev_unregistered() in drivers/media/platform/ exynos4-is/fimc-lite.c. But as you said video_is_registered() is fully asynchronous. Actually I'm trying to fix a nasty race between deferred driver probing and video device open(). The problem is that video open() callback can be called after driver remove() callback was invoked. How is that possible? The video_device_register must be the last thing in the probe function. If it succeeds, then the probe must succeed as well. Note that I now realize that this might fail in the case of multiple device nodes being registered. We never had problems with that in the past, but in theory you can the race condition you mention in that scenario. The correct approach here would probably be to always return 0 in probe() if only some of the video_device_register calls fail. Anyway, assuming that only one device node is created, then I can't see how you can get a race condition here. Any open() call will increase the module's refcount, making it impossible to unload. As far as I can tell, once you call rmmod it should no longer be possible to open() an device node whose struct file_operations owner is that module (i.e. the owner field of the file_operations struct points to that module). Looking at the way fs/char_dev is implemented, that seems to be correctly handled by the kernel core. This issue is actually not only related to deferred probing. It can be also triggered by driver module removal or through driver's sysfs unbind attribute. Let's assume following scenario: - a driver module is loaded - driver probe is called, it registers video device, - udev opens /dev/video - after mutex_unlock(videodev_lock); call in v4l2_open() in v4l2-core/ v4l2-dev.c something fails in probe() And that shouldn't happen. That's the crucial bit: under which scenario does this happen for you? If there is a control path where you do create a working device node, but the probe fails, then that will indeed cause all sorts of problems. But it shouldn't get in that situation (except I think in the case of multiple device nodes, which is something I need to think about). and it unwinds, probe callback exits and the driver code code calls dev_set_drvdata(dev, NULL); as shown below. static int really_probe(struct device *dev, struct device_driver *drv) { ... pr_debug(bus: '%s': %s: probing driver %s with device %s\n, drv-bus-name, __func__, drv-name, dev_name(dev)); ... if (dev-bus-probe) { ret = dev-bus-probe(dev); if (ret) goto probe_failed; } else if (drv-probe) { ret = drv-probe(dev); if (ret) goto probe_failed; } ... pr_debug(bus: '%s': %s: bound device %s to driver %s\n, drv-bus-name, __func__, dev_name(dev), drv-name); goto done; probe_failed: devres_release_all(dev); driver_sysfs_remove(dev); dev-driver = NULL; dev_set_drvdata(dev, NULL); ... ret = 0; done: ... return ret; } Now we get to ret = vdev-fops-open(filp); in
Re: [Linaro-mm-sig] [RFC 0/1] drm/pl111: Initial drm/kms driver for pl111
On Wed, Aug 7, 2013 at 1:33 PM, Tom Cooksey tom.cook...@arm.com wrote: Didn't you say that programmatically describing device placement constraints was an unbounded problem? I guess we would have to accept that it's not possible to describe all possible constraints and instead find a way to describe the common ones? well, the point I'm trying to make, is by dividing your constraints into two groups, one that impacts and is handled by userspace, and one that is in the kernel (ie. where the pages go), you cut down the number of permutations that the kernel has to care about considerably. And kernel already cares about, for example, what range of addresses that a device can dma to/from. I think really the only thing missing is the max # of sglist entries (contiguous or not) I think it's more than physically contiguous or not. For example, it can be more efficient to use large page sizes on devices with IOMMUs to reduce TLB traffic. I think the size and even the availability of large pages varies between different IOMMUs. sure.. but I suppose if we can spiff out dma_params to express I need contiguous, perhaps we can add some way to express I prefer as-contiguous-as-possible.. either way, this is about where the pages are placed, and not about the layout of pixels within the page, so should be in kernel. It's something that is missing, but I believe that it belongs in dma_params and hidden behind dma_alloc_*() for simple drivers. Thinking about it, isn't this more a property of the IOMMU? I mean, are there any cases where an IOMMU had a large page mode but you wouldn't want to use it? So when allocating the memory, you'd have to take into account not just the constraints of the devices themselves, but also of any IOMMUs any of the device sit behind? There's also the issue of buffer stride alignment. As I say, if the buffer is to be written by a tile-based GPU like Mali, it's more efficient if the buffer's stride is aligned to the max AXI bus burst length. Though I guess a buffer stride only makes sense as a concept when interpreting the data as a linear-layout 2D image, so perhaps belongs in user-space along with format negotiation? Yeah.. this isn't about where the pages go, but about the arrangement within a page. And, well, except for hw that supports the same tiling (or compressed-fb) in display+gpu, you probably aren't sharing tiled buffers. You'd only want to share a buffer between devices if those devices can understand the same pixel format. That pixel format can't be device- specific or opaque, it has to be explicit. I think drm_fourcc.h is what defines all the possible pixel formats. This is the enum I used in EGL_EXT_image_dma_buf_import at least. So if we get to the point where multiple devices can understand a tiled or compressed format, I assume we could just add that format to drm_fourcc.h and possibly v4l2's v4l2_mbus_pixelcode enum in v4l2-mediabus.h. For user-space to negotiate a common pixel format and now stride alignment, I guess it will obviously need a way to query what pixel formats a device supports and what its stride alignment requirements are. I don't know v4l2 very well, but it certainly seems the pixel format can be queried using V4L2_SUBDEV_FORMAT_TRY when attempting to set a particular format. I couldn't however find a way to retrieve a list of supported formats - it seems the mechanism is to try out each format in turn to determine if it is supported. Is that right? There doesn't however seem a way to query what stride constraints a V4l2 device might have. Does HW abstracted by v4l2 typically have such constraints? If so, how can we query them such that a buffer allocated by a DRM driver can be imported into v4l2 and used with that HW? Turning to DRM/KMS, it seems the supported formats of a plane can be queried using drm_mode_get_plane. However, there doesn't seem to be a way to query the supported formats of a crtc? If display HW only supports scanning out from a single buffer (like pl111 does), I think it won't have any planes and a fb can only be set on the crtc. In which case, how should user-space query which pixel formats that crtc supports? Assuming user-space can query the supported formats and find a common one, it will need to allocate a buffer. Looks like drm_mode_create_dumb can do that, but it only takes a bpp parameter, there's no format parameter. I assume then that user-space defines the format and tells the DRM driver which format the buffer is in when creating the fb with drm_mode_fb_cmd2, which does take a format parameter? Is that right? As with v4l2, DRM doesn't appear to have a way to query the stride constraints? Assuming there is a way to query the stride constraints, there also isn't a way to specify them when creating a buffer with DRM, though perhaps the existing pitch parameter of drm_mode_create_dumb could be used to
Re: [RFC 0/1] drm/pl111: Initial drm/kms driver for pl111
On Wed, Aug 7, 2013 at 1:33 PM, Tom Cooksey tom.cook...@arm.com wrote: Didn't you say that programmatically describing device placement constraints was an unbounded problem? I guess we would have to accept that it's not possible to describe all possible constraints and instead find a way to describe the common ones? well, the point I'm trying to make, is by dividing your constraints into two groups, one that impacts and is handled by userspace, and one that is in the kernel (ie. where the pages go), you cut down the number of permutations that the kernel has to care about considerably. And kernel already cares about, for example, what range of addresses that a device can dma to/from. I think really the only thing missing is the max # of sglist entries (contiguous or not) I think it's more than physically contiguous or not. For example, it can be more efficient to use large page sizes on devices with IOMMUs to reduce TLB traffic. I think the size and even the availability of large pages varies between different IOMMUs. sure.. but I suppose if we can spiff out dma_params to express I need contiguous, perhaps we can add some way to express I prefer as-contiguous-as-possible.. either way, this is about where the pages are placed, and not about the layout of pixels within the page, so should be in kernel. It's something that is missing, but I believe that it belongs in dma_params and hidden behind dma_alloc_*() for simple drivers. Thinking about it, isn't this more a property of the IOMMU? I mean, are there any cases where an IOMMU had a large page mode but you wouldn't want to use it? So when allocating the memory, you'd have to take into account not just the constraints of the devices themselves, but also of any IOMMUs any of the device sit behind? perhaps yes. But the device is associated w/ the iommu it is attached to, so this shouldn't be a problem There's also the issue of buffer stride alignment. As I say, if the buffer is to be written by a tile-based GPU like Mali, it's more efficient if the buffer's stride is aligned to the max AXI bus burst length. Though I guess a buffer stride only makes sense as a concept when interpreting the data as a linear-layout 2D image, so perhaps belongs in user-space along with format negotiation? Yeah.. this isn't about where the pages go, but about the arrangement within a page. And, well, except for hw that supports the same tiling (or compressed-fb) in display+gpu, you probably aren't sharing tiled buffers. You'd only want to share a buffer between devices if those devices can understand the same pixel format. That pixel format can't be device- specific or opaque, it has to be explicit. I think drm_fourcc.h is what defines all the possible pixel formats. This is the enum I used in EGL_EXT_image_dma_buf_import at least. So if we get to the point where multiple devices can understand a tiled or compressed format, I assume we could just add that format to drm_fourcc.h and possibly v4l2's v4l2_mbus_pixelcode enum in v4l2-mediabus.h. For user-space to negotiate a common pixel format and now stride alignment, I guess it will obviously need a way to query what pixel formats a device supports and what its stride alignment requirements are. I don't know v4l2 very well, but it certainly seems the pixel format can be queried using V4L2_SUBDEV_FORMAT_TRY when attempting to set a particular format. I couldn't however find a way to retrieve a list of supported formats - it seems the mechanism is to try out each format in turn to determine if it is supported. Is that right? it is exposed for drm plane's. What is missing is to expose the primary-plane associated with the crtc. There doesn't however seem a way to query what stride constraints a V4l2 device might have. Does HW abstracted by v4l2 typically have such constraints? If so, how can we query them such that a buffer allocated by a DRM driver can be imported into v4l2 and used with that HW? Turning to DRM/KMS, it seems the supported formats of a plane can be queried using drm_mode_get_plane. However, there doesn't seem to be a way to query the supported formats of a crtc? If display HW only supports scanning out from a single buffer (like pl111 does), I think it won't have any planes and a fb can only be set on the crtc. In which case, how should user-space query which pixel formats that crtc supports? Assuming user-space can query the supported formats and find a common one, it will need to allocate a buffer. Looks like drm_mode_create_dumb can do that, but it only takes a bpp parameter, there's no format parameter. I assume then that user-space defines the format and tells the DRM driver which format the buffer is in when creating the fb with drm_mode_fb_cmd2, which does take a format parameter? Is that right? Right, the gem object has no inherent format, it is just some bytes. The
cron job: media_tree daily build: WARNINGS
This message is generated daily by a cron job that builds media_tree for the kernels and architectures in the list below. Results of the daily build of media_tree: date: Wed Aug 7 19:00:17 CEST 2013 git branch: test git hash: dfb9f94e8e5e7f73c8e2bcb7d4fb1de57e7c333d gcc version:i686-linux-gcc (GCC) 4.8.1 sparse version: v0.4.5-rc1 host hardware: x86_64 host os:3.9-7.slh.1-amd64 linux-git-arm-at91: OK linux-git-arm-davinci: OK linux-git-arm-exynos: OK linux-git-arm-mx: OK linux-git-arm-omap: OK linux-git-arm-omap1: OK linux-git-arm-pxa: OK linux-git-blackfin: OK linux-git-i686: OK linux-git-m32r: OK linux-git-mips: OK linux-git-powerpc64: OK linux-git-sh: OK linux-git-x86_64: OK linux-2.6.31.14-i686: WARNINGS linux-2.6.32.27-i686: WARNINGS linux-2.6.33.7-i686: WARNINGS linux-2.6.34.7-i686: WARNINGS linux-2.6.35.9-i686: WARNINGS linux-2.6.36.4-i686: WARNINGS linux-2.6.37.6-i686: WARNINGS linux-2.6.38.8-i686: WARNINGS linux-2.6.39.4-i686: WARNINGS linux-3.0.60-i686: OK linux-3.10-i686: OK linux-3.1.10-i686: OK linux-3.2.37-i686: OK linux-3.3.8-i686: OK linux-3.4.27-i686: WARNINGS linux-3.5.7-i686: WARNINGS linux-3.6.11-i686: WARNINGS linux-3.7.4-i686: WARNINGS linux-3.8-i686: WARNINGS linux-3.9.2-i686: WARNINGS linux-2.6.31.14-x86_64: WARNINGS linux-2.6.32.27-x86_64: WARNINGS linux-2.6.33.7-x86_64: WARNINGS linux-2.6.34.7-x86_64: WARNINGS linux-2.6.35.9-x86_64: WARNINGS linux-2.6.36.4-x86_64: WARNINGS linux-2.6.37.6-x86_64: WARNINGS linux-2.6.38.8-x86_64: WARNINGS linux-2.6.39.4-x86_64: WARNINGS linux-3.0.60-x86_64: OK linux-3.10-x86_64: OK linux-3.1.10-x86_64: OK linux-3.2.37-x86_64: OK linux-3.3.8-x86_64: OK linux-3.4.27-x86_64: WARNINGS linux-3.5.7-x86_64: WARNINGS linux-3.6.11-x86_64: WARNINGS linux-3.7.4-x86_64: WARNINGS linux-3.8-x86_64: WARNINGS linux-3.9.2-x86_64: WARNINGS apps: WARNINGS spec-git: OK sparse version: v0.4.5-rc1 sparse: ERRORS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Wednesday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Wednesday.tar.bz2 The Media Infrastructure API from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/media.html -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: dib8000 scanning not working on 3.10.3
Hi again Mauro, reverting both commits: * 59501bb792c66b85fb7fdbd740e788e3afc70bbd * f45f513a9325b52a5f3e26ee8d15471e8b692947 The problem still exists, I am unable to get any result, and also no error logs) :( What shall I do to try to fix this ? Do you need more info on my current setup. Thanks in advance and best regards... On Mon, Aug 5, 2013 at 5:26 PM, Mauro Carvalho Chehab m.che...@samsung.com wrote: Em Mon, 05 Aug 2013 16:09:56 -0300 Luis Polasek lpola...@gmail.com escreveu: Hi Mauro, I have tested using dvb5-scan, and the results are the same (no results, and no error logs) :( Do you have any clue why it is not working with this kernel version ? c/c Oliver and Patrick, who maintains this driver There were a recent change on this driver, in order to support some newer versions of this chipset. Perhaps those changes broke it for you. commit 59501bb792c66b85fb7fdbd740e788e3afc70bbd Author: Olivier Grenie olivier.gre...@parrot.com Date: Mon Dec 31 09:51:17 2012 -0300 [media] dib7090p: improve the support of the dib7090 and dib7790 The intend of this patch is to improve the support of the dib7090 and dib7790. The AGC1 min value is set to 32768 by default. The actual AGC1 min and the external attenuation are controled depending on the received RF level. Signed-off-by: Olivier Grenie olivier.gre...@parrot.com Signed-off-by: Patrick Boettcher patrick.boettc...@parrot.com Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com commit f45f513a9325b52a5f3e26ee8d15471e8b692947 Author: Olivier Grenie olivier.gre...@parrot.com Date: Mon Dec 31 09:47:10 2012 -0300 [media] dib7090p: remove the support for the dib7090E The intend of this patch is to remove the support for the dib7090E. The DiB7090E-package has never left prototype state and never made it to mass-prod-state. Signed-off-by: Olivier Grenie olivier.gre...@parrot.com Signed-off-by: Patrick Boettcher patrick.boettc...@parrot.com Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com Could you please revert those patches and see if they fix the issue? Please try to revert this one first: http://git.linuxtv.org/media_tree.git/commitdiff_plain/59501bb792c66b85fb7fdbd740e788e3afc70bbd If this doesn't solve, try to revert just this one: http://git.linuxtv.org/media_tree.git/commitdiff_plain/f45f513a9325b52a5f3e26ee8d15471e8b692947 then, try to revert both. AFAIKT, those are the only changes that may be affecting isdb-t on dib8000 driver. Thanks! Mauro Thanks and regards... On Thu, Aug 1, 2013 at 2:15 PM, Mauro Carvalho Chehab m.che...@samsung.comwrote: Em Thu, 1 Aug 2013 13:36:25 -0300 Ezequiel Garcia ezequiel.gar...@free-electrons.com escreveu: Hi Luis, (I'm Ccing Mauro, who mantains this driver and might know what's going on). On Wed, Jul 31, 2013 at 03:47:10PM -0300, Luis Polasek wrote: Hi, I just upgraded my kernel to 3.10.3, and dib8000 scanning does not work anymore. I tested using dvbscan (from dvb-apps/util/) and w_scan on a Prolink Pixelview SBTVD (dib8000 module*).This tools worked very well on version 3.9.9 , but now it does not produces any result, and also there are no error messages in the logs (dmesg). Please run a git bisect and report your findings. Note that dibcom8000 shows just a handful of commit on 2013, so you could start reverting those and see what happens. Perhaps it is a failure at the DVBv3 emulation. Did it also break using dvbv5-scan (part of v4l-utils)? Regards, Mauro -- Cheers, Mauro -- Cheers, Mauro -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 12/16] msi3101: init bits 23:20 on PLL register
Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/staging/media/msi3101/sdr-msi3101.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index a937d00..93168db 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -1129,9 +1129,19 @@ static int msi3101_set_usb_adc(struct msi3101_state *s) * * VCO 20200 - 72000++ */ - reg3 = 0x01c00303; + reg3 = 0x01000303; reg4 = 0x0004; + /* XXX: Filters? AGC? */ + if (f_sr 600) + reg3 |= 0x1 20; + else if (f_sr 700) + reg3 |= 0x5 20; + else if (f_sr 850) + reg3 |= 0x9 20; + else + reg3 |= 0xd 20; + for (div_r_out = 4; div_r_out 16; div_r_out += 2) { f_vco = f_sr * div_r_out * 12; dev_dbg(s-udev-dev, %s: div_r_out=%d f_vco=%d\n, -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 13/16] msi3101: fix overflow in freq setting
Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/staging/media/msi3101/sdr-msi3101.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index 93168db..56f9757 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -1507,11 +1507,11 @@ static int vidioc_s_frequency(struct file *file, void *priv, const struct v4l2_frequency *f) { struct msi3101_state *s = video_drvdata(file); - dev_dbg(s-udev-dev, %s: frequency=%u Hz (%d)\n, - __func__, f-frequency * 625U / 10U, f-frequency); + dev_dbg(s-udev-dev, %s: frequency=%lu Hz (%u)\n, + __func__, f-frequency * 625UL / 10UL, f-frequency); return v4l2_ctrl_s_ctrl_int64(s-ctrl_tuner_rf, - f-frequency * 625U / 10U); + f-frequency * 625UL / 10UL); } const struct v4l2_ioctl_ops msi3101_ioctl_ops = { -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 01/16] Mirics MSi3101 SDR Dongle driver
Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/staging/media/Kconfig |2 + drivers/staging/media/Makefile |1 + drivers/staging/media/msi3101/Kconfig |3 + drivers/staging/media/msi3101/Makefile |1 + drivers/staging/media/msi3101/sdr-msi3101.c | 1618 +++ 5 files changed, 1625 insertions(+) create mode 100644 drivers/staging/media/msi3101/Kconfig create mode 100644 drivers/staging/media/msi3101/Makefile create mode 100644 drivers/staging/media/msi3101/sdr-msi3101.c diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig index ae0abc3..46f1e61 100644 --- a/drivers/staging/media/Kconfig +++ b/drivers/staging/media/Kconfig @@ -29,6 +29,8 @@ source drivers/staging/media/dt3155v4l/Kconfig source drivers/staging/media/go7007/Kconfig +source drivers/staging/media/msi3101/Kconfig + source drivers/staging/media/solo6x10/Kconfig # Keep LIRC at the end, as it has sub-menus diff --git a/drivers/staging/media/Makefile b/drivers/staging/media/Makefile index 2b97cae..eb7f30b 100644 --- a/drivers/staging/media/Makefile +++ b/drivers/staging/media/Makefile @@ -4,4 +4,5 @@ obj-$(CONFIG_LIRC_STAGING) += lirc/ obj-$(CONFIG_SOLO6X10) += solo6x10/ obj-$(CONFIG_VIDEO_DT3155) += dt3155v4l/ obj-$(CONFIG_VIDEO_GO7007) += go7007/ +obj-$(CONFIG_USB_MSI3101) += msi3101/ obj-$(CONFIG_VIDEO_DM365_VPFE) += davinci_vpfe/ diff --git a/drivers/staging/media/msi3101/Kconfig b/drivers/staging/media/msi3101/Kconfig new file mode 100644 index 000..b94a95a --- /dev/null +++ b/drivers/staging/media/msi3101/Kconfig @@ -0,0 +1,3 @@ +config USB_MSI3101 + tristate Mirics MSi3101 SDR Dongle + depends on USB VIDEO_DEV VIDEO_V4L2 diff --git a/drivers/staging/media/msi3101/Makefile b/drivers/staging/media/msi3101/Makefile new file mode 100644 index 000..3730654 --- /dev/null +++ b/drivers/staging/media/msi3101/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_USB_MSI3101) += sdr-msi3101.o diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c new file mode 100644 index 000..46fdb6c --- /dev/null +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -0,0 +1,1618 @@ +/* + * Mirics MSi3101 SDR Dongle driver + * + * Copyright (C) 2013 Antti Palosaari cr...@iki.fi + * + *This program is free software; you can redistribute it and/or modify + *it under the terms of the GNU General Public License as published by + *the Free Software Foundation; either version 2 of the License, or + *(at your option) any later version. + * + *This program is distributed in the hope that it will be useful, + *but WITHOUT ANY WARRANTY; without even the implied warranty of + *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + *GNU General Public License for more details. + * + *You should have received a copy of the GNU General Public License along + *with this program; if not, write to the Free Software Foundation, Inc., + *51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include linux/kernel.h +#include linux/module.h +#include linux/init.h +#include linux/slab.h +#include linux/input.h +#include linux/videodev2.h +#include media/v4l2-device.h +#include media/v4l2-ioctl.h +#include media/v4l2-ctrls.h +#include media/v4l2-event.h +#include linux/usb.h +#include linux/mutex.h +#include media/videobuf2-vmalloc.h + +struct msi3101_gain { + u8 tot:7; + u8 baseband:6; + bool lna:1; + bool mixer:1; +}; + +/* 60 – 120 MHz band, lna 24dB, mixer 19dB */ +static const struct msi3101_gain msi3101_gain_lut_120[] = { + { 0, 0, 0, 0}, + { 1, 1, 0, 0}, + { 2, 2, 0, 0}, + { 3, 3, 0, 0}, + { 4, 4, 0, 0}, + { 5, 5, 0, 0}, + { 6, 6, 0, 0}, + { 7, 7, 0, 0}, + { 8, 8, 0, 0}, + { 9, 9, 0, 0}, + { 10, 10, 0, 0}, + { 11, 11, 0, 0}, + { 12, 12, 0, 0}, + { 13, 13, 0, 0}, + { 14, 14, 0, 0}, + { 15, 15, 0, 0}, + { 16, 16, 0, 0}, + { 17, 17, 0, 0}, + { 18, 18, 0, 0}, + { 19, 19, 0, 0}, + { 20, 20, 0, 0}, + { 21, 21, 0, 0}, + { 22, 22, 0, 0}, + { 23, 23, 0, 0}, + { 24, 24, 0, 0}, + { 25, 25, 0, 0}, + { 26, 26, 0, 0}, + { 27, 27, 0, 0}, + { 28, 28, 0, 0}, + { 29, 5, 1, 0}, + { 30, 6, 1, 0}, + { 31, 7, 1, 0}, + { 32, 8, 1, 0}, + { 33, 9, 1, 0}, + { 34, 10, 1, 0}, + { 35, 11, 1, 0}, + { 36, 12, 1, 0}, + { 37, 13, 1, 0}, + { 38, 14, 1, 0}, + { 39, 15, 1, 0}, + { 40, 16, 1, 0}, + { 41, 17, 1, 0}, + { 42, 18, 1, 0}, + { 43, 19, 1, 0}, + { 44, 20, 1, 0}, + { 45, 21, 1, 0}, + { 46, 22, 1, 0}, + {
[PATCH 15/16] msi3101: changes for tuner PLL freq limits
I made some tuner freq limit tests against RF signal generator. Adjust some PLL limits according to these test results. Here are the results, taken from two different devices. Numbers are RF limits and calculated and VCO limits. Mirics MSi3101 SDR Dongle: VHF_MODE 52 - 132 1664 - 4224 B3_MODE 103 - 263 1648 - 4208 B45_MODE 413 - 960 1652 - 3840 Hauppauge WinTV 133559 LF: VHF_MODE 49 - 130 1568 - 4160 B3_MODE 98 - 259 1568 - 4144 B45_MODE 391 - 960 1564 - 3840 Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/staging/media/msi3101/sdr-msi3101.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index c4bd963..e7a21a2 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -1306,11 +1306,11 @@ static int msi3101_set_tuner(struct msi3101_state *s) u8 mode; u8 lo_div; } band_lut[] = { - { 3000, 0x01, 16}, /* AM_MODE1 */ + { 4700, 0x01, 16}, /* AM_MODE1 */ {10800, 0x02, 32}, /* VHF_MODE */ - {24000, 0x04, 16}, /* B3_MODE */ + {33000, 0x04, 16}, /* B3_MODE */ {96000, 0x08, 4}, /* B45_MODE */ - {16750, 0x10, 2}, /* BL_MODE */ + { ~0U, 0x10, 2}, /* BL_MODE */ }; static const struct { u32 freq; -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 00/16 STAGING] Mirics MSi3101 SDR Dongle driver
It is driver for MSi3101 USB SDR designed by Mirics. I will pull-request that soon for the Kernel 3.12 staging. It is not ready for mainline as there is multiple issues. Biggest issues are; missing API controls and stream format conversions should be implemented by libv4l2. That driver is MSi3101 design, which consists of two chips: 1) USB ADC called MSi2500 and RF-tuner called MSi001. So I will split that to the two parts later... USB ADC is a state of the art in the reverse-engineering as I was not able to get documentation or other needed info, gah :-( Anyhow, it was quite interesting as a point of learn the first USB ADC I have seen. Biggest challenge was to discover how to calculate ADC sampling rate. It was a typical Fractional-N PLL as all these are nowadays. First I calculated sampling rates by the driver, after that brute forced PLL registers with a different values and look what kind of data rate it is outputting :) Nice trick - but took a lot of time. Re-engineering such USB ADC is still a little bit easier than typical DTV demodulator in my experience. Another, not so hard, issue to mention was understand different stream formats. Chip seems to offer multiple formats, best one I found seems to offer even 14-bit resolution. Special thanks to University Oulu HAM club, Oulun Teekkarien Radiokerho, OH8TA, for the support I received. You rule! Antti Palosaari (16): Mirics MSi3101 SDR Dongle driver msi3101: sample is correct term for sample msi3101: fix sampling rate calculation msi3101: add sampling mode control msi3101: enhance sampling results msi3101: fix stream re-start halt msi3101: add 2040:d300 Hauppauge WinTV 133559 LF msi3101: add debug dump for unknown stream data msi3101: correct ADC sampling rate calc a little msi3101: improve tuner synth calc step size msi3101: add support for stream format 252 I+Q per frame msi3101: init bits 23:20 on PLL register msi3101: fix overflow in freq setting msi3101: add stream format 336 I+Q pairs per frame msi3101: changes for tuner PLL freq limits msi3101: a lot of small cleanups drivers/staging/media/Kconfig |2 + drivers/staging/media/Makefile |1 + drivers/staging/media/msi3101/Kconfig |3 + drivers/staging/media/msi3101/Makefile |1 + drivers/staging/media/msi3101/sdr-msi3101.c | 1822 +++ 5 files changed, 1829 insertions(+) create mode 100644 drivers/staging/media/msi3101/Kconfig create mode 100644 drivers/staging/media/msi3101/Makefile create mode 100644 drivers/staging/media/msi3101/sdr-msi3101.c -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 09/16] msi3101: correct ADC sampling rate calc a little
Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/staging/media/msi3101/sdr-msi3101.c | 23 --- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index 2b73fc1..04bbbdf 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -987,7 +987,7 @@ static int msi3101_tuner_write(struct msi3101_state *s, u32 data) #define DIV_R_IN 2 static int msi3101_set_usb_adc(struct msi3101_state *s) { - int ret, div_n, div_m, div_r_out, f_sr, f_vco; + int ret, div_n, div_m, div_r_out, f_sr, f_vco, fract; u32 reg4, reg3; /* * Synthesizer config is just a educated guess... @@ -998,7 +998,7 @@ static int msi3101_set_usb_adc(struct msi3101_state *s) * [12:10] output divider * [13]0 ? * [14]0 ? -* [15]increase sr by max fract +* [15]fractional MSB, bit 20 * [16:19] N * [23:20] ? * [24:31] 0x01 @@ -1019,6 +1019,7 @@ static int msi3101_set_usb_adc(struct msi3101_state *s) f_sr = s-ctrl_sampling_rate-val64; reg3 = 0x01c00303; + reg4 = 0x0004; for (div_r_out = 4; div_r_out 16; div_r_out += 2) { f_vco = f_sr * div_r_out * 12; @@ -1030,24 +1031,16 @@ static int msi3101_set_usb_adc(struct msi3101_state *s) div_n = f_vco / (F_REF * DIV_R_IN); div_m = f_vco % (F_REF * DIV_R_IN); + fract = 0x20ul * div_m / (F_REF * DIV_R_IN); reg3 |= div_n 16; reg3 |= (div_r_out / 2 - 1) 10; - reg4 = 0x0ful * div_m / F_REF; - - if (reg4 = 0x0ful) { - dev_dbg(s-udev-dev, - %s: extending fractional part value %08x\n, - __func__, reg4); - reg4 -= 0x0ful; - reg3 |= 1 15; - } - - reg4 = (reg4 8) | 0x04; + reg3 |= ((fract 20) 0x01) 15; /* [20] */ + reg4 |= ((fract 0) 0x0f) 8; /* [19:0] */ dev_dbg(s-udev-dev, - %s: f_sr=%d f_vco=%d div_n=%d div_m=%d div_r_out=%d reg4=%08x\n, - __func__, f_sr, f_vco, div_n, div_m, div_r_out, reg4); + %s: f_sr=%d f_vco=%d div_n=%d div_m=%d div_r_out=%d reg3=%08x reg4=%08x\n, + __func__, f_sr, f_vco, div_n, div_m, div_r_out, reg3, reg4); ret = msi3101_ctrl_msg(s, CMD_WREG, 0x00608008); if (ret) -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 05/16] msi3101: enhance sampling results
It looks like there is some extra data carried to enhance sampling results. When you tune to some some weak/empty channel those bits are always zeroes. When you tune to some channel where is very strong signals those bits are all zeroes. Examining those 32-bits reveals shortly there is 16 pieces of 2-bit numbers. Number seen are 0, 1 and 3 - for some reason 2 is not used. I used that number to shift bits given amount to left, increasing sampling resolution by 3-bits. It may be wrong, but after some testing it still provides better signal. Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/staging/media/msi3101/sdr-msi3101.c | 120 1 file changed, 67 insertions(+), 53 deletions(-) diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index b6a8939..c73f1d9 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -409,6 +409,7 @@ struct msi3101_state { u32 next_sample; /* for track lost packets */ u32 sample; /* for sample rate calc */ unsigned long jiffies; + unsigned int sample_ctrl_bit[4]; }; /* Private functions */ @@ -430,6 +431,51 @@ leave: } /* + * +=== + * | 00-1024 | USB packet + * +=== + * | 00- 03 | sequence number of first sample in that USB packet + * +--- + * | 04- 15 | garbage + * +--- + * | 16- 175 | samples + * +--- + * | 176- 179 | control bits for previous samples + * +--- + * | 180- 339 | samples + * +--- + * | 340- 343 | control bits for previous samples + * +--- + * | 344- 503 | samples + * +--- + * | 504- 507 | control bits for previous samples + * +--- + * | 508- 667 | samples + * +--- + * | 668- 671 | control bits for previous samples + * +--- + * | 672- 831 | samples + * +--- + * | 832- 835 | control bits for previous samples + * +--- + * | 836- 995 | samples + * +--- + * | 996- 999 | control bits for previous samples + * +--- + * | 1000-1024 | garbage + * +--- + * + * Bytes 4 - 7 could have some meaning? + * + * Control bits for previous samples is 32-bit field, containing 16 x 2-bit + * numbers. This results one 2-bit number for 8 samples. It is likely used for + * for bit shifting sample by given bits, increasing actual sampling resolution. + * Number 2 (0b10) was never seen. + * + * 6 * 16 * 2 * 4 = 768 samples. 768 * 4 = 3072 bytes + */ + +/* * Converts signed 10-bit integer into 32-bit IEEE floating point * representation. * Will be exact from 0 to 2^24. Above that, we round towards zero @@ -438,20 +484,24 @@ leave: */ #define I2F_FRAC_BITS 23 #define I2F_MASK ((1 I2F_FRAC_BITS) - 1) -static uint32_t msi3101_int2float(uint32_t x) +static u32 msi3101_convert_sample(struct msi3101_state *s, u16 x, int shift) { - uint32_t msb, exponent, fraction, sign; + u32 msb, exponent, fraction, sign; + s-sample_ctrl_bit[shift]++; /* Zero is special */ if (!x) return 0; - /* Negative / positive value */ - if (x 0x200) { + /* Convert 10-bit two's complement to 13-bit */ + if (x (1 9)) { + x |= ~0U 10; /* set all the rest bits to one */ + x = shift; x = -x; - x = 0x3ff; + x = 0xfff; /* result is 12 bit ... + sign */ sign = 1 31; } else { + x = shift; sign = 0 31; } @@ -476,6 +526,7 @@ static int msi3101_convert_stream(struct msi3101_state *s, u32 *dst, { int i, j, k, l, i_max, dst_len = 0; u16 sample[4]; + u32 bits; #ifdef MSI3101_EXTENSIVE_DEBUG u32 sample_num[3]; #endif @@ -493,6 +544,7 @@ static int msi3101_convert_stream(struct
[PATCH 14/16] msi3101: add stream format 336 I+Q pairs per frame
That one seem to have 12-bit resolution. Use it for streams that has sampling rate 6 = rate (Msps) 8, between 6 and 8Msps. Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/staging/media/msi3101/sdr-msi3101.c | 95 + 1 file changed, 95 insertions(+) diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index 56f9757..c4bd963 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -605,6 +605,98 @@ static int msi3101_convert_stream_384(struct msi3101_state *s, u32 *dst, } /* + * Converts signed 12-bit integer into 32-bit IEEE floating point + * representation. + */ +static u32 msi3101_convert_sample_336(struct msi3101_state *s, u16 x) +{ + u32 msb, exponent, fraction, sign; + + /* Zero is special */ + if (!x) + return 0; + + /* Negative / positive value */ + if (x (1 11)) { + x = -x; + x = 0x7ff; /* result is 11 bit ... + sign */ + sign = 1 31; + } else { + sign = 0 31; + } + + /* Get location of the most significant bit */ + msb = __fls(x); + + /* +* Use a rotate instead of a shift because that works both leftwards +* and rightwards due to the mod(32) behaviour. This means we don't +* need to check to see if we are above 2^24 or not. +*/ + fraction = ror32(x, (msb - I2F_FRAC_BITS) 0x1f) I2F_MASK; + exponent = (127 + msb) I2F_FRAC_BITS; + + return (fraction + exponent) | sign; +} + +static int msi3101_convert_stream_336(struct msi3101_state *s, u32 *dst, + u8 *src, unsigned int src_len) +{ + int i, j, i_max, dst_len = 0; + u16 sample[2]; + u32 sample_num[3]; + + /* There could be 1-3 1024 bytes URB frames */ + i_max = src_len / 1024; + + for (i = 0; i i_max; i++) { + sample_num[i] = src[3] 24 | src[2] 16 | src[1] 8 | src[0] 0; + if (i == 0 s-next_sample != sample_num[0]) { + dev_dbg_ratelimited(s-udev-dev, + %d samples lost, %d %08x:%08x\n, + sample_num[0] - s-next_sample, + src_len, s-next_sample, sample_num[0]); + } + + /* +* Dump all unknown 'garbage' data - maybe we will discover +* someday if there is something rational... +*/ + dev_dbg_ratelimited(s-udev-dev, %*ph\n, 12, src[4]); + + src += 16; + for (j = 0; j 1008; j += 3) { + sample[0] = (src[j + 0] 0xff) 0 | (src[j + 1] 0x0f) 8; + sample[1] = (src[j + 1] 0xf0) 4 | (src[j + 2] 0xff) 4; + + *dst++ = msi3101_convert_sample_336(s, sample[0]); + *dst++ = msi3101_convert_sample_336(s, sample[1]); + } + /* 336 x I+Q 32bit float samples */ + dst_len += 336 * 2 * 4; + src += 1008; + } + + /* calculate samping rate and output it in 10 seconds intervals */ + if ((s-jiffies + msecs_to_jiffies(1)) = jiffies) { + unsigned long jiffies_now = jiffies; + unsigned long msecs = jiffies_to_msecs(jiffies_now) - jiffies_to_msecs(s-jiffies); + unsigned int samples = sample_num[i_max - 1] - s-sample; + s-jiffies = jiffies_now; + s-sample = sample_num[i_max - 1]; + dev_dbg(s-udev-dev, + slen=%d samples=%u msecs=%lu sampling rate=%lu\n, + src_len, samples, msecs, + samples * 1000UL / msecs); + } + + /* next sample (sample = sample + i * 336) */ + s-next_sample = sample_num[i_max - 1] + 336; + + return dst_len; +} + +/* * Converts signed 14-bit integer into 32-bit IEEE floating point * representation. * Will be exact from 0 to 2^24. Above that, we round towards zero @@ -1097,6 +1189,9 @@ static int msi3101_set_usb_adc(struct msi3101_state *s) if (f_sr 600) { s-convert_stream = msi3101_convert_stream_252; reg7 = 0x9407; + } else if (f_sr 800) { + s-convert_stream = msi3101_convert_stream_336; + reg7 = 0x8507; } else { s-convert_stream = msi3101_convert_stream_384; reg7 = 0xa507; -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/16] msi3101: add support for stream format 252 I+Q per frame
That one seems to have 14-bit ADC resolution, wow! It is now used when sampling rate is below 6 Msps. Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/staging/media/msi3101/sdr-msi3101.c | 139 +--- 1 file changed, 125 insertions(+), 14 deletions(-) diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index 4ff6030..a937d00 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -397,6 +397,8 @@ struct msi3101_state { unsigned int vb_full; /* vb is full and packets dropped */ struct urb *urbs[MAX_ISO_BUFS]; + int (*convert_stream) (struct msi3101_state *s, u32 *dst, u8 *src, + unsigned int src_len); /* Controls */ struct v4l2_ctrl_handler ctrl_handler; @@ -484,7 +486,7 @@ leave: */ #define I2F_FRAC_BITS 23 #define I2F_MASK ((1 I2F_FRAC_BITS) - 1) -static u32 msi3101_convert_sample(struct msi3101_state *s, u16 x, int shift) +static u32 msi3101_convert_sample_384(struct msi3101_state *s, u16 x, int shift) { u32 msb, exponent, fraction, sign; s-sample_ctrl_bit[shift]++; @@ -521,7 +523,7 @@ static u32 msi3101_convert_sample(struct msi3101_state *s, u16 x, int shift) #define MSI3101_CONVERT_IN_URB_HANDLER #define MSI3101_EXTENSIVE_DEBUG -static int msi3101_convert_stream(struct msi3101_state *s, u32 *dst, +static int msi3101_convert_stream_384(struct msi3101_state *s, u32 *dst, u8 *src, unsigned int src_len) { int i, j, k, l, i_max, dst_len = 0; @@ -561,10 +563,10 @@ static int msi3101_convert_stream(struct msi3101_state *s, u32 *dst, sample[2] = (src[l + 2] 0xf0) 4 | (src[l + 3] 0x3f) 4; sample[3] = (src[l + 3] 0xc0) 6 | (src[l + 4] 0xff) 2; - *dst++ = msi3101_convert_sample(s, sample[0], (bits (2 * k)) 0x3); - *dst++ = msi3101_convert_sample(s, sample[1], (bits (2 * k)) 0x3); - *dst++ = msi3101_convert_sample(s, sample[2], (bits (2 * k)) 0x3); - *dst++ = msi3101_convert_sample(s, sample[3], (bits (2 * k)) 0x3); + *dst++ = msi3101_convert_sample_384(s, sample[0], (bits (2 * k)) 0x3); + *dst++ = msi3101_convert_sample_384(s, sample[1], (bits (2 * k)) 0x3); + *dst++ = msi3101_convert_sample_384(s, sample[2], (bits (2 * k)) 0x3); + *dst++ = msi3101_convert_sample_384(s, sample[3], (bits (2 * k)) 0x3); /* 4 x 32bit float samples */ dst_len += 4 * 4; @@ -603,6 +605,103 @@ static int msi3101_convert_stream(struct msi3101_state *s, u32 *dst, } /* + * Converts signed 14-bit integer into 32-bit IEEE floating point + * representation. + * Will be exact from 0 to 2^24. Above that, we round towards zero + * as the fractional bits will not fit in a float. (It would be better to + * round towards even as the fpu does, but that is slower.) + */ +#define I2F_FRAC_BITS 23 +#define I2F_MASK ((1 I2F_FRAC_BITS) - 1) +static u32 msi3101_convert_sample_252(struct msi3101_state *s, u16 x) +{ + u32 msb, exponent, fraction, sign; + + /* Zero is special */ + if (!x) + return 0; + + /* Negative / positive value */ + if (x (1 13)) { + x = -x; + x = 0x1fff; /* result is 13 bit ... + sign */ + sign = 1 31; + } else { + sign = 0 31; + } + + /* Get location of the most significant bit */ + msb = __fls(x); + + /* +* Use a rotate instead of a shift because that works both leftwards +* and rightwards due to the mod(32) behaviour. This means we don't +* need to check to see if we are above 2^24 or not. +*/ + fraction = ror32(x, (msb - I2F_FRAC_BITS) 0x1f) I2F_MASK; + exponent = (127 + msb) I2F_FRAC_BITS; + + return (fraction + exponent) | sign; +} + +static int msi3101_convert_stream_252(struct msi3101_state *s, u32 *dst, + u8 *src, unsigned int src_len) +{ + int i, j, i_max, dst_len = 0; + u16 sample[2]; + u32 sample_num[3]; + + /* There could be 1-3 1024 bytes URB frames */ + i_max = src_len / 1024; + + for (i = 0; i i_max; i++) { + sample_num[i] = src[3] 24 | src[2] 16 | src[1] 8 | src[0] 0; + if (i == 0 s-next_sample != sample_num[0]) { + dev_dbg_ratelimited(s-udev-dev, + %d samples lost, %d %08x:%08x\n, + sample_num[0] -
[PATCH 02/16] msi3101: sample is correct term for sample
Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/staging/media/msi3101/sdr-msi3101.c | 32 ++--- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index 46fdb6c..87896ee 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -405,8 +405,8 @@ struct msi3101_state { struct v4l2_ctrl *ctrl_tuner_if; struct v4l2_ctrl *ctrl_tuner_gain; - u32 symbol_received; /* for track lost packets */ - u32 symbol; /* for symbol rate calc */ + u32 next_sample; /* for track lost packets */ + u32 sample; /* for sample rate calc */ unsigned long jiffies; }; @@ -476,18 +476,18 @@ static int msi3101_convert_stream(struct msi3101_state *s, u32 *dst, int i, j, k, l, i_max, dst_len = 0; u16 sample[4]; #ifdef MSI3101_EXTENSIVE_DEBUG - u32 symbol[3]; + u32 sample_num[3]; #endif /* There could be 1-3 1024 bytes URB frames */ i_max = src_len / 1024; for (i = 0; i i_max; i++) { #ifdef MSI3101_EXTENSIVE_DEBUG - symbol[i] = src[3] 24 | src[2] 16 | src[1] 8 | src[0] 0; - if (i == 0 s-symbol_received != symbol[0]) { + sample_num[i] = src[3] 24 | src[2] 16 | src[1] 8 | src[0] 0; + if (i == 0 s-next_sample != sample_num[0]) { dev_dbg(s-udev-dev, - %d symbols lost, %d %08x:%08x\n, - symbol[0] - s-symbol_received, - src_len, s-symbol_received, symbol[0]); + %d samples lost, %d %08x:%08x\n, + sample_num[0] - s-next_sample, + src_len, s-next_sample, sample_num[0]); } #endif src += 16; @@ -520,21 +520,21 @@ static int msi3101_convert_stream(struct msi3101_state *s, u32 *dst, } #ifdef MSI3101_EXTENSIVE_DEBUG - /* calculate symbol rate and output it in 10 seconds intervals */ + /* calculate samping rate and output it in 10 seconds intervals */ if ((s-jiffies + msecs_to_jiffies(1)) = jiffies) { unsigned long jiffies_now = jiffies; unsigned long msecs = jiffies_to_msecs(jiffies_now) - jiffies_to_msecs(s-jiffies); - unsigned int symbols = symbol[i_max - 1] - s-symbol; + unsigned int samples = sample_num[i_max - 1] - s-sample; s-jiffies = jiffies_now; - s-symbol = symbol[i_max - 1]; + s-sample = sample_num[i_max - 1]; dev_dbg(s-udev-dev, - slen=%d symbols=%u msecs=%lu symbolrate=%lu\n, - src_len, symbols, msecs, - symbols * 1000UL / msecs); + slen=%d samples=%u msecs=%lu sampling rate=%lu\n, + src_len, samples, msecs, + samples * 1000UL / msecs); } - /* last received symbol (symbol = symbol + i * 384) */ - s-symbol_received = symbol[i_max - 1] + 384; + /* next sample (sample = sample + i * 384) */ + s-next_sample = sample_num[i_max - 1] + 384; #endif return dst_len; } -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 16/16] msi3101: a lot of small cleanups
Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/staging/media/msi3101/sdr-msi3101.c | 141 1 file changed, 40 insertions(+), 101 deletions(-) diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index e7a21a2..a3cc4c6 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -16,20 +16,36 @@ *You should have received a copy of the GNU General Public License along *with this program; if not, write to the Free Software Foundation, Inc., *51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * That driver is somehow based of pwc driver: + * (C) 1999-2004 Nemosoft Unv. + * (C) 2004-2006 Luc Saillard (l...@saillard.org) + * (C) 2011 Hans de Goede hdego...@redhat.com + * + * Development tree of that driver will be on: + * http://git.linuxtv.org/anttip/media_tree.git/shortlog/refs/heads/mirics + * + * GNU Radio plugin gr-kernel for device usage will be on: + * http://git.linuxtv.org/anttip/gr-kernel.git + * + * TODO: + * I will look these: + * - split RF tuner and USB ADC interface to own drivers (msi2500 and msi001) + * - move controls to V4L2 API + * + * Help is very highly welcome for these + all the others you could imagine: + * - use libv4l2 for stream format conversions + * - gr-kernel: switch to v4l2_mmap (current read eats a lot of cpu) + * - SDRSharp support */ -#include linux/kernel.h #include linux/module.h -#include linux/init.h #include linux/slab.h -#include linux/input.h -#include linux/videodev2.h #include media/v4l2-device.h #include media/v4l2-ioctl.h #include media/v4l2-ctrls.h #include media/v4l2-event.h #include linux/usb.h -#include linux/mutex.h #include media/videobuf2-vmalloc.h struct msi3101_gain { @@ -358,9 +374,9 @@ static const struct msi3101_gain msi3101_gain_lut_1000[] = { #define ISO_FRAMES_PER_DESC (8) #define ISO_MAX_FRAME_SIZE (3 * 1024) #define ISO_BUFFER_SIZE (ISO_FRAMES_PER_DESC * ISO_MAX_FRAME_SIZE) - #define MAX_ISOC_ERRORS 20 +/* TODO: These should be moved to V4L2 API */ #define MSI3101_CID_SAMPLING_MODE ((V4L2_CID_USER_BASE | 0xf000) + 0) #define MSI3101_CID_SAMPLING_RATE ((V4L2_CID_USER_BASE | 0xf000) + 1) #define MSI3101_CID_SAMPLING_RESOLUTION ((V4L2_CID_USER_BASE | 0xf000) + 2) @@ -373,8 +389,6 @@ static const struct msi3101_gain msi3101_gain_lut_1000[] = { struct msi3101_frame_buf { struct vb2_buffer vb; /* common v4l buffer stuff -- must be first */ struct list_head list; - void *data; /* raw data from USB device */ - int filled; /* number of bytes filled to *data */ }; struct msi3101_state { @@ -478,14 +492,19 @@ leave: */ /* - * Converts signed 10-bit integer into 32-bit IEEE floating point - * representation. - * Will be exact from 0 to 2^24. Above that, we round towards zero - * as the fractional bits will not fit in a float. (It would be better to - * round towards even as the fpu does, but that is slower.) + * Integer to 32-bit IEEE floating point representation routine is taken + * from Radeon R600 driver (drivers/gpu/drm/radeon/r600_blit_kms.c). + * + * TODO: Currently we do conversion here in Kernel, but in future that will + * be moved to the libv4l2 library as video format conversions are. */ #define I2F_FRAC_BITS 23 #define I2F_MASK ((1 I2F_FRAC_BITS) - 1) + +/* + * Converts signed ~10+3-bit integer into 32-bit IEEE floating point + * representation. + */ static u32 msi3101_convert_sample_384(struct msi3101_state *s, u16 x, int shift) { u32 msb, exponent, fraction, sign; @@ -510,35 +529,26 @@ static u32 msi3101_convert_sample_384(struct msi3101_state *s, u16 x, int shift) /* Get location of the most significant bit */ msb = __fls(x); - /* -* Use a rotate instead of a shift because that works both leftwards -* and rightwards due to the mod(32) behaviour. This means we don't -* need to check to see if we are above 2^24 or not. -*/ fraction = ror32(x, (msb - I2F_FRAC_BITS) 0x1f) I2F_MASK; exponent = (127 + msb) I2F_FRAC_BITS; return (fraction + exponent) | sign; } -#define MSI3101_CONVERT_IN_URB_HANDLER -#define MSI3101_EXTENSIVE_DEBUG static int msi3101_convert_stream_384(struct msi3101_state *s, u32 *dst, u8 *src, unsigned int src_len) { int i, j, k, l, i_max, dst_len = 0; u16 sample[4]; u32 bits; -#ifdef MSI3101_EXTENSIVE_DEBUG u32 sample_num[3]; -#endif + /* There could be 1-3 1024 bytes URB frames */ i_max = src_len / 1024; for (i = 0; i i_max; i++) { -#ifdef MSI3101_EXTENSIVE_DEBUG sample_num[i] = src[3] 24 | src[2] 16 | src[1] 8 | src[0] 0; if (i == 0 s-next_sample != sample_num[0]) { - dev_dbg(s-udev-dev, +
[PATCH 06/16] msi3101: fix stream re-start halt
Restarting stream fails quite often. Small delay is between urb killing and stream stop command - likely to give harware some time to process killed urbs. Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/staging/media/msi3101/sdr-msi3101.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index c73f1d9..2180bf8 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -959,7 +959,7 @@ static int msi3101_ctrl_msg(struct msi3101_state *s, u8 cmd, u32 data) msi3101_dbg_usb_control_msg(s-udev, request, requesttype, value, index, NULL, 0); - ret = usb_control_msg(s-udev, usb_rcvctrlpipe(s-udev, 0), + ret = usb_control_msg(s-udev, usb_sndctrlpipe(s-udev, 0), request, requesttype, value, index, NULL, 0, 2000); if (ret) @@ -1300,12 +1300,15 @@ static int msi3101_stop_streaming(struct vb2_queue *vq) if (mutex_lock_interruptible(s-v4l2_lock)) return -ERESTARTSYS; - msi3101_ctrl_msg(s, CMD_STOP_STREAMING, 0); - if (s-udev) msi3101_isoc_cleanup(s); msi3101_cleanup_queued_bufs(s); + + /* according to tests, at least 700us delay is required */ + msleep(20); + msi3101_ctrl_msg(s, CMD_STOP_STREAMING, 0); + mutex_unlock(s-v4l2_lock); return 0; -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/16] msi3101: improve tuner synth calc step size
Allow stepless synthesizer configuration. With that change we lose precision a little bit, as it is now between +-500Hz from the target. It could be better but on that case calculation algorithm goes more complex and atm there is more important things to do. Two approach to improve which comes to my mind are: 1) select and use biggest suitable step 2) use greatest common divisor algo to find divisor for thresh frac when possible to avoid rounding errors, which is root of cause of current +-500Hz inaccuracy. Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/staging/media/msi3101/sdr-msi3101.c | 44 ++--- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index 04bbbdf..4ff6030 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -1079,9 +1079,10 @@ err: static int msi3101_set_tuner(struct msi3101_state *s) { - int i, ret, len; - u32 reg, synthstep, thresh, n, frac; - u64 fsynth; + int ret, i, len; + unsigned int n, m, thresh, frac, vco_step, tmp; + u32 reg; + u64 f_vco; u8 mode, lo_div; const struct msi3101_gain *gain_lut; static const struct { @@ -1176,21 +1177,30 @@ static int msi3101_set_tuner(struct msi3101_state *s) if (i == ARRAY_SIZE(bandwidth_lut)) goto err; - #define FSTEP 1 - #define FREF1 2400 - fsynth = (rf_freq + 0) * lo_div; - synthstep = FSTEP * lo_div; - thresh = (FREF1 * 4) / synthstep; - n = fsynth / (FREF1 * 4); - frac = thresh * (fsynth % (FREF1 * 4)) / (FREF1 * 4); +#define F_OUT_STEP 1 +#define R_REF 4 +#define F_IF 0 + f_vco = (rf_freq + F_IF) * lo_div; + n = f_vco / (F_REF * R_REF); + m = f_vco % (F_REF * R_REF); - if (thresh 4095 || n 63 || frac 4095) { - dev_dbg(s-udev-dev, - %s: synth setup failed rf=%d thresh=%d n=%d frac=%d\n, - __func__, rf_freq, thresh, n, frac); - ret = -EINVAL; - goto err; - } + vco_step = F_OUT_STEP * lo_div; + thresh = (F_REF * R_REF) / vco_step; + frac = 1ul * thresh * m / (F_REF * R_REF); + + /* Divide to reg max. After that RF resolution will be +-500Hz. */ + tmp = DIV_ROUND_UP(thresh, 4095); + thresh = DIV_ROUND_CLOSEST(thresh, tmp); + frac = DIV_ROUND_CLOSEST(frac, tmp); + + /* calc real RF set */ + tmp = 1ul * F_REF * R_REF * n; + tmp += 1ul * F_REF * R_REF * frac / thresh; + tmp /= lo_div; + + dev_dbg(s-udev-dev, + %s: rf=%u:%u n=%d thresh=%d frac=%d\n, + __func__, rf_freq, tmp, n, thresh, frac); ret = msi3101_tuner_write(s, 0x0e); ret = msi3101_tuner_write(s, 0x03); -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 04/16] msi3101: add sampling mode control
Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/staging/media/msi3101/sdr-msi3101.c | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index 4de4f50..b6a8939 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -361,8 +361,9 @@ static const struct msi3101_gain msi3101_gain_lut_1000[] = { #define MAX_ISOC_ERRORS 20 -#define MSI3101_CID_SAMPLING_RATE ((V4L2_CID_USER_BASE | 0xf000) + 0) -#define MSI3101_CID_SAMPLING_RESOLUTION ((V4L2_CID_USER_BASE | 0xf000) + 1) +#define MSI3101_CID_SAMPLING_MODE ((V4L2_CID_USER_BASE | 0xf000) + 0) +#define MSI3101_CID_SAMPLING_RATE ((V4L2_CID_USER_BASE | 0xf000) + 1) +#define MSI3101_CID_SAMPLING_RESOLUTION ((V4L2_CID_USER_BASE | 0xf000) + 2) #define MSI3101_CID_TUNER_RF ((V4L2_CID_USER_BASE | 0xf000) + 10) #define MSI3101_CID_TUNER_BW ((V4L2_CID_USER_BASE | 0xf000) + 11) #define MSI3101_CID_TUNER_IF ((V4L2_CID_USER_BASE | 0xf000) + 12) @@ -1418,6 +1419,7 @@ static int msi3101_s_ctrl(struct v4l2_ctrl *ctrl) ctrl-minimum, ctrl-maximum, ctrl-step); switch (ctrl-id) { + case MSI3101_CID_SAMPLING_MODE: case MSI3101_CID_SAMPLING_RATE: case MSI3101_CID_SAMPLING_RESOLUTION: ret = 0; @@ -1455,6 +1457,18 @@ static int msi3101_probe(struct usb_interface *intf, struct usb_device *udev = interface_to_usbdev(intf); struct msi3101_state *s = NULL; int ret; + static const char * const ctrl_sampling_mode_qmenu_strings[] = { + Quadrature Sampling, + NULL, + }; + static const struct v4l2_ctrl_config ctrl_sampling_mode = { + .ops= msi3101_ctrl_ops, + .id = MSI3101_CID_SAMPLING_MODE, + .type = V4L2_CTRL_TYPE_MENU, + .flags = V4L2_CTRL_FLAG_INACTIVE, + .name = Sampling Mode, + .qmenu = ctrl_sampling_mode_qmenu_strings, + }; static const struct v4l2_ctrl_config ctrl_sampling_rate = { .ops= msi3101_ctrl_ops, .id = MSI3101_CID_SAMPLING_RATE, @@ -1553,7 +1567,8 @@ static int msi3101_probe(struct usb_interface *intf, video_set_drvdata(s-vdev, s); /* Register controls */ - v4l2_ctrl_handler_init(s-ctrl_handler, 6); + v4l2_ctrl_handler_init(s-ctrl_handler, 7); + v4l2_ctrl_new_custom(s-ctrl_handler, ctrl_sampling_mode, NULL); s-ctrl_sampling_rate = v4l2_ctrl_new_custom(s-ctrl_handler, ctrl_sampling_rate, NULL); v4l2_ctrl_new_custom(s-ctrl_handler, ctrl_sampling_resolution, NULL); s-ctrl_tuner_rf = v4l2_ctrl_new_custom(s-ctrl_handler, ctrl_tuner_rf, NULL); -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe 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 07/16] msi3101: add 2040:d300 Hauppauge WinTV 133559 LF
Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/staging/media/msi3101/sdr-msi3101.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index 2180bf8..152415a 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -1635,6 +1635,7 @@ err_free_mem: /* USB device ID list */ static struct usb_device_id msi3101_id_table[] = { { USB_DEVICE(0x1df7, 0x2500) }, + { USB_DEVICE(0x2040, 0xd300) }, /* Hauppauge WinTV 133559 LF */ { } }; MODULE_DEVICE_TABLE(usb, msi3101_id_table); -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 08/16] msi3101: add debug dump for unknown stream data
Dump all unknown 'garbage' data - maybe we will discover someday if there is something rational... Also fix comment in USB frame description. Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/staging/media/msi3101/sdr-msi3101.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index 152415a..2b73fc1 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -432,7 +432,7 @@ leave: /* * +=== - * | 00-1024 | USB packet + * | 00-1023 | USB packet * +=== * | 00- 03 | sequence number of first sample in that USB packet * +--- @@ -462,7 +462,7 @@ leave: * +--- * | 996- 999 | control bits for previous samples * +--- - * | 1000-1024 | garbage + * | 1000-1023 | garbage * +--- * * Bytes 4 - 7 could have some meaning? @@ -522,7 +522,7 @@ static u32 msi3101_convert_sample(struct msi3101_state *s, u16 x, int shift) #define MSI3101_CONVERT_IN_URB_HANDLER #define MSI3101_EXTENSIVE_DEBUG static int msi3101_convert_stream(struct msi3101_state *s, u32 *dst, - const u8 *src, unsigned int src_len) + u8 *src, unsigned int src_len) { int i, j, k, l, i_max, dst_len = 0; u16 sample[4]; @@ -541,6 +541,15 @@ static int msi3101_convert_stream(struct msi3101_state *s, u32 *dst, sample_num[0] - s-next_sample, src_len, s-next_sample, sample_num[0]); } + + /* +* Dump all unknown 'garbage' data - maybe we will discover +* someday if there is something rational... +*/ + dev_dbg_ratelimited(s-udev-dev, + %*ph %*ph\n, 12, src[4], 24, src[1000]); + memset(src[4], 0, 12); + memset(src[1000], 0, 24); #endif src += 16; for (j = 0; j 6; j++) { -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 03/16] msi3101: fix sampling rate calculation
These calculations seems to give 100% correct results. Calculation formulas could be still a little bit wrong as I have no knowledge what kind of dividers, multipliers and VCO limits there really is. Signed-off-by: Antti Palosaari cr...@iki.fi --- drivers/staging/media/msi3101/sdr-msi3101.c | 58 +++-- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index 87896ee..4de4f50 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -960,16 +960,14 @@ static int msi3101_tuner_write(struct msi3101_state *s, u32 data) }; #define F_REF 2400 +#define DIV_R_IN 2 static int msi3101_set_usb_adc(struct msi3101_state *s) { - int ret, div_n, div_m, div_r_out, f_sr; + int ret, div_n, div_m, div_r_out, f_sr, f_vco; u32 reg4, reg3; /* -* FIXME: Synthesizer config is just a educated guess... -* It seems to give reasonable values when N is 5-12 and output -* divider R is 2, which means sampling rates 5-12 Msps in practise. +* Synthesizer config is just a educated guess... * -* reg 3 ADC synthesizer config * [7:0] 0x03, register address * [8] 1, always * [9] ? @@ -984,42 +982,48 @@ static int msi3101_set_usb_adc(struct msi3101_state *s) * output divider * val div * 0 - (invalid) -* 1 2 -* 2 3 -* 3 4 -* 4 5 -* 5 6 -* 6 7 -* 7 8 +* 1 4 +* 2 6 +* 3 8 +* 410 +* 512 +* 614 +* 716 +* +* VCO 20200 - 72000++ */ f_sr = s-ctrl_sampling_rate-val64; reg3 = 0x01c00303; - for (div_n = 12; div_n 5; div_n--) { - if (f_sr = div_n * 100) + for (div_r_out = 4; div_r_out 16; div_r_out += 2) { + f_vco = f_sr * div_r_out * 12; + dev_dbg(s-udev-dev, %s: div_r_out=%d f_vco=%d\n, + __func__, div_r_out, f_vco); + if (f_vco = 20200) break; } - reg3 |= div_n 16; - - for (div_r_out = 2; div_r_out 8; div_r_out++) { - if (f_sr = div_n * F_REF / div_r_out / 12) - break; - } + div_n = f_vco / (F_REF * DIV_R_IN); + div_m = f_vco % (F_REF * DIV_R_IN); - reg3 |= (div_r_out - 1) 10; - div_m = f_sr % (div_n * F_REF / div_r_out / 12); + reg3 |= div_n 16; + reg3 |= (div_r_out / 2 - 1) 10; + reg4 = 0x0ful * div_m / F_REF; - if (div_m = 50) { + if (reg4 = 0x0ful) { + dev_dbg(s-udev-dev, + %s: extending fractional part value %08x\n, + __func__, reg4); + reg4 -= 0x0ful; reg3 |= 1 15; - div_m -= 50; } - reg4 = ((div_m * 0x0ful / 50) 8) | 0x04; + reg4 = (reg4 8) | 0x04; - dev_dbg(s-udev-dev, %s: sr=%d n=%d m=%d r_out=%d reg4=%08x\n, - __func__, f_sr, div_n, div_m, div_r_out, reg4); + dev_dbg(s-udev-dev, + %s: f_sr=%d f_vco=%d div_n=%d div_m=%d div_r_out=%d reg4=%08x\n, + __func__, f_sr, f_vco, div_n, div_m, div_r_out, reg4); ret = msi3101_ctrl_msg(s, CMD_WREG, 0x00608008); if (ret) -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
PROLINK PixelView PlayTV Cinema BX1500 TV card
Hi, I'm copying my post from the Ubuntu Forums: // starts here Hi, I'm running Linux Mint 12 32-bit (the equivalent of Ubuntu 11.10) with the 3.2.49 kernel and I have the TV card from the title. Manufacturer's website: http://www.prolink.com.tw/style/frame/templates15/product_detail.asp?lang=2customer_id=1470name_id=36169rid=17744id=79936content_set=color_5 I have properly installed the latest V4L drivers following this guide: http://linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4L-DVB_Device_Drivers However, it looks like the driver doesn't have support for this particular card as noted in the first warning in the above article. The proper kernel module (cx23885) loads, but it doesn't do anything. I've tried it with MythTV, Kaffeine and VLC and all of them report that there is no capture card. This is the output of lspci -v: 04:00.0 Multimedia video controller: Conexant Systems, Inc. CX23885 PCI Video and Audio Decoder (rev 02) Subsystem: PROLINK Microsystems Corp Device 4980 Flags: bus master, fast devsel, latency 0, IRQ 16 Memory at fbe0 (64-bit, non-prefetchable) [size=2M] Capabilities: [40] Express Endpoint, MSI 00 Capabilities: [80] Power Management version 2 Capabilities: [90] Vital Product Data Capabilities: [a0] MSI: Enable- Count=1/1 Maskable- 64bit+ Kernel driver in use: cx23885 Kernel modules: cx23885 The output of dmesg is here: http://pastebin.com/yVK2NE3u Trying to modprobe the module with other card ids just spits out a bunch of errors in dmesg. // ends here I have been googling a lot and found no information whatsoever about this and similar PlayTV Cinema cards on Linux. After receiving no reply on Ubuntu Forums, on linuxtv.org wiki I found that I can contact LMML directly about driver support. So I was wondering if there is any way to add support for this and similar cards to the cx23885 driver. I am willing to provide more information if necessary. -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Mail Back If Interested!
Good Day, RE:INVESTMENT / BUSINESS PARTNERSHIP PROPOSAL. I represent a group of company based in the Gulf Region with access to over 270 Million Euros and we are seeking means of expanding and relocating our business interest abroad in the following sectors: oil/Gas, banking, real estate, stock speculation and mining, transportation, health sector and tobacco, Communication Services, Agriculture Forestry Fishing, thus any sector. If you have a solid background and idea of making good profit in any of the mentioned business sectors or any other business in your country, Please write me for possible business co-operation. More so, we are ready to facilitate and fund any business that is capable of generating 10% annual return on investment (AROI) Joint Venture partnership and Hard loan funding can also be considered. I am confident that you will give your consideration to this proposal and respond positively within a short period of time. I am available to discuss this proposal with you and to answer any questions you may have in regard to this investment. As soon as you give your positive response to this proposal, I will not hesitate in sending you the details information of this great investment partnership opportunity. Email contact: I look forward to discussing this opportunity further with you. Sincerely, Willi Tenisch -- To unsubscribe from this list: send the line unsubscribe 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: Syntek webcams and out-of-tree driver
On Tuesday 06 August 2013 08:10:38 Hans de Goede wrote: Hi, On 08/05/2013 11:19 PM, Ondrej Zary wrote: Hello, the in-kernel stkwebcam driver (by Jaime Velasco Juan and Nicolas VIVIEN) supports only two webcam types (USB IDs 0x174f:0xa311 and 0x05e1:0x0501). There are many other Syntek webcam types that are not supported by this driver (such as 0x174f:0x6a31 in Asus F5RL laptop). There is an out-of-tree GPL driver called stk11xx (by Martin Roos and also Nicolas VIVIEN) at http://sourceforge.net/projects/syntekdriver/ which supports more webcams. It can be even compiled for the latest kernels using the patch below and seems to work somehow (slow and buggy but better than nothing) with the Asus F5RL. I took a quick look and there are a number of issues with this driver: 1) It conflicts usb-id wise with the new stk1160 driver (which supports usb-id 05e1:0408) so support for that usb-id, and any code only used for that id will need to be removed 2) seems to work somehow (slow and buggy) is not really the quality we aim for with in kernel drivers. We definitely will want to remove any usb-ids, and any code only used for those ids, where there is overlap with the existing stkwebcam driver, to avoid regressions 3) It does in kernel bayer decoding, this is not acceptable, it needs to be modified to produce buffers with raw bayer data (libv4l will take care of the bater decoding in userspace). 4) It is not using any of the new kernel infrastructure we have been adding over time, like the control-framework, videobuf2, etc. It would be best to convert this to a gspca sub driver (of which there are many already, which can serve as examples), so that it will use all the existing framework code. Here's a proof of concept that this can be done. HW dependent code copied from stk11xx and modified a bit. Userspace bayer decoding works fine - I get correct image in cheese (or mplayer with LD_PRELOAD)! I've also found the STK1135 datasheet! http://wenku.baidu.com/view/028c3459be23482fb4da4c5d https://anonfiles.com/file/3b813f8e4c848ed26aaec804e0afa092 So I can clean up the driver now. --- drivers/media/usb/gspca/Kconfig |9 + drivers/media/usb/gspca/Makefile |2 + drivers/media/usb/gspca/stk1135.c | 968 + 3 files changed, 979 insertions(+), 0 deletions(-) create mode 100644 drivers/media/usb/gspca/stk1135.c diff --git a/drivers/media/usb/gspca/Kconfig b/drivers/media/usb/gspca/Kconfig index 6345f93..4f0c6d5 100644 --- a/drivers/media/usb/gspca/Kconfig +++ b/drivers/media/usb/gspca/Kconfig @@ -338,6 +338,15 @@ config USB_GSPCA_STK014 To compile this driver as a module, choose M here: the module will be called gspca_stk014. +config USB_GSPCA_STK1135 + tristate Syntek STK1135 USB Camera Driver + depends on VIDEO_V4L2 USB_GSPCA + help + Say Y here if you want support for cameras based on the STK1135 chip. + + To compile this driver as a module, choose M here: the + module will be called gspca_stk1135. + config USB_GSPCA_STV0680 tristate STV0680 USB Camera Driver depends on VIDEO_V4L2 USB_GSPCA diff --git a/drivers/media/usb/gspca/Makefile b/drivers/media/usb/gspca/Makefile index c901da0..5855131 100644 --- a/drivers/media/usb/gspca/Makefile +++ b/drivers/media/usb/gspca/Makefile @@ -34,6 +34,7 @@ obj-$(CONFIG_USB_GSPCA_SQ905C) += gspca_sq905c.o obj-$(CONFIG_USB_GSPCA_SQ930X) += gspca_sq930x.o obj-$(CONFIG_USB_GSPCA_SUNPLUS) += gspca_sunplus.o obj-$(CONFIG_USB_GSPCA_STK014) += gspca_stk014.o +obj-$(CONFIG_USB_GSPCA_STK1135) += gspca_stk1135.o obj-$(CONFIG_USB_GSPCA_STV0680) += gspca_stv0680.o obj-$(CONFIG_USB_GSPCA_T613) += gspca_t613.o obj-$(CONFIG_USB_GSPCA_TOPRO)+= gspca_topro.o @@ -78,6 +79,7 @@ gspca_sq905-objs:= sq905.o gspca_sq905c-objs := sq905c.o gspca_sq930x-objs := sq930x.o gspca_stk014-objs := stk014.o +gspca_stk1135-objs := stk1135.o gspca_stv0680-objs := stv0680.o gspca_sunplus-objs := sunplus.o gspca_t613-objs := t613.o diff --git a/drivers/media/usb/gspca/stk1135.c b/drivers/media/usb/gspca/stk1135.c new file mode 100644 index 000..ce17202 --- /dev/null +++ b/drivers/media/usb/gspca/stk1135.c @@ -0,0 +1,968 @@ +/* + * Syntek STK1135 subdriver + * + * Copyright (c) 2013 Ondrej Zary + * + * Based on Syntekdriver by Nicolas VIVIEN: + * http://syntekdriver.sourceforge.net + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have
Re: [PATCH] V4L: Drop meaningless video_is_registered() call in v4l2_open()
Hi Hans and Sylwester, On Wednesday 07 August 2013 19:49:53 Hans Verkuil wrote: On 08/07/2013 06:49 PM, Sylwester Nawrocki wrote: On 08/02/2013 03:00 PM, Hans Verkuil wrote: Hi Sylwester, The patch is good, but I have some issues with the commit message itself. Thanks a lot for the detailed explanation, I just wrote this a bit longish changelog to possibly get some feedback and to better understand what is exactly going on. Currently the v4l2-core looks like a racing disaster to me. On 08/02/2013 02:27 PM, Sylwester Nawrocki wrote: As it currently stands this code doesn't protect against any races between video device open() and its unregistration. Races could be avoided by doing the video_is_registered() check protected by the core mutex, while the video device unregistration is also done with this mutex held. The video_unregister_device() is called completely asynchronously, particularly in the case of usb drivers. So it was never the goal of the video_is_registered() to be fool proof, since that isn't possible, nor is that necessary. The goal was that the v4l2 core would use it for the various file operations and ioctls as a quick check whether the device was unregistered and to return the correct error. This prevents drivers from having to do the same thing. OK, I think I just myself used this video_is_registered() flag for some more stuff, by surrounding it with mutex_lock/mutex_unlock and putting more stuff in between, like media_entity_cleanup(). You can't do that, because there are most likely still filehandles open or even ioctls being executed. Cleanup happens in the release function(s) when the kref goes to 0. And this probably led me astray for a while, thinking that video_is_registered() was intended to be used synchronously. For example see fimc_lite_subdev_unregistered() in drivers/media/platform/ exynos4-is/fimc-lite.c. But as you said video_is_registered() is fully asynchronous. Actually I'm trying to fix a nasty race between deferred driver probing and video device open(). The problem is that video open() callback can be called after driver remove() callback was invoked. How is that possible? The video_device_register must be the last thing in the probe function. If it succeeds, then the probe must succeed as well. Note that I now realize that this might fail in the case of multiple device nodes being registered. We never had problems with that in the past, but in theory you can the race condition you mention in that scenario. The correct approach here would probably be to always return 0 in probe() if only some of the video_device_register calls fail. H... Returning success in probe when probing partly fails doesn't sound very good to me. Once you call video_device_register() you should be prepared to handle userspace calls. The device node can be opened, in which case the module refcount will be incremented, but probe() can still fail. However, the video device becomes refcounted as soon as it's registered, so drivers should only release resources in the release callback. This would unfortunately mean that the devm_* helpers can't be used. I would be surprised if this problem was specific to V4L2. It might be something we should try to solve with the help of the device core. Anyway, assuming that only one device node is created, then I can't see how you can get a race condition here. Any open() call will increase the module's refcount, making it impossible to unload. As far as I can tell, once you call rmmod it should no longer be possible to open() an device node whose struct file_operations owner is that module (i.e. the owner field of the file_operations struct points to that module). Looking at the way fs/char_dev is implemented, that seems to be correctly handled by the kernel core. This issue is actually not only related to deferred probing. It can be also triggered by driver module removal or through driver's sysfs unbind attribute. Let's assume following scenario: - a driver module is loaded - driver probe is called, it registers video device, - udev opens /dev/video - after mutex_unlock(videodev_lock); call in v4l2_open() in v4l2-core/ v4l2-dev.c something fails in probe() And that shouldn't happen. That's the crucial bit: under which scenario does this happen for you? If there is a control path where you do create a working device node, but the probe fails, then that will indeed cause all sorts of problems. But it shouldn't get in that situation (except I think in the case of multiple device nodes, which is something I need to think about). and it unwinds, probe callback exits and the driver code code calls dev_set_drvdata(dev, NULL); as shown below. static int really_probe(struct device *dev, struct device_driver *drv) { ... pr_debug(bus: '%s': %s: probing driver %s with device
[GIT PULL 3.12] e4000 fixes
The following changes since commit 1c26190a8d492adadac4711fe5762d46204b18b0: [media] exynos4-is: Correct colorspace handling at FIMC-LITE (2013-06-28 15:33:27 -0300) are available in the git repository at: git://linuxtv.org/anttip/media_tree.git rtl2832u_e4000 for you to fetch changes up to 9b3fd8a3ff7ab8b02ef29fa17744323e786b4f2f: e4000: change remaining pr_warn to dev_warn (2013-07-26 13:00:02 +0300) Antti Palosaari (4): e4000: implement DC offset correction e4000: use swap() macro e4000: make checkpatch.pl happy e4000: change remaining pr_warn to dev_warn drivers/media/tuners/e4000.c | 82 -- drivers/media/tuners/e4000.h | 2 +- 2 files changed, 61 insertions(+), 23 deletions(-) -- http://palosaari.fi/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT PULL 3.12] DVB USB v2 get rid of deferred probe
The following changes since commit 1c26190a8d492adadac4711fe5762d46204b18b0: [media] exynos4-is: Correct colorspace handling at FIMC-LITE (2013-06-28 15:33:27 -0300) are available in the git repository at: git://linuxtv.org/anttip/media_tree.git dvb_usb_v2 for you to fetch changes up to c42f1abc409a87eb7791105ba9e1125924820655: dvb_usb_v2: get rid of deferred probe (2013-08-08 01:43:43 +0300) Antti Palosaari (2): lme2510: do not use bInterfaceNumber from dvb_usb_v2 dvb_usb_v2: get rid of deferred probe drivers/media/usb/dvb-usb-v2/dvb_usb.h | 5 - drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 134 + drivers/media/usb/dvb-usb-v2/lmedm04.c | 2 +- 3 files changed, 46 insertions(+), 95 deletions(-) -- http://palosaari.fi/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: EM28xx - MSI Digivox Trio - almost working.
On 20-06-13 07:14, P. van Gaans wrote: Hi all, (device: http://linuxtv.org/wiki/index.php/MSI_DigiVox_Trio) Thanks to the message from Philip Pemberton I was able to try loading the em28xx driver myself using: sudo modprobe em28xx card=NUMBER echo eb1a 2885 | sudo tee /sys/bus/usb/drivers/em28xx/new_id Here are the results for NUMBER: Card=79 (Terratec Cinergy H5): works, less corruption than card=87, just some blocks every few seconds. Attenuators didn't help. Card=81 (Hauppauge WinTV HVR 930C): doesn't work, no /dev/dvb adapter Card=82 (Terratec Cinergy HTC Stick): similar to card=87 Card=85 (PCTV QuatroStick (510e)): constantly producing i2c read errors, doesn't work Card=86 (PCTV QuatroStick nano (520e): same Card=87 (Terratec Cinergy HTC USB XS): stick works and scans channels, but reception is bugged with corruption. It's like having a DVB-T antenna that's just not good enough, except this is DVB-C and my signal is excellent. Attenuators didn't help. Card=88 (C3 Tech Digital Duo HDTV/SDTV USB): doesn't work, no /dev/dvb adapter So with card=79 it's really close to working. What else can I do? Best regareds, P. van Gaans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Hi all, Success! While I never succeeded in figuring out how the sniffing is supposed to be done (how to get any output from those scripts anyway? how to load the debug module in such away it actually works? run on native linux, or a windows VM on linux, or snoop in windows en run the script on linux? you get the picture) I just noticed a little notice on the DVB-C USB wiki page: If you are experiencing problems with USB devices, it may not be the fault of the tuner. For example AMD 700 series chipsets (e.g. 780G) have a problem with USB ports which results in tuners working or partially working or not working at all. I was actually not even testing on an AMD 700 series but on an AMD 600 series. And a somewhat older kernel, with latest v4l-dvb compiled. So here's what I did: I took the Digivox Trio, plugged it in an Ivy Bridgy computer with Lubuntu 13.04 (stock kernel, stock v4l-dvb, Lubuntu appears to come with the firmware preloaded), load the em28xx driver as if the Digivox were a Terratec H5 and watched 5 minutes or so, flawless. I will continue to test and watch some longer programs, but right now it appears it is safe to say the Digivox Trio can be supported by simply treating as an H5. Best regards, P. van Gaans -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Can I put a V4L2 soc camera driver under other subsystem directory?
Hi Guennadi and LMML, I'm working on a camera controller driver for Tegra, which is using soc_camera. But we also need to use Tegra specific host1x interface like syncpt APIs. Since host1x is quite Tegra specific framework which is in drivers/gpu/host1x and has several host1x's client driver like graphic 2D driver, my v4l2 soc_camera driver is also a host1x client driver. Right now host1x does not expose any global include header files like API in the kernel, because no other users. So we plan to put all host1x related driver together, is that OK for us to put our Tegra soc_camera driver into drivers/gpu/host1x/camera or similar? I guess besides it will introduce some extra maintenance it should be OK, right? Thanks, -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
Re: [PATCH] [media] exynos-gsc: fix s2r functionality
Hi Sylwester, On Wed, Aug 7, 2013 at 10:23 PM, Sylwester Nawrocki s.nawro...@samsung.com wrote: On 08/07/2013 02:53 PM, Arun Kumar K wrote: From: Prathyush K prathyus...@samsung.com When gsc is in runtime suspended state, there is no need to call m2m_suspend during suspend and similarily, there is no need to call s/similarily/similarly. I'll fix that typo when applying. Thanks. m2m_resume during resume if already in runtime suspended state. This patch adds the necessary conditions to achieve this. Signed-off-by: Prathyush K prathyus...@samsung.com Signed-off-by: Arun Mankuzhi aru...@samsung.com Signed-off-by: Arun Kumar K arun...@samsung.com Thanks, that looks good. I'll queue it for 3.12. We actually have similar patch for the exynos4-is fimc-is-i2c driver. However this is sort of things that IMO should ideally be handled in the PM core. Yes indeed. Regards Arun -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html