Re: [RFC PATCH v3 09/11] [media] vimc: Subdevices as modules
On 06/12/2017 10:35 PM, Helen Koike wrote: Hi Hans, Thank you for your review. Please check my comments below On 2017-06-12 07:37 AM, Hans Verkuil wrote: On 06/03/2017 04:58 AM, Helen Koike wrote: +static struct component_match *vimc_add_subdevs(struct vimc_device *vimc) +{ +struct component_match *match = NULL; +unsigned int i; + +for (i = 0; i < vimc->pipe_cfg->num_ents; i++) { +dev_dbg(&vimc->pdev.dev, "new pdev for %s\n", +vimc->pipe_cfg->ents[i].drv); + +/* + * TODO: check if using platform_data is indeed the best way to + * pass the name to the driver or if we should add the drv name + * in the platform_device_id table + */ Didn't you set the drv name in the platform_device_id table already? I refer to the name of the entity, there is the name that identifies the driver as "vimc-sensor" that is set in the platform_device_id table but there is also the custom name of the entity e.g. "My Sensor A" that I need to inform to the vimc-sensor driver. Ah, so in the TODO you mean: "the best way to pass the entity name to the driver" I got confused there. But in that case I still don't get what you mean with "add the drv name in the platform_device_id table". Do you mean "entity name" there as well? Using platform_data feels like an abuse to be honest. Another option would be to make the vimc-sensor driver to populate the entity name automatically as "Sensor x", where x could be the entity number, but I don't think this is a good option. Why not? Well, probably not the entity number, but a simple instance counter would do fine (i.e. Sensor 1, 2, 3...). It can be made fancier later with dynamic reconfiguration where you might want to use the first unused instance number. Creating these components here makes sense. Wouldn't it also make sense to use v4l2_async to wait until they have all been bound? It would more closely emulate standard drivers. Apologies if I misunderstand what is happening here. I am using linux/component.h for that, when all devices are present and all modules are loaded, the component.h system brings up the core by calling vimc_comp_bind() function, which calls component_bind_all() to call the binding function of each module, then it finishes registering the topology. If any one of the components or module is unload, the component system takes down the entire topology calling component_unbind_all which calls the unbind functions from each module. This makes sure that the media device, subdevices and video device are only registered in the v4l2 system if all the modules are loaded. I wans't familiar with v4l2-async.h, but from a quick look it seems that it only works with struct v4l2_subdev, but I'll also need for struct video_device (for the capture node for example). And also, if a module is missing we would have vimc partially registered, e.g. the debayer could be registered at /dev/subdevX but the sensor not yet and the media wouldn't be ready, I am not sure if this is a problem though. Maybe we can use component.h for now, then I can implement v4l2_async_{un}register_video_device and migrate to v4l2-sync.h latter. What do you think? That's OK. The v4l2-async mechanism precedes the component API. We should probably investigate moving over to the component API. I seem to remember that it didn't have all the features we needed, but it's a long time ago since someone looked at that and whatever the objections were, they may no longer be true. Regards, Hans
Re: [RFC PATCH v3 05/11] [media] vimc: common: Add vimc_link_validate
On 06/12/2017 07:20 PM, Helen Koike wrote: Hi Hans, Thanks for your review, just a question below On 2017-06-12 06:50 AM, Hans Verkuil wrote: On 06/03/2017 04:58 AM, Helen Koike wrote: +/* The width, height, code and colorspace must match. */ +if (source_fmt.format.width != sink_fmt.format.width +|| source_fmt.format.height != sink_fmt.format.height +|| source_fmt.format.code != sink_fmt.format.code +|| source_fmt.format.colorspace != sink_fmt.format.colorspace) Source and/or Sink may be COLORSPACE_DEFAULT. If that's the case, then you should skip comparing ycbcr_enc, quantization or xfer_func. If colorspace is DEFAULT, then that implies that the other fields are DEFAULT as well. Nothing else makes sense in that case. I thought that the colorspace couldn't be COLORSPACE_DEFAULT, in the documentation it is written "The default colorspace. This can be used by applications to let the driver fill in the colorspace.", so the colorspace is always set to something different from default no ? I thought that the COLORSPACE_DEFAULT was only used by the userspace in VIDIOC_{SUBDEV}_S_FMT so say "driver, use wherever colorspace you want", but if usespace calls VIDIOC_{SUBDEV}_G_FMT, it would return which exact colorspace the driver is using, no? I don't think this rule works for the MC. For regular v4l2 devices the bridge driver knows what colorspace it receives so it can replace the colorspace DEFAULT with the real one. But a e.g. scaler subdev does not actually touch on the colorspace. And it doesn't know what colorspace it will receive or transmit. I don't feel it makes sense to require userspace to set and propagate the colorspace information throughout the pipeline. Allowing it to be set to DEFAULT (i.e. 'don't care') makes sense to me. I might change my mind later on this. The simple fact is that the spec isn't clear what to do with MC devices. That's also where this vimc driver comes in, so we can try this out without requiring specialized hardware. Regards, Hans
[PATCH RESEND v10 1/1] [media] i2c: add support for OV13858 sensor
This patch adds driver for Omnivision's ov13858 sensor, the driver supports following features: - manual exposure/gain(analog and digital) control support - two link frequencies - VBLANK/HBLANK support - test pattern support - media controller support - runtime pm support - supported resolutions + 4224x3136 at 30FPS + 2112x1568 at 30FPS(default) and 60FPS + 2112x1188 at 30FPS(default) and 60FPS + 1056x784 at 30FPS(default) and 60FPS Signed-off-by: Hyungwoo Yang --- drivers/media/i2c/Kconfig |8 + drivers/media/i2c/Makefile |1 + drivers/media/i2c/ov13858.c | 1860 +++ 3 files changed, 1869 insertions(+) create mode 100644 drivers/media/i2c/ov13858.c diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index c380e24..26a9a3c 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -600,6 +600,14 @@ config VIDEO_OV9650 This is a V4L2 sensor-level driver for the Omnivision OV9650 and OV9652 camera sensors. +config VIDEO_OV13858 + tristate "OmniVision OV13858 sensor support" + depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API + depends on MEDIA_CAMERA_SUPPORT + ---help--- + This is a Video4Linux2 sensor-level driver for the OmniVision + OV13858 camera. + config VIDEO_VS6624 tristate "ST VS6624 sensor support" depends on VIDEO_V4L2 && I2C diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 62323ec..3f4dc02 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -63,6 +63,7 @@ obj-$(CONFIG_VIDEO_OV5647) += ov5647.o obj-$(CONFIG_VIDEO_OV7640) += ov7640.o obj-$(CONFIG_VIDEO_OV7670) += ov7670.o obj-$(CONFIG_VIDEO_OV9650) += ov9650.o +obj-$(CONFIG_VIDEO_OV13858) += ov13858.o obj-$(CONFIG_VIDEO_MT9M032) += mt9m032.o obj-$(CONFIG_VIDEO_MT9M111) += mt9m111.o obj-$(CONFIG_VIDEO_MT9P031) += mt9p031.o diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c new file mode 100644 index 000..6e1c280 --- /dev/null +++ b/drivers/media/i2c/ov13858.c @@ -0,0 +1,1860 @@ +/* + * Copyright (c) 2017 Intel Corporation. + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include + +#define OV13858_REG_VALUE_08BIT1 +#define OV13858_REG_VALUE_16BIT2 +#define OV13858_REG_VALUE_24BIT3 + +#define OV13858_REG_MODE_SELECT0x0100 +#define OV13858_MODE_STANDBY 0x00 +#define OV13858_MODE_STREAMING 0x01 + +#define OV13858_REG_SOFTWARE_RST 0x0103 +#define OV13858_SOFTWARE_RST 0x01 + +/* PLL1 generates PCLK and MIPI_PHY_CLK */ +#define OV13858_REG_PLL1_CTRL_00x0300 +#define OV13858_REG_PLL1_CTRL_10x0301 +#define OV13858_REG_PLL1_CTRL_20x0302 +#define OV13858_REG_PLL1_CTRL_30x0303 +#define OV13858_REG_PLL1_CTRL_40x0304 +#define OV13858_REG_PLL1_CTRL_50x0305 + +/* PLL2 generates DAC_CLK, SCLK and SRAM_CLK */ +#define OV13858_REG_PLL2_CTRL_B0x030b +#define OV13858_REG_PLL2_CTRL_C0x030c +#define OV13858_REG_PLL2_CTRL_D0x030d +#define OV13858_REG_PLL2_CTRL_E0x030e +#define OV13858_REG_PLL2_CTRL_F0x030f +#define OV13858_REG_PLL2_CTRL_12 0x0312 +#define OV13858_REG_MIPI_SC_CTRL0 0x3016 +#define OV13858_REG_MIPI_SC_CTRL1 0x3022 + +/* Chip ID */ +#define OV13858_REG_CHIP_ID0x300a +#define OV13858_CHIP_ID0x00d855 + +/* V_TIMING internal */ +#define OV13858_REG_VTS0x380e +#define OV13858_VTS_30FPS 0x0c8e /* 30 fps */ +#define OV13858_VTS_60FPS 0x0648 /* 60 fps */ +#define OV13858_VTS_MAX0x7fff +#define OV13858_VBLANK_MIN 56 + +/* HBLANK control - read only */ +#define OV13858_PPL_540MHZ 2244 +#define OV13858_PPL_1080MHZ4488 + +/* Exposure control */ +#define OV13858_REG_EXPOSURE 0x3500 +#define OV13858_EXPOSURE_MIN 4 +#define OV13858_EXPOSURE_MAX (OV13858_VTS_MAX - 8) +#define OV13858_EXPOSURE_STEP 1 +#define OV13858_EXPOSURE_DEFAULT 0x640 + +/* Analog gain control */ +#define OV13858_REG_ANALOG_GAIN0x3508 +#define OV13858_ANA_GAIN_MIN 0 +#define OV13858_ANA_GAIN_MAX 0x1fff +#define OV13858_ANA_GAIN_STEP 1 +#define OV13858_ANA_GAIN_DEFAULT 0
Re: [PATCH v10 1/1] [media] i2c: add support for OV13858 sensor
Hi Hyungwoo, [auto build test ERROR on linuxtv-media/master] [also build test ERROR on v4.12-rc5 next-20170609] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Hyungwoo-Yang/i2c-add-support-for-OV13858-sensor/20170613-122218 base: git://linuxtv.org/media_tree.git master config: ia64-allmodconfig (attached as .config) compiler: ia64-linux-gcc (GCC) 6.2.0 reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=ia64 All error/warnings (new ones prefixed by >>): drivers/media/i2c/ov13858.c: In function 'ov13858_read_platform_data': >> drivers/media/i2c/ov13858.c:1704:9: error: 'struct ov13858' has no member >> named 'num_of_skip_frames' ov13858->num_of_skip_frames = val; ^~ >> drivers/media/i2c/ov13858.c:1729:33: error: assignment of read-only location >> 'link_freq_menu_items[freq_id]' link_freq_menu_items[freq_id] = val; ^ >> drivers/media/i2c/ov13858.c:1731:12: warning: assignment discards 'const' >> qualifier from pointer target type [-Wdiscarded-qualifiers] freq_cfg = &link_freq_configs[freq_id]; ^ vim +1704 drivers/media/i2c/ov13858.c 1698 return -EINVAL; 1699 } 1700 1701 ret = device_property_read_u32(dev, "skip-frames", &val); 1702 if (ret) 1703 return ret; > 1704 ov13858->num_of_skip_frames = val; 1705 1706 device_for_each_child_node(dev, child) { 1707 if (!fwnode_property_present(child, "link")) 1708 continue; 1709 1710 /* Limited number of link frequencies are allowed */ 1711 if (freq_id == OV13858_NUM_OF_LINK_FREQS) { 1712 dev_err(dev, "no more than two freqs\n"); 1713 ret = -EINVAL; 1714 goto error; 1715 } 1716 1717 fwn_freq = fwnode_get_next_child_node(child, NULL); 1718 if (!fwn_freq) { 1719 ret = -EINVAL; 1720 goto error; 1721 } 1722 1723 /* Get link freq menu item for LINK_FREQ control */ 1724 ret = fwnode_property_read_u32(fwn_freq, "link-rate", &val); 1725 if (ret) { 1726 dev_err(dev, "link-rate error : %d\n", ret); 1727 goto error; 1728 } > 1729 link_freq_menu_items[freq_id] = val; 1730 > 1731 freq_cfg = &link_freq_configs[freq_id]; 1732 ret = fwnode_property_read_u32(fwn_freq, "pixel-rate", &val); 1733 if (ret) { 1734 dev_err(dev, "pixel-rate error : %d\n", ret); --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip
Re: [PATCH v2 0/15] [dt-bindings] [media] Add document file and driver for Sony CXD2880 DVB-T2/T tuner + demodulator
Dear Takiguchi, Roger that. Thanks for explanation ! 2017-06-13 1:35 GMT-04:00 Takiguchi, Yasunari : > Dear Abylay Ospan > > Thank you for your review and proposal. > > Unfortunately, we supposed it's difficult to cover CXD2841 functionality by > CXD2880 driver. > CXD2880 is for mobile IC, tuner (RF) and demodulator convined IC. > On the other hand, CXD2841 is demodulator only IC for stationary use. > CXD2841 supports terrestrial, cable and satellite broadcasting systems. > But CXD2880 supports terrestrial broadcasting systems only. > And as you suggested, the driver supports SPI interface only. > > Regards & Thanks a lot > Takiguchi > > > On 2017/06/12 22:33, Abylay Ospan wrote: >> Dear Takiguchi, >> >> I'm working on 'drivers/media/dvb-frontends/cxd2841er.c' (universal >> demod) and 'linux/drivers/media/dvb-frontends/helene.c' (universal >> TERR/CABLE/SAT tuner). >> >> How do you think - is your cxd2880 proposed driver have possibilities >> to cover cxd2841er demod functionality too ? >> >> I have quickly checked your cxd2880_top.c and looks like cxd2880 works >> over SPI (not I2C) ?Also, looks like registers map, sequences >> is different. Am I right ? >> >> How do you think ? >> >> Thanks a lot ! > -- Abylay Ospan, NetUP Inc. http://www.netup.tv
Re: [Patch v4 00/12] Add MFC v10.10 support
On Fri, 2017-06-09 at 19:36 +0200, Sylwester Nawrocki wrote: > On 04/06/2017 08:11 AM, Smitha T Murthy wrote: > > This patch series adds MFC v10.10 support. MFC v10.10 is used in some > > of Exynos7 variants. > > > > This adds support for following: > > > > * Add support for HEVC encoder and decoder > > * Add support for VP9 decoder > > * Update Documentation for control id definitions > > * Update computation of min scratch buffer size requirement for V8 onwards > Smitha, do you have any updates on this? IIRC, there were few things > which needed corrections but we were rather close to the final version. > > -- > Thanks, > Sylwester > Hi Sylwester, Sorry, I am currently held up with some other work. I will try to make time and work on the next the updated patch series soon. Regards, Smitha
Re: [PATCH v2 0/15] [dt-bindings] [media] Add document file and driver for Sony CXD2880 DVB-T2/T tuner + demodulator
Dear Abylay Ospan Thank you for your review and proposal. Unfortunately, we supposed it's difficult to cover CXD2841 functionality by CXD2880 driver. CXD2880 is for mobile IC, tuner (RF) and demodulator convined IC. On the other hand, CXD2841 is demodulator only IC for stationary use. CXD2841 supports terrestrial, cable and satellite broadcasting systems. But CXD2880 supports terrestrial broadcasting systems only. And as you suggested, the driver supports SPI interface only. Regards & Thanks a lot Takiguchi On 2017/06/12 22:33, Abylay Ospan wrote: > Dear Takiguchi, > > I'm working on 'drivers/media/dvb-frontends/cxd2841er.c' (universal > demod) and 'linux/drivers/media/dvb-frontends/helene.c' (universal > TERR/CABLE/SAT tuner). > > How do you think - is your cxd2880 proposed driver have possibilities > to cover cxd2841er demod functionality too ? > > I have quickly checked your cxd2880_top.c and looks like cxd2880 works > over SPI (not I2C) ?Also, looks like registers map, sequences > is different. Am I right ? > > How do you think ? > > Thanks a lot !
Re: [PATCH] [media] ir-spi: Fix issues with lirc API
Hi Anton, On Sun, May 07, 2017 at 11:00:11AM +1000, Anton Blanchard wrote: > From: Anton Blanchard > > The ir-spi driver has 2 issues which prevents it from working with > lirc: > > 1. The ir-spi driver uses 16 bits of SPI data to create one cycle of > the waveform. As such our SPI clock needs to be 16x faster than the > carrier frequency. > > The driver is inconsistent in how it currently handles this. It > initializes it to the carrier frequency: > > But the commit message has some example code which initialises it > to 16x the carrier frequency: > > val = 608000; > ret = ioctl(fd, LIRC_SET_SEND_CARRIER, &val); > > To maintain compatibility with lirc, always do the frequency adjustment > in the driver. > > 2. lirc presents pulses in microseconds, but the ir-spi driver treats > them as cycles of the carrier. Similar to other lirc drivers, do the > conversion with DIV_ROUND_CLOSEST(). > > Fixes: fe052da49201 ("[media] rc: add support for IR LEDs driven through SPI") > Cc: sta...@vger.kernel.org > Signed-off-by: Anton Blanchard Thanks for fixing it. Reviewed-by: Andi Shyti Andi
[PATCH v10 0/1] [media] i2c: add support for OV13858 sensor
v10 : moved data dependent on module input clock frequency into fwnode. v9 : added HBLANK and CID_GAIN(for digital gain). v8 : enabled ov13858 with basic functionalities. Hyungwoo Yang (1): [media] i2c: add support for OV13858 sensor drivers/media/i2c/Kconfig |8 + drivers/media/i2c/Makefile |1 + drivers/media/i2c/ov13858.c | 1920 +++ 3 files changed, 1929 insertions(+) create mode 100644 drivers/media/i2c/ov13858.c -- 1.9.1
[PATCH v10 1/1] [media] i2c: add support for OV13858 sensor
This patch adds driver for Omnivision's ov13858 sensor, the driver supports following features: - manual exposure/gain(analog and digital) control support - two link frequencies - VBLANK/HBLANK support - test pattern support - media controller support - runtime pm support - supported resolutions + 4224x3136 at 30FPS + 2112x1568 at 30FPS(default) and 60FPS + 2112x1188 at 30FPS(default) and 60FPS + 1056x784 at 30FPS(default) and 60FPS Signed-off-by: Hyungwoo Yang --- drivers/media/i2c/Kconfig |8 + drivers/media/i2c/Makefile |1 + drivers/media/i2c/ov13858.c | 1920 +++ 3 files changed, 1929 insertions(+) create mode 100644 drivers/media/i2c/ov13858.c diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index c380e24..26a9a3c 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -600,6 +600,14 @@ config VIDEO_OV9650 This is a V4L2 sensor-level driver for the Omnivision OV9650 and OV9652 camera sensors. +config VIDEO_OV13858 + tristate "OmniVision OV13858 sensor support" + depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API + depends on MEDIA_CAMERA_SUPPORT + ---help--- + This is a Video4Linux2 sensor-level driver for the OmniVision + OV13858 camera. + config VIDEO_VS6624 tristate "ST VS6624 sensor support" depends on VIDEO_V4L2 && I2C diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 62323ec..3f4dc02 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -63,6 +63,7 @@ obj-$(CONFIG_VIDEO_OV5647) += ov5647.o obj-$(CONFIG_VIDEO_OV7640) += ov7640.o obj-$(CONFIG_VIDEO_OV7670) += ov7670.o obj-$(CONFIG_VIDEO_OV9650) += ov9650.o +obj-$(CONFIG_VIDEO_OV13858) += ov13858.o obj-$(CONFIG_VIDEO_MT9M032) += mt9m032.o obj-$(CONFIG_VIDEO_MT9M111) += mt9m111.o obj-$(CONFIG_VIDEO_MT9P031) += mt9p031.o diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c new file mode 100644 index 000..0334cee --- /dev/null +++ b/drivers/media/i2c/ov13858.c @@ -0,0 +1,1920 @@ +/* + * Copyright (c) 2017 Intel Corporation. + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include + +#define OV13858_REG_VALUE_08BIT1 +#define OV13858_REG_VALUE_16BIT2 +#define OV13858_REG_VALUE_24BIT3 + +#define OV13858_REG_MODE_SELECT0x0100 +#define OV13858_MODE_STANDBY 0x00 +#define OV13858_MODE_STREAMING 0x01 + +#define OV13858_REG_SOFTWARE_RST 0x0103 +#define OV13858_SOFTWARE_RST 0x01 + +/* PLL1 generates PCLK and MIPI_PHY_CLK */ +#define OV13858_REG_PLL1_CTRL_00x0300 +#define OV13858_REG_PLL1_CTRL_10x0301 +#define OV13858_REG_PLL1_CTRL_20x0302 +#define OV13858_REG_PLL1_CTRL_30x0303 +#define OV13858_REG_PLL1_CTRL_40x0304 +#define OV13858_REG_PLL1_CTRL_50x0305 + +/* PLL2 generates DAC_CLK, SCLK and SRAM_CLK */ +#define OV13858_REG_PLL2_CTRL_B0x030b +#define OV13858_REG_PLL2_CTRL_C0x030c +#define OV13858_REG_PLL2_CTRL_D0x030d +#define OV13858_REG_PLL2_CTRL_E0x030e +#define OV13858_REG_PLL2_CTRL_F0x030f +#define OV13858_REG_PLL2_CTRL_12 0x0312 +#define OV13858_REG_MIPI_SC_CTRL0 0x3016 +#define OV13858_REG_MIPI_SC_CTRL1 0x3022 + +/* Chip ID */ +#define OV13858_REG_CHIP_ID0x300a +#define OV13858_CHIP_ID0x00d855 + +/* V_TIMING internal */ +#define OV13858_REG_VTS0x380e +#define OV13858_VTS_30FPS 0x0c8e /* 30 fps */ +#define OV13858_VTS_60FPS 0x0648 /* 60 fps */ +#define OV13858_VTS_MAX0x7fff +#define OV13858_VBLANK_MIN 56 + +/* HBLANK control - read only */ +#define OV13858_PPL_540MHZ 2244 +#define OV13858_PPL_1080MHZ4488 + +/* Exposure control */ +#define OV13858_REG_EXPOSURE 0x3500 +#define OV13858_EXPOSURE_MIN 4 +#define OV13858_EXPOSURE_MAX (OV13858_VTS_MAX - 8) +#define OV13858_EXPOSURE_STEP 1 +#define OV13858_EXPOSURE_DEFAULT 0x640 + +/* Analog gain control */ +#define OV13858_REG_ANALOG_GAIN0x3508 +#define OV13858_ANA_GAIN_MIN 0 +#define OV13858_ANA_GAIN_MAX 0x1fff +#define OV13858_ANA_GAIN_STEP 1 +#define OV13858_ANA_GAIN_DEFAULT 0
[PATCH v4 0/2] ADV748x HDMI/Analog video receiver
From: Kieran Bingham This is a driver for the Analog Devices ADV748x device, and follows on from a previous posting by Niklas Söderlund [0] of an earlier incarnation of this driver. Aside from a few bug fixes, and considerable refactoring this driver: - is refactored to multiple object files - defines multiple sub devices for the output paths. - has independent controls for both HDMI and Analog video paths - Specifies 'endpoint' matching instead of 'device' in async framework These patches are based up on Niklas' pending RVin work [1] and Sakari's fwnode series [2] This version is the culmination of large refactoring and development, and I believe is ready (or near) for mainline integration. ADV748x === The ADV7481 and ADV7482 support two video pipelines which can run independently of each other, with each pipeline terminating in a CSI-2 output: TXA (4-Lane) and TXB (1-Lane) The ADV7480 (Not yet included here), ADV7481, and ADV7482 are all derivatives, with the following features Analog HDMI MHL 4-Lane 1-Lane In In CSI CSI ADV7480 XX X ADV7481 XXX X X ADV7482 XX X X Implementation == This RFC creates 4 entities. AFE (CVBS/Analog In), HDMI, TXA and TXB. At probe time, the DT is parsed to identify the endpoints for each of these nodes, and those are used for async matching of the CSI2 (TXA/TXB) entities in the master driver. The HDMI and AFE entities are then registered after a successful registration of both the CSI2 entities. (Known) Future Todo's = Further potential development areas include: - ADV7480 Support (No AFE) - MHL support (Not present on ADV7482) - EDID support - CEC Support - Configurable I2C addressing - Interrupt handling for format changes and hotplug detect. However, this driver is functional without the above, and these developments can be written when required. References == [0] http://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg05196.html [1] https://git.ragnatech.se/linux rcar-vin-elinux-v7 [2] https://www.mail-archive.com/linux-media@vger.kernel.org/msg111332.html v1/RFC: - Initial posting v2: - Reworked DT parsing and entities v3: - Refreshed with lots of fixups from Sakari's review comments v4: - Many changes all round, following Laurent's review and extensive development - Now uses regmap - AFE port numbering has been changed to match the entity pads - Kieran Bingham (2): media: i2c: adv748x: add adv748x driver arm64: dts: renesas: salvator-x: Add ADV7482 support Documentation/devicetree/bindings/media/i2c/adv748x.txt | 96 +- MAINTAINERS | 6 +- arch/arm64/boot/dts/renesas/salvator-x.dtsi | 123 +- drivers/media/i2c/Kconfig | 11 +- drivers/media/i2c/Makefile | 1 +- drivers/media/i2c/adv748x/Makefile | 7 +- drivers/media/i2c/adv748x/adv748x-afe.c | 571 ++- drivers/media/i2c/adv748x/adv748x-core.c| 907 +- drivers/media/i2c/adv748x/adv748x-csi2.c| 323 +++- drivers/media/i2c/adv748x/adv748x-hdmi.c| 652 ++- drivers/media/i2c/adv748x/adv748x.h | 415 - 11 files changed, 3112 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/adv748x.txt create mode 100644 drivers/media/i2c/adv748x/Makefile create mode 100644 drivers/media/i2c/adv748x/adv748x-afe.c create mode 100644 drivers/media/i2c/adv748x/adv748x-core.c create mode 100644 drivers/media/i2c/adv748x/adv748x-csi2.c create mode 100644 drivers/media/i2c/adv748x/adv748x-hdmi.c create mode 100644 drivers/media/i2c/adv748x/adv748x.h base-commit: 287d20fda775908006c5d64a15cd65244578ed01 -- git-series 0.9.1
[PATCH v4 2/2] arm64: dts: renesas: salvator-x: Add ADV7482 support
From: Kieran Bingham Provide ADV7482, and the needed connectors Signed-off-by: Kieran Bingham v4: - dt: Rebase to dts/renesas/salvator-x.dtsi - dt: Use AIN0-7 rather than AIN1-8 arch/arm64/boot/dts/renesas/salvator-x.dtsi | 123 +- 1 file changed, 123 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/salvator-x.dtsi b/arch/arm64/boot/dts/renesas/salvator-x.dtsi index 937bdf8842f2..c073baf6aeb7 100644 --- a/arch/arm64/boot/dts/renesas/salvator-x.dtsi +++ b/arch/arm64/boot/dts/renesas/salvator-x.dtsi @@ -68,6 +68,16 @@ enable-gpios = <&gpio6 7 GPIO_ACTIVE_HIGH>; }; + cvbs-in { + compatible = "composite-video-connector"; + label = "CVBS IN"; + + port { + cvbs_con: endpoint { + }; + }; + }; + reg_1p8v: regulator0 { compatible = "regulator-fixed"; regulator-name = "fixed-1.8V"; @@ -183,6 +193,17 @@ }; }; + hdmi-in { + compatible = "hdmi-connector"; + label = "HDMI IN"; + type = "a"; + + port { + hdmi_in_con: endpoint { + }; + }; + }; + vga { compatible = "vga-connector"; @@ -260,6 +281,51 @@ }; }; +&csi20 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + csi20_in: endpoint { + clock-lanes = <0>; + data-lanes = <1>; + remote-endpoint = <&adv7482_txb>; + }; + }; + }; +}; + +&csi40 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + csi40_in: endpoint { + clock-lanes = <0>; + data-lanes = <1 2 3 4>; + remote-endpoint = <&adv7482_txa>; + }; + }; + }; +}; + +&cvbs_con { + port { + cvbs_in: endpoint { + remote-endpoint = <&adv7482_ain7>; + }; + }; +}; + &du { pinctrl-0 = <&du_pins>; pinctrl-names = "default"; @@ -294,6 +360,14 @@ clock-frequency = <32768>; }; +&hdmi_in_con { + port { + hdmi_in: endpoint { + remote-endpoint = <&adv7482_hdmi>; + }; + }; +}; + &hsusb { status = "okay"; }; @@ -358,6 +432,55 @@ shunt-resistor-micro-ohms = <5000>; }; + + video-receiver@70 { + compatible = "adi,adv7482"; + reg = <0x70>; + + #address-cells = <1>; + #size-cells = <0>; + + interrupt-parent = <&gpio6>; + interrupt-names = "intrq1", "intrq2"; + interrupts = <30 IRQ_TYPE_LEVEL_LOW>, +<31 IRQ_TYPE_LEVEL_LOW>; + + port@7 { + reg = <7>; + + adv7482_ain7: endpoint { + remote-endpoint = <&cvbs_in>; + }; + }; + + port@8 { + reg = <8>; + + adv7482_hdmi: endpoint { + remote-endpoint = <&hdmi_in>; + }; + }; + + port@10 { + reg = <10>; + + adv7482_txa: endpoint { + clock-lanes = <0>; + data-lanes = <1 2 3 4>; + remote-endpoint = <&csi40_in>; + }; + }; + + port@11 { + reg = <11>; + + adv7482_txb: endpoint { + clock-lanes = <0>; + data-lanes = <1>; + remote-endpoint = <&csi20_in>; + }; + }; + }; }; &i2c_dvfs { -- git-series 0.9.1
[PATCH v4 1/2] media: i2c: adv748x: add adv748x driver
From: Kieran Bingham Provide support for the ADV7481 and ADV7482. The driver is modelled with 4 subdevices to allow simultaneous streaming from the AFE (Analog front end) and HDMI inputs though two CSI TX entities. The HDMI entity is linked to the TXA CSI bus, whilst the AFE is linked to the TXB CSI bus. The driver is based on a prototype by Koji Matsuoka in the Renesas BSP, and an earlier rework by Niklas Söderlund. Signed-off-by: Kieran Bingham --- v2: - Implement DT parsing - adv748x: Add CSI2 entity - adv748x: Rework pad allocations and fmts - Give AFE 8 input pads and move pad defines - Use the enums to ensure pads are referenced correctly. - adv748x: Rename AFE/HDMI entities Now they are 'just afe' and 'just hdmi' - Reorder the entity enum and structures - Added pad-format for the CSI2 entities - CSI2 s_stream pass through - CSI2 control pass through (with link following) v3: - dt: Extend DT documentation to specify interrupt mappings - simplify adv748x_parse_dt - core: Add banner to header file describing ADV748x variants - Use entity structure pointers rather than global state pointers where possible - afe: Reduce indent on afe_status - hdmi: Add error checking to the bt->pixelclock values. - Remove all unnecessary pad checks: handled by core - Fix all probe cleanup paths - adv748x_csi2_probe() now fails if it has no endpoint - csi2: Fix small oneliners for is_txa and get_remote_sd() - csi2: Fix checkpatch warnings - csi2: Fix up s_stream pass-through - csi2: Fix up Pixel Rate passthrough - csi2: simplify adv748x_csi2_get_pad_format() - Remove 'async notifiers' from AFE/HDMI Using async notifiers was overkill, when we have access to the subdevices internally and can register them directly. - Use state lock in control handlers and clean up s_ctrls - remove _interruptible mutex locks v4: - all: Convert hex 0xXX to lowercase - all: Use defines instead of hardcoded register values - all: Use regmap - afe, csi2, hdmi: _probe -> _init - afe, csi2, hdmi: _remove -> _cleanup - afe, hdmi: Convert pattern generator to a control - afe, hdmi: get/set-fmt refactor - afe, hdmi, csi2: Convert to internal calls for pixelrate - afe: Allow the AFE to configure the Input Select from DT - afe: Reduce indent on adv748x_afe_status switch - afe: Remove ununsed macro definitions AIN0-7 - afe: Remove extraneous control checks handled by core - afe: Comment fixups - afe: Rename error label - afe: Correct control names on the SDP - afe: Use AIN0-7 rather than AIN1-8 to match ports and MC pads - core: adv748x_parse_dt references to nodes, and catch multiple endpoints in a port. - core: adv748x_dt_cleanup to simplify releasing DT nodes - core: adv748x_print_info renamed to adv748x_identify_chip - core: reorganise ordering of probe sequence - core: No need for of_match_ptr - core: Fix up i2c read/writes (regmap still on todo list) - core: Set specific functions from the entities on subdev-init - core: Use kzalloc for state instead of devm - core: Improve probe error reporting - core: Track unknown BIT(6) in tx{a,b}_power - csi2: Improve adv748x_csi2_get_remote_sd as adv748x_csi2_get_source_sd - csi2: -EPIPE instead of -ENODEV - csi2: adv_dbg, instead of adv_info - csi2: adv748x_csi2_set_format fix - csi2: remove async notifier and sd member variables - csi2: register links from the CSI2 - csi2: create virtual channel helper function - dt: Remove numbering from endpoints - dt: describe ports and interrupts as optional - dt: Re-tab - hdmi: adv748x_hdmi_have_signal -> adv748x_hdmi_has_signal - hdmi: fix adv748x_hdmi_read_pixelclock return checks - hdmi: improve adv748x_hdmi_set_video_timings - hdmi: Fix tmp variable as polarity - hdmi: Improve adv748x_hdmi_s_stream - hdmi: Clean up adv748x_hdmi_s_ctrl register definitions and usage - hdmi: Fix up adv748x_hdmi_s_dv_timings with macro names for register - hdmi: Add locking to adv748x_hdmi_g_dv_timings writes and locking - hdmi: adv748x_hdmi_set_de_timings function added to clarify DE writes - hdmi: Use CP in control register naming to match component processor - hdmi: clean up adv748x_hdmi_query_dv_timings() - KConfig: Fix up dependency and capitalisation Documentation/devicetree/bindings/media/i2c/adv748x.txt | 96 +- MAINTAINERS | 6 +- drivers/media/i2c/Kconfig | 11 +- drivers/media/i2c/Makefile | 1 +- drivers/media/i2c/adv748x/Makefile | 7 +- drivers/media/i2c/adv748x/adv748x-afe.c | 571 ++- drivers/media/i2c/adv748x/adv748x-core.c| 907 +- drivers/media/i2c/adv748x/adv748x-csi2.c| 323 +++- drivers/media/i2c/adv748x/adv748x-hdmi.c| 652 ++- drivers/media/i2c/adv748x/adv748x.h | 415 - 10 files changed, 2989 insertions(+) create mode 100
Re: [RFC PATCH v3 09/11] [media] vimc: Subdevices as modules
Hi Hans, Thank you for your review. Please check my comments below On 2017-06-12 07:37 AM, Hans Verkuil wrote: On 06/03/2017 04:58 AM, Helen Koike wrote: Change the core structure for adding subdevices in the topology. Instead of calling the specific create function for each subdevice, inject a child platform_device with the driver's name. Each type of node in the topology (sensor, capture, debayer, scaler) will register a platform_driver with the corresponding name through the component subsystem. Implementing a new subdevice type doesn't require vimc-core to be altered. This facilitates future implementation of dynamic entities, where hotpluging an entity in the topology is just a matter of registering/unregistering a platform_device in the system. It also facilitates other implementations of different nodes without touching the core code and remove the need of a header file for each type of node. Signed-off-by: Helen Koike --- Changes in v3: [media] vimc: Subdevices as modules - This is a new patch in the series Changes in v2: None --- drivers/media/platform/vimc/Makefile | 7 +- drivers/media/platform/vimc/vimc-capture.c | 96 --- drivers/media/platform/vimc/vimc-capture.h | 28 -- drivers/media/platform/vimc/vimc-common.c | 37 ++- drivers/media/platform/vimc/vimc-common.h | 14 +- drivers/media/platform/vimc/vimc-core.c| 406 +++-- drivers/media/platform/vimc/vimc-sensor.c | 91 +-- drivers/media/platform/vimc/vimc-sensor.h | 28 -- 8 files changed, 320 insertions(+), 387 deletions(-) delete mode 100644 drivers/media/platform/vimc/vimc-capture.h delete mode 100644 drivers/media/platform/vimc/vimc-sensor.h diff --git a/drivers/media/platform/vimc/Makefile b/drivers/media/platform/vimc/Makefile index 6b6ddf4..0e5d5ce 100644 --- a/drivers/media/platform/vimc/Makefile +++ b/drivers/media/platform/vimc/Makefile @@ -1,3 +1,6 @@ -vimc-objs := vimc-core.o vimc-capture.o vimc-common.o vimc-sensor.o +vimc-objs := vimc-core.o +vimc_capture-objs := vimc-capture.o +vimc_common-objs := vimc-common.o +vimc_sensor-objs := vimc-sensor.o -obj-$(CONFIG_VIDEO_VIMC) += vimc.o +obj-$(CONFIG_VIDEO_VIMC) += vimc.o vimc_capture.o vimc_common.o vimc_sensor.o diff --git a/drivers/media/platform/vimc/vimc-capture.c b/drivers/media/platform/vimc/vimc-capture.c index b5da0ea..633d99a 100644 --- a/drivers/media/platform/vimc/vimc-capture.c +++ b/drivers/media/platform/vimc/vimc-capture.c @@ -15,18 +15,24 @@ * */ +#include #include #include +#include +#include #include #include #include #include -#include "vimc-capture.h" +#include "vimc-common.h" + +#define VIMC_CAP_DRV_NAME "vimc-capture" struct vimc_cap_device { struct vimc_ent_device ved; struct video_device vdev; +struct device *dev; struct v4l2_pix_format format; struct vb2_queue queue; struct list_head buf_list; @@ -150,7 +156,7 @@ static int vimc_cap_s_fmt_vid_cap(struct file *file, void *priv, vimc_cap_try_fmt_vid_cap(file, priv, f); -dev_dbg(vcap->vdev.v4l2_dev->dev, "%s: format update: " +dev_dbg(vcap->dev, "%s: format update: " "old:%dx%d (0x%x, %d, %d, %d, %d) " "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vcap->vdev.name, /* old */ @@ -365,8 +371,7 @@ static int vimc_cap_start_streaming(struct vb2_queue *vq, unsigned int count) vcap->kthread_cap = kthread_run(vimc_cap_tpg_thread, vcap, "%s-cap", vcap->vdev.v4l2_dev->name); if (IS_ERR(vcap->kthread_cap)) { -dev_err(vcap->vdev.v4l2_dev->dev, -"%s: kernel_thread() failed\n", +dev_err(vcap->dev, "%s: kernel_thread() failed\n", vcap->vdev.name); ret = PTR_ERR(vcap->kthread_cap); goto err_tpg_free; @@ -443,8 +448,7 @@ static int vimc_cap_buffer_prepare(struct vb2_buffer *vb) unsigned long size = vcap->format.sizeimage; if (vb2_plane_size(vb, 0) < size) { -dev_err(vcap->vdev.v4l2_dev->dev, -"%s: buffer too small (%lu < %lu)\n", +dev_err(vcap->dev, "%s: buffer too small (%lu < %lu)\n", vcap->vdev.name, vb2_plane_size(vb, 0), size); return -EINVAL; } @@ -469,8 +473,10 @@ static const struct media_entity_operations vimc_cap_mops = { .link_validate= vimc_link_validate, }; -static void vimc_cap_destroy(struct vimc_ent_device *ved) +static void vimc_cap_comp_unbind(struct device *comp, struct device *master, + void *master_data) { +struct vimc_ent_device *ved = dev_get_drvdata(comp); struct vimc_cap_device *vcap = container_of(ved, struct vimc_cap_device, ved); @@ -481,32 +487,25 @@ static void vimc_cap_destroy(struct vimc_ent_device *ved) kfree(vcap); } -struct vimc_ent_device *vimc_cap_create(struct v4l2_device *v4l2_dev, -const cha
Re: how to link up audio bus from media controller driver to soc dai bus?
Hi Tim, On Mon, Jun 12, 2017 at 4:15 PM, Tim Harvey wrote: > Greetings, > > I'm working on a media controller driver for the tda1997x HDMI > receiver which provides an audio bus supporting I2S/SPDIF/OBA/HBR/DST. > I'm unclear how to bind the audio bus to a SoC's audio bus, for > example the IMX6 SSI (I2S) bus. I thought perhaps it was via a > simple-audio-card device-tree binding but that appears to require an > ALSA codec to bind to? > > Can anyone point me to an example of a media controller device driver > that supports audio and video and how the audio is bound to a I2S bus? Does the tda998x.txt example help? Documentation/devicetree/bindings/display/bridge/tda998x.txt and the dts example: arch/arm/boot/dts/am335x-boneblack-common.dtsi
Re: how to link up audio bus from media controller driver to soc dai bus?
On Mon, Jun 12, 2017 at 3:15 PM, Tim Harvey wrote: > Greetings, > > I'm working on a media controller driver for the tda1997x HDMI > receiver which provides an audio bus supporting I2S/SPDIF/OBA/HBR/DST. > I'm unclear how to bind the audio bus to a SoC's audio bus, for > example the IMX6 SSI (I2S) bus. I thought perhaps it was via a > simple-audio-card device-tree binding but that appears to require an > ALSA codec to bind to? > > Can anyone point me to an example of a media controller device driver > that supports audio and video and how the audio is bound to a I2S bus? I'm not sure if this is what you are looking for now not, but on some AMD APUs, we have an i2s bus and codec attached to the GPU rather than as a standalone device. The audio DMA engine and interrupts are controlled via the GPU's mmio aperture, but we expose the audio DMA engine and i2c interface via alsa. We use the MFD (Multi-Function Device) kernel infrastructure to do this. The GPU driver loads and probes the audio capabilities and triggers the hotplug of the i2s and audio dma engine. For the GPU side see: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c for the audio side: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/soc/amd/acp-pcm-dma.c Alex
Re: [RFC PATCH v3 08/11] [media] vimc: Optimize frame generation through the pipe
Hi Hans, Thank you for your review On 2017-06-12 07:03 AM, Hans Verkuil wrote: On 06/03/2017 04:58 AM, Helen Koike wrote: Add a parameter called vsen_tpg, if true then vimc will work as before: frames will be generated in the sensor nodes then propagated through the pipe and processed by each node until a capture node is reached. If vsen_tpg is false, then the frame is not generated by the sensor, but directly from the capture node, thus saving intermediate memory buffers and process time, allowing a higher frame rate. Signed-off-by: Helen Koike --- Changes in v3: [media] vimc: Optimize frame generation through the pipe - This is a new patch in the series Changes in v2: None --- drivers/media/platform/vimc/vimc-capture.c | 178 + drivers/media/platform/vimc/vimc-common.h | 2 + drivers/media/platform/vimc/vimc-sensor.c | 30 - 3 files changed, 156 insertions(+), 54 deletions(-) diff --git a/drivers/media/platform/vimc/vimc-capture.c b/drivers/media/platform/vimc/vimc-capture.c index e943267..b5da0ea 100644 --- a/drivers/media/platform/vimc/vimc-capture.c +++ b/drivers/media/platform/vimc/vimc-capture.c @@ -15,7 +15,10 @@ * */ +#include +#include #include +#include #include #include @@ -38,6 +41,8 @@ struct vimc_cap_device { struct mutex lock; u32 sequence; struct media_pipeline pipe; +struct tpg_data tpg; +struct task_struct *kthread_cap; }; static const struct v4l2_pix_format fmt_default = { @@ -246,6 +251,91 @@ static void vimc_cap_return_all_buffers(struct vimc_cap_device *vcap, spin_unlock(&vcap->qlock); } +static void vimc_cap_process_frame(struct vimc_ent_device *ved, + struct media_pad *sink, const void *frame) +{ +struct vimc_cap_device *vcap = container_of(ved, struct vimc_cap_device, +ved); +struct vimc_cap_buffer *vimc_buf; +void *vbuf; + +spin_lock(&vcap->qlock); + +/* Get the first entry of the list */ +vimc_buf = list_first_entry_or_null(&vcap->buf_list, +typeof(*vimc_buf), list); +if (!vimc_buf) { +spin_unlock(&vcap->qlock); +return; +} + +/* Remove this entry from the list */ +list_del(&vimc_buf->list); + +spin_unlock(&vcap->qlock); + +/* Fill the buffer */ +vimc_buf->vb2.vb2_buf.timestamp = ktime_get_ns(); +vimc_buf->vb2.sequence = vcap->sequence++; +vimc_buf->vb2.field = vcap->format.field; + +vbuf = vb2_plane_vaddr(&vimc_buf->vb2.vb2_buf, 0); + +if (sink) +memcpy(vbuf, frame, vcap->format.sizeimage); +else +tpg_fill_plane_buffer(&vcap->tpg, V4L2_STD_PAL, 0, vbuf); + +/* Set it as ready */ +vb2_set_plane_payload(&vimc_buf->vb2.vb2_buf, 0, + vcap->format.sizeimage); +vb2_buffer_done(&vimc_buf->vb2.vb2_buf, VB2_BUF_STATE_DONE); +} + + +static int vimc_cap_tpg_thread(void *data) +{ +struct vimc_cap_device *vcap = data; + +set_freezable(); +set_current_state(TASK_UNINTERRUPTIBLE); + +for (;;) { +try_to_freeze(); +if (kthread_should_stop()) +break; + +vimc_cap_process_frame(&vcap->ved, NULL, NULL); + +/* 60 frames per second */ +schedule_timeout(HZ/60); +} + +return 0; +} + +static void vimc_cap_tpg_s_format(struct vimc_cap_device *vcap) +{ +const struct vimc_pix_map *vpix = +vimc_pix_map_by_pixelformat(vcap->format.pixelformat); + +tpg_reset_source(&vcap->tpg, vcap->format.width, vcap->format.height, + vcap->format.field); +tpg_s_bytesperline(&vcap->tpg, 0, vcap->format.width * vpix->bpp); +tpg_s_buf_height(&vcap->tpg, vcap->format.height); +tpg_s_fourcc(&vcap->tpg, vpix->pixelformat); +/* + * TODO: check why the tpg_s_field need this third argument if + * it is already receiving the field + */ +tpg_s_field(&vcap->tpg, vcap->format.field, +vcap->format.field == V4L2_FIELD_ALTERNATE); I thought I explained that earlier? When in alternate field mode the format.field value will be TOP or BOTTOM, but never ALTERNATE. So tpg_s_field needs to know if it will create TOP or BOTTOM fields only, or if they will be alternating. Yes, sorry about that. I removed from the vimc_sensor but I forgot it here. I am dropping this patch in the series as I found another bug when multiple links are enabled going to the same sink pad. I'll re-work in this optimization and re-send another version in the future in a different patch series. Since we don't support ALTERNATE anyway, just pass false as the third argument and drop the comment. +tpg_s_colorspace(&vcap->tpg, vcap->format.colorspace); +tpg_s_ycbcr_enc(&vcap->tpg, vcap->format.ycbcr_enc); +tpg_s_quantization(&vcap->tpg, vcap->format.quantization); +tpg_s_xfer_func(&vcap->tpg, vcap->format.xfer_func); +} + static int vimc_cap_start_streaming(struct vb2_queue *v
how to link up audio bus from media controller driver to soc dai bus?
Greetings, I'm working on a media controller driver for the tda1997x HDMI receiver which provides an audio bus supporting I2S/SPDIF/OBA/HBR/DST. I'm unclear how to bind the audio bus to a SoC's audio bus, for example the IMX6 SSI (I2S) bus. I thought perhaps it was via a simple-audio-card device-tree binding but that appears to require an ALSA codec to bind to? Can anyone point me to an example of a media controller device driver that supports audio and video and how the audio is bound to a I2S bus? Regards, Tim
Re: [PATCH v8 00/34] i.MX Media Driver
On 06/11/2017 01:05 PM, Vladimir Zapolskiy wrote: On 06/10/2017 02:26 AM, Hans Verkuil wrote: On 10/06/17 01:16, Steve Longerbeam wrote: On 06/07/2017 12:02 PM, Hans Verkuil wrote: We're still waiting for an Ack for patch 02/34, right? Hi Hans, Rub has provided an Ack for patch 2. Other than that everything is ready AFAICT. But as Pavel pointed out, in fact we are missing many Acks still, for all of the dts source changes (patches 4-14), as well as really everything else (imx-media staging driver patches). No Acks needed for the staging part. It's staging, so not held to the same standards as non-staging parts. That doesn't mean Acks aren't welcome, of course. Acks are wanted for particular i.MX DTS changes including device tree binding descriptions. Shawn, please bless the series. I second that request! There are a couple minor update to the ARM dts patches for imx6, I will post a new series for them. But there should not be anything of much controversy in these ARM dts patches. Steve
Re: [PATCH] MAINTAINERS: add entry for Freescale i.MX media driver
On Mon, Jun 12, 2017 at 09:36:51AM -0700, Steve Longerbeam wrote: > Add maintainer entry for the imx-media driver. > > Signed-off-by: Steve Longerbeam Acked-by: Philipp Zabel regards Philipp > --- > MAINTAINERS | 12 > 1 file changed, 12 insertions(+) > > diff --git a/MAINTAINERS b/MAINTAINERS > index 9c7f663..11adc51 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -8111,6 +8111,18 @@ L: linux-...@vger.kernel.org > S: Maintained > F: drivers/iio/dac/cio-dac.c > > +MEDIA DRIVERS FOR FREESCALE IMX > +M: Steve Longerbeam > +M: Philipp Zabel > +L: linux-media@vger.kernel.org > +T: git git://linuxtv.org/media_tree.git > +S: Maintained > +F: Documentation/devicetree/bindings/media/imx.txt > +F: Documentation/media/v4l-drivers/imx.rst > +F: drivers/staging/media/imx/ > +F: include/linux/imx-media.h > +F: include/media/imx.h > + > MEDIA DRIVERS FOR RENESAS - FCP > M: Laurent Pinchart > L: linux-media@vger.kernel.org > -- > 2.7.4 > > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- |
Re: [RFC PATCH v3 05/11] [media] vimc: common: Add vimc_link_validate
Hi Hans, Thanks for your review, just a question below On 2017-06-12 06:50 AM, Hans Verkuil wrote: On 06/03/2017 04:58 AM, Helen Koike wrote: All links will be checked in the same way. Adding a helper function for that Signed-off-by: Helen Koike --- Changes in v3: [media] vimc: common: Add vimc_link_validate - this is a new patch in the series Changes in v2: None --- drivers/media/platform/vimc/vimc-capture.c | 78 +++--- drivers/media/platform/vimc/vimc-common.c | 124 - drivers/media/platform/vimc/vimc-common.h | 14 3 files changed, 148 insertions(+), 68 deletions(-) diff --git a/drivers/media/platform/vimc/vimc-capture.c b/drivers/media/platform/vimc/vimc-capture.c index 93f6a09..5bdecd1 100644 --- a/drivers/media/platform/vimc/vimc-capture.c +++ b/drivers/media/platform/vimc/vimc-capture.c @@ -64,6 +64,15 @@ static int vimc_cap_querycap(struct file *file, void *priv, return 0; } +static void vimc_cap_get_format(struct vimc_ent_device *ved, +struct v4l2_pix_format *fmt) +{ +struct vimc_cap_device *vcap = container_of(ved, struct vimc_cap_device, +ved); + +*fmt = vcap->format; +} + static int vimc_cap_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { @@ -231,74 +240,8 @@ static const struct vb2_ops vimc_cap_qops = { .wait_finish= vb2_ops_wait_finish, }; -/* - * NOTE: this function is a copy of v4l2_subdev_link_validate_get_format - * maybe the v4l2 function should be public - */ -static int vimc_cap_v4l2_subdev_link_validate_get_format(struct media_pad *pad, -struct v4l2_subdev_format *fmt) -{ -struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(pad->entity); - -fmt->which = V4L2_SUBDEV_FORMAT_ACTIVE; -fmt->pad = pad->index; - -return v4l2_subdev_call(sd, pad, get_fmt, NULL, fmt); -} - -static int vimc_cap_link_validate(struct media_link *link) -{ -struct v4l2_subdev_format source_fmt; -const struct vimc_pix_map *vpix; -struct vimc_cap_device *vcap = container_of(link->sink->entity, -struct vimc_cap_device, -vdev.entity); -struct v4l2_pix_format *sink_fmt = &vcap->format; -int ret; - -/* - * if it is a raw node from vimc-core, ignore the link for now - * TODO: remove this when there are no more raw nodes in the - * core and return error instead - */ -if (link->source->entity->obj_type == MEDIA_ENTITY_TYPE_BASE) -return 0; - -/* Get the the format of the subdev */ -ret = vimc_cap_v4l2_subdev_link_validate_get_format(link->source, -&source_fmt); -if (ret) -return ret; - -dev_dbg(vcap->vdev.v4l2_dev->dev, -"%s: link validate formats src:%dx%d %d sink:%dx%d %d\n", -vcap->vdev.name, -source_fmt.format.width, source_fmt.format.height, -source_fmt.format.code, -sink_fmt->width, sink_fmt->height, -sink_fmt->pixelformat); - -/* The width, height and code must match. */ -vpix = vimc_pix_map_by_pixelformat(sink_fmt->pixelformat); -if (source_fmt.format.width != sink_fmt->width -|| source_fmt.format.height != sink_fmt->height -|| vpix->code != source_fmt.format.code) -return -EPIPE; - -/* - * The field order must match, or the sink field order must be NONE - * to support interlaced hardware connected to bridges that support - * progressive formats only. - */ -if (source_fmt.format.field != sink_fmt->field && -sink_fmt->field != V4L2_FIELD_NONE) -return -EPIPE; - -return 0; -} - static const struct media_entity_operations vimc_cap_mops = { -.link_validate= vimc_cap_link_validate, +.link_validate= vimc_link_validate, }; static void vimc_cap_destroy(struct vimc_ent_device *ved) @@ -434,6 +377,7 @@ struct vimc_ent_device *vimc_cap_create(struct v4l2_device *v4l2_dev, vcap->ved.destroy = vimc_cap_destroy; vcap->ved.ent = &vcap->vdev.entity; vcap->ved.process_frame = vimc_cap_process_frame; +vcap->ved.vdev_get_format = vimc_cap_get_format; /* Initialize the video_device struct */ vdev = &vcap->vdev; diff --git a/drivers/media/platform/vimc/vimc-common.c b/drivers/media/platform/vimc/vimc-common.c index f809a9d..83d4251 100644 --- a/drivers/media/platform/vimc/vimc-common.c +++ b/drivers/media/platform/vimc/vimc-common.c @@ -252,8 +252,130 @@ int vimc_pipeline_s_stream(struct media_entity *ent, int enable) return 0; } +static void vimc_fmt_pix_to_mbus(struct v4l2_mbus_framefmt *mfmt, + struct v4l2_pix_format *pfmt) +{ +const struct vimc_pix_map *vpix = +vimc_pix_map_by_pixelformat(pfmt->pixelformat); + +mfmt->width = pfmt->width; +mfmt->height = pfmt->height; +mfmt->code = vpix->code; +
[PATCH v2 6/6] [media] s5p-jpeg: Add stream error handling for Exynos5420
From: henryhsu On Exynos5420, the STREAM_STAT bit raised on the JPGINTST register means there is a syntax error or an unrecoverable error on compressed file when ERR_INT_EN is set to 1. Fix this case and report BUF_STATE_ERROR to videobuf2. Signed-off-by: Henry-Ruey Hsu Signed-off-by: Thierry Escande --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 3d90a63..1a07a82 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -2790,6 +2790,7 @@ static irqreturn_t exynos3250_jpeg_irq(int irq, void *dev_id) unsigned long payload_size = 0; enum vb2_buffer_state state = VB2_BUF_STATE_DONE; bool interrupt_timeout = false; + bool stream_error = false; u32 irq_status; spin_lock(&jpeg->slock); @@ -2806,6 +2807,11 @@ static irqreturn_t exynos3250_jpeg_irq(int irq, void *dev_id) jpeg->irq_status |= irq_status; + if (irq_status & EXYNOS3250_STREAM_STAT) { + stream_error = true; + dev_err(jpeg->dev, "Syntax error or unrecoverable error occurred.\n"); + } + curr_ctx = v4l2_m2m_get_curr_priv(jpeg->m2m_dev); if (!curr_ctx) @@ -2822,7 +2828,7 @@ static irqreturn_t exynos3250_jpeg_irq(int irq, void *dev_id) EXYNOS3250_RDMA_DONE | EXYNOS3250_RESULT_STAT)) payload_size = exynos3250_jpeg_compressed_size(jpeg->regs); - else if (interrupt_timeout) + else if (interrupt_timeout || stream_error) state = VB2_BUF_STATE_ERROR; else goto exit_unlock; -- 2.7.4
[PATCH v2 3/6] [media] s5p-jpeg: Correct WARN_ON statement for checking subsampling
From: Tony K Nadackal Corrects the WARN_ON statement for subsampling based on the JPEG Hardware version. Signed-off-by: Tony K Nadackal Signed-off-by: Thierry Escande --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 623508d..0d935f5 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -614,24 +614,26 @@ static inline struct s5p_jpeg_ctx *fh_to_ctx(struct v4l2_fh *fh) static int s5p_jpeg_to_user_subsampling(struct s5p_jpeg_ctx *ctx) { - WARN_ON(ctx->subsampling > 3); - switch (ctx->jpeg->variant->version) { case SJPEG_S5P: + WARN_ON(ctx->subsampling > 3); if (ctx->subsampling > 2) return V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY; return ctx->subsampling; case SJPEG_EXYNOS3250: case SJPEG_EXYNOS5420: + WARN_ON(ctx->subsampling > 6); if (ctx->subsampling > 3) return V4L2_JPEG_CHROMA_SUBSAMPLING_411; return exynos3250_decoded_subsampling[ctx->subsampling]; case SJPEG_EXYNOS4: case SJPEG_EXYNOS5433: + WARN_ON(ctx->subsampling > 3); if (ctx->subsampling > 2) return V4L2_JPEG_CHROMA_SUBSAMPLING_420; return exynos4x12_decoded_subsampling[ctx->subsampling]; default: + WARN_ON(ctx->subsampling > 3); return V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY; } } -- 2.7.4
[PATCH v2 0/6] [media] s5p-jpeg: Various fixes and improvements
Hi, This series contains various fixes and improvements for the Samsung s5p-jpeg driver. All these patches come from the Chromium v3.8 kernel tree. In this v2: - Remove IOMMU support patch (mapping now created automatically for single JPEG CODEC device). - Remove "Change sclk_jpeg to 166MHz" patch (can be set through DT properties). - Remove support for multi-planar APIs (Not needed). - Add comment regarding call to jpeg_bound_align_image() after qbuf. - Remove unrelated code from resolution change event support patch. Regards, Thierry Abhilash Kesavan (1): [media] s5p-jpeg: Reset the Codec before doing a soft reset Tony K Nadackal (3): [media] s5p-jpeg: Call jpeg_bound_align_image after qbuf [media] s5p-jpeg: Correct WARN_ON statement for checking subsampling [media] s5p-jpeg: Decode 4:1:1 chroma subsampling format henryhsu (2): [media] s5p-jpeg: Add support for resolution change event [media] s5p-jpeg: Add stream error handling for Exynos5420 drivers/media/platform/s5p-jpeg/jpeg-core.c | 140 +- drivers/media/platform/s5p-jpeg/jpeg-core.h | 7 ++ drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c | 4 + 3 files changed, 122 insertions(+), 29 deletions(-) -- 2.7.4
[PATCH v2 5/6] [media] s5p-jpeg: Add support for resolution change event
From: henryhsu This patch adds support for resolution change event to notify clients so they can prepare correct output buffer. When resolution change happened, G_FMT for CAPTURE should return old resolution and format before CAPTURE queues streamoff. Signed-off-by: Henry-Ruey Hsu Signed-off-by: Thierry Escande --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 125 +++- drivers/media/platform/s5p-jpeg/jpeg-core.h | 7 ++ 2 files changed, 91 insertions(+), 41 deletions(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 7ef7173..3d90a63 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -1611,8 +1612,6 @@ static int s5p_jpeg_s_fmt(struct s5p_jpeg_ctx *ct, struct v4l2_format *f) FMT_TYPE_OUTPUT : FMT_TYPE_CAPTURE; q_data->fmt = s5p_jpeg_find_format(ct, pix->pixelformat, f_type); - q_data->w = pix->width; - q_data->h = pix->height; if (q_data->fmt->fourcc != V4L2_PIX_FMT_JPEG) { /* * During encoding Exynos4x12 SoCs access wider memory area @@ -1620,6 +1619,8 @@ static int s5p_jpeg_s_fmt(struct s5p_jpeg_ctx *ct, struct v4l2_format *f) * the JPEG_IMAGE_SIZE register. In order to avoid sysmmu * page fault calculate proper buffer size in such a case. */ + q_data->w = pix->width; + q_data->h = pix->height; if (ct->jpeg->variant->hw_ex4_compat && f_type == FMT_TYPE_OUTPUT && ct->mode == S5P_JPEG_ENCODE) q_data->size = exynos4_jpeg_get_output_buffer_size(ct, @@ -1695,6 +1696,15 @@ static int s5p_jpeg_s_fmt_vid_out(struct file *file, void *priv, return s5p_jpeg_s_fmt(fh_to_ctx(priv), f); } +static int s5p_jpeg_subscribe_event(struct v4l2_fh *fh, + const struct v4l2_event_subscription *sub) +{ + if (sub->type == V4L2_EVENT_SOURCE_CHANGE) + return v4l2_src_change_event_subscribe(fh, sub); + + return -EINVAL; +} + static int exynos3250_jpeg_try_downscale(struct s5p_jpeg_ctx *ctx, struct v4l2_rect *r) { @@ -2020,6 +2030,9 @@ static const struct v4l2_ioctl_ops s5p_jpeg_ioctl_ops = { .vidioc_g_selection = s5p_jpeg_g_selection, .vidioc_s_selection = s5p_jpeg_s_selection, + + .vidioc_subscribe_event = s5p_jpeg_subscribe_event, + .vidioc_unsubscribe_event = v4l2_event_unsubscribe, }; /* @@ -2412,8 +2425,17 @@ static int s5p_jpeg_job_ready(void *priv) { struct s5p_jpeg_ctx *ctx = priv; - if (ctx->mode == S5P_JPEG_DECODE) + if (ctx->mode == S5P_JPEG_DECODE) { + /* +* We have only one input buffer and one output buffer. If there +* is a resolution change event, no need to continue decoding. +*/ + if (ctx->state == JPEGCTX_RESOLUTION_CHANGE) + return 0; + return ctx->hdr_parsed; + } + return 1; } @@ -2492,6 +2514,30 @@ static int s5p_jpeg_buf_prepare(struct vb2_buffer *vb) return 0; } +static void s5p_jpeg_set_capture_queue_data(struct s5p_jpeg_ctx *ctx) +{ + struct s5p_jpeg_q_data *q_data = &ctx->cap_q; + + q_data->w = ctx->out_q.w; + q_data->h = ctx->out_q.h; + + /* +* This call to jpeg_bound_align_image() takes care of width and +* height values alignment when user space calls the QBUF of +* OUTPUT buffer after the S_FMT of CAPTURE buffer. +* Please note that on Exynos4x12 SoCs, resigning from executing +* S_FMT on capture buffer for each JPEG image can result in a +* hardware hangup if subsampling is lower than the one of input +* JPEG. +*/ + jpeg_bound_align_image(ctx, &q_data->w, S5P_JPEG_MIN_WIDTH, + S5P_JPEG_MAX_WIDTH, q_data->fmt->h_align, + &q_data->h, S5P_JPEG_MIN_HEIGHT, + S5P_JPEG_MAX_HEIGHT, q_data->fmt->v_align); + + q_data->size = q_data->w * q_data->h * q_data->fmt->depth >> 3; +} + static void s5p_jpeg_buf_queue(struct vb2_buffer *vb) { struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); @@ -2499,9 +2545,20 @@ static void s5p_jpeg_buf_queue(struct vb2_buffer *vb) if (ctx->mode == S5P_JPEG_DECODE && vb->vb2_queue->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) { - struct s5p_jpeg_q_data tmp, *q_data; - - ctx->hdr_parsed = s5p_jpeg_parse_hdr(&tmp, + static const struct v4l2_event ev_src_ch = { + .type = V4L2_EVENT_SOURCE_CHANGE, +
[PATCH v2 4/6] [media] s5p-jpeg: Decode 4:1:1 chroma subsampling format
From: Tony K Nadackal This patch adds support for decoding 4:1:1 chroma subsampling in the jpeg header parsing function. Signed-off-by: Tony K Nadackal Signed-off-by: Thierry Escande --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 0d935f5..7ef7173 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -1236,6 +1236,9 @@ static bool s5p_jpeg_parse_hdr(struct s5p_jpeg_q_data *result, case 0x33: ctx->subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY; break; + case 0x41: + ctx->subsampling = V4L2_JPEG_CHROMA_SUBSAMPLING_411; + break; default: return false; } -- 2.7.4
[PATCH v2 1/6] [media] s5p-jpeg: Reset the Codec before doing a soft reset
From: Abhilash Kesavan This patch resets the encoding and decoding register bits before doing a soft reset. Signed-off-by: Tony K Nadackal Signed-off-by: Thierry Escande --- drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c b/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c index a1d823a..9ad8f6d 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c @@ -21,6 +21,10 @@ void exynos4_jpeg_sw_reset(void __iomem *base) unsigned int reg; reg = readl(base + EXYNOS4_JPEG_CNTL_REG); + writel(reg & ~(EXYNOS4_DEC_MODE | EXYNOS4_ENC_MODE), + base + EXYNOS4_JPEG_CNTL_REG); + + reg = readl(base + EXYNOS4_JPEG_CNTL_REG); writel(reg & ~EXYNOS4_SOFT_RESET_HI, base + EXYNOS4_JPEG_CNTL_REG); udelay(100); -- 2.7.4
[PATCH v2 2/6] [media] s5p-jpeg: Call jpeg_bound_align_image after qbuf
From: Tony K Nadackal When queuing an OUTPUT buffer for decoder, s5p_jpeg_parse_hdr() function parses the input jpeg file and takes the width and height parameters from its header. These new width/height values will be used for the calculation of stride. HX_JPEG Hardware needs the width and height values aligned on a 16 bits boundary. This width/height alignment is handled in the s5p_jpeg_s_fmt_vid_cap() function during the S_FMT ioctl call. But if user space calls the QBUF of OUTPUT buffer after the S_FMT of CAPTURE buffer, these aligned values will be replaced by the values in jpeg header. If the width/height values of jpeg are not aligned, the decoder output will be corrupted. So in this patch we call jpeg_bound_align_image() to align the width/height values of Capture buffer in s5p_jpeg_buf_queue(). Signed-off-by: Tony K Nadackal Signed-off-by: Thierry Escande --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 52dc794..623508d 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -2523,6 +2523,25 @@ static void s5p_jpeg_buf_queue(struct vb2_buffer *vb) q_data = &ctx->cap_q; q_data->w = tmp.w; q_data->h = tmp.h; + + /* +* This call to jpeg_bound_align_image() takes care of width and +* height values alignment when user space calls the QBUF of +* OUTPUT buffer after the S_FMT of CAPTURE buffer. +* Please note that on Exynos4x12 SoCs, resigning from executing +* S_FMT on capture buffer for each JPEG image can result in a +* hardware hangup if subsampling is lower than the one of input +* JPEG. +*/ + jpeg_bound_align_image(ctx, + &q_data->w, + S5P_JPEG_MIN_WIDTH, S5P_JPEG_MAX_WIDTH, + q_data->fmt->h_align, + &q_data->h, + S5P_JPEG_MIN_HEIGHT, S5P_JPEG_MAX_HEIGHT, + q_data->fmt->v_align); + + q_data->size = q_data->w * q_data->h * q_data->fmt->depth >> 3; } v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf); -- 2.7.4
[PATCH] MAINTAINERS: add entry for Freescale i.MX media driver
Add maintainer entry for the imx-media driver. Signed-off-by: Steve Longerbeam --- MAINTAINERS | 12 1 file changed, 12 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 9c7f663..11adc51 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8111,6 +8111,18 @@ L: linux-...@vger.kernel.org S: Maintained F: drivers/iio/dac/cio-dac.c +MEDIA DRIVERS FOR FREESCALE IMX +M: Steve Longerbeam +M: Philipp Zabel +L: linux-media@vger.kernel.org +T: git git://linuxtv.org/media_tree.git +S: Maintained +F: Documentation/devicetree/bindings/media/imx.txt +F: Documentation/media/v4l-drivers/imx.rst +F: drivers/staging/media/imx/ +F: include/linux/imx-media.h +F: include/media/imx.h + MEDIA DRIVERS FOR RENESAS - FCP M: Laurent Pinchart L: linux-media@vger.kernel.org -- 2.7.4
[PATCH v10 03/18] MAINTAINERS: Add Qualcomm Venus video accelerator driver
Add an entry for Venus video encoder/decoder accelerator driver. Signed-off-by: Stanimir Varbanov --- MAINTAINERS | 8 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 053c3bdd1fe5..2cf03bb969b5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10584,6 +10584,14 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/rkuo/linux-hexagon-kernel.g S: Supported F: arch/hexagon/ +QUALCOMM VENUS VIDEO ACCELERATOR DRIVER +M: Stanimir Varbanov +L: linux-media@vger.kernel.org +L: linux-arm-...@vger.kernel.org +T: git git://linuxtv.org/media_tree.git +S: Maintained +F: drivers/media/platform/qcom/venus/ + QUALCOMM WCN36XX WIRELESS DRIVER M: Eugene Krasnikov L: wcn3...@lists.infradead.org -- 2.7.4
[PATCH v10 05/18] media: venus: vdec: add video decoder files
This consists of video decoder implementation plus decoder controls. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/vdec.c | 1154 drivers/media/platform/qcom/venus/vdec.h | 23 + drivers/media/platform/qcom/venus/vdec_ctrls.c | 150 +++ 3 files changed, 1327 insertions(+) create mode 100644 drivers/media/platform/qcom/venus/vdec.c create mode 100644 drivers/media/platform/qcom/venus/vdec.h create mode 100644 drivers/media/platform/qcom/venus/vdec_ctrls.c diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c new file mode 100644 index ..96e7e7e71e5f --- /dev/null +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -0,0 +1,1154 @@ +/* + * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. + * Copyright (C) 2017 Linaro Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hfi_venus_io.h" +#include "core.h" +#include "helpers.h" +#include "vdec.h" + +static u32 get_framesize_uncompressed(unsigned int plane, u32 width, u32 height) +{ + u32 y_stride, uv_stride, y_plane; + u32 y_sclines, uv_sclines, uv_plane; + u32 size; + + y_stride = ALIGN(width, 128); + uv_stride = ALIGN(width, 128); + y_sclines = ALIGN(height, 32); + uv_sclines = ALIGN(((height + 1) >> 1), 16); + + y_plane = y_stride * y_sclines; + uv_plane = uv_stride * uv_sclines + SZ_4K; + size = y_plane + uv_plane + SZ_8K; + + return ALIGN(size, SZ_4K); +} + +static u32 get_framesize_compressed(unsigned int width, unsigned int height) +{ + return ((width * height * 3 / 2) / 2) + 128; +} + +/* + * Three resons to keep MPLANE formats (despite that the number of planes + * currently is one): + * - the MPLANE formats allow only one plane to be used + * - the downstream driver use MPLANE formats too + * - future firmware versions could add support for >1 planes + */ +static const struct venus_format vdec_formats[] = { + { + .pixfmt = V4L2_PIX_FMT_NV12, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + }, { + .pixfmt = V4L2_PIX_FMT_MPEG4, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, + }, { + .pixfmt = V4L2_PIX_FMT_MPEG2, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, + }, { + .pixfmt = V4L2_PIX_FMT_H263, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, + }, { + .pixfmt = V4L2_PIX_FMT_VC1_ANNEX_G, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, + }, { + .pixfmt = V4L2_PIX_FMT_VC1_ANNEX_L, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, + }, { + .pixfmt = V4L2_PIX_FMT_H264, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, + }, { + .pixfmt = V4L2_PIX_FMT_VP8, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, + }, { + .pixfmt = V4L2_PIX_FMT_VP9, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, + }, { + .pixfmt = V4L2_PIX_FMT_XVID, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, + }, +}; + +static const struct venus_format *find_format(u32 pixfmt, u32 type) +{ + const struct venus_format *fmt = vdec_formats; + unsigned int size = ARRAY_SIZE(vdec_formats); + unsigned int i; + + for (i = 0; i < size; i++) { + if (fmt[i].pixfmt == pixfmt) + break; + } + + if (i == size || fmt[i].type != type) + return NULL; + + return &fmt[i]; +} + +static const struct venus_format * +find_format_by_index(unsigned int index, u32 type) +{ + const struct venus_format *fmt = vdec_formats; + unsigned int size = ARRAY_SIZE(vdec_formats); + unsigned int i, k = 0; + + if (index > size) + return NULL; + + for (i = 0; i < size; i++) { + if (fmt[i].type != type) + continue; + if (k == index) + break; +
[PATCH v10 06/18] media: venus: venc: add video encoder files
This adds encoder part of the driver plus encoder controls. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/venc.c | 1283 drivers/media/platform/qcom/venus/venc.h | 23 + drivers/media/platform/qcom/venus/venc_ctrls.c | 270 + 3 files changed, 1576 insertions(+) create mode 100644 drivers/media/platform/qcom/venus/venc.c create mode 100644 drivers/media/platform/qcom/venus/venc.h create mode 100644 drivers/media/platform/qcom/venus/venc_ctrls.c diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c new file mode 100644 index ..d5b4b5bf10a2 --- /dev/null +++ b/drivers/media/platform/qcom/venus/venc.c @@ -0,0 +1,1283 @@ +/* + * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. + * Copyright (C) 2017 Linaro Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hfi_venus_io.h" +#include "core.h" +#include "helpers.h" +#include "venc.h" + +#define NUM_B_FRAMES_MAX 4 + +static u32 get_framesize_uncompressed(unsigned int plane, u32 width, u32 height) +{ + u32 y_stride, uv_stride, y_plane; + u32 y_sclines, uv_sclines, uv_plane; + u32 size; + + y_stride = ALIGN(width, 128); + uv_stride = ALIGN(width, 128); + y_sclines = ALIGN(height, 32); + uv_sclines = ALIGN(((height + 1) >> 1), 16); + + y_plane = y_stride * y_sclines; + uv_plane = uv_stride * uv_sclines + SZ_4K; + size = y_plane + uv_plane + SZ_8K; + size = ALIGN(size, SZ_4K); + + return size; +} + +static u32 get_framesize_compressed(u32 width, u32 height) +{ + u32 sz = ALIGN(height, 32) * ALIGN(width, 32) * 3 / 2 / 2; + + return ALIGN(sz, SZ_4K); +} + +/* + * Three resons to keep MPLANE formats (despite that the number of planes + * currently is one): + * - the MPLANE formats allow only one plane to be used + * - the downstream driver use MPLANE formats too + * - future firmware versions could add support for >1 planes + */ +static const struct venus_format venc_formats[] = { + { + .pixfmt = V4L2_PIX_FMT_NV12, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, + }, { + .pixfmt = V4L2_PIX_FMT_MPEG4, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + }, { + .pixfmt = V4L2_PIX_FMT_H263, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + }, { + .pixfmt = V4L2_PIX_FMT_H264, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + }, { + .pixfmt = V4L2_PIX_FMT_VP8, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + }, { + .pixfmt = V4L2_PIX_FMT_VP9, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + }, +}; + +static const struct venus_format *find_format(u32 pixfmt, u32 type) +{ + const struct venus_format *fmt = venc_formats; + unsigned int size = ARRAY_SIZE(venc_formats); + unsigned int i; + + for (i = 0; i < size; i++) { + if (fmt[i].pixfmt == pixfmt) + break; + } + + if (i == size || fmt[i].type != type) + return NULL; + + return &fmt[i]; +} + +static const struct venus_format * +find_format_by_index(unsigned int index, u32 type) +{ + const struct venus_format *fmt = venc_formats; + unsigned int size = ARRAY_SIZE(venc_formats); + unsigned int i, k = 0; + + if (index > size) + return NULL; + + for (i = 0; i < size; i++) { + if (fmt[i].type != type) + continue; + if (k == index) + break; + k++; + } + + if (i == size) + return NULL; + + return &fmt[i]; +} + +static int venc_v4l2_to_hfi(int id, int value) +{ + switch (id) { + case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL: + switch (value) { + case V4L2_MPEG_VIDEO_MPEG4_LEVEL_0: + default: + return HFI_MPEG4_LEVEL_0; + case V4L2_MPEG_VIDEO_MPEG4_LEVEL_0B: + return HFI_MPEG4_LEVEL_0b; + case V4L2_MPEG_VIDEO_
[PATCH v10 08/18] media: venus: hfi: add Venus HFI files
Here is the implementation of Venus video accelerator low-level functionality. It contanins code which setup the registers and startup uthe processor, allocate and manipulates with the shared memory used for sending commands and receiving messages. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi_venus.c| 1571 ++ drivers/media/platform/qcom/venus/hfi_venus.h| 23 + drivers/media/platform/qcom/venus/hfi_venus_io.h | 113 ++ 3 files changed, 1707 insertions(+) create mode 100644 drivers/media/platform/qcom/venus/hfi_venus.c create mode 100644 drivers/media/platform/qcom/venus/hfi_venus.h create mode 100644 drivers/media/platform/qcom/venus/hfi_venus_io.h diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c new file mode 100644 index ..ab209f3d9498 --- /dev/null +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -0,0 +1,1571 @@ +/* + * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. + * Copyright (C) 2017 Linaro Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "core.h" +#include "hfi_cmds.h" +#include "hfi_msgs.h" +#include "hfi_venus.h" +#include "hfi_venus_io.h" + +#define HFI_MASK_QHDR_TX_TYPE 0xff00 +#define HFI_MASK_QHDR_RX_TYPE 0x00ff +#define HFI_MASK_QHDR_PRI_TYPE 0xff00 +#define HFI_MASK_QHDR_ID_TYPE 0x00ff + +#define HFI_HOST_TO_CTRL_CMD_Q 0 +#define HFI_CTRL_TO_HOST_MSG_Q 1 +#define HFI_CTRL_TO_HOST_DBG_Q 2 +#define HFI_MASK_QHDR_STATUS 0x00ff + +#define IFACEQ_NUM 3 +#define IFACEQ_CMD_IDX 0 +#define IFACEQ_MSG_IDX 1 +#define IFACEQ_DBG_IDX 2 +#define IFACEQ_MAX_BUF_COUNT 50 +#define IFACEQ_MAX_PARALLEL_CLNTS 16 +#define IFACEQ_DFLT_QHDR 0x0101 + +#define POLL_INTERVAL_US 50 + +#define IFACEQ_MAX_PKT_SIZE1024 +#define IFACEQ_MED_PKT_SIZE768 +#define IFACEQ_MIN_PKT_SIZE8 +#define IFACEQ_VAR_SMALL_PKT_SIZE 100 +#define IFACEQ_VAR_LARGE_PKT_SIZE 512 +#define IFACEQ_VAR_HUGE_PKT_SIZE (1024 * 12) + +enum tzbsp_video_state { + TZBSP_VIDEO_STATE_SUSPEND = 0, + TZBSP_VIDEO_STATE_RESUME +}; + +struct hfi_queue_table_header { + u32 version; + u32 size; + u32 qhdr0_offset; + u32 qhdr_size; + u32 num_q; + u32 num_active_q; +}; + +struct hfi_queue_header { + u32 status; + u32 start_addr; + u32 type; + u32 q_size; + u32 pkt_size; + u32 pkt_drop_cnt; + u32 rx_wm; + u32 tx_wm; + u32 rx_req; + u32 tx_req; + u32 rx_irq_status; + u32 tx_irq_status; + u32 read_idx; + u32 write_idx; +}; + +#define IFACEQ_TABLE_SIZE \ + (sizeof(struct hfi_queue_table_header) +\ +sizeof(struct hfi_queue_header) * IFACEQ_NUM) + +#define IFACEQ_QUEUE_SIZE (IFACEQ_MAX_PKT_SIZE * \ + IFACEQ_MAX_BUF_COUNT * IFACEQ_MAX_PARALLEL_CLNTS) + +#define IFACEQ_GET_QHDR_START_ADDR(ptr, i) \ + (void *)(((ptr) + sizeof(struct hfi_queue_table_header)) + \ + ((i) * sizeof(struct hfi_queue_header))) + +#define QDSS_SIZE SZ_4K +#define SFR_SIZE SZ_4K +#define QUEUE_SIZE \ + (IFACEQ_TABLE_SIZE + (IFACEQ_QUEUE_SIZE * IFACEQ_NUM)) + +#define ALIGNED_QDSS_SIZE ALIGN(QDSS_SIZE, SZ_4K) +#define ALIGNED_SFR_SIZE ALIGN(SFR_SIZE, SZ_4K) +#define ALIGNED_QUEUE_SIZE ALIGN(QUEUE_SIZE, SZ_4K) +#define SHARED_QSIZE ALIGN(ALIGNED_SFR_SIZE + ALIGNED_QUEUE_SIZE + \ + ALIGNED_QDSS_SIZE, SZ_1M) + +struct mem_desc { + dma_addr_t da; /* device address */ + void *kva; /* kernel virtual address */ + u32 size; + unsigned long attrs; +}; + +struct iface_queue { + struct hfi_queue_header *qhdr; + struct mem_desc qmem; +}; + +enum venus_state { + VENUS_STATE_DEINIT = 1, + VENUS_STATE_INIT, +}; + +struct venus_hfi_device { + struct venus_core *core; + u32 irq_status; + u32 last_packet_type; + bool power_enabled; + bool suspended; + enum venus_state state; + /* serialize read / write to the shared memory */ + struct mutex lock; + struct completion pwr_
[PATCH v10 14/18] media: venus: hfi_msgs: fix set but not used variables
This fixes a warning found when building with gcc7: drivers/media/platform/qcom/venus/hfi_msgs.c:465:40: warning: variable 'domain' set but not used [-Wunused-but-set-variable] u32 rem_bytes, num_props, codecs = 0, domain = 0; ^~ drivers/media/platform/qcom/venus/hfi_msgs.c:465:28: warning: variable 'codecs' set but not used [-Wunused-but-set-variable] u32 rem_bytes, num_props, codecs = 0, domain = 0; The warning is avoided by deleting the variables declaration. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi_msgs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c b/drivers/media/platform/qcom/venus/hfi_msgs.c index 88898118f6af..f8841713e417 100644 --- a/drivers/media/platform/qcom/venus/hfi_msgs.c +++ b/drivers/media/platform/qcom/venus/hfi_msgs.c @@ -462,7 +462,7 @@ static u32 init_done_read_prop(struct venus_core *core, struct venus_inst *inst, struct hfi_msg_session_init_done_pkt *pkt) { struct device *dev = core->dev; - u32 rem_bytes, num_props, codecs = 0, domain = 0; + u32 rem_bytes, num_props; u32 ptype, next_offset = 0; u32 err; u8 *data; @@ -490,8 +490,6 @@ static u32 init_done_read_prop(struct venus_core *core, struct venus_inst *inst, (struct hfi_codec_mask_supported *) (data + next_offset); - codecs = masks->codecs; - domain = masks->video_domains; next_offset += sizeof(*masks); num_props--; break; -- 2.7.4
[PATCH v10 04/18] media: venus: adding core part and helper functions
* core.c has implemented the platform driver methods, file operations and v4l2 registration. * helpers.c has implemented common helper functions for: - buffer management - vb2_ops and functions for format propagation, - functions for allocating and freeing buffers for internal usage. The buffer parameters describing internal buffers depends on current format, resolution and codec. - functions for calculation of current load of the hardware. Depending on the count of instances and resolutions it selects the best clock rate for the video core. * firmware loader Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.c | 388 ++ drivers/media/platform/qcom/venus/core.h | 323 drivers/media/platform/qcom/venus/firmware.c | 109 drivers/media/platform/qcom/venus/firmware.h | 22 + drivers/media/platform/qcom/venus/helpers.c | 727 +++ drivers/media/platform/qcom/venus/helpers.h | 45 ++ 6 files changed, 1614 insertions(+) create mode 100644 drivers/media/platform/qcom/venus/core.c create mode 100644 drivers/media/platform/qcom/venus/core.h create mode 100644 drivers/media/platform/qcom/venus/firmware.c create mode 100644 drivers/media/platform/qcom/venus/firmware.h create mode 100644 drivers/media/platform/qcom/venus/helpers.c create mode 100644 drivers/media/platform/qcom/venus/helpers.h diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c new file mode 100644 index ..48391d87d5c3 --- /dev/null +++ b/drivers/media/platform/qcom/venus/core.c @@ -0,0 +1,388 @@ +/* + * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. + * Copyright (C) 2017 Linaro Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "core.h" +#include "vdec.h" +#include "venc.h" +#include "firmware.h" + +static void venus_event_notify(struct venus_core *core, u32 event) +{ + struct venus_inst *inst; + + switch (event) { + case EVT_SYS_WATCHDOG_TIMEOUT: + case EVT_SYS_ERROR: + break; + default: + return; + } + + mutex_lock(&core->lock); + core->sys_error = true; + list_for_each_entry(inst, &core->instances, list) + inst->ops->event_notify(inst, EVT_SESSION_ERROR, NULL); + mutex_unlock(&core->lock); + + disable_irq_nosync(core->irq); + + /* +* Delay recovery to ensure venus has completed any pending cache +* operations. Without this sleep, we see device reset when firmware is +* unloaded after a system error. +*/ + schedule_delayed_work(&core->work, msecs_to_jiffies(100)); +} + +static const struct hfi_core_ops venus_core_ops = { + .event_notify = venus_event_notify, +}; + +static void venus_sys_error_handler(struct work_struct *work) +{ + struct venus_core *core = + container_of(work, struct venus_core, work.work); + int ret = 0; + + dev_warn(core->dev, "system error has occurred, starting recovery!\n"); + + pm_runtime_get_sync(core->dev); + + hfi_core_deinit(core, true); + hfi_destroy(core); + mutex_lock(&core->lock); + venus_shutdown(&core->dev_fw); + + pm_runtime_put_sync(core->dev); + + ret |= hfi_create(core, &venus_core_ops); + + pm_runtime_get_sync(core->dev); + + ret |= venus_boot(core->dev, &core->dev_fw); + + ret |= hfi_core_resume(core, true); + + enable_irq(core->irq); + + mutex_unlock(&core->lock); + + ret |= hfi_core_init(core); + + pm_runtime_put_sync(core->dev); + + if (ret) { + disable_irq_nosync(core->irq); + dev_warn(core->dev, "recovery failed (%d)\n", ret); + schedule_delayed_work(&core->work, msecs_to_jiffies(10)); + return; + } + + mutex_lock(&core->lock); + core->sys_error = false; + mutex_unlock(&core->lock); +} + +static int venus_clks_get(struct venus_core *core) +{ + const struct venus_resources *res = core->res; + struct device *dev = core->dev; + unsigned int i; + + for (i = 0; i < res->clks_num; i++) { + core->clks[i] = devm_clk_get(dev, res->clks[i]); + if (IS_ERR(core->clks[i])) + return PTR_ERR(core->clks[i
[PATCH v10 13/18] media: venus: hfi_venus: fix variable dereferenced before check
This fixes a warning found when building with gcc7: drivers/media/platform/qcom/venus/hfi_venus.c:998 venus_isr_thread() warn: variable dereferenced before check 'hdev' (see line 994) Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi_venus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c index ab209f3d9498..1caae8feaa36 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -991,13 +991,14 @@ static void venus_process_msg_sys_error(struct venus_hfi_device *hdev, static irqreturn_t venus_isr_thread(struct venus_core *core) { struct venus_hfi_device *hdev = to_hfi_priv(core); - const struct venus_resources *res = hdev->core->res; + const struct venus_resources *res; void *pkt; u32 msg_ret; if (!hdev) return IRQ_NONE; + res = hdev->core->res; pkt = hdev->pkt_buf; if (hdev->irq_status & WRAPPER_INTR_STATUS_A2HWD_MASK) { -- 2.7.4
[PATCH v10 09/18] media: venus: enable building of Venus video driver
This adds Venus driver Makefile and changes v4l2 platform Makefile/Kconfig in order to enable building of the driver. Note that in this initial version the COMPILE_TEST-ing is not supported because the drivers specific to ARM builds are still in process of enabling the aforementioned compile testing. Once that disadvantage is fixed the Venus driver compile testing will be possible with follow-up changes. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/Kconfig | 13 + drivers/media/platform/Makefile| 2 ++ drivers/media/platform/qcom/venus/Makefile | 11 +++ 3 files changed, 26 insertions(+) create mode 100644 drivers/media/platform/qcom/venus/Makefile diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 288d3b0dc812..017e42ce0ff9 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -464,6 +464,19 @@ config VIDEO_TI_VPE_DEBUG ---help--- Enable debug messages on VPE driver. +config VIDEO_QCOM_VENUS + tristate "Qualcomm Venus V4L2 encoder/decoder driver" + depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA + depends on ARCH_QCOM && IOMMU_DMA + select QCOM_MDT_LOADER + select VIDEOBUF2_DMA_SG + select V4L2_MEM2MEM_DEV + ---help--- + This is a V4L2 driver for Qualcomm Venus video accelerator + hardware. It accelerates encoding and decoding operations + on various Qualcomm SoCs. + To compile this driver as a module choose m here. + endif # V4L_MEM2MEM_DRIVERS # TI VIDEO PORT Helper Modules diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index c3588d570f5d..37053723fb03 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -79,3 +79,5 @@ obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec/ obj-$(CONFIG_VIDEO_MEDIATEK_MDP) += mtk-mdp/ obj-$(CONFIG_VIDEO_MEDIATEK_JPEG) += mtk-jpeg/ + +obj-$(CONFIG_VIDEO_QCOM_VENUS) += qcom/venus/ diff --git a/drivers/media/platform/qcom/venus/Makefile b/drivers/media/platform/qcom/venus/Makefile new file mode 100644 index ..0fe9afb83697 --- /dev/null +++ b/drivers/media/platform/qcom/venus/Makefile @@ -0,0 +1,11 @@ +# Makefile for Qualcomm Venus driver + +venus-core-objs += core.o helpers.o firmware.o \ + hfi_venus.o hfi_msgs.o hfi_cmds.o hfi.o + +venus-dec-objs += vdec.o vdec_ctrls.o +venus-enc-objs += venc.o venc_ctrls.o + +obj-$(CONFIG_VIDEO_QCOM_VENUS) += venus-core.o +obj-$(CONFIG_VIDEO_QCOM_VENUS) += venus-dec.o +obj-$(CONFIG_VIDEO_QCOM_VENUS) += venus-enc.o -- 2.7.4
[PATCH v10 11/18] media: venus: hfi_cmds: fix variable dereferenced before check
This fixes a warning found when building the driver with gcc7: drivers/media/platform/qcom/venus/hfi_cmds.c:415 pkt_session_set_property_1x() warn: variable dereferenced before check 'pkt' (see line 412) drivers/media/platform/qcom/venus/hfi_cmds.c:1177 pkt_session_set_property_3xx() warn: variable dereferenced before check 'pkt' (see line 1174) Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi_cmds.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c index dad41a6af42e..b83c5b8ddccb 100644 --- a/drivers/media/platform/qcom/venus/hfi_cmds.c +++ b/drivers/media/platform/qcom/venus/hfi_cmds.c @@ -409,12 +409,14 @@ static int pkt_session_get_property_1x(struct hfi_session_get_property_pkt *pkt, static int pkt_session_set_property_1x(struct hfi_session_set_property_pkt *pkt, void *cookie, u32 ptype, void *pdata) { - void *prop_data = &pkt->data[1]; + void *prop_data; int ret = 0; if (!pkt || !cookie || !pdata) return -EINVAL; + prop_data = &pkt->data[1]; + pkt->shdr.hdr.size = sizeof(*pkt); pkt->shdr.hdr.pkt_type = HFI_CMD_SESSION_SET_PROPERTY; pkt->shdr.session_id = hash32_ptr(cookie); @@ -1171,12 +1173,14 @@ static int pkt_session_set_property_3xx(struct hfi_session_set_property_pkt *pkt, void *cookie, u32 ptype, void *pdata) { - void *prop_data = &pkt->data[1]; + void *prop_data; int ret = 0; if (!pkt || !cookie || !pdata) return -EINVAL; + prop_data = &pkt->data[1]; + pkt->shdr.hdr.size = sizeof(*pkt); pkt->shdr.hdr.pkt_type = HFI_CMD_SESSION_SET_PROPERTY; pkt->shdr.session_id = hash32_ptr(cookie); -- 2.7.4
[PATCH v10 07/18] media: venus: hfi: add Host Firmware Interface (HFI)
This is the implementation of HFI. It is charged with the responsibility to comunicate with the firmware through an interface commands and messages. - hfi.c has interface functions used by the core, decoder and encoder parts to comunicate with the firmware. For example there are functions for session and core initialisation. - hfi_cmds has packetization operations which preparing packets to be send from host to firmware. - hfi_msgs takes care of messages sent from firmware to the host. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi.c| 522 ++ drivers/media/platform/qcom/venus/hfi.h| 175 drivers/media/platform/qcom/venus/hfi_cmds.c | 1255 drivers/media/platform/qcom/venus/hfi_cmds.h | 304 ++ drivers/media/platform/qcom/venus/hfi_helper.h | 1050 drivers/media/platform/qcom/venus/hfi_msgs.c | 1054 drivers/media/platform/qcom/venus/hfi_msgs.h | 283 ++ 7 files changed, 4643 insertions(+) create mode 100644 drivers/media/platform/qcom/venus/hfi.c create mode 100644 drivers/media/platform/qcom/venus/hfi.h create mode 100644 drivers/media/platform/qcom/venus/hfi_cmds.c create mode 100644 drivers/media/platform/qcom/venus/hfi_cmds.h create mode 100644 drivers/media/platform/qcom/venus/hfi_helper.h create mode 100644 drivers/media/platform/qcom/venus/hfi_msgs.c create mode 100644 drivers/media/platform/qcom/venus/hfi_msgs.h diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platform/qcom/venus/hfi.c new file mode 100644 index ..20c9205fdbb4 --- /dev/null +++ b/drivers/media/platform/qcom/venus/hfi.c @@ -0,0 +1,522 @@ +/* + * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. + * Copyright (C) 2017 Linaro Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#include +#include +#include +#include +#include +#include + +#include "core.h" +#include "hfi.h" +#include "hfi_cmds.h" +#include "hfi_venus.h" + +#define TIMEOUTmsecs_to_jiffies(1000) + +static u32 to_codec_type(u32 pixfmt) +{ + switch (pixfmt) { + case V4L2_PIX_FMT_H264: + case V4L2_PIX_FMT_H264_NO_SC: + return HFI_VIDEO_CODEC_H264; + case V4L2_PIX_FMT_H263: + return HFI_VIDEO_CODEC_H263; + case V4L2_PIX_FMT_MPEG1: + return HFI_VIDEO_CODEC_MPEG1; + case V4L2_PIX_FMT_MPEG2: + return HFI_VIDEO_CODEC_MPEG2; + case V4L2_PIX_FMT_MPEG4: + return HFI_VIDEO_CODEC_MPEG4; + case V4L2_PIX_FMT_VC1_ANNEX_G: + case V4L2_PIX_FMT_VC1_ANNEX_L: + return HFI_VIDEO_CODEC_VC1; + case V4L2_PIX_FMT_VP8: + return HFI_VIDEO_CODEC_VP8; + case V4L2_PIX_FMT_VP9: + return HFI_VIDEO_CODEC_VP9; + case V4L2_PIX_FMT_XVID: + return HFI_VIDEO_CODEC_DIVX; + default: + return 0; + } +} + +int hfi_core_init(struct venus_core *core) +{ + int ret = 0; + + mutex_lock(&core->lock); + + if (core->state >= CORE_INIT) + goto unlock; + + reinit_completion(&core->done); + + ret = core->ops->core_init(core); + if (ret) + goto unlock; + + ret = wait_for_completion_timeout(&core->done, TIMEOUT); + if (!ret) { + ret = -ETIMEDOUT; + goto unlock; + } + + ret = 0; + + if (core->error != HFI_ERR_NONE) { + ret = -EIO; + goto unlock; + } + + core->state = CORE_INIT; +unlock: + mutex_unlock(&core->lock); + return ret; +} + +static int core_deinit_wait_atomic_t(atomic_t *p) +{ + schedule(); + return 0; +} + +int hfi_core_deinit(struct venus_core *core, bool blocking) +{ + int ret = 0, empty; + + mutex_lock(&core->lock); + + if (core->state == CORE_UNINIT) + goto unlock; + + empty = list_empty(&core->instances); + + if (!empty && !blocking) { + ret = -EBUSY; + goto unlock; + } + + if (!empty) { + mutex_unlock(&core->lock); + wait_on_atomic_t(&core->insts_count, core_deinit_wait_atomic_t, +TASK_UNINTERRUPTIBLE); + mutex_lock(&core->lock); + } + + ret = core->ops->core_deinit(core); + + if (!ret) + core->state = CORE_UNINIT; + +unlock: + mutex_unlock(&core->lock); + re
[PATCH v10 16/18] media: venus: venc: fix compile error in venc_close
This fixes the following compile error ocured when building with gcc7: drivers/media/platform/qcom/venus/venc.c:1150 venc_close() error: dereferencing freed memory 'inst' by moving kfree as a last call. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/venc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index d5b4b5bf10a2..39748e7a08e4 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -1145,10 +1145,10 @@ static int venc_close(struct file *file) mutex_destroy(&inst->lock); v4l2_fh_del(&inst->fh); v4l2_fh_exit(&inst->fh); - kfree(inst); pm_runtime_put_sync(inst->core->dev_enc); + kfree(inst); return 0; } -- 2.7.4
[PATCH v10 15/18] media: venus: vdec: fix compile error in vdec_close
This fixes the following compile error ocured when building with gcc7: drivers/media/platform/qcom/venus/vdec.c:1022 vdec_close() error: dereferencing freed memory 'inst' by moving kfree as a last call. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/vdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 96e7e7e71e5f..594315b55b1f 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -1017,9 +1017,10 @@ static int vdec_close(struct file *file) mutex_destroy(&inst->lock); v4l2_fh_del(&inst->fh); v4l2_fh_exit(&inst->fh); - kfree(inst); pm_runtime_put_sync(inst->core->dev_dec); + + kfree(inst); return 0; } -- 2.7.4
[PATCH v10 18/18] media: venus: enable building with COMPILE_TEST
We want all media drivers to build with COMPILE_TEST, as the Coverity instance we use on Kernel works only for x86. Also, our test workflow relies on it, in order to identify git bisect breakages. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Stanimir Varbanov --- drivers/media/platform/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 017e42ce0ff9..0898f63fa451 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -467,7 +467,7 @@ config VIDEO_TI_VPE_DEBUG config VIDEO_QCOM_VENUS tristate "Qualcomm Venus V4L2 encoder/decoder driver" depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA - depends on ARCH_QCOM && IOMMU_DMA + depends on (ARCH_QCOM && IOMMU_DMA) || COMPILE_TEST select QCOM_MDT_LOADER select VIDEOBUF2_DMA_SG select V4L2_MEM2MEM_DEV -- 2.7.4
[PATCH v10 17/18] media: venus: vdec: add support for min buffers for capture
This adds support for V4L2_CID_MIN_BUFFERS_FOR_CAPTURE get control in venus decoder, it is usable in case when the userspace wants to know minimum capture buffers before calling request_buf for capture queue in mem2mem drivers. Also this will fix an issue found gstreamer v4l2videodec element, i.e. the video decoder element cannot continue because the buffers are insufficient. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/vdec.c | 7 +++ drivers/media/platform/qcom/venus/vdec_ctrls.c | 10 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 594315b55b1f..eb0c1c51cfef 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -627,6 +627,12 @@ static int vdec_queue_setup(struct vb2_queue *q, inst->out_height); inst->input_buf_size = sizes[0]; inst->num_input_bufs = *num_buffers; + + ret = vdec_cap_num_buffers(inst, &num); + if (ret) + break; + + inst->num_output_bufs = num; break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: *num_planes = inst->fmt_cap->num_planes; @@ -951,6 +957,7 @@ static int vdec_open(struct file *file) inst->core = core; inst->session_type = VIDC_SESSION_TYPE_DEC; + inst->num_output_bufs = 1; venus_helper_init_instance(inst); diff --git a/drivers/media/platform/qcom/venus/vdec_ctrls.c b/drivers/media/platform/qcom/venus/vdec_ctrls.c index 1045fc5b4925..032839bbc967 100644 --- a/drivers/media/platform/qcom/venus/vdec_ctrls.c +++ b/drivers/media/platform/qcom/venus/vdec_ctrls.c @@ -70,6 +70,9 @@ static int vdec_op_g_volatile_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER: ctrl->val = ctr->post_loop_deb_mode; break; + case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE: + ctrl->val = inst->num_output_bufs; + break; default: return -EINVAL; }; @@ -87,7 +90,7 @@ int vdec_ctrl_init(struct venus_inst *inst) struct v4l2_ctrl *ctrl; int ret; - ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 6); + ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 7); if (ret) return ret; @@ -135,6 +138,11 @@ int vdec_ctrl_init(struct venus_inst *inst) v4l2_ctrl_new_std(&inst->ctrl_handler, &vdec_ctrl_ops, V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER, 0, 1, 1, 0); + ctrl = v4l2_ctrl_new_std(&inst->ctrl_handler, &vdec_ctrl_ops, + V4L2_CID_MIN_BUFFERS_FOR_CAPTURE, 1, 32, 1, 1); + if (ctrl) + ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE; + ret = inst->ctrl_handler.error; if (ret) { v4l2_ctrl_handler_free(&inst->ctrl_handler); -- 2.7.4
[PATCH v10 12/18] media: venus: helpers: fix variable dereferenced before check
This fixes a warning found when building the driver with gcc7: drivers/media/platform/qcom/venus/helpers.c:157 load_per_instance() warn: variable dereferenced before check 'inst' (see line 153) Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index f777ef80b941..5f4434c0a8f1 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -150,14 +150,12 @@ static int intbufs_free(struct venus_inst *inst) static u32 load_per_instance(struct venus_inst *inst) { - u32 w = inst->width; - u32 h = inst->height; u32 mbs; if (!inst || !(inst->state >= INST_INIT && inst->state < INST_STOP)) return 0; - mbs = (ALIGN(w, 16) / 16) * (ALIGN(h, 16) / 16); + mbs = (ALIGN(inst->width, 16) / 16) * (ALIGN(inst->height, 16) / 16); return mbs * inst->fps; } -- 2.7.4
[GIT PULL] linux-firmware: Add Qualcomm Venus firmware
Hi, This pull request adds firmware for venus video codec driver. The following changes since commit 37857004a430e96dc837db7f967b6d0279053de8: linux-firmware: add firmware image for Redpine 9113 chipset (2017-06-01 10:22:17 -0700) are available in the git repository at: https://github.com/svarbanov/linux-firmware.git for you to fetch changes up to 70c8af0291f81a39b411f7f125ec413f00073e5f: qcom: add venus firmware files for v1.8 (2017-06-12 17:09:27 +0300) Stanimir Varbanov (1): qcom: add venus firmware files for v1.8 LICENSE.qcom | 206 +++ WHENCE | 18 ++ qcom/NOTICE.txt | 506 +++ qcom/venus-1.8/venus.b00 | Bin 0 -> 212 bytes qcom/venus-1.8/venus.b01 | Bin 0 -> 6600 bytes qcom/venus-1.8/venus.b02 | Bin 0 -> 975088 bytes qcom/venus-1.8/venus.b03 | Bin 0 -> 5568 bytes qcom/venus-1.8/venus.b04 | 1 + qcom/venus-1.8/venus.mdt | Bin 0 -> 6812 bytes 9 files changed, 731 insertions(+) create mode 100644 LICENSE.qcom create mode 100644 qcom/NOTICE.txt create mode 100644 qcom/venus-1.8/venus.b00 create mode 100644 qcom/venus-1.8/venus.b01 create mode 100644 qcom/venus-1.8/venus.b02 create mode 100644 qcom/venus-1.8/venus.b03 create mode 100644 qcom/venus-1.8/venus.b04 create mode 100644 qcom/venus-1.8/venus.mdt -- regards, Stan
[PATCH v10 02/18] doc: DT: venus: binding document for Qualcomm video driver
Add binding document for Venus video encoder/decoder driver Cc: Rob Herring Cc: devicet...@vger.kernel.org Acked-by: Rob Herring Signed-off-by: Stanimir Varbanov --- .../devicetree/bindings/media/qcom,venus.txt | 107 + 1 file changed, 107 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/qcom,venus.txt diff --git a/Documentation/devicetree/bindings/media/qcom,venus.txt b/Documentation/devicetree/bindings/media/qcom,venus.txt new file mode 100644 index ..2693449daf73 --- /dev/null +++ b/Documentation/devicetree/bindings/media/qcom,venus.txt @@ -0,0 +1,107 @@ +* Qualcomm Venus video encoder/decoder accelerators + +- compatible: + Usage: required + Value type: + Definition: Value should contain one of: + - "qcom,msm8916-venus" + - "qcom,msm8996-venus" +- reg: + Usage: required + Value type: + Definition: Register base address and length of the register map. +- interrupts: + Usage: required + Value type: + Definition: Should contain interrupt line number. +- clocks: + Usage: required + Value type: + Definition: A List of phandle and clock specifier pairs as listed + in clock-names property. +- clock-names: + Usage: required for msm8916 + Value type: + Definition: Should contain the following entries: + - "core"Core video accelerator clock + - "iface" Video accelerator AHB clock + - "bus" Video accelerator AXI clock +- clock-names: + Usage: required for msm8996 + Value type: + Definition: Should contain the following entries: + - "core"Core video accelerator clock + - "iface" Video accelerator AHB clock + - "bus" Video accelerator AXI clock + - "mbus"Video MAXI clock +- power-domains: + Usage: required + Value type: + Definition: A phandle and power domain specifier pairs to the + power domain which is responsible for collapsing + and restoring power to the peripheral. +- iommus: + Usage: required + Value type: + Definition: A list of phandle and IOMMU specifier pairs. +- memory-region: + Usage: required + Value type: + Definition: reference to the reserved-memory for the firmware + memory region. + +* Subnodes +The Venus video-codec node must contain two subnodes representing +video-decoder and video-encoder. + +Every of video-encoder or video-decoder subnode should have: + +- compatible: + Usage: required + Value type: + Definition: Value should contain "venus-decoder" or "venus-encoder" +- clocks: + Usage: required for msm8996 + Value type: + Definition: A List of phandle and clock specifier pairs as listed + in clock-names property. +- clock-names: + Usage: required for msm8996 + Value type: + Definition: Should contain the following entries: + - "core"Subcore video accelerator clock + +- power-domains: + Usage: required for msm8996 + Value type: + Definition: A phandle and power domain specifier pairs to the + power domain which is responsible for collapsing + and restoring power to the subcore. + +* An Example + video-codec@1d0 { + compatible = "qcom,msm8916-venus"; + reg = <0x01d0 0xff000>; + interrupts = ; + clocks = <&gcc GCC_VENUS0_VCODEC0_CLK>, +<&gcc GCC_VENUS0_AHB_CLK>, +<&gcc GCC_VENUS0_AXI_CLK>; + clock-names = "core", "iface", "bus"; + power-domains = <&gcc VENUS_GDSC>; + iommus = <&apps_iommu 5>; + memory-region = <&venus_mem>; + + video-decoder { + compatible = "venus-decoder"; + clocks = <&mmcc VIDEO_SUBCORE0_CLK>; + clock-names = "core"; + power-domains = <&mmcc VENUS_CORE0_GDSC>; + }; + + video-encoder { + compatible = "venus-encoder"; + clocks = <&mmcc VIDEO_SUBCORE1_CLK>; + clock-names = "core"; + power-domains = <&mmcc VENUS_CORE1_GDSC>; + }; + }; -- 2.7.4
[PATCH v10 01/18] media: v4l2-mem2mem: extend m2m APIs for more accurate buffer management
this add functions for: - remove buffers from src/dst queue by index - remove exact buffer from src/dst queue also extends m2m API to iterate over a list of src/dst buffers in safely and non-safely manner. Signed-off-by: Stanimir Varbanov --- drivers/media/v4l2-core/v4l2-mem2mem.c | 37 ++ include/media/v4l2-mem2mem.h | 92 ++ 2 files changed, 129 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c index 6bc27e7b2a33..f62e68aa04c4 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -126,6 +126,43 @@ void *v4l2_m2m_buf_remove(struct v4l2_m2m_queue_ctx *q_ctx) } EXPORT_SYMBOL_GPL(v4l2_m2m_buf_remove); +void v4l2_m2m_buf_remove_by_buf(struct v4l2_m2m_queue_ctx *q_ctx, + struct vb2_v4l2_buffer *vbuf) +{ + struct v4l2_m2m_buffer *b; + unsigned long flags; + + spin_lock_irqsave(&q_ctx->rdy_spinlock, flags); + b = container_of(vbuf, struct v4l2_m2m_buffer, vb); + list_del(&b->list); + q_ctx->num_rdy--; + spin_unlock_irqrestore(&q_ctx->rdy_spinlock, flags); +} +EXPORT_SYMBOL_GPL(v4l2_m2m_buf_remove_by_buf); + +struct vb2_v4l2_buffer * +v4l2_m2m_buf_remove_by_idx(struct v4l2_m2m_queue_ctx *q_ctx, unsigned int idx) + +{ + struct v4l2_m2m_buffer *b, *tmp; + struct vb2_v4l2_buffer *ret = NULL; + unsigned long flags; + + spin_lock_irqsave(&q_ctx->rdy_spinlock, flags); + list_for_each_entry_safe(b, tmp, &q_ctx->rdy_queue, list) { + if (b->vb.vb2_buf.index == idx) { + list_del(&b->list); + q_ctx->num_rdy--; + ret = &b->vb; + break; + } + } + spin_unlock_irqrestore(&q_ctx->rdy_spinlock, flags); + + return ret; +} +EXPORT_SYMBOL_GPL(v4l2_m2m_buf_remove_by_idx); + /* * Scheduling handlers */ diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h index 3ccd01bd245e..e157d5c9b224 100644 --- a/include/media/v4l2-mem2mem.h +++ b/include/media/v4l2-mem2mem.h @@ -437,6 +437,47 @@ static inline void *v4l2_m2m_next_dst_buf(struct v4l2_m2m_ctx *m2m_ctx) } /** + * v4l2_m2m_for_each_dst_buf() - iterate over a list of destination ready + * buffers + * + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @b: current buffer of type struct v4l2_m2m_buffer + */ +#define v4l2_m2m_for_each_dst_buf(m2m_ctx, b) \ + list_for_each_entry(b, &m2m_ctx->cap_q_ctx.rdy_queue, list) + +/** + * v4l2_m2m_for_each_src_buf() - iterate over a list of source ready buffers + * + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @b: current buffer of type struct v4l2_m2m_buffer + */ +#define v4l2_m2m_for_each_src_buf(m2m_ctx, b) \ + list_for_each_entry(b, &m2m_ctx->out_q_ctx.rdy_queue, list) + +/** + * v4l2_m2m_for_each_dst_buf_safe() - iterate over a list of destination ready + * buffers safely + * + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @b: current buffer of type struct v4l2_m2m_buffer + * @n: used as temporary storage + */ +#define v4l2_m2m_for_each_dst_buf_safe(m2m_ctx, b, n) \ + list_for_each_entry_safe(b, n, &m2m_ctx->cap_q_ctx.rdy_queue, list) + +/** + * v4l2_m2m_for_each_src_buf_safe() - iterate over a list of source ready + * buffers safely + * + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @b: current buffer of type struct v4l2_m2m_buffer + * @n: used as temporary storage + */ +#define v4l2_m2m_for_each_src_buf_safe(m2m_ctx, b, n) \ + list_for_each_entry_safe(b, n, &m2m_ctx->out_q_ctx.rdy_queue, list) + +/** * v4l2_m2m_get_src_vq() - return vb2_queue for source buffers * * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx @@ -488,6 +529,57 @@ static inline void *v4l2_m2m_dst_buf_remove(struct v4l2_m2m_ctx *m2m_ctx) return v4l2_m2m_buf_remove(&m2m_ctx->cap_q_ctx); } +/** + * v4l2_m2m_buf_remove_by_buf() - take off exact buffer from the list of ready + * buffers + * + * @q_ctx: pointer to struct @v4l2_m2m_queue_ctx + * @vbuf: the buffer to be removed + */ +void v4l2_m2m_buf_remove_by_buf(struct v4l2_m2m_queue_ctx *q_ctx, + struct vb2_v4l2_buffer *vbuf); + +/** + * v4l2_m2m_src_buf_remove_by_buf() - take off exact source buffer from the list + * of ready buffers + * + * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx + * @vbuf: the buffer to be removed + */ +static inline void v4l2_m2m_src_buf_remove_by_buf(struct v4l2_m2m_ctx *m2m_ctx, + struct vb2_v4l2_buffer *vbuf) +{ + v4l2_m2m_buf_remove_by_buf(&m2m_ctx->out_q_ctx, vbuf); +} + +/** + * v4l2_m2m_dst_buf_remove_by_buf() - take off exact destinat
[PATCH v10 10/18] media: venus: hfi: fix mutex unlock
This fixed a warning when build driver with gcc7: drivers/media/platform/qcom/venus/hfi.c:171 hfi_core_ping() warn: inconsistent returns 'mutex:&core->lock'. Locked on: line 159 Unlocked on: line 171 Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platform/qcom/venus/hfi.c index 20c9205fdbb4..c09490876516 100644 --- a/drivers/media/platform/qcom/venus/hfi.c +++ b/drivers/media/platform/qcom/venus/hfi.c @@ -156,7 +156,7 @@ int hfi_core_ping(struct venus_core *core) ret = core->ops->core_ping(core, 0xbeef); if (ret) - return ret; + goto unlock; ret = wait_for_completion_timeout(&core->done, TIMEOUT); if (!ret) { -- 2.7.4
[PATCH v10 00/18] Qualcomm video decoder/encoder driver
Hello, The changes since patchset v9 are the following: * patches from 1/18 to 9/18 are the same. * patches from 10/18 to 16/18 are fixes for warns/errors found by Mauro when building with its gcc7. * patch 17/18 adding support for minimum buffers for capture get control. This fixes an issue with gstreamer and it will be good to have it in the inital version of the venus driver. * patch 18/18 enable COMPILE_TEST Kconfig option for the driver, and this patch depends on the other one for qcom_scm driver. The submited patch for qcom_scm driver can be found at [1]. Mauro, I failed to build gcc7 on my own machine and fallback to a pre-built version of the gcc-7 for may Ubuntu distro. The version which I tried was: gcc version 7.1.0 (Ubuntu 7.1.0-5ubuntu2~16.04). Unfortunately I cannot reproduce the warns/errors (except two warnings) from your compiler (even that the version looks the same 7.1.0). So I fixed the warns/errors as per your response to v9, and hope that the errors will disappear. [1] https://patchwork.kernel.org/patch/9775803/ Stanimir Varbanov (18): media: v4l2-mem2mem: extend m2m APIs for more accurate buffer management doc: DT: venus: binding document for Qualcomm video driver MAINTAINERS: Add Qualcomm Venus video accelerator driver media: venus: adding core part and helper functions media: venus: vdec: add video decoder files media: venus: venc: add video encoder files media: venus: hfi: add Host Firmware Interface (HFI) media: venus: hfi: add Venus HFI files media: venus: enable building of Venus video driver media: venus: hfi: fix mutex unlock media: venus: hfi_cmds: fix variable dereferenced before check media: venus: helpers: fix variable dereferenced before check media: venus: hfi_venus: fix variable dereferenced before check media: venus: hfi_msgs: fix set but not used variables media: venus: vdec: fix compile error in vdec_close media: venus: venc: fix compile error in venc_close media: venus: vdec: add support for min buffers for capture media: venus: enable building with COMPILE_TEST .../devicetree/bindings/media/qcom,venus.txt | 107 ++ MAINTAINERS|8 + drivers/media/platform/Kconfig | 13 + drivers/media/platform/Makefile|2 + drivers/media/platform/qcom/venus/Makefile | 11 + drivers/media/platform/qcom/venus/core.c | 388 + drivers/media/platform/qcom/venus/core.h | 323 drivers/media/platform/qcom/venus/firmware.c | 109 ++ drivers/media/platform/qcom/venus/firmware.h | 22 + drivers/media/platform/qcom/venus/helpers.c| 725 + drivers/media/platform/qcom/venus/helpers.h| 45 + drivers/media/platform/qcom/venus/hfi.c| 522 +++ drivers/media/platform/qcom/venus/hfi.h| 175 +++ drivers/media/platform/qcom/venus/hfi_cmds.c | 1259 drivers/media/platform/qcom/venus/hfi_cmds.h | 304 drivers/media/platform/qcom/venus/hfi_helper.h | 1050 + drivers/media/platform/qcom/venus/hfi_msgs.c | 1052 + drivers/media/platform/qcom/venus/hfi_msgs.h | 283 drivers/media/platform/qcom/venus/hfi_venus.c | 1572 drivers/media/platform/qcom/venus/hfi_venus.h | 23 + drivers/media/platform/qcom/venus/hfi_venus_io.h | 113 ++ drivers/media/platform/qcom/venus/vdec.c | 1162 +++ drivers/media/platform/qcom/venus/vdec.h | 23 + drivers/media/platform/qcom/venus/vdec_ctrls.c | 158 ++ drivers/media/platform/qcom/venus/venc.c | 1283 drivers/media/platform/qcom/venus/venc.h | 23 + drivers/media/platform/qcom/venus/venc_ctrls.c | 270 drivers/media/v4l2-core/v4l2-mem2mem.c | 37 + include/media/v4l2-mem2mem.h | 92 ++ 29 files changed, 11154 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/qcom,venus.txt create mode 100644 drivers/media/platform/qcom/venus/Makefile create mode 100644 drivers/media/platform/qcom/venus/core.c create mode 100644 drivers/media/platform/qcom/venus/core.h create mode 100644 drivers/media/platform/qcom/venus/firmware.c create mode 100644 drivers/media/platform/qcom/venus/firmware.h create mode 100644 drivers/media/platform/qcom/venus/helpers.c create mode 100644 drivers/media/platform/qcom/venus/helpers.h create mode 100644 drivers/media/platform/qcom/venus/hfi.c create mode 100644 drivers/media/platform/qcom/venus/hfi.h create mode 100644 drivers/media/platform/qcom/venus/hfi_cmds.c create mode 100644 drivers/media/platform/qcom/venus/hfi_cmds.h create mode 100644 drivers/media/platform/qcom/venus/hfi_helper.h create mode 100644 drivers/media/platform/qcom/venus/hfi_msgs.c create mode 100644 drivers/media/platform/qcom/venus/hfi_msgs.h
I Would love to discuse something with you.
Re: [PATCH v7 2/2] media: rcar-csi2: add Renesas R-Car MIPI CSI-2 receiver driver
Hi Hans, Thanks for your comments. On 2017-05-29 13:16:23 +0200, Hans Verkuil wrote: > On 05/24/2017 02:13 AM, Niklas Söderlund wrote: > > From: Niklas Söderlund > > > > A V4L2 driver for Renesas R-Car MIPI CSI-2 receiver. The driver > > supports the rcar-vin driver on R-Car Gen3 SoCs where separate CSI-2 > > hardware blocks are connected between the video sources and the video > > grabbers (VIN). > > > > Driver is based on a prototype by Koji Matsuoka in the Renesas BSP. > > > > Signed-off-by: Niklas Söderlund > > --- > > drivers/media/platform/rcar-vin/Kconfig | 12 + > > drivers/media/platform/rcar-vin/Makefile| 1 + > > drivers/media/platform/rcar-vin/rcar-csi2.c | 867 > > > > 3 files changed, 880 insertions(+) > > create mode 100644 drivers/media/platform/rcar-vin/rcar-csi2.c > > > > diff --git a/drivers/media/platform/rcar-vin/Kconfig > > b/drivers/media/platform/rcar-vin/Kconfig > > index af4c98b44d2e22cb..6875f30c1ae42631 100644 > > --- a/drivers/media/platform/rcar-vin/Kconfig > > +++ b/drivers/media/platform/rcar-vin/Kconfig > > @@ -1,3 +1,15 @@ > > +config VIDEO_RCAR_CSI2 > > + tristate "R-Car MIPI CSI-2 Receiver" > > + depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && OF > > + depends on ARCH_RENESAS || COMPILE_TEST > > + select V4L2_FWNODE > > + ---help--- > > + Support for Renesas R-Car MIPI CSI-2 receiver. > > + Supports R-Car Gen3 SoCs. > > + > > + To compile this driver as a module, choose M here: the > > + module will be called rcar-csi2. > > + > > config VIDEO_RCAR_VIN > > tristate "R-Car Video Input (VIN) Driver" > > depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && OF && HAS_DMA && > > MEDIA_CONTROLLER > > diff --git a/drivers/media/platform/rcar-vin/Makefile > > b/drivers/media/platform/rcar-vin/Makefile > > index 48c5632c21dc060b..5ab803d3e7c1aa57 100644 > > --- a/drivers/media/platform/rcar-vin/Makefile > > +++ b/drivers/media/platform/rcar-vin/Makefile > > @@ -1,3 +1,4 @@ > > rcar-vin-objs = rcar-core.o rcar-dma.o rcar-v4l2.o > > +obj-$(CONFIG_VIDEO_RCAR_CSI2) += rcar-csi2.o > > obj-$(CONFIG_VIDEO_RCAR_VIN) += rcar-vin.o > > diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c > > b/drivers/media/platform/rcar-vin/rcar-csi2.c > > new file mode 100644 > > index ..1175f1fe4b139a13 > > --- /dev/null > > +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c > > @@ -0,0 +1,867 @@ > > +/* > > + * Driver for Renesas R-Car MIPI CSI-2 Receiver > > + * > > + * Copyright (C) 2017 Renesas Electronics Corp. > > + * > > + * 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. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +/* Register offsets and bits */ > > + > > +/* Control Timing Select */ > > +#define TREF_REG 0x00 > > +#define TREF_TREF (1 << 0) > > + > > +/* Software Reset */ > > +#define SRST_REG 0x04 > > +#define SRST_SRST (1 << 0) > > + > > +/* PHY Operation Control */ > > +#define PHYCNT_REG 0x08 > > +#define PHYCNT_SHUTDOWNZ (1 << 17) > > +#define PHYCNT_RSTZ(1 << 16) > > +#define PHYCNT_ENABLECLK (1 << 4) > > +#define PHYCNT_ENABLE_3(1 << 3) > > +#define PHYCNT_ENABLE_2(1 << 2) > > +#define PHYCNT_ENABLE_1(1 << 1) > > +#define PHYCNT_ENABLE_0(1 << 0) > > + > > +/* Checksum Control */ > > +#define CHKSUM_REG 0x0c > > +#define CHKSUM_ECC_EN (1 << 1) > > +#define CHKSUM_CRC_EN (1 << 0) > > + > > +/* > > + * Channel Data Type Select > > + * VCDT[0-15]: Channel 1 VCDT[16-31]: Channel 2 > > + * VCDT2[0-15]: Channel 3 VCDT2[16-31]: Channel 4 > > + */ > > +#define VCDT_REG 0x10 > > +#define VCDT2_REG 0x14 > > +#define VCDT_VCDTN_EN (1 << 15) > > +#define VCDT_SEL_VC(n) (((n) & 0x3) << 8) > > +#define VCDT_SEL_DTN_ON(1 << 6) > > +#define VCDT_SEL_DT(n) (((n) & 0x3f) << 0) > > + > > +/* Frame Data Type Select */ > > +#define FRDT_REG 0x18 > > + > > +/* Field Detection Control */ > > +#define FLD_REG0x1c > > +#define FLD_FLD_NUM(n) (((n) & 0xff) << 16) > > +#define FLD_FLD_EN4(1 << 3) > > +#define FLD_FLD_EN3(1 << 2) > > +#define FLD_FLD_EN2(1 << 1) > > +#define
Re: [PATCH 2/2] dt-bindings: media/s5p-cec.txt, media/stih-cec.txt: refer to cec.txt
On Fri, Jun 9, 2017 at 12:54 PM, Hans Verkuil wrote: > From: Hans Verkuil > > Now that there is a cec.txt with common CEC bindings, update the two > driver-specific bindings to refer to cec.txt. > > Signed-off-by: Hans Verkuil > Cc: Krzysztof Kozlowski > Cc: Andrzej Hajda > Cc: Benjamin Gaignard > Cc: devicet...@vger.kernel.org > --- > Documentation/devicetree/bindings/media/s5p-cec.txt | 6 ++ > Documentation/devicetree/bindings/media/stih-cec.txt | 2 +- > 2 files changed, 3 insertions(+), 5 deletions(-) Reviewed-by: Rob Herring
Re: [PATCH 1/2] dt-bindings: add media/cec.txt
On Fri, Jun 9, 2017 at 12:54 PM, Hans Verkuil wrote: > From: Hans Verkuil > > Document common HDMI CEC bindings. Add this to the MAINTAINERS file > as well. > > Signed-off-by: Hans Verkuil > Cc: Krzysztof Kozlowski > Cc: Andrzej Hajda > Cc: Benjamin Gaignard > Cc: devicet...@vger.kernel.org > --- > Documentation/devicetree/bindings/media/cec.txt | 8 > MAINTAINERS | 1 + > 2 files changed, 9 insertions(+) > create mode 100644 Documentation/devicetree/bindings/media/cec.txt Reviewed-by: Rob Herring Thanks for doing this. Rob
Re: [PATCH v8 3/8] media: i2c: max2175: Add MAX2175 support
Hi Hans, On Mon, Jun 12, 2017 at 3:50 PM, Hans Verkuil wrote: > On 06/12/2017 03:26 PM, Ramesh Shanmugasundaram wrote: >> This patch adds driver support for the MAX2175 chip. This is Maxim >> Integrated's RF to Bits tuner front end chip designed for software-defined >> radio solutions. This driver exposes the tuner as a sub-device instance >> with standard and custom controls to configure the device. >> >> Signed-off-by: Ramesh Shanmugasundaram >> > > > Sorry, got this sparse warning: > > /home/hans/work/build/media-git/drivers/media/i2c/max2175.c: In function > 'max2175_poll_timeout': > /home/hans/work/build/media-git/drivers/media/i2c/max2175.c:385:21: warning: > '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context] > 1000, timeout_ms * 1000); > ~~~^~~ > > The smatch warnings are now gone. > > If you can make a v9 for just this patch? This is not an issue with the max2175 driver, but with the regmap_read_poll_timeout() macro: #define regmap_read_poll_timeout(map, addr, val, cond, sleep_us, timeout_us) \ ({ \ ... if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \ For increased safety, and to avoid this warning, "timeout_us" should be inside parentheses. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH v8 3/8] media: i2c: max2175: Add MAX2175 support
On 06/12/2017 03:26 PM, Ramesh Shanmugasundaram wrote: This patch adds driver support for the MAX2175 chip. This is Maxim Integrated's RF to Bits tuner front end chip designed for software-defined radio solutions. This driver exposes the tuner as a sub-device instance with standard and custom controls to configure the device. Signed-off-by: Ramesh Shanmugasundaram Sorry, got this sparse warning: /home/hans/work/build/media-git/drivers/media/i2c/max2175.c: In function 'max2175_poll_timeout': /home/hans/work/build/media-git/drivers/media/i2c/max2175.c:385:21: warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context] 1000, timeout_ms * 1000); ~~~^~~ The smatch warnings are now gone. If you can make a v9 for just this patch? Regards, Hans
[PATCH v8 7/8] media: platform: rcar_drif: Add DRIF support
This patch adds Digital Radio Interface (DRIF) support to R-Car Gen3 SoCs. The driver exposes each instance of DRIF as a V4L2 SDR device. A DRIF device represents a channel and each channel can have one or two sub-channels respectively depending on the target board. DRIF supports only Rx functionality. It receives samples from a RF frontend tuner chip it is interfaced with. The combination of DRIF and the tuner device, which is registered as a sub-device, determines the receive sample rate and format. In order to be compliant as a V4L2 SDR device, DRIF needs to bind with the tuner device, which can be provided by a third party vendor. DRIF acts as a slave device and the tuner device acts as a master transmitting the samples. The driver allows asynchronous binding of a tuner device that is registered as a v4l2 sub-device. The driver can learn about the tuner it is interfaced with based on port endpoint properties of the device in device tree. The V4L2 SDR device inherits the controls exposed by the tuner device. The device can also be configured to use either one or both of the data pins at runtime based on the master (tuner) configuration. Signed-off-by: Ramesh Shanmugasundaram --- v8: - Fixed smatch warnings in two places. v7: - Added COMPILE_TEST to rcar_drif (Hans added it in last pull request). v6: - Used fwnode_ apis wherever applicable. - Cleaned up debug prints. --- drivers/media/platform/Kconfig | 25 + drivers/media/platform/Makefile|1 + drivers/media/platform/rcar_drif.c | 1498 3 files changed, 1524 insertions(+) create mode 100644 drivers/media/platform/rcar_drif.c diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 288d3b0dc812..a2fc37d0d29e 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -538,3 +538,28 @@ config VIDEO_STI_HDMI_CEC between compatible devices. endif #CEC_PLATFORM_DRIVERS + +menuconfig SDR_PLATFORM_DRIVERS + bool "SDR platform devices" + depends on MEDIA_SDR_SUPPORT + default n + ---help--- + Say Y here to enable support for platform-specific SDR Drivers. + +if SDR_PLATFORM_DRIVERS + +config VIDEO_RCAR_DRIF + tristate "Renesas Digitial Radio Interface (DRIF)" + depends on VIDEO_V4L2 && HAS_DMA + depends on ARCH_RENESAS || COMPILE_TEST + select VIDEOBUF2_VMALLOC + ---help--- + Say Y if you want to enable R-Car Gen3 DRIF support. DRIF is Digital + Radio Interface that interfaces with an RF front end chip. It is a + receiver of digital data which uses DMA to transfer received data to + a configured location for an application to use. + + To compile this driver as a module, choose M here; the module + will be called rcar_drif. + +endif # SDR_PLATFORM_DRIVERS diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index c3588d570f5d..4cfbb9d0c6cf 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_VIDEO_SH_VOU)+= sh_vou.o obj-$(CONFIG_SOC_CAMERA) += soc_camera/ +obj-$(CONFIG_VIDEO_RCAR_DRIF) += rcar_drif.o obj-$(CONFIG_VIDEO_RENESAS_FCP)+= rcar-fcp.o obj-$(CONFIG_VIDEO_RENESAS_FDP1) += rcar_fdp1.o obj-$(CONFIG_VIDEO_RENESAS_JPU)+= rcar_jpu.o diff --git a/drivers/media/platform/rcar_drif.c b/drivers/media/platform/rcar_drif.c new file mode 100644 index ..522364ff0d5d --- /dev/null +++ b/drivers/media/platform/rcar_drif.c @@ -0,0 +1,1498 @@ +/* + * R-Car Gen3 Digital Radio Interface (DRIF) driver + * + * Copyright (C) 2017 Renesas Electronics Corporation + * + * 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. + */ + +/* + * The R-Car DRIF is a receive only MSIOF like controller with an + * external master device driving the SCK. It receives data into a FIFO, + * then this driver uses the SYS-DMAC engine to move the data from + * the device to memory. + * + * Each DRIF channel DRIFx (as per datasheet) contains two internal + * channels DRIFx0 & DRIFx1 within itself with each having its own resources + * like module clk, register set, irq and dma. These internal channels share + * common CLK & SYNC from master. The two data pins D0 & D1 shall be + * considered to represent the two internal channels. This internal split + * is not visible to the master device. + * + * Depending on the master device, a DRIF channel can use + * (1)
[PATCH v8 5/8] doc_rst: media: New SDR formats PC16, PC18 & PC20
This patch adds documentation for the three new SDR formats V4L2_SDR_FMT_PCU16BE V4L2_SDR_FMT_PCU18BE V4L2_SDR_FMT_PCU20BE Signed-off-by: Ramesh Shanmugasundaram --- .../media/uapi/v4l/pixfmt-sdr-pcu16be.rst | 55 ++ .../media/uapi/v4l/pixfmt-sdr-pcu18be.rst | 55 ++ .../media/uapi/v4l/pixfmt-sdr-pcu20be.rst | 54 + Documentation/media/uapi/v4l/sdr-formats.rst | 3 ++ 4 files changed, 167 insertions(+) create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst create mode 100644 Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst new file mode 100644 index ..2de1b1a0f517 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu16be.rst @@ -0,0 +1,55 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-SDR-FMT-PCU16BE: + +** +V4L2_SDR_FMT_PCU16BE ('PC16') +** + +Planar complex unsigned 16-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are represented as a 16 bit unsigned big endian number stored in +32 bit space. The remaining unused bits within the 32 bit space will be +padded with 0. I value starts first and Q value starts at an offset +equalling half of the buffer size (i.e.) offset = buffersize/2. Out of +the 16 bits, bit 15:2 (14 bit) is data and bit 1:0 (2 bit) can be any +value. + +**Byte Order.** +Each cell is one byte. + +.. flat-table:: +:header-rows: 1 +:stub-columns: 0 + +* - Offset: + - Byte B0 + - Byte B1 + - Byte B2 + - Byte B3 +* - start + 0: + - I'\ :sub:`0[13:6]` + - I'\ :sub:`0[5:0]; B1[1:0]=pad` + - pad + - pad +* - start + 4: + - I'\ :sub:`1[13:6]` + - I'\ :sub:`1[5:0]; B1[1:0]=pad` + - pad + - pad +* - ... +* - start + offset: + - Q'\ :sub:`0[13:6]` + - Q'\ :sub:`0[5:0]; B1[1:0]=pad` + - pad + - pad +* - start + offset + 4: + - Q'\ :sub:`1[13:6]` + - Q'\ :sub:`1[5:0]; B1[1:0]=pad` + - pad + - pad diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst new file mode 100644 index ..da8b26bf6b95 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu18be.rst @@ -0,0 +1,55 @@ +.. -*- coding: utf-8; mode: rst -*- + +.. _V4L2-SDR-FMT-PCU18BE: + +** +V4L2_SDR_FMT_PCU18BE ('PC18') +** + +Planar complex unsigned 18-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are represented as a 18 bit unsigned big endian number stored in +32 bit space. The remaining unused bits within the 32 bit space will be +padded with 0. I value starts first and Q value starts at an offset +equalling half of the buffer size (i.e.) offset = buffersize/2. Out of +the 18 bits, bit 17:2 (16 bit) is data and bit 1:0 (2 bit) can be any +value. + +**Byte Order.** +Each cell is one byte. + +.. flat-table:: +:header-rows: 1 +:stub-columns: 0 + +* - Offset: + - Byte B0 + - Byte B1 + - Byte B2 + - Byte B3 +* - start + 0: + - I'\ :sub:`0[17:10]` + - I'\ :sub:`0[9:2]` + - I'\ :sub:`0[1:0]; B2[5:0]=pad` + - pad +* - start + 4: + - I'\ :sub:`1[17:10]` + - I'\ :sub:`1[9:2]` + - I'\ :sub:`1[1:0]; B2[5:0]=pad` + - pad +* - ... +* - start + offset: + - Q'\ :sub:`0[17:10]` + - Q'\ :sub:`0[9:2]` + - Q'\ :sub:`0[1:0]; B2[5:0]=pad` + - pad +* - start + offset + 4: + - Q'\ :sub:`1[17:10]` + - Q'\ :sub:`1[9:2]` + - Q'\ :sub:`1[1:0]; B2[5:0]=pad` + - pad diff --git a/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst new file mode 100644 index ..5499eed39477 --- /dev/null +++ b/Documentation/media/uapi/v4l/pixfmt-sdr-pcu20be.rst @@ -0,0 +1,54 @@ +.. -*- coding: utf-8; mode: rst -*- +.. _V4L2-SDR-FMT-PCU20BE: + +** +V4L2_SDR_FMT_PCU20BE ('PC20') +** + +Planar complex unsigned 20-bit big endian IQ sample + +Description +=== + +This format contains a sequence of complex number samples. Each complex +number consist of two parts called In-phase and Quadrature (IQ). Both I +and Q are represented as a 20 bit unsigned big endian number stored in +32 bit space. The remaining unused bits within
[PATCH v8 8/8] MAINTAINERS: Add entry for R-Car DRIF & MAX2175 drivers
Add maintainter entry for the R-Car DRIF and MAX2175 drivers. Signed-off-by: Ramesh Shanmugasundaram --- MAINTAINERS | 19 +++ 1 file changed, 19 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 053c3bdd1fe5..cfa78fe5142a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8031,6 +8031,16 @@ S: Maintained F: Documentation/hwmon/max20751 F: drivers/hwmon/max20751.c +MAX2175 SDR TUNER DRIVER +M: Ramesh Shanmugasundaram +L: linux-media@vger.kernel.org +T: git git://linuxtv.org/media_tree.git +S: Maintained +F: Documentation/devicetree/bindings/media/i2c/max2175.txt +F: Documentation/media/v4l-drivers/max2175.rst +F: drivers/media/i2c/max2175* +F: include/uapi/linux/max2175.h + MAX6650 HARDWARE MONITOR AND FAN CONTROLLER DRIVER L: linux-hw...@vger.kernel.org S: Orphan @@ -8111,6 +8121,15 @@ L: linux-...@vger.kernel.org S: Maintained F: drivers/iio/dac/cio-dac.c +MEDIA DRIVERS FOR RENESAS - DRIF +M: Ramesh Shanmugasundaram +L: linux-media@vger.kernel.org +L: linux-renesas-...@vger.kernel.org +T: git git://linuxtv.org/media_tree.git +S: Supported +F: Documentation/devicetree/bindings/media/renesas,drif.txt +F: drivers/media/platform/rcar_drif.c + MEDIA DRIVERS FOR RENESAS - FCP M: Laurent Pinchart L: linux-media@vger.kernel.org -- 2.12.2
[PATCH v8 0/8] Add V4L2 SDR (DRIF & MAX2175) driver
Hi Mauro, Hans, This patch set contains two drivers - Renesas R-Car Digital Radio Interface (DRIF) driver - Maxim's MAX2175 RF to Bits tuner driver These patches were based on top of media_tree. commit: 47f910f0e0deb880c2114811f7ea1ec115a19ee4 These two drivers combined together expose a V4L2 SDR device that is compliant with the V4L2 framework [1]. Agreed review comments are incorporated in this series. The rcar_drif device is modelled using "renesas,bonding" property. The discussion on this property is available here [2]. Change history: v7 -> v8: - Added MAINTAINERS entry for both drivers - Fixed smatch warnings on both drivers (Thank you Hans) v6 -> v7: - MAX2175 I2S enable/disable control is made private (Mauro #v4l) - Added COMPILE_TEST to rcar_drif in Kconfig (Hans) v5 -> v6: - Addressed Sakari's comments & rebased to his branch. - Used fwnode_ instead of of_ apis whereever applicable. v4 -> v5: - Minor documentation changes. Refer individual patches. v3 -> v4: - Added ACKs rcar_drif: - Incorporated a number of review comments from Laurent on DRIF driver. - Addressed comments from Rob and Laurent on bindings. max2175: - Minor changes addressing Hans and Laurent's comments v2 -> v3: rcar_drif: - Reduced DRIF DT properties to expose tested I2S mode only (Hans - discussion on #v4l) - Fixed error path clean up of ctrl_hdl on rcar_drif v1 -> v2: - SDR formats renamed as "planar" instead of sliced (Hans) - Documentation formatting correction (Laurent) rcar_drif: - DT model using "bonding" property - Addressed Laurent's coments on bindings - DT optional parameters rename & rework - Addressed Han's comments on driver - Addressed Geert's comments on DT max2175: - Avoided scaling using method proposed by Antti. Thanks - Bindings is a separate patch (Rob) - Addressed Rob's comment on bindings - Added Custom controls documentation (Laurent) [1] v4l2-compliance report: root@salvator-x:~# v4l2-compliance -S /dev/swradio0 v4l2-compliance SHA : d57bb8af0c71d82b702e35a7362aa077189dd593 Driver Info: Driver name : rcar_drif Card type : R-Car DRIF Bus info : platform:R-Car DRIF Driver version: 4.12.0 Capabilities : 0x8531 SDR Capture Tuner Read/Write Streaming Extended Pix Format Device Capabilities Device Caps : 0x0531 SDR Capture Tuner Read/Write Streaming Extended Pix Format Compliance test for device /dev/swradio0 (not using libv4l2): Required ioctls: test VIDIOC_QUERYCAP: OK Allow for multiple opens: test second sdr open: OK test VIDIOC_QUERYCAP: OK test VIDIOC_G/S_PRIORITY: OK test for unlimited opens: OK Debug ioctls: test VIDIOC_DBG_G/S_REGISTER: OK test VIDIOC_LOG_STATUS: OK Input ioctls: test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK test VIDIOC_G/S_FREQUENCY: OK test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported) test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported) Inputs: 0 Audio Inputs: 0 Tuners: 1 Output ioctls: test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported) Outputs: 0 Audio Outputs: 0 Modulators: 0 Input/Output configuration ioctls: test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported) Control ioctls: test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK test VIDIOC_G/S_CTRL: OK test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 5 Private Controls: 2 Format ioctls: test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK test VIDIOC_TRY_FMT: OK test VIDIOC_S_FMT: OK test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported) test Composing: OK (Not Supported) test Scaling: OK (Not Supported) Codec ioctls: test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported)
[PATCH v8 4/8] media: Add new SDR formats PC16, PC18 & PC20
This patch adds support for the three new SDR formats. These formats were prefixed with "planar" indicating I & Q data are not interleaved as in other formats. Here, I & Q data constitutes the top half and bottom half of the received buffer respectively. V4L2_SDR_FMT_PCU16BE - 14-bit complex (I & Q) unsigned big-endian sample inside 16-bit. V4L2 FourCC: PC16 V4L2_SDR_FMT_PCU18BE - 16-bit complex (I & Q) unsigned big-endian sample inside 18-bit. V4L2 FourCC: PC18 V4L2_SDR_FMT_PCU20BE - 18-bit complex (I & Q) unsigned big-endian sample inside 20-bit. V4L2 FourCC: PC20 Signed-off-by: Ramesh Shanmugasundaram --- drivers/media/v4l2-core/v4l2-ioctl.c | 3 +++ include/uapi/linux/videodev2.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 4f27cfa134a1..ce40183d9daa 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1229,6 +1229,9 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_SDR_FMT_CS8: descr = "Complex S8"; break; case V4L2_SDR_FMT_CS14LE: descr = "Complex S14LE"; break; case V4L2_SDR_FMT_RU12LE: descr = "Real U12LE"; break; + case V4L2_SDR_FMT_PCU16BE: descr = "Planar Complex U16BE"; break; + case V4L2_SDR_FMT_PCU18BE: descr = "Planar Complex U18BE"; break; + case V4L2_SDR_FMT_PCU20BE: descr = "Planar Complex U20BE"; break; case V4L2_TCH_FMT_DELTA_TD16: descr = "16-bit signed deltas"; break; case V4L2_TCH_FMT_DELTA_TD08: descr = "8-bit signed deltas"; break; case V4L2_TCH_FMT_TU16: descr = "16-bit unsigned touch data"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 2b8feb86d09e..45cf7359822c 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -669,6 +669,9 @@ struct v4l2_pix_format { #define V4L2_SDR_FMT_CS8 v4l2_fourcc('C', 'S', '0', '8') /* complex s8 */ #define V4L2_SDR_FMT_CS14LE v4l2_fourcc('C', 'S', '1', '4') /* complex s14le */ #define V4L2_SDR_FMT_RU12LE v4l2_fourcc('R', 'U', '1', '2') /* real u12le */ +#define V4L2_SDR_FMT_PCU16BE v4l2_fourcc('P', 'C', '1', '6') /* planar complex u16be */ +#define V4L2_SDR_FMT_PCU18BE v4l2_fourcc('P', 'C', '1', '8') /* planar complex u18be */ +#define V4L2_SDR_FMT_PCU20BE v4l2_fourcc('P', 'C', '2', '0') /* planar complex u20be */ /* Touch formats - used for Touch devices */ #define V4L2_TCH_FMT_DELTA_TD16v4l2_fourcc('T', 'D', '1', '6') /* 16-bit signed deltas */ -- 2.12.2
[PATCH v8 6/8] dt-bindings: media: Add Renesas R-Car DRIF binding
Add binding documentation for Renesas R-Car Digital Radio Interface (DRIF) controller. Signed-off-by: Ramesh Shanmugasundaram Acked-by: Rob Herring --- .../devicetree/bindings/media/renesas,drif.txt | 176 + 1 file changed, 176 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/renesas,drif.txt diff --git a/Documentation/devicetree/bindings/media/renesas,drif.txt b/Documentation/devicetree/bindings/media/renesas,drif.txt new file mode 100644 index ..39516b94c28f --- /dev/null +++ b/Documentation/devicetree/bindings/media/renesas,drif.txt @@ -0,0 +1,176 @@ +Renesas R-Car Gen3 Digital Radio Interface controller (DRIF) + + +R-Car Gen3 DRIF is a SPI like receive only slave device. A general +representation of DRIF interfacing with a master device is shown below. + ++-++-+ +| |-SCK--->|CLK | +| Master|-SS>|SYNC DRIFn (slave) | +| |-SD0--->|D0 | +| |-SD1--->|D1 | ++-++-+ + +As per datasheet, each DRIF channel (drifn) is made up of two internal +channels (drifn0 & drifn1). These two internal channels share the common +CLK & SYNC. Each internal channel has its own dedicated resources like +irq, dma channels, address space & clock. This internal split is not +visible to the external master device. + +The device tree model represents each internal channel as a separate node. +The internal channels sharing the CLK & SYNC are tied together by their +phandles using a property called "renesas,bonding". For the rest of +the documentation, unless explicitly stated, the word channel implies an +internal channel. + +When both internal channels are enabled they need to be managed together +as one (i.e.) they cannot operate alone as independent devices. Out of the +two, one of them needs to act as a primary device that accepts common +properties of both the internal channels. This channel is identified by a +property called "renesas,primary-bond". + +To summarize, + - When both the internal channels that are bonded together are enabled, + the zeroth channel is selected as primary-bond. This channels accepts + properties common to all the members of the bond. + - When only one of the bonded channels need to be enabled, the property + "renesas,bonding" or "renesas,primary-bond" will have no effect. That + enabled channel can act alone as any other independent device. + +Required properties of an internal channel: +--- +- compatible: "renesas,r8a7795-drif" if DRIF controller is a part of R8A7795 SoC. + "renesas,rcar-gen3-drif" for a generic R-Car Gen3 compatible device. + + When compatible with the generic version, nodes must list the + SoC-specific version corresponding to the platform first + followed by the generic version. + +- reg: offset and length of that channel. +- interrupts: associated with that channel. +- clocks: phandle and clock specifier of that channel. +- clock-names: clock input name string: "fck". +- dmas: phandles to the DMA channels. +- dma-names: names of the DMA channel: "rx". +- renesas,bonding: phandle to the other channel. + +Optional properties of an internal channel: +--- +- power-domains: phandle to the respective power domain. + +Required properties of an internal channel when: + - It is the only enabled channel of the bond (or) + - If it acts as primary among enabled bonds + +- pinctrl-0: pin control group to be used for this channel. +- pinctrl-names: must be "default". +- renesas,primary-bond: empty property indicating the channel acts as primary + among the bonded channels. +- port: child port node corresponding to the data input, in accordance with + the video interface bindings defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. The port + node must contain at least one endpoint. + +Optional endpoint property: +--- +- sync-active: Indicates sync signal polarity, 0/1 for low/high respectively. + This property maps to SYNCAC bit in the hardware manual. The + default is 1 (active high). + +Example: + + +(1) Both internal channels enabled: +--- + +When interfacing with a third party tuner device with two data pins as shown +below. + ++-++-+ +| |-SCK--->|CLK | +| Master|-SS>|SYNC DRIFn (slave) | +|
[PATCH v8 3/8] media: i2c: max2175: Add MAX2175 support
This patch adds driver support for the MAX2175 chip. This is Maxim Integrated's RF to Bits tuner front end chip designed for software-defined radio solutions. This driver exposes the tuner as a sub-device instance with standard and custom controls to configure the device. Signed-off-by: Ramesh Shanmugasundaram --- v8: - Fixed smatch warnings in max2175_load_from_rom(). v7: - Made I2S enable/disable control as private (Mauro). v6: - Addressed Sakari's comments. They are: - Added uapi header file. - Added newline at the end of the function before return. - Cleaned up header file inclusion. - Used fwnode_ apis whereever applicable. - Cleaned up debug statements. - Removed separate dir for max2175. v5: - sck -> Sample clock is clarified in driver documentation (Hans) - "refout-load-pF" is renamed to "refout-load" as per updated bindings. --- Documentation/media/v4l-drivers/index.rst |1 + Documentation/media/v4l-drivers/max2175.rst | 62 ++ drivers/media/i2c/Kconfig | 12 + drivers/media/i2c/Makefile |2 + drivers/media/i2c/max2175.c | 1453 +++ drivers/media/i2c/max2175.h | 109 ++ include/uapi/linux/max2175.h| 28 + 7 files changed, 1667 insertions(+) create mode 100644 Documentation/media/v4l-drivers/max2175.rst create mode 100644 drivers/media/i2c/max2175.c create mode 100644 drivers/media/i2c/max2175.h create mode 100644 include/uapi/linux/max2175.h diff --git a/Documentation/media/v4l-drivers/index.rst b/Documentation/media/v4l-drivers/index.rst index 90fe22a6414a..2e24d6806052 100644 --- a/Documentation/media/v4l-drivers/index.rst +++ b/Documentation/media/v4l-drivers/index.rst @@ -42,6 +42,7 @@ For more details see the file COPYING in the source distribution of Linux. davinci-vpbe fimc ivtv + max2175 meye omap3isp omap4_camera diff --git a/Documentation/media/v4l-drivers/max2175.rst b/Documentation/media/v4l-drivers/max2175.rst new file mode 100644 index ..04478c25d57a --- /dev/null +++ b/Documentation/media/v4l-drivers/max2175.rst @@ -0,0 +1,62 @@ +Maxim Integrated MAX2175 RF to bits tuner driver + + +The MAX2175 driver implements the following driver-specific controls: + +``V4L2_CID_MAX2175_I2S_ENABLE`` +--- +Enable/Disable I2S output of the tuner. This is a private control +that can be accessed only using the subdev interface. +Refer to Documentation/media/kapi/v4l2-controls for more details. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - I2S output is disabled. +* - ``(1)`` + - I2S output is enabled. + +``V4L2_CID_MAX2175_HSLS`` +- +The high-side/low-side (HSLS) control of the tuner for a given band. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``(0)`` + - The LO frequency position is below the desired frequency. +* - ``(1)`` + - The LO frequency position is above the desired frequency. + +``V4L2_CID_MAX2175_RX_MODE (menu)`` +--- +The Rx mode controls a number of preset parameters of the tuner like +sample clock (sck), sampling rate etc. These multiple settings are +provided under one single label called Rx mode in the datasheet. The +list below shows the supported modes with a brief description. + +.. flat-table:: +:header-rows: 0 +:stub-columns: 0 +:widths: 1 4 + +* - ``"Europe modes"`` +* - ``"FM 1.2" (0)`` + - This configures FM band with a sample rate of 0.512 million +samples/sec with a 10.24 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures VHF band with a sample rate of 2.048 million +samples/sec with a 32.768 MHz sck. + +* - ``"North America modes"`` +* - ``"FM 1.0" (0)`` + - This configures FM band with a sample rate of 0.7441875 million +samples/sec with a 14.88375 MHz sck. +* - ``"DAB 1.2" (1)`` + - This configures FM band with a sample rate of 0.372 million +samples/sec with a 7.441875 MHz sck. diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index c380e2475c82..c0e6e78883b0 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -796,6 +796,18 @@ config VIDEO_SAA6752HS To compile this driver as a module, choose M here: the module will be called saa6752hs. +comment "SDR tuner chips" + +config SDR_MAX2175 + tristate "Maxim 2175 RF to Bits tuner" + depends on VIDEO_V4L2 && MEDIA_SDR_SUPPORT && I2C + ---help--- + Support for Maxim 2175 tuner. It is an advanced analog/digital + radio receiver with RF-to-Bits front-end designed for SDR solutions. + +
[PATCH v8 2/8] dt-bindings: media: Add MAX2175 binding description
Add device tree binding documentation for MAX2175 RF to bits tuner device. Signed-off-by: Ramesh Shanmugasundaram Acked-by: Rob Herring --- .../devicetree/bindings/media/i2c/max2175.txt | 59 ++ .../devicetree/bindings/property-units.txt | 1 + 2 files changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/max2175.txt diff --git a/Documentation/devicetree/bindings/media/i2c/max2175.txt b/Documentation/devicetree/bindings/media/i2c/max2175.txt new file mode 100644 index ..02b4e9cd7b1b --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/max2175.txt @@ -0,0 +1,59 @@ +Maxim Integrated MAX2175 RF to Bits tuner +- + +The MAX2175 IC is an advanced analog/digital hybrid-radio receiver with +RF to Bits® front-end designed for software-defined radio solutions. + +Required properties: + +- compatible: "maxim,max2175" for MAX2175 RF-to-bits tuner. +- clocks: clock specifier. +- port: child port node corresponding to the I2S output, in accordance with + the video interface bindings defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. The port + node must contain at least one endpoint. + +Optional properties: + +- maxim,master : phandle to the master tuner if it is a slave. This + is used to define two tuners in diversity mode + (1 master, 1 slave). By default each tuner is an + individual master. +- maxim,refout-load : load capacitance value (in picofarads) on reference + output drive level. The possible load values are: +0 (default - refout disabled) + 10 + 20 + 30 + 40 + 60 + 70 +- maxim,am-hiz-filter : empty property indicates the AM Hi-Z filter is used + in this hardware for AM antenna input. + +Example: + + +Board specific DTS file + +/* Fixed XTAL clock node */ +maxim_xtal: clock { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <36864000>; +}; + +/* A tuner device instance under i2c bus */ +max2175_0: tuner@60 { + compatible = "maxim,max2175"; + reg = <0x60>; + clocks = <&maxim_xtal>; + maxim,refout-load = <10>; + + port { + max2175_0_ep: endpoint { + remote-endpoint = <&slave_rx_device>; + }; + }; + +}; diff --git a/Documentation/devicetree/bindings/property-units.txt b/Documentation/devicetree/bindings/property-units.txt index 12278d79f6c0..7c9f6ee918f1 100644 --- a/Documentation/devicetree/bindings/property-units.txt +++ b/Documentation/devicetree/bindings/property-units.txt @@ -28,6 +28,7 @@ Electricity -ohms : Ohms -micro-ohms: micro Ohms -microvolt : micro volts +-picofarads: picofarads Temperature -- 2.12.2
[PATCH v8 1/8] media: v4l2-ctrls: Reserve controls for MAX217X
Reserve controls for MAX217X RF to Bits tuner family. These hybrid radio receiver chips are highly programmable and hence reserving 32 controls. Signed-off-by: Ramesh Shanmugasundaram Acked-by: Laurent Pinchart --- include/uapi/linux/v4l2-controls.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 0d2e1e01fbd5..83b28b41123f 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -180,6 +180,11 @@ enum v4l2_colorfx { * We reserve 16 controls for this driver. */ #define V4L2_CID_USER_TC358743_BASE(V4L2_CID_USER_BASE + 0x1080) +/* The base for the max217x driver controls. + * We reserve 32 controls for this driver + */ +#define V4L2_CID_USER_MAX217X_BASE (V4L2_CID_USER_BASE + 0x1090) + /* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls * and the 'MPEG' part of the define is historical */ -- 2.12.2
Re: [PATCH v2 0/15] [dt-bindings] [media] Add document file and driver for Sony CXD2880 DVB-T2/T tuner + demodulator
Dear Takiguchi, I'm working on 'drivers/media/dvb-frontends/cxd2841er.c' (universal demod) and 'linux/drivers/media/dvb-frontends/helene.c' (universal TERR/CABLE/SAT tuner). How do you think - is your cxd2880 proposed driver have possibilities to cover cxd2841er demod functionality too ? I have quickly checked your cxd2880_top.c and looks like cxd2880 works over SPI (not I2C) ?Also, looks like registers map, sequences is different. Am I right ? How do you think ? Thanks a lot ! 2017-05-31 21:41 GMT-04:00 Takiguchi, Yasunari : > Hi, all > > I sent the patch series of Sony CXD2880 DVB-T2/T tuner + demodulator driver > on Apr/14. > Are there any comments, advices and review results for them? > > I'd like to get better understanding of current review status for our codes. > > Regards, > Takiguchi -- Abylay Ospan, NetUP Inc. http://www.netup.tv
Re: [PATCH 2/2] dt-bindings: media/s5p-cec.txt, media/stih-cec.txt: refer to cec.txt
On 06/12/2017 02:51 PM, Benjamin Gaignard wrote: 2017-06-09 19:54 GMT+02:00 Hans Verkuil : From: Hans Verkuil Now that there is a cec.txt with common CEC bindings, update the two driver-specific bindings to refer to cec.txt. Signed-off-by: Hans Verkuil Acked-by: Sylwester Nawrocki -- Thanks, Sylwester
Re: [PATCH 1/2] dt-bindings: add media/cec.txt
On 06/09/2017 07:54 PM, Hans Verkuil wrote: From: Hans Verkuil Document common HDMI CEC bindings. Add this to the MAINTAINERS file as well. Signed-off-by: Hans Verkuil Acked-by: Sylwester Nawrocki --- Documentation/devicetree/bindings/media/cec.txt | 8 MAINTAINERS | 1 + 2 files changed, 9 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/cec.txt diff --git a/Documentation/devicetree/bindings/media/cec.txt b/Documentation/devicetree/bindings/media/cec.txt new file mode 100644 index ..22d7aae3d3d7 --- /dev/null +++ b/Documentation/devicetree/bindings/media/cec.txt @@ -0,0 +1,8 @@ +Common bindings for HDMI CEC adapters + +- hdmi-phandle: phandle to the HDMI controller. For a common property I would rather make it "hdmi-controller", this "-phandle" part feels like appending "_pointer" to variable names in C code. But since you are just rearranging existing documentation and Rob agrees with that I have no objections. +- needs-hpd: if present the CEC support is only available when the HPD + is high. Some boards only let the CEC pin through if the HPD is high, + for example if there is a level converter that uses the HPD to power + up or down. diff --git a/MAINTAINERS b/MAINTAINERS index 053c3bdd1fe5..4ac340d189a3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3137,6 +3137,7 @@ F:include/media/cec.h F:include/media/cec-notifier.h F:include/uapi/linux/cec.h F:include/uapi/linux/cec-funcs.h +F: Documentation/devicetree/bindings/media/cec.txt CELL BROADBAND ENGINE ARCHITECTURE M:Arnd Bergmann -- Regards, Sylwester
Re: [PATCH 2/2] dt-bindings: media/s5p-cec.txt, media/stih-cec.txt: refer to cec.txt
2017-06-09 19:54 GMT+02:00 Hans Verkuil : > From: Hans Verkuil > > Now that there is a cec.txt with common CEC bindings, update the two > driver-specific bindings to refer to cec.txt. > > Signed-off-by: Hans Verkuil > Cc: Krzysztof Kozlowski > Cc: Andrzej Hajda > Cc: Benjamin Gaignard > Cc: devicet...@vger.kernel.org > --- > Documentation/devicetree/bindings/media/s5p-cec.txt | 6 ++ > Documentation/devicetree/bindings/media/stih-cec.txt | 2 +- > 2 files changed, 3 insertions(+), 5 deletions(-) > > diff --git a/Documentation/devicetree/bindings/media/s5p-cec.txt > b/Documentation/devicetree/bindings/media/s5p-cec.txt > index 261af4d1a791..1b1a10ba48ce 100644 > --- a/Documentation/devicetree/bindings/media/s5p-cec.txt > +++ b/Documentation/devicetree/bindings/media/s5p-cec.txt > @@ -15,13 +15,11 @@ Required properties: >- clock-names : from common clock binding: must contain "hdmicec", > corresponding to entry in the clocks property. >- samsung,syscon-phandle - phandle to the PMU system controller > - - hdmi-phandle - phandle to the HDMI controller > + - hdmi-phandle - phandle to the HDMI controller, see also cec.txt. > > Optional: >- needs-hpd : if present the CEC support is only available when the HPD > -is high. Some boards only let the CEC pin through if the HPD is high, for > -example if there is a level converter that uses the HPD to power up > -or down. > + is high. See cec.txt for more details. > > Example: > > diff --git a/Documentation/devicetree/bindings/media/stih-cec.txt > b/Documentation/devicetree/bindings/media/stih-cec.txt > index 289a08b33651..8be2a040c6c6 100644 > --- a/Documentation/devicetree/bindings/media/stih-cec.txt > +++ b/Documentation/devicetree/bindings/media/stih-cec.txt > @@ -9,7 +9,7 @@ Required properties: > - pinctrl-names: Contains only one value - "default" > - pinctrl-0: Specifies the pin control groups used for CEC hardware. > - resets: Reference to a reset controller > - - hdmi-phandle: Phandle to the HDMI controller > + - hdmi-phandle: Phandle to the HDMI controller, see also cec.txt. > > Example for STIH407: > > -- > 2.11.0 > Acked-by: Benjamin Gaignard
Re: [PATCH 1/2] dt-bindings: add media/cec.txt
2017-06-09 19:54 GMT+02:00 Hans Verkuil : > From: Hans Verkuil > > Document common HDMI CEC bindings. Add this to the MAINTAINERS file > as well. > > Signed-off-by: Hans Verkuil > Cc: Krzysztof Kozlowski > Cc: Andrzej Hajda > Cc: Benjamin Gaignard > Cc: devicet...@vger.kernel.org > --- > Documentation/devicetree/bindings/media/cec.txt | 8 > MAINTAINERS | 1 + > 2 files changed, 9 insertions(+) > create mode 100644 Documentation/devicetree/bindings/media/cec.txt > > diff --git a/Documentation/devicetree/bindings/media/cec.txt > b/Documentation/devicetree/bindings/media/cec.txt > new file mode 100644 > index ..22d7aae3d3d7 > --- /dev/null > +++ b/Documentation/devicetree/bindings/media/cec.txt > @@ -0,0 +1,8 @@ > +Common bindings for HDMI CEC adapters > + > +- hdmi-phandle: phandle to the HDMI controller. > + > +- needs-hpd: if present the CEC support is only available when the HPD > + is high. Some boards only let the CEC pin through if the HPD is high, > + for example if there is a level converter that uses the HPD to power > + up or down. > diff --git a/MAINTAINERS b/MAINTAINERS > index 053c3bdd1fe5..4ac340d189a3 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -3137,6 +3137,7 @@ F:include/media/cec.h > F: include/media/cec-notifier.h > F: include/uapi/linux/cec.h > F: include/uapi/linux/cec-funcs.h > +F: Documentation/devicetree/bindings/media/cec.txt > > CELL BROADBAND ENGINE ARCHITECTURE > M: Arnd Bergmann > -- > 2.11.0 > Looks good for me Acked-by: Benjamin Gaignard
Re: [PATCH 4/9] stih-cec/vivid/pulse8/rainshadow: use cec_transmit_attempt_done
2017-06-07 16:46 GMT+02:00 Hans Verkuil : > From: Hans Verkuil > > Use the helper function cec_transmit_attempt_done instead of > cec_transmit_done to simplify the code. > > Signed-off-by: Hans Verkuil > Cc: Benjamin Gaignard > --- > drivers/media/platform/sti/cec/stih-cec.c | 9 - > drivers/media/platform/vivid/vivid-cec.c | 6 +++--- > drivers/media/usb/pulse8-cec/pulse8-cec.c | 9 +++-- > drivers/media/usb/rainshadow-cec/rainshadow-cec.c | 9 +++-- > 4 files changed, 13 insertions(+), 20 deletions(-) > > diff --git a/drivers/media/platform/sti/cec/stih-cec.c > b/drivers/media/platform/sti/cec/stih-cec.c > index 6f9f03670b56..dccbdaebb7a8 100644 > --- a/drivers/media/platform/sti/cec/stih-cec.c > +++ b/drivers/media/platform/sti/cec/stih-cec.c > @@ -226,22 +226,21 @@ static int stih_cec_adap_transmit(struct cec_adapter > *adap, u8 attempts, > static void stih_tx_done(struct stih_cec *cec, u32 status) > { > if (status & CEC_TX_ERROR) { > - cec_transmit_done(cec->adap, CEC_TX_STATUS_ERROR, 0, 0, 0, 1); > + cec_transmit_attempt_done(cec->adap, CEC_TX_STATUS_ERROR); > return; > } > > if (status & CEC_TX_ARB_ERROR) { > - cec_transmit_done(cec->adap, > - CEC_TX_STATUS_ARB_LOST, 1, 0, 0, 0); > + cec_transmit_attempt_done(cec->adap, CEC_TX_STATUS_ARB_LOST); > return; > } > > if (!(status & CEC_TX_ACK_GET_STS)) { > - cec_transmit_done(cec->adap, CEC_TX_STATUS_NACK, 0, 1, 0, 0); > + cec_transmit_attempt_done(cec->adap, CEC_TX_STATUS_NACK); > return; > } > > - cec_transmit_done(cec->adap, CEC_TX_STATUS_OK, 0, 0, 0, 0); > + cec_transmit_attempt_done(cec->adap, CEC_TX_STATUS_OK); > } > > static void stih_rx_done(struct stih_cec *cec, u32 status) > diff --git a/drivers/media/platform/vivid/vivid-cec.c > b/drivers/media/platform/vivid/vivid-cec.c > index 653f4099f737..e15705758969 100644 > --- a/drivers/media/platform/vivid/vivid-cec.c > +++ b/drivers/media/platform/vivid/vivid-cec.c > @@ -34,7 +34,7 @@ void vivid_cec_bus_free_work(struct vivid_dev *dev) > cancel_delayed_work_sync(&cw->work); > spin_lock(&dev->cec_slock); > list_del(&cw->list); > - cec_transmit_done(cw->adap, CEC_TX_STATUS_LOW_DRIVE, 0, 0, 1, > 0); > + cec_transmit_attempt_done(cw->adap, CEC_TX_STATUS_LOW_DRIVE); > kfree(cw); > } > spin_unlock(&dev->cec_slock); > @@ -84,7 +84,7 @@ static void vivid_cec_xfer_done_worker(struct work_struct > *work) > dev->cec_xfer_start_jiffies = 0; > list_del(&cw->list); > spin_unlock(&dev->cec_slock); > - cec_transmit_done(cw->adap, cw->tx_status, 0, valid_dest ? 0 : 1, 0, > 0); > + cec_transmit_attempt_done(cw->adap, cw->tx_status); > > /* Broadcast message */ > if (adap != dev->cec_rx_adap) > @@ -105,7 +105,7 @@ static void vivid_cec_xfer_try_worker(struct work_struct > *work) > if (dev->cec_xfer_time_jiffies) { > list_del(&cw->list); > spin_unlock(&dev->cec_slock); > - cec_transmit_done(cw->adap, CEC_TX_STATUS_ARB_LOST, 1, 0, 0, > 0); > + cec_transmit_attempt_done(cw->adap, CEC_TX_STATUS_ARB_LOST); > kfree(cw); > } else { > INIT_DELAYED_WORK(&cw->work, vivid_cec_xfer_done_worker); > diff --git a/drivers/media/usb/pulse8-cec/pulse8-cec.c > b/drivers/media/usb/pulse8-cec/pulse8-cec.c > index 1dfc2de1fe77..c843070f24c1 100644 > --- a/drivers/media/usb/pulse8-cec/pulse8-cec.c > +++ b/drivers/media/usb/pulse8-cec/pulse8-cec.c > @@ -148,18 +148,15 @@ static void pulse8_irq_work_handler(struct work_struct > *work) > cec_received_msg(pulse8->adap, &pulse8->rx_msg); > break; > case MSGCODE_TRANSMIT_SUCCEEDED: > - cec_transmit_done(pulse8->adap, CEC_TX_STATUS_OK, > - 0, 0, 0, 0); > + cec_transmit_attempt_done(pulse8->adap, CEC_TX_STATUS_OK); > break; > case MSGCODE_TRANSMIT_FAILED_ACK: > - cec_transmit_done(pulse8->adap, CEC_TX_STATUS_NACK, > - 0, 1, 0, 0); > + cec_transmit_attempt_done(pulse8->adap, CEC_TX_STATUS_NACK); > break; > case MSGCODE_TRANSMIT_FAILED_LINE: > case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA: > case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE: > - cec_transmit_done(pulse8->adap, CEC_TX_STATUS_ERROR, > - 0, 0, 0, 1); > + cec_transmit_attempt_done(pulse8->adap, CEC_TX_STATUS_ERROR); > break; > } > } > diff --git a/drivers/media/usb/rainshadow-cec/rainshadow-cec.c > b/drive
Re: [PATCH 8/9] s5p_cec: set the CEC_CAP_NEEDS_HPD flag if needed
On 06/07/2017 04:46 PM, Hans Verkuil wrote: From: Hans Verkuil Use the needs-hpd DT property to determine if the CEC_CAP_NEEDS_HPD should be set. Signed-off-by: Hans Verkuil Acked-by: Sylwester Nawrocki --- drivers/media/platform/s5p-cec/s5p_cec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-cec/s5p_cec.c b/drivers/media/platform/s5p-cec/s5p_cec.c index 65a223e578ed..8e06071a7977 100644 --- a/drivers/media/platform/s5p-cec/s5p_cec.c +++ b/drivers/media/platform/s5p-cec/s5p_cec.c @@ -173,6 +173,7 @@ static int s5p_cec_probe(struct platform_device *pdev) struct platform_device *hdmi_dev; struct resource *res; struct s5p_cec_dev *cec; + bool needs_hpd = of_property_read_bool(pdev->dev.of_node, "needs-hpd"); dev->of_node could also be used instead of pdev->dev.of_node. int ret; np = of_parse_phandle(pdev->dev.of_node, "hdmi-phandle", 0); @@ -221,7 +222,8 @@ static int s5p_cec_probe(struct platform_device *pdev) cec->adap = cec_allocate_adapter(&s5p_cec_adap_ops, cec, CEC_NAME, CEC_CAP_LOG_ADDRS | CEC_CAP_TRANSMIT | - CEC_CAP_PASSTHROUGH | CEC_CAP_RC, 1); + CEC_CAP_PASSTHROUGH | CEC_CAP_RC | + (needs_hpd ? CEC_CAP_NEEDS_HPD : 0), 1); ret = PTR_ERR_OR_ZERO(cec->adap); if (ret) return ret; -- Regards, Sylwester
[PATCH] MAINTAINERS: add maintainer entry for video multiplexer v4l2 subdevice driver
Add maintainer entry for the video multiplexer v4l2 subdevice driver that will control video bus multiplexers via the multiplexer framework. Signed-off-by: Philip Zabel --- MAINTAINERS | 6 ++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index f7d568b8f133..f6b8282efe46 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13522,6 +13522,12 @@ S: Maintained F: drivers/media/v4l2-core/videobuf2-* F: include/media/videobuf2-* +VIDEO MULTIPLEXER DRIVER +M: Philipp Zabel +L: linux-media@vger.kernel.org +S: Maintained +F: drivers/media/platform/video-mux.c + VIRTIO AND VHOST VSOCK DRIVER M: Stefan Hajnoczi L: k...@vger.kernel.org -- 2.11.0
Fwd: Re: [PATCH v6 1/3] [media] v4l: add parsed MPEG-2 support
I don't know why it was sent in html format, I am sorry to re-send it again. On 04/28/2017 09:25 PM, Hugues Fruchet wrote: Add "parsed MPEG-2" pixel format & related controls needed by stateless video decoders. In order to decode the video bitstream chunk provided by user on output queue, stateless decoders require also some extra data resulting from this video bitstream chunk parsing. Those parsed extra data have to be set by user through control framework using the dedicated mpeg video extended controls introduced in this patchset. I have compared those v4l2 controls with the registers of the rockchip video IP. Most of them are met, but only lacks of sw_init_qp. Here is the full translation table of the registers of the rockchip video IP. q_scale_type sw_qscale_type concealment_motion_vectorssw_con_mv_e intra_dc_precision sw_intra_dc_prec intra_vlc_format sw_intra_vlc_tab frame_pred_frame_dct sw_frame_pred_dct alternate_scan sw_alt_scan_flag_e f_code sw_fcode_bwd_ver sw_fcode_bwd_hor sw_fcode_fwd_ver sw_fcode_fwd_hor full_pel_forward_vector sw_mv_accuracy_fwd full_pel_backward_vector sw_mv_accuracy_bwd I also saw you add two format for parsed MPEG-2/MPEG-1 format, I would not recommand to do that. That is what google does, because for a few video format and some hardware, they just request a offsets from the original video byte stream. Signed-off-by: Hugues Fruchet --- Documentation/media/uapi/v4l/extended-controls.rst | 363 + Documentation/media/uapi/v4l/pixfmt-013.rst| 10 + Documentation/media/uapi/v4l/vidioc-queryctrl.rst | 38 ++- Documentation/media/videodev2.h.rst.exceptions | 6 + drivers/media/v4l2-core/v4l2-ctrls.c | 53 +++ drivers/media/v4l2-core/v4l2-ioctl.c | 2 + include/uapi/linux/v4l2-controls.h | 94 ++ include/uapi/linux/videodev2.h | 8 + 8 files changed, 572 insertions(+), 2 deletions(-) diff --git a/Documentation/media/uapi/v4l/extended-controls.rst b/Documentation/media/uapi/v4l/extended-controls.rst index abb1057..b48eac9 100644 --- a/Documentation/media/uapi/v4l/extended-controls.rst +++ b/Documentation/media/uapi/v4l/extended-controls.rst @@ -1827,6 +1827,369 @@ enum v4l2_mpeg_cx2341x_video_median_filter_type - not insert, 1 = insert packets. +MPEG-2 Parsed Control Reference +- + +The MPEG-2 parsed decoding controls are needed by stateless video decoders. +Those decoders expose :ref:`Compressed formats ` :ref:`V4L2_PIX_FMT_MPEG1_PARSED` or :ref:`V4L2_PIX_FMT_MPEG2_PARSED`. +In order to decode the video bitstream chunk provided by user on output queue, +stateless decoders require also some extra data resulting from this video +bitstream chunk parsing. Those parsed extra data have to be set by user +through control framework using the mpeg video extended controls defined +in this section. Those controls have been defined based on MPEG-2 standard +ISO/IEC 13818-2, and so derive directly from the MPEG-2 video bitstream syntax +including how it is coded inside bitstream (enumeration values for ex.). + +MPEG-2 Parsed Control IDs +^^^ + +.. _mpeg2-parsed-control-id: + +.. c:type:: V4L2_CID_MPEG_VIDEO_MPEG2_SEQ_HDR +(enum) + +.. tabularcolumns:: |p{4.0cm}|p{2.5cm}|p{11.0cm}| + +.. c:type:: v4l2_mpeg_video_mpeg2_seq_hdr + +.. cssclass:: longtable + +.. flat-table:: struct v4l2_mpeg_video_mpeg2_seq_hdr +:header-rows: 0 +:stub-columns: 0 +:widths: 1 1 2 + +* - __u16 + - ``width`` + - Video width in pixels. +* - __u16 + - ``height`` + - Video height in pixels. +* - __u8 + - ``aspect_ratio_info`` + - Aspect ratio code as in the bitstream (1: 1:1 square pixels, +2: 4:3 display, 3: 16:9 display, 4: 2.21:1 display) +* - __u8 + - ``framerate code`` + - Framerate code as in the bitstream +(1: 24000/1001.0 '23.976 fps, 2: 24.0, 3: 25.0, +4: 3/1001.0 '29.97, 5: 30.0, 6: 50.0, 7: 6/1001.0, +8: 60.0) +* - __u16 + - ``vbv_buffer_size`` + - Video Buffering Verifier size, expressed in 16KBytes unit. +* - __u32 + - ``bitrate_value`` + - Bitrate value as in the bitstream, expressed in 400bps unit +* - __u16 + - ``constrained_parameters_flag`` + - Set to 1 if this bitstream uses constrained parameters. +* - __u8 + - ``load_intra_quantiser_matrix`` + - If set to 1, ``intra_quantiser_matrix`` table is to be used for +decoding. +* - __u8 + - ``load_non_intra_quantiser_matrix`` + - If set to 1, ``non_intra_quantiser_matrix`` table is to be used for +decoding. +* - __u8 + - ``intra_quantiser_matrix[64]`` + - Intra quantization table, in zig-zag scan order. +* - __u8 + - ``non_intra_quantiser_matrix[64]`` + - Non-intra quantization table, in zig
Re: [RFC PATCH v3 09/11] [media] vimc: Subdevices as modules
On 06/03/2017 04:58 AM, Helen Koike wrote: Change the core structure for adding subdevices in the topology. Instead of calling the specific create function for each subdevice, inject a child platform_device with the driver's name. Each type of node in the topology (sensor, capture, debayer, scaler) will register a platform_driver with the corresponding name through the component subsystem. Implementing a new subdevice type doesn't require vimc-core to be altered. This facilitates future implementation of dynamic entities, where hotpluging an entity in the topology is just a matter of registering/unregistering a platform_device in the system. It also facilitates other implementations of different nodes without touching the core code and remove the need of a header file for each type of node. Signed-off-by: Helen Koike --- Changes in v3: [media] vimc: Subdevices as modules - This is a new patch in the series Changes in v2: None --- drivers/media/platform/vimc/Makefile | 7 +- drivers/media/platform/vimc/vimc-capture.c | 96 --- drivers/media/platform/vimc/vimc-capture.h | 28 -- drivers/media/platform/vimc/vimc-common.c | 37 ++- drivers/media/platform/vimc/vimc-common.h | 14 +- drivers/media/platform/vimc/vimc-core.c| 406 +++-- drivers/media/platform/vimc/vimc-sensor.c | 91 +-- drivers/media/platform/vimc/vimc-sensor.h | 28 -- 8 files changed, 320 insertions(+), 387 deletions(-) delete mode 100644 drivers/media/platform/vimc/vimc-capture.h delete mode 100644 drivers/media/platform/vimc/vimc-sensor.h diff --git a/drivers/media/platform/vimc/Makefile b/drivers/media/platform/vimc/Makefile index 6b6ddf4..0e5d5ce 100644 --- a/drivers/media/platform/vimc/Makefile +++ b/drivers/media/platform/vimc/Makefile @@ -1,3 +1,6 @@ -vimc-objs := vimc-core.o vimc-capture.o vimc-common.o vimc-sensor.o +vimc-objs := vimc-core.o +vimc_capture-objs := vimc-capture.o +vimc_common-objs := vimc-common.o +vimc_sensor-objs := vimc-sensor.o -obj-$(CONFIG_VIDEO_VIMC) += vimc.o +obj-$(CONFIG_VIDEO_VIMC) += vimc.o vimc_capture.o vimc_common.o vimc_sensor.o diff --git a/drivers/media/platform/vimc/vimc-capture.c b/drivers/media/platform/vimc/vimc-capture.c index b5da0ea..633d99a 100644 --- a/drivers/media/platform/vimc/vimc-capture.c +++ b/drivers/media/platform/vimc/vimc-capture.c @@ -15,18 +15,24 @@ * */ +#include #include #include +#include +#include #include #include #include #include -#include "vimc-capture.h" +#include "vimc-common.h" + +#define VIMC_CAP_DRV_NAME "vimc-capture" struct vimc_cap_device { struct vimc_ent_device ved; struct video_device vdev; + struct device *dev; struct v4l2_pix_format format; struct vb2_queue queue; struct list_head buf_list; @@ -150,7 +156,7 @@ static int vimc_cap_s_fmt_vid_cap(struct file *file, void *priv, vimc_cap_try_fmt_vid_cap(file, priv, f); - dev_dbg(vcap->vdev.v4l2_dev->dev, "%s: format update: " + dev_dbg(vcap->dev, "%s: format update: " "old:%dx%d (0x%x, %d, %d, %d, %d) " "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vcap->vdev.name, /* old */ @@ -365,8 +371,7 @@ static int vimc_cap_start_streaming(struct vb2_queue *vq, unsigned int count) vcap->kthread_cap = kthread_run(vimc_cap_tpg_thread, vcap, "%s-cap", vcap->vdev.v4l2_dev->name); if (IS_ERR(vcap->kthread_cap)) { - dev_err(vcap->vdev.v4l2_dev->dev, - "%s: kernel_thread() failed\n", + dev_err(vcap->dev, "%s: kernel_thread() failed\n", vcap->vdev.name); ret = PTR_ERR(vcap->kthread_cap); goto err_tpg_free; @@ -443,8 +448,7 @@ static int vimc_cap_buffer_prepare(struct vb2_buffer *vb) unsigned long size = vcap->format.sizeimage; if (vb2_plane_size(vb, 0) < size) { - dev_err(vcap->vdev.v4l2_dev->dev, - "%s: buffer too small (%lu < %lu)\n", + dev_err(vcap->dev, "%s: buffer too small (%lu < %lu)\n", vcap->vdev.name, vb2_plane_size(vb, 0), size); return -EINVAL; } @@ -469,8 +473,10 @@ static const struct media_entity_operations vimc_cap_mops = { .link_validate = vimc_link_validate, }; -static void vimc_cap_destroy(struct vimc_ent_device *ved) +static void vimc_cap_comp_unbind(struct device *comp, struct device *master, +void *master_data) { + struct vimc_ent_device *ved = dev_get_drvdata(comp); struct vimc_cap_device *vcap = container_of(ved, struct vimc_cap_device, ved); @@ -481,32 +487,25 @@ static void vimc_cap_destroy(struct vimc_ent_device *ved
[PATCH v2] media: fdp1: Support ES2 platforms
From: Kieran Bingham The new Renesas R-Car H3 ES2.0 platforms have a new hw version register. Update the driver accordingly, defaulting to the new hw revision, and differentiating the older revision as ES1 Signed-off-by: Kieran Bingham --- drivers/media/platform/rcar_fdp1.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/rcar_fdp1.c b/drivers/media/platform/rcar_fdp1.c index 42f25d241edd..159786b052f3 100644 --- a/drivers/media/platform/rcar_fdp1.c +++ b/drivers/media/platform/rcar_fdp1.c @@ -258,8 +258,9 @@ MODULE_PARM_DESC(debug, "activate debug info"); /* Internal Data (HW Version) */ #define FD1_IP_INTDATA 0x0800 -#define FD1_IP_H3 0x02010101 +#define FD1_IP_H3_ES1 0x02010101 #define FD1_IP_M3W 0x02010202 +#define FD1_IP_H3 0x02010203 /* LUTs */ #define FD1_LUT_DIF_ADJ0x1000 @@ -2359,12 +2360,15 @@ static int fdp1_probe(struct platform_device *pdev) hw_version = fdp1_read(fdp1, FD1_IP_INTDATA); switch (hw_version) { - case FD1_IP_H3: - dprintk(fdp1, "FDP1 Version R-Car H3\n"); + case FD1_IP_H3_ES1: + dprintk(fdp1, "FDP1 Version R-Car H3 ES1\n"); break; case FD1_IP_M3W: dprintk(fdp1, "FDP1 Version R-Car M3-W\n"); break; + case FD1_IP_H3: + dprintk(fdp1, "FDP1 Version R-Car H3\n"); + break; default: dev_err(fdp1->dev, "FDP1 Unidentifiable (0x%08x)\n", hw_version); -- 2.7.4
Re: [PATCH] media: fdp1: Support ES2 platforms
Hi Kieran, Laurent, On Sat, Jun 10, 2017 at 9:54 AM, Laurent Pinchart wrote: > On Friday 09 Jun 2017 18:15:48 Kieran Bingham wrote: >> From: Kieran Bingham >> >> The new Renesas R-Car H3 ES2.0 platforms have an updated hw version >> register. Update the driver accordingly. >> >> Signed-off-by: Kieran Bingham Thanks, seems to work fine (as in: no more complaints from the driver). >> --- a/drivers/media/platform/rcar_fdp1.c >> +++ b/drivers/media/platform/rcar_fdp1.c >> @@ -260,6 +260,7 @@ MODULE_PARM_DESC(debug, "activate debug info"); >> #define FD1_IP_INTDATA 0x0800 >> #define FD1_IP_H30x02010101 >> #define FD1_IP_M3W 0x02010202 >> +#define FD1_IP_H3_ES20x02010203 > > Following our global policy of treating ES2 as the default, how about renaming > FDP1_IP_H3 to FDP1_IP_H3_ES1 and adding a new FD1_IP_H3 for ES2 ? The messages > below should be updated as well. Yes, that sounds good. >> /* LUTs */ >> #define FD1_LUT_DIF_ADJ 0x1000 >> @@ -2365,6 +2366,9 @@ static int fdp1_probe(struct platform_device *pdev) >> case FD1_IP_M3W: >> dprintk(fdp1, "FDP1 Version R-Car M3-W\n"); >> break; >> + case FD1_IP_H3_ES2: >> + dprintk(fdp1, "FDP1 Version R-Car H3-ES2\n"); Please drop dashes between SoC names and revisions. >> + break; >> default: >> dev_err(fdp1->dev, "FDP1 Unidentifiable (0x%08x)\n", >> hw_version); Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
[PATCH] MAINTAINERS: Add entry for R-Car DRIF & MAX2175 drivers
Add maintainter entry for the R-Car DRIF and MAX2175 drivers. Signed-off-by: Ramesh Shanmugasundaram --- Hi Hans, Added the missing MAINTAINTERS entry on top of this (https://www.mail-archive.com/linux-renesas-soc@vger.kernel.org/msg15081.html) series as requested. Thanks, Ramesh. --- MAINTAINERS | 19 +++ 1 file changed, 19 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 053c3bdd1fe5..cfa78fe5142a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8031,6 +8031,16 @@ S: Maintained F: Documentation/hwmon/max20751 F: drivers/hwmon/max20751.c +MAX2175 SDR TUNER DRIVER +M: Ramesh Shanmugasundaram +L: linux-media@vger.kernel.org +T: git git://linuxtv.org/media_tree.git +S: Maintained +F: Documentation/devicetree/bindings/media/i2c/max2175.txt +F: Documentation/media/v4l-drivers/max2175.rst +F: drivers/media/i2c/max2175* +F: include/uapi/linux/max2175.h + MAX6650 HARDWARE MONITOR AND FAN CONTROLLER DRIVER L: linux-hw...@vger.kernel.org S: Orphan @@ -8111,6 +8121,15 @@ L: linux-...@vger.kernel.org S: Maintained F: drivers/iio/dac/cio-dac.c +MEDIA DRIVERS FOR RENESAS - DRIF +M: Ramesh Shanmugasundaram +L: linux-media@vger.kernel.org +L: linux-renesas-...@vger.kernel.org +T: git git://linuxtv.org/media_tree.git +S: Supported +F: Documentation/devicetree/bindings/media/renesas,drif.txt +F: drivers/media/platform/rcar_drif.c + MEDIA DRIVERS FOR RENESAS - FCP M: Laurent Pinchart L: linux-media@vger.kernel.org -- 2.12.2
Re: [PATCH v5 0/8] Add support for DCMI camera interface of STMicroelectronics STM32 SoC series
Hi Hugues On 05/05/2017 05:31 PM, Hugues Fruchet wrote: This patchset introduces a basic support for Digital Camera Memory Interface (DCMI) of STMicroelectronics STM32 SoC series. This first basic support implements RGB565 & YUV frame grabbing. Cropping and JPEG support will be added later on. This has been tested on STM324x9I-EVAL evaluation board embedding an OV2640 camera sensor. . Hugues Fruchet (8): dt-bindings: Document STM32 DCMI bindings [media] stm32-dcmi: STM32 DCMI camera interface driver ARM: dts: stm32: Enable DCMI support on STM32F429 MCU ARM: dts: stm32: Enable DCMI camera interface on STM32F429-EVAL board ARM: dts: stm32: Enable STMPE1600 gpio expander of STM32F429-EVAL board ARM: dts: stm32: Enable OV2640 camera support of STM32F429-EVAL board ARM: configs: stm32: STMPE1600 GPIO expander ARM: configs: stm32: DCMI + OV2640 camera support .../devicetree/bindings/media/st,stm32-dcmi.txt| 46 + arch/arm/boot/dts/stm32429i-eval.dts | 56 + arch/arm/boot/dts/stm32f429.dtsi | 37 + arch/arm/configs/stm32_defconfig |9 + drivers/media/platform/Kconfig | 12 + drivers/media/platform/Makefile|2 + drivers/media/platform/stm32/Makefile |1 + drivers/media/platform/stm32/stm32-dcmi.c | 1403 8 files changed, 1566 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/st,stm32-dcmi.txt create mode 100644 drivers/media/platform/stm32/Makefile create mode 100644 drivers/media/platform/stm32/stm32-dcmi.c Patches 3, 4, 5, 6 applied on stm32-dt-for-v4.13 Patch 7 applied on stm32-defconfig-for-v4.13 Patch 8 will not be applied: As SDRAM used on STM32 MCUs is small, I don't want to penalize other users: - by increasing static kernel size - by enabling devices which consume dynamically lot of memory User will be free to enable it through menuconfig. Regards Alex
Re: [RFC PATCH v3 08/11] [media] vimc: Optimize frame generation through the pipe
On 06/03/2017 04:58 AM, Helen Koike wrote: Add a parameter called vsen_tpg, if true then vimc will work as before: frames will be generated in the sensor nodes then propagated through the pipe and processed by each node until a capture node is reached. If vsen_tpg is false, then the frame is not generated by the sensor, but directly from the capture node, thus saving intermediate memory buffers and process time, allowing a higher frame rate. Signed-off-by: Helen Koike --- Changes in v3: [media] vimc: Optimize frame generation through the pipe - This is a new patch in the series Changes in v2: None --- drivers/media/platform/vimc/vimc-capture.c | 178 + drivers/media/platform/vimc/vimc-common.h | 2 + drivers/media/platform/vimc/vimc-sensor.c | 30 - 3 files changed, 156 insertions(+), 54 deletions(-) diff --git a/drivers/media/platform/vimc/vimc-capture.c b/drivers/media/platform/vimc/vimc-capture.c index e943267..b5da0ea 100644 --- a/drivers/media/platform/vimc/vimc-capture.c +++ b/drivers/media/platform/vimc/vimc-capture.c @@ -15,7 +15,10 @@ * */ +#include +#include #include +#include #include #include @@ -38,6 +41,8 @@ struct vimc_cap_device { struct mutex lock; u32 sequence; struct media_pipeline pipe; + struct tpg_data tpg; + struct task_struct *kthread_cap; }; static const struct v4l2_pix_format fmt_default = { @@ -246,6 +251,91 @@ static void vimc_cap_return_all_buffers(struct vimc_cap_device *vcap, spin_unlock(&vcap->qlock); } +static void vimc_cap_process_frame(struct vimc_ent_device *ved, + struct media_pad *sink, const void *frame) +{ + struct vimc_cap_device *vcap = container_of(ved, struct vimc_cap_device, + ved); + struct vimc_cap_buffer *vimc_buf; + void *vbuf; + + spin_lock(&vcap->qlock); + + /* Get the first entry of the list */ + vimc_buf = list_first_entry_or_null(&vcap->buf_list, + typeof(*vimc_buf), list); + if (!vimc_buf) { + spin_unlock(&vcap->qlock); + return; + } + + /* Remove this entry from the list */ + list_del(&vimc_buf->list); + + spin_unlock(&vcap->qlock); + + /* Fill the buffer */ + vimc_buf->vb2.vb2_buf.timestamp = ktime_get_ns(); + vimc_buf->vb2.sequence = vcap->sequence++; + vimc_buf->vb2.field = vcap->format.field; + + vbuf = vb2_plane_vaddr(&vimc_buf->vb2.vb2_buf, 0); + + if (sink) + memcpy(vbuf, frame, vcap->format.sizeimage); + else + tpg_fill_plane_buffer(&vcap->tpg, V4L2_STD_PAL, 0, vbuf); + + /* Set it as ready */ + vb2_set_plane_payload(&vimc_buf->vb2.vb2_buf, 0, + vcap->format.sizeimage); + vb2_buffer_done(&vimc_buf->vb2.vb2_buf, VB2_BUF_STATE_DONE); +} + + +static int vimc_cap_tpg_thread(void *data) +{ + struct vimc_cap_device *vcap = data; + + set_freezable(); + set_current_state(TASK_UNINTERRUPTIBLE); + + for (;;) { + try_to_freeze(); + if (kthread_should_stop()) + break; + + vimc_cap_process_frame(&vcap->ved, NULL, NULL); + + /* 60 frames per second */ + schedule_timeout(HZ/60); + } + + return 0; +} + +static void vimc_cap_tpg_s_format(struct vimc_cap_device *vcap) +{ + const struct vimc_pix_map *vpix = + vimc_pix_map_by_pixelformat(vcap->format.pixelformat); + + tpg_reset_source(&vcap->tpg, vcap->format.width, vcap->format.height, +vcap->format.field); + tpg_s_bytesperline(&vcap->tpg, 0, vcap->format.width * vpix->bpp); + tpg_s_buf_height(&vcap->tpg, vcap->format.height); + tpg_s_fourcc(&vcap->tpg, vpix->pixelformat); + /* +* TODO: check why the tpg_s_field need this third argument if +* it is already receiving the field +*/ + tpg_s_field(&vcap->tpg, vcap->format.field, + vcap->format.field == V4L2_FIELD_ALTERNATE); I thought I explained that earlier? When in alternate field mode the format.field value will be TOP or BOTTOM, but never ALTERNATE. So tpg_s_field needs to know if it will create TOP or BOTTOM fields only, or if they will be alternating. Since we don't support ALTERNATE anyway, just pass false as the third argument and drop the comment. + tpg_s_colorspace(&vcap->tpg, vcap->format.colorspace); + tpg_s_ycbcr_enc(&vcap->tpg, vcap->format.ycbcr_enc); + tpg_s_quantization(&vcap->tpg, vcap->format.quantization); + tpg_s_xfer_func(&vcap->tpg, vcap->format.xfer_func); +} + static int vimc_cap_start_streaming(struct vb2_queue *vq, unsigned int count) { struct vimc_cap_device *vcap = vb2
Re: [PATCH v2 3/3] [media] intel-ipu3: cio2: Add new MIPI-CSI2 driver
Hi Yong, Please see my comments inline. On Wed, Jun 7, 2017 at 10:34 AM, Yong Zhi wrote: > This patch adds CIO2 CSI-2 device driver for > Intel's IPU3 camera sub-system support. > > Signed-off-by: Yong Zhi > --- > drivers/media/pci/Kconfig|2 + > drivers/media/pci/Makefile |3 +- > drivers/media/pci/intel/Makefile |5 + > drivers/media/pci/intel/ipu3/Kconfig | 17 + > drivers/media/pci/intel/ipu3/Makefile|1 + > drivers/media/pci/intel/ipu3/ipu3-cio2.c | 1788 > ++ > drivers/media/pci/intel/ipu3/ipu3-cio2.h | 424 +++ > 7 files changed, 2239 insertions(+), 1 deletion(-) > create mode 100644 drivers/media/pci/intel/Makefile > create mode 100644 drivers/media/pci/intel/ipu3/Kconfig > create mode 100644 drivers/media/pci/intel/ipu3/Makefile > create mode 100644 drivers/media/pci/intel/ipu3/ipu3-cio2.c > create mode 100644 drivers/media/pci/intel/ipu3/ipu3-cio2.h [snip] > diff --git a/drivers/media/pci/intel/ipu3/Kconfig > b/drivers/media/pci/intel/ipu3/Kconfig > new file mode 100644 > index 000..2a895d6 > --- /dev/null > +++ b/drivers/media/pci/intel/ipu3/Kconfig > @@ -0,0 +1,17 @@ > +config VIDEO_IPU3_CIO2 > + tristate "Intel ipu3-cio2 driver" > + depends on VIDEO_V4L2 && PCI > + depends on MEDIA_CONTROLLER > + depends on HAS_DMA > + depends on ACPI I wonder if it wouldn't make sense to make this depend on X86 (|| COMPILE_TEST) as well. Are we expecting a standalone PCI(e) card with this device in the future? > + select V4L2_FWNODE > + select VIDEOBUF2_DMA_SG > + > + ---help--- > + This is the Intel IPU3 CIO2 CSI-2 receiver unit, found in Intel > + Skylake and Kaby Lake SoCs and used for capturing images and > + video from a camera sensor. > + > + Say Y or M here if you have a Skylake/Kaby Lake SoC with MIPI CSI-2 > + connected camera. > + The module will be called ipu3-cio2. > diff --git a/drivers/media/pci/intel/ipu3/Makefile > b/drivers/media/pci/intel/ipu3/Makefile > new file mode 100644 > index 000..20186e3 > --- /dev/null > +++ b/drivers/media/pci/intel/ipu3/Makefile > @@ -0,0 +1 @@ > +obj-$(CONFIG_VIDEO_IPU3_CIO2) += ipu3-cio2.o > diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c > b/drivers/media/pci/intel/ipu3/ipu3-cio2.c > new file mode 100644 > index 000..69c47fc > --- /dev/null > +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c [snip] > +static int cio2_fbpt_init_dummy(struct cio2_device *cio2) > +{ > + unsigned int i; > + > + cio2->dummy_page = dma_alloc_noncoherent(&cio2->pci_dev->dev, > PAGE_SIZE, > + &cio2->dummy_page_bus_addr, > GFP_KERNEL); > + cio2->dummy_lop = dma_alloc_noncoherent(&cio2->pci_dev->dev, > PAGE_SIZE, > + &cio2->dummy_lop_bus_addr, > GFP_KERNEL); Something is not right here. Why noncoherent memory is allocated, but coherent memory is freed in the free function above? Wasn't the intention to just always use coherent memory throughout the driver? > + if (!cio2->dummy_page || !cio2->dummy_lop) { > + cio2_fbpt_exit_dummy(cio2); > + return -ENOMEM; > + } > + /* > +* List of Pointers(LOP) contains 1024x32b pointers to 4KB page each > +* Initialize each entry to dummy_page bus base address. > +*/ > + for (i = 0; i < PAGE_SIZE / sizeof(*cio2->dummy_lop); i++) > + cio2->dummy_lop[i] = cio2->dummy_page_bus_addr >> PAGE_SHIFT; > + > + return 0; > +} [snip] > +/* Initialize fpbt entries to point to a given buffer */ > +static void cio2_fbpt_entry_init_buf(struct cio2_device *cio2, > +struct cio2_buffer *b, > +struct cio2_fbpt_entry > +entry[CIO2_MAX_LOPS]) > +{ > + struct vb2_buffer *vb = &b->vbb.vb2_buf; > + unsigned int length = vb->planes[0].length; > + dma_addr_t lop_bus_addr = b->lop_bus_addr; > + int remaining; > + > + entry[0].first_entry.first_page_offset = > + offset_in_page(vb2_plane_vaddr(vb, 0)); nit: Even though it's technically the same value, it's kind of logically confusing that a function for virtual addresses is used for DMA calculations. Similarly for offset_in_page, since it refers to CPU pages. > + remaining = length + entry[0].first_entry.first_page_offset; > + entry[1].second_entry.num_of_pages = DIV_ROUND_UP(remaining, > PAGE_SIZE); > + /* > +* last_page_available_bytes has the offset of the last byte in the > +* last page which is still accessible by DMA. DMA cannot access > +* beyond this point. Valid range for this is from 0 to 4095. > +* 0 indicates 1st byte in the page is DMA accessible. > +* 4095 (PAGE_SIZE - 1) means every single byte in the last p
Re: [RFC PATCH v3 07/11] [media] vimc: cap: Support several image formats
On 06/03/2017 04:58 AM, Helen Koike wrote: Allow user space to change the image format as the frame size, the pixel format, colorspace, quantization, field YCbCr encoding and the transfer function Signed-off-by: Helen Koike --- Changes in v3: [media] vimc: cap: Support several image formats - use *_DEFAULT macros for colorimetry in the default format - clamp height and width of the image by an even value - is user try to set colorspace to an invalid format, set all colorimetry parameters to _DEFAULT - remove V4L2_FMT_FLAG_COMPRESSED from vimc_cap_enum_fmt_vid_cap - remove V4L2_BUF_TYPE_VIDEO_CAPTURE from vimc_cap_enum_fmt_vid_cap - increase step_width and step_height to 2 instead of 1 - remove link validate function, use the one in vimc-common.c Changes in v2: [media] vimc: cap: Support several image formats - this is a new commit in the serie (the old one was splitted in two) - allow user space to change all fields from struct v4l2_pix_format (e.g. colospace, quantization, field, xfer_func, ycbcr_enc) - link_validate and try_fmt: also checks colospace, quantization, field, xfer_func, ycbcr_enc - add struct v4l2_pix_format fmt_default - add enum_framesizes - enum_fmt_vid_cap: enumerate all formats from vimc_pix_map_table - add mode dev_dbg --- drivers/media/platform/vimc/vimc-capture.c | 131 + 1 file changed, 115 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/vimc/vimc-capture.c b/drivers/media/platform/vimc/vimc-capture.c index 5bdecd1..e943267 100644 --- a/drivers/media/platform/vimc/vimc-capture.c +++ b/drivers/media/platform/vimc/vimc-capture.c @@ -40,6 +40,14 @@ struct vimc_cap_device { struct media_pipeline pipe; }; +static const struct v4l2_pix_format fmt_default = { + .width = 640, + .height = 480, + .pixelformat = V4L2_PIX_FMT_RGB24, + .field = V4L2_FIELD_NONE, + .colorspace = V4L2_COLORSPACE_SRGB, +}; + struct vimc_cap_buffer { /* * struct vb2_v4l2_buffer must be the first element @@ -73,7 +81,7 @@ static void vimc_cap_get_format(struct vimc_ent_device *ved, *fmt = vcap->format; } -static int vimc_cap_fmt_vid_cap(struct file *file, void *priv, +static int vimc_cap_g_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { struct vimc_cap_device *vcap = video_drvdata(file); @@ -83,16 +91,112 @@ static int vimc_cap_fmt_vid_cap(struct file *file, void *priv, return 0; } +static int vimc_cap_try_fmt_vid_cap(struct file *file, void *priv, + struct v4l2_format *f) +{ + struct v4l2_pix_format *format = &f->fmt.pix; + const struct vimc_pix_map *vpix; + + format->width = clamp_t(u32, format->width, VIMC_FRAME_MIN_WIDTH, + VIMC_FRAME_MAX_WIDTH) & ~1; + format->height = clamp_t(u32, format->height, VIMC_FRAME_MIN_HEIGHT, +VIMC_FRAME_MAX_HEIGHT) & ~1; + + /* Don't accept a pixelformat that is not on the table */ + vpix = vimc_pix_map_by_pixelformat(format->pixelformat); + if (!vpix) { + format->pixelformat = fmt_default.pixelformat; + vpix = vimc_pix_map_by_pixelformat(format->pixelformat); + } + /* TODO: Add support for custom bytesperline values */ + format->bytesperline = format->width * vpix->bpp; + format->sizeimage = format->bytesperline * format->height; + + if (format->field == V4L2_FIELD_ANY) + format->field = fmt_default.field; + + if (format->colorspace == V4L2_COLORSPACE_DEFAULT) + format->colorspace = fmt_default.colorspace; + + /* Check if values are out of range */ + if (format->colorspace > V4L2_COLORSPACE_DCI_P3) { + format->colorspace = fmt_default.colorspace; + format->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; + format->quantization = V4L2_QUANTIZATION_DEFAULT; + format->xfer_func = V4L2_XFER_FUNC_DEFAULT; + } + if (format->ycbcr_enc > V4L2_YCBCR_ENC_SMPTE240M) + format->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; + if (format->quantization > V4L2_QUANTIZATION_LIM_RANGE) + format->quantization = V4L2_QUANTIZATION_DEFAULT; + if (format->xfer_func > V4L2_XFER_FUNC_SMPTE2084) + format->xfer_func = V4L2_XFER_FUNC_DEFAULT; You might want to move this to common, since the sensor has the same code. + return 0; +} + +static int vimc_cap_s_fmt_vid_cap(struct file *file, void *priv, + struct v4l2_format *f) +{ + struct vimc_cap_device *vcap = video_drvdata(file); + + /* Do not change the format while stream is on */ + if (vb2_is_busy(&vcap->queue)) +
Re: [RFC PATCH v3 05/11] [media] vimc: common: Add vimc_link_validate
On 06/03/2017 04:58 AM, Helen Koike wrote: All links will be checked in the same way. Adding a helper function for that Signed-off-by: Helen Koike --- Changes in v3: [media] vimc: common: Add vimc_link_validate - this is a new patch in the series Changes in v2: None --- drivers/media/platform/vimc/vimc-capture.c | 78 +++--- drivers/media/platform/vimc/vimc-common.c | 124 - drivers/media/platform/vimc/vimc-common.h | 14 3 files changed, 148 insertions(+), 68 deletions(-) diff --git a/drivers/media/platform/vimc/vimc-capture.c b/drivers/media/platform/vimc/vimc-capture.c index 93f6a09..5bdecd1 100644 --- a/drivers/media/platform/vimc/vimc-capture.c +++ b/drivers/media/platform/vimc/vimc-capture.c @@ -64,6 +64,15 @@ static int vimc_cap_querycap(struct file *file, void *priv, return 0; } +static void vimc_cap_get_format(struct vimc_ent_device *ved, + struct v4l2_pix_format *fmt) +{ + struct vimc_cap_device *vcap = container_of(ved, struct vimc_cap_device, + ved); + + *fmt = vcap->format; +} + static int vimc_cap_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { @@ -231,74 +240,8 @@ static const struct vb2_ops vimc_cap_qops = { .wait_finish= vb2_ops_wait_finish, }; -/* - * NOTE: this function is a copy of v4l2_subdev_link_validate_get_format - * maybe the v4l2 function should be public - */ -static int vimc_cap_v4l2_subdev_link_validate_get_format(struct media_pad *pad, - struct v4l2_subdev_format *fmt) -{ - struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(pad->entity); - - fmt->which = V4L2_SUBDEV_FORMAT_ACTIVE; - fmt->pad = pad->index; - - return v4l2_subdev_call(sd, pad, get_fmt, NULL, fmt); -} - -static int vimc_cap_link_validate(struct media_link *link) -{ - struct v4l2_subdev_format source_fmt; - const struct vimc_pix_map *vpix; - struct vimc_cap_device *vcap = container_of(link->sink->entity, - struct vimc_cap_device, - vdev.entity); - struct v4l2_pix_format *sink_fmt = &vcap->format; - int ret; - - /* -* if it is a raw node from vimc-core, ignore the link for now -* TODO: remove this when there are no more raw nodes in the -* core and return error instead -*/ - if (link->source->entity->obj_type == MEDIA_ENTITY_TYPE_BASE) - return 0; - - /* Get the the format of the subdev */ - ret = vimc_cap_v4l2_subdev_link_validate_get_format(link->source, - &source_fmt); - if (ret) - return ret; - - dev_dbg(vcap->vdev.v4l2_dev->dev, - "%s: link validate formats src:%dx%d %d sink:%dx%d %d\n", - vcap->vdev.name, - source_fmt.format.width, source_fmt.format.height, - source_fmt.format.code, - sink_fmt->width, sink_fmt->height, - sink_fmt->pixelformat); - - /* The width, height and code must match. */ - vpix = vimc_pix_map_by_pixelformat(sink_fmt->pixelformat); - if (source_fmt.format.width != sink_fmt->width - || source_fmt.format.height != sink_fmt->height - || vpix->code != source_fmt.format.code) - return -EPIPE; - - /* -* The field order must match, or the sink field order must be NONE -* to support interlaced hardware connected to bridges that support -* progressive formats only. -*/ - if (source_fmt.format.field != sink_fmt->field && - sink_fmt->field != V4L2_FIELD_NONE) - return -EPIPE; - - return 0; -} - static const struct media_entity_operations vimc_cap_mops = { - .link_validate = vimc_cap_link_validate, + .link_validate = vimc_link_validate, }; static void vimc_cap_destroy(struct vimc_ent_device *ved) @@ -434,6 +377,7 @@ struct vimc_ent_device *vimc_cap_create(struct v4l2_device *v4l2_dev, vcap->ved.destroy = vimc_cap_destroy; vcap->ved.ent = &vcap->vdev.entity; vcap->ved.process_frame = vimc_cap_process_frame; + vcap->ved.vdev_get_format = vimc_cap_get_format; /* Initialize the video_device struct */ vdev = &vcap->vdev; diff --git a/drivers/media/platform/vimc/vimc-common.c b/drivers/media/platform/vimc/vimc-common.c index f809a9d..83d4251 100644 --- a/drivers/media/platform/vimc/vimc-common.c +++ b/drivers/media/platform/vimc/vimc-common.c @@ -252,8 +252,130 @@ int vimc_pipeline_s_stream(struct media_entity *ent, int enable) return 0; } +static void vimc_fmt_pix_to_mbus(struct v4l2_mbus_fra
Re: [PATCH RFC 1/2] [media] v4l2: add V4L2_INPUT_TYPE_DEFAULT
On 06/06/2017 06:22 PM, Helen Koike wrote: Hi All, Just reviving this discussion On 2017-04-07 06:53 AM, Laurent Pinchart wrote: Hi Hans, On Friday 07 Apr 2017 11:46:48 Hans Verkuil wrote: On 04/04/2017 03:22 PM, Sakari Ailus wrote: On Mon, Apr 03, 2017 at 12:11:54PM -0300, Helen Koike wrote: On 2017-03-31 06:57 AM, Mauro Carvalho Chehab wrote: Em Fri, 31 Mar 2017 10:29:04 +0200 Hans Verkuil escreveu: On 30/03/17 18:02, Helen Koike wrote: Add V4L2_INPUT_TYPE_DEFAULT and helpers functions for input ioctls to be used when no inputs are available in the device Signed-off-by: Helen Koike --- drivers/media/v4l2-core/v4l2-ioctl.c | 27 +++ include/media/v4l2-ioctl.h | 26 ++ include/uapi/linux/videodev2.h | 1 + 3 files changed, 54 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 0c3f238..ccaf04b 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -2573,6 +2573,33 @@ struct mutex *v4l2_ioctl_get_lock(struct video_device *vdev, unsigned cmd) return vdev->lock; } +int v4l2_ioctl_enum_input_default(struct file *file, void *priv, + struct v4l2_input *i) +{ + if (i->index > 0) + return -EINVAL; + + memset(i, 0, sizeof(*i)); + i->type = V4L2_INPUT_TYPE_DEFAULT; + strlcpy(i->name, "Default", sizeof(i->name)); + + return 0; +} +EXPORT_SYMBOL(v4l2_ioctl_enum_input_default); + +int v4l2_ioctl_g_input_default(struct file *file, void *priv, unsigned int *i) +{ + *i = 0; + return 0; +} +EXPORT_SYMBOL(v4l2_ioctl_g_input_default); + +int v4l2_ioctl_s_input_default(struct file *file, void *priv, unsigned int i) +{ + return i ? -EINVAL : 0; +} +EXPORT_SYMBOL(v4l2_ioctl_s_input_default); + /* Common ioctl debug function. This function can be used by external ioctl messages as well as internal V4L ioctl */ void v4l_printk_ioctl(const char *prefix, unsigned int cmd) diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 6cd94e5..accc470 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h @@ -652,6 +652,32 @@ struct video_device; */ struct mutex *v4l2_ioctl_get_lock(struct video_device *vdev, unsigned int cmd); + +/** + * v4l2_ioctl_enum_input_default - v4l2 ioctl helper for VIDIOC_ENUM_INPUT ioctl + * + * Plug this function in vidioc_enum_input field of the struct v4l2_ioctl_ops to + * enumerate a single input as V4L2_INPUT_TYPE_DEFAULT + */ +int v4l2_ioctl_enum_input_default(struct file *file, void *priv, + struct v4l2_input *i); + +/** + * v4l2_ioctl_g_input_default - v4l2 ioctl helper for VIDIOC_G_INPUT ioctl + * + * Plug this function in vidioc_g_input field of the struct v4l2_ioctl_ops + * when using v4l2_ioctl_enum_input_default + */ +int v4l2_ioctl_g_input_default(struct file *file, void *priv, unsigned int *i); + +/** + * v4l2_ioctl_s_input_default - v4l2 ioctl helper for VIDIOC_S_INPUT ioctl + * + * Plug this function in vidioc_s_input field of the struct v4l2_ioctl_ops + * when using v4l2_ioctl_enum_input_default + */ +int v4l2_ioctl_s_input_default(struct file *file, void *priv, unsigned int i); + /* names for fancy debug output */ extern const char *v4l2_field_names[]; extern const char *v4l2_type_names[]; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 316be62..c10bbde 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1477,6 +1477,7 @@ struct v4l2_input { }; /* Values for the 'type' field */ +#define V4L2_INPUT_TYPE_DEFAULT0 I don't think we should add a new type here. I second that. Just replied the same thing on a comment from Sakari to patch 2/2. The whole point of this exercise is to allow existing apps to work, and existing apps expect a TYPE_CAMERA. BTW, don't read to much in the term 'CAMERA': it's really a catch all for any video stream, whether it is from a sensor, composite input, HDMI, etc. The description for V4L2_INPUT_TYPE_CAMERA in the spec is hopelessly out of date :-( Yeah, we always used "CAMERA" to mean NOT_TUNER. Rather than creating a new type I would add a new V4L2_IN_CAP_MC capability that indicates that this input is controlled via the media controller. That makes much more sense and it wouldn't potentially break applications. Exactly the same can be done for outputs as well: add V4L2_OUT_CAP_MC and use V4L2_OUTPUT_TYPE_ANALOG as the output type (again, a horrible outdated name and the spec is again out of date). I don't see any sense on distinguishing IN and OUT for MC. I mean: should we ever allow that any driver to have their inputs controlled via V4L2 API, and their outputs controlled via MC (or vice-versa)? I don't think so. Either all device inputs/outputs are controlled via V4L2 or via MC. So, let's call it just V4L2_CAP_MC. R
Re: [PATCH v7 0/7] Add V4L2 SDR (DRIF & MAX2175) driver
Hi Ramesh, Can you post a patch on top of this series adding entries for these two drivers to the MAINTAINERS file? That's missing in this series. Thanks! Hans On 06/09/2017 05:07 PM, Ramesh Shanmugasundaram wrote: Hi Mauro, Hans, This patch set contains two drivers - Renesas R-Car Digital Radio Interface (DRIF) driver - Maxim's MAX2175 RF to Bits tuner driver These patches were based on top of media_tree. commit: 47f910f0e0deb880c2114811f7ea1ec115a19ee4 These two drivers combined together expose a V4L2 SDR device that is compliant with the V4L2 framework [1]. Agreed review comments are incorporated in this series. The rcar_drif device is modelled using "renesas,bonding" property. The discussion on this property is available here [2]. Change history: v6 -> v7: - MAX2175 I2S enable/disable control is made private (Mauro #v4l) - Added COMPILE_TEST to rcar_drif in Kconfig (Hans) v5 -> v6: - Addressed Sakari's comments & rebased to his branch. - Used fwnode_ instead of of_ apis whereever applicable. v4 -> v5: - Minor documentation changes. Refer individual patches. v3 -> v4: - Added ACKs rcar_drif: - Incorporated a number of review comments from Laurent on DRIF driver. - Addressed comments from Rob and Laurent on bindings. max2175: - Minor changes addressing Hans and Laurent's comments v2 -> v3: rcar_drif: - Reduced DRIF DT properties to expose tested I2S mode only (Hans - discussion on #v4l) - Fixed error path clean up of ctrl_hdl on rcar_drif v1 -> v2: - SDR formats renamed as "planar" instead of sliced (Hans) - Documentation formatting correction (Laurent) rcar_drif: - DT model using "bonding" property - Addressed Laurent's coments on bindings - DT optional parameters rename & rework - Addressed Han's comments on driver - Addressed Geert's comments on DT max2175: - Avoided scaling using method proposed by Antti. Thanks - Bindings is a separate patch (Rob) - Addressed Rob's comment on bindings - Added Custom controls documentation (Laurent) [1] v4l2-compliance report: root@salvator-x:~# v4l2-compliance -S /dev/swradio0 v4l2-compliance SHA : d57bb8af0c71d82b702e35a7362aa077189dd593 Driver Info: Driver name : rcar_drif Card type : R-Car DRIF Bus info : platform:R-Car DRIF Driver version: 4.12.0 Capabilities : 0x8531 SDR Capture Tuner Read/Write Streaming Extended Pix Format Device Capabilities Device Caps : 0x0531 SDR Capture Tuner Read/Write Streaming Extended Pix Format Compliance test for device /dev/swradio0 (not using libv4l2): Required ioctls: test VIDIOC_QUERYCAP: OK Allow for multiple opens: test second sdr open: OK test VIDIOC_QUERYCAP: OK test VIDIOC_G/S_PRIORITY: OK test for unlimited opens: OK Debug ioctls: test VIDIOC_DBG_G/S_REGISTER: OK test VIDIOC_LOG_STATUS: OK Input ioctls: test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK test VIDIOC_G/S_FREQUENCY: OK test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported) test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported) Inputs: 0 Audio Inputs: 0 Tuners: 1 Output ioctls: test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported) Outputs: 0 Audio Outputs: 0 Modulators: 0 Input/Output configuration ioctls: test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported) Control ioctls: test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK test VIDIOC_G/S_CTRL: OK test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 5 Private Controls: 2 Format ioctls: test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK test VIDIOC_TRY_FMT: OK test VIDIOC_S_FMT: OK test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported) test Composing: OK (Not Supported)
cron job: media_tree daily build: ERRORS
This message is generated daily by a cron job that builds media_tree for the kernels and architectures in the list below. Results of the daily build of media_tree: date: Mon Jun 12 05:00:20 CEST 2017 media-tree git hash:47f910f0e0deb880c2114811f7ea1ec115a19ee4 media_build git hash: 170d3ce439eed9f2f43c5e02fc8d3ca201ca78e8 v4l-utils git hash: ce237eefc1f6dafafc0e1fe3a5fd9f075d3fd066 gcc version:i686-linux-gcc (GCC) 7.1.0 sparse version: v0.5.0-3553-g78b2ea6 smatch version: v0.5.0-3553-g78b2ea6 host hardware: x86_64 host os:4.9.0-164 linux-git-arm-at91: WARNINGS linux-git-arm-davinci: WARNINGS linux-git-arm-multi: WARNINGS linux-git-arm-pxa: OK linux-git-arm-stm32: OK linux-git-blackfin-bf561: OK linux-git-i686: OK linux-git-m32r: OK linux-git-mips: OK linux-git-powerpc64: OK linux-git-sh: OK linux-git-x86_64: WARNINGS linux-2.6.36.4-i686: ERRORS linux-2.6.37.6-i686: ERRORS linux-2.6.38.8-i686: ERRORS linux-2.6.39.4-i686: ERRORS linux-3.0.60-i686: ERRORS linux-3.1.10-i686: ERRORS linux-3.2.37-i686: ERRORS linux-3.3.8-i686: ERRORS linux-3.4.27-i686: ERRORS linux-3.5.7-i686: ERRORS linux-3.6.11-i686: ERRORS linux-3.7.4-i686: ERRORS linux-3.8-i686: ERRORS linux-3.9.2-i686: ERRORS linux-3.10.1-i686: ERRORS linux-3.11.1-i686: ERRORS linux-3.12.67-i686: ERRORS linux-3.13.11-i686: ERRORS linux-3.14.9-i686: ERRORS linux-3.15.2-i686: ERRORS linux-3.16.7-i686: ERRORS linux-3.17.8-i686: ERRORS linux-3.18.7-i686: ERRORS linux-3.19-i686: ERRORS linux-4.0.9-i686: ERRORS linux-4.1.33-i686: ERRORS linux-4.2.8-i686: WARNINGS linux-4.3.6-i686: WARNINGS linux-4.4.22-i686: WARNINGS linux-4.5.7-i686: WARNINGS linux-4.6.7-i686: WARNINGS linux-4.7.5-i686: WARNINGS linux-4.8-i686: OK linux-4.9.26-i686: OK linux-4.10.14-i686: OK linux-4.11-i686: OK linux-4.12-rc1-i686: OK linux-2.6.36.4-x86_64: ERRORS linux-2.6.37.6-x86_64: ERRORS linux-2.6.38.8-x86_64: ERRORS linux-2.6.39.4-x86_64: ERRORS linux-3.0.60-x86_64: ERRORS linux-3.1.10-x86_64: ERRORS linux-3.2.37-x86_64: ERRORS linux-3.3.8-x86_64: ERRORS linux-3.4.27-x86_64: ERRORS linux-3.5.7-x86_64: ERRORS linux-3.6.11-x86_64: ERRORS linux-3.7.4-x86_64: ERRORS linux-3.8-x86_64: ERRORS linux-3.9.2-x86_64: ERRORS linux-3.10.1-x86_64: ERRORS linux-3.11.1-x86_64: ERRORS linux-3.12.67-x86_64: ERRORS linux-3.13.11-x86_64: ERRORS linux-3.14.9-x86_64: ERRORS linux-3.15.2-x86_64: ERRORS linux-3.16.7-x86_64: ERRORS linux-3.17.8-x86_64: ERRORS linux-3.18.7-x86_64: ERRORS linux-3.19-x86_64: ERRORS linux-4.0.9-x86_64: ERRORS linux-4.1.33-x86_64: ERRORS linux-4.2.8-x86_64: WARNINGS linux-4.3.6-x86_64: WARNINGS linux-4.4.22-x86_64: WARNINGS linux-4.5.7-x86_64: WARNINGS linux-4.6.7-x86_64: WARNINGS linux-4.7.5-x86_64: WARNINGS linux-4.8-x86_64: WARNINGS linux-4.9.26-x86_64: WARNINGS linux-4.10.14-x86_64: WARNINGS linux-4.11-x86_64: WARNINGS linux-4.12-rc1-x86_64: WARNINGS apps: WARNINGS spec-git: OK sparse: WARNINGS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Monday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Monday.tar.bz2 The Media Infrastructure API from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/index.html