Re: [PATCH v4l-utils v7 4/7] mediactl: Add media_device creation helpers

2016-12-08 Thread Jacek Anaszewski

Hhi Sakari,

On 12/09/2016 12:05 AM, Sakari Ailus wrote:

Hi Jacek,

On Thu, Dec 08, 2016 at 11:04:20PM +0100, Jacek Anaszewski wrote:

Hi Sakari,

On 11/24/2016 01:17 PM, Sakari Ailus wrote:

Hi Jacek,

Thanks for the patchset.

On Wed, Oct 12, 2016 at 04:35:19PM +0200, Jacek Anaszewski wrote:

Add helper functions that allow for easy instantiation of media_device
object basing on whether the media device contains v4l2 subdev with
given file descriptor.


Doesn't this work with video nodes as well? That's what you seem to be using
it for later on. And I think that's actually more useful.

The existing implementation uses udev to look up devices. Could you use
libudev device enumeration API to find the media devices, and fall back to
sysfs if udev doesn't work? There seems to be a reasonable-looking example
here:

http://stackoverflow.com/questions/25361042/how-to-list-usb-mass-storage-devices-programatically-using-libudev-in-linux>


Actually I am calling media_get_devname_udev() at first and falling back
to sysfs similarly as it is accomplished in media_enum_entities().
Is there any specific reason for which I should use libudev device
enumeration API in media_device_new_by_subdev_fd()?


Yes. You rely on the API udev provides; the sysfs implementation is just a
fallback in case udev isn't available in the system. I guess it'd mostly
work but, for instance, you assume sysfs is found under /sys. The sysfs
itself isn't one of the most stable APIs either. Udev is a simply better
option when it's there.


Thanks for clarifying that. I'll check the libudev device enumeration
API then.

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


Re: uvcvideo logging kernel warnings on device disconnect

2016-12-08 Thread Greg KH
On Fri, Dec 09, 2016 at 01:09:21AM +0200, Laurent Pinchart wrote:
> Hi Dave,
> 
> (CC'ing LKML and Greg KH)
> 
> On Thursday 08 Dec 2016 12:31:55 Dave Stevenson wrote:
> > Hi All.
> > 
> > I'm working with a USB webcam which has been seen to spontaneously
> > disconnect when in use. That's a separate issue, but when it does it
> > throws a load of warnings into the kernel log if there is a file handle
> > on the device open at the time, even if not streaming.
> > 
> > I've reproduced this with a generic Logitech C270 webcam on:
> > - Ubuntu 16.04 (kernel 4.4.0-51) vanilla, and with the latest media tree
> > from linuxtv.org
> > - Ubuntu 14.04 (kernel 4.4.0-42) vanilla
> > - an old 3.10.x tree on an embedded device.
> > 
> > To reproduce:
> > - connect USB webcam.
> > - run a simple app that opens /dev/videoX, sleeps for a while, and then
> > closes the handle.
> > - disconnect the webcam whilst the app is running.
> > - read kernel logs - observe warnings. We get the disconnect logged as
> > it occurs, but the warnings all occur when the file descriptor is
> > closed. (A copy of the logs from my Ubuntu 14.04 machine are below).
> > 
> > I can fully appreciate that the open file descriptor is holding
> > references to a now invalid device, but is there a way to avoid them? Or
> > do we really not care and have to put up with the log noise when doing
> > such silly things?
> 
> This is a known problem, caused by the driver core trying to remove the same 
> sysfs attributes group twice.

Ick, not good.

> The group is first removed when the USB device is disconnected. The input 
> device and media device created by the uvcvideo driver are children of the 
> USB 
> interface device, which is deleted from the system when the camera is 
> unplugged. Due to the parent-child relationship, all sysfs attribute groups 
> of 
> the children are removed.

Wait, why is the USB device being removed from sysfs at this point,
didn't the input and media subsystems grab a reference to it so that it
does not disappear just yet?

> Then, when the device node is closed, the media device and input device are 
> unregistered, causing the corresponding devices to be deleted too. The driver 
> core tries to remove the sysfs attributes groups related to those devices, 
> and 
> issues a warning as they have been removed already.
> 
> I'm not sure how to fix that, any hint from LKML would be appreciated.

Properly grab a reference to the USB device?  :)

If that's already happening, please let me know and I'll see what needs
to be done, but I think that should solve the issue for you.

thanks,

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


cron job: media_tree daily build: ERRORS

2016-12-08 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:   Fri Dec  9 05:00:17 CET 2016
media-tree git hash:365fe4e0ce218dc5ad10df17b150a366b6015499
media_build git hash:   1606032398b1d79149c1507be2029e1a00d8dff0
v4l-utils git hash: 188e604d57bec065078ff772c802b93ddb6def4b
gcc version:i686-linux-gcc (GCC) 6.2.0
sparse version: v0.5.0-3553-g78b2ea6
smatch version: v0.5.0-3553-g78b2ea6
host hardware:  x86_64
host os:4.8.0-164

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-multi: 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: WARNINGS
linux-2.6.37.6-i686: WARNINGS
linux-2.6.38.8-i686: WARNINGS
linux-2.6.39.4-i686: WARNINGS
linux-3.0.60-i686: WARNINGS
linux-3.1.10-i686: WARNINGS
linux-3.2.37-i686: WARNINGS
linux-3.3.8-i686: WARNINGS
linux-3.4.27-i686: WARNINGS
linux-3.5.7-i686: WARNINGS
linux-3.6.11-i686: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-3.10.1-i686: WARNINGS
linux-3.11.1-i686: OK
linux-3.12.67-i686: OK
linux-3.13.11-i686: WARNINGS
linux-3.14.9-i686: WARNINGS
linux-3.15.2-i686: WARNINGS
linux-3.16.7-i686: WARNINGS
linux-3.17.8-i686: WARNINGS
linux-3.18.7-i686: WARNINGS
linux-3.19-i686: WARNINGS
linux-4.0.9-i686: WARNINGS
linux-4.1.33-i686: WARNINGS
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-rc5-i686: OK
linux-2.6.36.4-x86_64: WARNINGS
linux-2.6.37.6-x86_64: WARNINGS
linux-2.6.38.8-x86_64: WARNINGS
linux-2.6.39.4-x86_64: WARNINGS
linux-3.0.60-x86_64: WARNINGS
linux-3.1.10-x86_64: WARNINGS
linux-3.2.37-x86_64: WARNINGS
linux-3.3.8-x86_64: WARNINGS
linux-3.4.27-x86_64: WARNINGS
linux-3.5.7-x86_64: WARNINGS
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
linux-3.10.1-x86_64: WARNINGS
linux-3.11.1-x86_64: OK
linux-3.12.67-x86_64: OK
linux-3.13.11-x86_64: WARNINGS
linux-3.14.9-x86_64: WARNINGS
linux-3.15.2-x86_64: WARNINGS
linux-3.16.7-x86_64: WARNINGS
linux-3.17.8-x86_64: WARNINGS
linux-3.18.7-x86_64: WARNINGS
linux-3.19-x86_64: WARNINGS
linux-4.0.9-x86_64: WARNINGS
linux-4.1.33-x86_64: WARNINGS
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: OK
linux-4.9-rc5-x86_64: OK
apps: WARNINGS
spec-git: OK
smatch: ERRORS
sparse: WARNINGS

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

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


Re: [PATCH 2/2] uvcvideo: Document Intel SR300 Depth camera INZI format

2016-12-08 Thread Daniel Johnson
> In addition to my previous comments, wouldn't it make more sense to create a
> multiplanar format for this instead of bundling the two separate images into a
> single plane ?

Unfortunately that would break userspace at this point as multiple
libraries are already depending on a patch that implements the INZI
format in this way. I first released a work in progress patch in March
of 2015. It was integrated into a Robot Operating System module
shortly after that, and Intel has included it in librealsense since
January, and also in the firmware for their new Joule module. Since
people using this have mostly had to patch their own kernel to use it
that might not be a deal breaker. I had initially held back on
upstreaming it because I was trying to work out some details of the
image formats. Two depth formats seemed the same, and I was trying to
figure out what was different enough about them to justify having two
formats. I've never had access to any intel documentation beyond what
is public on their website, and many details are missing.

For reference I got an early RealSense camera when only windows was
supported, and figured out some rudimentary support for Linux over a
year before intel released their own support. A manager hiring for
Intel's open source library told me over the phone that they were in
fact using my blog posts to help them develop it so it wasn't
surprising that the patch they distributed with the library included
my comments. It was surprising that they didn't mention me as the
author of the patch.

I could rebase my original patch on the current development kernel and
submit it if that helps. I can reformat the useful bits from my blog
posts as documentation on how 3d cameras work. I wrote a C hotplug
utility to let the kernel know about non standard camera controls. I
also have a partially finished kernel driver for the SR300, and F200
cameras for things like retrieving the calibration to turn depth
images into point clouds, putting the camera into firmware update
mode, etc that intel's library does with libusb. I think there should
be a standard v4l2 api for 3d cameras because as it is now userspace
programs have to be written differently for each vendor. Really all
they need are some calibration matrices, and distortion coefficients.
Precise time synchronization between /dev/videoX nodes would also be
really helpful. These two things would be helpful for other cameras as
well for things like stitching 360 degree video.

Here are links to my blog series.
http://solsticlipse.com/2015/01/09/intel-real-sense-camera-on-linux.html
http://solsticlipse.com/2015/02/10/intel-real-sense-on-linux-part-2-3d-camera-controls.html
http://solsticlipse.com/2015/03/31/intel-real-sense-3d-on-linux-macos.html
http://solsticlipse.com/2016/09/26/long-road-to-ubiquitous-3d-cameras.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 4/4] dvb-usb-cxusb: Geniatech Mygica T230C support.

2016-12-08 Thread CrazyCat
Updated Geniatech DVB-T/T2 stick support.

Signed-off-by: CrazyCat 
---
 drivers/media/usb/dvb-usb/cxusb.c | 136 ++
 1 file changed, 136 insertions(+)

diff --git a/drivers/media/usb/dvb-usb/cxusb.c 
b/drivers/media/usb/dvb-usb/cxusb.c
index 3edc30d..4bf4c68 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -1439,6 +1439,82 @@ static int cxusb_mygica_t230_frontend_attach(struct 
dvb_usb_adapter *adap)
return 0;
 }
 
+static int cxusb_mygica_t230c_frontend_attach(struct dvb_usb_adapter *adap)
+{
+   struct dvb_usb_device *d = adap->dev;
+   struct cxusb_state *st = d->priv;
+   struct i2c_adapter *adapter;
+   struct i2c_client *client_demod;
+   struct i2c_client *client_tuner;
+   struct i2c_board_info info;
+   struct si2168_config si2168_config;
+   struct si2157_config si2157_config;
+
+   /* Select required USB configuration */
+   if (usb_set_interface(d->udev, 0, 0) < 0)
+   err("set interface failed");
+
+   /* Unblock all USB pipes */
+   usb_clear_halt(d->udev,
+   usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
+   usb_clear_halt(d->udev,
+   usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
+   usb_clear_halt(d->udev,
+   usb_rcvbulkpipe(d->udev, 
d->props.adapter[0].fe[0].stream.endpoint));
+
+   /* attach frontend */
+   memset(&si2168_config, 0, sizeof(si2168_config));
+   si2168_config.i2c_adapter = &adapter;
+   si2168_config.fe = &adap->fe_adap[0].fe;
+   si2168_config.ts_mode = SI2168_TS_PARALLEL;
+   si2168_config.ts_clock_inv = 1;
+   memset(&info, 0, sizeof(struct i2c_board_info));
+   strlcpy(info.type, "si2168", I2C_NAME_SIZE);
+   info.addr = 0x64;
+   info.platform_data = &si2168_config;
+   request_module(info.type);
+   client_demod = i2c_new_device(&d->i2c_adap, &info);
+   if (client_demod == NULL || client_demod->dev.driver == NULL)
+   return -ENODEV;
+
+   if (!try_module_get(client_demod->dev.driver->owner)) {
+   i2c_unregister_device(client_demod);
+   return -ENODEV;
+   }
+
+   /* attach tuner */
+   memset(&si2157_config, 0, sizeof(si2157_config));
+   si2157_config.fe = adap->fe_adap[0].fe;
+   memset(&info, 0, sizeof(struct i2c_board_info));
+   strlcpy(info.type, "si2141", I2C_NAME_SIZE);
+   info.addr = 0x60;
+   info.platform_data = &si2157_config;
+   request_module("si2157");
+   client_tuner = i2c_new_device(adapter, &info);
+   if (client_tuner == NULL || client_tuner->dev.driver == NULL) {
+   module_put(client_demod->dev.driver->owner);
+   i2c_unregister_device(client_demod);
+   return -ENODEV;
+   }
+   if (!try_module_get(client_tuner->dev.driver->owner)) {
+   i2c_unregister_device(client_tuner);
+   module_put(client_demod->dev.driver->owner);
+   i2c_unregister_device(client_demod);
+   return -ENODEV;
+   }
+
+   st->i2c_client_demod = client_demod;
+   st->i2c_client_tuner = client_tuner;
+
+   /* hook fe: need to resync the slave fifo when signal locks. */
+   mutex_init(&st->stream_mutex);
+   st->last_lock = 0;
+   st->fe_read_status = adap->fe_adap[0].fe->ops.read_status;
+   adap->fe_adap[0].fe->ops.read_status = cxusb_read_status;
+
+   return 0;
+}
+
 /*
  * DViCO has shipped two devices with the same USB ID, but only one of them
  * needs a firmware download.  Check the device class details to see if they
@@ -1521,6 +1597,7 @@ static int bluebird_patch_dvico_firmware_download(struct 
usb_device *udev,
 static struct dvb_usb_device_properties cxusb_d680_dmb_properties;
 static struct dvb_usb_device_properties cxusb_mygica_d689_properties;
 static struct dvb_usb_device_properties cxusb_mygica_t230_properties;
+static struct dvb_usb_device_properties cxusb_mygica_t230c_properties;
 
 static int cxusb_probe(struct usb_interface *intf,
   const struct usb_device_id *id)
@@ -1553,6 +1630,8 @@ static int cxusb_probe(struct usb_interface *intf,
 THIS_MODULE, NULL, adapter_nr) ||
0 == dvb_usb_device_init(intf, &cxusb_mygica_t230_properties,
 THIS_MODULE, NULL, adapter_nr) ||
+   0 == dvb_usb_device_init(intf, &cxusb_mygica_t230c_properties,
+THIS_MODULE, NULL, adapter_nr) ||
0)
return 0;
 
@@ -1604,6 +1683,7 @@ enum cxusb_table_index {
CONEXANT_D680_DMB,
MYGICA_D689,
MYGICA_T230,
+   MYGICA_T230C,
NR__cxusb_table_index
 };
 
@@ -1671,6 +1751,9 @@ enum cxusb_table_index {
[MYGICA_T230] = {
USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230)
   

[PATCH 1/4] dvb-usb-cxusb: New RC map for Geniatech Mygica T230.

2016-12-08 Thread CrazyCat
Updated RC map for Geniatech DVB-T/T2 sticks.

Signed-off-by: CrazyCat 
---
 drivers/media/usb/dvb-usb/cxusb.c | 42 +--
 1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/cxusb.c 
b/drivers/media/usb/dvb-usb/cxusb.c
index 9b8771e..3edc30d 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -653,6 +653,44 @@ static int cxusb_d680_dmb_rc_query(struct dvb_usb_device 
*d, u32 *event,
{ 0x0025, KEY_POWER },
 };
 
+static struct rc_map_table rc_map_t230_table[] = {
+   { 0x, KEY_0 },
+   { 0x0001, KEY_1 },
+   { 0x0002, KEY_2 },
+   { 0x0003, KEY_3 },
+   { 0x0004, KEY_4 },
+   { 0x0005, KEY_5 },
+   { 0x0006, KEY_6 },
+   { 0x0007, KEY_7 },
+   { 0x0008, KEY_8 },
+   { 0x0009, KEY_9 },
+   { 0x000a, KEY_MUTE },
+   { 0x000b, KEY_STOP },   /* Stop */
+   { 0x000c, KEY_POWER2 }, /* Turn on/off application */
+   { 0x000d, KEY_OK }, /* OK */
+   { 0x000e, KEY_CAMERA }, /* Snapshot */
+   { 0x000f, KEY_ZOOM },   /* Full Screen/Restore */
+   { 0x0010, KEY_RIGHT },  /* Right arrow */
+   { 0x0011, KEY_LEFT },   /* Left arrow */
+   { 0x0012, KEY_CHANNELUP },
+   { 0x0013, KEY_CHANNELDOWN },
+   { 0x0014, KEY_SHUFFLE },
+   { 0x0016, KEY_PAUSE },
+   { 0x0017, KEY_PLAY },   /* Play */
+   { 0x001e, KEY_TIME },   /* Time Shift */
+   { 0x001f, KEY_RECORD },
+   { 0x0020, KEY_UP },
+   { 0x0021, KEY_DOWN },
+   { 0x0025, KEY_POWER },  /* Turn off computer */
+   { 0x0026, KEY_REWIND }, /* FR << */
+   { 0x0027, KEY_FASTFORWARD },/* FF >> */
+   { 0x0029, KEY_ESC },
+   { 0x002b, KEY_VOLUMEUP },
+   { 0x002c, KEY_VOLUMEDOWN },
+   { 0x002d, KEY_CHANNEL },/* CH Surfing */
+   { 0x0038, KEY_VIDEO },  /* TV/AV/S-Video/YPbPr */
+};
+
 static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
 {
static u8 clock_config []  = { CLOCK_CTL,  0x38, 0x28 };
@@ -2317,8 +2355,8 @@ struct dvb_usb_device_properties 
cxusb_bluebird_dualdig4_rev2_properties = {
 
.rc.legacy = {
.rc_interval  = 100,
-   .rc_map_table = rc_map_d680_dmb_table,
-   .rc_map_size  = ARRAY_SIZE(rc_map_d680_dmb_table),
+   .rc_map_table = rc_map_t230_table,
+   .rc_map_size  = ARRAY_SIZE(rc_map_t230_table),
.rc_query = cxusb_d680_dmb_rc_query,
},
 
-- 
1.9.1


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


[PATCH 2/4] si2168: Si2168-D60 support.

2016-12-08 Thread CrazyCat
Support for new demod version.

Signed-off-by: CrazyCat 
---
 drivers/media/dvb-frontends/si2168.c  | 4 
 drivers/media/dvb-frontends/si2168_priv.h | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/drivers/media/dvb-frontends/si2168.c 
b/drivers/media/dvb-frontends/si2168.c
index 20b4a65..28f3bbe 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -674,6 +674,9 @@ static int si2168_probe(struct i2c_client *client,
case SI2168_CHIP_ID_B40:
dev->firmware_name = SI2168_B40_FIRMWARE;
break;
+   case SI2168_CHIP_ID_D60:
+   dev->firmware_name = SI2168_D60_FIRMWARE;
+   break;
default:
dev_dbg(&client->dev, "unknown chip version Si21%d-%c%c%c\n",
cmd.args[2], cmd.args[1], cmd.args[3], cmd.args[4]);
@@ -761,3 +764,4 @@ static int si2168_remove(struct i2c_client *client)
 MODULE_FIRMWARE(SI2168_A20_FIRMWARE);
 MODULE_FIRMWARE(SI2168_A30_FIRMWARE);
 MODULE_FIRMWARE(SI2168_B40_FIRMWARE);
+MODULE_FIRMWARE(SI2168_D60_FIRMWARE);
diff --git a/drivers/media/dvb-frontends/si2168_priv.h 
b/drivers/media/dvb-frontends/si2168_priv.h
index 7843ccb..4baa95b 100644
--- a/drivers/media/dvb-frontends/si2168_priv.h
+++ b/drivers/media/dvb-frontends/si2168_priv.h
@@ -25,6 +25,7 @@
 #define SI2168_A20_FIRMWARE "dvb-demod-si2168-a20-01.fw"
 #define SI2168_A30_FIRMWARE "dvb-demod-si2168-a30-01.fw"
 #define SI2168_B40_FIRMWARE "dvb-demod-si2168-b40-01.fw"
+#define SI2168_D60_FIRMWARE "dvb-demod-si2168-d60-01.fw"
 #define SI2168_B40_FIRMWARE_FALLBACK "dvb-demod-si2168-02.fw"
 
 /* state struct */
@@ -37,6 +38,7 @@ struct si2168_dev {
#define SI2168_CHIP_ID_A20 ('A' << 24 | 68 << 16 | '2' << 8 | '0' << 0)
#define SI2168_CHIP_ID_A30 ('A' << 24 | 68 << 16 | '3' << 8 | '0' << 0)
#define SI2168_CHIP_ID_B40 ('B' << 24 | 68 << 16 | '4' << 8 | '0' << 0)
+   #define SI2168_CHIP_ID_D60 ('D' << 24 | 68 << 16 | '6' << 8 | '0' << 0)
unsigned int chip_id;
unsigned int version;
const char *firmware_name;
-- 
1.9.1


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


Re: [PATCH v6 0/5] davinci: VPIF: add DT support

2016-12-08 Thread Kevin Hilman
Hi Javier,

Javier Martinez Canillas  writes:

> On Wed, Dec 7, 2016 at 3:30 PM, Kevin Hilman  wrote:
>> Prepare the groundwork for adding DT support for davinci VPIF drivers.
>> This series does some fixups/cleanups and then adds the DT binding and
>> DT compatible string matching for DT probing.
>>
>> The controversial part from previous versions around async subdev
>> parsing, and specifically hard-coding the input/output routing of
>> subdevs, has been left out of this series.  That part can be done as a
>> follow-on step after agreement has been reached on the path forward.
>
> I had a similar need for another board (OMAP3 IGEPv2), that has a
> TVP5151 video decoder (that also supports 2 composite or 1 s-video
> signal) attached to the OMAP3 ISP.
>
> I posted some RFC patches [0] to define the input signals in the DT,
> and AFAICT Laurent and Hans were not against the approach but just had
> some comments on the DT binding.
>
> Basically they wanted the ports to be directly in the tvp5150 node
> instead of under a connectors sub-node [1] and to just be called just
> a (input / output) port instead of a connector [2].
>
> Unfortunately I was busy with other tasks so I couldn't res-pin the
> patches, but I think you could have something similar in the DT
> binding for your case and it shouldn't be hard to parse the ports /
> endpoints in the driver to get that information from DT and setup the
> input and output pins.

Thanks for pointing that out.  I did see this in Hans' reply to one of
my earlier versions.  Indeed I think this could be useful in solving my
problem.

>> With is version, platforms can still use the VPIF capture/display
>> drivers, but must provide platform_data for the subdevs and subdev
>> routing.
>>
>
> I guess DT backward compatibility isn't a big issue on this platform,
> since support for the platform is quite recently and after all someone
> who wants to use the vpif with current DT will need platform data and
> pdata-quirks anyways.

That's correct.

> So I agree with you that the input / output signals lookup from DT
> could be done as a follow-up.

Thanks. I'll happily add the input/output signals once they're agreed
upon.  In the mean time, at least we can have a usable video capture on
this platform, and it's at least a step in the right direction for DT
support.

Thanks for the review,

Kevin
--
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 3/4] si2157: Si2141/2151 tuner support.

2016-12-08 Thread CrazyCat
Support for new tuner version.

Signed-off-by: CrazyCat 
---
 drivers/media/tuners/si2157.c  | 71 ++
 drivers/media/tuners/si2157_priv.h |  2 ++
 2 files changed, 67 insertions(+), 6 deletions(-)

diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index 57b2508..69fd21e 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -1,5 +1,5 @@
 /*
- * Silicon Labs Si2146/2147/2148/2157/2158 silicon tuner driver
+ * Silicon Labs Si2141/2146/2147/2148/2151/2157/2158 silicon tuner driver
  *
  * Copyright (C) 2014 Antti Palosaari 
  *
@@ -84,7 +84,7 @@ static int si2157_init(struct dvb_frontend *fe)
struct si2157_cmd cmd;
const struct firmware *fw;
const char *fw_name;
-   unsigned int uitmp, chip_id;
+   unsigned int uitmp, chip_id, count;
 
dev_dbg(&client->dev, "\n");
 
@@ -102,14 +102,46 @@ static int si2157_init(struct dvb_frontend *fe)
if (uitmp == dev->if_frequency / 1000)
goto warm;
 
+   if (dev->chiptype == SI2157_CHIPTYPE_SI2141) {
+   count = 0;
+   do {
+   if (count > 10)
+   goto err;
+
+   /* reset */
+   memcpy(cmd.args, "\xc0\x05\x00\x00", 4);
+   cmd.wlen = 4;
+   cmd.rlen = 1;
+   ret = si2157_cmd_execute(client, &cmd);
+   if (ret)
+   goto err;
+
+   memcpy(cmd.args, 
"\xc0\x00\x0d\x0e\x00\x01\x01\x01\x01\x03", 10);
+   cmd.wlen = 10;
+   cmd.rlen = 1;
+   ret = si2157_cmd_execute(client, &cmd);
+   if (ret)
+   goto err;
+   count++;
+   } while (cmd.args[0] == 0xfe);
+   dev_info(&client->dev, "Si2141/2151 reset attempts %d\n", 
count);
+   }
+
/* power up */
-   if (dev->chiptype == SI2157_CHIPTYPE_SI2146) {
+   switch (dev->chiptype) {
+   case SI2157_CHIPTYPE_SI2146:
memcpy(cmd.args, "\xc0\x05\x01\x00\x00\x0b\x00\x00\x01", 9);
cmd.wlen = 9;
-   } else {
+   break;
+   case SI2157_CHIPTYPE_SI2141:
+   memcpy(cmd.args, "\xc0\x08\x01\x02\x00\x08\x01", 7);
+   cmd.wlen = 7;
+   break;
+   default:
memcpy(cmd.args, 
"\xc0\x00\x0c\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01", 15);
cmd.wlen = 15;
}
+
cmd.rlen = 1;
ret = si2157_cmd_execute(client, &cmd);
if (ret)
@@ -131,6 +163,8 @@ static int si2157_init(struct dvb_frontend *fe)
#define SI2157_A30 ('A' << 24 | 57 << 16 | '3' << 8 | '0' << 0)
#define SI2147_A30 ('A' << 24 | 47 << 16 | '3' << 8 | '0' << 0)
#define SI2146_A10 ('A' << 24 | 46 << 16 | '1' << 8 | '0' << 0)
+   #define SI2141_A10 ('A' << 24 | 41 << 16 | '1' << 8 | '0' << 0)
+   #define SI2151_A10 ('A' << 24 | 51 << 16 | '1' << 8 | '0' << 0)
 
switch (chip_id) {
case SI2158_A20:
@@ -142,6 +176,10 @@ static int si2157_init(struct dvb_frontend *fe)
case SI2146_A10:
fw_name = NULL;
break;
+   case SI2141_A10:
+   case SI2151_A10:
+   fw_name = SI2141_A10_FIRMWARE;
+   break;
default:
dev_err(&client->dev, "unknown chip version Si21%d-%c%c%c\n",
cmd.args[2], cmd.args[1],
@@ -214,6 +252,23 @@ static int si2157_init(struct dvb_frontend *fe)
 
dev_info(&client->dev, "firmware version: %c.%c.%d\n",
cmd.args[6], cmd.args[7], cmd.args[8]);
+
+   if (dev->chiptype == SI2157_CHIPTYPE_SI2141) {
+   /* set clock */
+   memcpy(cmd.args, "\xc0\x00\x0d", 3);
+   cmd.wlen = 3;
+   cmd.rlen = 1;
+   ret = si2157_cmd_execute(client, &cmd);
+   if (ret)
+   goto err;
+   /* setup PIN */
+   memcpy(cmd.args, "\x12\x80\x80\x85\x00\x81\x00", 7);
+   cmd.wlen = 7;
+   cmd.rlen = 7;
+   ret = si2157_cmd_execute(client, &cmd);
+   if (ret)
+   goto err;
+   }
 warm:
/* init statistics in order signal app which are supported */
c->strength.len = 1;
@@ -471,7 +526,8 @@ static int si2157_probe(struct i2c_client *client,
 #endif
 
dev_info(&client->dev, "Silicon Labs %s successfully attached\n",
-   dev->chiptype == SI2157_CHIPTYPE_SI2146 ?
+   dev->chiptype == SI2157_CHIPTYPE_SI2141 ?
+   "Si2141/2151" : dev->chiptype == SI2157_CHIPTYPE_SI2146 
?
"Si2146" : "Si2147/2148/2157/2158");
 
retur

Re: [PATCH v6 3/3] sound/usb: Use Media Controller API to share media resources

2016-12-08 Thread Sakari Ailus
Hi Shuah,

On Thu, Dec 08, 2016 at 07:46:03AM -0700, Shuah Khan wrote:
> Hi Sakari,
> 
> On 12/07/2016 03:27 PM, Sakari Ailus wrote:
> > Hi Shuah,
> > 
> > On Wed, Dec 07, 2016 at 01:03:59PM -0700, Shuah Khan wrote:
> >> Hi Sakari,
> >>
> >> On 12/07/2016 03:52 AM, Sakari Ailus wrote:
> >>> Hi Shuah,
> >>>
> >>> On Mon, Dec 05, 2016 at 05:38:23PM -0700, Shuah Khan wrote:
>  On 12/05/2016 04:21 PM, Laurent Pinchart wrote:
> > Hi Shuah,
> >
> > On Monday 05 Dec 2016 15:44:30 Shuah Khan wrote:
> >> On 11/30/2016 03:01 PM, Shuah Khan wrote:
> >>> Change ALSA driver to use Media Controller API to share media 
> >>> resources
> >>> with DVB, and V4L2 drivers on a AU0828 media device.
> >>>
> >>> Media Controller specific initialization is done after sound card is
> >>> registered. ALSA creates Media interface and entity function graph
> >>> nodes for Control, Mixer, PCM Playback, and PCM Capture devices.
> >>>
> >>> snd_usb_hw_params() will call Media Controller enable source handler
> >>> interface to request the media resource. If resource request is 
> >>> granted,
> >>> it will release it from snd_usb_hw_free(). If resource is busy, 
> >>> -EBUSY is
> >>> returned.
> >>>
> >>> Media specific cleanup is done in usb_audio_disconnect().
> >>>
> >>> Signed-off-by: Shuah Khan 
> >>
> >> Hi Takashi,
> >>
> >> If you are good with this patch, could you please Ack it, so Mauro
> >> can pull it into media tree with the other two patches in this series,
> >> when he is ready to do so.
> >
> > I *really* want to address the concerns raised by Sakari before pulling 
> > more 
> > code that makes fixing the race conditions more difficult. Please, 
> > let's all 
> > work on fixing the core code to build a stable base on which we can 
> > build 
> > additional features. V4L2 and MC need teamwork, it's time to give the 
> > subsystem the love it deserves.
> >
> 
>  Hi Laurent,
> 
>  The issue Sakari brought up is specific to using devm for video_device in
>  omap3 and vsp1. I tried reproducing the problem on two different drivers
>  and couldn't on Linux 4.9-rc7.
> 
>  After sharing that with Sakari, I suggested to Sakari to pull up his 
>  patch
>  that removes the devm usage and see if he still needs all the patches in 
>  his
>  patch series. He didn't back to me on that. I also requested him to 
>  rebase on
> >>>
> >>> Just to see what remains, I made a small hack to test this with omap3isp 
> >>> by
> >>> just replacing the devm_() functions by their plain counterparts. The 
> >>> memory
> >>> is thus never released, for there is no really a proper moment to release 
> >>> it
> >>> --- something which the patchset resolves. The result is here:
> >>>
> >>> http://www.retiisi.org.uk/v4l2/tmp/media-ref-dmesg.txt>
> >>
> >> Did you test this on 4.9-rc7 without any of your other patches? If you
> >> haven't could you please run this test with just the removing devm usage
> >> from omap3isp?
> >>
> >> It would be good to get a baseline on the current with just the not using
> >> devm first and then see what needs fixing.
> >>
> >> Also, could you please send me the complete dmesg.
> > 
> > Updated from v4.9-rc6 to rc7 and with increased CONFIG_LOG_BUF_SHIFT. The
> > diff and dmesg are here:
> > 
> > http://www.retiisi.org.uk/v4l2/tmp/media-ref-diff2.txt>
> > http://www.retiisi.org.uk/v4l2/tmp/media-ref-dmesg2.txt>
> > 
> 
> Does unbind work on this even without streaming? Could you suppress

It's been working as long as I remember. There are caveats though --- the
clock to the sensor is provided by the ISP, so obviously things will not
work until the sensor is rebound as well. That is unrelated to the media
framework though; just FYI.

> debug messages and run unbind without streaming. It might fail. Let
> me know if what you see with just unbind on this driver.

I don't think disabling debug messages makes a difference but sure I can
provide you a log on that. But that'll be tomorrow.

> 
> I unearthed an old Gumstix Overo that was hiding in my hardware stash
> and I am setting it up to test.

Is it supported in mainline? I have a Nokia N9...

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL v2 FOR v4.11] Remove FSF postal address

2016-12-08 Thread Sakari Ailus
Hi Mauro,

This pull request contains a single patch, one that removes the FSF postal
address from the headers in source code files. The patch is rebased from
what I posted for review. The changes since that are done to the commit
message as you requested. It now looks like this:

8<
commit 50937f09e90bce1dbba67fdffd79d8c2a525edfe
Author: Sakari Ailus 
Date:   Fri Oct 28 14:31:20 2016 +0300

media: Drop FSF's postal address from the source code files

Drop the FSF's postal address from the source code files that typically
contain mostly the license text. Of the 628 removed instances, 578 are
outdated.

The patch has been created with the following command without manual edits:

git grep -l "675 Mass Ave\|59 Temple Place\|51 Franklin St" -- \
drivers/media/ include/media|while read i; do i=$i perl -e '
open(F,"< $ENV{i}");
$a=join("", );
$a =~ s/[ \t]*\*\n.*You should.*\n.*along with.*\n.*(\n.*USA.*$)?\n//m
&& $a =~ s/(^.*)Or, (point your browser to) /$1To obtain the license, 
$2\n$1/m;
close(F);
open(F, "> $ENV{i}");
print F $a;
close(F);'; done

Signed-off-by: Sakari Ailus 
8<

Please pull.


The following changes since commit 365fe4e0ce218dc5ad10df17b150a366b6015499:

  [media] mn88472: fix chip id check on probe (2016-12-01 12:47:22 -0200)

are available in the git repository at:

  ssh://linuxtv.org/git/sailus/media_tree.git fsf-address

for you to fetch changes up to 50937f09e90bce1dbba67fdffd79d8c2a525edfe:

  media: Drop FSF's postal address from the source code files (2016-12-09 
00:09:51 +0200)


Sakari Ailus (1):
  media: Drop FSF's postal address from the source code files

 drivers/media/common/b2c2/flexcop.c| 4 
 drivers/media/common/cx2341x.c | 4 
 drivers/media/common/siano/sms-cards.c | 4 
 drivers/media/common/siano/sms-cards.h | 4 
 drivers/media/common/siano/smscoreapi.c| 4 
 drivers/media/common/tveeprom.c| 4 
 drivers/media/dvb-core/demux.h | 4 
 drivers/media/dvb-core/dmxdev.c| 4 
 drivers/media/dvb-core/dmxdev.h| 4 
 drivers/media/dvb-core/dvb_ca_en50221.c| 7 ++-
 drivers/media/dvb-core/dvb_demux.c | 4 
 drivers/media/dvb-core/dvb_demux.h | 4 
 drivers/media/dvb-core/dvb_frontend.c  | 7 ++-
 drivers/media/dvb-core/dvb_math.c  | 4 
 drivers/media/dvb-core/dvb_math.h  | 4 
 drivers/media/dvb-core/dvb_net.c   | 7 ++-
 drivers/media/dvb-core/dvb_net.h   | 4 
 drivers/media/dvb-core/dvb_ringbuffer.c| 4 
 drivers/media/dvb-core/dvbdev.c| 4 
 drivers/media/dvb-core/dvbdev.h| 4 
 drivers/media/dvb-frontends/af9013.c   | 4 
 drivers/media/dvb-frontends/af9013.h   | 4 
 drivers/media/dvb-frontends/af9013_priv.h  | 4 
 drivers/media/dvb-frontends/atbm8830.c | 4 
 drivers/media/dvb-frontends/atbm8830.h | 4 
 drivers/media/dvb-frontends/atbm8830_priv.h| 4 
 drivers/media/dvb-frontends/au8522_decoder.c   | 5 -
 drivers/media/dvb-frontends/bcm3510.h  | 4 
 drivers/media/dvb-frontends/bcm3510_priv.h | 4 
 drivers/media/dvb-frontends/bsbe1-d01a.h   | 7 ++-
 drivers/media/dvb-frontends/bsbe1.h| 7 ++-
 drivers/media/dvb-frontends/bsru6.h| 7 ++-
 drivers/media/dvb-frontends/cx24113.c  | 4 
 drivers/media/dvb-frontends/cx24113.h  | 4 
 drivers/media/dvb-frontends/cx24123.c  | 4 
 drivers/media/dvb-frontends/dib0070.c  | 4 
 drivers/media/dvb-frontends/dib0090.c  | 4 
 drivers/media/dvb-frontends/drx39xyj/drx39xxj.h| 4 
 drivers/media/dvb-frontends/drxd.h | 8 ++--
 drivers/media/dvb-frontends/drxd_firm.c| 8 ++--
 drivers/media/dvb-frontends/drxd_firm.h| 8 ++--
 drivers/media/dvb-frontends/drxd_hard.c| 8 ++--
 drivers/media/dvb-frontends/drxd_map_firm.h| 8 ++--
 drivers/media/dvb-frontends/drxk_hard.c| 8 ++--
 drivers/media/dvb-frontends/dvb-pll.c  | 4 
 drivers/media/dvb-frontends/dvb_dummy_fe.c | 4 
 drivers/media/dvb-frontends/dvb_dummy_fe.h | 4 
 drivers/media/dvb-frontends/ec100.c| 4 
 drivers/media/dvb-frontends/ec100.h| 4 
 drivers/media/dvb-frontends/hd29l2.c   | 4 
 drivers/media/dvb

Re: [PATCH v3] [media] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Laurent Pinchart
Hi Mauro,

On Thursday 08 Dec 2016 21:16:07 Mauro Carvalho Chehab wrote:
> Em Fri, 09 Dec 2016 00:33:22 +0200 Laurent Pinchart escreveu:
> > Hi Mauro,
> > 
> > I've just sent a series of patches ("[PATCH 0/6] Fix tvp5150 regression
> > with em28xx") that should fix this problem properly. I unfortunately
> > haven't been able to test it with an em28xx device as I don't own any.
> 
> I'll try to test it tomorrow, with interlaced video. I guess I can
> test also VBI, but I need to double-check. I'm currently missing some
> way to test progressive video, though.

Thank you. I dug up an em28xx device I got years ago (had nearly forgotten 
about it) but it doesn't have a tvp5150, so I confirm I can't test this 
myself.

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH v3] [media] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Mauro Carvalho Chehab
Em Fri, 09 Dec 2016 00:33:22 +0200
Laurent Pinchart  escreveu:

> Hi Mauro,
> 
> I've just sent a series of patches ("[PATCH 0/6] Fix tvp5150 regression with 
> em28xx") that should fix this problem properly. I unfortunately haven't been 
> able to test it with an em28xx device as I don't own any.

I'll try to test it tomorrow, with interlaced video. I guess I can
test also VBI, but I need to double-check. I'm currently missing some
way to test progressive video, though.

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


Re: uvcvideo logging kernel warnings on device disconnect

2016-12-08 Thread Laurent Pinchart
Hi Dave,

(CC'ing LKML and Greg KH)

On Thursday 08 Dec 2016 12:31:55 Dave Stevenson wrote:
> Hi All.
> 
> I'm working with a USB webcam which has been seen to spontaneously
> disconnect when in use. That's a separate issue, but when it does it
> throws a load of warnings into the kernel log if there is a file handle
> on the device open at the time, even if not streaming.
> 
> I've reproduced this with a generic Logitech C270 webcam on:
> - Ubuntu 16.04 (kernel 4.4.0-51) vanilla, and with the latest media tree
> from linuxtv.org
> - Ubuntu 14.04 (kernel 4.4.0-42) vanilla
> - an old 3.10.x tree on an embedded device.
> 
> To reproduce:
> - connect USB webcam.
> - run a simple app that opens /dev/videoX, sleeps for a while, and then
> closes the handle.
> - disconnect the webcam whilst the app is running.
> - read kernel logs - observe warnings. We get the disconnect logged as
> it occurs, but the warnings all occur when the file descriptor is
> closed. (A copy of the logs from my Ubuntu 14.04 machine are below).
> 
> I can fully appreciate that the open file descriptor is holding
> references to a now invalid device, but is there a way to avoid them? Or
> do we really not care and have to put up with the log noise when doing
> such silly things?

This is a known problem, caused by the driver core trying to remove the same 
sysfs attributes group twice.

The group is first removed when the USB device is disconnected. The input 
device and media device created by the uvcvideo driver are children of the USB 
interface device, which is deleted from the system when the camera is 
unplugged. Due to the parent-child relationship, all sysfs attribute groups of 
the children are removed.

Then, when the device node is closed, the media device and input device are 
unregistered, causing the corresponding devices to be deleted too. The driver 
core tries to remove the sysfs attributes groups related to those devices, and 
issues a warning as they have been removed already.

I'm not sure how to fix that, any hint from LKML would be appreciated.

> [157877.297617] usb 1-1: new high-speed USB device number 12 using xhci_hcd
> [157877.698744] usb 1-1: New USB device found, idVendor=046d, idProduct=0825
> [157877.698747] usb 1-1: New USB device strings: Mfr=0, Product=0,
> SerialNumber=2
> [157877.698749] usb 1-1: SerialNumber: E989E680
> [157877.699314] uvcvideo: Found UVC 1.00 device  (046d:0825)
> [157877.789891] input: UVC Camera (046d:0825) as
> /devices/pci:00/:00:14.0/usb1/1-1/1-1:1.0/input/input688
> [157879.135333] usb 1-1: set resolution quirk: cval->res = 384
> 
> [157885.686043] usb 1-1: USB disconnect, device number 12
> 
> [157901.378104] [ cut here ]
> [157901.378111] WARNING: CPU: 2 PID: 21082 at
> /build/linux-lts-xenial-Ev_ZZB/linux-lts-xenial-4.4.0/fs/sysfs/group.c:237
> sysfs_remove_group+0x8d/0x90()
> [157901.378113] sysfs group 81ecb6c0 not found for kobject 'event13'
> [157901.378114] Modules linked in: snd_usb_audio snd_usbmidi_lib uas
> usb_storage ufs qnx4 hfsplus hfs minix ntfs msdos jfs xfs libcrc32c drbg
> ansi_cprng ctr ccm dm_crypt cmac asus_nb_wmi asus_wmi sparse_keymap
> snd_soc_rt5640 snd_soc_rl6231 snd_soc_core arc4 snd_compress ac97_bus
> snd_pcm_dmaengine uvcvideo snd_seq_midi videobuf2_vmalloc
> videobuf2_memops snd_seq_midi_event videobuf2_v4l2 intel_rapl
> videobuf2_core v4l2_common x86_pkg_temp_thermal videodev
> intel_powerclamp media kvm_intel iwlmvm dm_multipath snd_rawmidi kvm
> mac80211 snd_hda_codec_hdmi irqbypass crct10dif_pclmul crc32_pclmul
> snd_hda_codec_conexant snd_hda_codec_generic btusb rfcomm btrtl btbcm
> bnep snd_hda_intel snd_hda_codec btintel iwlwifi bluetooth snd_seq
> snd_hda_core snd_hwdep aesni_intel aes_x86_64 lrw gf128mul glue_helper
> ablk_helper cryptd input_leds cfg80211 snd_pcm joydev nfsd serio_raw
> mei_me snd_seq_device auth_rpcgss nfs_acl mei processor_thermal_device
> intel_soc_dts_iosf lpc_ich snd_timer binfmt_misc shpchp
> intel_pch_thermal nfs lockd grace sunrpc fscache snd soundcore elan_i2c
> i2c_hid hid int3402_thermal int340x_thermal_zone nls_iso8859_1 dw_dmac
> int3400_thermal snd_soc_sst_acpi dw_dmac_core acpi_als acpi_pad
> i2c_designware_platform kfifo_buf i2c_designware_core 8250_dw
> spi_pxa2xx_platform parport_pc industrialio acpi_thermal_rel ppdev
> coretemp mac_hid lp parport btrfs xor raid6_pq dm_mirror dm_region_hash
> dm_log i915 i2c_algo_bit drm_kms_helper syscopyarea sysfillrect
> sysimgblt fb_sys_fops drm ahci psmouse libahci wmi video sdhci_acpi
> sdhci fjes
> [157901.378184] CPU: 2 PID: 21082 Comm: a.out Not tainted
> 4.4.0-42-generic #62~14.04.1-Ubuntu
> [157901.378185] Hardware name: ASUSTeK COMPUTER INC.
> [157901.378186]   8800da3a7bb8 813d51ec
> 8800da3a7c00
> [157901.378188]  81cdd3b0 8800da3a7bf0 8107d886
> 
> [157901.378190]  81ecb6c0 8800bb2e08c0 8800d93f6248
> 8801081b9540
> [157901.37819

Re: [PATCH v4l-utils v7 4/7] mediactl: Add media_device creation helpers

2016-12-08 Thread Sakari Ailus
Hi Jacek,

On Thu, Dec 08, 2016 at 11:04:20PM +0100, Jacek Anaszewski wrote:
> Hi Sakari,
> 
> On 11/24/2016 01:17 PM, Sakari Ailus wrote:
> >Hi Jacek,
> >
> >Thanks for the patchset.
> >
> >On Wed, Oct 12, 2016 at 04:35:19PM +0200, Jacek Anaszewski wrote:
> >>Add helper functions that allow for easy instantiation of media_device
> >>object basing on whether the media device contains v4l2 subdev with
> >>given file descriptor.
> >
> >Doesn't this work with video nodes as well? That's what you seem to be using
> >it for later on. And I think that's actually more useful.
> >
> >The existing implementation uses udev to look up devices. Could you use
> >libudev device enumeration API to find the media devices, and fall back to
> >sysfs if udev doesn't work? There seems to be a reasonable-looking example
> >here:
> >
> >http://stackoverflow.com/questions/25361042/how-to-list-usb-mass-storage-devices-programatically-using-libudev-in-linux>
> 
> Actually I am calling media_get_devname_udev() at first and falling back
> to sysfs similarly as it is accomplished in media_enum_entities().
> Is there any specific reason for which I should use libudev device
> enumeration API in media_device_new_by_subdev_fd()?

Yes. You rely on the API udev provides; the sysfs implementation is just a
fallback in case udev isn't available in the system. I guess it'd mostly
work but, for instance, you assume sysfs is found under /sys. The sysfs
itself isn't one of the most stable APIs either. Udev is a simply better
option when it's there.

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3] [media] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Laurent Pinchart
Hi Mauro,

I've just sent a series of patches ("[PATCH 0/6] Fix tvp5150 regression with 
em28xx") that should fix this problem properly. I unfortunately haven't been 
able to test it with an em28xx device as I don't own any.

On Thursday 08 Dec 2016 17:46:53 Mauro Carvalho Chehab wrote:
> commit 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
> support") added a logic that overrides TVP5150_CONF_SHARED_PIN setting,
> depending on the type of bus set via the .set_fmt() subdev callback.
> 
> This is known to cause trobules on devices that don't use a V4L2
> subdev devnode, and a fix for it was made by commit 47de9bf8931e
> ("[media] tvp5150: Fix breakage for serial usage"). Unfortunately,
> such fix doesn't consider the case of progressive video inputs,
> causing chroma decoding issues on such videos, as it overrides not
> only the type of video output, but also other unrelated bits.
> 
> So, instead of trying to guess, let's detect if the device configuration
> is set via Device Tree. If not, just ignore the new logic, restoring
> the original behavior.
> 
> Fixes: 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
> support") Cc: Devin Heitmueller 
> Cc: Javier Martinez Canillas 
> Cc: Laurent Pinchart 
> Cc: sta...@vger.kernel.org
> Signed-off-by: Mauro Carvalho Chehab 
> ---
> 
> changes since version 2:
>   - fixed settings for register 0x0d
>   - tested on WinTV USB2 with S-Video input
> 
> I'll do an extra test with HVR-950 on both S-Video and composite soon enough
> 
> changes since version 1: added a notice about what's broken at the
> tvp5150_stream() logic, and improved patch's description.
> 
> changes since RFC: don't touch at enum v4l2_mbus_type.
> 
>  drivers/media/i2c/tvp5150.c | 16 
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
> index 6737685d5be5..8b9d2fad17df 100644
> --- a/drivers/media/i2c/tvp5150.c
> +++ b/drivers/media/i2c/tvp5150.c
> @@ -57,6 +57,7 @@ struct tvp5150 {
>   u16 rom_ver;
> 
>   enum v4l2_mbus_type mbus_type;
> + bool has_dt;
>  };
> 
>  static inline struct tvp5150 *to_tvp5150(struct v4l2_subdev *sd)
> @@ -1053,6 +1054,20 @@ static int tvp5150_s_stream(struct v4l2_subdev *sd,
> int enable) /* Output format: 8-bit ITU-R BT.656 with embedded syncs */
>   int val = 0x09;
> 
> + if (!decoder->has_dt)
> + return 0;
> +
> + /*
> +  * FIXME: the logic below is hardcoded to work with some OMAP3
> +  * hardware with tvp5151. As such, it hardcodes values for
> +  * both TVP5150_CONF_SHARED_PIN and TVP5150_MISC_CTL, and ignores
> +  * what was set before at the driver. Ideally, we should have
> +  * DT nodes describing the setup, instead of hardcoding those
> +  * values, and doing a read before writing values to
> +  * TVP5150_MISC_CTL, but any patch adding support for it should
> +  * keep DT backward-compatible.
> +  */
> +
>   /* Output format: 8-bit 4:2:2 YUV with discrete sync */
>   if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
>   val = 0x0d;
> @@ -1471,6 +1486,7 @@ static int tvp5150_probe(struct i2c_client *c,
>   dev_err(sd->dev, "DT parsing error: %d\n", res);
>   return res;
>   }
> + decoder->has_dt = true;
>   } else {
>   /* Default to BT.656 embedded sync */
>   core->mbus_type = V4L2_MBUS_BT656;

-- 
Regards,

Laurent Pinchart

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


[PATCH 2/6] v4l: tvp5150: Don't inline the tvp5150_selmux() function

2016-12-08 Thread Laurent Pinchart
The function is large and called in several places, don't inline it.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/i2c/tvp5150.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 08384951c9e5..febe6833a504 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -258,7 +258,7 @@ static int tvp5150_log_status(struct v4l2_subdev *sd)
Basic functions
  /
 
-static inline void tvp5150_selmux(struct v4l2_subdev *sd)
+static void tvp5150_selmux(struct v4l2_subdev *sd)
 {
int opmode = 0;
struct tvp5150 *decoder = to_tvp5150(sd);
-- 
Regards,

Laurent Pinchart

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


[PATCH 5/6] v4l: tvp5150: Fix comment regarding output pin muxing

2016-12-08 Thread Laurent Pinchart
The FID/GLCO/VLK/HVLK and INTREQ/GPCL/VBLK pins are muxed differently
depending on whether the input is an S-Video or composite signal. The
comment that explains the logic doesn't reflect the code. It appears
that the comment is incorrect, as disabling the output data bus in
composite mode makes no sense. Update the comment to match the code.

While at it define macros for the MISC_CTL register bits, the code is
too confusing with numerical values.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/i2c/tvp5150.c | 24 +---
 drivers/media/i2c/tvp5150_reg.h |  9 +
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 19b79028cac5..18260849fe5a 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -291,8 +291,12 @@ static void tvp5150_selmux(struct v4l2_subdev *sd)
tvp5150_write(sd, TVP5150_OP_MODE_CTL, opmode);
tvp5150_write(sd, TVP5150_VD_IN_SRC_SEL_1, input);
 
-   /* Svideo should enable YCrCb output and disable GPCL output
-* For Composite and TV, it should be the reverse
+   /*
+* Setup the FID/GLCO/VLK/HVLK and INTREQ/GPCL/VBLK output signals. For
+* S-Video we output the vertical lock (VLK) signal on FID/GLCO/VLK/HVLK
+* and set INTREQ/GPCL/VBLK to logic 0. For composite we output the
+* field indicator (FID) signal on FID/GLCO/VLK/HVLK and set
+* INTREQ/GPCL/VBLK to logic 1.
 */
val = tvp5150_read(sd, TVP5150_MISC_CTL);
if (val < 0) {
@@ -301,9 +305,9 @@ static void tvp5150_selmux(struct v4l2_subdev *sd)
}
 
if (decoder->input == TVP5150_SVIDEO)
-   val = (val & ~0x40) | 0x10;
+   val = (val & ~TVP5150_MISC_CTL_GPCL) | TVP5150_MISC_CTL_HVLK;
else
-   val = (val & ~0x10) | 0x40;
+   val = (val & ~TVP5150_MISC_CTL_HVLK) | ~TVP5150_MISC_CTL_GPCL;
tvp5150_write(sd, TVP5150_MISC_CTL, val);
 };
 
@@ -455,7 +459,12 @@ static const struct i2c_reg_value tvp5150_init_enable[] = {
},{ /* Automatic offset and AGC enabled */
TVP5150_ANAL_CHL_CTL, 0x15
},{ /* Activate YCrCb output 0x9 or 0xd ? */
-   TVP5150_MISC_CTL, 0x6f
+   TVP5150_MISC_CTL, TVP5150_MISC_CTL_GPCL |
+ TVP5150_MISC_CTL_INTREQ_OE |
+ TVP5150_MISC_CTL_YCBCR_OE |
+ TVP5150_MISC_CTL_SYNC_OE |
+ TVP5150_MISC_CTL_VBLANK |
+ TVP5150_MISC_CTL_CLOCK_OE,
},{ /* Activates video std autodetection for all standards */
TVP5150_AUTOSW_MSK, 0x0
},{ /* Default format: 0x47. For 4:2:2: 0x40 */
@@ -1050,11 +1059,12 @@ static int tvp5150_s_stream(struct v4l2_subdev *sd, int 
enable)
 {
struct tvp5150 *decoder = to_tvp5150(sd);
/* Output format: 8-bit ITU-R BT.656 with embedded syncs */
-   int val = 0x09;
+   int val = TVP5150_MISC_CTL_YCBCR_OE | TVP5150_MISC_CTL_CLOCK_OE;
 
/* Output format: 8-bit 4:2:2 YUV with discrete sync */
if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
-   val = 0x0d;
+   val = TVP5150_MISC_CTL_YCBCR_OE | TVP5150_MISC_CTL_SYNC_OE
+   | TVP5150_MISC_CTL_CLOCK_OE;
 
/* Initializes TVP5150 to its default values */
/* # set PCLK (27MHz) */
diff --git a/drivers/media/i2c/tvp5150_reg.h b/drivers/media/i2c/tvp5150_reg.h
index 25a994944918..30a48c28d05a 100644
--- a/drivers/media/i2c/tvp5150_reg.h
+++ b/drivers/media/i2c/tvp5150_reg.h
@@ -9,6 +9,15 @@
 #define TVP5150_ANAL_CHL_CTL 0x01 /* Analog channel controls */
 #define TVP5150_OP_MODE_CTL  0x02 /* Operation mode controls */
 #define TVP5150_MISC_CTL 0x03 /* Miscellaneous controls */
+#define TVP5150_MISC_CTL_VBLK_GPCL BIT(7)
+#define TVP5150_MISC_CTL_GPCL  BIT(6)
+#define TVP5150_MISC_CTL_INTREQ_OE BIT(5)
+#define TVP5150_MISC_CTL_HVLK  BIT(4)
+#define TVP5150_MISC_CTL_YCBCR_OE  BIT(3)
+#define TVP5150_MISC_CTL_SYNC_OE   BIT(2)
+#define TVP5150_MISC_CTL_VBLANKBIT(1)
+#define TVP5150_MISC_CTL_CLOCK_OE  BIT(0)
+
 #define TVP5150_AUTOSW_MSK   0x04 /* Autoswitch mask: TVP5150A / 
TVP5150AM */
 
 /* Reserved 05h */
-- 
Regards,

Laurent Pinchart

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


[PATCH 3/6] v4l: tvp5150: Add missing break in set control handler

2016-12-08 Thread Laurent Pinchart
A break is missing resulting in the hue control enabling or disabling
the decode completely. Fix it.

Fixes: c43875f66140 ("[media] tvp5150: replace MEDIA_ENT_F_CONN_TEST by a 
control")
Signed-off-by: Laurent Pinchart 
---
 drivers/media/i2c/tvp5150.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index febe6833a504..3a0fe8cc64e9 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -818,6 +818,7 @@ static int tvp5150_s_ctrl(struct v4l2_ctrl *ctrl)
return 0;
case V4L2_CID_HUE:
tvp5150_write(sd, TVP5150_HUE_CTL, ctrl->val);
+   break;
case V4L2_CID_TEST_PATTERN:
decoder->enable = ctrl->val ? false : true;
tvp5150_selmux(sd);
-- 
Regards,

Laurent Pinchart

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


[PATCH 6/6] v4l: tvp5150: Don't override output pinmuxing at stream on/off time

2016-12-08 Thread Laurent Pinchart
The s_stream() handler incorrectly writes the whole MISC_CTL register to
enable or disable the outputs, overriding the output pinmuxing
configuration. Fix it to only touch the output enable bits.

The CONF_SHARED_PIN register is also written by the same function,
resulting in muxing the INTREQ signal instead of the VBLK/GPCL signal on
the INTREQ/GPCL/VBLK pin. As the driver doesn't support interrupts this
is obviously incorrect, and breaks operation on other devices. Fix it by
removing the write.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/i2c/tvp5150.c | 33 +++--
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 18260849fe5a..9f1104b7c2cd 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -1058,22 +1058,27 @@ static const struct media_entity_operations 
tvp5150_sd_media_ops = {
 static int tvp5150_s_stream(struct v4l2_subdev *sd, int enable)
 {
struct tvp5150 *decoder = to_tvp5150(sd);
-   /* Output format: 8-bit ITU-R BT.656 with embedded syncs */
-   int val = TVP5150_MISC_CTL_YCBCR_OE | TVP5150_MISC_CTL_CLOCK_OE;
-
-   /* Output format: 8-bit 4:2:2 YUV with discrete sync */
-   if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
-   val = TVP5150_MISC_CTL_YCBCR_OE | TVP5150_MISC_CTL_SYNC_OE
-   | TVP5150_MISC_CTL_CLOCK_OE;
+   int val;
 
-   /* Initializes TVP5150 to its default values */
-   /* # set PCLK (27MHz) */
-   tvp5150_write(sd, TVP5150_CONF_SHARED_PIN, 0x00);
+   /* Enable or disable the video output signals. */
+   val = tvp5150_read(sd, TVP5150_MISC_CTL);
+   if (val < 0)
+   return val;
+
+   val &= ~(TVP5150_MISC_CTL_YCBCR_OE | TVP5150_MISC_CTL_SYNC_OE |
+TVP5150_MISC_CTL_CLOCK_OE);
+
+   if (enable) {
+   /*
+* Enable the YCbCr and clock outputs. In discrete sync mode
+* (non-BT.656) additionally enable the the sync outputs.
+*/
+   val |= TVP5150_MISC_CTL_YCBCR_OE | TVP5150_MISC_CTL_CLOCK_OE;
+   if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
+   val |= TVP5150_MISC_CTL_SYNC_OE;
+   }
 
-   if (enable)
-   tvp5150_write(sd, TVP5150_MISC_CTL, val);
-   else
-   tvp5150_write(sd, TVP5150_MISC_CTL, 0x00);
+   tvp5150_write(sd, TVP5150_MISC_CTL, val);
 
return 0;
 }
-- 
Regards,

Laurent Pinchart

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


[PATCH 1/6] v4l: tvp5150: Compile tvp5150_link_setup out if !CONFIG_MEDIA_CONTROLLER

2016-12-08 Thread Laurent Pinchart
The function is only referenced as a handler in the tvp5150_sd_media_ops
structure, which is only used when CONFIG_MEDIA_CONTROLLER is set. Don't
define the function and the structure when the configuration option is
unset to avoid an unused function warning.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/i2c/tvp5150.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 6737685d5be5..08384951c9e5 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -1013,11 +1013,11 @@ static int tvp5150_enum_frame_size(struct v4l2_subdev 
*sd,
Media entity ops
  /
 
+#ifdef CONFIG_MEDIA_CONTROLLER
 static int tvp5150_link_setup(struct media_entity *entity,
  const struct media_pad *local,
  const struct media_pad *remote, u32 flags)
 {
-#ifdef CONFIG_MEDIA_CONTROLLER
struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
struct tvp5150 *decoder = to_tvp5150(sd);
int i;
@@ -1034,7 +1034,6 @@ static int tvp5150_link_setup(struct media_entity *entity,
decoder->input = i;
 
tvp5150_selmux(sd);
-#endif
 
return 0;
 }
@@ -1042,6 +1041,7 @@ static int tvp5150_link_setup(struct media_entity *entity,
 static const struct media_entity_operations tvp5150_sd_media_ops = {
.link_setup = tvp5150_link_setup,
 };
+#endif
 
 /
I2C Command
-- 
Regards,

Laurent Pinchart

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


[PATCH 4/6] v4l: tvp5150: Don't reset device in get/set format handlers

2016-12-08 Thread Laurent Pinchart
The tvp5150 doesn't support format setting through the subdev pad API
and thus implements the set format handler as a get format operation.
The single handler, tvp5150_fill_fmt(), resets the device by calling
tvp5150_reset(). This causes malfunction as the device can be reset at
will, possibly from userspace when the subdev userspace API is enabled.

The reset call was added in commit ec2c4f3f93cb ("[media] media:
tvp5150: Add mbus_fmt callbacks"), probably as an attempt to set the
device to a known state before detecting the current TV standard.
However, the get format handler doesn't access the hardware to get the
TV standard since commit 963ddc63e20d ("[media] media: tvp5150: Add
cropping support"). There is thus no need to reset the device when
getting the format. Fix it.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/i2c/tvp5150.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 3a0fe8cc64e9..19b79028cac5 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -861,8 +861,6 @@ static int tvp5150_fill_fmt(struct v4l2_subdev *sd,
 
f = &format->format;
 
-   tvp5150_reset(sd, 0);
-
f->width = decoder->rect.width;
f->height = decoder->rect.height / 2;
 
-- 
Regards,

Laurent Pinchart

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


[PATCH 0/6] Fix tvp5150 regression with em28xx

2016-12-08 Thread Laurent Pinchart
Hello,

This patch series fixes a regression reported by Devin Heitmueller that
affects a large number of em28xx. The problem was introduced by

commit 13d52fe40f1f7bbad49128e8ee6a2fe5e13dd18d
Author: Mauro Carvalho Chehab 
Date:   Tue Jan 26 06:59:39 2016 -0200

[media] em28xx: fix implementation of s_stream

that started calling s_stream(1) in the em28xx driver when enabling the
stream, resulting in the tvp5150 s_stream() operation writing several
registers with values fit for other platforms (namely OMAP3, possibly others)
but not for em28xx.

The series starts with two unrelated drive-by cleanups and an unrelated bug
fix. It then continues with a patch to remove an unneeded and armful call to
tvp5150_reset() when getting the format from the subdevice (4/6), an update of
an invalid comment and the addition of macros for register bits in order to
make the code more readable (5/6) and actually allow following the incorrect
code flow, and finally a rework of the s_stream() operation to fix the
problem.

I haven't been able to test this with an em28xx device as I don't own any. I
would appreciate if someone could give the series a go.

Laurent Pinchart (6):
  v4l: tvp5150: Compile tvp5150_link_setup out if
!CONFIG_MEDIA_CONTROLLER
  v4l: tvp5150: Don't inline the tvp5150_selmux() function
  v4l: tvp5150: Add missing break in set control handler
  v4l: tvp5150: Don't reset device in get/set format handlers
  v4l: tvp5150: Fix comment regarding output pin muxing
  v4l: tvp5150: Don't override output pinmuxing at stream on/off time

 drivers/media/i2c/tvp5150.c | 60 +
 drivers/media/i2c/tvp5150_reg.h |  9 +++
 2 files changed, 46 insertions(+), 23 deletions(-)

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH v4l-utils v7 4/7] mediactl: Add media_device creation helpers

2016-12-08 Thread Jacek Anaszewski

Hi Sakari,

On 11/24/2016 01:17 PM, Sakari Ailus wrote:

Hi Jacek,

Thanks for the patchset.

On Wed, Oct 12, 2016 at 04:35:19PM +0200, Jacek Anaszewski wrote:

Add helper functions that allow for easy instantiation of media_device
object basing on whether the media device contains v4l2 subdev with
given file descriptor.


Doesn't this work with video nodes as well? That's what you seem to be using
it for later on. And I think that's actually more useful.

The existing implementation uses udev to look up devices. Could you use
libudev device enumeration API to find the media devices, and fall back to
sysfs if udev doesn't work? There seems to be a reasonable-looking example
here:

http://stackoverflow.com/questions/25361042/how-to-list-usb-mass-storage-devices-programatically-using-libudev-in-linux>


Actually I am calling media_get_devname_udev() at first and falling back
to sysfs similarly as it is accomplished in media_enum_entities().
Is there any specific reason for which I should use libudev device
enumeration API in media_device_new_by_subdev_fd()?

Best regards,
Jacek Anaszewski



Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
---
 utils/media-ctl/libmediactl.c | 131 +-
 utils/media-ctl/mediactl.h|  27 +
 2 files changed, 156 insertions(+), 2 deletions(-)

diff --git a/utils/media-ctl/libmediactl.c b/utils/media-ctl/libmediactl.c
index 155b65f..d347a40 100644
--- a/utils/media-ctl/libmediactl.c
+++ b/utils/media-ctl/libmediactl.c
@@ -27,6 +27,7 @@
 #include 

 #include 
+#include 
 #include 
 #include 
 #include 
@@ -440,8 +441,9 @@ static int media_get_devname_udev(struct udev *udev,
return -EINVAL;

devnum = makedev(entity->info.v4l.major, entity->info.v4l.minor);
-   media_dbg(entity->media, "looking up device: %u:%u\n",
- major(devnum), minor(devnum));
+   if (entity->media)
+   media_dbg(entity->media, "looking up device: %u:%u\n",
+ major(devnum), minor(devnum));
device = udev_device_new_from_devnum(udev, 'c', devnum);
if (device) {
p = udev_device_get_devnode(device);
@@ -523,6 +525,7 @@ static int media_get_devname_sysfs(struct media_entity 
*entity)
return 0;
 }

+


Unrelated change.


 static int media_enum_entities(struct media_device *media)
 {
struct media_entity *entity;
@@ -707,6 +710,92 @@ struct media_device *media_device_new(const char *devnode)
return media;
 }

+struct media_device *media_device_new_by_subdev_fd(int fd, struct media_entity 
**fd_entity)
+{
+   char video_devname[32], device_dir_path[256], media_dev_path[256], 
media_major_minor[10];
+   struct media_device *media = NULL;
+   struct dirent *entry;
+   struct media_entity tmp_entity;
+   DIR *device_dir;
+   struct udev *udev;
+   char *p;
+   int ret, i;
+
+   if (fd_entity == NULL)
+   return NULL;
+
+   ret = media_get_devname_by_fd(fd, video_devname);
+   if (ret < 0)
+   return NULL;
+
+   p = strrchr(video_devname, '/');
+   if (p == NULL)
+   return NULL;
+
+   ret = media_udev_open(&udev);
+   if (ret < 0)
+   return NULL;
+
+   sprintf(device_dir_path, "/sys/class/video4linux/%s/device/", p + 1);
+
+   device_dir = opendir(device_dir_path);
+   if (device_dir == NULL)
+   return NULL;
+
+   while ((entry = readdir(device_dir))) {
+   if (strncmp(entry->d_name, "media", 4))


Why 4? And isn't entry->d_name nul-terminated, so you could use strcmp()?


+   continue;
+
+   sprintf(media_dev_path, "%s%s/dev", device_dir_path, 
entry->d_name);
+
+   fd = open(media_dev_path, O_RDONLY);
+   if (fd < 0)
+   continue;
+
+   ret = read(fd, media_major_minor, sizeof(media_major_minor));
+   if (ret < 0)
+   continue;
+
+   sscanf(media_major_minor, "%d:%d", &tmp_entity.info.dev.major, 
&tmp_entity.info.dev.minor);


This would be better split on two lines.


+
+   /* Try to get the device name via udev */
+   if (media_get_devname_udev(udev, &tmp_entity)) {
+   /* Fall back to get the device name via sysfs */
+   if (media_get_devname_sysfs(&tmp_entity))
+   continue;
+   }
+
+   media = media_device_new(tmp_entity.devname);
+   if (media == NULL)
+   continue;
+
+   ret = media_device_enumerate(media);
+   if (ret < 0) {
+   media_dbg(media, "Failed to enumerate %s (%d)\n",
+ tmp_entity.devname, ret);
+   media_device_unref(media);
+   media = NULL;
+   contin

Re: [PATCH 2/3] [media] em28xx: use usb_interface for dev_foo() calls

2016-12-08 Thread Mauro Carvalho Chehab
Em Thu, 8 Dec 2016 23:28:14 +0200
Antti Palosaari  escreveu:

> Tested both patch 1 and 2 individually and bug is fixed.
> 
> Tested-by: Antti Palosaari 

Thanks for testing it!

> 
> However, some loggings are wrong as error level used instead of info. If 
> you has colors enabled those log levels are printed with different 
> colors, red is error and so.
> 
> These for example are printed as errors:
> em28xx 2-2:1.0: New device PCTV PCTV 292e @ 480 Mbps (2013:025f, 
> interface 0, class 0)
> em28xx 2-2:1.0: DVB interface 0 found: isoc
> em28xx 2-2:1.0: dvb set to isoc mode.
> 
> Not important issue, but probably those could be fixed at some point too.

That's likely like that for a long time... when this driver was written,
it was just using printk() without any level. At some point, we started
fixing it, but never finished, and kept it too verbose.

I'll address it.

> 
> regards
> Antti
> 
> 
> On 12/08/2016 09:43 PM, Mauro Carvalho Chehab wrote:
> > From: Mauro Carvalho Chehab 
> >
> > The usb_device->dev is not the right device for dev_foo() calls.
> > Instead, it should use usb_interface->dev.
> >
> > Signed-off-by: Mauro Carvalho Chehab 
> > Signed-off-by: Mauro Carvalho Chehab 
> > ---
> >  drivers/media/usb/em28xx/em28xx-audio.c  | 34 ++--
> >  drivers/media/usb/em28xx/em28xx-camera.c | 30 +--
> >  drivers/media/usb/em28xx/em28xx-cards.c  | 61 ++---
> >  drivers/media/usb/em28xx/em28xx-core.c   | 48 -
> >  drivers/media/usb/em28xx/em28xx-dvb.c| 61 ++---
> >  drivers/media/usb/em28xx/em28xx-i2c.c| 92 
> > 
> >  drivers/media/usb/em28xx/em28xx-input.c  | 32 +--
> >  drivers/media/usb/em28xx/em28xx-vbi.c|  2 +-
> >  drivers/media/usb/em28xx/em28xx-video.c  | 68 +++
> >  drivers/media/usb/em28xx/em28xx.h|  1 +
> >  10 files changed, 216 insertions(+), 213 deletions(-)
> >
> > diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
> > b/drivers/media/usb/em28xx/em28xx-audio.c
> > index 7060e5146e31..7f8601427b7f 100644
> > --- a/drivers/media/usb/em28xx/em28xx-audio.c
> > +++ b/drivers/media/usb/em28xx/em28xx-audio.c
> > @@ -56,7 +56,7 @@ MODULE_PARM_DESC(debug, "activates debug info");
> >
> >  #define dprintk(fmt, arg...) do {  \
> > if (debug)  \
> > -   dev_printk(KERN_DEBUG, &dev->udev->dev, \
> > +   dev_printk(KERN_DEBUG, &dev->intf->dev, \
> >"video: %s: " fmt, __func__, ## arg);\
> >  } while (0)
> >
> > @@ -166,7 +166,7 @@ static void em28xx_audio_isocirq(struct urb *urb)
> >
> > status = usb_submit_urb(urb, GFP_ATOMIC);
> > if (status < 0)
> > -   dev_err(&dev->udev->dev,
> > +   dev_err(&dev->intf->dev,
> > "resubmit of audio urb failed (error=%i)\n",
> > status);
> > return;
> > @@ -185,7 +185,7 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)
> >
> > errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC);
> > if (errCode) {
> > -   dev_err(&dev->udev->dev,
> > +   dev_err(&dev->intf->dev,
> > "submit of audio urb failed (error=%i)\n",
> > errCode);
> > em28xx_deinit_isoc_audio(dev);
> > @@ -322,7 +322,7 @@ static int snd_em28xx_capture_open(struct 
> > snd_pcm_substream *substream)
> >  err:
> > mutex_unlock(&dev->lock);
> >
> > -   dev_err(&dev->udev->dev,
> > +   dev_err(&dev->intf->dev,
> > "Error while configuring em28xx mixer\n");
> > return ret;
> >  }
> > @@ -761,7 +761,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
> > intf = usb_ifnum_to_if(dev->udev, dev->ifnum);
> >
> > if (intf->num_altsetting <= alt) {
> > -   dev_err(&dev->udev->dev, "alt %d doesn't exist on interface 
> > %d\n",
> > +   dev_err(&dev->intf->dev, "alt %d doesn't exist on interface 
> > %d\n",
> >   dev->ifnum, alt);
> > return -ENODEV;
> > }
> > @@ -777,14 +777,14 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
> > }
> >
> > if (!ep) {
> > -   dev_err(&dev->udev->dev, "Couldn't find an audio endpoint");
> > +   dev_err(&dev->intf->dev, "Couldn't find an audio endpoint");
> > return -ENODEV;
> > }
> >
> > ep_size = em28xx_audio_ep_packet_size(dev->udev, ep);
> > interval = 1 << (ep->bInterval - 1);
> >
> > -   dev_info(&dev->udev->dev,
> > +   dev_info(&dev->intf->dev,
> >  "Endpoint 0x%02x %s on intf %d alt %d interval = %d, size 
> > %d\n",
> >  EM28XX_EP_AUDIO, usb_speed_string(dev->udev->speed),
> >  dev->ifnum, alt, interval, ep_size);
> > @@ -824,7 +824,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
> > 

Re: [PATCH 2/3] [media] em28xx: use usb_interface for dev_foo() calls

2016-12-08 Thread Antti Palosaari

Tested both patch 1 and 2 individually and bug is fixed.

Tested-by: Antti Palosaari 

However, some loggings are wrong as error level used instead of info. If 
you has colors enabled those log levels are printed with different 
colors, red is error and so.


These for example are printed as errors:
em28xx 2-2:1.0: New device PCTV PCTV 292e @ 480 Mbps (2013:025f, 
interface 0, class 0)

em28xx 2-2:1.0: DVB interface 0 found: isoc
em28xx 2-2:1.0: dvb set to isoc mode.

Not important issue, but probably those could be fixed at some point too.

regards
Antti


On 12/08/2016 09:43 PM, Mauro Carvalho Chehab wrote:

From: Mauro Carvalho Chehab 

The usb_device->dev is not the right device for dev_foo() calls.
Instead, it should use usb_interface->dev.

Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/usb/em28xx/em28xx-audio.c  | 34 ++--
 drivers/media/usb/em28xx/em28xx-camera.c | 30 +--
 drivers/media/usb/em28xx/em28xx-cards.c  | 61 ++---
 drivers/media/usb/em28xx/em28xx-core.c   | 48 -
 drivers/media/usb/em28xx/em28xx-dvb.c| 61 ++---
 drivers/media/usb/em28xx/em28xx-i2c.c| 92 
 drivers/media/usb/em28xx/em28xx-input.c  | 32 +--
 drivers/media/usb/em28xx/em28xx-vbi.c|  2 +-
 drivers/media/usb/em28xx/em28xx-video.c  | 68 +++
 drivers/media/usb/em28xx/em28xx.h|  1 +
 10 files changed, 216 insertions(+), 213 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
b/drivers/media/usb/em28xx/em28xx-audio.c
index 7060e5146e31..7f8601427b7f 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -56,7 +56,7 @@ MODULE_PARM_DESC(debug, "activates debug info");

 #define dprintk(fmt, arg...) do {  \
if (debug)  \
-   dev_printk(KERN_DEBUG, &dev->udev->dev,   \
+   dev_printk(KERN_DEBUG, &dev->intf->dev,   \
   "video: %s: " fmt, __func__, ## arg);  \
 } while (0)

@@ -166,7 +166,7 @@ static void em28xx_audio_isocirq(struct urb *urb)

status = usb_submit_urb(urb, GFP_ATOMIC);
if (status < 0)
-   dev_err(&dev->udev->dev,
+   dev_err(&dev->intf->dev,
"resubmit of audio urb failed (error=%i)\n",
status);
return;
@@ -185,7 +185,7 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)

errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC);
if (errCode) {
-   dev_err(&dev->udev->dev,
+   dev_err(&dev->intf->dev,
"submit of audio urb failed (error=%i)\n",
errCode);
em28xx_deinit_isoc_audio(dev);
@@ -322,7 +322,7 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream 
*substream)
 err:
mutex_unlock(&dev->lock);

-   dev_err(&dev->udev->dev,
+   dev_err(&dev->intf->dev,
"Error while configuring em28xx mixer\n");
return ret;
 }
@@ -761,7 +761,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
intf = usb_ifnum_to_if(dev->udev, dev->ifnum);

if (intf->num_altsetting <= alt) {
-   dev_err(&dev->udev->dev, "alt %d doesn't exist on interface 
%d\n",
+   dev_err(&dev->intf->dev, "alt %d doesn't exist on interface 
%d\n",
  dev->ifnum, alt);
return -ENODEV;
}
@@ -777,14 +777,14 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
}

if (!ep) {
-   dev_err(&dev->udev->dev, "Couldn't find an audio endpoint");
+   dev_err(&dev->intf->dev, "Couldn't find an audio endpoint");
return -ENODEV;
}

ep_size = em28xx_audio_ep_packet_size(dev->udev, ep);
interval = 1 << (ep->bInterval - 1);

-   dev_info(&dev->udev->dev,
+   dev_info(&dev->intf->dev,
 "Endpoint 0x%02x %s on intf %d alt %d interval = %d, size 
%d\n",
 EM28XX_EP_AUDIO, usb_speed_string(dev->udev->speed),
 dev->ifnum, alt, interval, ep_size);
@@ -824,7 +824,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
if (urb_size > ep_size * npackets)
npackets = DIV_ROUND_UP(urb_size, ep_size);

-   dev_info(&dev->udev->dev,
+   dev_info(&dev->intf->dev,
 "Number of URBs: %d, with %d packets and %d size\n",
 num_urb, npackets, urb_size);

@@ -863,7 +863,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
buf = usb_alloc_coherent(dev->udev, npackets * ep_size, 
GFP_ATOMIC,
 &urb->transfer_dma);
if 

Re: [PATCH 3/3] [media] em28xx: don't store usb_device at struct em28xx

2016-12-08 Thread kbuild test robot
Hi Mauro,

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on next-20161208]
[cannot apply to v4.9-rc8]
[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/Mauro-Carvalho-Chehab/em28xx-don-t-change-the-device-s-name/20161209-035446
base:   git://linuxtv.org/media_tree.git master
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

   include/linux/compiler.h:253:8: sparse: attribute 'no_sanitize_address': 
unknown attribute
   drivers/media/usb/em28xx/em28xx-input.c:577:26: sparse: no member 'udev' in 
struct em28xx
   drivers/media/usb/em28xx/em28xx-input.c:589:32: sparse: no member 'udev' in 
struct em28xx
>> drivers/media/usb/em28xx/em28xx-input.c:589:32: sparse: cast from unknown 
>> type
   drivers/media/usb/em28xx/em28xx-input.c:590:33: sparse: no member 'udev' in 
struct em28xx
   drivers/media/usb/em28xx/em28xx-input.c:590:33: sparse: cast from unknown 
type
   drivers/media/usb/em28xx/em28xx-input.c:802:26: sparse: no member 'udev' in 
struct em28xx
   drivers/media/usb/em28xx/em28xx-input.c:809:31: sparse: no member 'udev' in 
struct em28xx
   drivers/media/usb/em28xx/em28xx-input.c:809:31: sparse: cast from unknown 
type
   drivers/media/usb/em28xx/em28xx-input.c:810:32: sparse: no member 'udev' in 
struct em28xx
   drivers/media/usb/em28xx/em28xx-input.c:810:32: sparse: cast from unknown 
type
   drivers/media/usb/em28xx/em28xx-input.c: In function 
'em28xx_register_snapshot_button':
   drivers/media/usb/em28xx/em28xx-input.c:577:19: error: 'struct em28xx' has 
no member named 'udev'; did you mean 'adev'?
 usb_make_path(dev->udev, dev->snapshot_button_path,
  ^~
   In file included from include/linux/byteorder/little_endian.h:4:0,
from arch/x86/include/uapi/asm/byteorder.h:4,
from include/asm-generic/bitops/le.h:5,
from arch/x86/include/asm/bitops.h:504,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from include/linux/list.h:8,
from include/linux/timer.h:4,
from include/linux/workqueue.h:8,
from drivers/media/usb/em28xx/em28xx.h:32,
from drivers/media/usb/em28xx/em28xx-input.c:24:
   drivers/media/usb/em28xx/em28xx-input.c:589:40: error: 'struct em28xx' has 
no member named 'udev'; did you mean 'adev'?
 input_dev->id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
   ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: in definition of 
macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
  ^
   drivers/media/usb/em28xx/em28xx-input.c:589:25: note: in expansion of macro 
'le16_to_cpu'
 input_dev->id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
^~~
   drivers/media/usb/em28xx/em28xx-input.c:590:41: error: 'struct em28xx' has 
no member named 'udev'; did you mean 'adev'?
 input_dev->id.product = le16_to_cpu(dev->udev->descriptor.idProduct);
^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: in definition of 
macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
  ^
   drivers/media/usb/em28xx/em28xx-input.c:590:26: note: in expansion of macro 
'le16_to_cpu'
 input_dev->id.product = le16_to_cpu(dev->udev->descriptor.idProduct);
 ^~~
   drivers/media/usb/em28xx/em28xx-input.c: In function 'em28xx_ir_init':
   drivers/media/usb/em28xx/em28xx-input.c:802:19: error: 'struct em28xx' has 
no member named 'udev'; did you mean 'adev'?
 usb_make_path(dev->udev, ir->phys, sizeof(ir->phys));
  ^~
   In file included from include/linux/byteorder/little_endian.h:4:0,
from arch/x86/include/uapi/asm/byteorder.h:4,
from include/asm-generic/bitops/le.h:5,
from arch/x86/include/asm/bitops.h:504,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from include/linux/list.h:8,
from include/linux/timer.h:4,
from include/linux/workqueue.h:8,
  

Re: [PATCH 3/3] [media] em28xx: don't store usb_device at struct em28xx

2016-12-08 Thread kbuild test robot
Hi Mauro,

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on next-20161208]
[cannot apply to v4.9-rc8]
[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/Mauro-Carvalho-Chehab/em28xx-don-t-change-the-device-s-name/20161209-035446
base:   git://linuxtv.org/media_tree.git master
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   drivers/media/usb/em28xx/em28xx-input.c: In function 
'em28xx_register_snapshot_button':
>> drivers/media/usb/em28xx/em28xx-input.c:577:19: error: 'struct em28xx' has 
>> no member named 'udev'; did you mean 'adev'?
 usb_make_path(dev->udev, dev->snapshot_button_path,
  ^~
   In file included from include/linux/byteorder/little_endian.h:4:0,
from arch/x86/include/uapi/asm/byteorder.h:4,
from include/asm-generic/bitops/le.h:5,
from arch/x86/include/asm/bitops.h:504,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from include/linux/list.h:8,
from include/linux/timer.h:4,
from include/linux/workqueue.h:8,
from drivers/media/usb/em28xx/em28xx.h:32,
from drivers/media/usb/em28xx/em28xx-input.c:24:
   drivers/media/usb/em28xx/em28xx-input.c:589:40: error: 'struct em28xx' has 
no member named 'udev'; did you mean 'adev'?
 input_dev->id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
   ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: in definition of 
macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
  ^
>> drivers/media/usb/em28xx/em28xx-input.c:589:25: note: in expansion of macro 
>> 'le16_to_cpu'
 input_dev->id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
^~~
   drivers/media/usb/em28xx/em28xx-input.c:590:41: error: 'struct em28xx' has 
no member named 'udev'; did you mean 'adev'?
 input_dev->id.product = le16_to_cpu(dev->udev->descriptor.idProduct);
^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: in definition of 
macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
  ^
   drivers/media/usb/em28xx/em28xx-input.c:590:26: note: in expansion of macro 
'le16_to_cpu'
 input_dev->id.product = le16_to_cpu(dev->udev->descriptor.idProduct);
 ^~~
   drivers/media/usb/em28xx/em28xx-input.c: In function 'em28xx_ir_init':
   drivers/media/usb/em28xx/em28xx-input.c:802:19: error: 'struct em28xx' has 
no member named 'udev'; did you mean 'adev'?
 usb_make_path(dev->udev, ir->phys, sizeof(ir->phys));
  ^~
   In file included from include/linux/byteorder/little_endian.h:4:0,
from arch/x86/include/uapi/asm/byteorder.h:4,
from include/asm-generic/bitops/le.h:5,
from arch/x86/include/asm/bitops.h:504,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from include/linux/list.h:8,
from include/linux/timer.h:4,
from include/linux/workqueue.h:8,
from drivers/media/usb/em28xx/em28xx.h:32,
from drivers/media/usb/em28xx/em28xx-input.c:24:
   drivers/media/usb/em28xx/em28xx-input.c:809:39: error: 'struct em28xx' has 
no member named 'udev'; did you mean 'adev'?
 rc->input_id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
  ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: in definition of 
macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
  ^
   drivers/media/usb/em28xx/em28xx-input.c:809:24: note: in expansion of macro 
'le16_to_cpu'
 rc->input_id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
   ^~~
   drivers/media/usb/em28xx/em28xx-input.c:810:40: error: 'struct em28xx' has 
no member named 'udev'; did you mean 'adev'?
  

Re: [PATCH 3/3] [media] em28xx: don't store usb_device at struct em28xx

2016-12-08 Thread kbuild test robot
Hi Mauro,

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on next-20161208]
[cannot apply to v4.9-rc8]
[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/Mauro-Carvalho-Chehab/em28xx-don-t-change-the-device-s-name/20161209-035446
base:   git://linuxtv.org/media_tree.git master
config: i386-randconfig-i1-201649 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/media/usb/em28xx/em28xx-input.c: In function 
'em28xx_register_snapshot_button':
>> drivers/media/usb/em28xx/em28xx-input.c:577:19: error: 'struct em28xx' has 
>> no member named 'udev'
 usb_make_path(dev->udev, dev->snapshot_button_path,
  ^
   In file included from include/linux/byteorder/little_endian.h:4:0,
from arch/x86/include/uapi/asm/byteorder.h:4,
from include/asm-generic/bitops/le.h:5,
from arch/x86/include/asm/bitops.h:504,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from include/linux/list.h:8,
from include/linux/timer.h:4,
from include/linux/workqueue.h:8,
from drivers/media/usb/em28xx/em28xx.h:32,
from drivers/media/usb/em28xx/em28xx-input.c:24:
   drivers/media/usb/em28xx/em28xx-input.c:589:40: error: 'struct em28xx' has 
no member named 'udev'
 input_dev->id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
   ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: in definition of 
macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
  ^
   drivers/media/usb/em28xx/em28xx-input.c:589:25: note: in expansion of macro 
'le16_to_cpu'
 input_dev->id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
^
   drivers/media/usb/em28xx/em28xx-input.c:590:41: error: 'struct em28xx' has 
no member named 'udev'
 input_dev->id.product = le16_to_cpu(dev->udev->descriptor.idProduct);
^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: in definition of 
macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
  ^
   drivers/media/usb/em28xx/em28xx-input.c:590:26: note: in expansion of macro 
'le16_to_cpu'
 input_dev->id.product = le16_to_cpu(dev->udev->descriptor.idProduct);
 ^
   drivers/media/usb/em28xx/em28xx-input.c: In function 'em28xx_ir_init':
   drivers/media/usb/em28xx/em28xx-input.c:802:19: error: 'struct em28xx' has 
no member named 'udev'
 usb_make_path(dev->udev, ir->phys, sizeof(ir->phys));
  ^
   In file included from include/linux/byteorder/little_endian.h:4:0,
from arch/x86/include/uapi/asm/byteorder.h:4,
from include/asm-generic/bitops/le.h:5,
from arch/x86/include/asm/bitops.h:504,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from include/linux/list.h:8,
from include/linux/timer.h:4,
from include/linux/workqueue.h:8,
from drivers/media/usb/em28xx/em28xx.h:32,
from drivers/media/usb/em28xx/em28xx-input.c:24:
   drivers/media/usb/em28xx/em28xx-input.c:809:39: error: 'struct em28xx' has 
no member named 'udev'
 rc->input_id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
  ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: in definition of 
macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
  ^
   drivers/media/usb/em28xx/em28xx-input.c:809:24: note: in expansion of macro 
'le16_to_cpu'
 rc->input_id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor);
   ^
   drivers/media/usb/em28xx/em28xx-input.c:810:40: error: 'struct em28xx' has 
no member named 'udev'
 rc->input_id.product = le16_to_cpu(dev->udev->descriptor.idProduct);
   ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: in definition of 
macro '__le16_to_cpu'
#define __l

Re: [PATCH v3] [media] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread kbuild test robot
Hi Mauro,

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.9-rc8 next-20161208]
[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/Mauro-Carvalho-Chehab/tvp5150-don-t-touch-register-TVP5150_CONF_SHARED_PIN-if-not-needed/20161209-040023
base:   git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-x005-201649 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/media/i2c/tvp5150.c: In function 'tvp5150_probe':
>> drivers/media/i2c/tvp5150.c:1489:3: error: 'decoder' undeclared (first use 
>> in this function)
  decoder->has_dt = true;
  ^~~
   drivers/media/i2c/tvp5150.c:1489:3: note: each undeclared identifier is 
reported only once for each function it appears in

vim +/decoder +1489 drivers/media/i2c/tvp5150.c

  1483  if (IS_ENABLED(CONFIG_OF) && np) {
  1484  res = tvp5150_parse_dt(core, np);
  1485  if (res) {
  1486  dev_err(sd->dev, "DT parsing error: %d\n", res);
  1487  return res;
  1488  }
> 1489  decoder->has_dt = true;
  1490  } else {
  1491  /* Default to BT.656 embedded sync */
  1492  core->mbus_type = V4L2_MBUS_BT656;

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH v3] [media] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Mauro Carvalho Chehab
Em Thu, 8 Dec 2016 17:51:02 -0200
Mauro Carvalho Chehab  escreveu:

> Em Thu,  8 Dec 2016 17:46:53 -0200
> Mauro Carvalho Chehab  escreveu:
> 
> > commit 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
> > support") added a logic that overrides TVP5150_CONF_SHARED_PIN setting,
> > depending on the type of bus set via the .set_fmt() subdev callback.
> > 
> > This is known to cause trobules on devices that don't use a V4L2
> > subdev devnode, and a fix for it was made by commit 47de9bf8931e
> > ("[media] tvp5150: Fix breakage for serial usage"). Unfortunately,
> > such fix doesn't consider the case of progressive video inputs,
> > causing chroma decoding issues on such videos, as it overrides not
> > only the type of video output, but also other unrelated bits.
> > 
> > So, instead of trying to guess, let's detect if the device configuration
> > is set via Device Tree. If not, just ignore the new logic, restoring
> > the original behavior.
> > 
> > Fixes: 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation 
> > support")
> > Cc: Devin Heitmueller 
> > Cc: Javier Martinez Canillas 
> > Cc: Laurent Pinchart 
> > Cc: sta...@vger.kernel.org
> > Signed-off-by: Mauro Carvalho Chehab 
> > ---
> > 
> > changes since version 2: 
> >   - fixed settings for register 0x0d
> >   - tested on WinTV USB2 with S-Video input
> > 
> > I'll do an extra test with HVR-950 on both S-Video and composite soon 
> > enough  
> 
> Tested with HVR-950 (USB ID 2040:6513, Hauppauge model 65201, rev A1C0):
>   - both S-Video and composite entries are working.

Devin,

Btw, if you're willing to test it against the latest Kernel, I recommend
you to also apply the three em28xx patches I just sent upstream, as they
fix a regression with the conversion to dev_foo() print on em28xx driver,
reported by Antti, with happens when removing the em28xx driver from memory.

Such regression happened only at the 4.9-rc development cycle, so it 
shouldn't affect any earlier versions of em28xx.

I'm placing all 4 patches under this branch:
https://git.linuxtv.org/mchehab/experimental.git/log/?h=em28xx-fixes

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


Re: [PATCH v3] [media] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Mauro Carvalho Chehab
Em Thu,  8 Dec 2016 17:46:53 -0200
Mauro Carvalho Chehab  escreveu:

> commit 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
> support") added a logic that overrides TVP5150_CONF_SHARED_PIN setting,
> depending on the type of bus set via the .set_fmt() subdev callback.
> 
> This is known to cause trobules on devices that don't use a V4L2
> subdev devnode, and a fix for it was made by commit 47de9bf8931e
> ("[media] tvp5150: Fix breakage for serial usage"). Unfortunately,
> such fix doesn't consider the case of progressive video inputs,
> causing chroma decoding issues on such videos, as it overrides not
> only the type of video output, but also other unrelated bits.
> 
> So, instead of trying to guess, let's detect if the device configuration
> is set via Device Tree. If not, just ignore the new logic, restoring
> the original behavior.
> 
> Fixes: 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation support")
> Cc: Devin Heitmueller 
> Cc: Javier Martinez Canillas 
> Cc: Laurent Pinchart 
> Cc: sta...@vger.kernel.org
> Signed-off-by: Mauro Carvalho Chehab 
> ---
> 
> changes since version 2: 
>   - fixed settings for register 0x0d
>   - tested on WinTV USB2 with S-Video input
> 
> I'll do an extra test with HVR-950 on both S-Video and composite soon enough

Tested with HVR-950 (USB ID 2040:6513, Hauppauge model 65201, rev A1C0):
- both S-Video and composite entries are working.

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


[PATCH v3] [media] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Mauro Carvalho Chehab
commit 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
support") added a logic that overrides TVP5150_CONF_SHARED_PIN setting,
depending on the type of bus set via the .set_fmt() subdev callback.

This is known to cause trobules on devices that don't use a V4L2
subdev devnode, and a fix for it was made by commit 47de9bf8931e
("[media] tvp5150: Fix breakage for serial usage"). Unfortunately,
such fix doesn't consider the case of progressive video inputs,
causing chroma decoding issues on such videos, as it overrides not
only the type of video output, but also other unrelated bits.

So, instead of trying to guess, let's detect if the device configuration
is set via Device Tree. If not, just ignore the new logic, restoring
the original behavior.

Fixes: 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation support")
Cc: Devin Heitmueller 
Cc: Javier Martinez Canillas 
Cc: Laurent Pinchart 
Cc: sta...@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab 
---

changes since version 2: 
  - fixed settings for register 0x0d
  - tested on WinTV USB2 with S-Video input

I'll do an extra test with HVR-950 on both S-Video and composite soon enough

changes since version 1: added a notice about what's broken at the
tvp5150_stream() logic, and improved patch's description.

changes since RFC: don't touch at enum v4l2_mbus_type.

 drivers/media/i2c/tvp5150.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 6737685d5be5..8b9d2fad17df 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -57,6 +57,7 @@ struct tvp5150 {
u16 rom_ver;
 
enum v4l2_mbus_type mbus_type;
+   bool has_dt;
 };
 
 static inline struct tvp5150 *to_tvp5150(struct v4l2_subdev *sd)
@@ -1053,6 +1054,20 @@ static int tvp5150_s_stream(struct v4l2_subdev *sd, int 
enable)
/* Output format: 8-bit ITU-R BT.656 with embedded syncs */
int val = 0x09;
 
+   if (!decoder->has_dt)
+   return 0;
+
+   /*
+* FIXME: the logic below is hardcoded to work with some OMAP3
+* hardware with tvp5151. As such, it hardcodes values for
+* both TVP5150_CONF_SHARED_PIN and TVP5150_MISC_CTL, and ignores
+* what was set before at the driver. Ideally, we should have
+* DT nodes describing the setup, instead of hardcoding those
+* values, and doing a read before writing values to
+* TVP5150_MISC_CTL, but any patch adding support for it should
+* keep DT backward-compatible.
+*/
+
/* Output format: 8-bit 4:2:2 YUV with discrete sync */
if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
val = 0x0d;
@@ -1471,6 +1486,7 @@ static int tvp5150_probe(struct i2c_client *c,
dev_err(sd->dev, "DT parsing error: %d\n", res);
return res;
}
+   decoder->has_dt = true;
} else {
/* Default to BT.656 embedded sync */
core->mbus_type = V4L2_MBUS_BT656;
-- 
2.9.3


--
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 2/3] [media] em28xx: use usb_interface for dev_foo() calls

2016-12-08 Thread Mauro Carvalho Chehab
From: Mauro Carvalho Chehab 

The usb_device->dev is not the right device for dev_foo() calls.
Instead, it should use usb_interface->dev.

Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/usb/em28xx/em28xx-audio.c  | 34 ++--
 drivers/media/usb/em28xx/em28xx-camera.c | 30 +--
 drivers/media/usb/em28xx/em28xx-cards.c  | 61 ++---
 drivers/media/usb/em28xx/em28xx-core.c   | 48 -
 drivers/media/usb/em28xx/em28xx-dvb.c| 61 ++---
 drivers/media/usb/em28xx/em28xx-i2c.c| 92 
 drivers/media/usb/em28xx/em28xx-input.c  | 32 +--
 drivers/media/usb/em28xx/em28xx-vbi.c|  2 +-
 drivers/media/usb/em28xx/em28xx-video.c  | 68 +++
 drivers/media/usb/em28xx/em28xx.h|  1 +
 10 files changed, 216 insertions(+), 213 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
b/drivers/media/usb/em28xx/em28xx-audio.c
index 7060e5146e31..7f8601427b7f 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -56,7 +56,7 @@ MODULE_PARM_DESC(debug, "activates debug info");
 
 #define dprintk(fmt, arg...) do {  \
if (debug)  \
-   dev_printk(KERN_DEBUG, &dev->udev->dev, \
+   dev_printk(KERN_DEBUG, &dev->intf->dev, \
   "video: %s: " fmt, __func__, ## arg);\
 } while (0)
 
@@ -166,7 +166,7 @@ static void em28xx_audio_isocirq(struct urb *urb)
 
status = usb_submit_urb(urb, GFP_ATOMIC);
if (status < 0)
-   dev_err(&dev->udev->dev,
+   dev_err(&dev->intf->dev,
"resubmit of audio urb failed (error=%i)\n",
status);
return;
@@ -185,7 +185,7 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)
 
errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC);
if (errCode) {
-   dev_err(&dev->udev->dev,
+   dev_err(&dev->intf->dev,
"submit of audio urb failed (error=%i)\n",
errCode);
em28xx_deinit_isoc_audio(dev);
@@ -322,7 +322,7 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream 
*substream)
 err:
mutex_unlock(&dev->lock);
 
-   dev_err(&dev->udev->dev,
+   dev_err(&dev->intf->dev,
"Error while configuring em28xx mixer\n");
return ret;
 }
@@ -761,7 +761,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
intf = usb_ifnum_to_if(dev->udev, dev->ifnum);
 
if (intf->num_altsetting <= alt) {
-   dev_err(&dev->udev->dev, "alt %d doesn't exist on interface 
%d\n",
+   dev_err(&dev->intf->dev, "alt %d doesn't exist on interface 
%d\n",
  dev->ifnum, alt);
return -ENODEV;
}
@@ -777,14 +777,14 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
}
 
if (!ep) {
-   dev_err(&dev->udev->dev, "Couldn't find an audio endpoint");
+   dev_err(&dev->intf->dev, "Couldn't find an audio endpoint");
return -ENODEV;
}
 
ep_size = em28xx_audio_ep_packet_size(dev->udev, ep);
interval = 1 << (ep->bInterval - 1);
 
-   dev_info(&dev->udev->dev,
+   dev_info(&dev->intf->dev,
 "Endpoint 0x%02x %s on intf %d alt %d interval = %d, size 
%d\n",
 EM28XX_EP_AUDIO, usb_speed_string(dev->udev->speed),
 dev->ifnum, alt, interval, ep_size);
@@ -824,7 +824,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
if (urb_size > ep_size * npackets)
npackets = DIV_ROUND_UP(urb_size, ep_size);
 
-   dev_info(&dev->udev->dev,
+   dev_info(&dev->intf->dev,
 "Number of URBs: %d, with %d packets and %d size\n",
 num_urb, npackets, urb_size);
 
@@ -863,7 +863,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
buf = usb_alloc_coherent(dev->udev, npackets * ep_size, 
GFP_ATOMIC,
 &urb->transfer_dma);
if (!buf) {
-   dev_err(&dev->udev->dev,
+   dev_err(&dev->intf->dev,
"usb_alloc_coherent failed!\n");
em28xx_audio_free_urb(dev);
return -ENOMEM;
@@ -904,16 +904,16 @@ static int em28xx_audio_init(struct em28xx *dev)
return 0;
}
 
-   dev_info(&dev->udev->dev, "Binding audio extension\n");
+   dev_info(&dev->intf->dev, "Binding audio extension\n");
 
kref_get(&dev->ref);
 
-   dev_info(&dev->udev->dev,
+   dev_info(&dev->intf->dev,

[PATCH 1/3] [media] em28xx: don't change the device's name

2016-12-08 Thread Mauro Carvalho Chehab
From: Mauro Carvalho Chehab 

Changing the device name, causes it to be unable to remove the
sysfs file, causing troubles if a device is removed and then
re-inserted.

[ 1010.310320] WARNING: CPU: 3 PID: 119 at fs/sysfs/dir.c:31 
sysfs_warn_dup+0x7b/0x90
[ 1010.310323] sysfs: cannot create duplicate filename '/bus/usb/devices/1-3.3'
[ 1010.310325] Modules linked in: lgdt330x em28xx_dvb dvb_core em28xx_alsa 
tuner_xc2028 tuner tvp5150 em28xx_v4l videobuf2_vmalloc videobuf2_memops 
videobuf2_v4l2 videobuf2_core em28xx tveeprom v4l2_common videodev media 
xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat 
nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack 
ipt_REJECT nf_reject_ipv4 xt_tcpudp tun bridge stp llc ebtable_filter ebtables 
ip6table_filter ip6_tables iptable_filter ip_tables x_tables cmac bnep 
cpufreq_powersave cpufreq_conservative cpufreq_userspace binfmt_misc parport_pc 
ppdev lp parport snd_hda_codec_hdmi iTCO_wdt snd_hda_codec_realtek 
iTCO_vendor_support snd_hda_codec_generic arc4 intel_rapl x86_pkg_temp_thermal 
iwlmvm intel_powerclamp coretemp kvm_intel mac80211 kvm i915
[ 1010.310383]  irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel 
iwlwifi pl2303 aesni_intel btusb aes_x86_64 usbserial lrw btrtl gf128mul 
glue_helper btbcm ablk_helper cryptd btintel bluetooth drm_kms_helper cfg80211 
drm psmouse pcspkr i2c_i801 e1000e serio_raw snd_hda_intel snd_soc_rt5640 
snd_hda_codec snd_soc_rl6231 snd_soc_ssm4567 mei_me i2c_smbus rfkill 
snd_hda_core ptp mei snd_soc_core ehci_pci sg lpc_ich shpchp mfd_core ehci_hcd 
pps_core snd_hwdep i2c_algo_bit snd_compress snd_pcm sdhci_acpi snd_timer 
battery snd sdhci elan_i2c snd_soc_sst_acpi mmc_core fjes dw_dmac i2c_hid 
soundcore snd_soc_sst_match i2c_designware_platform video i2c_designware_core 
acpi_pad acpi_als kfifo_buf tpm_tis button industrialio tpm_tis_core tpm ext4 
crc16 jbd2 fscrypto mbcache dm_mod joydev evdev hid_logitech_hidpp
[ 1010.310449]  sd_mod hid_logitech_dj usbhid hid ahci libahci crc32c_intel 
libata xhci_pci xhci_hcd scsi_mod usbcore fan thermal
[ 1010.310464] CPU: 3 PID: 119 Comm: kworker/3:2 Not tainted 4.9.0-rc8+ #14
[ 1010.310466] Hardware name:  /NUC5i7RYB, BIOS 
RYBDWi35.86A.0350.2015.0812.1722 08/12/2015
[ 1010.310487] Workqueue: usb_hub_wq hub_event [usbcore]
[ 1010.310490]   848f56c5 8803b1f7f858 

[ 1010.310496]  8414f8f8 8803001f ed00763eff07 
8803b1f7f8f0
[ 1010.310501]  8803b3ea1e60 0001 ffef 
8803b45c6840
[ 1010.310505] Call Trace:
[ 1010.310517]  [] ? dump_stack+0x5c/0x77
[ 1010.310522]  [] ? __warn+0x168/0x1a0
[ 1010.310526]  [] ? warn_slowpath_fmt+0xb4/0xf0
[ 1010.310529]  [] ? __warn+0x1a0/0x1a0
[ 1010.310534]  [] ? kasan_kmalloc+0xa6/0xd0
[ 1010.310539]  [] ? kernfs_path_from_node+0x4a/0x60
[ 1010.310543]  [] ? sysfs_warn_dup+0x7b/0x90
[ 1010.310547]  [] ? sysfs_do_create_link_sd.isra.2+0xb6/0xd0
[ 1010.310553]  [] ? bus_add_device+0x318/0x6b0
[ 1010.310557]  [] ? sysfs_create_groups+0x83/0x110
[ 1010.310562]  [] ? device_add+0x777/0x1350
[ 1010.310567]  [] ? device_private_init+0x180/0x180
[ 1010.310583]  [] ? usb_new_device+0x707/0x1030 [usbcore]
[ 1010.310598]  [] ? hub_event+0x1d65/0x3280 [usbcore]
[ 1010.310604]  [] ? account_entity_dequeue+0x30b/0x4a0
[ 1010.310618]  [] ? hub_port_debounce+0x280/0x280 [usbcore]
[ 1010.310624]  [] ? compat_start_thread+0x80/0x80
[ 1010.310629]  [] ? __schedule+0x704/0x1770
[ 1010.310633]  [] ? io_schedule_timeout+0x390/0x390
[ 1010.310638]  [] ? cache_reap+0x173/0x200
[ 1010.310642]  [] ? process_one_work+0x4ed/0xe60
[ 1010.310646]  [] ? worker_thread+0xe2/0xfd0
[ 1010.310650]  [] ? __wake_up_common+0xbc/0x160
[ 1010.310654]  [] ? process_one_work+0xe60/0xe60
[ 1010.310658]  [] ? kthread+0x1cc/0x220
[ 1010.310663]  [] ? kthread_park+0x80/0x80
[ 1010.310667]  [] ? kthread_park+0x80/0x80
[ 1010.310671]  [] ? kthread_park+0x80/0x80
[ 1010.310675]  [] ? ret_from_fork+0x25/0x30

Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/usb/em28xx/em28xx-cards.c | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-cards.c 
b/drivers/media/usb/em28xx/em28xx-cards.c
index b516c691b9eb..50e4c6e51ee7 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -3236,8 +3236,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct 
usb_device *udev,
   int minor)
 {
int retval;
-   static const char *default_chip_name = "em28xx";
-   const char *chip_name = default_chip_name;
+   const char *chip_name = NULL;
 
dev->udev = udev;
mutex_init(&dev->ctrl_urb_lock);
@@ -3324,14 +3323,9 @@ static int em28xx_init_dev(struct em28xx *dev, struct 
usb_device *udev,
break;
}
  

[PATCH 3/3] [media] em28xx: don't store usb_device at struct em28xx

2016-12-08 Thread Mauro Carvalho Chehab
From: Mauro Carvalho Chehab 

Now that we're storing usb_interface at em28xx struct,
there's no good reason to keep storing usb_device, as we can
get it from usb_interface. So, get rid of it.

Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/usb/em28xx/em28xx-audio.c | 22 +-
 drivers/media/usb/em28xx/em28xx-cards.c | 10 +-
 drivers/media/usb/em28xx/em28xx-core.c  | 29 +
 drivers/media/usb/em28xx/em28xx-dvb.c   |  3 ++-
 drivers/media/usb/em28xx/em28xx-video.c |  9 ++---
 drivers/media/usb/em28xx/em28xx.h   |  1 -
 6 files changed, 43 insertions(+), 31 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
b/drivers/media/usb/em28xx/em28xx-audio.c
index 7f8601427b7f..47521211bf86 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -256,6 +256,7 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream 
*substream)
 {
struct em28xx *dev = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
+   struct usb_device *udev = interface_to_usbdev(dev->intf);
int nonblock, ret = 0;
 
if (!dev) {
@@ -296,7 +297,7 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream 
*substream)
 */
dprintk("changing alternate number on interface %d to 
%d\n",
dev->ifnum, dev->alt);
-   usb_set_interface(dev->udev, dev->ifnum, dev->alt);
+   usb_set_interface(udev, dev->ifnum, dev->alt);
}
 
/* Sets volume, mute, etc */
@@ -714,6 +715,7 @@ static const struct snd_pcm_ops snd_em28xx_pcm_capture = {
 
 static void em28xx_audio_free_urb(struct em28xx *dev)
 {
+   struct usb_device *udev = interface_to_usbdev(dev->intf);
int i;
 
for (i = 0; i < dev->adev.num_urb; i++) {
@@ -722,7 +724,7 @@ static void em28xx_audio_free_urb(struct em28xx *dev)
if (!urb)
continue;
 
-   usb_free_coherent(dev->udev, urb->transfer_buffer_length,
+   usb_free_coherent(udev, urb->transfer_buffer_length,
  dev->adev.transfer_buffer[i],
  urb->transfer_dma);
 
@@ -749,6 +751,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
 {
struct usb_interface *intf;
struct usb_endpoint_descriptor *e, *ep = NULL;
+   struct usb_device *udev = interface_to_usbdev(dev->intf);
int i, ep_size, interval, num_urb, npackets;
int urb_size, bytes_per_transfer;
u8 alt;
@@ -758,7 +761,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
else
alt = 7;
 
-   intf = usb_ifnum_to_if(dev->udev, dev->ifnum);
+   intf = usb_ifnum_to_if(udev, dev->ifnum);
 
if (intf->num_altsetting <= alt) {
dev_err(&dev->intf->dev, "alt %d doesn't exist on interface 
%d\n",
@@ -781,12 +784,12 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
return -ENODEV;
}
 
-   ep_size = em28xx_audio_ep_packet_size(dev->udev, ep);
+   ep_size = em28xx_audio_ep_packet_size(udev, ep);
interval = 1 << (ep->bInterval - 1);
 
dev_info(&dev->intf->dev,
 "Endpoint 0x%02x %s on intf %d alt %d interval = %d, size 
%d\n",
-EM28XX_EP_AUDIO, usb_speed_string(dev->udev->speed),
+EM28XX_EP_AUDIO, usb_speed_string(udev->speed),
 dev->ifnum, alt, interval, ep_size);
 
/* Calculate the number and size of URBs to better fit the audio 
samples */
@@ -860,7 +863,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
}
dev->adev.urb[i] = urb;
 
-   buf = usb_alloc_coherent(dev->udev, npackets * ep_size, 
GFP_ATOMIC,
+   buf = usb_alloc_coherent(udev, npackets * ep_size, GFP_ATOMIC,
 &urb->transfer_dma);
if (!buf) {
dev_err(&dev->intf->dev,
@@ -870,9 +873,9 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
}
dev->adev.transfer_buffer[i] = buf;
 
-   urb->dev = dev->udev;
+   urb->dev = udev;
urb->context = dev;
-   urb->pipe = usb_rcvisocpipe(dev->udev, EM28XX_EP_AUDIO);
+   urb->pipe = usb_rcvisocpipe(udev, EM28XX_EP_AUDIO);
urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
urb->transfer_buffer = buf;
urb->interval = interval;
@@ -892,6 +895,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
 static int em28xx_audio_init(struct em28xx *dev)
 {
struct em28xx_audio *adev = &dev->adev;
+   struct usb_device *

Re: [PATCH] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Mauro Carvalho Chehab
Hi Devin,

Em Thu, 8 Dec 2016 12:50:19 -0500
Devin Heitmueller  escreveu:

> Hi Mauro, Laurent,
> 
> I tried out Mauro's latest patch (9:46am EST), and it appears to at
> least partially address the issue, but still doesn't work.  In fact,
> whereas before I was getting stable video with a chroma issue, with
> the patch applied I'm now getting no video at all (i.e. tvtime is
> completely blocked waiting for frames to arrive).
> 
> First off, a register dump does show that register 0x03 is now 0x6F,
> so at least that part is working.  However, TVP5150_DATA_RATE_SEL,
> (register 0x0D) is now being set to 0x40, whereas it needs to be set
> to 0x47 to work properly.  Just to confirm, I started up tvtime and
> fed the device the following command, at which point video started
> rendering properly:
> 
> sudo v4l2-dbg --chip=subdev0 --set-register=0x0d 0x47
> 
> I'm not sitting in front of the datasheet right now so I cannot
> suggest what the correct fix is, but at first glance it looks like the
> first hunk of Mauro's patch isn't correct for em28xx devices.
> 
> Also worth noting for the moment I'm testing exclusively with
> composite on the HVR-850.  Once we've got that working, I'll dig out
> an s-video cable and make sure that is working too.

Thanks for testing! Just tested here with S-Video, with WinTV USB2
(with interlaced video, generated with vivid + HVR-350).

I was able to reproduce the same issue as you: changing register 0x0d
to 0x47 indeed made it work.

I'm working on a followup patch.

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


Re: [PATCH] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Laurent Pinchart
Hi Devin,

On Thursday 08 Dec 2016 12:50:19 Devin Heitmueller wrote:
> Hi Mauro, Laurent,
> 
> I tried out Mauro's latest patch (9:46am EST), and it appears to at
> least partially address the issue, but still doesn't work.  In fact,
> whereas before I was getting stable video with a chroma issue, with
> the patch applied I'm now getting no video at all (i.e. tvtime is
> completely blocked waiting for frames to arrive).
> 
> First off, a register dump does show that register 0x03 is now 0x6F,
> so at least that part is working.  However, TVP5150_DATA_RATE_SEL,
> (register 0x0D) is now being set to 0x40, whereas it needs to be set
> to 0x47 to work properly.  Just to confirm, I started up tvtime and
> fed the device the following command, at which point video started
> rendering properly:
> 
> sudo v4l2-dbg --chip=subdev0 --set-register=0x0d 0x47
> 
> I'm not sitting in front of the datasheet right now so I cannot
> suggest what the correct fix is, but at first glance it looks like the
> first hunk of Mauro's patch isn't correct for em28xx devices.
> 
> Also worth noting for the moment I'm testing exclusively with
> composite on the HVR-850.  Once we've got that working, I'll dig out
> an s-video cable and make sure that is working too.

Thanks for your offer to test patches. I'm working on a proper fix and should 
be able to finish it tonight.

Feel free to contact me on IRC if you want to discuss the fix live, it could 
be faster than over e-mail.

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Devin Heitmueller
Hi Mauro, Laurent,

I tried out Mauro's latest patch (9:46am EST), and it appears to at
least partially address the issue, but still doesn't work.  In fact,
whereas before I was getting stable video with a chroma issue, with
the patch applied I'm now getting no video at all (i.e. tvtime is
completely blocked waiting for frames to arrive).

First off, a register dump does show that register 0x03 is now 0x6F,
so at least that part is working.  However, TVP5150_DATA_RATE_SEL,
(register 0x0D) is now being set to 0x40, whereas it needs to be set
to 0x47 to work properly.  Just to confirm, I started up tvtime and
fed the device the following command, at which point video started
rendering properly:

sudo v4l2-dbg --chip=subdev0 --set-register=0x0d 0x47

I'm not sitting in front of the datasheet right now so I cannot
suggest what the correct fix is, but at first glance it looks like the
first hunk of Mauro's patch isn't correct for em28xx devices.

Also worth noting for the moment I'm testing exclusively with
composite on the HVR-850.  Once we've got that working, I'll dig out
an s-video cable and make sure that is working too.

Cheers,

Devin


On Thu, Dec 8, 2016 at 10:22 AM, Laurent Pinchart
 wrote:
> On Thursday 08 Dec 2016 12:16:08 Mauro Carvalho Chehab wrote:
>> Em Thu, 08 Dec 2016 15:41:59 +0200 Laurent Pinchart escreveu:
>> > On Thursday 08 Dec 2016 11:38:34 Mauro Carvalho Chehab wrote:
>> > > changeset 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
>> > > support") added a logic that overrides TVP5150_CONF_SHARED_PIN setting,
>> > > depending on the type of bus set via the .set_fmt() subdev callback.
>> > >
>> > > This is known to cause trobules on devices that don't use a V4L2
>> > > subdev devnode, and a fix for it was made by changeset 47de9bf8931e
>> > > ("[media] tvp5150: Fix breakage for serial usage"). Unfortunately,
>> > > such fix doesn't consider the case of progressive video inputs,
>> > > causing chroma decoding issues on such videos, as it overrides not
>> > > only the type of video output, but also other unrelated bits.
>> > >
>> > > So, instead of trying to guess, let's detect if the device is set
>> > > via Device Tree. If not, just ignore the bogus logic.
>> >
>> > If you add a big [HACK] tag to the subject line, sure. I thought this
>> > would have been an occasion to fix the problem correctly :-(
>>
>> No, this is not a hack.
>>
>> It is a patch that restores the driver behavior that used to be
>> before adding DT support to the driver. Whatever DT-based drivers
>> need, it *should not* change the behavior for devices that don't
>> use DT.
>
> 1. This has nothing to do with DT, but with the addition of the s_stream()
> operation.
>
> 2. When I added s_stream() support the em28xx driver did not call s_stream(1).
> That has been changed by
>
> commit 13d52fe40f1f7bbad49128e8ee6a2fe5e13dd18d
> Author: Mauro Carvalho Chehab 
> Date:   Tue Jan 26 06:59:39 2016 -0200
>
> [media] em28xx: fix implementation of s_stream
>
> On em28xx driver, s_stream subdev ops was not implemented
> properly. It was used only to disable stream, never enabling it.
> That was the root cause of the regression when we added support
> for s_stream on tvp5150 driver.
>
> With that, we can get rid of the changes on tvp5150 side,
> e. g. changeset 47de9bf8931e ('[media] tvp5150: Fix breakage for serial
> usage').
>
> Tested video output on em2820+tvp5150 on WinTV USB2 and
> video and/or vbi output on em288x+tvp5150 on HVR 950.
>
> Signed-off-by: Mauro Carvalho Chehab 
>
> 3. There's clearly a bug in the current implementation, and it needs to be
> fixed. That fact does not turn every attempt to address the bug into proper
> fixes by magic. Hacks remain hacks.
>
> 4. I'm working on a proper fix.
>
>> I agree with you that the patch is incomplete, as it doesn't
>> add any OF var that would allow DT to specify the values
>> to be used for TVP5150_CONF_SHARED_PIN and TVP5150_MISC_CTL,
>> and assumes that tvp5150, tvp5151 and tvp5150am1 will all use
>> the same values for TVP5150_MISC_CTL.
>>
>> In order to fix that, someone with a DT-based driver with tvp5150,
>> tvp5150am1 and/or tvp5151 would need to spend some time and test
>> the hardware with both interlaced and progressive video inputs.
>>
>> That's not me, as I don't have any hardware that meets such requirement.
>>
>> If someone ships me such hardware, I could work on it on my spare time.
>> Otherwise, then perhaps you could work on such patch - or we could ping
>> Javier on Monday and see if has time/interest to work on it (afaikt, he's
>> OOT the rest of this week).
>>
>> Anyway, with this patch applied, the one working on such fix won't need
>> to be concerned to cause new regressions on the non-DT drivers that use
>> this chip, with is, IMHO, a very good thing.
>>
>> Also, this patch is simple enough to be backported to -stable.
>>
>> What's missing here is a notice explaining what's left to be done,
>> lik

Re: [PATCH 9/9] [media] coda: support YUYV output if VDOA is used

2016-12-08 Thread Philipp Zabel
Am Donnerstag, den 08.12.2016, 16:24 +0100 schrieb Michael Tretter:
> The VDOA is able to transform the NV12 custom macroblock tiled format of
> the CODA to YUYV format. If and only if the VDOA is available, the
> driver can also provide YUYV support.
> 
> While the driver is configured to produce YUYV output, the CODA must be
> configured to produce NV12 macroblock tiled frames and the VDOA must
> transform the intermediate result into the final YUYV output.
> 
> Signed-off-by: Michael Tretter 

Reviewed-by: Philipp Zabel 

> ---
>  drivers/media/platform/coda/coda-bit.c|  7 +--
>  drivers/media/platform/coda/coda-common.c | 30 ++
>  2 files changed, 35 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/coda/coda-bit.c 
> b/drivers/media/platform/coda/coda-bit.c
> index 3e2f830..b94ba62 100644
> --- a/drivers/media/platform/coda/coda-bit.c
> +++ b/drivers/media/platform/coda/coda-bit.c
> @@ -759,7 +759,7 @@ static void coda9_set_frame_cache(struct coda_ctx *ctx, 
> u32 fourcc)
>   cache_config = 1 << CODA9_CACHE_PAGEMERGE_OFFSET;
>   }
>   coda_write(ctx->dev, cache_size, CODA9_CMD_SET_FRAME_CACHE_SIZE);
> - if (fourcc == V4L2_PIX_FMT_NV12) {
> + if (fourcc == V4L2_PIX_FMT_NV12 || fourcc == V4L2_PIX_FMT_YUYV) {
>   cache_config |= 32 << CODA9_CACHE_LUMA_BUFFER_SIZE_OFFSET |
>   16 << CODA9_CACHE_CR_BUFFER_SIZE_OFFSET |
>   0 << CODA9_CACHE_CB_BUFFER_SIZE_OFFSET;
> @@ -1537,7 +1537,7 @@ static int __coda_start_decoding(struct coda_ctx *ctx)
>  
>   ctx->frame_mem_ctrl &= ~(CODA_FRAME_CHROMA_INTERLEAVE | (0x3 << 9) |
>CODA9_FRAME_TILED2LINEAR);
> - if (dst_fourcc == V4L2_PIX_FMT_NV12)
> + if (dst_fourcc == V4L2_PIX_FMT_NV12 || dst_fourcc == V4L2_PIX_FMT_YUYV)
>   ctx->frame_mem_ctrl |= CODA_FRAME_CHROMA_INTERLEAVE;
>   if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP)
>   ctx->frame_mem_ctrl |= (0x3 << 9) |
> @@ -2070,6 +2070,9 @@ static void coda_finish_decode(struct coda_ctx *ctx)
>   trace_coda_dec_rot_done(ctx, dst_buf, meta);
>  
>   switch (q_data_dst->fourcc) {
> + case V4L2_PIX_FMT_YUYV:
> + payload = width * height * 2;
> + break;
>   case V4L2_PIX_FMT_YUV420:
>   case V4L2_PIX_FMT_YVU420:
>   case V4L2_PIX_FMT_NV12:
> diff --git a/drivers/media/platform/coda/coda-common.c 
> b/drivers/media/platform/coda/coda-common.c
> index 8b23ea4..1a809b2 100644
> --- a/drivers/media/platform/coda/coda-common.c
> +++ b/drivers/media/platform/coda/coda-common.c
> @@ -95,6 +95,8 @@ void coda_write_base(struct coda_ctx *ctx, struct 
> coda_q_data *q_data,
>   u32 base_cb, base_cr;
>  
>   switch (q_data->fourcc) {
> + case V4L2_PIX_FMT_YUYV:
> + /* Fallthrough: IN -H264-> CODA -NV12 MB-> VDOA -YUYV-> OUT */
>   case V4L2_PIX_FMT_NV12:
>   case V4L2_PIX_FMT_YUV420:
>   default:
> @@ -201,6 +203,11 @@ static const struct coda_video_device coda_bit_decoder = 
> {
>   V4L2_PIX_FMT_NV12,
>   V4L2_PIX_FMT_YUV420,
>   V4L2_PIX_FMT_YVU420,
> + /*
> +  * If V4L2_PIX_FMT_YUYV should be default,
> +  * set_default_params() must be adjusted.
> +  */
> + V4L2_PIX_FMT_YUYV,
>   },
>  };
>  
> @@ -246,6 +253,7 @@ static u32 coda_format_normalize_yuv(u32 fourcc)
>   case V4L2_PIX_FMT_YUV420:
>   case V4L2_PIX_FMT_YVU420:
>   case V4L2_PIX_FMT_YUV422P:
> + case V4L2_PIX_FMT_YUYV:
>   return V4L2_PIX_FMT_YUV420;
>   default:
>   return fourcc;
> @@ -437,6 +445,11 @@ static int coda_try_pixelformat(struct coda_ctx *ctx, 
> struct v4l2_format *f)
>   return -EINVAL;
>  
>   for (i = 0; i < CODA_MAX_FORMATS; i++) {
> + /* Skip YUYV if the vdoa is not available */
> + if (!ctx->vdoa && f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE &&
> + formats[i] == V4L2_PIX_FMT_YUYV)
> + continue;
> +
>   if (formats[i] == f->fmt.pix.pixelformat) {
>   f->fmt.pix.pixelformat = formats[i];
>   return 0;
> @@ -520,6 +533,11 @@ static int coda_try_fmt(struct coda_ctx *ctx, const 
> struct coda_codec *codec,
>   f->fmt.pix.sizeimage = f->fmt.pix.bytesperline *
>   f->fmt.pix.height * 3 / 2;
>   break;
> + case V4L2_PIX_FMT_YUYV:
> + f->fmt.pix.bytesperline = round_up(f->fmt.pix.width, 16) * 2;
> + f->fmt.pix.sizeimage = f->fmt.pix.bytesperline *
> + f->fmt.pix.height;
> + break;
>   case V4L2_PIX_FMT_YUV422P:
>   f->fmt.pix.bytesperline = round_up(f->fmt.pix.width, 16);

Re: [PATCH 8/9] [media] coda: use VDOA for un-tiling custom macroblock format

2016-12-08 Thread Philipp Zabel
Am Donnerstag, den 08.12.2016, 16:24 +0100 schrieb Michael Tretter:
> If the CODA driver is configured to produce NV12 output and the VDOA is
> available, the VDOA can be used to transform the custom macroblock tiled
> format to a raster-ordered format for scanout.
> 
> In this case, set the output format of the CODA to the custom macroblock
> tiled format, disable the rotator, and use the VDOA to write to the v4l2
> buffer. The VDOA is synchronized with the CODA to always un-tile the
> frame that the CODA finished in the previous run.
> 
> Signed-off-by: Michael Tretter 
> ---
>  drivers/media/platform/coda/coda-bit.c| 77 
> +--
>  drivers/media/platform/coda/coda-common.c | 55 --
>  drivers/media/platform/coda/coda.h|  2 +
>  3 files changed, 104 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/media/platform/coda/coda-bit.c 
> b/drivers/media/platform/coda/coda-bit.c
> index 309eb4e..3e2f830 100644
> --- a/drivers/media/platform/coda/coda-bit.c
> +++ b/drivers/media/platform/coda/coda-bit.c
> @@ -30,6 +30,7 @@
>  #include 
>  
>  #include "coda.h"
> +#include "imx-vdoa.h"
>  #define CREATE_TRACE_POINTS
>  #include "trace.h"
>  
> @@ -1517,6 +1518,10 @@ static int __coda_start_decoding(struct coda_ctx *ctx)
>   u32 val;
>   int ret;
>  
> + v4l2_dbg(1, coda_debug, &dev->v4l2_dev,
> +  "Video Data Order Adapter: %s\n",
> +  ctx->use_vdoa ? "Enabled" : "Disabled");
> +
>   /* Start decoding */
>   q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
>   q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
> @@ -1535,7 +1540,8 @@ static int __coda_start_decoding(struct coda_ctx *ctx)
>   if (dst_fourcc == V4L2_PIX_FMT_NV12)
>   ctx->frame_mem_ctrl |= CODA_FRAME_CHROMA_INTERLEAVE;
>   if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP)
> - ctx->frame_mem_ctrl |= (0x3 << 9) | CODA9_FRAME_TILED2LINEAR;
> + ctx->frame_mem_ctrl |= (0x3 << 9) |
> + ((ctx->use_vdoa) ? 0 : CODA9_FRAME_TILED2LINEAR);
>   coda_write(dev, ctx->frame_mem_ctrl, CODA_REG_BIT_FRAME_MEM_CTRL);
>  
>   ctx->display_idx = -1;
> @@ -1724,6 +1730,7 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
>   struct coda_q_data *q_data_dst;
>   struct coda_buffer_meta *meta;
>   unsigned long flags;
> + u32 rot_mode = 0;
>   u32 reg_addr, reg_stride;
>  
>   dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
> @@ -1759,27 +1766,40 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
>   if (dev->devtype->product == CODA_960)
>   coda_set_gdi_regs(ctx);
>  
> - if (dev->devtype->product == CODA_960) {
> - /*
> -  * The CODA960 seems to have an internal list of buffers with
> -  * 64 entries that includes the registered frame buffers as
> -  * well as the rotator buffer output.
> -  * ROT_INDEX needs to be < 0x40, but > ctx->num_internal_frames.
> -  */
> - coda_write(dev, CODA_MAX_FRAMEBUFFERS + dst_buf->vb2_buf.index,
> - CODA9_CMD_DEC_PIC_ROT_INDEX);
> -
> - reg_addr = CODA9_CMD_DEC_PIC_ROT_ADDR_Y;
> - reg_stride = CODA9_CMD_DEC_PIC_ROT_STRIDE;
> + if (ctx->use_vdoa &&
> + ctx->display_idx >= 0 &&
> + ctx->display_idx < ctx->num_internal_frames) {
> + vdoa_device_run(ctx->vdoa,
> + 
> vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0),
> + ctx->internal_frames[ctx->display_idx].paddr);
>   } else {
> - reg_addr = CODA_CMD_DEC_PIC_ROT_ADDR_Y;
> - reg_stride = CODA_CMD_DEC_PIC_ROT_STRIDE;
> + if (dev->devtype->product == CODA_960) {
> + /*
> +  * The CODA960 seems to have an internal list of
> +  * buffers with 64 entries that includes the
> +  * registered frame buffers as well as the rotator
> +  * buffer output.
> +  *
> +  * ROT_INDEX needs to be < 0x40, but >
> +  * ctx->num_internal_frames.
> +  */
> + coda_write(dev,
> +CODA_MAX_FRAMEBUFFERS + 
> dst_buf->vb2_buf.index,
> +CODA9_CMD_DEC_PIC_ROT_INDEX);
> +
> + reg_addr = CODA9_CMD_DEC_PIC_ROT_ADDR_Y;
> + reg_stride = CODA9_CMD_DEC_PIC_ROT_STRIDE;
> + } else {
> + reg_addr = CODA_CMD_DEC_PIC_ROT_ADDR_Y;
> + reg_stride = CODA_CMD_DEC_PIC_ROT_STRIDE;
> + }
> + coda_write_base(ctx, q_data_dst, dst_buf, reg_addr);
> + coda_write(dev, q_data_dst->bytesperline, reg_stride);
> +
> + rot_mode = C

Re: [PATCH 7/9] [media] coda: fix frame index to returned error

2016-12-08 Thread Philipp Zabel
Am Donnerstag, den 08.12.2016, 16:24 +0100 schrieb Michael Tretter:
> display_idx refers to the frame that will be returned in the next round.
> The currently processed frame is ctx->display_idx and errors should be
> reported for this frame.
> 
> Signed-off-by: Michael Tretter 
> ---
>  drivers/media/platform/coda/coda-bit.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/coda/coda-bit.c 
> b/drivers/media/platform/coda/coda-bit.c
> index b662504..309eb4e 100644
> --- a/drivers/media/platform/coda/coda-bit.c
> +++ b/drivers/media/platform/coda/coda-bit.c
> @@ -2057,7 +2057,7 @@ static void coda_finish_decode(struct coda_ctx *ctx)
>   }
>   vb2_set_plane_payload(&dst_buf->vb2_buf, 0, payload);
>  
> - coda_m2m_buf_done(ctx, dst_buf, ctx->frame_errors[display_idx] ?
> + coda_m2m_buf_done(ctx, dst_buf, 
> ctx->frame_errors[ctx->display_idx] ?
> VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
>  
>   v4l2_dbg(1, coda_debug, &dev->v4l2_dev,

Acked-by: Philipp Zabel 

regards
Philipp

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


Re: [PATCH 5/9] [media] coda: get VDOA device using dt phandle

2016-12-08 Thread Philipp Zabel
Am Donnerstag, den 08.12.2016, 16:24 +0100 schrieb Michael Tretter:
> Signed-off-by: Michael Tretter 
> ---
>  drivers/media/platform/coda/coda-common.c | 43 
> +++
>  drivers/media/platform/coda/coda.h|  1 +
>  2 files changed, 44 insertions(+)
> 
> diff --git a/drivers/media/platform/coda/coda-common.c 
> b/drivers/media/platform/coda/coda-common.c
> index e0184194..1adb6f3 100644
> --- a/drivers/media/platform/coda/coda-common.c
> +++ b/drivers/media/platform/coda/coda-common.c
> @@ -41,6 +41,7 @@
>  #include 
>  
>  #include "coda.h"
> +#include "imx-vdoa.h"
>  
>  #define CODA_NAME"coda"
>  
> @@ -66,6 +67,10 @@ static int disable_tiling;
>  module_param(disable_tiling, int, 0644);
>  MODULE_PARM_DESC(disable_tiling, "Disable tiled frame buffers");
>  
> +static int disable_vdoa;
> +module_param(disable_vdoa, int, 0644);
> +MODULE_PARM_DESC(disable_vdoa, "Disable Video Data Order Adapter tiled to 
> raster-scan conversion");
> +
>  void coda_write(struct coda_dev *dev, u32 data, u32 reg)
>  {
>   v4l2_dbg(2, coda_debug, &dev->v4l2_dev,
> @@ -325,6 +330,34 @@ const char *coda_product_name(int product)
>   }
>  }
>  
> +static struct vdoa_data *coda_get_vdoa_data(struct device_node *np,
> + const char *name)

I'd drop the name parameter, there's only one possible phandle name.

> +{
> + struct device_node *vdoa_node;
> + struct platform_device *vdoa_pdev;
> + struct vdoa_data *vdoa_data;
> +
> + vdoa_node = of_parse_phandle(np, name, 0);

vdoa_node = of_parse_phandle(np, "vdoa", 0);

> + if (!vdoa_node)
> + return NULL;
> +
> + vdoa_pdev = of_find_device_by_node(vdoa_node);
> + if (!vdoa_pdev) {
> + vdoa_data = NULL;
> + goto out;
> + }
> +
> + vdoa_data = platform_get_drvdata(vdoa_pdev);
> + if (!vdoa_data)
> + vdoa_data = ERR_PTR(-EPROBE_DEFER);
> +
> +out:
> + if (vdoa_node)
> + of_node_put(vdoa_node);
> +
> + return vdoa_data;
> +}
> +
>  /*
>   * V4L2 ioctl() operations.
>   */
> @@ -2256,6 +2289,16 @@ static int coda_probe(struct platform_device *pdev)
>   }
>   dev->iram_pool = pool;
>  
> + /* Get VDOA from device tree if available */
> + if (!disable_tiling && !disable_vdoa) {

disable_tiling/disable_vdoa could be changed after the module is loaded.
Better always call coda_get_vdoa_data.

> + dev->vdoa = coda_get_vdoa_data(np, "vdoa");

dev->vdoa = coda_get_vdoa_data(np);

> + if (PTR_ERR(dev->vdoa) == -EPROBE_DEFER)
> + return -EPROBE_DEFER;
> + if (!dev->vdoa)
> + dev_info(&pdev->dev,
> +  "vdoa not available; not using tiled 
> intermediate format");

This message is not useful on i.MX53, maybe use
if (dev_type == CODA_960)

> + }
> +
>   ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev);
>   if (ret)
>   return ret;
> diff --git a/drivers/media/platform/coda/coda.h 
> b/drivers/media/platform/coda/coda.h
> index 53f9666..ae202dc 100644
> --- a/drivers/media/platform/coda/coda.h
> +++ b/drivers/media/platform/coda/coda.h
> @@ -75,6 +75,7 @@ struct coda_dev {
>   struct platform_device  *plat_dev;
>   const struct coda_devtype *devtype;
>   int firmware;
> + struct vdoa_data*vdoa;
>  
>   void __iomem*regs_base;
>   struct clk  *clk_per;

regards
Philipp

--
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 2/9] [media] coda: add i.MX6 VDOA driver

2016-12-08 Thread Michael Tretter
From: Philipp Zabel 

The i.MX6 Video Data Order Adapter's (VDOA) sole purpose is to convert
from a custom macroblock tiled format produced by the CODA960 decoder
into linear formats that can be used for scanout.

Signed-off-by: Philipp Zabel 
Signed-off-by: Michael Tretter 
---
 drivers/media/platform/Kconfig |   3 +
 drivers/media/platform/coda/Makefile   |   1 +
 drivers/media/platform/coda/imx-vdoa.c | 331 +
 drivers/media/platform/coda/imx-vdoa.h |  58 ++
 4 files changed, 393 insertions(+)
 create mode 100644 drivers/media/platform/coda/imx-vdoa.c
 create mode 100644 drivers/media/platform/coda/imx-vdoa.h

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index ce4a96f..41e007f 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -162,6 +162,9 @@ config VIDEO_CODA
   Coda is a range of video codec IPs that supports
   H.264, MPEG-4, and other video formats.
 
+config VIDEO_IMX_VDOA
+   def_tristate VIDEO_CODA if SOC_IMX6Q || COMPILE_TEST
+
 config VIDEO_MEDIATEK_VPU
tristate "Mediatek Video Processor Unit"
depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
diff --git a/drivers/media/platform/coda/Makefile 
b/drivers/media/platform/coda/Makefile
index 9342ac5..8582843 100644
--- a/drivers/media/platform/coda/Makefile
+++ b/drivers/media/platform/coda/Makefile
@@ -3,3 +3,4 @@ ccflags-y += -I$(src)
 coda-objs := coda-common.o coda-bit.o coda-gdi.o coda-h264.o coda-jpeg.o
 
 obj-$(CONFIG_VIDEO_CODA) += coda.o
+obj-$(CONFIG_VIDEO_IMX_VDOA) += imx-vdoa.o
diff --git a/drivers/media/platform/coda/imx-vdoa.c 
b/drivers/media/platform/coda/imx-vdoa.c
new file mode 100644
index 000..9b4ae07
--- /dev/null
+++ b/drivers/media/platform/coda/imx-vdoa.c
@@ -0,0 +1,331 @@
+/*
+ * i.MX6 Video Data Order Adapter (VDOA)
+ *
+ * Copyright (C) 2014 Philipp Zabel
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "imx-vdoa.h"
+
+#define VDOA_NAME "imx-vdoa"
+
+#define VDOAC  0x00
+#define VDOASRR0x04
+#define VDOAIE 0x08
+#define VDOAIST0x0c
+#define VDOAFP 0x10
+#define VDOAIEBA00 0x14
+#define VDOAIEBA01 0x18
+#define VDOAIEBA02 0x1c
+#define VDOAIEBA10 0x20
+#define VDOAIEBA11 0x24
+#define VDOAIEBA12 0x28
+#define VDOASL 0x2c
+#define VDOAIUBO   0x30
+#define VDOAVEBA0  0x34
+#define VDOAVEBA1  0x38
+#define VDOAVEBA2  0x3c
+#define VDOAVUBO   0x40
+#define VDOASR 0x44
+
+#define VDOAC_ISEL BIT(6)
+#define VDOAC_PFS  BIT(5)
+#define VDOAC_SO   BIT(4)
+#define VDOAC_SYNC BIT(3)
+#define VDOAC_NF   BIT(2)
+#define VDOAC_BNDM_MASK0x3
+#define VDOAC_BAND_HEIGHT_80x0
+#define VDOAC_BAND_HEIGHT_16   0x1
+#define VDOAC_BAND_HEIGHT_32   0x2
+
+#define VDOASRR_START  BIT(1)
+#define VDOASRR_SWRST  BIT(0)
+
+#define VDOAIE_EITERR  BIT(1)
+#define VDOAIE_EIEOT   BIT(0)
+
+#define VDOAIST_TERR   BIT(1)
+#define VDOAIST_EOTBIT(0)
+
+#define VDOAFP_FH_MASK (0x1fff << 16)
+#define VDOAFP_FW_MASK (0x3fff)
+
+#define VDOASL_VSLY_MASK   (0x3fff << 16)
+#define VDOASL_ISLY_MASK   (0x7fff)
+
+#define VDOASR_ERRWBIT(4)
+#define VDOASR_EOB BIT(3)
+#define VDOASR_CURRENT_FRAME   (0x3 << 1)
+#define VDOASR_CURRENT_BUFFER  BIT(1)
+
+enum {
+   V4L2_M2M_SRC = 0,
+   V4L2_M2M_DST = 1,
+};
+
+struct vdoa_data {
+   struct vdoa_ctx *curr_ctx;
+   struct device   *dev;
+   struct clk  *vdoa_clk;
+   void __iomem*regs;
+   int irq;
+};
+
+struct vdoa_q_data {
+   unsigned intwidth;
+   unsigned intheight;
+   unsigned intbytesperline;
+   unsigned intsizeimage;
+   u32 pixelformat;
+};
+
+struct vdoa_ctx {
+   struct vdoa_data*vdoa;
+   struct completion   completion;
+   struct vdoa_q_data  q_data[2];
+};
+
+static irqreturn_t vdoa_irq_handler(int irq, void *data)
+{
+   struct vdoa_data *vdoa = data;
+   struct vdoa_ctx *curr_ctx;
+   u32 val;
+
+   /* Disable interrupts */
+   writel(0, vdoa->regs + VDOAIE);
+
+   curr_ctx = vdoa->curr_ctx;
+   if (!curr_ctx) {
+   d

[PATCH 1/9] ARM: dts: imx6qdl: Add VDOA compatible and clocks properties

2016-12-08 Thread Michael Tretter
From: Philipp Zabel 

This adds a compatible property and the correct clock for the
i.MX6Q Video Data Order Adapter.

Signed-off-by: Philipp Zabel 
Signed-off-by: Michael Tretter 
---
 arch/arm/boot/dts/imx6qdl.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index b13b0b2..69e3668 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -1153,8 +1153,10 @@
};
 
vdoa@021e4000 {
+   compatible = "fsl,imx6q-vdoa";
reg = <0x021e4000 0x4000>;
interrupts = <0 18 IRQ_TYPE_LEVEL_HIGH>;
+   clocks = <&clks IMX6QDL_CLK_VDOA>;
};
 
uart2: serial@021e8000 {
-- 
2.10.2

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


[PATCH 4/9] [media] coda: correctly set capture compose rectangle

2016-12-08 Thread Michael Tretter
From: Philipp Zabel 

Correctly store the rectangle of valid video data in the destination
q_data before rounding up to macroblock size. This fixes the output
of VIDIOC_G_SELECTION for the capture side compose rectangle.

Signed-off-by: Philipp Zabel 
Signed-off-by: Michael Tretter 
---
 drivers/media/platform/coda/coda-common.c | 37 ---
 1 file changed, 29 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index c39718a..e0184194 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -566,7 +566,8 @@ static int coda_try_fmt_vid_out(struct file *file, void 
*priv,
return coda_try_fmt(ctx, codec, f);
 }
 
-static int coda_s_fmt(struct coda_ctx *ctx, struct v4l2_format *f)
+static int coda_s_fmt(struct coda_ctx *ctx, struct v4l2_format *f,
+ struct v4l2_rect *r)
 {
struct coda_q_data *q_data;
struct vb2_queue *vq;
@@ -589,10 +590,14 @@ static int coda_s_fmt(struct coda_ctx *ctx, struct 
v4l2_format *f)
q_data->height = f->fmt.pix.height;
q_data->bytesperline = f->fmt.pix.bytesperline;
q_data->sizeimage = f->fmt.pix.sizeimage;
-   q_data->rect.left = 0;
-   q_data->rect.top = 0;
-   q_data->rect.width = f->fmt.pix.width;
-   q_data->rect.height = f->fmt.pix.height;
+   if (r) {
+   q_data->rect = *r;
+   } else {
+   q_data->rect.left = 0;
+   q_data->rect.top = 0;
+   q_data->rect.width = f->fmt.pix.width;
+   q_data->rect.height = f->fmt.pix.height;
+   }
 
switch (f->fmt.pix.pixelformat) {
case V4L2_PIX_FMT_NV12:
@@ -621,27 +626,37 @@ static int coda_s_fmt_vid_cap(struct file *file, void 
*priv,
  struct v4l2_format *f)
 {
struct coda_ctx *ctx = fh_to_ctx(priv);
+   struct coda_q_data *q_data_src;
+   struct v4l2_rect r;
int ret;
 
ret = coda_try_fmt_vid_cap(file, priv, f);
if (ret)
return ret;
 
-   return coda_s_fmt(ctx, f);
+   q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
+   r.left = 0;
+   r.top = 0;
+   r.width = q_data_src->width;
+   r.height = q_data_src->height;
+
+   return coda_s_fmt(ctx, f, &r);
 }
 
 static int coda_s_fmt_vid_out(struct file *file, void *priv,
  struct v4l2_format *f)
 {
struct coda_ctx *ctx = fh_to_ctx(priv);
+   struct coda_q_data *q_data_src;
struct v4l2_format f_cap;
+   struct v4l2_rect r;
int ret;
 
ret = coda_try_fmt_vid_out(file, priv, f);
if (ret)
return ret;
 
-   ret = coda_s_fmt(ctx, f);
+   ret = coda_s_fmt(ctx, f, NULL);
if (ret)
return ret;
 
@@ -657,7 +672,13 @@ static int coda_s_fmt_vid_out(struct file *file, void 
*priv,
if (ret)
return ret;
 
-   return coda_s_fmt(ctx, &f_cap);
+   q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
+   r.left = 0;
+   r.top = 0;
+   r.width = q_data_src->width;
+   r.height = q_data_src->height;
+
+   return coda_s_fmt(ctx, &f_cap, &r);
 }
 
 static int coda_reqbufs(struct file *file, void *priv,
-- 
2.10.2

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


[PATCH 3/9] ARM: dts: imx6qdl: Add VDOA phandle to CODA node

2016-12-08 Thread Michael Tretter
The CODA driver should use the VDOA to transform the tiled format to
raster-ordered format, if the platform has a VDOA. Link the CODA and
VDOA nodes to tell the CODA driver that it can use the VDOA.

Signed-off-by: Michael Tretter 
---
 Documentation/devicetree/bindings/media/coda.txt | 2 ++
 arch/arm/boot/dts/imx6qdl.dtsi   | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/media/coda.txt 
b/Documentation/devicetree/bindings/media/coda.txt
index 2865d04..7900788 100644
--- a/Documentation/devicetree/bindings/media/coda.txt
+++ b/Documentation/devicetree/bindings/media/coda.txt
@@ -17,6 +17,7 @@ Required properties:
   determined by the clock-names property.
 - clock-names : Should be "ahb", "per"
 - iram : phandle pointing to the SRAM device node
+- vdoa : phandle pointing to the VDOA device node
 
 Example:
 
@@ -27,4 +28,5 @@ vpu: vpu@63ff4000 {
clocks = <&clks 63>, <&clks 63>;
clock-names = "ahb", "per";
iram = <&ocram>;
+   vdoa = <&vdoa>;
 };
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 69e3668..7bf3429 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -427,6 +427,7 @@
power-domains = <&gpc 1>;
resets = <&src 1>;
iram = <&ocram>;
+   vdoa = <&vdoa>;
};
 
aipstz@0207c000 { /* AIPSTZ1 */
@@ -1152,7 +1153,7 @@
};
};
 
-   vdoa@021e4000 {
+   vdoa: vdoa@021e4000 {
compatible = "fsl,imx6q-vdoa";
reg = <0x021e4000 0x4000>;
interrupts = <0 18 IRQ_TYPE_LEVEL_HIGH>;
-- 
2.10.2

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


[PATCH 6/9] [media] coda: add debug output about tiling

2016-12-08 Thread Michael Tretter
From: Philipp Zabel 

In order to make the VDOA work correctly, the CODA must produce frames
in tiled format. Print this information in the debug output.

Also print the color format in fourcc instead of the numeric value.

Signed-off-by: Philipp Zabel 
Signed-off-by: Michael Tretter 
---
 drivers/media/platform/coda/coda-common.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index 1adb6f3..3a21000 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -649,8 +649,10 @@ static int coda_s_fmt(struct coda_ctx *ctx, struct 
v4l2_format *f,
}
 
v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev,
-   "Setting format for type %d, wxh: %dx%d, fmt: %d\n",
-   f->type, q_data->width, q_data->height, q_data->fourcc);
+   "Setting format for type %d, wxh: %dx%d, fmt: %4.4s %c\n",
+   f->type, q_data->width, q_data->height,
+   (char *)&q_data->fourcc,
+   (ctx->tiled_map_type == GDI_LINEAR_FRAME_MAP) ? 'L' : 'T');
 
return 0;
 }
-- 
2.10.2

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


[PATCH 8/9] [media] coda: use VDOA for un-tiling custom macroblock format

2016-12-08 Thread Michael Tretter
If the CODA driver is configured to produce NV12 output and the VDOA is
available, the VDOA can be used to transform the custom macroblock tiled
format to a raster-ordered format for scanout.

In this case, set the output format of the CODA to the custom macroblock
tiled format, disable the rotator, and use the VDOA to write to the v4l2
buffer. The VDOA is synchronized with the CODA to always un-tile the
frame that the CODA finished in the previous run.

Signed-off-by: Michael Tretter 
---
 drivers/media/platform/coda/coda-bit.c| 77 +--
 drivers/media/platform/coda/coda-common.c | 55 --
 drivers/media/platform/coda/coda.h|  2 +
 3 files changed, 104 insertions(+), 30 deletions(-)

diff --git a/drivers/media/platform/coda/coda-bit.c 
b/drivers/media/platform/coda/coda-bit.c
index 309eb4e..3e2f830 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -30,6 +30,7 @@
 #include 
 
 #include "coda.h"
+#include "imx-vdoa.h"
 #define CREATE_TRACE_POINTS
 #include "trace.h"
 
@@ -1517,6 +1518,10 @@ static int __coda_start_decoding(struct coda_ctx *ctx)
u32 val;
int ret;
 
+   v4l2_dbg(1, coda_debug, &dev->v4l2_dev,
+"Video Data Order Adapter: %s\n",
+ctx->use_vdoa ? "Enabled" : "Disabled");
+
/* Start decoding */
q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
@@ -1535,7 +1540,8 @@ static int __coda_start_decoding(struct coda_ctx *ctx)
if (dst_fourcc == V4L2_PIX_FMT_NV12)
ctx->frame_mem_ctrl |= CODA_FRAME_CHROMA_INTERLEAVE;
if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP)
-   ctx->frame_mem_ctrl |= (0x3 << 9) | CODA9_FRAME_TILED2LINEAR;
+   ctx->frame_mem_ctrl |= (0x3 << 9) |
+   ((ctx->use_vdoa) ? 0 : CODA9_FRAME_TILED2LINEAR);
coda_write(dev, ctx->frame_mem_ctrl, CODA_REG_BIT_FRAME_MEM_CTRL);
 
ctx->display_idx = -1;
@@ -1724,6 +1730,7 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
struct coda_q_data *q_data_dst;
struct coda_buffer_meta *meta;
unsigned long flags;
+   u32 rot_mode = 0;
u32 reg_addr, reg_stride;
 
dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
@@ -1759,27 +1766,40 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
if (dev->devtype->product == CODA_960)
coda_set_gdi_regs(ctx);
 
-   if (dev->devtype->product == CODA_960) {
-   /*
-* The CODA960 seems to have an internal list of buffers with
-* 64 entries that includes the registered frame buffers as
-* well as the rotator buffer output.
-* ROT_INDEX needs to be < 0x40, but > ctx->num_internal_frames.
-*/
-   coda_write(dev, CODA_MAX_FRAMEBUFFERS + dst_buf->vb2_buf.index,
-   CODA9_CMD_DEC_PIC_ROT_INDEX);
-
-   reg_addr = CODA9_CMD_DEC_PIC_ROT_ADDR_Y;
-   reg_stride = CODA9_CMD_DEC_PIC_ROT_STRIDE;
+   if (ctx->use_vdoa &&
+   ctx->display_idx >= 0 &&
+   ctx->display_idx < ctx->num_internal_frames) {
+   vdoa_device_run(ctx->vdoa,
+   
vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0),
+   ctx->internal_frames[ctx->display_idx].paddr);
} else {
-   reg_addr = CODA_CMD_DEC_PIC_ROT_ADDR_Y;
-   reg_stride = CODA_CMD_DEC_PIC_ROT_STRIDE;
+   if (dev->devtype->product == CODA_960) {
+   /*
+* The CODA960 seems to have an internal list of
+* buffers with 64 entries that includes the
+* registered frame buffers as well as the rotator
+* buffer output.
+*
+* ROT_INDEX needs to be < 0x40, but >
+* ctx->num_internal_frames.
+*/
+   coda_write(dev,
+  CODA_MAX_FRAMEBUFFERS + 
dst_buf->vb2_buf.index,
+  CODA9_CMD_DEC_PIC_ROT_INDEX);
+
+   reg_addr = CODA9_CMD_DEC_PIC_ROT_ADDR_Y;
+   reg_stride = CODA9_CMD_DEC_PIC_ROT_STRIDE;
+   } else {
+   reg_addr = CODA_CMD_DEC_PIC_ROT_ADDR_Y;
+   reg_stride = CODA_CMD_DEC_PIC_ROT_STRIDE;
+   }
+   coda_write_base(ctx, q_data_dst, dst_buf, reg_addr);
+   coda_write(dev, q_data_dst->bytesperline, reg_stride);
+
+   rot_mode = CODA_ROT_MIR_ENABLE | ctx->params.rot_mode;
}
-   coda_write_base(ctx, q_data_dst, dst_buf, reg_addr);
-   coda_write(dev, q_data_dst->bytespe

[PATCH 5/9] [media] coda: get VDOA device using dt phandle

2016-12-08 Thread Michael Tretter
Signed-off-by: Michael Tretter 
---
 drivers/media/platform/coda/coda-common.c | 43 +++
 drivers/media/platform/coda/coda.h|  1 +
 2 files changed, 44 insertions(+)

diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index e0184194..1adb6f3 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -41,6 +41,7 @@
 #include 
 
 #include "coda.h"
+#include "imx-vdoa.h"
 
 #define CODA_NAME  "coda"
 
@@ -66,6 +67,10 @@ static int disable_tiling;
 module_param(disable_tiling, int, 0644);
 MODULE_PARM_DESC(disable_tiling, "Disable tiled frame buffers");
 
+static int disable_vdoa;
+module_param(disable_vdoa, int, 0644);
+MODULE_PARM_DESC(disable_vdoa, "Disable Video Data Order Adapter tiled to 
raster-scan conversion");
+
 void coda_write(struct coda_dev *dev, u32 data, u32 reg)
 {
v4l2_dbg(2, coda_debug, &dev->v4l2_dev,
@@ -325,6 +330,34 @@ const char *coda_product_name(int product)
}
 }
 
+static struct vdoa_data *coda_get_vdoa_data(struct device_node *np,
+   const char *name)
+{
+   struct device_node *vdoa_node;
+   struct platform_device *vdoa_pdev;
+   struct vdoa_data *vdoa_data;
+
+   vdoa_node = of_parse_phandle(np, name, 0);
+   if (!vdoa_node)
+   return NULL;
+
+   vdoa_pdev = of_find_device_by_node(vdoa_node);
+   if (!vdoa_pdev) {
+   vdoa_data = NULL;
+   goto out;
+   }
+
+   vdoa_data = platform_get_drvdata(vdoa_pdev);
+   if (!vdoa_data)
+   vdoa_data = ERR_PTR(-EPROBE_DEFER);
+
+out:
+   if (vdoa_node)
+   of_node_put(vdoa_node);
+
+   return vdoa_data;
+}
+
 /*
  * V4L2 ioctl() operations.
  */
@@ -2256,6 +2289,16 @@ static int coda_probe(struct platform_device *pdev)
}
dev->iram_pool = pool;
 
+   /* Get VDOA from device tree if available */
+   if (!disable_tiling && !disable_vdoa) {
+   dev->vdoa = coda_get_vdoa_data(np, "vdoa");
+   if (PTR_ERR(dev->vdoa) == -EPROBE_DEFER)
+   return -EPROBE_DEFER;
+   if (!dev->vdoa)
+   dev_info(&pdev->dev,
+"vdoa not available; not using tiled 
intermediate format");
+   }
+
ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev);
if (ret)
return ret;
diff --git a/drivers/media/platform/coda/coda.h 
b/drivers/media/platform/coda/coda.h
index 53f9666..ae202dc 100644
--- a/drivers/media/platform/coda/coda.h
+++ b/drivers/media/platform/coda/coda.h
@@ -75,6 +75,7 @@ struct coda_dev {
struct platform_device  *plat_dev;
const struct coda_devtype *devtype;
int firmware;
+   struct vdoa_data*vdoa;
 
void __iomem*regs_base;
struct clk  *clk_per;
-- 
2.10.2

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


[PATCH 7/9] [media] coda: fix frame index to returned error

2016-12-08 Thread Michael Tretter
display_idx refers to the frame that will be returned in the next round.
The currently processed frame is ctx->display_idx and errors should be
reported for this frame.

Signed-off-by: Michael Tretter 
---
 drivers/media/platform/coda/coda-bit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/coda/coda-bit.c 
b/drivers/media/platform/coda/coda-bit.c
index b662504..309eb4e 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -2057,7 +2057,7 @@ static void coda_finish_decode(struct coda_ctx *ctx)
}
vb2_set_plane_payload(&dst_buf->vb2_buf, 0, payload);
 
-   coda_m2m_buf_done(ctx, dst_buf, ctx->frame_errors[display_idx] ?
+   coda_m2m_buf_done(ctx, dst_buf, 
ctx->frame_errors[ctx->display_idx] ?
  VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
 
v4l2_dbg(1, coda_debug, &dev->v4l2_dev,
-- 
2.10.2

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


[PATCH 9/9] [media] coda: support YUYV output if VDOA is used

2016-12-08 Thread Michael Tretter
The VDOA is able to transform the NV12 custom macroblock tiled format of
the CODA to YUYV format. If and only if the VDOA is available, the
driver can also provide YUYV support.

While the driver is configured to produce YUYV output, the CODA must be
configured to produce NV12 macroblock tiled frames and the VDOA must
transform the intermediate result into the final YUYV output.

Signed-off-by: Michael Tretter 
---
 drivers/media/platform/coda/coda-bit.c|  7 +--
 drivers/media/platform/coda/coda-common.c | 30 ++
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/coda/coda-bit.c 
b/drivers/media/platform/coda/coda-bit.c
index 3e2f830..b94ba62 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -759,7 +759,7 @@ static void coda9_set_frame_cache(struct coda_ctx *ctx, u32 
fourcc)
cache_config = 1 << CODA9_CACHE_PAGEMERGE_OFFSET;
}
coda_write(ctx->dev, cache_size, CODA9_CMD_SET_FRAME_CACHE_SIZE);
-   if (fourcc == V4L2_PIX_FMT_NV12) {
+   if (fourcc == V4L2_PIX_FMT_NV12 || fourcc == V4L2_PIX_FMT_YUYV) {
cache_config |= 32 << CODA9_CACHE_LUMA_BUFFER_SIZE_OFFSET |
16 << CODA9_CACHE_CR_BUFFER_SIZE_OFFSET |
0 << CODA9_CACHE_CB_BUFFER_SIZE_OFFSET;
@@ -1537,7 +1537,7 @@ static int __coda_start_decoding(struct coda_ctx *ctx)
 
ctx->frame_mem_ctrl &= ~(CODA_FRAME_CHROMA_INTERLEAVE | (0x3 << 9) |
 CODA9_FRAME_TILED2LINEAR);
-   if (dst_fourcc == V4L2_PIX_FMT_NV12)
+   if (dst_fourcc == V4L2_PIX_FMT_NV12 || dst_fourcc == V4L2_PIX_FMT_YUYV)
ctx->frame_mem_ctrl |= CODA_FRAME_CHROMA_INTERLEAVE;
if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP)
ctx->frame_mem_ctrl |= (0x3 << 9) |
@@ -2070,6 +2070,9 @@ static void coda_finish_decode(struct coda_ctx *ctx)
trace_coda_dec_rot_done(ctx, dst_buf, meta);
 
switch (q_data_dst->fourcc) {
+   case V4L2_PIX_FMT_YUYV:
+   payload = width * height * 2;
+   break;
case V4L2_PIX_FMT_YUV420:
case V4L2_PIX_FMT_YVU420:
case V4L2_PIX_FMT_NV12:
diff --git a/drivers/media/platform/coda/coda-common.c 
b/drivers/media/platform/coda/coda-common.c
index 8b23ea4..1a809b2 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -95,6 +95,8 @@ void coda_write_base(struct coda_ctx *ctx, struct coda_q_data 
*q_data,
u32 base_cb, base_cr;
 
switch (q_data->fourcc) {
+   case V4L2_PIX_FMT_YUYV:
+   /* Fallthrough: IN -H264-> CODA -NV12 MB-> VDOA -YUYV-> OUT */
case V4L2_PIX_FMT_NV12:
case V4L2_PIX_FMT_YUV420:
default:
@@ -201,6 +203,11 @@ static const struct coda_video_device coda_bit_decoder = {
V4L2_PIX_FMT_NV12,
V4L2_PIX_FMT_YUV420,
V4L2_PIX_FMT_YVU420,
+   /*
+* If V4L2_PIX_FMT_YUYV should be default,
+* set_default_params() must be adjusted.
+*/
+   V4L2_PIX_FMT_YUYV,
},
 };
 
@@ -246,6 +253,7 @@ static u32 coda_format_normalize_yuv(u32 fourcc)
case V4L2_PIX_FMT_YUV420:
case V4L2_PIX_FMT_YVU420:
case V4L2_PIX_FMT_YUV422P:
+   case V4L2_PIX_FMT_YUYV:
return V4L2_PIX_FMT_YUV420;
default:
return fourcc;
@@ -437,6 +445,11 @@ static int coda_try_pixelformat(struct coda_ctx *ctx, 
struct v4l2_format *f)
return -EINVAL;
 
for (i = 0; i < CODA_MAX_FORMATS; i++) {
+   /* Skip YUYV if the vdoa is not available */
+   if (!ctx->vdoa && f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE &&
+   formats[i] == V4L2_PIX_FMT_YUYV)
+   continue;
+
if (formats[i] == f->fmt.pix.pixelformat) {
f->fmt.pix.pixelformat = formats[i];
return 0;
@@ -520,6 +533,11 @@ static int coda_try_fmt(struct coda_ctx *ctx, const struct 
coda_codec *codec,
f->fmt.pix.sizeimage = f->fmt.pix.bytesperline *
f->fmt.pix.height * 3 / 2;
break;
+   case V4L2_PIX_FMT_YUYV:
+   f->fmt.pix.bytesperline = round_up(f->fmt.pix.width, 16) * 2;
+   f->fmt.pix.sizeimage = f->fmt.pix.bytesperline *
+   f->fmt.pix.height;
+   break;
case V4L2_PIX_FMT_YUV422P:
f->fmt.pix.bytesperline = round_up(f->fmt.pix.width, 16);
f->fmt.pix.sizeimage = f->fmt.pix.bytesperline *
@@ -592,6 +610,15 @@ static int coda_try_fmt_vid_cap(struct file *file, void 
*priv,
ret = coda_try_vdoa(c

Re: [PATCH] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Laurent Pinchart
On Thursday 08 Dec 2016 12:16:08 Mauro Carvalho Chehab wrote:
> Em Thu, 08 Dec 2016 15:41:59 +0200 Laurent Pinchart escreveu:
> > On Thursday 08 Dec 2016 11:38:34 Mauro Carvalho Chehab wrote:
> > > changeset 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
> > > support") added a logic that overrides TVP5150_CONF_SHARED_PIN setting,
> > > depending on the type of bus set via the .set_fmt() subdev callback.
> > > 
> > > This is known to cause trobules on devices that don't use a V4L2
> > > subdev devnode, and a fix for it was made by changeset 47de9bf8931e
> > > ("[media] tvp5150: Fix breakage for serial usage"). Unfortunately,
> > > such fix doesn't consider the case of progressive video inputs,
> > > causing chroma decoding issues on such videos, as it overrides not
> > > only the type of video output, but also other unrelated bits.
> > > 
> > > So, instead of trying to guess, let's detect if the device is set
> > > via Device Tree. If not, just ignore the bogus logic.
> > 
> > If you add a big [HACK] tag to the subject line, sure. I thought this
> > would have been an occasion to fix the problem correctly :-(
> 
> No, this is not a hack.
> 
> It is a patch that restores the driver behavior that used to be
> before adding DT support to the driver. Whatever DT-based drivers
> need, it *should not* change the behavior for devices that don't
> use DT.

1. This has nothing to do with DT, but with the addition of the s_stream() 
operation.

2. When I added s_stream() support the em28xx driver did not call s_stream(1). 
That has been changed by

commit 13d52fe40f1f7bbad49128e8ee6a2fe5e13dd18d
Author: Mauro Carvalho Chehab 
Date:   Tue Jan 26 06:59:39 2016 -0200

[media] em28xx: fix implementation of s_stream

On em28xx driver, s_stream subdev ops was not implemented
properly. It was used only to disable stream, never enabling it.
That was the root cause of the regression when we added support
for s_stream on tvp5150 driver.

With that, we can get rid of the changes on tvp5150 side,
e. g. changeset 47de9bf8931e ('[media] tvp5150: Fix breakage for serial 
usage').

Tested video output on em2820+tvp5150 on WinTV USB2 and
video and/or vbi output on em288x+tvp5150 on HVR 950.

Signed-off-by: Mauro Carvalho Chehab 

3. There's clearly a bug in the current implementation, and it needs to be 
fixed. That fact does not turn every attempt to address the bug into proper 
fixes by magic. Hacks remain hacks.

4. I'm working on a proper fix.

> I agree with you that the patch is incomplete, as it doesn't
> add any OF var that would allow DT to specify the values
> to be used for TVP5150_CONF_SHARED_PIN and TVP5150_MISC_CTL,
> and assumes that tvp5150, tvp5151 and tvp5150am1 will all use
> the same values for TVP5150_MISC_CTL.
> 
> In order to fix that, someone with a DT-based driver with tvp5150,
> tvp5150am1 and/or tvp5151 would need to spend some time and test
> the hardware with both interlaced and progressive video inputs.
> 
> That's not me, as I don't have any hardware that meets such requirement.
> 
> If someone ships me such hardware, I could work on it on my spare time.
> Otherwise, then perhaps you could work on such patch - or we could ping
> Javier on Monday and see if has time/interest to work on it (afaikt, he's
> OOT the rest of this week).
> 
> Anyway, with this patch applied, the one working on such fix won't need
> to be concerned to cause new regressions on the non-DT drivers that use
> this chip, with is, IMHO, a very good thing.
> 
> Also, this patch is simple enough to be backported to -stable.
> 
> What's missing here is a notice explaining what's left to be done,
> like the one on the diff below.
> 
> Regards,
> Mauro
> 
> diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
> index eb43ac7002d6..c9fd36998ac7 100644
> --- a/drivers/media/i2c/tvp5150.c
> +++ b/drivers/media/i2c/tvp5150.c
> @@ -1057,6 +1057,17 @@ static int tvp5150_s_stream(struct v4l2_subdev *sd,
> int enable) if (!decoder->has_dt)
>   return 0;
> 
> + /*
> +  * FIXME: the logic below is hardcoded to work with some OMAP3
> +  * hardware with tvp5151. As such, it hardcodes values for
> +  * both TVP5150_CONF_SHARED_PIN and TVP5150_MISC_CTL, and ignores
> +  * what was set before at the driver. Ideally, we should have
> +  * DT nodes describing the setup, instead of hardcoding those
> +  * values, and doing a read before writing values to
> +  * TVP5150_MISC_CTL, but any patch adding support for it should
> +  * keep DT backward-compatible.
> +  */
> +
>   /* Output format: 8-bit 4:2:2 YUV with discrete sync */
>   if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
>   val = 0x0d;

-- 
Regards,

Laurent Pinchart

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

Re: [PATCH v2 3/3] uvcvideo: add a metadata device node

2016-12-08 Thread Guennadi Liakhovetski
On Thu, 8 Dec 2016, Laurent Pinchart wrote:

> Hi Guennadi,
> 
> On Thursday 08 Dec 2016 14:34:46 Guennadi Liakhovetski wrote:
> > On Tue, 6 Dec 2016, Laurent Pinchart wrote:
> > > On Tuesday 06 Dec 2016 11:39:22 Guennadi Liakhovetski wrote:
> > >> On Tue, 6 Dec 2016, Laurent Pinchart wrote:
> > >>> On Monday 05 Dec 2016 23:13:53 Guennadi Liakhovetski wrote:
> >  On Tue, 6 Dec 2016, Laurent Pinchart wrote:
> >  +  /*
> >  +   * Register a metadata node. TODO: shall this only be enabled
> >  for some
> >  +   * cameras?
> >  +   */
> >  +  if (!(dev->quirks & UVC_QUIRK_BUILTIN_ISIGHT))
> >  +  uvc_meta_register(stream);
> >  +
> > >>> 
> > >>> I think so, only for the cameras that can produce metadata.
> > >> 
> > >> Every UVC camera produces metadata, but most cameras only have
> > >> standard fields there. Whether we should stream standard header
> > >> fields from the metadata node will be discussed later. If we do
> > >> decide to stream standard header fields, then every USB camera gets
> > >> metadata nodes. If we decide not to include standard fields, how do
> > >> we know whether the camera has any private fields in headers
> > >> without streaming from it? Do you want a quirk for such cameras?
> > > 
> > > Unless they can be detected in a standard way that's probably the
> > > best solution.
> > 
> > How about a module parameter with a list of VID:PID pairs?
> 
> I'd like something that works out of the box for end-users, at least in most 
> cases. There's already a way to set quirks through a module parameter, and I 
> think I'd accept a patch extending that it make it VID:PID dependent.

Ok, that helps already, sure.

> That's 
> an acceptable solution for testing, but should not be considered as the way 
> to 
> go for production.
> 
> > The problem with the quirk is, that as vendors produce multiple cameras with
> > different PIDs they will have to push patches for each such camera.
> 
> How many such devices do you expect ?

No idea, significantly more than 2, let's say :) But well, you already can 
count a few RealSense USB / UVC cameras on the market.

Concerning metadata for isochronous endpoints. I actually don't know what 
to do with it. I don't have any such cameras with non-standard metadata. 
For the standard metadata it would probably be enough to get either the 
first or the last or the middle payload. Collecting all of them seems 
redundant to me. Maybe I could for now only enable metadata nodes for bulk 
endpoints. Would that be acceptable?

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


Re: [GIT PULL FOR v4.11] Remove FSF postal address

2016-12-08 Thread Mauro Carvalho Chehab
Em Thu, 8 Dec 2016 16:47:28 +0200
Sakari Ailus  escreveu:

> > Ok, if you're doing massive changes on some driver, be my
> > guest and remove the FSF address from it. Otherwise, just live
> > it as-is.  
> 
> This is a cleanup. The patch removes 628 instances of the postal address of
> which 578 are outdated:

Ok, that's a good enough reason to remove it. Please add it at the
patch's description, and I'll apply for 4.11, after the merge window.

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


Re: [GIT PULL FOR v4.11] Remove FSF postal address

2016-12-08 Thread Sakari Ailus
Hi Mauro,

On Thu, Dec 08, 2016 at 10:59:47AM -0200, Mauro Carvalho Chehab wrote:
> Hi Sakari,
> 
> Em Thu, 8 Dec 2016 13:09:20 +0200
> Sakari Ailus  escreveu:
> 
> > Hi Felipe,
> > 
> > On Thu, Dec 08, 2016 at 08:51:20AM -0200, Felipe Sanches wrote:
> > > but why?  
> > 
> > Please see my reply here:
> > 
> > http://www.spinics.net/lists/linux-media/msg107204.html>
> 
> Please don't. If people wanted that, they would be sending a big
> massive change by the time FSF check was added to checkpatch.

Typically it's best to do such changes per-subsystem if there's an intent to
change more than a single driver at a time. Seldom others than those
working on a subsystem would do that.

> 
> This is the kind of patch that can rise conflicts with other
> patches, and don't really benefit the code.

Patches to the media tree are submitted against the media tree master
branch. There are few changes to the media tree that come outside of it,
especially comment sections in files, suggesting a conflict might not be
very likely.

For the record, I rebased this patch from two weeks ago without conflicts.
The patch also cleanly applies to linux-next.

> 
> Ok, if you're doing massive changes on some driver, be my
> guest and remove the FSF address from it. Otherwise, just live
> it as-is.

This is a cleanup. The patch removes 628 instances of the postal address of
which 578 are outdated: that's hardly useful information to keep in the
codebase. Cleaning up useless and outdated code does improve long-term
maintainability of the code, and, as in this case, is additionally supported
by the coding style practices.

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Mauro Carvalho Chehab
commit 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
support") added a logic that overrides TVP5150_CONF_SHARED_PIN setting,
depending on the type of bus set via the .set_fmt() subdev callback.

This is known to cause trobules on devices that don't use a V4L2
subdev devnode, and a fix for it was made by commit 47de9bf8931e
("[media] tvp5150: Fix breakage for serial usage"). Unfortunately,
such fix doesn't consider the case of progressive video inputs,
causing chroma decoding issues on such videos, as it overrides not
only the type of video output, but also other unrelated bits.

So, instead of trying to guess, let's detect if the device configuration
is set via Device Tree. If not, just ignore the new logic, restoring
the original behavior.

Fixes: 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation support")
Cc: Devin Heitmueller 
Cc: Javier Martinez Canillas 
Cc: Laurent Pinchart 
Cc: sta...@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab 
---

changes since version 1: added a notice about what's broken at the
tvp5150_stream() logic, and improved patch's description.

changes since RFC: don't touch at enum v4l2_mbus_type.


 drivers/media/i2c/tvp5150.c | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 6737685d5be5..c9fd36998ac7 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -57,6 +57,7 @@ struct tvp5150 {
u16 rom_ver;
 
enum v4l2_mbus_type mbus_type;
+   bool has_dt;
 };
 
 static inline struct tvp5150 *to_tvp5150(struct v4l2_subdev *sd)
@@ -795,7 +796,7 @@ static int tvp5150_reset(struct v4l2_subdev *sd, u32 val)
 
tvp5150_set_std(sd, decoder->norm);
 
-   if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
+   if (decoder->mbus_type == V4L2_MBUS_PARALLEL || !decoder->has_dt)
tvp5150_write(sd, TVP5150_DATA_RATE_SEL, 0x40);
 
return 0;
@@ -1053,6 +1054,20 @@ static int tvp5150_s_stream(struct v4l2_subdev *sd, int 
enable)
/* Output format: 8-bit ITU-R BT.656 with embedded syncs */
int val = 0x09;
 
+   if (!decoder->has_dt)
+   return 0;
+
+   /*
+* FIXME: the logic below is hardcoded to work with some OMAP3
+* hardware with tvp5151. As such, it hardcodes values for
+* both TVP5150_CONF_SHARED_PIN and TVP5150_MISC_CTL, and ignores
+* what was set before at the driver. Ideally, we should have
+* DT nodes describing the setup, instead of hardcoding those
+* values, and doing a read before writing values to
+* TVP5150_MISC_CTL, but any patch adding support for it should
+* keep DT backward-compatible.
+*/
+
/* Output format: 8-bit 4:2:2 YUV with discrete sync */
if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
val = 0x0d;
@@ -1374,6 +1389,7 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, 
struct device_node *np)
}
 
decoder->mbus_type = bus_cfg.bus_type;
+   decoder->has_dt = true;
 
 #ifdef CONFIG_MEDIA_CONTROLLER
connectors = of_get_child_by_name(np, "connectors");
-- 
2.9.3


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


Re: [PATCH v6 3/3] sound/usb: Use Media Controller API to share media resources

2016-12-08 Thread Shuah Khan
Hi Sakari,

On 12/07/2016 03:27 PM, Sakari Ailus wrote:
> Hi Shuah,
> 
> On Wed, Dec 07, 2016 at 01:03:59PM -0700, Shuah Khan wrote:
>> Hi Sakari,
>>
>> On 12/07/2016 03:52 AM, Sakari Ailus wrote:
>>> Hi Shuah,
>>>
>>> On Mon, Dec 05, 2016 at 05:38:23PM -0700, Shuah Khan wrote:
 On 12/05/2016 04:21 PM, Laurent Pinchart wrote:
> Hi Shuah,
>
> On Monday 05 Dec 2016 15:44:30 Shuah Khan wrote:
>> On 11/30/2016 03:01 PM, Shuah Khan wrote:
>>> Change ALSA driver to use Media Controller API to share media resources
>>> with DVB, and V4L2 drivers on a AU0828 media device.
>>>
>>> Media Controller specific initialization is done after sound card is
>>> registered. ALSA creates Media interface and entity function graph
>>> nodes for Control, Mixer, PCM Playback, and PCM Capture devices.
>>>
>>> snd_usb_hw_params() will call Media Controller enable source handler
>>> interface to request the media resource. If resource request is granted,
>>> it will release it from snd_usb_hw_free(). If resource is busy, -EBUSY 
>>> is
>>> returned.
>>>
>>> Media specific cleanup is done in usb_audio_disconnect().
>>>
>>> Signed-off-by: Shuah Khan 
>>
>> Hi Takashi,
>>
>> If you are good with this patch, could you please Ack it, so Mauro
>> can pull it into media tree with the other two patches in this series,
>> when he is ready to do so.
>
> I *really* want to address the concerns raised by Sakari before pulling 
> more 
> code that makes fixing the race conditions more difficult. Please, let's 
> all 
> work on fixing the core code to build a stable base on which we can build 
> additional features. V4L2 and MC need teamwork, it's time to give the 
> subsystem the love it deserves.
>

 Hi Laurent,

 The issue Sakari brought up is specific to using devm for video_device in
 omap3 and vsp1. I tried reproducing the problem on two different drivers
 and couldn't on Linux 4.9-rc7.

 After sharing that with Sakari, I suggested to Sakari to pull up his patch
 that removes the devm usage and see if he still needs all the patches in 
 his
 patch series. He didn't back to me on that. I also requested him to rebase 
 on
>>>
>>> Just to see what remains, I made a small hack to test this with omap3isp by
>>> just replacing the devm_() functions by their plain counterparts. The memory
>>> is thus never released, for there is no really a proper moment to release it
>>> --- something which the patchset resolves. The result is here:
>>>
>>> http://www.retiisi.org.uk/v4l2/tmp/media-ref-dmesg.txt>
>>
>> Did you test this on 4.9-rc7 without any of your other patches? If you
>> haven't could you please run this test with just the removing devm usage
>> from omap3isp?
>>
>> It would be good to get a baseline on the current with just the not using
>> devm first and then see what needs fixing.
>>
>> Also, could you please send me the complete dmesg.
> 
> Updated from v4.9-rc6 to rc7 and with increased CONFIG_LOG_BUF_SHIFT. The
> diff and dmesg are here:
> 
> http://www.retiisi.org.uk/v4l2/tmp/media-ref-diff2.txt>
> http://www.retiisi.org.uk/v4l2/tmp/media-ref-dmesg2.txt>
> 

Does unbind work on this even without streaming? Could you suppress
debug messages and run unbind without streaming. It might fail. Let
me know if what you see with just unbind on this driver.

I unearthed an old Gumstix Overo that was hiding in my hardware stash
and I am setting it up to test.

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


Re: [PATCH 4/5] media: entity: Split graph walk iteration into two functions

2016-12-08 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Friday 25 Nov 2016 15:55:45 Sakari Ailus wrote:
> With media_entity_graph_walk_next() getting more and more complicated (and
> especially so with has_routing() support added), split the function into
> two.
> 
> Signed-off-by: Sakari Ailus 
> ---
>  drivers/media/media-entity.c | 56 +
>  1 file changed, 30 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index 2bddebb..e242ead 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -338,6 +338,34 @@ void media_graph_walk_start(struct media_graph *graph,
>  }
>  EXPORT_SYMBOL_GPL(media_graph_walk_start);
> 
> +static void graph_walk_iter(struct media_graph *graph)

I'd name the function media_graph_walk_iter(). With that changed,

Reviewed-by: Laurent Pinchart 

> +{
> + struct media_entity *entity = stack_top(graph);
> + struct media_link *link;
> + struct media_entity *next;
> +
> + link = list_entry(link_top(graph), typeof(*link), list);
> +
> + /* The link is not enabled so we do not follow. */
> + if (!(link->flags & MEDIA_LNK_FL_ENABLED)) {
> + link_top(graph) = link_top(graph)->next;
> + return;
> + }
> +
> + /* Get the entity in the other end of the link . */
> + next = media_entity_other(entity, link);
> +
> + /* Has the entity already been visited? */
> + if (media_entity_enum_test_and_set(&graph->ent_enum, next)) {
> + link_top(graph) = link_top(graph)->next;
> + return;
> + }
> +
> + /* Push the new entity to stack and start over. */
> + link_top(graph) = link_top(graph)->next;
> + stack_push(graph, next);
> +}
> +
>  struct media_entity *media_graph_walk_next(struct media_graph *graph)
>  {
>   if (stack_top(graph) == NULL)
> @@ -348,32 +376,8 @@ struct media_entity *media_graph_walk_next(struct
> media_graph *graph) * top of the stack until no more entities on the level
> can be
>* found.
>*/
> - while (link_top(graph) != &stack_top(graph)->links) {
> - struct media_entity *entity = stack_top(graph);
> - struct media_link *link;
> - struct media_entity *next;
> -
> - link = list_entry(link_top(graph), typeof(*link), list);
> -
> - /* The link is not enabled so we do not follow. */
> - if (!(link->flags & MEDIA_LNK_FL_ENABLED)) {
> - link_top(graph) = link_top(graph)->next;
> - continue;
> - }
> -
> - /* Get the entity in the other end of the link . */
> - next = media_entity_other(entity, link);
> -
> - /* Has the entity already been visited? */
> - if (media_entity_enum_test_and_set(&graph->ent_enum, next)) {
> - link_top(graph) = link_top(graph)->next;
> - continue;
> - }
> -
> - /* Push the new entity to stack and start over. */
> - link_top(graph) = link_top(graph)->next;
> - stack_push(graph, next);
> - }
> + while (link_top(graph) != &stack_top(graph)->links)
> + graph_walk_iter(graph);
> 
>   return stack_pop(graph);
>  }

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Mauro Carvalho Chehab
Em Thu, 08 Dec 2016 15:41:59 +0200
Laurent Pinchart  escreveu:

> Hi Mauro,
> 
> On Thursday 08 Dec 2016 11:38:34 Mauro Carvalho Chehab wrote:
> > changeset 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
> > support") added a logic that overrides TVP5150_CONF_SHARED_PIN setting,
> > depending on the type of bus set via the .set_fmt() subdev callback.
> > 
> > This is known to cause trobules on devices that don't use a V4L2
> > subdev devnode, and a fix for it was made by changeset 47de9bf8931e
> > ("[media] tvp5150: Fix breakage for serial usage"). Unfortunately,
> > such fix doesn't consider the case of progressive video inputs,
> > causing chroma decoding issues on such videos, as it overrides not
> > only the type of video output, but also other unrelated bits.
> > 
> > So, instead of trying to guess, let's detect if the device is set
> > via Device Tree. If not, just ignore the bogus logic.  
> 
> If you add a big [HACK] tag to the subject line, sure. I thought this would 
> have been an occasion to fix the problem correctly :-(

No, this is not a hack.

It is a patch that restores the driver behavior that used to be
before adding DT support to the driver. Whatever DT-based drivers
need, it *should not* change the behavior for devices that don't
use DT.

I agree with you that the patch is incomplete, as it doesn't
add any OF var that would allow DT to specify the values
to be used for TVP5150_CONF_SHARED_PIN and TVP5150_MISC_CTL,
and assumes that tvp5150, tvp5151 and tvp5150am1 will all use
the same values for TVP5150_MISC_CTL.

In order to fix that, someone with a DT-based driver with tvp5150, 
tvp5150am1 and/or tvp5151 would need to spend some time and test
the hardware with both interlaced and progressive video inputs.

That's not me, as I don't have any hardware that meets such requirement.

If someone ships me such hardware, I could work on it on my spare time. 
Otherwise, then perhaps you could work on such patch - or we could ping 
Javier on Monday and see if has time/interest to work on it (afaikt, he's
OOT the rest of this week).

Anyway, with this patch applied, the one working on such fix won't need
to be concerned to cause new regressions on the non-DT drivers that use
this chip, with is, IMHO, a very good thing.

Also, this patch is simple enough to be backported to -stable.

What's missing here is a notice explaining what's left to be done,
like the one on the diff below.

Regards,
Mauro

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index eb43ac7002d6..c9fd36998ac7 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -1057,6 +1057,17 @@ static int tvp5150_s_stream(struct v4l2_subdev *sd, int 
enable)
if (!decoder->has_dt)
return 0;
 
+   /*
+* FIXME: the logic below is hardcoded to work with some OMAP3
+* hardware with tvp5151. As such, it hardcodes values for
+* both TVP5150_CONF_SHARED_PIN and TVP5150_MISC_CTL, and ignores
+* what was set before at the driver. Ideally, we should have
+* DT nodes describing the setup, instead of hardcoding those
+* values, and doing a read before writing values to
+* TVP5150_MISC_CTL, but any patch adding support for it should
+* keep DT backward-compatible.
+*/
+
/* Output format: 8-bit 4:2:2 YUV with discrete sync */
if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
val = 0x0d;

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


Re: [PATCH 5/5] media: entity: Add debug information to graph walk

2016-12-08 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Friday 25 Nov 2016 15:55:46 Sakari Ailus wrote:
> Use dev_dbg() to tell about the progress of the graph traversal algorithm.
> This is intended to make debugging of the algorithm easier.
> 
> Signed-off-by: Sakari Ailus 
> ---
>  drivers/media/media-entity.c | 19 ++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index e242ead..186906b 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -335,6 +335,8 @@ void media_graph_walk_start(struct media_graph *graph,
>   graph->top = 0;
>   graph->stack[graph->top].entity = NULL;
>   stack_push(graph, entity);
> + dev_dbg(entity->graph_obj.mdev->dev,
> + "begin graph walk at \"%s\"\n", entity->name);

I'd use single quotes around entity names as that's more common in English 
(and in the kernel) and would avoid having to escape the quotes. Apart from 
that,

Reviewed-by: Laurent Pinchart 

>  }
>  EXPORT_SYMBOL_GPL(media_graph_walk_start);
> 
> @@ -349,6 +351,10 @@ static void graph_walk_iter(struct media_graph *graph)
>   /* The link is not enabled so we do not follow. */
>   if (!(link->flags & MEDIA_LNK_FL_ENABLED)) {
>   link_top(graph) = link_top(graph)->next;
> + dev_dbg(entity->graph_obj.mdev->dev,
> + "walk: skipping disabled link \"%s\":%u -> \"%s\":
%u\n",
> + link->source->entity->name, link->source->index,
> + link->sink->entity->name, link->sink->index);
>   return;
>   }
> 
> @@ -358,16 +364,23 @@ static void graph_walk_iter(struct media_graph *graph)
> /* Has the entity already been visited? */
>   if (media_entity_enum_test_and_set(&graph->ent_enum, next)) {
>   link_top(graph) = link_top(graph)->next;
> + dev_dbg(entity->graph_obj.mdev->dev,
> + "walk: skipping entity \"%s\" (already seen)\n",
> + next->name);
>   return;
>   }
> 
>   /* Push the new entity to stack and start over. */
>   link_top(graph) = link_top(graph)->next;
>   stack_push(graph, next);
> + dev_dbg(entity->graph_obj.mdev->dev, "walk: pushing \"%s\" on 
stack\n",
> + next->name);
>  }
> 
>  struct media_entity *media_graph_walk_next(struct media_graph *graph)
>  {
> + struct media_entity *entity;
> +
>   if (stack_top(graph) == NULL)
>   return NULL;
> 
> @@ -379,7 +392,11 @@ struct media_entity *media_graph_walk_next(struct
> media_graph *graph) while (link_top(graph) != &stack_top(graph)->links)
>   graph_walk_iter(graph);
> 
> - return stack_pop(graph);
> + entity = stack_pop(graph);
> + dev_dbg(entity->graph_obj.mdev->dev,
> + "walk: returning entity \"%s\"\n", entity->name);
> +
> + return entity;
>  }
>  EXPORT_SYMBOL_GPL(media_graph_walk_next);

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 1/5] media: entity: Fix stream count check

2016-12-08 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Friday 25 Nov 2016 15:55:42 Sakari Ailus wrote:
> There's a sanity check for the stream count remaining positive or zero on
> error path, but instead of performing the check on the traversed entity it
> is performed on the entity where traversal ends. Fix this.
> 
> Fixes: commit 3801bc7d1b8d ("[media] media: Media Controller fix to not let
> stream_count go negative") Signed-off-by: Sakari Ailus
> 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/media/media-entity.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index 58d9fa6..da46706 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -484,7 +484,7 @@ __must_check int __media_entity_pipeline_start(struct
> media_entity *entity,
> 
>   while ((entity_err = media_entity_graph_walk_next(graph))) {
>   /* don't let the stream_count go negative */
> - if (entity->stream_count > 0) {
> + if (entity_err->stream_count > 0) {
>   entity_err->stream_count--;
>   if (entity_err->stream_count == 0)
>   entity_err->pipe = NULL;

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 3/5] media: Rename graph and pipeline structs and functions

2016-12-08 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Friday 25 Nov 2016 15:55:44 Sakari Ailus wrote:
> The media_entity_pipeline_start() and media_entity_pipeline_stop()
> functions are renamed as media_pipeline_start() and media_pipeline_stop(),
> respectively. The reason is two-fold: the pipeline struct is, rightly,
> already called media_pipeline (rather than media_entity_pipeline) and what
> this really is about is a pipeline. A pipeline consists of entities ---
> and, well, other objects embedded in these entities.
> 
> As the pipeline object will be in the future moved from entities to pads
> in order to support multiple pipelines through a single entity, do the
> renaming now.
> 
> Similarly, functions operating on struct media_entity_graph as well as the
> struct itself are renamed by dropping the "entity_" part from the prefix
> of the function family and the data structure. The graph traversal which
> is what the functions are about is not specifically about entities only
> and will operate on pads for the same reason as the media pipeline.
> 
> The patch has been generated using the following command:
> 
> git grep -l media_entity |xargs perl -i -pe '
>   s/media_entity_pipeline/media_pipeline/g;
>   s/media_entity_graph/media_graph/g'
> 
> And a few manual edits related to line start alignment and line wrapping.
> 
> Signed-off-by: Sakari Ailus 

Acked-by: Laurent Pinchart 

> ---
>  Documentation/media/kapi/mc-core.rst   | 18 ++---
>  drivers/media/media-device.c   |  8 +--
>  drivers/media/media-entity.c   | 77 ++-
>  drivers/media/platform/exynos4-is/fimc-capture.c   |  8 +--
>  drivers/media/platform/exynos4-is/fimc-isp-video.c |  8 +--
>  drivers/media/platform/exynos4-is/fimc-lite.c  |  8 +--
>  drivers/media/platform/exynos4-is/media-dev.c  | 16 ++---
>  drivers/media/platform/exynos4-is/media-dev.h  |  2 +-
>  drivers/media/platform/omap3isp/ispvideo.c | 16 ++---
>  drivers/media/platform/s3c-camif/camif-capture.c   |  6 +-
>  drivers/media/platform/vsp1/vsp1_drm.c |  4 +-
>  drivers/media/platform/vsp1/vsp1_video.c   | 16 ++---
>  drivers/media/platform/xilinx/xilinx-dma.c | 16 ++---
>  drivers/media/usb/au0828/au0828-core.c |  4 +-
>  drivers/media/v4l2-core/v4l2-mc.c  | 18 ++---
>  drivers/staging/media/davinci_vpfe/vpfe_video.c| 25 ---
>  drivers/staging/media/davinci_vpfe/vpfe_video.h|  2 +-
>  drivers/staging/media/omap4iss/iss_video.c | 32 -
>  include/media/media-device.h   |  2 +-
>  include/media/media-entity.h   | 65 +-
>  20 files changed, 174 insertions(+), 177 deletions(-)

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 2/5] media: entity: Be vocal about failing sanity checks

2016-12-08 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Friday 25 Nov 2016 15:55:43 Sakari Ailus wrote:
> Commit 3801bc7d1b8d ("[media] media: Media Controller fix to not let
> stream_count go negative") added a sanity check for negative stream_count,
> but a failure of the check remained silent. Make sure the failure is
> noticed.
> 
> Signed-off-by: Sakari Ailus 

Reviewed-by: Laurent Pinchart 
> ---
>  drivers/media/media-entity.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index da46706..82dd0bc 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -483,8 +483,8 @@ __must_check int __media_entity_pipeline_start(struct
> media_entity *entity, media_entity_graph_walk_start(graph, entity_err);
> 
>   while ((entity_err = media_entity_graph_walk_next(graph))) {
> - /* don't let the stream_count go negative */
> - if (entity_err->stream_count > 0) {
> + /* Sanity check for negative stream_count */
> + if (!WARN_ON_ONCE(entity_err->stream_count <= 0)) {
>   entity_err->stream_count--;
>   if (entity_err->stream_count == 0)
>   entity_err->pipe = NULL;
> @@ -529,8 +529,8 @@ void __media_entity_pipeline_stop(struct media_entity
> *entity) media_entity_graph_walk_start(graph, entity);
> 
>   while ((entity = media_entity_graph_walk_next(graph))) {
> - /* don't let the stream_count go negative */
> - if (entity->stream_count > 0) {
> + /* Sanity check for negative stream_count */
> + if (!WARN_ON_ONCE(entity->stream_count <= 0)) {
>   entity->stream_count--;
>   if (entity->stream_count == 0)
>   entity->pipe = NULL;

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH RFC] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Laurent Pinchart
Hi Mauro,

On Thursday 08 Dec 2016 11:41:43 Mauro Carvalho Chehab wrote:
> Em Thu, 08 Dec 2016 15:02:28 +0200 Laurent Pinchart escreveu:
> > On Thursday 08 Dec 2016 10:53:33 Mauro Carvalho Chehab wrote:
> >> Em Thu, 08 Dec 2016 14:25:38 +0200 Laurent Pinchart escreveu:
> >>> On Thursday 08 Dec 2016 06:55:58 Mauro Carvalho Chehab wrote:
>  changeset 460b6c0831cb ("[media] tvp5150: Add s_stream subdev
>  operation support") added a logic that overrides
>  TVP5150_CONF_SHARED_PIN setting, depending on the type of bus set via
>  the .set_fmt() subdev callback.
>  
>  This is known to cause trobules on devices that don't use a V4L2
>  subdev devnode, and a fix for it was made by changeset 47de9bf8931e
>  ("[media] tvp5150: Fix breakage for serial usage"). Unfortunately,
>  such fix doesn't consider the case of progressive video inputs,
>  causing chroma decoding issues on such videos, as it overrides not
>  only the type of video output, but also other unrelated bits.
>  
>  So, instead of trying to guess, let's detect if the device is set
>  via a V4L2 subdev node or not. If not, just ignore the bogus logic.
>  
>  Fixes: 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
>  support") Cc: Devin Heitmueller 
>  Cc: Javier Martinez Canillas 
>  Cc: Laurent Pinchart ,
>  Signed-off-by: Mauro Carvalho Chehab 
>  ---
>  
>  Devin,
>  
>  I didn't test this patch. As I explained on my previous e-mail, my
>  current test scenario for analog TV inputs is not  ideal, as I lack
>  progressive video and RF output testcases.
>  
>  Could you please test if this will fix for you?
>  
>  Laurent/Javier,
>  
>  With regards to OMAP3, it would be good to try to reproduce the
>  issues Devin noticed on your hardware, testing with both progressive
>  and interlaced sources and checking if the chroma is being decoded
>  properly or not with a NTSC signal.
>  
>   drivers/media/i2c/tvp5150.c  | 7 ++-
>   drivers/media/platform/pxa_camera.c  | 1 +
>   drivers/media/platform/soc_camera/soc_mediabus.c | 1 +
>   include/media/v4l2-mediabus.h| 3 +++
>   4 files changed, 11 insertions(+), 1 deletion(-)
> >>> 
> >>> [snip]
> >>> 
>  diff --git a/include/media/v4l2-mediabus.h
>  b/include/media/v4l2-mediabus.h
>  index 34cc99e093ef..8af6b96d628b 100644
>  --- a/include/media/v4l2-mediabus.h
>  +++ b/include/media/v4l2-mediabus.h
>  @@ -70,11 +70,14 @@
>    * @V4L2_MBUS_BT656:parallel interface with embedded
>    synchronisation, can
>    *  also be used for BT.1120
>    * @V4L2_MBUS_CSI2: MIPI CSI-2 serial interface
>  + * @V4L2_MBUS_UNKNOWN:  used to indicate that the device is not
>  controlled
>  + *  via a V4L2 subdev devnode interface
> >>> 
> >>> Please, don't. v4l2_mbus_type has nothing to do with subdev device
> >>> nodes. It identifies the type of physical bus used to carry video data.
> >> 
> >> As explained, for the devices that the regression was introduced,
> >> there's no way to control the physical bus, as it is hardwired.
> >> 
> >> For those devices, mbus_type is just an useless information.
> > 
> > But the fact that a field is not used in some cases is no excuse to abuse
> > it for something completely unrelated to its purpose.
> > 
> >> The problem that your patch introduced is that it now assumes that
> >> the mbus would be controlled via a V4L2 subdevice. This is a wrong
> >> assumption, and caused a regression.
> >> 
> >> So, we need a simple way to get rid of the broken code on those
> >> devices, and that's the simplest way.
> > 
> > We need a correct way to fix the problem, and this isn't the correct way.
> > 
> > > If you didn't like the name, we could, instead, call it as:
> > > V4L2_MBUS_CONTROLLED_BY_VIDEODEV, with actually tells more about it.
> > 
> > No, V4L2_MBUS_* has *nothing* to do with how the device is controlled.
> 
> Well then your patch is wrong, as it *does* control the device based
> on the value of V4L2_MBUS_*.

???

> Anyway, there's another way to handle it: check if the device is
> controlled via DT, enabling the new (IMHO broken - see below) behavior only
> if it has DT. That will fix the regression without affecting OMAP3.

A device is never "controlled via DT", there's no such thing. It can be 
described in and instantiated from DT, but certainly not controlled.

> Patch sent.
> 
> Btw, the current logic is IMHO crap, as it just override all bits of
> mbus, even the ones unrelated to bt656 setup at register TVP5150_MISC_CTL.

Of course it is, that's why it's a bug. The code should certainly not override 
unrelated bits.

> It also doesn't consider the other parts of the driver that change
> the init values for S-Video setup, and do different init depending
> 

Re: [PATCH RFC] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Mauro Carvalho Chehab
Em Thu, 08 Dec 2016 15:02:28 +0200
Laurent Pinchart  escreveu:

> Hi Mauro,
> 
> On Thursday 08 Dec 2016 10:53:33 Mauro Carvalho Chehab wrote:
> > Em Thu, 08 Dec 2016 14:25:38 +0200 Laurent Pinchart escreveu:  
> > > On Thursday 08 Dec 2016 06:55:58 Mauro Carvalho Chehab wrote:  
> > >> changeset 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
> > >> support") added a logic that overrides TVP5150_CONF_SHARED_PIN setting,
> > >> depending on the type of bus set via the .set_fmt() subdev callback.
> > >> 
> > >> This is known to cause trobules on devices that don't use a V4L2
> > >> subdev devnode, and a fix for it was made by changeset 47de9bf8931e
> > >> ("[media] tvp5150: Fix breakage for serial usage"). Unfortunately,
> > >> such fix doesn't consider the case of progressive video inputs,
> > >> causing chroma decoding issues on such videos, as it overrides not
> > >> only the type of video output, but also other unrelated bits.
> > >> 
> > >> So, instead of trying to guess, let's detect if the device is set
> > >> via a V4L2 subdev node or not. If not, just ignore the bogus logic.
> > >> 
> > >> Fixes: 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
> > >> support") Cc: Devin Heitmueller 
> > >> Cc: Javier Martinez Canillas 
> > >> Cc: Laurent Pinchart ,
> > >> Signed-off-by: Mauro Carvalho Chehab 
> > >> ---
> > >> 
> > >> Devin,
> > >> 
> > >> I didn't test this patch. As I explained on my previous e-mail, my
> > >> current test scenario for analog TV inputs is not  ideal, as I lack
> > >> progressive video and RF output testcases.
> > >> 
> > >> Could you please test if this will fix for you?
> > >> 
> > >> Laurent/Javier,
> > >> 
> > >> With regards to OMAP3, it would be good to try to reproduce the issues
> > >> Devin noticed on your hardware, testing with both progressive and
> > >> interlaced sources and checking if the chroma is being decoded properly
> > >> or not with a NTSC signal.
> > >> 
> > >>  drivers/media/i2c/tvp5150.c  | 7 ++-
> > >>  drivers/media/platform/pxa_camera.c  | 1 +
> > >>  drivers/media/platform/soc_camera/soc_mediabus.c | 1 +
> > >>  include/media/v4l2-mediabus.h| 3 +++
> > >>  4 files changed, 11 insertions(+), 1 deletion(-)  
> > > 
> > > [snip]
> > >   
> > >> diff --git a/include/media/v4l2-mediabus.h
> > >> b/include/media/v4l2-mediabus.h
> > >> index 34cc99e093ef..8af6b96d628b 100644
> > >> --- a/include/media/v4l2-mediabus.h
> > >> +++ b/include/media/v4l2-mediabus.h
> > >> @@ -70,11 +70,14 @@
> > >>   * @V4L2_MBUS_BT656:parallel interface with embedded
> > >>   synchronisation, can
> > >>   *  also be used for BT.1120
> > >>   * @V4L2_MBUS_CSI2: MIPI CSI-2 serial interface
> > >> + * @V4L2_MBUS_UNKNOWN:  used to indicate that the device is not
> > >> controlled
> > >> + *  via a V4L2 subdev devnode interface  
> > > 
> > > Please, don't. v4l2_mbus_type has nothing to do with subdev device nodes.
> > > It identifies the type of physical bus used to carry video data.  
> > 
> > As explained, for the devices that the regression was introduced,
> > there's no way to control the physical bus, as it is hardwired.
> > 
> > For those devices, mbus_type is just an useless information.  
> 
> But the fact that a field is not used in some cases is no excuse to abuse it 
> for something completely unrelated to its purpose.
> 
> > The problem that your patch introduced is that it now assumes that
> > the mbus would be controlled via a V4L2 subdevice. This is a wrong
> > assumption, and caused a regression.
> > 
> > So, we need a simple way to get rid of the broken code on those
> > devices, and that's the simplest way.  
> 
> We need a correct way to fix the problem, and this isn't the correct way.
> 
> > If you didn't like the name, we could, instead, call it as:
> > V4L2_MBUS_CONTROLLED_BY_VIDEODEV, with actually tells more about it.  
> 
> No, V4L2_MBUS_* has *nothing* to do with how the device is controlled. 

Well then your patch is wrong, as it *does* control the device based
on the value of V4L2_MBUS_*.

Anyway, there's another way to handle it: check if the device is
controlled via DT, enabling the new (IMHO broken - see below) behavior only
if it has DT. That will fix the regression without affecting OMAP3.

Patch sent.

Btw, the current logic is IMHO crap, as it just override all bits of
mbus, even the ones unrelated to bt656 setup at register TVP5150_MISC_CTL.

It also doesn't consider the other parts of the driver that change
the init values for S-Video setup, and do different init depending
on the version of the chipset (tvp5150 uses a different init than
tvp5150am1).

It also overrides TVP5150_CONF_SHARED_PIN from its default without
any good reason.

The right thing seems to touch only on the bits that control the
output format, and read the setup for TVP5150_CONF_SHARED_PIN
from DT.

> 
> > ---
> > 
> > That's said, as OMAP3 support 

Re: [PATCH] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Laurent Pinchart
Hi Mauro,

On Thursday 08 Dec 2016 11:38:34 Mauro Carvalho Chehab wrote:
> changeset 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
> support") added a logic that overrides TVP5150_CONF_SHARED_PIN setting,
> depending on the type of bus set via the .set_fmt() subdev callback.
> 
> This is known to cause trobules on devices that don't use a V4L2
> subdev devnode, and a fix for it was made by changeset 47de9bf8931e
> ("[media] tvp5150: Fix breakage for serial usage"). Unfortunately,
> such fix doesn't consider the case of progressive video inputs,
> causing chroma decoding issues on such videos, as it overrides not
> only the type of video output, but also other unrelated bits.
> 
> So, instead of trying to guess, let's detect if the device is set
> via Device Tree. If not, just ignore the bogus logic.

If you add a big [HACK] tag to the subject line, sure. I thought this would 
have been an occasion to fix the problem correctly :-(

> Fixes: 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
> support") Cc: Devin Heitmueller 
> Cc: Javier Martinez Canillas 
> Cc: Laurent Pinchart ,
> Signed-off-by: Mauro Carvalho Chehab 
> ---
>  drivers/media/i2c/tvp5150.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
> index 6737685d5be5..eb43ac7002d6 100644
> --- a/drivers/media/i2c/tvp5150.c
> +++ b/drivers/media/i2c/tvp5150.c
> @@ -57,6 +57,7 @@ struct tvp5150 {
>   u16 rom_ver;
> 
>   enum v4l2_mbus_type mbus_type;
> + bool has_dt;
>  };
> 
>  static inline struct tvp5150 *to_tvp5150(struct v4l2_subdev *sd)
> @@ -795,7 +796,7 @@ static int tvp5150_reset(struct v4l2_subdev *sd, u32
> val)
> 
>   tvp5150_set_std(sd, decoder->norm);
> 
> - if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
> + if (decoder->mbus_type == V4L2_MBUS_PARALLEL || !decoder->has_dt)
>   tvp5150_write(sd, TVP5150_DATA_RATE_SEL, 0x40);
> 
>   return 0;
> @@ -1053,6 +1054,9 @@ static int tvp5150_s_stream(struct v4l2_subdev *sd,
> int enable)
>   /* Output format: 8-bit ITU-R BT.656 with embedded syncs */
>   int val = 0x09;
> 
> + if (!decoder->has_dt)
> + return 0;
> +
>   /* Output format: 8-bit 4:2:2 YUV with discrete sync */
>   if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
>   val = 0x0d;
> @@ -1374,6 +1378,7 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder,
> struct device_node *np)
>   }
> 
>   decoder->mbus_type = bus_cfg.bus_type;
> + decoder->has_dt = true;
> 
>  #ifdef CONFIG_MEDIA_CONTROLLER
>   connectors = of_get_child_by_name(np, "connectors");

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH v2 3/3] uvcvideo: add a metadata device node

2016-12-08 Thread Laurent Pinchart
Hi Guennadi,

On Thursday 08 Dec 2016 14:34:46 Guennadi Liakhovetski wrote:
> On Tue, 6 Dec 2016, Laurent Pinchart wrote:
> > On Tuesday 06 Dec 2016 11:39:22 Guennadi Liakhovetski wrote:
> >> On Tue, 6 Dec 2016, Laurent Pinchart wrote:
> >>> On Monday 05 Dec 2016 23:13:53 Guennadi Liakhovetski wrote:
>  On Tue, 6 Dec 2016, Laurent Pinchart wrote:
>  +/*
>  + * Register a metadata node. TODO: shall this only be enabled
>  for some
>  + * cameras?
>  + */
>  +if (!(dev->quirks & UVC_QUIRK_BUILTIN_ISIGHT))
>  +uvc_meta_register(stream);
>  +
> >>> 
> >>> I think so, only for the cameras that can produce metadata.
> >> 
> >> Every UVC camera produces metadata, but most cameras only have
> >> standard fields there. Whether we should stream standard header
> >> fields from the metadata node will be discussed later. If we do
> >> decide to stream standard header fields, then every USB camera gets
> >> metadata nodes. If we decide not to include standard fields, how do
> >> we know whether the camera has any private fields in headers
> >> without streaming from it? Do you want a quirk for such cameras?
> > 
> > Unless they can be detected in a standard way that's probably the
> > best solution.
> 
> How about a module parameter with a list of VID:PID pairs?

I'd like something that works out of the box for end-users, at least in most 
cases. There's already a way to set quirks through a module parameter, and I 
think I'd accept a patch extending that it make it VID:PID dependent. That's 
an acceptable solution for testing, but should not be considered as the way to 
go for production.

> The problem with the quirk is, that as vendors produce multiple cameras with
> different PIDs they will have to push patches for each such camera.

How many such devices do you expect ?

-- 
Regards,

Laurent Pinchart

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


[PATCH] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Mauro Carvalho Chehab
changeset 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
support") added a logic that overrides TVP5150_CONF_SHARED_PIN setting,
depending on the type of bus set via the .set_fmt() subdev callback.

This is known to cause trobules on devices that don't use a V4L2
subdev devnode, and a fix for it was made by changeset 47de9bf8931e
("[media] tvp5150: Fix breakage for serial usage"). Unfortunately,
such fix doesn't consider the case of progressive video inputs,
causing chroma decoding issues on such videos, as it overrides not
only the type of video output, but also other unrelated bits.

So, instead of trying to guess, let's detect if the device is set
via Device Tree. If not, just ignore the bogus logic.

Fixes: 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation support")
Cc: Devin Heitmueller 
Cc: Javier Martinez Canillas 
Cc: Laurent Pinchart ,
Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/i2c/tvp5150.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 6737685d5be5..eb43ac7002d6 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -57,6 +57,7 @@ struct tvp5150 {
u16 rom_ver;
 
enum v4l2_mbus_type mbus_type;
+   bool has_dt;
 };
 
 static inline struct tvp5150 *to_tvp5150(struct v4l2_subdev *sd)
@@ -795,7 +796,7 @@ static int tvp5150_reset(struct v4l2_subdev *sd, u32 val)
 
tvp5150_set_std(sd, decoder->norm);
 
-   if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
+   if (decoder->mbus_type == V4L2_MBUS_PARALLEL || !decoder->has_dt)
tvp5150_write(sd, TVP5150_DATA_RATE_SEL, 0x40);
 
return 0;
@@ -1053,6 +1054,9 @@ static int tvp5150_s_stream(struct v4l2_subdev *sd, int 
enable)
/* Output format: 8-bit ITU-R BT.656 with embedded syncs */
int val = 0x09;
 
+   if (!decoder->has_dt)
+   return 0;
+
/* Output format: 8-bit 4:2:2 YUV with discrete sync */
if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
val = 0x0d;
@@ -1374,6 +1378,7 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, 
struct device_node *np)
}
 
decoder->mbus_type = bus_cfg.bus_type;
+   decoder->has_dt = true;
 
 #ifdef CONFIG_MEDIA_CONTROLLER
connectors = of_get_child_by_name(np, "connectors");
-- 
2.9.3

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


Re: [PATCH v2 3/3] uvcvideo: add a metadata device node

2016-12-08 Thread Guennadi Liakhovetski
Hi Laurent,

One more question:

On Tue, 6 Dec 2016, Laurent Pinchart wrote:

> Hi Guennadi,
> 
> On Tuesday 06 Dec 2016 11:39:22 Guennadi Liakhovetski wrote:
> > On Tue, 6 Dec 2016, Laurent Pinchart wrote:
> > > On Monday 05 Dec 2016 23:13:53 Guennadi Liakhovetski wrote:
> > >> On Tue, 6 Dec 2016, Laurent Pinchart wrote:
> > >> +/*
> > >> + * Register a metadata node. TODO: shall this only be enabled
> > >> for some
> > >> + * cameras?
> > >> + */
> > >> +if (!(dev->quirks & UVC_QUIRK_BUILTIN_ISIGHT))
> > >> +uvc_meta_register(stream);
> > >> +
> > > 
> > > I think so, only for the cameras that can produce metadata.
> >  
> >  Every UVC camera produces metadata, but most cameras only have standard
> >  fields there. Whether we should stream standard header fields from the
> >  metadata node will be discussed later. If we do decide to stream
> >  standard header fields, then every USB camera gets metadata nodes. If
> >  we decide not to include standard fields, how do we know whether the
> >  camera has any private fields in headers without streaming from it? Do
> >  you want a quirk for such cameras?
> > >>> 
> > >>> Unless they can be detected in a standard way that's probably the best
> > >>> solution.

How about a module parameter with a list of VID:PID pairs? The problem 
with the quirk is, that as vendors produce multiple cameras with different 
PIDs they will have to push patches for each such camera.

Thanks
Guennadi
--
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


uvcvideo logging kernel warnings on device disconnect

2016-12-08 Thread Dave Stevenson

Hi All.

I'm working with a USB webcam which has been seen to spontaneously 
disconnect when in use. That's a separate issue, but when it does it 
throws a load of warnings into the kernel log if there is a file handle 
on the device open at the time, even if not streaming.


I've reproduced this with a generic Logitech C270 webcam on:
- Ubuntu 16.04 (kernel 4.4.0-51) vanilla, and with the latest media tree 
from linuxtv.org

- Ubuntu 14.04 (kernel 4.4.0-42) vanilla
- an old 3.10.x tree on an embedded device.

To reproduce:
- connect USB webcam.
- run a simple app that opens /dev/videoX, sleeps for a while, and then 
closes the handle.

- disconnect the webcam whilst the app is running.
- read kernel logs - observe warnings. We get the disconnect logged as 
it occurs, but the warnings all occur when the file descriptor is 
closed. (A copy of the logs from my Ubuntu 14.04 machine are below).


I can fully appreciate that the open file descriptor is holding 
references to a now invalid device, but is there a way to avoid them? Or 
do we really not care and have to put up with the log noise when doing 
such silly things?


Thanks in advance.
  Dave

[157877.297617] usb 1-1: new high-speed USB device number 12 using xhci_hcd
[157877.698744] usb 1-1: New USB device found, idVendor=046d, idProduct=0825
[157877.698747] usb 1-1: New USB device strings: Mfr=0, Product=0, 
SerialNumber=2

[157877.698749] usb 1-1: SerialNumber: E989E680
[157877.699314] uvcvideo: Found UVC 1.00 device  (046d:0825)
[157877.789891] input: UVC Camera (046d:0825) as 
/devices/pci:00/:00:14.0/usb1/1-1/1-1:1.0/input/input688

[157879.135333] usb 1-1: set resolution quirk: cval->res = 384

[157885.686043] usb 1-1: USB disconnect, device number 12

[157901.378104] [ cut here ]
[157901.378111] WARNING: CPU: 2 PID: 21082 at 
/build/linux-lts-xenial-Ev_ZZB/linux-lts-xenial-4.4.0/fs/sysfs/group.c:237 
sysfs_remove_group+0x8d/0x90()

[157901.378113] sysfs group 81ecb6c0 not found for kobject 'event13'
[157901.378114] Modules linked in: snd_usb_audio snd_usbmidi_lib uas 
usb_storage ufs qnx4 hfsplus hfs minix ntfs msdos jfs xfs libcrc32c drbg 
ansi_cprng ctr ccm dm_crypt cmac asus_nb_wmi asus_wmi sparse_keymap 
snd_soc_rt5640 snd_soc_rl6231 snd_soc_core arc4 snd_compress ac97_bus 
snd_pcm_dmaengine uvcvideo snd_seq_midi videobuf2_vmalloc 
videobuf2_memops snd_seq_midi_event videobuf2_v4l2 intel_rapl 
videobuf2_core v4l2_common x86_pkg_temp_thermal videodev 
intel_powerclamp media kvm_intel iwlmvm dm_multipath snd_rawmidi kvm 
mac80211 snd_hda_codec_hdmi irqbypass crct10dif_pclmul crc32_pclmul 
snd_hda_codec_conexant snd_hda_codec_generic btusb rfcomm btrtl btbcm 
bnep snd_hda_intel snd_hda_codec btintel iwlwifi bluetooth snd_seq 
snd_hda_core snd_hwdep aesni_intel aes_x86_64 lrw gf128mul glue_helper 
ablk_helper cryptd input_leds cfg80211 snd_pcm joydev nfsd serio_raw 
mei_me snd_seq_device auth_rpcgss nfs_acl mei processor_thermal_device 
intel_soc_dts_iosf lpc_ich snd_timer binfmt_misc shpchp 
intel_pch_thermal nfs lockd grace sunrpc fscache snd soundcore elan_i2c 
i2c_hid hid int3402_thermal int340x_thermal_zone nls_iso8859_1 dw_dmac 
int3400_thermal snd_soc_sst_acpi dw_dmac_core acpi_als acpi_pad 
i2c_designware_platform kfifo_buf i2c_designware_core 8250_dw 
spi_pxa2xx_platform parport_pc industrialio acpi_thermal_rel ppdev 
coretemp mac_hid lp parport btrfs xor raid6_pq dm_mirror dm_region_hash 
dm_log i915 i2c_algo_bit drm_kms_helper syscopyarea sysfillrect 
sysimgblt fb_sys_fops drm ahci psmouse libahci wmi video sdhci_acpi 
sdhci fjes
[157901.378184] CPU: 2 PID: 21082 Comm: a.out Not tainted 
4.4.0-42-generic #62~14.04.1-Ubuntu

[157901.378185] Hardware name: ASUSTeK COMPUTER INC.
[157901.378186]   8800da3a7bb8 813d51ec 
8800da3a7c00
[157901.378188]  81cdd3b0 8800da3a7bf0 8107d886 

[157901.378190]  81ecb6c0 8800bb2e08c0 8800d93f6248 
8801081b9540

[157901.378192] Call Trace:
[157901.378197]  [] dump_stack+0x63/0x87
[157901.378200]  [] warn_slowpath_common+0x86/0xc0
[157901.378202]  [] warn_slowpath_fmt+0x4c/0x50
[157901.378204]  [] ? kernfs_find_and_get_ns+0x48/0x60
[157901.378206]  [] sysfs_remove_group+0x8d/0x90
[157901.378209]  [] dpm_sysfs_remove+0x57/0x60
[157901.378211]  [] device_del+0x58/0x260
[157901.378213]  [] ? kbd_disconnect+0x22/0x30
[157901.378216]  [] evdev_disconnect+0x23/0x60
[157901.378218]  [] __input_unregister_device+0xb8/0x160
[157901.378219]  [] input_unregister_device+0x47/0x70
[157901.378223]  [] uvc_status_cleanup+0x42/0x50 
[uvcvideo]

[157901.378226]  [] uvc_delete+0x18/0x150 [uvcvideo]
[157901.378228]  [] uvc_release+0x23/0x30 [uvcvideo]
[157901.378233]  [] v4l2_device_release+0xcb/0x100 
[videodev]

[157901.378236]  [] device_release+0x32/0xa0
[157901.378237]  [] kobject_cleanup+0x77/0x190
[157901.378239]  [] kobject_put+0x25/0x50
[157901.378240]  [] put_device+0x17/0x20
[157901.37

Re: [PATCH RFC] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Laurent Pinchart
Hi Mauro,

On Thursday 08 Dec 2016 10:53:33 Mauro Carvalho Chehab wrote:
> Em Thu, 08 Dec 2016 14:25:38 +0200 Laurent Pinchart escreveu:
> > On Thursday 08 Dec 2016 06:55:58 Mauro Carvalho Chehab wrote:
> >> changeset 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
> >> support") added a logic that overrides TVP5150_CONF_SHARED_PIN setting,
> >> depending on the type of bus set via the .set_fmt() subdev callback.
> >> 
> >> This is known to cause trobules on devices that don't use a V4L2
> >> subdev devnode, and a fix for it was made by changeset 47de9bf8931e
> >> ("[media] tvp5150: Fix breakage for serial usage"). Unfortunately,
> >> such fix doesn't consider the case of progressive video inputs,
> >> causing chroma decoding issues on such videos, as it overrides not
> >> only the type of video output, but also other unrelated bits.
> >> 
> >> So, instead of trying to guess, let's detect if the device is set
> >> via a V4L2 subdev node or not. If not, just ignore the bogus logic.
> >> 
> >> Fixes: 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
> >> support") Cc: Devin Heitmueller 
> >> Cc: Javier Martinez Canillas 
> >> Cc: Laurent Pinchart ,
> >> Signed-off-by: Mauro Carvalho Chehab 
> >> ---
> >> 
> >> Devin,
> >> 
> >> I didn't test this patch. As I explained on my previous e-mail, my
> >> current test scenario for analog TV inputs is not  ideal, as I lack
> >> progressive video and RF output testcases.
> >> 
> >> Could you please test if this will fix for you?
> >> 
> >> Laurent/Javier,
> >> 
> >> With regards to OMAP3, it would be good to try to reproduce the issues
> >> Devin noticed on your hardware, testing with both progressive and
> >> interlaced sources and checking if the chroma is being decoded properly
> >> or not with a NTSC signal.
> >> 
> >>  drivers/media/i2c/tvp5150.c  | 7 ++-
> >>  drivers/media/platform/pxa_camera.c  | 1 +
> >>  drivers/media/platform/soc_camera/soc_mediabus.c | 1 +
> >>  include/media/v4l2-mediabus.h| 3 +++
> >>  4 files changed, 11 insertions(+), 1 deletion(-)
> > 
> > [snip]
> > 
> >> diff --git a/include/media/v4l2-mediabus.h
> >> b/include/media/v4l2-mediabus.h
> >> index 34cc99e093ef..8af6b96d628b 100644
> >> --- a/include/media/v4l2-mediabus.h
> >> +++ b/include/media/v4l2-mediabus.h
> >> @@ -70,11 +70,14 @@
> >>   * @V4L2_MBUS_BT656:  parallel interface with embedded
> >>   synchronisation, can
> >>   *also be used for BT.1120
> >>   * @V4L2_MBUS_CSI2:   MIPI CSI-2 serial interface
> >> + * @V4L2_MBUS_UNKNOWN:used to indicate that the device is not
> >> controlled
> >> + *via a V4L2 subdev devnode interface
> > 
> > Please, don't. v4l2_mbus_type has nothing to do with subdev device nodes.
> > It identifies the type of physical bus used to carry video data.
> 
> As explained, for the devices that the regression was introduced,
> there's no way to control the physical bus, as it is hardwired.
> 
> For those devices, mbus_type is just an useless information.

But the fact that a field is not used in some cases is no excuse to abuse it 
for something completely unrelated to its purpose.

> The problem that your patch introduced is that it now assumes that
> the mbus would be controlled via a V4L2 subdevice. This is a wrong
> assumption, and caused a regression.
> 
> So, we need a simple way to get rid of the broken code on those
> devices, and that's the simplest way.

We need a correct way to fix the problem, and this isn't the correct way.

> If you didn't like the name, we could, instead, call it as:
> V4L2_MBUS_CONTROLLED_BY_VIDEODEV, with actually tells more about it.

No, V4L2_MBUS_* has *nothing* to do with how the device is controlled. 

> ---
> 
> That's said, as OMAP3 support was added considering this code,
> if the progressive video bug is also present there, we could
> try some other solution, although, in such case, it is not a
> regression. Unfortunately, I don't have any OMAP3 hardware with
> tvp5151 to test.

I do, so I could test that.

> So, if nobody comes with another solution that would work for
> both cases, I'll likely send this regression fix to 4.10, as
> it is better than reverting the broken patch, as reverting it
> would cause regressions for OMAP3.

You're modifying the in-kernel V4L2 API as a hack to work around a bug. Let's 
not do that.

-- 
Regards,

Laurent Pinchart

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


Re: [GIT PULL FOR v4.11] Remove FSF postal address

2016-12-08 Thread Mauro Carvalho Chehab
Hi Sakari,

Em Thu, 8 Dec 2016 13:09:20 +0200
Sakari Ailus  escreveu:

> Hi Felipe,
> 
> On Thu, Dec 08, 2016 at 08:51:20AM -0200, Felipe Sanches wrote:
> > but why?  
> 
> Please see my reply here:
> 
> http://www.spinics.net/lists/linux-media/msg107204.html>

Please don't. If people wanted that, they would be sending a big
massive change by the time FSF check was added to checkpatch.

This is the kind of patch that can rise conflicts with other
patches, and don't really benefit the code.

Ok, if you're doing massive changes on some driver, be my
guest and remove the FSF address from it. Otherwise, just live
it as-is.

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


Re: [PATCH RFC] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Mauro Carvalho Chehab
Em Thu, 08 Dec 2016 14:25:38 +0200
Laurent Pinchart  escreveu:

> Hi Mauro,
> 
> Thank you for the patch.
> 
> On Thursday 08 Dec 2016 06:55:58 Mauro Carvalho Chehab wrote:
> > changeset 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
> > support") added a logic that overrides TVP5150_CONF_SHARED_PIN setting,
> > depending on the type of bus set via the .set_fmt() subdev callback.
> > 
> > This is known to cause trobules on devices that don't use a V4L2
> > subdev devnode, and a fix for it was made by changeset 47de9bf8931e
> > ("[media] tvp5150: Fix breakage for serial usage"). Unfortunately,
> > such fix doesn't consider the case of progressive video inputs,
> > causing chroma decoding issues on such videos, as it overrides not
> > only the type of video output, but also other unrelated bits.
> > 
> > So, instead of trying to guess, let's detect if the device is set
> > via a V4L2 subdev node or not. If not, just ignore the bogus logic.
> > 
> > Fixes: 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
> > support") Cc: Devin Heitmueller 
> > Cc: Javier Martinez Canillas 
> > Cc: Laurent Pinchart ,
> > Signed-off-by: Mauro Carvalho Chehab 
> > ---
> > 
> > Devin,
> > 
> > I didn't test this patch. As I explained on my previous e-mail, my current
> > test scenario for analog TV inputs is not  ideal, as I lack progressive
> > video and RF output testcases.
> > 
> > Could you please test if this will fix for you?
> > 
> > Laurent/Javier,
> > 
> > With regards to OMAP3, it would be good to try to reproduce the issues
> > Devin noticed on your hardware, testing with both progressive and interlaced
> > sources and checking if the chroma is being decoded properly or not with a
> > NTSC signal.
> > 
> >  drivers/media/i2c/tvp5150.c  | 7 ++-
> >  drivers/media/platform/pxa_camera.c  | 1 +
> >  drivers/media/platform/soc_camera/soc_mediabus.c | 1 +
> >  include/media/v4l2-mediabus.h| 3 +++
> >  4 files changed, 11 insertions(+), 1 deletion(-)  
> 
> [snip]
> 
> > diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
> > index 34cc99e093ef..8af6b96d628b 100644
> > --- a/include/media/v4l2-mediabus.h
> > +++ b/include/media/v4l2-mediabus.h
> > @@ -70,11 +70,14 @@
> >   * @V4L2_MBUS_BT656:   parallel interface with embedded 
> > synchronisation, can
> >   * also be used for BT.1120
> >   * @V4L2_MBUS_CSI2:MIPI CSI-2 serial interface
> > + * @V4L2_MBUS_UNKNOWN: used to indicate that the device is not   
> controlled
> > + * via a V4L2 subdev devnode interface  
> 
> Please, don't. v4l2_mbus_type has nothing to do with subdev device nodes. It 
> identifies the type of physical bus used to carry video data.

As explained, for the devices that the regression was introduced,
there's no way to control the physical bus, as it is hardwired.

For those devices, mbus_type is just an useless information.

The problem that your patch introduced is that it now assumes that
the mbus would be controlled via a V4L2 subdevice. This is a wrong
assumption, and caused a regression.

So, we need a simple way to get rid of the broken code on those
devices, and that's the simplest way.

If you didn't like the name, we could, instead, call it as:
V4L2_MBUS_CONTROLLED_BY_VIDEODEV, with actually tells more about it.

---

That's said, as OMAP3 support was added considering this code,
if the progressive video bug is also present there, we could
try some other solution, although, in such case, it is not a
regression. Unfortunately, I don't have any OMAP3 hardware with
tvp5151 to test.

So, if nobody comes with another solution that would work for
both cases, I'll likely send this regression fix to 4.10, as
it is better than reverting the broken patch, as reverting it
would cause regressions for OMAP3.


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


Re: [PATCH RFC] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Laurent Pinchart
Hi Mauro,

Thank you for the patch.

On Thursday 08 Dec 2016 06:55:58 Mauro Carvalho Chehab wrote:
> changeset 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
> support") added a logic that overrides TVP5150_CONF_SHARED_PIN setting,
> depending on the type of bus set via the .set_fmt() subdev callback.
> 
> This is known to cause trobules on devices that don't use a V4L2
> subdev devnode, and a fix for it was made by changeset 47de9bf8931e
> ("[media] tvp5150: Fix breakage for serial usage"). Unfortunately,
> such fix doesn't consider the case of progressive video inputs,
> causing chroma decoding issues on such videos, as it overrides not
> only the type of video output, but also other unrelated bits.
> 
> So, instead of trying to guess, let's detect if the device is set
> via a V4L2 subdev node or not. If not, just ignore the bogus logic.
> 
> Fixes: 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
> support") Cc: Devin Heitmueller 
> Cc: Javier Martinez Canillas 
> Cc: Laurent Pinchart ,
> Signed-off-by: Mauro Carvalho Chehab 
> ---
> 
> Devin,
> 
> I didn't test this patch. As I explained on my previous e-mail, my current
> test scenario for analog TV inputs is not  ideal, as I lack progressive
> video and RF output testcases.
> 
> Could you please test if this will fix for you?
> 
> Laurent/Javier,
> 
> With regards to OMAP3, it would be good to try to reproduce the issues
> Devin noticed on your hardware, testing with both progressive and interlaced
> sources and checking if the chroma is being decoded properly or not with a
> NTSC signal.
> 
>  drivers/media/i2c/tvp5150.c  | 7 ++-
>  drivers/media/platform/pxa_camera.c  | 1 +
>  drivers/media/platform/soc_camera/soc_mediabus.c | 1 +
>  include/media/v4l2-mediabus.h| 3 +++
>  4 files changed, 11 insertions(+), 1 deletion(-)

[snip]

> diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
> index 34cc99e093ef..8af6b96d628b 100644
> --- a/include/media/v4l2-mediabus.h
> +++ b/include/media/v4l2-mediabus.h
> @@ -70,11 +70,14 @@
>   * @V4L2_MBUS_BT656: parallel interface with embedded synchronisation, can
>   *   also be used for BT.1120
>   * @V4L2_MBUS_CSI2:  MIPI CSI-2 serial interface
> + * @V4L2_MBUS_UNKNOWN:   used to indicate that the device is not 
controlled
> + *   via a V4L2 subdev devnode interface

Please, don't. v4l2_mbus_type has nothing to do with subdev device nodes. It 
identifies the type of physical bus used to carry video data.

>   */
>  enum v4l2_mbus_type {
>   V4L2_MBUS_PARALLEL,
>   V4L2_MBUS_BT656,
>   V4L2_MBUS_CSI2,
> + V4L2_MBUS_UNKNOWN,
>  };
> 
>  /**

-- 
Regards,

Laurent Pinchart

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


Re: [GIT PULL FOR v4.11] Remove FSF postal address

2016-12-08 Thread Sakari Ailus
Hi Felipe,

On Thu, Dec 08, 2016 at 08:51:20AM -0200, Felipe Sanches wrote:
> but why?

Please see my reply here:

http://www.spinics.net/lists/linux-media/msg107204.html>

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL FOR v4.11] Remove FSF postal address

2016-12-08 Thread Felipe Sanches
but why?

2016-12-08 6:08 GMT-02:00 Sakari Ailus :
> Hi Mauro,
>
> This pull request contains a single patch, one that removes the FSF postal
> address from the headers in source code files. The patch is rebased from
> what I posted for review, no other changes.
>
> Please pull.
>
>
> The following changes since commit 365fe4e0ce218dc5ad10df17b150a366b6015499:
>
>   [media] mn88472: fix chip id check on probe (2016-12-01 12:47:22 -0200)
>
> are available in the git repository at:
>
>   ssh://linuxtv.org/git/sailus/media_tree.git fsf-address
>
> for you to fetch changes up to ad3d39349fa89300e03e4c25c0083d138f9051d9:
>
>   media: Drop FSF's postal address from the source code files (2016-12-08 
> 09:24:00 +0200)
>
> 
> Sakari Ailus (1):
>   media: Drop FSF's postal address from the source code files
>
>  drivers/media/common/b2c2/flexcop.c| 4 
>  drivers/media/common/cx2341x.c | 4 
>  drivers/media/common/siano/sms-cards.c | 4 
>  drivers/media/common/siano/sms-cards.h | 4 
>  drivers/media/common/siano/smscoreapi.c| 4 
>  drivers/media/common/tveeprom.c| 4 
>  drivers/media/dvb-core/demux.h | 4 
>  drivers/media/dvb-core/dmxdev.c| 4 
>  drivers/media/dvb-core/dmxdev.h| 4 
>  drivers/media/dvb-core/dvb_ca_en50221.c| 7 ++-
>  drivers/media/dvb-core/dvb_demux.c | 4 
>  drivers/media/dvb-core/dvb_demux.h | 4 
>  drivers/media/dvb-core/dvb_frontend.c  | 7 ++-
>  drivers/media/dvb-core/dvb_math.c  | 4 
>  drivers/media/dvb-core/dvb_math.h  | 4 
>  drivers/media/dvb-core/dvb_net.c   | 7 ++-
>  drivers/media/dvb-core/dvb_net.h   | 4 
>  drivers/media/dvb-core/dvb_ringbuffer.c| 4 
>  drivers/media/dvb-core/dvbdev.c| 4 
>  drivers/media/dvb-core/dvbdev.h| 4 
>  drivers/media/dvb-frontends/af9013.c   | 4 
>  drivers/media/dvb-frontends/af9013.h   | 4 
>  drivers/media/dvb-frontends/af9013_priv.h  | 4 
>  drivers/media/dvb-frontends/atbm8830.c | 4 
>  drivers/media/dvb-frontends/atbm8830.h | 4 
>  drivers/media/dvb-frontends/atbm8830_priv.h| 4 
>  drivers/media/dvb-frontends/au8522_decoder.c   | 5 -
>  drivers/media/dvb-frontends/bcm3510.h  | 4 
>  drivers/media/dvb-frontends/bcm3510_priv.h | 4 
>  drivers/media/dvb-frontends/bsbe1-d01a.h   | 7 ++-
>  drivers/media/dvb-frontends/bsbe1.h| 7 ++-
>  drivers/media/dvb-frontends/bsru6.h| 7 ++-
>  drivers/media/dvb-frontends/cx24113.c  | 4 
>  drivers/media/dvb-frontends/cx24113.h  | 4 
>  drivers/media/dvb-frontends/cx24123.c  | 4 
>  drivers/media/dvb-frontends/dib0070.c  | 4 
>  drivers/media/dvb-frontends/dib0090.c  | 4 
>  drivers/media/dvb-frontends/drx39xyj/drx39xxj.h| 4 
>  drivers/media/dvb-frontends/drxd.h | 8 ++--
>  drivers/media/dvb-frontends/drxd_firm.c| 8 ++--
>  drivers/media/dvb-frontends/drxd_firm.h| 8 ++--
>  drivers/media/dvb-frontends/drxd_hard.c| 8 ++--
>  drivers/media/dvb-frontends/drxd_map_firm.h| 8 ++--
>  drivers/media/dvb-frontends/drxk_hard.c| 8 ++--
>  drivers/media/dvb-frontends/dvb-pll.c  | 4 
>  drivers/media/dvb-frontends/dvb_dummy_fe.c | 4 
>  drivers/media/dvb-frontends/dvb_dummy_fe.h | 4 
>  drivers/media/dvb-frontends/ec100.c| 4 
>  drivers/media/dvb-frontends/ec100.h| 4 
>  drivers/media/dvb-frontends/hd29l2.c   | 4 
>  drivers/media/dvb-frontends/hd29l2.h   | 4 
>  drivers/media/dvb-frontends/hd29l2_priv.h  | 4 
>  drivers/media/dvb-frontends/isl6405.c  | 7 ++-
>  drivers/media/dvb-frontends/isl6405.h  | 7 ++-
>  drivers/media/dvb-frontends/isl6421.c  | 7 ++-
>  drivers/media/dvb-frontends/isl6421.h  | 7 ++-
>  drivers/media/dvb-frontends/itd1000.c  | 4 
>  drivers/media/dvb-frontends/itd1000.h  | 4 
>  drivers/media/dvb-frontends/itd1000_priv.h | 4 
>  drivers/media/dvb-frontends/ix2505v.c  | 4 
>  drivers/media/dvb-frontends/ix2505v.h  | 4 
>  drivers/media/dvb-frontends/lg2160.c   | 4 
>  drivers/media/dvb-frontends/lg2160.h   | 4 
>  drivers/media/dvb-frontends/lgdt3305.c | 4 
>  drivers/media/dvb-frontends/l

Re: [git:media_tree/master] [media] Add Cinergy S2 rev.4 support

2016-12-08 Thread Sakari Ailus
Hi Enrico,

On Thu, Dec 08, 2016 at 10:40:06AM +0100, Enrico Mioso wrote:
> Hello guys.
> 
> First of all, thank you for your great work.
> 
> I am writing to you to understand if there where problems with a patch I sent 
> something like 17 octobrer to add an USB id.
> Where there any problems?
> I saw it was accepted but can't find it in the kernel. I admit I didn't check 
> in media tree.

The patch first goes to the media tree, and then Mauro (the media tree
maintainer) sends a pull request to Linus on the master branch, typically a
short while after the kernel release. So the usual time for the patch to
reach the mainline kernel release is roughly between one and two kernel
release cycles.

http://static.lwn.net/kerneldoc/process/2.Process.html>

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 3/3] ARM: multi_v7_defconfig: enable STMicroelectronics HVA debugfs

2016-12-08 Thread Jean Christophe TROTIN
Hi Hans,

You're right: the HVA DEBUGFS config option shouldn't be enabled by default.
So, "[PATCH v3 3/3] ARM: multi_v7_defconfig: enable STMicroelectronics HVA 
debugfs" must be ignored. It will be taken into account in our configuration 
fragment.
Do you have any other remark about the patches [PATCH v3 1/3] and [PATCH v3 
2/3]?
If you need a new version (v4) without the "[PATCH v3 3/3]", please let me know?

Regards,

Jean-Christophe.


On 12/05/2016 01:32 PM, Hans Verkuil wrote:
> Please provide a commit message, it shouldn't be empty.
>
> But are you sure you want to enable it in the defconfig? I think in general
> DEBUGFS config options aren't enabled by default.
>
> Regards,
>
>   Hans
>
> On 11/28/2016 11:30 AM, Jean-Christophe Trotin wrote:
>> Signed-off-by: Jean-Christophe Trotin 
>> ---
>>  arch/arm/configs/multi_v7_defconfig | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/arm/configs/multi_v7_defconfig 
>> b/arch/arm/configs/multi_v7_defconfig
>> index eb14ab6..7a15107 100644
>> --- a/arch/arm/configs/multi_v7_defconfig
>> +++ b/arch/arm/configs/multi_v7_defconfig
>> @@ -563,6 +563,7 @@ CONFIG_VIDEO_SAMSUNG_S5P_JPEG=m
>>  CONFIG_VIDEO_SAMSUNG_S5P_MFC=m
>>  CONFIG_VIDEO_STI_BDISP=m
>>  CONFIG_VIDEO_STI_HVA=m
>> +CONFIG_VIDEO_STI_HVA_DEBUGFS=y
>>  CONFIG_DYNAMIC_DEBUG=y
>>  CONFIG_VIDEO_RENESAS_JPU=m
>>  CONFIG_VIDEO_RENESAS_VSP1=m
>>
>--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL FOR v4.10] cec: fix report_current_latency

2016-12-08 Thread Hans Verkuil

CEC bug fix.

Regards,

Hans

The following changes since commit 365fe4e0ce218dc5ad10df17b150a366b6015499:

  [media] mn88472: fix chip id check on probe (2016-12-01 12:47:22 -0200)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git cecfix

for you to fetch changes up to d5febd6cd89a69c4b046259cb6e66514cd353248:

  cec: fix report_current_latency (2016-12-08 11:26:31 +0100)


Hans Verkuil (1):
  cec: fix report_current_latency

 drivers/media/cec/cec-adap.c   |  2 +-
 include/uapi/linux/cec-funcs.h | 10 +++---
 2 files changed, 8 insertions(+), 4 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [git:media_tree/master] [media] Add Cinergy S2 rev.4 support

2016-12-08 Thread Enrico Mioso

Hello guys.

First of all, thank you for your great work.

I am writing to you to understand if there where problems with a patch I sent 
something like 17 octobrer to add an USB id.
Where there any problems?
I saw it was accepted but can't find it in the kernel. I admit I didn't check 
in media tree.
Sorry for the disturbance.
Thank you.
--
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 RFC] tvp5150: don't touch register TVP5150_CONF_SHARED_PIN if not needed

2016-12-08 Thread Mauro Carvalho Chehab
changeset 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation
support") added a logic that overrides TVP5150_CONF_SHARED_PIN setting,
depending on the type of bus set via the .set_fmt() subdev callback.

This is known to cause trobules on devices that don't use a V4L2
subdev devnode, and a fix for it was made by changeset 47de9bf8931e
("[media] tvp5150: Fix breakage for serial usage"). Unfortunately,
such fix doesn't consider the case of progressive video inputs,
causing chroma decoding issues on such videos, as it overrides not
only the type of video output, but also other unrelated bits.

So, instead of trying to guess, let's detect if the device is set
via a V4L2 subdev node or not. If not, just ignore the bogus logic.

Fixes: 460b6c0831cb ("[media] tvp5150: Add s_stream subdev operation support")
Cc: Devin Heitmueller 
Cc: Javier Martinez Canillas 
Cc: Laurent Pinchart ,
Signed-off-by: Mauro Carvalho Chehab 
---

Devin,

I didn't test this patch. As I explained on my previous e-mail, my current test
scenario for analog TV inputs is not  ideal, as I lack progressive video
and RF output testcases.

Could you please test if this will fix for you? 

Laurent/Javier,

With regards to OMAP3, it would be good to try to reproduce the issues
Devin noticed on your hardware, testing with both progressive and interlaced
sources and checking if the chroma is being decoded properly or not with a
NTSC signal. 

 drivers/media/i2c/tvp5150.c  | 7 ++-
 drivers/media/platform/pxa_camera.c  | 1 +
 drivers/media/platform/soc_camera/soc_mediabus.c | 1 +
 include/media/v4l2-mediabus.h| 3 +++
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 6737685d5be5..c8d701291a54 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -795,7 +795,8 @@ static int tvp5150_reset(struct v4l2_subdev *sd, u32 val)
 
tvp5150_set_std(sd, decoder->norm);
 
-   if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
+   if (decoder->mbus_type == V4L2_MBUS_PARALLEL ||
+   decoder->mbus_type == V4L2_MBUS_UNKNOWN)
tvp5150_write(sd, TVP5150_DATA_RATE_SEL, 0x40);
 
return 0;
@@ -1053,6 +1054,9 @@ static int tvp5150_s_stream(struct v4l2_subdev *sd, int 
enable)
/* Output format: 8-bit ITU-R BT.656 with embedded syncs */
int val = 0x09;
 
+   if (decoder->mbus_type == V4L2_MBUS_UNKNOWN)
+   return 0;
+
/* Output format: 8-bit 4:2:2 YUV with discrete sync */
if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
val = 0x0d;
@@ -1501,6 +1505,7 @@ static int tvp5150_probe(struct i2c_client *c,
core->norm = V4L2_STD_ALL;  /* Default is autodetect */
core->input = TVP5150_COMPOSITE1;
core->enable = true;
+   core->mbus_type = V4L2_MBUS_UNKNOWN;
 
v4l2_ctrl_handler_init(&core->hdl, 5);
v4l2_ctrl_new_std(&core->hdl, &tvp5150_ctrl_ops,
diff --git a/drivers/media/platform/pxa_camera.c 
b/drivers/media/platform/pxa_camera.c
index 929006f65cc7..86b60b85d20e 100644
--- a/drivers/media/platform/pxa_camera.c
+++ b/drivers/media/platform/pxa_camera.c
@@ -593,6 +593,7 @@ static unsigned int pxa_mbus_config_compatible(const struct 
v4l2_mbus_config *cf
common_flags = cfg->flags & flags;
 
switch (cfg->type) {
+   case V4L2_MBUS_UNKNOWN:
case V4L2_MBUS_PARALLEL:
hsync = common_flags & (V4L2_MBUS_HSYNC_ACTIVE_HIGH |
V4L2_MBUS_HSYNC_ACTIVE_LOW);
diff --git a/drivers/media/platform/soc_camera/soc_mediabus.c 
b/drivers/media/platform/soc_camera/soc_mediabus.c
index e3e665e1c503..37c49a10fbe0 100644
--- a/drivers/media/platform/soc_camera/soc_mediabus.c
+++ b/drivers/media/platform/soc_camera/soc_mediabus.c
@@ -490,6 +490,7 @@ unsigned int soc_mbus_config_compatible(const struct 
v4l2_mbus_config *cfg,
 
switch (cfg->type) {
case V4L2_MBUS_PARALLEL:
+   case V4L2_MBUS_UNKNOWN:
hsync = common_flags & (V4L2_MBUS_HSYNC_ACTIVE_HIGH |
V4L2_MBUS_HSYNC_ACTIVE_LOW);
vsync = common_flags & (V4L2_MBUS_VSYNC_ACTIVE_HIGH |
diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
index 34cc99e093ef..8af6b96d628b 100644
--- a/include/media/v4l2-mediabus.h
+++ b/include/media/v4l2-mediabus.h
@@ -70,11 +70,14 @@
  * @V4L2_MBUS_BT656:   parallel interface with embedded synchronisation, can
  * also be used for BT.1120
  * @V4L2_MBUS_CSI2:MIPI CSI-2 serial interface
+ * @V4L2_MBUS_UNKNOWN: used to indicate that the device is not controlled
+ * via a V4L2 subdev devnode interface
  */
 enum v4l2_mbus_type {
V4L2_MBUS_PARALLEL,
V4L2_MBUS_BT656,
V4L2_MBUS_CSI2,
+   V4L2_MBUS_UNKNOWN,
 };
 
 /**
-- 
2.9.3


--
To unsubscribe from this li

Re: Regression: tvp5150 refactoring breaks all em28xx devices

2016-12-08 Thread Mauro Carvalho Chehab
Hi Laurent and Devin,

Em Thu, 08 Dec 2016 00:59:17 +0200
Laurent Pinchart  escreveu:

> Hi Devin,
> 
> On Wednesday 07 Dec 2016 12:47:01 Devin Heitmueller wrote:
> > Hello Javier, Mauro, Laurent,
> > 
> > I hope all is well with you.  Mauro, Laurent:  you guys going to
> > ELC/Portland in February?  
> 
> I haven't decided for sure yet, but I will likely go.

I haven't decided yet, but probably I won't.

> > Looks like the refactoring done to tvp5150 in January 2016 for
> > s_stream() to support some embedded platform caused breakage in the
> > 30+ em28xx products that also use the chip.  

When I wrote my patch on the top of Laurent's one, I tested it, with both
analog TV and composite input, and didn't notice any issue. I used a
WinTV USB2 and HVR-950.

I didn't test with progressive video input though, as I'm using a PVR-350
TV out to generate signals, with, AFIKT, generates only interlaced video.

Unfortunately, analog TV signal broadcast ended last month, and I don't
have any analog TV RF generator. I might still have an old VCR with a
RF output, but need to check if it is on my garage.

> 
> I assume you're talking about
> 
> commit 460b6c0831cb52ef349156cfa27e889606b4cb75
> Author: Laurent Pinchart 
> Date:   Thu Jan 7 10:46:45 2016 -0200
> 
> [media] tvp5150: Add s_stream subdev operation support
> 
> followed by
> 
> commit 47de9bf8931e6bf9c92fdba9867925d1ce482ab1
> Author: Mauro Carvalho Chehab 
> Date:   Mon Jan 25 14:39:34 2016 -0200
> 
> [media] tvp5150: Fix breakage for serial usage
> 
> both introduced in v4.6. I further assume that "serial" means BT.656 here, 
> which is still parallel.
> 
> > Problem confirmed on both the Startech SVIDUSB2 board Steve Preston
> > was nice enough to ship me (after adding a board profile), as well as
> > on my original HVR-950 which has worked fine since 2008.
> > 
> > The implementation tramples the TVP5150_MISC_CTL register, blowing
> > into it a hard-coded value based on one of two scenarios, neither of
> > which matches what is expected by em28xx devices.  At least in the
> > case of NTSC, this results in chroma cycling.  This was also reported
> > by Alexandre-Xavier Labonté-Lamoureux back in August, although in the
> > video below he's also having some other issue related to progressive
> > video because he's using an old gaming console as the source (i.e. pay
> > attention to the chroma effects in the top half of the video rather
> > than the fact that only the first field is being rendered).
> > 
> > https://youtu.be/WLlqJ7T3y4g
> > 
> > The s_stream implementation writes 0x09 or 0x0d into TVP5150_MISC_CTL
> > (overriding whatever was written by tvp5150_init_default and
> > tvp5150_selmux().  In fact, just as a test I was able to start up
> > video, see the corruption, and write the correct value back into the
> > register via v4l2-dbg in order to get it working again:
> > 
> > sudo v4l2-dbg --chip=subdev0 --set-register=0x03 0x6f
> > 
> > There's no easy fix for this without extending the driver to support
> > proper configuration of the output pin muxing, which it isn't clear to
> > me what the right approach is and I don't have the embedded hardware
> > platform that prompted the refactoring in order to do regression
> > testing anyway.
> > 
> > Feel free to take it upon yourselves to fix the regression you introduced.  
> 
> I've had a quick look at the code from the point of view opposite from yours, 
> with my knowledge of the embedded side but without any experience with 
> em28xx. 
> I don't think that adding proper configuration of pinmuxing would be that 
> hard, if it wasn't for the tvp5150_reset() function. The function is called 
> directly in the get and set format handlers, and through subdev core 
> operations.
> 
> The way we expose and use the reset operation is a very surprising (to stay 
> politically correct) idea, but in the context of em28xx shouldn't be too much 
> of a problem as the operation is only invoked at stream on time, before 
> s_stream(1). However, calling it from the get and set format handlers can 
> only 
> lead me to conclude that the kernel is missing an ENOBRAIN error code. I'll 
> blame it on history.
> 
> As a prerequisite to implement proper output mixing configuration, the 
> tvp5150_reset() call needs to be removed from tvp5150_fill_fmt(). 

That shouldn't affect anything. The .set_fmt() callback is only called by
drivers/media/v4l2-core/v4l2-subdev.c. As those devices don't use
subdevs, removing tvp5150_reset() from tvp5150_fill_fmt() shouldn't
affect anything.

> I can't test 
> that with the em28xx driver as I don't have access to any such device. Devin, 
> would you be able to assist with testing on em28xx by removing the function 
> call from a working kernel (v4.5 would be ideal) and check if the device 
> still 
> operates correctly ? I believe it would, given that the reset operation is 
> called at stream on time as well as explained above, and that call would 
> still 
> be there.
> 
>

[GIT PULL FOR v4.10] Smiapp runtime PM fixes

2016-12-08 Thread Sakari Ailus
Hi Mauro,

These patches fix a compiler warning for the smiapp driver and also make
power management work again without runtime PM.

Please pull.


The following changes since commit 365fe4e0ce218dc5ad10df17b150a366b6015499:

  [media] mn88472: fix chip id check on probe (2016-12-01 12:47:22 -0200)

are available in the git repository at:

  ssh://linuxtv.org/git/sailus/media_tree.git smiapp-pm

for you to fetch changes up to c29df33f9ec94226eab8ee92d8c66ab83c76659a:

  smiapp: Make suspend and resume functions __maybe_unused (2016-12-08 10:01:57 
+0200)


Sakari Ailus (2):
  smiapp: Implement power-on and power-off sequences without runtime PM
  smiapp: Make suspend and resume functions __maybe_unused

 drivers/media/i2c/smiapp/smiapp-core.c | 33 -
 1 file changed, 12 insertions(+), 21 deletions(-)

-- 
Regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL FOR v4.11] Remove FSF postal address

2016-12-08 Thread Sakari Ailus
Hi Mauro,

This pull request contains a single patch, one that removes the FSF postal
address from the headers in source code files. The patch is rebased from
what I posted for review, no other changes.

Please pull.


The following changes since commit 365fe4e0ce218dc5ad10df17b150a366b6015499:

  [media] mn88472: fix chip id check on probe (2016-12-01 12:47:22 -0200)

are available in the git repository at:

  ssh://linuxtv.org/git/sailus/media_tree.git fsf-address

for you to fetch changes up to ad3d39349fa89300e03e4c25c0083d138f9051d9:

  media: Drop FSF's postal address from the source code files (2016-12-08 
09:24:00 +0200)


Sakari Ailus (1):
  media: Drop FSF's postal address from the source code files

 drivers/media/common/b2c2/flexcop.c| 4 
 drivers/media/common/cx2341x.c | 4 
 drivers/media/common/siano/sms-cards.c | 4 
 drivers/media/common/siano/sms-cards.h | 4 
 drivers/media/common/siano/smscoreapi.c| 4 
 drivers/media/common/tveeprom.c| 4 
 drivers/media/dvb-core/demux.h | 4 
 drivers/media/dvb-core/dmxdev.c| 4 
 drivers/media/dvb-core/dmxdev.h| 4 
 drivers/media/dvb-core/dvb_ca_en50221.c| 7 ++-
 drivers/media/dvb-core/dvb_demux.c | 4 
 drivers/media/dvb-core/dvb_demux.h | 4 
 drivers/media/dvb-core/dvb_frontend.c  | 7 ++-
 drivers/media/dvb-core/dvb_math.c  | 4 
 drivers/media/dvb-core/dvb_math.h  | 4 
 drivers/media/dvb-core/dvb_net.c   | 7 ++-
 drivers/media/dvb-core/dvb_net.h   | 4 
 drivers/media/dvb-core/dvb_ringbuffer.c| 4 
 drivers/media/dvb-core/dvbdev.c| 4 
 drivers/media/dvb-core/dvbdev.h| 4 
 drivers/media/dvb-frontends/af9013.c   | 4 
 drivers/media/dvb-frontends/af9013.h   | 4 
 drivers/media/dvb-frontends/af9013_priv.h  | 4 
 drivers/media/dvb-frontends/atbm8830.c | 4 
 drivers/media/dvb-frontends/atbm8830.h | 4 
 drivers/media/dvb-frontends/atbm8830_priv.h| 4 
 drivers/media/dvb-frontends/au8522_decoder.c   | 5 -
 drivers/media/dvb-frontends/bcm3510.h  | 4 
 drivers/media/dvb-frontends/bcm3510_priv.h | 4 
 drivers/media/dvb-frontends/bsbe1-d01a.h   | 7 ++-
 drivers/media/dvb-frontends/bsbe1.h| 7 ++-
 drivers/media/dvb-frontends/bsru6.h| 7 ++-
 drivers/media/dvb-frontends/cx24113.c  | 4 
 drivers/media/dvb-frontends/cx24113.h  | 4 
 drivers/media/dvb-frontends/cx24123.c  | 4 
 drivers/media/dvb-frontends/dib0070.c  | 4 
 drivers/media/dvb-frontends/dib0090.c  | 4 
 drivers/media/dvb-frontends/drx39xyj/drx39xxj.h| 4 
 drivers/media/dvb-frontends/drxd.h | 8 ++--
 drivers/media/dvb-frontends/drxd_firm.c| 8 ++--
 drivers/media/dvb-frontends/drxd_firm.h| 8 ++--
 drivers/media/dvb-frontends/drxd_hard.c| 8 ++--
 drivers/media/dvb-frontends/drxd_map_firm.h| 8 ++--
 drivers/media/dvb-frontends/drxk_hard.c| 8 ++--
 drivers/media/dvb-frontends/dvb-pll.c  | 4 
 drivers/media/dvb-frontends/dvb_dummy_fe.c | 4 
 drivers/media/dvb-frontends/dvb_dummy_fe.h | 4 
 drivers/media/dvb-frontends/ec100.c| 4 
 drivers/media/dvb-frontends/ec100.h| 4 
 drivers/media/dvb-frontends/hd29l2.c   | 4 
 drivers/media/dvb-frontends/hd29l2.h   | 4 
 drivers/media/dvb-frontends/hd29l2_priv.h  | 4 
 drivers/media/dvb-frontends/isl6405.c  | 7 ++-
 drivers/media/dvb-frontends/isl6405.h  | 7 ++-
 drivers/media/dvb-frontends/isl6421.c  | 7 ++-
 drivers/media/dvb-frontends/isl6421.h  | 7 ++-
 drivers/media/dvb-frontends/itd1000.c  | 4 
 drivers/media/dvb-frontends/itd1000.h  | 4 
 drivers/media/dvb-frontends/itd1000_priv.h | 4 
 drivers/media/dvb-frontends/ix2505v.c  | 4 
 drivers/media/dvb-frontends/ix2505v.h  | 4 
 drivers/media/dvb-frontends/lg2160.c   | 4 
 drivers/media/dvb-frontends/lg2160.h   | 4 
 drivers/media/dvb-frontends/lgdt3305.c | 4 
 drivers/media/dvb-frontends/lgdt3305.h | 4 
 drivers/media/dvb-frontends/lgdt330x.c | 4 
 drivers/media/dvb-frontends/lgdt330x.h | 4 
 drivers/media/dvb-frontends/lgdt330x_priv.h| 4 
 drivers