Re: [RFC PATCH 00/24] Make Nokia N900 cameras working

2016-04-26 Thread Ivaylo Dimitrov

Hi,

On 27.04.2016 06:08, Sebastian Reichel wrote:

Hi,

On Mon, Apr 25, 2016 at 12:08:00AM +0300, Ivaylo Dimitrov wrote:

Those patch series make cameras on Nokia N900 partially working.
Some more patches are needed, but I've already sent them for
upstreaming so they are not part of the series:

https://lkml.org/lkml/2016/4/16/14
https://lkml.org/lkml/2016/4/16/33

As omap3isp driver supports only one endpoint on ccp2 interface,
but cameras on N900 require different strobe settings, so far
it is not possible to have both cameras correctly working with
the same board DTS. DTS patch in the series has the correct
settings for the front camera. This is a problem still to be
solved.

The needed pipeline could be made with:

media-ctl -r
media-ctl -l '"vs6555 binner 2-0010":1 -> "video-bus-switch":2 [1]'
media-ctl -l '"video-bus-switch":0 -> "OMAP3 ISP CCP2":0 [1]'
media-ctl -l '"OMAP3 ISP CCP2":1 -> "OMAP3 ISP CCDC":0 [1]'
media-ctl -l '"OMAP3 ISP CCDC":2 -> "OMAP3 ISP preview":0 [1]'
media-ctl -l '"OMAP3 ISP preview":1 -> "OMAP3 ISP resizer":0 [1]'
media-ctl -l '"OMAP3 ISP resizer":1 -> "OMAP3 ISP resizer output":0 [1]'
media-ctl -V '"vs6555 pixel array 2-0010":0 [SGRBG10/648x488 (0,0)/648x488 
(0,0)/648x488]'
media-ctl -V '"vs6555 binner 2-0010":1 [SGRBG10/648x488 (0,0)/648x488 
(0,0)/648x488]'
media-ctl -V '"OMAP3 ISP CCP2":0 [SGRBG10 648x488]'
media-ctl -V '"OMAP3 ISP CCP2":1 [SGRBG10 648x488]'
media-ctl -V '"OMAP3 ISP CCDC":2 [SGRBG10 648x488]'
media-ctl -V '"OMAP3 ISP preview":1 [UYVY 648x488]'
media-ctl -V '"OMAP3 ISP resizer":1 [UYVY 656x488]'

and tested with:

mplayer -tv driver=v4l2:width=656:height=488:outfmt=uyvy:device=/dev/video6 -vo 
xv -vf screenshot tv://


4.6-rc4 + twl regulator patch + the patches mentioned above + this
patchset (I put everything together here [0]) do _not_ work for me.
The error matches what I have seen when I was working on it: No
image data seems to be received by the ISP. For example there are
no related IRQs:

root@n900:~# cat /proc/interrupts  | grep ISP
  40:  0  INTC  24 Edge  480bd400.mmu, OMAP3 ISP

I tested with mpv and yavta (yavta --capture=8 --pause --skip 0
--format UYVY --size 656x488 /dev/video6)

[0] 
https://git.kernel.org/cgit/linux/kernel/git/sre/linux-n900.git/log/?h=n900-camera-ivo



Ok, going to diff with my tree to see what I have missed to send in the 
patchset


Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 00/24] Make Nokia N900 cameras working

2016-04-26 Thread Sebastian Reichel
Hi,

On Mon, Apr 25, 2016 at 12:08:00AM +0300, Ivaylo Dimitrov wrote:
> Those patch series make cameras on Nokia N900 partially working.
> Some more patches are needed, but I've already sent them for
> upstreaming so they are not part of the series:
> 
> https://lkml.org/lkml/2016/4/16/14
> https://lkml.org/lkml/2016/4/16/33
> 
> As omap3isp driver supports only one endpoint on ccp2 interface,
> but cameras on N900 require different strobe settings, so far
> it is not possible to have both cameras correctly working with
> the same board DTS. DTS patch in the series has the correct
> settings for the front camera. This is a problem still to be
> solved.
> 
> The needed pipeline could be made with:
> 
> media-ctl -r
> media-ctl -l '"vs6555 binner 2-0010":1 -> "video-bus-switch":2 [1]'
> media-ctl -l '"video-bus-switch":0 -> "OMAP3 ISP CCP2":0 [1]'
> media-ctl -l '"OMAP3 ISP CCP2":1 -> "OMAP3 ISP CCDC":0 [1]'
> media-ctl -l '"OMAP3 ISP CCDC":2 -> "OMAP3 ISP preview":0 [1]'
> media-ctl -l '"OMAP3 ISP preview":1 -> "OMAP3 ISP resizer":0 [1]'
> media-ctl -l '"OMAP3 ISP resizer":1 -> "OMAP3 ISP resizer output":0 [1]'
> media-ctl -V '"vs6555 pixel array 2-0010":0 [SGRBG10/648x488 (0,0)/648x488 
> (0,0)/648x488]'
> media-ctl -V '"vs6555 binner 2-0010":1 [SGRBG10/648x488 (0,0)/648x488 
> (0,0)/648x488]'
> media-ctl -V '"OMAP3 ISP CCP2":0 [SGRBG10 648x488]'
> media-ctl -V '"OMAP3 ISP CCP2":1 [SGRBG10 648x488]'
> media-ctl -V '"OMAP3 ISP CCDC":2 [SGRBG10 648x488]'
> media-ctl -V '"OMAP3 ISP preview":1 [UYVY 648x488]'
> media-ctl -V '"OMAP3 ISP resizer":1 [UYVY 656x488]'
> 
> and tested with:
> 
> mplayer -tv driver=v4l2:width=656:height=488:outfmt=uyvy:device=/dev/video6 
> -vo xv -vf screenshot tv://

4.6-rc4 + twl regulator patch + the patches mentioned above + this
patchset (I put everything together here [0]) do _not_ work for me.
The error matches what I have seen when I was working on it: No
image data seems to be received by the ISP. For example there are
no related IRQs:

root@n900:~# cat /proc/interrupts  | grep ISP
 40:  0  INTC  24 Edge  480bd400.mmu, OMAP3 ISP

I tested with mpv and yavta (yavta --capture=8 --pause --skip 0
--format UYVY --size 656x488 /dev/video6)

[0] 
https://git.kernel.org/cgit/linux/kernel/git/sre/linux-n900.git/log/?h=n900-camera-ivo

-- Sebastian


signature.asc
Description: PGP signature


[PATCH] media: fix media_ioctl use-after-free when driver unbinds

2016-04-26 Thread Shuah Khan
When driver unbind is run while media_ioctl is in progress, media_ioctl()
fails with use-after-free. This first use-after-free is followed by more
user-after-free errors in media_release(), kobject_put(), and cdev_put()
as driver unbind continues. This problem is found on uvcvideo, em28xx, and
au0828 drivers and fix has been tested on all three.

This fix allocates media devnode and manages its lifetime separate from the
struct media_device. Adds kobject to the media_devnode structure and this
kobject is set as the cdev parent kobject. This allows cdev_add() to hold
a reference to it and release the reference in cdev_del() ensuring that the
media_devnode is not deallocated as long as the application has the cdev
open.

The first error is below:

[  472.424302] 
==
[  472.424333] BUG: KASAN: use-after-free in media_ioctl+0xf0/0x130 [media] at 
addr 880027b72330
[  472.424341] Read of size 8 by task media_device_te/1794
[  472.424348] 
=
[  472.424356] BUG kmalloc-4096 (Not tainted): kasan: bad access detected
[  472.424361] 
-
[  472.431973] CPU: 1 PID: 1794 Comm: media_device_te Tainted: GB   
4.6.0-rc5 #2
[  472.431988] Hardware name: Hewlett-Packard HP ProBook 6475b/180F, BIOS 68TTU 
Ver. F.04 08/03/2012
[  472.431996]  ea9edc00 88009ddffc78 81aecac3 
8801fa403200
[  472.432016]  880027b72260 88009ddffca8 815359b2 
8801fa403200
[  472.432040]  ea9edc00 880027b72260 a0c9cc60 
88009ddffcd0
[  472.432059] Call Trace:
[  472.432079]  [] dump_stack+0x67/0x94
[  472.432092]  [] print_trailer+0x112/0x1a0
[  472.432108]  [] object_err+0x34/0x40
[  472.432125]  [] kasan_report_error+0x224/0x530
[  472.432148]  [] ? 
__media_device_get_topology+0x1850/0x1850 [media]
[  472.432167]  [] __asan_report_load8_noabort+0x43/0x50
[  472.432190]  [] ? media_ioctl+0x120/0x130 [media]
[  472.432209]  [] media_ioctl+0x120/0x130 [media]
[  472.432229]  [] do_vfs_ioctl+0x184/0xe80
[  472.432243]  [] ? ioctl_preallocate+0x1a0/0x1a0
[  472.432256]  [] ? __hrtimer_init+0x170/0x170
[  472.432272]  [] ? do_nanosleep+0x161/0x480
[  472.432298]  [] ? sigprocmask+0x290/0x290
[  472.432323]  [] ? __fget_light+0x139/0x200
[  472.432358]  [] SyS_ioctl+0x79/0x90
[  472.432381]  [] entry_SYSCALL_64_fastpath+0x18/0xa8

Signed-off-by: Shuah Khan 
---
 drivers/media/media-device.c   | 32 
 drivers/media/media-devnode.c  | 23 +++
 drivers/media/usb/au0828/au0828-core.c |  4 ++--
 drivers/media/usb/uvc/uvc_driver.c |  2 +-
 include/media/media-device.h   |  7 ++-
 include/media/media-devnode.h  |  8 +++-
 6 files changed, 55 insertions(+), 21 deletions(-)

diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 6e43c95..78b0350 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -428,7 +428,7 @@ static long media_device_ioctl(struct file *filp, unsigned 
int cmd,
   unsigned long arg)
 {
struct media_devnode *devnode = media_devnode_data(filp);
-   struct media_device *dev = to_media_device(devnode);
+   struct media_device *dev = devnode->media_dev;
long ret;
 
switch (cmd) {
@@ -504,7 +504,7 @@ static long media_device_compat_ioctl(struct file *filp, 
unsigned int cmd,
  unsigned long arg)
 {
struct media_devnode *devnode = media_devnode_data(filp);
-   struct media_device *dev = to_media_device(devnode);
+   struct media_device *dev = devnode->media_dev;
long ret;
 
switch (cmd) {
@@ -546,7 +546,8 @@ static const struct media_file_operations media_device_fops 
= {
 static ssize_t show_model(struct device *cd,
  struct device_attribute *attr, char *buf)
 {
-   struct media_device *mdev = to_media_device(to_media_devnode(cd));
+   struct media_devnode *devnode = to_media_devnode(cd);
+   struct media_device *mdev = devnode->media_dev;
 
return sprintf(buf, "%.*s\n", (int)sizeof(mdev->model), mdev->model);
 }
@@ -725,21 +726,26 @@ int __must_check __media_device_register(struct 
media_device *mdev,
 {
int ret;
 
+   mdev->devnode = kzalloc(sizeof(struct media_devnode), GFP_KERNEL);
+   if (!mdev->devnode)
+   return -ENOMEM;
+
/* Register the device node. */
-   mdev->devnode.fops = _device_fops;
-   mdev->devnode.parent = mdev->dev;
-   mdev->devnode.release = media_device_release;
+   mdev->devnode->fops = _device_fops;
+   mdev->devnode->parent = mdev->dev;
+   mdev->devnode->media_dev = mdev;
+   mdev->devnode->release = media_device_release;
 
  

cron job: media_tree daily build: OK

2016-04-26 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Wed Apr 27 04:00:30 CEST 2016
git branch: test
git hash:   45c175c4ae9695d6d2f30a45ab7f3866cfac184b
gcc version:i686-linux-gcc (GCC) 5.3.0
sparse version: v0.5.0-56-g7647c77
smatch version: v0.5.0-3413-g618cd5c
host hardware:  x86_64
host os:4.5.0-164

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin-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: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16.7-i686: OK
linux-3.17.8-i686: OK
linux-3.18.7-i686: OK
linux-3.19-i686: OK
linux-4.0-i686: OK
linux-4.1.1-i686: OK
linux-4.2-i686: OK
linux-4.3-i686: OK
linux-4.4-i686: OK
linux-4.5-i686: OK
linux-4.6-rc1-i686: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16.7-x86_64: OK
linux-3.17.8-x86_64: OK
linux-3.18.7-x86_64: OK
linux-3.19-x86_64: OK
linux-4.0-x86_64: OK
linux-4.1.1-x86_64: OK
linux-4.2-x86_64: OK
linux-4.3-x86_64: OK
linux-4.4-x86_64: OK
linux-4.5-x86_64: OK
linux-4.6-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: WARNINGS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Wednesday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Wednesday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] Fix ir-rx51 by using PWM pdata

2016-04-26 Thread Tony Lindgren
Hi all,

Here are minimal fixes to get ir-rx51 going again. Then further
fixes can be done as noted in the second patch.

Regards,

Tony


Tony Lindgren (2):
  ARM: OMAP2+: Add more functions to pwm pdata for ir-rx51
  [media] ir-rx51: Fix build after multiarch changes broke it

 arch/arm/mach-omap2/board-rx51-peripherals.c   | 35 -
 arch/arm/mach-omap2/pdata-quirks.c | 33 -
 drivers/media/rc/Kconfig   |  2 +-
 drivers/media/rc/ir-rx51.c | 99 ++
 include/linux/platform_data/media/ir-rx51.h|  1 +
 include/linux/platform_data/pwm_omap_dmtimer.h | 21 ++
 6 files changed, 141 insertions(+), 50 deletions(-)

-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] ARM: OMAP2+: Add more functions to pwm pdata for ir-rx51

2016-04-26 Thread Tony Lindgren
Before we start removing omap3 legacy booting support, let's make n900
DT booting behave the same way for ir-rx51 as the legacy booting does.

For now, we need to pass pdata to the ir-rx51 driver. This means that
the n900 tree can move to using DT based booting without having to carry
all the legacy platform data with it when it gets dropped from the mainline
tree.

Note that the ir-rx51 driver is currently disabled because of the
dependency to !ARCH_MULTIPLATFORM. This will get sorted out later
with the help of drivers/pwm/pwm-omap-dmtimer.c. But first we need
to add chained IRQ support to dmtimer code to avoid introducing new
custom frameworks.

So let's just pass the necessary dmtimer functions to ir-rx51 so we
can get it working in the following patch.

Cc: Neil Armstrong 
Signed-off-by: Tony Lindgren 
---
 arch/arm/mach-omap2/board-rx51-peripherals.c   | 35 --
 arch/arm/mach-omap2/pdata-quirks.c | 33 +++-
 include/linux/platform_data/media/ir-rx51.h|  1 +
 include/linux/platform_data/pwm_omap_dmtimer.h | 21 
 4 files changed, 87 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c 
b/arch/arm/mach-omap2/board-rx51-peripherals.c
index da174c0..4c35ffd 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -30,6 +30,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 
 #include "common.h"
@@ -47,9 +49,8 @@
 
 #include 
 
-#if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE)
+#include 
 #include 
-#endif
 
 #include "mux.h"
 #include "omap-pm.h"
@@ -1212,10 +1213,40 @@ static void __init rx51_init_tsc2005(void)
gpio_to_irq(RX51_TSC2005_IRQ_GPIO);
 }
 
+#if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
+static struct pwm_omap_dmtimer_pdata pwm_dmtimer_pdata = {
+   .request_by_node = omap_dm_timer_request_by_node,
+   .request_specific = omap_dm_timer_request_specific,
+   .request = omap_dm_timer_request,
+   .set_source = omap_dm_timer_set_source,
+   .get_irq = omap_dm_timer_get_irq,
+   .set_int_enable = omap_dm_timer_set_int_enable,
+   .set_int_disable = omap_dm_timer_set_int_disable,
+   .free = omap_dm_timer_free,
+   .enable = omap_dm_timer_enable,
+   .disable = omap_dm_timer_disable,
+   .get_fclk = omap_dm_timer_get_fclk,
+   .start = omap_dm_timer_start,
+   .stop = omap_dm_timer_stop,
+   .set_load = omap_dm_timer_set_load,
+   .set_match = omap_dm_timer_set_match,
+   .set_pwm = omap_dm_timer_set_pwm,
+   .set_prescaler = omap_dm_timer_set_prescaler,
+   .read_counter = omap_dm_timer_read_counter,
+   .write_counter = omap_dm_timer_write_counter,
+   .read_status = omap_dm_timer_read_status,
+   .write_status = omap_dm_timer_write_status,
+};
+#endif
+
 #if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE)
 static struct lirc_rx51_platform_data rx51_lirc_data = {
.set_max_mpu_wakeup_lat = omap_pm_set_max_mpu_wakeup_lat,
.pwm_timer = 9, /* Use GPT 9 for CIR */
+#if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
+   .dmtimer = _dmtimer_pdata,
+#endif
+
 };
 
 static struct platform_device rx51_lirc_device = {
diff --git a/arch/arm/mach-omap2/pdata-quirks.c 
b/arch/arm/mach-omap2/pdata-quirks.c
index cfaf45f..b36f0bd 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "common.h"
@@ -32,6 +33,7 @@
 #include "dss-common.h"
 #include "control.h"
 #include "omap_device.h"
+#include "omap-pm.h"
 #include "omap-secure.h"
 #include "soc.h"
 #include "hsmmc.h"
@@ -271,6 +273,8 @@ static struct platform_device omap3_rom_rng_device = {
},
 };
 
+static struct platform_device rx51_lirc_device;
+
 static void __init nokia_n900_legacy_init(void)
 {
hsmmc2_internal_input_clk();
@@ -291,6 +295,8 @@ static void __init nokia_n900_legacy_init(void)
platform_device_register(_rom_rng_device);
 
}
+
+   platform_device_register(_lirc_device);
 }
 
 static void __init omap3_tao3530_legacy_init(void)
@@ -458,8 +464,14 @@ void omap_auxdata_legacy_init(struct device *dev)
 
 /* Dual mode timer PWM callbacks platdata */
 #if IS_ENABLED(CONFIG_OMAP_DM_TIMER)
-struct pwm_omap_dmtimer_pdata pwm_dmtimer_pdata = {
+static struct pwm_omap_dmtimer_pdata pwm_dmtimer_pdata = {
.request_by_node = omap_dm_timer_request_by_node,
+   .request_specific = omap_dm_timer_request_specific,
+   .request = omap_dm_timer_request,
+   .set_source = omap_dm_timer_set_source,
+   .get_irq = omap_dm_timer_get_irq,
+   .set_int_enable = omap_dm_timer_set_int_enable,
+   .set_int_disable = omap_dm_timer_set_int_disable,
.free = omap_dm_timer_free,
.enable = omap_dm_timer_enable,
.disable = 

[PATCH 2/2] [media] ir-rx51: Fix build after multiarch changes broke it

2016-04-26 Thread Tony Lindgren
The ir-rx51 driver for n900 has been disabled since the multiarch
changes as plat include directory no longer is SoC specific.

Let's fix it with minimal changes to pass the dmtimer calls in
pdata. Then the following changes can be done while things can
be tested to be working for each change:

1. Change the non-pwm dmtimer to use just hrtimer if possible

2. Change the pwm dmtimer to use Linux PWM API with the new
   drivers/pwm/pwm-omap-dmtimer.c and remove the direct calls
   to dmtimer functions

3. Parse configuration from device tree and drop the pdata

Note compilation of this depends on the previous patch
"ARM: OMAP2+: Add more functions to pwm pdata for ir-rx51".

Cc: Mauro Carvalho Chehab 
Cc: Neil Armstrong 
Cc: linux-media@vger.kernel.org
Signed-off-by: Tony Lindgren 
---
 drivers/media/rc/Kconfig   |  2 +-
 drivers/media/rc/ir-rx51.c | 99 +-
 2 files changed, 54 insertions(+), 47 deletions(-)


Can you guys please test this still works? I've only been able
to test that it compiles/loads/unloads as my n900 in in a rack.


diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
index bd4d685..370e16e 100644
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -336,7 +336,7 @@ config IR_TTUSBIR
 
 config IR_RX51
tristate "Nokia N900 IR transmitter diode"
-   depends on OMAP_DM_TIMER && ARCH_OMAP2PLUS && LIRC && 
!ARCH_MULTIPLATFORM
+   depends on OMAP_DM_TIMER && PWM_OMAP_DMTIMER && ARCH_OMAP2PLUS && LIRC
---help---
   Say Y or M here if you want to enable support for the IR
   transmitter diode built in the Nokia N900 (RX51) device.
diff --git a/drivers/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c
index 4e1711a..da839c3 100644
--- a/drivers/media/rc/ir-rx51.c
+++ b/drivers/media/rc/ir-rx51.c
@@ -19,6 +19,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -26,11 +27,9 @@
 #include 
 #include 
 
-#include 
-#include 
-
 #include 
 #include 
+#include 
 #include 
 
 #define LIRC_RX51_DRIVER_FEATURES (LIRC_CAN_SET_SEND_DUTY_CYCLE |  \
@@ -44,8 +43,9 @@
 #define TIMER_MAX_VALUE 0x
 
 struct lirc_rx51 {
-   struct omap_dm_timer *pwm_timer;
-   struct omap_dm_timer *pulse_timer;
+   pwm_omap_dmtimer *pwm_timer;
+   pwm_omap_dmtimer *pulse_timer;
+   struct pwm_omap_dmtimer_pdata *dmtimer;
struct device*dev;
struct lirc_rx51_platform_data *pdata;
wait_queue_head_t wqueue;
@@ -63,14 +63,14 @@ struct lirc_rx51 {
 
 static void lirc_rx51_on(struct lirc_rx51 *lirc_rx51)
 {
-   omap_dm_timer_set_pwm(lirc_rx51->pwm_timer, 0, 1,
- OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE);
+   lirc_rx51->dmtimer->set_pwm(lirc_rx51->pwm_timer, 0, 1,
+   PWM_OMAP_DMTIMER_TRIGGER_OVERFLOW_AND_COMPARE);
 }
 
 static void lirc_rx51_off(struct lirc_rx51 *lirc_rx51)
 {
-   omap_dm_timer_set_pwm(lirc_rx51->pwm_timer, 0, 1,
- OMAP_TIMER_TRIGGER_NONE);
+   lirc_rx51->dmtimer->set_pwm(lirc_rx51->pwm_timer, 0, 1,
+   PWM_OMAP_DMTIMER_TRIGGER_NONE);
 }
 
 static int init_timing_params(struct lirc_rx51 *lirc_rx51)
@@ -79,12 +79,12 @@ static int init_timing_params(struct lirc_rx51 *lirc_rx51)
 
load = -(lirc_rx51->fclk_khz * 1000 / lirc_rx51->freq);
match = -(lirc_rx51->duty_cycle * -load / 100);
-   omap_dm_timer_set_load(lirc_rx51->pwm_timer, 1, load);
-   omap_dm_timer_set_match(lirc_rx51->pwm_timer, 1, match);
-   omap_dm_timer_write_counter(lirc_rx51->pwm_timer, TIMER_MAX_VALUE - 2);
-   omap_dm_timer_start(lirc_rx51->pwm_timer);
-   omap_dm_timer_set_int_enable(lirc_rx51->pulse_timer, 0);
-   omap_dm_timer_start(lirc_rx51->pulse_timer);
+   lirc_rx51->dmtimer->set_load(lirc_rx51->pwm_timer, 1, load);
+   lirc_rx51->dmtimer->set_match(lirc_rx51->pwm_timer, 1, match);
+   lirc_rx51->dmtimer->write_counter(lirc_rx51->pwm_timer, TIMER_MAX_VALUE 
- 2);
+   lirc_rx51->dmtimer->start(lirc_rx51->pwm_timer);
+   lirc_rx51->dmtimer->set_int_enable(lirc_rx51->pulse_timer, 0);
+   lirc_rx51->dmtimer->start(lirc_rx51->pulse_timer);
 
lirc_rx51->match = 0;
 
@@ -100,15 +100,15 @@ static int pulse_timer_set_timeout(struct lirc_rx51 
*lirc_rx51, int usec)
BUG_ON(usec < 0);
 
if (lirc_rx51->match == 0)
-   counter = omap_dm_timer_read_counter(lirc_rx51->pulse_timer);
+   counter = 
lirc_rx51->dmtimer->read_counter(lirc_rx51->pulse_timer);
else
counter = lirc_rx51->match;
 
counter += (u32)(lirc_rx51->fclk_khz * usec / (1000));
-   omap_dm_timer_set_match(lirc_rx51->pulse_timer, 1, counter);
-   omap_dm_timer_set_int_enable(lirc_rx51->pulse_timer,
-OMAP_TIMER_INT_MATCH);
-   if 

Re: [PATCH v2 08/13] v4l: vsp1: Make vsp1_entity_get_pad_compose() more generic

2016-04-26 Thread Sergei Shtylyov

Hello.

On 04/26/2016 12:36 AM, Laurent Pinchart wrote:


Turn the helper into a function that can retrieve crop and compose
selection rectangles.

Signed-off-by: Laurent Pinchart 
---
  drivers/media/platform/vsp1/vsp1_entity.c | 24 
  drivers/media/platform/vsp1/vsp1_entity.h |  6 +++---
  drivers/media/platform/vsp1/vsp1_rpf.c|  7 ---
  3 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_entity.c 
b/drivers/media/platform/vsp1/vsp1_entity.c
index f60d7926d53f..8c49a74381a1 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.c
+++ b/drivers/media/platform/vsp1/vsp1_entity.c
@@ -87,12 +87,28 @@ vsp1_entity_get_pad_format(struct vsp1_entity *entity,
return v4l2_subdev_get_try_format(>subdev, cfg, pad);
  }

+/**
+ * vsp1_entity_get_pad_selection - Get a pad selection from storage for entity
+ * @entity: the entity
+ * @cfg: the configuration storage
+ * @pad: the pad number
+ * @target: the selection target
+ *
+ * Return the selection rectangle stored in the given configuration for an
+ * entity's pad. The configuration can be an ACTIVE or TRY configuration. The
+ * selection target can be COMPOSE or CROP.
+ */
  struct v4l2_rect *
-vsp1_entity_get_pad_compose(struct vsp1_entity *entity,
-   struct v4l2_subdev_pad_config *cfg,
-   unsigned int pad)
+vsp1_entity_get_pad_selection(struct vsp1_entity *entity,
+ struct v4l2_subdev_pad_config *cfg,
+ unsigned int pad, unsigned int target)
  {
-   return v4l2_subdev_get_try_compose(>subdev, cfg, pad);
+   if (target == V4L2_SEL_TGT_COMPOSE)
+   return v4l2_subdev_get_try_compose(>subdev, cfg, pad);
+   else if (target == V4L2_SEL_TGT_CROP)
+   return v4l2_subdev_get_try_crop(>subdev, cfg, pad);
+   else
+   return NULL;


   How about *switch* instead?

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH v2 0/2] [media] tvp515p: Proposal for MC input connector support

2016-04-26 Thread Javier Martinez Canillas
On 04/12/2016 06:42 PM, Javier Martinez Canillas wrote:
> Hello,
> 
> This is a second version of an RFC patch series that adds MC input connector
> support to the tvp5150 driver. The first RFC version was [0].
> 
> The patches are RFC because a previous version was merged and later reverted
> since the approach was found to be inadequate. So I preferred to post this
> approach as RFC to discuss it first.
> 
> The main difference with v1 is that a single sink pad is used for the tvp5150
> (instead of using a pad per each input pin) as suggested by Mauro and Hans.
> 
> The mc_nextgen_test dot output after applying the series can be found at [1]
> and the graph png generated using the dot tool is at [2].
> 
> I tested these patches on an IGEPv2 by capturing using both Composite inputs.
> 
> [0]: https://www.mail-archive.com/linux-media@vger.kernel.org/msg95389.html
> [1]: http://hastebin.com/yiduhonome.tex
> [2]: http://i.imgur.com/EyFtVtJ.png?1
> 
> Best regards,
> Javier
> 
> Changes in v2:
> - Remove from the changelog a mention of devices that multiplex the
>   physical RCA connectors to be used for the S-Video Y and C signals
>   since it's a special case and it doesn't really work on the IGEPv2.
> - Use a single sink pad for the demod and map the connectors as entities
>   so the mux is made via links. Suggested by Mauro and Hans.
> 
> Javier Martinez Canillas (2):
>   [media] tvp5150: Add input connectors DT bindings
>   [media] tvp5150: Replace connector support according to DT binding
> 
>  .../devicetree/bindings/media/i2c/tvp5150.txt  |  59 
>  drivers/media/i2c/tvp5150.c| 155 
> +++--
>  2 files changed, 170 insertions(+), 44 deletions(-)
> 

Any comments about this series?

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv6] [media] rcar-vin: add Renesas R-Car VIN driver

2016-04-26 Thread Niklas Söderlund
A V4L2 driver for Renesas R-Car VIN driver that do not depend on
soc_camera. The driver is heavily based on its predecessor and aims to
replace it.

Signed-off-by: Niklas Söderlund 
---

The patched is based on and depends on patches from the media_tree
(git://linuxtv.org/media_tree.git) master branch.

The driver is tested on Koelsch and can do streaming using qv4l2 and
grab frames using yavta. It passes a v4l2-compliance (git master) run
without any failures, see bellow for output. Some issues I know about
but will have to wait for future work in other patches.
 - One can not bind/unbind the subdevice and continue using the driver.
 - Do not support FIELD_ALTERNATE.
 - Suggested compat string "renesas,rcar-gen2-vin" is not included. Will
   address this in a separate patch together with gen3.

The goal is to replace the soc_camera driver completely to prepare for
Gen3 enablement. I have therefor chosen to inherit the
CONFIG_VIDEO_RCAR_VIN name for this new driver and renamed the
soc_camera driver CONFIG_VIDEO_RCAR_VIN_OLD.

* Changes since v5
- Rolled in a patch from Hans Verkuil where s_stream(0) was not called
  if start_streaming failed.
- Rolled in a patch from Hans Verkuil which adds support for the source
  change event and fixes the s_std support: changing the standard will
  also change the resolution, and that was never updated.
- Extended Hans patch to reset the crop and compose rectangles when
  changing the standard to match the new resolution.
- Fixed a spelling error in rcar-vin.h
- Changed terminology for the subdevice from sensor to source.

* Changes since v4
- Set device_caps in struct video_device instead of in vidioc_querycap
  call.
- Verify type is V4L2_BUF_TYPE_VIDEO_CAPTURE in vidioc_g_selection,
  vidioc_s_selection and vidioc_cropcap calls.
- Call subdev operation g_input_status in vidioc_enum_input to fill in
  the struct v4l2_input status field.
- Rework the logic that verifies that the HW is properly stopped when
  calling stop_streaming to not depend on the interrupt handler. One
  user reported problems with the soc_camera driver which used the same
  stop logic as this driver. The report described a scenario where an
  interrupt would not be generated when stopping the HW hence the state
  would not be set to stopped.
- Use the v4l2_rect_* helper functions from recently merged v4l2-rect.h
  instead of having our own implementation of the same functions.

* Changes since v3
- Print error and return EINVAL instead of ENOBUFS if there is not
  enough buffers to fill HW in start_streaming. This error should not
  happen since 'min_buffers_needed' should ensure it never happens but
  we check for the condition anyhow.
- Return all buffers with state VB2_BUF_STATE_QUEUED if there is an
  error in start_streaming.

* Changes since v2
- Fix review comments from Hans Verkuil, thanks!
- Update description in Kconfig
- Drop V4L2_SEL_TGT_COMPOSE_PADDED
- Wrong size for NV16 image
- Copy ycbcr_enc and xfer_func when keeping old format.
- Add vidioc_cropcap
- Return -ENOBUFS in start_streaming to signal more buffers are
  needed instead of sleeping in a critical section...
- Move all v4l2 ioctls and file ops to rcar-v4l2.c (and as a follow
  up moved all HW functions to rcar-dma.c to increase readability).
- Fixed RGB formats 's/V4L2_PIX_FMT_RGB555X/V4L2_PIX_FMT_XRGB555' and
  's/V4L2_PIX_FMT_RGB32/V4L2_PIX_FMT_XBGR32'. This was an error carried
  over from soc-camera dirver, whit this fix I get correct colors in
  qv4l2.
- Rework how media bus type and flags are handled. Instead of defining
  own values and a unsigned int use struct v4l2_mbus_config to store the
  configuration parsed from DT.
- Remove duplicated code from the v4l2_file_operations release code
  path. There is no need to try and stop the streaming from here. If
  start_streaming have been called stop_streaming will be called by the
  framework stopping the streaming.
- Remove all special checks for the chip RCAR_E1. There are no compat
  string that will select this chip model. Neither for this driver or
  its predecessor in soc-camera.
- Force an width alignment of 32 if the NV16 format is used due to HW
  limitation.

* Changes since RFC/PATCH
- Fixed review comments from Hans Verkuil, thanks for reviewing.
- Added vidioc_[gs]_selection crop and composition is supported. Thanks
  Laurent for taking the time and explaining to me how to do
  composition.
- Reworked the DMA flow to better support single and continues frame
  grabbing mode.
- Dropped a lot of the formats that was ported from soc_camera, once I
  looked at it in a working driver it was obvious that the rcar_vin
  soc_camera driver did not support them.
- Added better comments for the core structs
- Fixed copyright in file headers
- A lot more testing.

# v4l2-compliance -d 27 -s -f
Driver Info:
Driver name   : rcar_vin
Card type : R_Car_VIN
Bus info 

dvbv5-scan does not find any DVBS2 channels

2016-04-26 Thread Bob Goddard
Like my previous email, I complained that dvbv5-scan does not find ANY DVBS2 
channels on Astra28E, even with a single transponder listed in the source 
frequency file.

I complained about this on 05/02/2016 15:05 and nothing has so far been does. 
It STILL fails.

No doubt Mauro or whoever the hell looks after this list will ban my email 
address again.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Errors in scan file

2016-04-26 Thread Bob Goddard
I posted an email with a patch back on 04/02/2016 17:32 only to find that 
nothing has been done.

This patch, reproduced below adds 2 new transponders to Astra 28.2E and removes 
a trailing space. This trailing spaces causes dvbv5-scan to segfault.

Why has this not been actioned and why was my email address banned? Is this a 
close community that tells people to f-off?



dvb-s/Astra-28.2E | 27 ---
1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/dvb-s/Astra-28.2E b/dvb-s/Astra-28.2E
index ea06c56..42168f6 100644
--- a/dvb-s/Astra-28.2E
+++ b/dvb-s/Astra-28.2E
@@ -264,6 +264,17 @@
MODULATION = QPSK
INVERSION = AUTO
 
+## Astra 2E
+# Transponder 31
+[CHANNEL]
+   DELIVERY_SYSTEM = DVBS
+   FREQUENCY = 12304000
+   POLARIZATION = HORIZONTAL
+   SYMBOL_RATE = 2750
+   INNER_FEC = 2/3
+   MODULATION = QPSK
+   INVERSION = AUTO
+
 # Transponder 32
 [CHANNEL]
DELIVERY_SYSTEM = DVBS2
@@ -572,7 +583,7 @@
 [CHANNEL]
DELIVERY_SYSTEM = DVBS
FREQUENCY = 11170750
-   POLARIZATION = HORIZONTAL 
+   POLARIZATION = HORIZONTAL
SYMBOL_RATE = 2200
INNER_FEC = 5/6
MODULATION = QPSK
@@ -611,8 +622,8 @@
 # Transponder 93
 [CHANNEL]
DELIVERY_SYSTEM = DVBS
-   FREQUENCY = 11508500
-   POLARIZATION = VERTICAL
+   FREQUENCY = 11523500
+   POLARIZATION = HORIZONTAL
SYMBOL_RATE = 2200
INNER_FEC = 5/6
MODULATION = QPSK
@@ -678,6 +689,16 @@
MODULATION = PSK/8
INVERSION = AUTO
 
+# Transponder 102
+[CHANNEL]
+   DELIVERY_SYSTEM = DVBS
+   FREQUENCY = 11656000
+   POLARIZATION = VERTICAL
+   SYMBOL_RATE = 2200
+   INNER_FEC = 5/6
+   MODULATION = QPSK
+   INVERSION = AUTO
+
 # Transponder 103
 [CHANNEL]
DELIVERY_SYSTEM = DVBS
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [media] tw686x: avoid going past array

2016-04-26 Thread Mauro Carvalho Chehab
Fix those two warnings:
drivers/media/pci/tw686x/tw686x-video.c:69 tw686x_fields_map() error: 
buffer overflow 'std_525_60' 31 <= 31
drivers/media/pci/tw686x/tw686x-video.c:73 tw686x_fields_map() error: 
buffer overflow 'std_625_50' 26 <= 26

I had those changes at the last version of my patch, but I ended
by merging the previous version by mistake.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/pci/tw686x/tw686x-video.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/tw686x/tw686x-video.c 
b/drivers/media/pci/tw686x/tw686x-video.c
index d2a0147e6492..253e10823ba3 100644
--- a/drivers/media/pci/tw686x/tw686x-video.c
+++ b/drivers/media/pci/tw686x/tw686x-video.c
@@ -64,11 +64,11 @@ static unsigned int tw686x_fields_map(v4l2_std_id std, 
unsigned int fps)
unsigned int i;
 
if (std & V4L2_STD_525_60) {
-   if (fps > ARRAY_SIZE(std_525_60))
+   if (fps >= ARRAY_SIZE(std_525_60))
fps = 30;
i = std_525_60[fps];
} else {
-   if (fps > ARRAY_SIZE(std_625_50))
+   if (fps >= ARRAY_SIZE(std_625_50))
fps = 25;
i = std_625_50[fps];
}
-- 
2.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v9 1/8] dt-bindings: Add a binding for Mediatek Video Processor

2016-04-26 Thread Tiffany Lin
From: Andrew-CT Chen 

Add a DT binding documentation of Video Processor Unit for the
MT8173 SoC from Mediatek.

Signed-off-by: Andrew-CT Chen 
Signed-off-by: Tiffany Lin 
Acked-by: Rob Herring 

---
 .../devicetree/bindings/media/mediatek-vpu.txt |   31 
 1 file changed, 31 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/mediatek-vpu.txt

diff --git a/Documentation/devicetree/bindings/media/mediatek-vpu.txt 
b/Documentation/devicetree/bindings/media/mediatek-vpu.txt
new file mode 100644
index 000..2a5bac3
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/mediatek-vpu.txt
@@ -0,0 +1,31 @@
+* Mediatek Video Processor Unit
+
+Video Processor Unit is a HW video controller. It controls HW Codec including
+H.264/VP8/VP9 Decode, H.264/VP8 Encode and Image Processor (scale/rotate/color 
convert).
+
+Required properties:
+  - compatible: "mediatek,mt8173-vpu"
+  - reg: Must contain an entry for each entry in reg-names.
+  - reg-names: Must include the following entries:
+"tcm": tcm base
+"cfg_reg": Main configuration registers base
+  - interrupts: interrupt number to the cpu.
+  - clocks : clock name from clock manager
+  - clock-names: must be main. It is the main clock of VPU
+
+Optional properties:
+  - memory-region: phandle to a node describing memory (see
+Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt)
+to be used for VPU extended memory; if not present, VPU may be located
+anywhere in the memory
+
+Example:
+   vpu: vpu@1002 {
+   compatible = "mediatek,mt8173-vpu";
+   reg = <0 0x1002 0 0x3>,
+ <0 0x1005 0 0x100>;
+   reg-names = "tcm", "cfg_reg";
+   interrupts = ;
+   clocks = < TOP_SCP_SEL>;
+   clock-names = "main";
+   };
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v9 3/8] arm64: dts: mediatek: Add node for Mediatek Video Processor Unit

2016-04-26 Thread Tiffany Lin
From: Andrew-CT Chen 

Add VPU drivers for MT8173

Signed-off-by: Andrew-CT Chen 
Signed-off-by: Tiffany Lin 

---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi |   23 +++
 1 file changed, 23 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi 
b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index eab7efc..ae147bb 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -125,6 +125,18 @@
clock-output-names = "cpum_ck";
};
 
+   reserved-memory {
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+   vpu_dma_reserved: vpu_dma_mem_region {
+   compatible = "shared-dma-pool";
+   reg = <0 0xb700 0 0x50>;
+   alignment = <0x1000>;
+   no-map;
+   };
+   };
+
timer {
compatible = "arm,armv8-timer";
interrupt-parent = <>;
@@ -269,6 +281,17 @@
clock-names = "spi", "wrap";
};
 
+   vpu: vpu@1002 {
+   compatible = "mediatek,mt8173-vpu";
+   reg = <0 0x1002 0 0x3>,
+ <0 0x1005 0 0x100>;
+   reg-names = "tcm", "cfg_reg";
+   interrupts = ;
+   clocks = < CLK_TOP_SCP_SEL>;
+   clock-names = "main";
+   memory-region = <_dma_reserved>;
+   };
+
sysirq: intpol-controller@10200620 {
compatible = "mediatek,mt8173-sysirq",
 "mediatek,mt6577-sysirq";
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v9 4/8] dt-bindings: Add a binding for Mediatek Video Encoder

2016-04-26 Thread Tiffany Lin
Add a DT binding documentation of Video Encoder for the
MT8173 SoC from Mediatek.

Signed-off-by: Tiffany Lin 
Acked-by: Rob Herring 

---
 .../devicetree/bindings/media/mediatek-vcodec.txt  |   59 
 1 file changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/mediatek-vcodec.txt

diff --git a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt 
b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
new file mode 100644
index 000..59a47a5
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
@@ -0,0 +1,59 @@
+Mediatek Video Codec
+
+Mediatek Video Codec is the video codec hw present in Mediatek SoCs which
+supports high resolution encoding functionalities.
+
+Required properties:
+- compatible : "mediatek,mt8173-vcodec-enc" for encoder
+- reg : Physical base address of the video codec registers and length of
+  memory mapped region.
+- interrupts : interrupt number to the cpu.
+- mediatek,larb : must contain the local arbiters in the current Socs.
+- clocks : list of clock specifiers, corresponding to entries in
+  the clock-names property.
+- clock-names: encoder must contain "venc_sel_src", "venc_sel",
+- "venc_lt_sel_src", "venc_lt_sel".
+- iommus : should point to the respective IOMMU block with master port as
+  argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.txt
+  for details.
+- mediatek,vpu : the node of video processor unit
+
+Example:
+vcodec_enc: vcodec@0x18002000 {
+compatible = "mediatek,mt8173-vcodec-enc";
+reg = <0 0x18002000 0 0x1000>,/*VENC_SYS*/
+  <0 0x19002000 0 0x1000>;/*VENC_LT_SYS*/
+interrupts = ,
+;
+mediatek,larb = <>,
+   <>;
+iommus = < M4U_PORT_VENC_RCPU>,
+ < M4U_PORT_VENC_REC>,
+ < M4U_PORT_VENC_BSDMA>,
+ < M4U_PORT_VENC_SV_COMV>,
+ < M4U_PORT_VENC_RD_COMV>,
+ < M4U_PORT_VENC_CUR_LUMA>,
+ < M4U_PORT_VENC_CUR_CHROMA>,
+ < M4U_PORT_VENC_REF_LUMA>,
+ < M4U_PORT_VENC_REF_CHROMA>,
+ < M4U_PORT_VENC_NBM_RDMA>,
+ < M4U_PORT_VENC_NBM_WDMA>,
+ < M4U_PORT_VENC_RCPU_SET2>,
+ < M4U_PORT_VENC_REC_FRM_SET2>,
+ < M4U_PORT_VENC_BSDMA_SET2>,
+ < M4U_PORT_VENC_SV_COMA_SET2>,
+ < M4U_PORT_VENC_RD_COMA_SET2>,
+ < M4U_PORT_VENC_CUR_LUMA_SET2>,
+ < M4U_PORT_VENC_CUR_CHROMA_SET2>,
+ < M4U_PORT_VENC_REF_LUMA_SET2>,
+ < M4U_PORT_VENC_REC_CHROMA_SET2>;
+mediatek,vpu = <>;
+clocks = < CLK_TOP_VENCPLL_D2>,
+ < CLK_TOP_VENC_SEL>,
+ < CLK_TOP_UNIVPLL1_D2>,
+ < CLK_TOP_VENC_LT_SEL>;
+clock-names = "venc_sel_src",
+  "venc_sel",
+  "venc_lt_sel_src",
+  "venc_lt_sel";
+  };
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v9 7/8] [media] vcodec: mediatek: Add Mediatek H264 Video Encoder Driver

2016-04-26 Thread Tiffany Lin
Add h264 encoder driver for MT8173

Signed-off-by: PoChun Lin 
Signed-off-by: Tiffany Lin 

---
 drivers/media/platform/mtk-vcodec/Makefile |1 +
 .../media/platform/mtk-vcodec/venc/venc_h264_if.c  |  677 
 drivers/media/platform/mtk-vcodec/venc_drv_if.c|4 +-
 3 files changed, 681 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c

diff --git a/drivers/media/platform/mtk-vcodec/Makefile 
b/drivers/media/platform/mtk-vcodec/Makefile
index bf73a45..dc5cb00 100644
--- a/drivers/media/platform/mtk-vcodec/Makefile
+++ b/drivers/media/platform/mtk-vcodec/Makefile
@@ -12,6 +12,7 @@ mtk-vcodec-enc-y := venc/venc_vp8_if.o \
venc_drv_if.o \
venc_vpu_if.o \
 
+
 mtk-vcodec-common-y := mtk_vcodec_intr.o \
mtk_vcodec_util.o\
 
diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c 
b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
new file mode 100644
index 000..4b40cc1
--- /dev/null
+++ b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
@@ -0,0 +1,677 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ * Author: Jungchang Tsao 
+ * Daniel Hsiao 
+ * PoChun Lin 
+ *
+ * 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 "../mtk_vcodec_drv.h"
+#include "../mtk_vcodec_util.h"
+#include "../mtk_vcodec_intr.h"
+#include "../mtk_vcodec_enc.h"
+#include "../mtk_vcodec_enc_pm.h"
+#include "../venc_drv_base.h"
+#include "../venc_ipi_msg.h"
+#include "../venc_vpu_if.h"
+#include "mtk_vpu.h"
+
+static const char h264_filler_marker[] = {0x0, 0x0, 0x0, 0x1, 0xc};
+
+#define H264_FILLER_MARKER_SIZE ARRAY_SIZE(h264_filler_marker)
+#define VENC_PIC_BITSTREAM_BYTE_CNT 0x0098
+
+/**
+ * enum venc_h264_vpu_work_buf - h264 encoder buffer index
+ */
+enum venc_h264_vpu_work_buf {
+   VENC_H264_VPU_WORK_BUF_RC_INFO,
+   VENC_H264_VPU_WORK_BUF_RC_CODE,
+   VENC_H264_VPU_WORK_BUF_REC_LUMA,
+   VENC_H264_VPU_WORK_BUF_REC_CHROMA,
+   VENC_H264_VPU_WORK_BUF_REF_LUMA,
+   VENC_H264_VPU_WORK_BUF_REF_CHROMA,
+   VENC_H264_VPU_WORK_BUF_MV_INFO_1,
+   VENC_H264_VPU_WORK_BUF_MV_INFO_2,
+   VENC_H264_VPU_WORK_BUF_SKIP_FRAME,
+   VENC_H264_VPU_WORK_BUF_MAX,
+};
+
+/**
+ * enum venc_h264_bs_mode - for bs_mode argument in h264_enc_vpu_encode
+ */
+enum venc_h264_bs_mode {
+   H264_BS_MODE_SPS,
+   H264_BS_MODE_PPS,
+   H264_BS_MODE_FRAME,
+};
+
+/*
+ * struct venc_h264_vpu_config - Structure for h264 encoder configuration
+ * @input_fourcc: input fourcc
+ * @bitrate: target bitrate (in bps)
+ * @pic_w: picture width. Picture size is visible stream resolution, in pixels,
+ * to be used for display purposes; must be smaller or equal to buffer
+ * size.
+ * @pic_h: picture height
+ * @buf_w: buffer width. Buffer size is stream resolution in pixels aligned to
+ * hardware requirements.
+ * @buf_h: buffer height
+ * @gop_size: group of picture size (idr frame)
+ * @intra_period: intra frame period
+ * @framerate: frame rate in fps
+ * @profile: as specified in standard
+ * @level: as specified in standard
+ * @wfd: WFD mode 1:on, 0:off
+ */
+struct venc_h264_vpu_config {
+   u32 input_fourcc;
+   u32 bitrate;
+   u32 pic_w;
+   u32 pic_h;
+   u32 buf_w;
+   u32 buf_h;
+   u32 gop_size;
+   u32 intra_period;
+   u32 framerate;
+   u32 profile;
+   u32 level;
+   u32 wfd;
+};
+
+/*
+ * struct venc_h264_vpu_buf - Structure for buffer information
+ * @align: buffer alignment (in bytes)
+ * @iova: IO virtual address
+ * @vpua: VPU side memory addr which is used by RC_CODE
+ * @size: buffer size (in bytes)
+ */
+struct venc_h264_vpu_buf {
+   u32 align;
+   u32 iova;
+   u32 vpua;
+   u32 size;
+};
+
+/*
+ * struct venc_h264_vsi - Structure for VPU driver control and info share
+ * This structure is allocated in VPU side and shared to AP side.
+ * @config: h264 encoder configuration
+ * @work_bufs: working buffer information in VPU side
+ * The work_bufs here is for storing the 'size' info shared to AP side.
+ * The similar item in struct venc_h264_inst is for memory allocation
+ * in AP side. The AP driver will copy the 'size' from here to the one in
+ * struct mtk_vcodec_mem, then invoke mtk_vcodec_mem_alloc to allocate
+ * the buffer. After that, bypass the 'dma_addr' to the 'iova' 

[PATCH] [media] exynos-gsc: avoid build warning without CONFIG_OF

2016-04-26 Thread Arnd Bergmann
When building the exynos-gsc driver with CONFIG_OF disabled, we get
a warning about an out-of-bounds access:

drivers/media/platform/exynos-gsc/gsc-core.c: In function 'gsc_probe':
drivers/media/platform/exynos-gsc/gsc-core.c:1078:34: error: array subscript is 
above array bounds [-Werror=array-bounds]

This is harmless because the driver will never be used without CONFIG_OF,
but it's better to avoid the warning anyway. Checking the return value
of of_alias_get_id() for an error condition is probably a good idea
anyway, and it makes sure the compiler can verify that we don't get
into that situation.

Signed-off-by: Arnd Bergmann 
Fixes: 26a7ed9c1819 ("[media] exynos-gsc: remove an always false condition")
---
 drivers/media/platform/exynos-gsc/gsc-core.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c 
b/drivers/media/platform/exynos-gsc/gsc-core.c
index c595723f5031..c04973669a47 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1063,13 +1063,17 @@ static int gsc_probe(struct platform_device *pdev)
struct resource *res;
struct gsc_driverdata *drv_data = gsc_get_drv_data(pdev);
struct device *dev = >dev;
-   int ret = 0;
+   int ret;
 
gsc = devm_kzalloc(dev, sizeof(struct gsc_dev), GFP_KERNEL);
if (!gsc)
return -ENOMEM;
 
-   gsc->id = of_alias_get_id(pdev->dev.of_node, "gsc");
+   ret = of_alias_get_id(pdev->dev.of_node, "gsc");
+   if (ret < 0)
+   return ret;
+
+   gsc->id = ret;
if (gsc->id >= drv_data->num_entities) {
dev_err(dev, "Invalid platform device id: %d\n", gsc->id);
return -EINVAL;
-- 
2.7.0

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v9 2/8] [media] VPU: mediatek: support Mediatek VPU

2016-04-26 Thread Tiffany Lin
From: Andrew-CT Chen 

The VPU driver for hw video codec embedded in Mediatek's MT8173 SOCs.
It is able to handle video decoding/encoding of in a range of formats.
The driver provides with VPU firmware download, memory management and
the communication interface between CPU and VPU.
For VPU initialization, it will create virtual memory for CPU access and
IOMMU address for vcodec hw device access. When a decode/encode instance
opens a device node, vpu driver will download vpu firmware to the device.
A decode/encode instant will decode/encode a frame using VPU
interface to interrupt vpu to handle decoding/encoding jobs.

Signed-off-by: Andrew-CT Chen 
Signed-off-by: Tiffany Lin 

---
 drivers/media/platform/Kconfig   |   13 +
 drivers/media/platform/Makefile  |2 +
 drivers/media/platform/mtk-vpu/Makefile  |3 +
 drivers/media/platform/mtk-vpu/mtk_vpu.c |  942 ++
 drivers/media/platform/mtk-vpu/mtk_vpu.h |  162 +
 5 files changed, 1122 insertions(+)
 create mode 100644 drivers/media/platform/mtk-vpu/Makefile
 create mode 100755 drivers/media/platform/mtk-vpu/mtk_vpu.c
 create mode 100644 drivers/media/platform/mtk-vpu/mtk_vpu.h

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 84e041c..74c3575 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -152,6 +152,19 @@ config VIDEO_CODA
   Coda is a range of video codec IPs that supports
   H.264, MPEG-4, and other video formats.
 
+config VIDEO_MEDIATEK_VPU
+   tristate "Mediatek Video Processor Unit"
+   depends on VIDEO_DEV && VIDEO_V4L2
+   depends on ARCH_MEDIATEK || COMPILE_TEST
+   ---help---
+   This driver provides downloading VPU firmware and
+   communicating with VPU. This driver for hw video
+   codec embedded in Mediatek's MT8173 SOCs. It is able
+   to handle video decoding/encoding in a range of formats.
+
+   To compile this driver as a module, choose M here: the
+   module will be called mtk-vpu.
+
 config VIDEO_MEM2MEM_DEINTERLACE
tristate "Deinterlace support"
depends on VIDEO_DEV && VIDEO_V4L2 && DMA_ENGINE
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index bbb7bd1..2efb7b1 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -56,3 +56,5 @@ obj-$(CONFIG_VIDEO_AM437X_VPFE)   += am437x/
 obj-$(CONFIG_VIDEO_XILINX) += xilinx/
 
 ccflags-y += -I$(srctree)/drivers/media/i2c
+
+obj-$(CONFIG_VIDEO_MEDIATEK_VPU)   += mtk-vpu/
diff --git a/drivers/media/platform/mtk-vpu/Makefile 
b/drivers/media/platform/mtk-vpu/Makefile
new file mode 100644
index 000..58cc1b4
--- /dev/null
+++ b/drivers/media/platform/mtk-vpu/Makefile
@@ -0,0 +1,3 @@
+mtk-vpu-y += mtk_vpu.o
+
+obj-$(CONFIG_VIDEO_MEDIATEK_VPU) += mtk-vpu.o
diff --git a/drivers/media/platform/mtk-vpu/mtk_vpu.c 
b/drivers/media/platform/mtk-vpu/mtk_vpu.c
new file mode 100755
index 000..be87205
--- /dev/null
+++ b/drivers/media/platform/mtk-vpu/mtk_vpu.c
@@ -0,0 +1,942 @@
+/*
+* Copyright (c) 2016 MediaTek Inc.
+* Author: Andrew-CT Chen 
+*
+* 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "mtk_vpu.h"
+
+/**
+ * VPU (video processor unit) is a tiny processor controlling video hardware
+ * related to video codec, scaling and color format converting.
+ * VPU interfaces with other blocks by share memory and interrupt.
+ **/
+
+#define INIT_TIMEOUT_MS2000U
+#define IPI_TIMEOUT_MS 2000U
+#define VPU_FW_VER_LEN 16
+
+/* maximum program/data TCM (Tightly-Coupled Memory) size */
+#define VPU_PTCM_SIZE  (96 * SZ_1K)
+#define VPU_DTCM_SIZE  (32 * SZ_1K)
+/* the offset to get data tcm address */
+#define VPU_DTCM_OFFSET0x18000UL
+/* daynamic allocated maximum extended memory size */
+#define VPU_EXT_P_SIZE SZ_1M
+#define VPU_EXT_D_SIZE SZ_4M
+/* maximum binary firmware size */
+#define VPU_P_FW_SIZE  (VPU_PTCM_SIZE + VPU_EXT_P_SIZE)
+#define VPU_D_FW_SIZE  (VPU_DTCM_SIZE + VPU_EXT_D_SIZE)
+/* the size of share buffer between Host and  VPU */
+#define SHARE_BUF_SIZE 48
+
+/* binary firmware name */
+#define VPU_P_FW   "vpu_p.bin"
+#define 

[PATCH v9 8/8] arm64: dts: mediatek: Add Video Encoder for MT8173

2016-04-26 Thread Tiffany Lin
Add video encoder node for MT8173

Signed-off-by: Tiffany Lin 

---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi |   39 ++
 1 file changed, 39 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi 
b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index ae147bb..348ce0e 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -717,6 +717,45 @@
clock-names = "apb", "smi";
};
 
+   vcodec_enc: vcodec@18002000 {
+   compatible = "mediatek,mt8173-vcodec-enc";
+   reg = <0 0x18002000 0 0x1000>,  /* VENC_SYS */
+ <0 0x19002000 0 0x1000>;  /* VENC_LT_SYS */
+   interrupts = ,
+;
+   mediatek,larb = <>,
+   <>;
+   iommus = < M4U_PORT_VENC_RCPU>,
+< M4U_PORT_VENC_REC>,
+< M4U_PORT_VENC_BSDMA>,
+< M4U_PORT_VENC_SV_COMV>,
+< M4U_PORT_VENC_RD_COMV>,
+< M4U_PORT_VENC_CUR_LUMA>,
+< M4U_PORT_VENC_CUR_CHROMA>,
+< M4U_PORT_VENC_REF_LUMA>,
+< M4U_PORT_VENC_REF_CHROMA>,
+< M4U_PORT_VENC_NBM_RDMA>,
+< M4U_PORT_VENC_NBM_WDMA>,
+< M4U_PORT_VENC_RCPU_SET2>,
+< M4U_PORT_VENC_REC_FRM_SET2>,
+< M4U_PORT_VENC_BSDMA_SET2>,
+< M4U_PORT_VENC_SV_COMA_SET2>,
+< M4U_PORT_VENC_RD_COMA_SET2>,
+< M4U_PORT_VENC_CUR_LUMA_SET2>,
+< M4U_PORT_VENC_CUR_CHROMA_SET2>,
+< M4U_PORT_VENC_REF_LUMA_SET2>,
+< M4U_PORT_VENC_REC_CHROMA_SET2>;
+   mediatek,vpu = <>;
+   clocks = < CLK_TOP_VENCPLL_D2>,
+< CLK_TOP_VENC_SEL>,
+< CLK_TOP_UNIVPLL1_D2>,
+< CLK_TOP_VENC_LT_SEL>;
+   clock-names = "venc_sel_src",
+ "venc_sel",
+ "venc_lt_sel_src",
+ "venc_lt_sel";
+   };
+
vencltsys: clock-controller@1900 {
compatible = "mediatek,mt8173-vencltsys", "syscon";
reg = <0 0x1900 0 0x1000>;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v9 0/8] Add MT8173 Video Encoder Driver and VPU Driver

2016-04-26 Thread Tiffany Lin
==
 Introduction
==

The purpose of this series is to add the driver for video codec hw embedded in 
the Mediatek's MT8173 SoCs.
Mediatek Video Codec is able to handle video encoding of in a range of formats.

This patch series also include VPU driver. Mediatek Video Codec driver rely on 
VPU driver to load,
communicate with VPU.

Internally the driver uses videobuf2 framework and MTK IOMMU and MTK SMI both 
have been merged in v4.6-rc1.

==
 Device interface
==

In principle the driver bases on v4l2 memory-to-memory framework:
it provides a single video node and each opened file handle gets its own 
private context with separate
buffer queues. Each context consist of 2 buffer queues: OUTPUT (for source 
buffers, i.e. raw video
frames) and CAPTURE (for destination buffers, i.e. encoded video frames).

==
 VPU (Video Processor Unit)
==
The VPU driver for hw video codec embedded in Mediatek's MT8173 SOCs.
It is able to handle video decoding/encoding in a range of formats.
The driver provides with VPU firmware download, memory management and the 
communication interface between CPU and VPU.
For VPU initialization, it will create virtual memory for CPU access and 
physical address for VPU hw device access. 
When a decode/encode instance opens a device node, vpu driver will download vpu 
firmware to the device.
A decode/encode instant will decode/encode a frame using VPU interface to 
interrupt vpu to handle decoding/encoding jobs.

Please have a look at the code and comments will be very much appreciated.

Change in v9:
1. Rename idx in mtk_vcodec_ctx to id and curr_max_idx in mtk_vcodec_dev to 
id_counter.
2. Refine fops_vcodec_open

VPU part
Merge Julia Lawall's fixes[1][2] to "[PATCH v9 2/8] [media] VPU: mediatek: 
support Mediatek VPU"
[1][PATCH] VPU: mediatek: fix simple_open.cocci warnings 
[2][PATCH] VPU: mediatek: fix platform_no_drv_owner.cocci warnings

Change in v8:
1. Refine indentation
2. Refine colorspace information process vidioc_try_fmt_vid_out_mplane
3. Remove instance_mask in mtk_vcodec_dev, use curr_max_idx for instance index
4. Use kzalloc to allocate ctx
5. Refine fops_vcodec_open

VPU Part
1. Refine vpu_load_firmware

Change in v7:
1. Rebase against the master branch of git://linuxtv.org/media_tree.git
2. Add ycbcr_enc, quantization and xfer_func in try_fmt, g_fmt, s_fmt
3. Merge h264_enc and vp8_enc to venc directory

Change in v6:
1. Add synchronization access protect between irq handler and work thread
2. Add DMA_ATTR_ALLOC_SINGLE_PAGES support
3. S_FMT will return coded_width, coded_height, so user space could allocate 
correct size memory that HW required
4. merge h264/vp8 enc ap and md32 ipi msg
5. separate h264/vp8 enc gop_size and intra_period handle
6. remove sizeimage relative code in work buffer function
7. Refine makefile to build as an module
8. Code clean up

VPU Part
1. export symbols for building VPU as an module
2. change function from "wait_event_interruptible_timeout" to 
"wait_event_timeout" since
   CPU needs to wait for ACK from VPU even if it was interrupted by a signal

v4l2-compliance test output:
localhost Encode # ./v4l2-compliance -d /dev/video1
Driver Info:
Driver name   : mtk-vcodec-enc
Card type : platform:mt8173
Bus info  : platform:mt8173
Driver version: 4.4.0
Capabilities  : 0x84204000
Video Memory-to-Memory Multiplanar
Streaming
Extended Pix Format
Device Capabilities
Device Caps   : 0x04204000
Video Memory-to-Memory Multiplanar
Streaming
Extended Pix Format

Compliance test for device /dev/video1 (not using libv4l2):

Required ioctls:
test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
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: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
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 

[PATCH v9 5/8] [media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2016-04-26 Thread Tiffany Lin
Add v4l2 layer encoder driver for MT8173

Signed-off-by: Tiffany Lin 

---
 drivers/media/platform/Kconfig |   16 +
 drivers/media/platform/Makefile|2 +
 drivers/media/platform/mtk-vcodec/Makefile |   14 +
 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  338 +
 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 1301 
 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h |   58 +
 .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |  453 +++
 .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c  |  137 +++
 .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.h  |   26 +
 .../media/platform/mtk-vcodec/mtk_vcodec_intr.c|   55 +
 .../media/platform/mtk-vcodec/mtk_vcodec_intr.h|   27 +
 .../media/platform/mtk-vcodec/mtk_vcodec_util.c|   94 ++
 .../media/platform/mtk-vcodec/mtk_vcodec_util.h|   87 ++
 drivers/media/platform/mtk-vcodec/venc_drv_base.h  |   62 +
 drivers/media/platform/mtk-vcodec/venc_drv_if.c|  106 ++
 drivers/media/platform/mtk-vcodec/venc_drv_if.h|  163 +++
 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h   |  210 
 17 files changed, 3149 insertions(+)
 create mode 100644 drivers/media/platform/mtk-vcodec/Makefile
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.h
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_base.h
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.c
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.h
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 74c3575..13b765a 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -165,6 +165,22 @@ config VIDEO_MEDIATEK_VPU
To compile this driver as a module, choose M here: the
module will be called mtk-vpu.
 
+config VIDEO_MEDIATEK_VCODEC
+   tristate "Mediatek Video Codec driver"
+   depends on VIDEO_DEV && VIDEO_V4L2
+   depends on ARCH_MEDIATEK || COMPILE_TEST
+   select VIDEOBUF2_DMA_CONTIG
+   select V4L2_MEM2MEM_DEV
+   select VIDEO_MEDIATEK_VPU
+   default n
+   ---help---
+   Mediatek video codec driver provides HW capability to
+   encode and decode in a range of video formats
+   This driver rely on VPU driver to communicate with VPU.
+
+   To compile this driver as a module, choose M here: the
+   module will be called mtk-vcodec
+
 config VIDEO_MEM2MEM_DEINTERLACE
tristate "Deinterlace support"
depends on VIDEO_DEV && VIDEO_V4L2 && DMA_ENGINE
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index 2efb7b1..6e735fe 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -58,3 +58,5 @@ obj-$(CONFIG_VIDEO_XILINX)+= xilinx/
 ccflags-y += -I$(srctree)/drivers/media/i2c
 
 obj-$(CONFIG_VIDEO_MEDIATEK_VPU)   += mtk-vpu/
+
+obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC)+= mtk-vcodec/
diff --git a/drivers/media/platform/mtk-vcodec/Makefile 
b/drivers/media/platform/mtk-vcodec/Makefile
new file mode 100644
index 000..d04433be
--- /dev/null
+++ b/drivers/media/platform/mtk-vcodec/Makefile
@@ -0,0 +1,14 @@
+
+obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-enc.o mtk-vcodec-common.o
+
+
+
+mtk-vcodec-enc-y := mtk_vcodec_enc.o \
+   mtk_vcodec_enc_drv.o \
+   mtk_vcodec_enc_pm.o \
+   venc_drv_if.o \
+
+mtk-vcodec-common-y := mtk_vcodec_intr.o \
+   mtk_vcodec_util.o\
+
+ccflags-y += -I$(srctree)/drivers/media/platform/mtk-vpu
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h 
b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
new file mode 100644
index 000..78eee50
--- /dev/null
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
@@ -0,0 +1,338 @@
+/*
+* Copyright (c) 2016 MediaTek Inc.
+* Author: PC Chen 
+* Tiffany Lin 
+*
+* 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 

[PATCH v9 6/8] [media] vcodec: mediatek: Add Mediatek VP8 Video Encoder Driver

2016-04-26 Thread Tiffany Lin
Add vp8 encoder driver for MT8173

Signed-off-by: PoChun Lin 
Signed-off-by: Tiffany Lin 

---
 drivers/media/platform/mtk-vcodec/Makefile |6 +-
 .../media/platform/mtk-vcodec/venc/venc_vp8_if.c   |  479 
 drivers/media/platform/mtk-vcodec/venc_drv_if.c|7 +-
 drivers/media/platform/mtk-vcodec/venc_vpu_if.c|  237 ++
 drivers/media/platform/mtk-vcodec/venc_vpu_if.h|   61 +++
 5 files changed, 788 insertions(+), 2 deletions(-)
 create mode 100644 drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_vpu_if.c
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_vpu_if.h

diff --git a/drivers/media/platform/mtk-vcodec/Makefile 
b/drivers/media/platform/mtk-vcodec/Makefile
index d04433be..bf73a45 100644
--- a/drivers/media/platform/mtk-vcodec/Makefile
+++ b/drivers/media/platform/mtk-vcodec/Makefile
@@ -1,12 +1,16 @@
 
+
 obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-enc.o mtk-vcodec-common.o
 
 
 
-mtk-vcodec-enc-y := mtk_vcodec_enc.o \
+mtk-vcodec-enc-y := venc/venc_vp8_if.o \
+   venc/venc_h264_if.o \
+   mtk_vcodec_enc.o \
mtk_vcodec_enc_drv.o \
mtk_vcodec_enc_pm.o \
venc_drv_if.o \
+   venc_vpu_if.o \
 
 mtk-vcodec-common-y := mtk_vcodec_intr.o \
mtk_vcodec_util.o\
diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c 
b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
new file mode 100644
index 000..13e9d80
--- /dev/null
+++ b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
@@ -0,0 +1,479 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ * Author: Daniel Hsiao 
+ * PoChun Lin 
+ *
+ * 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 "../mtk_vcodec_drv.h"
+#include "../mtk_vcodec_util.h"
+#include "../mtk_vcodec_intr.h"
+#include "../mtk_vcodec_enc.h"
+#include "../mtk_vcodec_enc_pm.h"
+#include "../venc_drv_base.h"
+#include "../venc_ipi_msg.h"
+#include "../venc_vpu_if.h"
+#include "mtk_vpu.h"
+
+#define VENC_BITSTREAM_FRAME_SIZE 0x0098
+#define VENC_BITSTREAM_HEADER_LEN 0x00e8
+
+/* This ac_tag is vp8 frame tag. */
+#define MAX_AC_TAG_SIZE 10
+
+/**
+ * enum venc_vp8_vpu_work_buf - vp8 encoder buffer index
+ */
+enum venc_vp8_vpu_work_buf {
+   VENC_VP8_VPU_WORK_BUF_LUMA,
+   VENC_VP8_VPU_WORK_BUF_LUMA2,
+   VENC_VP8_VPU_WORK_BUF_LUMA3,
+   VENC_VP8_VPU_WORK_BUF_CHROMA,
+   VENC_VP8_VPU_WORK_BUF_CHROMA2,
+   VENC_VP8_VPU_WORK_BUF_CHROMA3,
+   VENC_VP8_VPU_WORK_BUF_MV_INFO,
+   VENC_VP8_VPU_WORK_BUF_BS_HEADER,
+   VENC_VP8_VPU_WORK_BUF_PROB_BUF,
+   VENC_VP8_VPU_WORK_BUF_RC_INFO,
+   VENC_VP8_VPU_WORK_BUF_RC_CODE,
+   VENC_VP8_VPU_WORK_BUF_RC_CODE2,
+   VENC_VP8_VPU_WORK_BUF_RC_CODE3,
+   VENC_VP8_VPU_WORK_BUF_MAX,
+};
+
+/*
+ * struct venc_vp8_vpu_config - Structure for vp8 encoder configuration
+ * @input_fourcc: input fourcc
+ * @bitrate: target bitrate (in bps)
+ * @pic_w: picture width. Picture size is visible stream resolution, in pixels,
+ * to be used for display purposes; must be smaller or equal to buffer
+ * size.
+ * @pic_h: picture height
+ * @buf_w: buffer width (with 16 alignment). Buffer size is stream resolution
+ * in pixels aligned to hardware requirements.
+ * @buf_h: buffer height (with 16 alignment)
+ * @gop_size: group of picture size (key frame)
+ * @framerate: frame rate in fps
+ * @ts_mode: temporal scalability mode (0: disable, 1: enable)
+ *  support three temporal layers - 0: 7.5fps 1: 7.5fps 2: 15fps.
+ */
+struct venc_vp8_vpu_config {
+   u32 input_fourcc;
+   u32 bitrate;
+   u32 pic_w;
+   u32 pic_h;
+   u32 buf_w;
+   u32 buf_h;
+   u32 gop_size;
+   u32 framerate;
+   u32 ts_mode;
+};
+
+/*
+ * struct venc_vp8_vpu_buf -Structure for buffer information
+ * @align: buffer alignment (in bytes)
+ * @iova: IO virtual address
+ * @vpua: VPU side memory addr which is used by RC_CODE
+ * @size: buffer size (in bytes)
+ */
+struct venc_vp8_vpu_buf {
+   u32 align;
+   u32 iova;
+   u32 vpua;
+   u32 size;
+};
+
+/*
+ * struct venc_vp8_vsi - Structure for VPU driver control and info share
+ * This structure is allocated in VPU side and shared to AP side.
+ * @config: vp8 encoder configuration
+ * @work_bufs: working buffer information in VPU side
+ * The 

Re: [PATCH v8 5/8] [media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2016-04-26 Thread Hans Verkuil
On 04/26/2016 04:17 AM, tiffany lin wrote:
> Hi Hans,
> 
> On Mon, 2016-04-25 at 15:13 +0200, Hans Verkuil wrote:
>> On 04/25/2016 02:30 PM, Tiffany Lin wrote:
>>> Add v4l2 layer encoder driver for MT8173
>>>
>>> Signed-off-by: Tiffany Lin 
>>>
>>> ---
>>>  drivers/media/platform/Kconfig |   16 +
>>>  drivers/media/platform/Makefile|2 +
>>>  drivers/media/platform/mtk-vcodec/Makefile |   14 +
>>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  339 +
>>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 1303 
>>> 
>>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h |   58 +
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |  456 +++
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c  |  137 ++
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.h  |   26 +
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_intr.c|   56 +
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_intr.h|   27 +
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_util.c|   96 ++
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_util.h|   87 ++
>>>  drivers/media/platform/mtk-vcodec/venc_drv_base.h  |   62 +
>>>  drivers/media/platform/mtk-vcodec/venc_drv_if.c|  107 ++
>>>  drivers/media/platform/mtk-vcodec/venc_drv_if.h|  165 +++
>>>  drivers/media/platform/mtk-vcodec/venc_ipi_msg.h   |  210 
>>>  17 files changed, 3161 insertions(+)
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/Makefile
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_base.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h
>>>
>>
>> ...
>>
>>> +static int fops_vcodec_open(struct file *file)
>>> +{
>>> +   struct mtk_vcodec_dev *dev = video_drvdata(file);
>>> +   struct mtk_vcodec_ctx *ctx = NULL;
>>> +   int ret = 0;
>>> +
>>> +   mutex_lock(>dev_mutex);
>>
>> I would move this to after the kzalloc, since that doesn't need to be
>> called with the mutex held.
>>
> Will fix this in next version.
> 
>>> +
>>> +   ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
>>> +   if (!ctx) {
>>
>> And then you can just do return -ENOMEM here.
>>
> Got it.
>>> +   ret = -ENOMEM;
>>> +   goto err_alloc;
>>> +   }
>>> +
>>> +   ctx->idx = dev->curr_max_idx;
>>
>> I'd do:
>>
>>  /*
>>   * Use simple counter to uniquely identify this context. Only
>>   * used for logging.
>>   */
>>  ctx->idx = dev->curr_max_idx++;
>>
>> I would also prefer that it is call 'id' instead of idx, since that's really
>> what it is, just an ID.
>>
>> And the counter is then id_counter instead of curr_max_idx.
>>
> Got it, will fix this in next version.
> 
>>> +   v4l2_fh_init(>fh, video_devdata(file));
>>> +   file->private_data = >fh;
>>> +   v4l2_fh_add(>fh);
>>> +   INIT_LIST_HEAD(>list);
>>> +   ctx->dev = dev;
>>> +   init_waitqueue_head(>queue);
>>> +
>>> +   ctx->type = MTK_INST_ENCODER;
>>> +   ret = mtk_vcodec_enc_ctrls_setup(ctx);
>>> +   if (ret) {
>>> +   mtk_v4l2_err("Failed to setup controls() (%d)",
>>> +   ret);
>>> +   goto err_ctrls_setup;
>>> +   }
>>> +   ctx->m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev_enc, ctx,
>>> +   _vcodec_enc_queue_init);
>>> +   if (IS_ERR(ctx->m2m_ctx)) {
>>> +   ret = PTR_ERR(ctx->m2m_ctx);
>>> +   mtk_v4l2_err("Failed to v4l2_m2m_ctx_init() (%d)",
>>> +   ret);
>>> +   goto err_m2m_ctx_init;
>>> +   }
>>> +   mtk_vcodec_enc_set_default_params(ctx);
>>> +
>>> +   if (v4l2_fh_is_singular(>fh)) {
>>> +   /*
>>> +* vpu_load_firmware checks if it was loaded already and
>>> +* does nothing in that case
>>> +*/
>>> +   ret = vpu_load_firmware(dev->vpu_plat_dev);
>>> +   if (ret < 0) {
>>> +   /*
>>> +* Return 0 if downloading firmware successfully,
>>> +* otherwise it is failed
>>> +*/
>>> +   

Re: dvb-s2 card "TeVii S472" (cx23885)

2016-04-26 Thread Olli Salonen
Hi Hendrik, Hans,

My media_tree Hendrik is pulling from Github is just a rather recent
copy of the media_tree master branch on git.linuxtv.org (it's missing
like the last 10 patches that have been added within the last 24
hours) with 2 simple patches on top that should not break anything.

Also, the media_build is recent, since you just cloned it.

Hans, do you know if there are any known issues with the current
media_build/media_tree on certain kernels?

Thanks.

Cheers,
-olli

On 25 April 2016 at 19:14, Hendrik Oenings  wrote:
> Hi Olli,
>
> I've tested the driver, it compiles well and I've installed it on my
> system.
> But there's a problem: Everytime I try to load the driver (exact: the
> module cx23885), modprobe (or insmod) is giving me the following:
> # modprobe cx23885
> modprobe: ERROR: could not insert 'cx23885': Exec format error
>
> I've also tried to compile it with the current 4.6er kernel, but it
> stays the same.
> $ uname -r
> 4.6.0-rc5
>
> I've also tried to recompile the driver, but it didn't help.
>
> Maybe it is important to mention that some patches fail at the
> beginning of the build process (pr_fmt, debug).
>
> The installed module seems to be correct file format (my arch is
> x86_64):
> $ file \
>  /lib/modules/4.6.0-rc5/kernel/drivers/media/pci/cx23885/cx23885.ko
>
> /lib/modules/4.6.0-rc5/kernel/drivers/media/pci/cx23885/cx23885.ko: ELF
> 64-bit LSB relocatable, x86-64, version 1 (SYSV),
> BuildID[sha1]=07a3f2f2fe383ab691b0022568dcd4d8315dc4b8, not stripped
>
> Regards,
> Hendrik
>
> On Mo, 25 Apr 2016 11:56:37 +0300, Olli Salonen 
> wrote:
>
>> Hello Hendrik,
>>
>> I've created an initial version of the driver.
>> https://github.com/trsqr/media_tree/commit/b59f25b18bbe84e009618eefeaf646f5939bdd53
>>
>> To build, do the following:
>>
>> git clone git://linuxtv.org/media_build.git
>> git clone --depth=1 https://github.com/trsqr/media_tree.git -b
>> s472 ./media cd media_build
>> make dir DIR=../media
>> make distclean
>> make
>>
>> To install after a successful build:
>>
>> sudo make install
>>
>> Download also the following firmware and place it in /lib/firmware:
>> http://palosaari.fi/linux/v4l-dvb/firmware/M88DS3103/3.B/
>>
>> The thing is, I had to guess the following parameters in
>> drivers/media/pci/cx23885/cx23885-dvb.c file:
>>
>> +static const struct m88ds3103_config tevii_s472_m88ds3103_config = {
>> +   .i2c_addr = 0x68,
>> +   .clock = 2700,
>> +   .i2c_wr_max = 33,
>> +   .clock_out = 0,
>> +   .ts_mode = M88DS3103_TS_PARALLEL,
>> +   .ts_clk = 16000,
>> +   .ts_clk_pol = 0,
>> +   .lnb_en_pol = 0,
>> +   .lnb_hv_pol = 1,
>> +   .agc = 0x99,
>> +};
>>
>> If the driver does not work (it loads and appears to tune, but does
>> not find channels), try altering ts_clk_pol, lnb_en_pol and
>> lnb_hv_pol. The possible values are 1 and 0 so there should not be
>> that many iterations needed.. Current values are based on best guess.
>>
>> Cheers,
>> -olli
>>
>>
>>
>> On 24 April 2016 at 19:00, Hendrik Oenings  wrote:
>> > Hi Olli,
>> >
>> > I'm glad that there is someone trying to help me and of course I'm
>> > able to test a driver.
>> >
>> > Because of the attached photos, I think it is better not to send
>> > this mail to the mailing list.
>> >
>> > cx23885, m88ds3103 and m88ts2022 are the values I also think they're
>> > correct. cx23885 is also mentioned by lspci, the other values I've
>> > also seen often while searching for a solution.
>> >
>> > Here is also the full output of lspci concerning the tv card which
>> > is probably helpful.
>> > # lspci -vv
>> > [...]
>> > 03:00.0 Multimedia video controller: Conexant Systems, Inc. CX23885
>> > PCI Video and Audio Decoder (rev 04) Subsystem: Device d472:9022
>> > Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop-
>> > ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz- UDF-
>> > FastB2B- ParErr- DEVSEL=fast >TAbort- SERR-
>> > > > routed to IRQ 19 Region 0: Memory at f7c0 (64-bit,
>> > non-prefetchable) [size=2M] Capabilities: [40] Express (v1)
>> > Endpoint, MSI 00 DevCap: MaxPayload 128 bytes, PhantFunc 0,
>> > Latency L0s <64ns, L1 <1us ExtTag- AttnBtn- AttnInd- PwrInd- RBE-
>> > FLReset- DevCtl:Report errors: Correctable- Non-Fatal-
>> > Fatal- Unsupported- RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop+
>> > MaxPayload 128 bytes, MaxReadReq 512 bytes
>> > DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq-
>> > AuxPwr- TransPend- LnkCap:  Port #0, Speed 2.5GT/s, Width x1,
>> > ASPM L0s L1, Exit Latency L0s <2us, L1 <4us ClockPM- Surprise-
>> > LLActRep- BwNot- ASPMOptComp- LnkCtl:   ASPM Disabled; RCB 64
>> > bytes Disabled- CommClk+ ExtSynch- ClockPM- AutWidDis- BWInt-
>> > AutBWInt- LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train-
>> > SlotClk+ DLActive- BWMgmt- ABWMgmt- Capabilities: [80] Power
>> > Management version 2 Flags: PMEClk-