Re: Hauppage HVR-2250 - No Free Sequences

2014-11-02 Thread Kyle Sanderson
[9.327707] saa7164 driver loaded
[9.328739] ACPI: PCI Interrupt Link [LN4A] enabled at IRQ 19
[9.329585] CORE saa7164[0]: subsystem: 0070:8851, board: Hauppauge
WinTV-HVR2250 [card=7,autodetected]
[9.329592] saa7164[0]/0: found at :05:00.0, rev: 129, irq: 19,
latency: 0, mmio: 0xfe80
[9.460023] saa7164_downloadfirmware() no first image
[9.460034] saa7164_downloadfirmware() Waiting for firmware upload
(NXP7164-2010-03-10.1.fw)
[9.684071] saa7164_downloadfirmware() firmware read 4019072 bytes.
[9.684076] saa7164_downloadfirmware() firmware loaded.
[9.684077] Firmware file header part 1:
[9.684080]  .FirmwareSize = 0x0
[9.684081]  .BSLSize = 0x0
[9.684083]  .Reserved = 0x3d538
[9.684084]  .Version = 0x3
[9.684086] saa7164_downloadfirmware() SecBootLoader.FileSize = 4019072
[9.684092] saa7164_downloadfirmware() FirmwareSize = 0x1fd6
[9.684094] saa7164_downloadfirmware() BSLSize = 0x0
[9.684096] saa7164_downloadfirmware() Reserved = 0x0
[9.684098] saa7164_downloadfirmware() Version = 0x1661c00
[   16.496685] saa7164_downloadimage() Image downloaded, booting...
[   16.600015] saa7164_downloadimage() Image booted successfully.
[   16.600040] starting firmware download(2)
[   19.166683] saa7164_downloadimage() Image downloaded, booting...
[   21.130015] saa7164_downloadimage() Image booted successfully.
[   21.130040] firmware download complete.
[   21.177186] tveeprom 1-: Hauppauge model 88061, rev C4F2, serial#
[   21.177193] tveeprom 1-: MAC address is 00:0d:fe:xx:xx:xx
[   21.177196] tveeprom 1-: tuner model is NXP 18271C2_716x (idx
152, type 4)
[   21.177200] tveeprom 1-: TV standards NTSC(M) ATSC/DVB Digital
(eeprom 0x88)
[   21.177203] tveeprom 1-: audio processor is SAA7164 (idx 43)
[   21.177205] tveeprom 1-: decoder processor is SAA7164 (idx 40)
[   21.177208] tveeprom 1-: has radio, has IR receiver, has no IR
transmitter
[   21.177210] saa7164[0]: Hauppauge eeprom: model=88061
[   21.544594] tda18271 2-0060: creating new instance
[   21.549445] TDA18271HD/C2 detected @ 2-0060
[   21.781995] DVB: registering new adapter (saa7164)
[   21.782011] saa7164 :05:00.0: DVB: registering adapter 0
frontend 0 (Samsung S5H1411 QAM/8VSB Frontend)...
[   22.071439] tda18271 3-0060: creating new instance
[   22.075732] TDA18271HD/C2 detected @ 3-0060
[   22.298139] tda18271: performing RF tracking filter calibration
[   24.573984] tda18271: RF tracking filter calibration complete
[   24.578058] DVB: registering new adapter (saa7164)
[   24.578074] saa7164 :05:00.0: DVB: registering adapter 1
frontend 0 (Samsung S5H1411 QAM/8VSB Frontend)...
[   24.579110] saa7164[0]: registered device video0 [mpeg]
[   24.809340] saa7164[0]: registered device video1 [mpeg]
[   25.020165] saa7164[0]: registered device vbi0 [vbi]
[   25.020333] saa7164[0]: registered device vbi1 [vbi]

Kernel: 3.12.21-gentoo-r1

On Fri, Oct 31, 2014 at 8:55 AM, Kyle Sanderson kyle.l...@gmail.com wrote:
 Hi All,

 So I've been using my tuner for a couple years now with tvheadend,
 works great :-). However, eventually I encounter something like this
 in my dmesg

 [585870.001641] saa7164_cmd_send() No free sequences
 [585870.001645] saa7164_api_i2c_write() error, ret(1) = 0xc
 [585870.001650] tda10048_writereg: writereg error (ret == -5)
 [585870.024809] saa7164_cmd_send() No free sequences
 [585870.024820] saa7164_api_i2c_read() error, ret(1) = 0xc
 [585870.024826] tda10048_readreg: readreg error (ret == -5)
 [585870.024838] saa7164_cmd_send() No free sequences
 [585870.024843] saa7164_api_i2c_read() error, ret(1) = 0xc
 [585870.024848] tda10048_readreg: readreg error (ret == -5)
 [585870.024856] saa7164_cmd_send() No free sequences
 [585870.024861] saa7164_api_i2c_write() error, ret(1) = 0xc
 [585870.024866] tda10048_writereg: writereg error (ret == -5)
 [585870.024878] saa7164_cmd_send() No free sequences
 [585870.024883] saa7164_api_i2c_write() error, ret(1) = 0xc

 The result is the card stops accepting commands; won't tune to other
 frequencies. Rebooting the box seems to resolve it. The time before
 that starts occurring though varies wildly, usually when it's stormy
 and the ATSC antenna starts cutting in and out (reflection off of the
 tree).

 Is there another way I can get around doing that? would rmmod/insmod work?

 Looking on the Hauppage site it looks like they're still developing
 drivers for it ( ftp://ftp.hauppauge.com/Support/HVR2250/ ). From
 google-ing around, it looks like people are still using the firmware
 that Steven Toth ripped in 2011.

 Any tips? I've tried a couple horrible kernel patches but didn't get anywhere.
 Kyle.
--
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:v4l-utils/master] libdvbv5, dvbv5-scan: generalize channel duplication check

2014-11-02 Thread Akihiro TSUKADA
Hi,

After I re-checked the source,
I noticed that dvb_scan_add_entry() also breaks API/ABI compatibility
as well as dvb_new_freq_is_needed(), and those functions are
marked as ancillary functions used internally inside the library
in dvb-scan.h.
So I think it would rather be better to move those funcs to a private
header (dvb-scan-priv.h?).
Which way should we go? ver bump/compat-soname.c/dvb-scan-priv.h ?
--
Akihiro
--
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:v4l-utils/master] libdvbv5, dvbv5-scan: generalize channel duplication check

2014-11-02 Thread Mauro Carvalho Chehab
Em Sun, 02 Nov 2014 18:30:46 +0900
Akihiro TSUKADA tsk...@gmail.com escreveu:

 Hi,
 
 After I re-checked the source,
 I noticed that dvb_scan_add_entry() also breaks API/ABI compatibility
 as well as dvb_new_freq_is_needed(), and those functions are
 marked as ancillary functions used internally inside the library
 in dvb-scan.h.
 So I think it would rather be better to move those funcs to a private
 header (dvb-scan-priv.h?).
 Which way should we go? ver bump/compat-soname.c/dvb-scan-priv.h ?

I would keep them exported. It shouldn't be hard to provide a backward
compatible function with the same name where the extra parameter would
be filled internally, and passed to a new function with one extra argument.

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


Re: [PATCH v2 3/7] v4l-utils/libdvbv5: add support for ISDB-S scanning

2014-11-02 Thread Akihiro TSUKADA
 Hmm... Is this due to a spec definition, or is it just how satellite
 operators decided?
 
 If ARIB spec doesn't allow polarization set, we should remove it from the
 Kernel DocBook. 

ARIB spec does NOT limit polarization, just the satellite operators do.

 
 Btw, how does the PT1 driver handle those parameters? If it just uses
 frequency (it seems so), then the only valid parameters for ISDB-S are
   DTV_FREQUENCY
 and
   DTV_STREAM_ID
 
 (and, eventually, polarization, if ARIB spec allows it)
 
 right?

Yes, right. PT1 uses DTV_FREQUENCY and DTV_STREAM_ID.
--
Akihiro
--
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 6/7] v4l-utils/dvb: add COUNTRY property

2014-11-02 Thread Gregor Jasny
Hello,

Hello Coverity detected that dvb_guess_user_country introduces a
resource leak (CID 1250445).

On 31/10/14 14:13, tsk...@gmail.com wrote:
 +enum dvb_country_t dvb_guess_user_country(void)
 +{
 + char * buf, * pch, * pbuf;
 + unsigned cat;
 + enum dvb_country_t id = COUNTRY_UNKNOWN;
 +
 + for (cat = 0; cat  sizeof(cats)/sizeof(cats[0]); cat++) {
 +
 + // the returned char * should be C, POSIX or something 
 valid.
 + // If valid, we can only *guess* which format is returned.
 + // Assume here something like de_DE.iso8859-1@euro or 
 de_DE.utf-8
 + buf = secure_getenv(cats[cat]);
 + if (! buf || strlen(buf)  2)
 + continue;
 +
 + buf = strdup(buf);
 + pbuf= buf;
 +
 + if (! strncmp(buf, POSIX, MIN(strlen(buf), 5)) ||
 + ! (strncmp(buf, en, MIN(strlen(buf), 2))  
 !isalpha(buf[2])) )
 + continue;
 +
 + // assuming 'language_country.encoding@variant'
 +
 + // country after '_', if given
 + if ((pch = strchr(buf, '_')))
 + pbuf = pch + 1;
 +
 + // remove all after '@', including '@'
 + if ((pch = strchr(pbuf, '@')))
 + *pch = 0;
 +
 + // remove all after '.', including '.'
 + if ((pch = strchr(pbuf, '.')))
 + *pch = 0;
 +
 + if (strlen(pbuf) == 2)
 + id = dvb_country_a2_to_id(pbuf);
 + free(buf);
 + if (id != COUNTRY_UNKNOWN)
 + return id;
 + }
 +
 + return COUNTRY_UNKNOWN;
 +}

pbuf / buf may get leaked due to the continue statement.

Could you please post a patch?

Thanks,
Gregor
--
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:v4l-utils/master] libdvbv5, dvbv5-scan: generalize channel duplication check

2014-11-02 Thread Gregor Jasny
On 02/11/14 10:41, Mauro Carvalho Chehab wrote:
 Em Sun, 02 Nov 2014 18:30:46 +0900
 Akihiro TSUKADA tsk...@gmail.com escreveu:
 
 Hi,

 After I re-checked the source,
 I noticed that dvb_scan_add_entry() also breaks API/ABI compatibility
 as well as dvb_new_freq_is_needed(), and those functions are
 marked as ancillary functions used internally inside the library
 in dvb-scan.h.
 So I think it would rather be better to move those funcs to a private
 header (dvb-scan-priv.h?).
 Which way should we go? ver bump/compat-soname.c/dvb-scan-priv.h ?
 
 I would keep them exported. It shouldn't be hard to provide a backward
 compatible function with the same name where the extra parameter would
 be filled internally, and passed to a new function with one extra argument.

As far as I understand dvb-scan uses these functions, so they are not
that internal like intended. Providing a backward compatible function
would be the way to go.

FYI: The Ubuntu buildbot discovered the breakage:
 https://launchpad.net/~libv4l/+archive/ubuntu/development/+build/6528719/+files/buildlog_ubuntu-trusty-i386.v4l-utils_1.6.0%2Br2607-66%7Eubuntu14.04.1_FAILEDTOBUILD.txt.gz

Thanks,
-Gregor
--
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] staging: media: lirc: lirc_zilog.c: adjust debug messages

2014-11-02 Thread Konrad Zapalowicz
On 11/01, Aya Mahfouz wrote:
 This patch removes one debug message and replaces a dev_err
 call by pr_err.

Usually you would like to send this as two separate patches because
replacing a debug message is way different than removing some code. It
should look like:

PATCH 0/2 staging: media: adjust debug messages
PATCH 1/2 staging: media: replace dev_err...
PATCH 2/2 staging: media: remove debug message..

The lirc_zilog.c is not necessary in the topic line, as this can be seen
from the diff.
 
 Signed-off-by: Aya Mahfouz mahfouz.saif.elya...@gmail.com
 ---
  drivers/staging/media/lirc/lirc_zilog.c | 7 +--
  1 file changed, 1 insertion(+), 6 deletions(-)
 
 diff --git a/drivers/staging/media/lirc/lirc_zilog.c 
 b/drivers/staging/media/lirc/lirc_zilog.c
 index 11a7cb1..ba538cd4 100644
 --- a/drivers/staging/media/lirc/lirc_zilog.c
 +++ b/drivers/staging/media/lirc/lirc_zilog.c
 @@ -1336,11 +1336,6 @@ static int close(struct inode *node, struct file 
 *filep)
   /* find our IR struct */
   struct IR *ir = filep-private_data;
  
 - if (ir == NULL) {
 - dev_err(ir-l.dev, close: no private_data attached to the 
 file!\n);
 - return -ENODEV;
 - }
 -

What is the reason behind this change? What would happen if the
filep-private_data is NULL? Are the callers of this function aware that
it will not return ENODEV anymore?

thanks,
konrad

   atomic_dec(ir-open_count);
  
   put_ir_device(ir, false);
 @@ -1633,7 +1628,7 @@ out_put_xx:
  out_put_ir:
   put_ir_device(ir, true);
  out_no_ir:
 - dev_err(ir-l.dev, %s: probing IR %s on %s (i2c-%d) failed with %d\n,
 + pr_err(%s: probing IR %s on %s (i2c-%d) failed with %d\n,
   __func__, tx_probe ? Tx : Rx, adap-name, adap-nr,
  ret);
   mutex_unlock(ir_devices_lock);
 -- 
 1.9.3
 
 ___
 devel mailing list
 de...@linuxdriverproject.org
 http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
--
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/7] [media] cx231xx: Cleanup printk at the driver

2014-11-02 Thread Mauro Carvalho Chehab
Em Sat, 01 Nov 2014 16:01:12 +0200
Antti Palosaari cr...@iki.fi escreveu:

 On 11/01/2014 03:38 PM, Mauro Carvalho Chehab wrote:
  There are lots of debug printks printed with pr_info. Also, the
  printk's data are not too coherent:
 
  - there are duplicated driver name at the print format;
  - function name format string differs from function to function;
  - long strings broken into multiple lines;
  - some printks just produce ugly reports, being almost useless
 as-is.
 
  Do a cleanup on that.
 
  Still, there are much to be done in order to do a better printk
  job on this driver, but, at least it will now be a way less
  verbose, if debug printks are disabled, and some logs might
  actually be useful.
 
 As you do that kind of cleanup, why don't just use a bit more time and 
 do it properly using dev_foo() logging. Basically all device drivers 
 should use dev_foo() logging, it prints module name, bus number etc. 
 automatically in a standard manner. pr_foo() is worse, which should be 
 only used for cases where pointer to device is not available (like library).

I did the conversion. It now prints:

Load time:

[  608.359255] usb 1-2: New device Conexant Corporation Polaris AV Capturb @ 
480 Mbps (1554:5010) with 7 interfaces
[  608.360009] usb 1-2: Identified as Pixelview PlayTV USB Hybrid (card=10)
[  608.363129] i2c i2c-8: Added multiplexed i2c bus 10
[  608.363201] i2c i2c-8: Added multiplexed i2c bus 11
[  608.560247] cx25840 7-0044: cx23102 A/V decoder found @ 0x88 (cx231xx #0-0)
[  610.968904] cx25840 7-0044: loaded v4l-cx231xx-avcore-01.fw firmware (16382 
bytes)
[  611.041317] Chip ID is not zero. It is not a TEA5767
[  611.041351] tuner 9-0060: Tuner -1 found with type(s) Radio TV.
[  611.041429] tda18271 9-0060: creating new instance
[  611.044096] TDA18271HD/C2 detected @ 9-0060
[  611.239460] tda18271: performing RF tracking filter calibration
[  612.800569] tda18271: RF tracking filter calibration complete
[  612.835365] usb 1-2: v4l2 driver version 0.0.3
[  613.055006] usb 1-2: Registered video device video0 [v4l2]
[  613.055461] usb 1-2: Registered VBI device vbi0
[  613.110279] Registered IR keymap rc-pixelview-002t
[  613.110574] input: i2c IR (Pixelview PlayTV USB Hy as 
/devices/virtual/rc/rc0/input12
[  613.111398] rc0: i2c IR (Pixelview PlayTV USB Hy as /devices/virtual/rc/rc0
[  613.111409] ir-kbd-i2c: i2c IR (Pixelview PlayTV USB Hy detected at 
i2c-9/9-0030/ir0 [cx231xx #0-2]
[  613.111444] usb 1-2: video EndPoint Addr 0x84, Alternate settings: 5
[  613.111454] usb 1-2: VBI EndPoint Addr 0x85, Alternate settings: 2
[  613.111465] usb 1-2: sliced CC EndPoint Addr 0x86, Alternate settings: 2
[  613.111474] usb 1-2: TS EndPoint Addr 0x81, Alternate settings: 6
[  613.111654] usbcore: registered new interface driver cx231xx
[  613.136510] usb 1-2: audio EndPoint Addr 0x83, Alternate settings: 3
[  613.136521] usb 1-2: Cx231xx Audio Extension initialized
[  613.199085] usb 1-2: dvb_init: looking for demod on i2c bus: 9
[  613.232349] i2c i2c-11: Detected a Fujitsu mb86a20s frontend
[  613.232385] tda18271 9-0060: attaching existing instance
[  613.232392] DVB: registering new adapter (cx231xx #0)
[  613.232402] usb 1-2: DVB: registering adapter 0 frontend 0 (Fujitsu 
mb86A20s)...
[  613.234528] usb 1-2: Successfully loaded cx231xx-dvb
[  613.234618] usb 1-2: Cx231xx dvb Extension initialized

We might eventually get rid of some messages there, like changing
the USB interface settings detection messages to debug for video, vbi,
sliced CC, TS and audio, but this is a potential source of problems,
if it got mis-detected. So, I would keep it there for now.

If i2c_scan, it will also show:

[  608.371656] usb 1-2: i2c scan: found device @ port 0 addr 0x40  [???]
[  608.374750] usb 1-2: i2c scan: found device @ port 0 addr 0x60  [colibri]
[  608.378433] usb 1-2: i2c scan: found device @ port 0 addr 0x88  [hammerhead]
[  608.380226] usb 1-2: i2c scan: found device @ port 0 addr 0x98  [???]
[  608.405747] usb 1-2: i2c scan: found device @ port 3 addr 0xa0  [eeprom]
[  608.422310] usb 1-2: i2c scan: found device @ port 2 addr 0x60  [colibri]
[  608.430229] usb 1-2: i2c scan: found device @ port 2 addr 0xc0  [tuner]
[  608.438793] usb 1-2: i2c scan: found device @ port 4 addr 0x20  [demod]

At remove time, it will print:

[  919.440166] usb 1-2: Cx231xx dvb Extension removed
[  936.428407] usb 1-2: Cx231xx Audio Extension removed
[  936.433072] usbcore: deregistering interface driver cx231xx
[  936.433112] usb 1-2: V4L2 device vbi0 deregistered
[  936.433244] usb 1-2: V4L2 device video0 deregistered
[  936.433505] tda18271 9-0060: destroying instance

I'm posting the patches.

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


[PATCH] v4l-utils/libdvbv5: restore deleted functions to keep API/ABI compatible

2014-11-02 Thread tskd08
From: Akihiro Tsukada tsk...@gmail.com

dvb_new_freq_is_needed() was integrated to dvb_new_entry_is_needed(),
and dvb_scan_add_entry() was added a new parameter.
As those changes broke API/ABI compatibility,
restore the original functions.

Signed-off-by: Akihiro Tsukada tsk...@gmail.com
---
 lib/include/libdvbv5/dvb-scan.h | 21 -
 lib/libdvbv5/dvb-scan.c | 50 +++--
 2 files changed, 48 insertions(+), 23 deletions(-)

diff --git a/lib/include/libdvbv5/dvb-scan.h b/lib/include/libdvbv5/dvb-scan.h
index aad6d01..c480426 100644
--- a/lib/include/libdvbv5/dvb-scan.h
+++ b/lib/include/libdvbv5/dvb-scan.h
@@ -385,17 +385,26 @@ void dvb_add_scaned_transponders(struct dvb_v5_fe_parms 
*parms,
  */
 int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *parms);
 
-int dvb_new_entry_is_needed(struct dvb_entry *entry,
-  struct dvb_entry *last_entry,
-  uint32_t freq, int shift,
-  enum dvb_sat_polarization pol, uint32_t stream_id);
+int dvb_new_freq_is_needed(struct dvb_entry *entry, struct dvb_entry 
*last_entry,
+  uint32_t freq, enum dvb_sat_polarization pol, int 
shift);
 
 struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *parms,
 struct dvb_entry *first_entry,
 struct dvb_entry *entry,
 uint32_t freq, uint32_t shift,
-enum dvb_sat_polarization pol,
-uint32_t stream_id);
+enum dvb_sat_polarization pol);
+
+int dvb_new_entry_is_needed(struct dvb_entry *entry,
+   struct dvb_entry *last_entry,
+   uint32_t freq, int shift,
+   enum dvb_sat_polarization pol, uint32_t stream_id);
+
+struct dvb_entry *dvb_scan_add_entry_ex(struct dvb_v5_fe_parms *parms,
+   struct dvb_entry *first_entry,
+   struct dvb_entry *entry,
+   uint32_t freq, uint32_t shift,
+   enum dvb_sat_polarization pol,
+   uint32_t stream_id);
 
 void dvb_update_transponders(struct dvb_v5_fe_parms *parms,
 struct dvb_v5_descriptors *dvb_scan_handler,
diff --git a/lib/libdvbv5/dvb-scan.c b/lib/libdvbv5/dvb-scan.c
index 6c94e8d..637c64e 100644
--- a/lib/libdvbv5/dvb-scan.c
+++ b/lib/libdvbv5/dvb-scan.c
@@ -693,6 +693,23 @@ int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *__p)
return shift;
 }
 
+int dvb_new_freq_is_needed(struct dvb_entry *entry, struct dvb_entry 
*last_entry,
+  uint32_t freq, enum dvb_sat_polarization pol, int 
shift)
+{
+   return dvb_new_entry_is_needed(entry, last_entry, freq, shift,
+pol, NO_STREAM_ID_FILTER);
+}
+
+struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *__p,
+struct dvb_entry *first_entry,
+struct dvb_entry *entry,
+uint32_t freq, uint32_t shift,
+enum dvb_sat_polarization pol)
+{
+   return dvb_scan_add_entry_ex(__p, first_entry, entry, freq, shift,
+   pol, NO_STREAM_ID_FILTER);
+}
+
 int dvb_new_entry_is_needed(struct dvb_entry *entry,
struct dvb_entry *last_entry,
uint32_t freq, int shift,
@@ -729,12 +746,12 @@ int dvb_new_entry_is_needed(struct dvb_entry *entry,
return 1;
 }
 
-struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *__p,
-struct dvb_entry *first_entry,
-struct dvb_entry *entry,
-uint32_t freq, uint32_t shift,
-enum dvb_sat_polarization pol,
-uint32_t stream_id)
+struct dvb_entry *dvb_scan_add_entry_ex(struct dvb_v5_fe_parms *__p,
+   struct dvb_entry *first_entry,
+   struct dvb_entry *entry,
+   uint32_t freq, uint32_t shift,
+   enum dvb_sat_polarization pol,
+   uint32_t stream_id)
 {
struct dvb_v5_fe_parms_priv *parms = (void *)__p;
struct dvb_entry *new_entry;
@@ -819,7 +836,7 @@ static void add_update_nit_dvbc(struct dvb_table_nit *nit,
new = tr-entry;
} else {
new = dvb_scan_add_entry(tr-parms, tr-first_entry, tr-entry,
-d-frequency, tr-shift, tr-pol, 0);
+   

[PATCH] v4l-utils/libdvbv5: fix memory leak in dvb_guess_user_country()

2014-11-02 Thread tskd08
From: Akihiro Tsukada tsk...@gmail.com

Signed-off-by: Akihiro Tsukada tsk...@gmail.com
---
 lib/libdvbv5/countries.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/libdvbv5/countries.c b/lib/libdvbv5/countries.c
index 7acdcc7..9e68ea6 100644
--- a/lib/libdvbv5/countries.c
+++ b/lib/libdvbv5/countries.c
@@ -395,13 +395,13 @@ enum dvb_country_t dvb_guess_user_country(void)
if (! buf || strlen(buf)  2)
continue;
 
-   buf = strdup(buf);
-   pbuf= buf;
-
if (! strncmp(buf, POSIX, MIN(strlen(buf), 5)) ||
! (strncmp(buf, en, MIN(strlen(buf), 2))  
!isalpha(buf[2])) )
continue;
 
+   buf = strdup(buf);
+   pbuf= buf;
+
// assuming 'language_country.encoding@variant'
 
// country after '_', if given
-- 
2.1.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


[PATCHv2 05/14] [media] cx25840: convert max_buf_size var to lowercase

2014-11-02 Thread Mauro Carvalho Chehab
CodingStyle fix: vars should be in lowercase.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/i2c/cx25840/cx25840-firmware.c 
b/drivers/media/i2c/cx25840/cx25840-firmware.c
index 6092bf71300f..9bbb31adc29d 100644
--- a/drivers/media/i2c/cx25840/cx25840-firmware.c
+++ b/drivers/media/i2c/cx25840/cx25840-firmware.c
@@ -113,7 +113,7 @@ int cx25840_loadfw(struct i2c_client *client)
const u8 *ptr;
const char *fwname = get_fw_name(client);
int size, retval;
-   int MAX_BUF_SIZE = FWSEND;
+   int max_buf_size = FWSEND;
u32 gpio_oe = 0, gpio_da = 0;
 
if (is_cx2388x(state)) {
@@ -123,8 +123,8 @@ int cx25840_loadfw(struct i2c_client *client)
}
 
/* cx231xx cannot accept more than 16 bytes at a time */
-   if (is_cx231xx(state)  MAX_BUF_SIZE  16)
-   MAX_BUF_SIZE = 16;
+   if (is_cx231xx(state)  max_buf_size  16)
+   max_buf_size = 16;
 
if (request_firmware(fw, fwname, FWDEV(client)) != 0) {
v4l_err(client, unable to open firmware %s\n, fwname);
@@ -139,7 +139,7 @@ int cx25840_loadfw(struct i2c_client *client)
size = fw-size;
ptr = fw-data;
while (size  0) {
-   int len = min(MAX_BUF_SIZE - 2, size);
+   int len = min(max_buf_size - 2, size);
 
memcpy(buffer + 2, ptr, len);
 
-- 
1.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


[PATCHv2 11/14] [media] cx231xx: add addr for demod and make i2c_devs const

2014-11-02 Thread Mauro Carvalho Chehab
I2C address 0x10 is the demod. While here, make the array const.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c 
b/drivers/media/usb/cx231xx/cx231xx-i2c.c
index c4dc13afbe05..87b26157cad0 100644
--- a/drivers/media/usb/cx231xx/cx231xx-i2c.c
+++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c
@@ -471,7 +471,8 @@ static struct i2c_adapter cx231xx_adap_template = {
  * i2c_devs
  * incomplete list of known devices
  */
-static char *i2c_devs[128] = {
+static const char *i2c_devs[128] = {
+   [0x20  1] = demod,
[0x60  1] = colibri,
[0x88  1] = hammerhead,
[0x8e  1] = CIR,
-- 
1.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


[PATCHv2 10/14] [media] cx231xx: use dev_foo instead of printk

2014-11-02 Thread Mauro Carvalho Chehab
There are several places at cx231xx that uses printk without
any special reason. Change all of them to use dev_foo().

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c 
b/drivers/media/usb/cx231xx/cx231xx-avcore.c
index 9088a32db2d1..b299242a63dd 100644
--- a/drivers/media/usb/cx231xx/cx231xx-avcore.c
+++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c
@@ -1208,7 +1208,8 @@ int cx231xx_set_audio_decoder_input(struct cx231xx *dev,
/* This is just a casual suggestion to people adding
   new boards in case they use a tuner type we don't
   currently know about */
-   printk(KERN_INFO Unknown tuner type configuring SIF);
+   dev_info(dev-udev-dev,
+Unknown tuner type configuring SIF);
break;
}
break;
diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c 
b/drivers/media/usb/cx231xx/cx231xx-cards.c
index 2e8741314bce..7156344e7022 100644
--- a/drivers/media/usb/cx231xx/cx231xx-cards.c
+++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
@@ -1216,11 +1216,11 @@ static int cx231xx_init_dev(struct cx231xx *dev, struct 
usb_device *udev,
cx231xx_add_into_devlist(dev);
 
if (dev-board.has_417) {
-   printk(KERN_INFO attach 417 %d\n, dev-model);
+   dev_info(udev-dev, attach 417 %d\n, dev-model);
if (cx231xx_417_register(dev)  0) {
-   printk(KERN_ERR
+   dev_err(udev-dev,
%s() Failed to register 417 on VID_B\n,
-  __func__);
+   __func__);
}
}
 
diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c 
b/drivers/media/usb/cx231xx/cx231xx-dvb.c
index 044ad353d09b..a0d40bda718d 100644
--- a/drivers/media/usb/cx231xx/cx231xx-dvb.c
+++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c
@@ -45,11 +45,6 @@ MODULE_PARM_DESC(debug, enable debug messages [dvb]);
 
 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
-#define dprintk(level, fmt, arg...) do {   \
-if (debug = level)\
-   printk(KERN_DEBUG %s/2-dvb:  fmt, dev-name, ## arg); \
-} while (0)
-
 #define CX231XX_DVB_NUM_BUFS 5
 #define CX231XX_DVB_MAX_PACKETSIZE 564
 #define CX231XX_DVB_MAX_PACKETS 64
@@ -196,9 +191,11 @@ static inline void print_err_status(struct cx231xx *dev, 
int packet, int status)
break;
}
if (packet  0) {
-   dprintk(1, URB status %d [%s].\n, status, errmsg);
+   dev_dbg(dev-udev-dev,
+   URB status %d [%s].\n, status, errmsg);
} else {
-   dprintk(1, URB packet %d, status %d [%s].\n,
+   dev_dbg(dev-udev-dev,
+   URB packet %d, status %d [%s].\n,
packet, status, errmsg);
}
 }
@@ -377,20 +374,21 @@ static int attach_xc5000(u8 addr, struct cx231xx *dev)
cfg.i2c_addr = addr;
 
if (!dev-dvb-frontend) {
-   printk(KERN_ERR %s/2: dvb frontend not attached. 
+   dev_err(dev-udev-dev, %s/2: dvb frontend not attached. 
   Can't attach xc5000\n, dev-name);
return -EINVAL;
}
 
fe = dvb_attach(xc5000_attach, dev-dvb-frontend, cfg);
if (!fe) {
-   printk(KERN_ERR %s/2: xc5000 attach failed\n, dev-name);
+   dev_err(dev-udev-dev,
+   %s/2: xc5000 attach failed\n, dev-name);
dvb_frontend_detach(dev-dvb-frontend);
dev-dvb-frontend = NULL;
return -EINVAL;
}
 
-   printk(KERN_INFO %s/2: xc5000 attached\n, dev-name);
+   dev_info(dev-udev-dev, %s/2: xc5000 attached\n, dev-name);
 
return 0;
 }
@@ -462,7 +460,7 @@ static int register_dvb(struct cx231xx_dvb *dvb,
result = dvb_register_adapter(dvb-adapter, dev-name, module, device,
  adapter_nr);
if (result  0) {
-   printk(KERN_WARNING
+   dev_warn(dev-udev-dev,
   %s: dvb_register_adapter failed (errno = %d)\n,
   dev-name, result);
goto fail_adapter;
@@ -476,7 +474,7 @@ static int register_dvb(struct cx231xx_dvb *dvb,
/* register frontend */
result = dvb_register_frontend(dvb-adapter, dvb-frontend);
if (result  0) {
-   printk(KERN_WARNING
+   dev_warn(dev-udev-dev,
   %s: dvb_register_frontend failed (errno = %d)\n,
   dev-name, result);
goto fail_frontend;
@@ -494,7 +492,8 @@ static int register_dvb(struct cx231xx_dvb *dvb,
 
result = dvb_dmx_init(dvb-demux);
if (result  0) {
-

[PATCHv2 04/14] [media] cx25840: Don't report an error if max size is adjusted

2014-11-02 Thread Mauro Carvalho Chehab
There's no reason to report:
cx25840 7-0044:  Firmware download size changed to 16 bytes max length

If the driver needs to adjust the buffer's maximum size.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/i2c/cx25840/cx25840-firmware.c 
b/drivers/media/i2c/cx25840/cx25840-firmware.c
index b3169f94ece8..6092bf71300f 100644
--- a/drivers/media/i2c/cx25840/cx25840-firmware.c
+++ b/drivers/media/i2c/cx25840/cx25840-firmware.c
@@ -122,10 +122,9 @@ int cx25840_loadfw(struct i2c_client *client)
gpio_da = cx25840_read(client, 0x164);
}
 
-   if (is_cx231xx(state)  MAX_BUF_SIZE  16) {
-   v4l_err(client,  Firmware download size changed to 16 bytes 
max length\n);
-   MAX_BUF_SIZE = 16;  /* cx231xx cannot accept more than 16 bytes 
at a time */
-   }
+   /* cx231xx cannot accept more than 16 bytes at a time */
+   if (is_cx231xx(state)  MAX_BUF_SIZE  16)
+   MAX_BUF_SIZE = 16;
 
if (request_firmware(fw, fwname, FWDEV(client)) != 0) {
v4l_err(client, unable to open firmware %s\n, fwname);
-- 
1.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


[PATCHv2 07/14] [media] cx231xx: disable I2C errors during i2c_scan

2014-11-02 Thread Mauro Carvalho Chehab
Otherwise, it would produce lots of useless messages like:
cx231xx: cx231xx_send_usb_command: failed with status --32

After this patch, I2C scan will produce an useful report:

[ 9494.050807] cx231xx: i2c_scan: checking for I2C devices on port=0 ..
[ 9494.074928] cx231xx: i2c scan: Completed Checking for I2C devices on port=0.
[ 9494.074936] cx231xx: i2c_scan: checking for I2C devices on port=3 ..
[ 9494.098934] cx231xx: i2c scan: Completed Checking for I2C devices on port=3.
[ 9494.098942] cx231xx: i2c_scan: checking for I2C devices on port=2 ..
[ 9494.118440] cx231xx: i2c scan: Completed Checking for I2C devices on port=2.
[ 9494.118448] cx231xx: i2c_scan: checking for I2C devices on port=4 ..
[ 9494.141889] cx231xx: i2c scan: Completed Checking for I2C devices on port=4.

[ 9494.060182] cx231xx: i2c scan: found device @ 0x40  [???]
[ 9494.062953] cx231xx: i2c scan: found device @ 0x60  [colibri]
[ 9494.066071] cx231xx: i2c scan: found device @ 0x88  [hammerhead]
[ 9494.067383] cx231xx: i2c scan: found device @ 0x98  [???]
[ 9494.090113] cx231xx: i2c scan: found device @ 0xa0  [eeprom]
[ 9494.106463] cx231xx: i2c scan: found device @ 0x60  [colibri]
[ 9494.113762] cx231xx: i2c scan: found device @ 0xc0  [tuner]
[ 9494.121882] cx231xx: i2c scan: found device @ 0x20  [???]
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c 
b/drivers/media/usb/cx231xx/cx231xx-core.c
index c5842a1ea104..66e8f8ae9be4 100644
--- a/drivers/media/usb/cx231xx/cx231xx-core.c
+++ b/drivers/media/usb/cx231xx/cx231xx-core.c
@@ -227,7 +227,7 @@ int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus,
 
/* call common vendor command request */
status = cx231xx_send_vendor_cmd(dev, ven_req);
-   if (status  0) {
+   if (status  0  !dev-i2c_scan_running) {
pr_err(%s: failed with status -%d\n,
__func__, status);
}
diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c 
b/drivers/media/usb/cx231xx/cx231xx-i2c.c
index 5a0604711be0..f99857e6c842 100644
--- a/drivers/media/usb/cx231xx/cx231xx-i2c.c
+++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c
@@ -496,6 +496,9 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port)
if (!i2c_scan)
return;
 
+   /* Don't generate I2C errors during scan */
+   dev-i2c_scan_running = true;
+
memset(client, 0, sizeof(client));
client.adapter = cx231xx_get_i2c_adap(dev, i2c_port);
 
@@ -512,6 +515,8 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port)
}
pr_info(i2c scan: Completed Checking for I2C devices on port=%d.\n,
i2c_port);
+
+   dev-i2c_scan_running = false;
 }
 
 /*
diff --git a/drivers/media/usb/cx231xx/cx231xx.h 
b/drivers/media/usb/cx231xx/cx231xx.h
index aeee721a8eef..253f2437c0f1 100644
--- a/drivers/media/usb/cx231xx/cx231xx.h
+++ b/drivers/media/usb/cx231xx/cx231xx.h
@@ -610,6 +610,8 @@ struct cx231xx {
unsigned int has_audio_class:1;
unsigned int has_alsa_audio:1;
 
+   unsigned int i2c_scan_running:1; /* true only during i2c_scan */
+
struct cx231xx_fmt *format;
 
struct v4l2_device v4l2_dev;
-- 
1.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


[PATCHv2 13/14] [media] cx231xx: too much changes. Bump version number

2014-11-02 Thread Mauro Carvalho Chehab
The I2C mux changes are significant. Bump version number.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index 5ea8124f5d20..c5b5e9541669 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -43,7 +43,7 @@
 
 #include cx231xx-vbi.h
 
-#define CX231XX_VERSION 0.0.2
+#define CX231XX_VERSION 0.0.3
 
 #define DRIVER_AUTHOR   Srinivasa Deevi srinivasa.de...@conexant.com
 #define DRIVER_DESC Conexant cx231xx based USB video device driver
-- 
1.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


[PATCHv2 06/14] [media] cx231xx: use 1 byte read for i2c scan

2014-11-02 Thread Mauro Carvalho Chehab
From: Matthias Schwarzott z...@gentoo.org

Now cx231xx_i2c_check_for_device works like i2c_check_for_device of em28xx 
driver.

For me this fixes scanning of all ports but port 2.

Signed-off-by: Matthias Schwarzott z...@gentoo.org
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c 
b/drivers/media/usb/cx231xx/cx231xx-i2c.c
index 1a0d9efeb209..5a0604711be0 100644
--- a/drivers/media/usb/cx231xx/cx231xx-i2c.c
+++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c
@@ -350,14 +350,15 @@ static int cx231xx_i2c_check_for_device(struct 
i2c_adapter *i2c_adap,
struct cx231xx *dev = bus-dev;
struct cx231xx_i2c_xfer_data req_data;
int status = 0;
+   u8 buf[1];
 
/* prepare xfer_data struct */
req_data.dev_addr = msg-addr;
-   req_data.direction = msg-flags;
+   req_data.direction = I2C_M_RD;
req_data.saddr_len = 0;
req_data.saddr_dat = 0;
-   req_data.buf_size = 0;
-   req_data.p_buffer = NULL;
+   req_data.buf_size = 1;
+   req_data.p_buffer = buf;
 
/* usb send command */
status = dev-cx231xx_send_usb_command(bus, req_data);
-- 
1.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


[PATCHv2 08/14] [media] cx231xx: convert from pr_foo to dev_foo

2014-11-02 Thread Mauro Carvalho Chehab
Replace all pr_foo occurrences by dev_foo, as this is
the recommended way for drivers.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c 
b/drivers/media/usb/cx231xx/cx231xx-417.c
index a0d1156d1df1..0773da4dc29b 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -39,7 +39,6 @@
 #include media/v4l2-event.h
 #include media/cx2341x.h
 #include media/tuner.h
-#include linux/usb.h
 
 #define CX231xx_FIRM_IMAGE_SIZE 376836
 #define CX231xx_FIRM_IMAGE_NAME v4l-cx23885-enc.fw
@@ -988,7 +987,8 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
IVTV_REG_APU, 0);
 
if (retval != 0) {
-   pr_err(%s: Error with mc417_register_write\n, __func__);
+   dev_err(dev-udev-dev,
+   %s: Error with mc417_register_write\n, __func__);
return -1;
}
 
@@ -996,21 +996,25 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
  dev-udev-dev);
 
if (retval != 0) {
-   pr_err(ERROR: Hotplug firmware request failed (%s).\n,
+   dev_err(dev-udev-dev,
+   ERROR: Hotplug firmware request failed (%s).\n,
CX231xx_FIRM_IMAGE_NAME);
-   pr_err(Please fix your hotplug setup, the board will not work 
without firmware loaded!\n);
+   dev_err(dev-udev-dev,
+   Please fix your hotplug setup, the board will not work 
without firmware loaded!\n);
return -1;
}
 
if (firmware-size != CX231xx_FIRM_IMAGE_SIZE) {
-   pr_err(ERROR: Firmware size mismatch (have %zd, expected 
%d)\n,
+   dev_err(dev-udev-dev,
+   ERROR: Firmware size mismatch (have %zd, expected 
%d)\n,
firmware-size, CX231xx_FIRM_IMAGE_SIZE);
release_firmware(firmware);
return -1;
}
 
if (0 != memcmp(firmware-data, magic, 8)) {
-   pr_err(ERROR: Firmware magic mismatch, wrong file?\n);
+   dev_err(dev-udev-dev,
+   ERROR: Firmware magic mismatch, wrong file?\n);
release_firmware(firmware);
return -1;
}
@@ -1057,7 +1061,8 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
retval |= mc417_register_write(dev, IVTV_REG_HW_BLOCKS,
IVTV_CMD_HW_BLOCKS_RST);
if (retval  0) {
-   pr_err(%s: Error with mc417_register_write\n,
+   dev_err(dev-udev-dev,
+   %s: Error with mc417_register_write\n,
__func__);
return retval;
}
@@ -1069,7 +1074,8 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
retval |= mc417_register_write(dev, IVTV_REG_VPU, value  0xFFE8);
 
if (retval  0) {
-   pr_err(%s: Error with mc417_register_write\n,
+   dev_err(dev-udev-dev,
+   %s: Error with mc417_register_write\n,
__func__);
return retval;
}
@@ -1117,25 +1123,28 @@ static int cx231xx_initialize_codec(struct cx231xx *dev)
dprintk(2, %s: PING OK\n, __func__);
retval = cx231xx_load_firmware(dev);
if (retval  0) {
-   pr_err(%s: f/w load failed\n, __func__);
+   dev_err(dev-udev-dev,
+   %s: f/w load failed\n, __func__);
return retval;
}
retval = cx231xx_find_mailbox(dev);
if (retval  0) {
-   pr_err(%s: mailbox  0, error\n,
+   dev_err(dev-udev-dev, %s: mailbox  0, error\n,
__func__);
return -1;
}
dev-cx23417_mailbox = retval;
retval = cx231xx_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0);
if (retval  0) {
-   pr_err(ERROR: cx23417 firmware ping failed!\n);
+   dev_err(dev-udev-dev,
+   ERROR: cx23417 firmware ping failed!\n);
return -1;
}
retval = cx231xx_api_cmd(dev, CX2341X_ENC_GET_VERSION, 0, 1,
version);
if (retval  0) {
-   pr_err(ERROR: cx23417 firmware get encoder: version 
failed!\n);
+   dev_err(dev-udev-dev,
+   ERROR: cx23417 firmware get encoder: version 
failed!\n);
return -1;
}
dprintk(1, cx23417 firmware version is 0x%08x\n, version);
@@ -1416,8 +1425,9 @@ static int bb_buf_prepare(struct videobuf_queue *q,
if 

[PATCHv2 01/14] [media] cx231xx: get rid of driver-defined printk macros

2014-11-02 Thread Mauro Carvalho Chehab
It currently does just like what pr_foo() macros do. So,
replace them.

A deeper cleanup is needed, as there are lots of debug macros
printed with pr_info.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c 
b/drivers/media/usb/cx231xx/cx231xx-417.c
index 459bb0e98971..d678f4587ab4 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -24,6 +24,8 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include cx231xx.h
+
 #include linux/module.h
 #include linux/moduleparam.h
 #include linux/init.h
@@ -39,8 +41,6 @@
 #include media/tuner.h
 #include linux/usb.h
 
-#include cx231xx.h
-
 #define CX231xx_FIRM_IMAGE_SIZE 376836
 #define CX231xx_FIRM_IMAGE_NAME v4l-cx23885-enc.fw
 
@@ -1416,7 +1416,7 @@ static int bb_buf_prepare(struct videobuf_queue *q,
if (!dev-video_mode.bulk_ctl.num_bufs)
urb_init = 1;
}
-   /*cx231xx_info(urb_init=%d dev-video_mode.max_pkt_size=%d\n,
+   /*pr_info(urb_init=%d dev-video_mode.max_pkt_size=%d\n,
urb_init, dev-video_mode.max_pkt_size);*/
dev-mode_tv = 1;
 
diff --git a/drivers/media/usb/cx231xx/cx231xx-audio.c 
b/drivers/media/usb/cx231xx/cx231xx-audio.c
index 9b925874d392..8312388edabb 100644
--- a/drivers/media/usb/cx231xx/cx231xx-audio.c
+++ b/drivers/media/usb/cx231xx/cx231xx-audio.c
@@ -20,6 +20,7 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include cx231xx.h
 #include linux/kernel.h
 #include linux/usb.h
 #include linux/init.h
@@ -37,7 +38,6 @@
 #include sound/initval.h
 #include sound/control.h
 #include media/v4l2-common.h
-#include cx231xx.h
 
 static int debug;
 module_param(debug, int, 0644);
@@ -182,7 +182,7 @@ static void cx231xx_audio_isocirq(struct urb *urb)
 
status = usb_submit_urb(urb, GFP_ATOMIC);
if (status  0) {
-   cx231xx_errdev(resubmit of audio urb failed (error=%i)\n,
+   pr_err(resubmit of audio urb failed (error=%i)\n,
   status);
}
return;
@@ -266,7 +266,7 @@ static void cx231xx_audio_bulkirq(struct urb *urb)
 
status = usb_submit_urb(urb, GFP_ATOMIC);
if (status  0) {
-   cx231xx_errdev(resubmit of audio urb failed (error=%i)\n,
+   pr_err(resubmit of audio urb failed (error=%i)\n,
   status);
}
return;
@@ -277,7 +277,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
int i, errCode;
int sb_size;
 
-   cx231xx_info(%s: Starting ISO AUDIO transfers\n, __func__);
+   pr_info(%s: Starting ISO AUDIO transfers\n, __func__);
 
if (dev-state  DEV_DISCONNECTED)
return -ENODEV;
@@ -295,7 +295,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
memset(dev-adev.transfer_buffer[i], 0x80, sb_size);
urb = usb_alloc_urb(CX231XX_ISO_NUM_AUDIO_PACKETS, GFP_ATOMIC);
if (!urb) {
-   cx231xx_errdev(usb_alloc_urb failed!\n);
+   pr_err(usb_alloc_urb failed!\n);
for (j = 0; j  i; j++) {
usb_free_urb(dev-adev.urb[j]);
kfree(dev-adev.transfer_buffer[j]);
@@ -338,7 +338,7 @@ static int cx231xx_init_audio_bulk(struct cx231xx *dev)
int i, errCode;
int sb_size;
 
-   cx231xx_info(%s: Starting BULK AUDIO transfers\n, __func__);
+   pr_info(%s: Starting BULK AUDIO transfers\n, __func__);
 
if (dev-state  DEV_DISCONNECTED)
return -ENODEV;
@@ -356,7 +356,7 @@ static int cx231xx_init_audio_bulk(struct cx231xx *dev)
memset(dev-adev.transfer_buffer[i], 0x80, sb_size);
urb = usb_alloc_urb(CX231XX_NUM_AUDIO_PACKETS, GFP_ATOMIC);
if (!urb) {
-   cx231xx_errdev(usb_alloc_urb failed!\n);
+   pr_err(usb_alloc_urb failed!\n);
for (j = 0; j  i; j++) {
usb_free_urb(dev-adev.urb[j]);
kfree(dev-adev.transfer_buffer[j]);
@@ -439,13 +439,13 @@ static int snd_cx231xx_capture_open(struct 
snd_pcm_substream *substream)
dprintk(opening device and trying to acquire exclusive lock\n);
 
if (!dev) {
-   cx231xx_errdev(BUG: cx231xx can't find device struct.
+   pr_err(BUG: cx231xx can't find device struct.
Can't proceed with open\n);
return -ENODEV;
}
 
if (dev-state  DEV_DISCONNECTED) {
-   cx231xx_errdev(Can't open. the device was removed.\n);
+   pr_err(Can't open. the device was removed.\n);
return -ENODEV;
}
 
@@ -458,7 +458,7 @@ static int snd_cx231xx_capture_open(struct 

[PATCHv2 00/14] Reduce cx231xx verbosity and do some cleanups

2014-11-02 Thread Mauro Carvalho Chehab
The cx231xx driver is too verbose. Several debug messages
are sent to dmesg. Do some cleanup and fix i2c_scan.

After this patch, it will now produce:

[  608.359255] usb 1-2: New device Conexant Corporation Polaris AV Capturb @ 
480 Mbps (1554:5010) with 7 interfaces
[  608.360009] usb 1-2: Identified as Pixelview PlayTV USB Hybrid (card=10)
[  608.363129] i2c i2c-8: Added multiplexed i2c bus 10
[  608.363201] i2c i2c-8: Added multiplexed i2c bus 11
[  610.968904] cx25840 7-0044: loaded v4l-cx231xx-avcore-01.fw firmware (16382 
bytes)
[  611.041317] Chip ID is not zero. It is not a TEA5767
[  611.041351] tuner 9-0060: Tuner -1 found with type(s) Radio TV.
[  611.041429] tda18271 9-0060: creating new instance
[  611.044096] TDA18271HD/C2 detected @ 9-0060
[  611.239460] tda18271: performing RF tracking filter calibration
[  612.800569] tda18271: RF tracking filter calibration complete
[  612.835365] usb 1-2: v4l2 driver version 0.0.3
[  613.055006] usb 1-2: Registered video device video0 [v4l2]
[  613.055461] usb 1-2: Registered VBI device vbi0
[  613.110279] Registered IR keymap rc-pixelview-002t
[  613.110574] input: i2c IR (Pixelview PlayTV USB Hy as 
/devices/virtual/rc/rc0/input12
[  613.111398] rc0: i2c IR (Pixelview PlayTV USB Hy as /devices/virtual/rc/rc0
[  613.111409] ir-kbd-i2c: i2c IR (Pixelview PlayTV USB Hy detected at 
i2c-9/9-0030/ir0 [cx231xx #0-2]
[  613.111444] usb 1-2: video EndPoint Addr 0x84, Alternate settings: 5
[  613.111454] usb 1-2: VBI EndPoint Addr 0x85, Alternate settings: 2
[  613.111465] usb 1-2: sliced CC EndPoint Addr 0x86, Alternate settings: 2
[  613.111474] usb 1-2: TS EndPoint Addr 0x81, Alternate settings: 6
[  613.111654] usbcore: registered new interface driver cx231xx
[  613.136510] usb 1-2: audio EndPoint Addr 0x83, Alternate settings: 3
[  613.136521] usb 1-2: Cx231xx Audio Extension initialized
[  613.199085] usb 1-2: dvb_init: looking for demod on i2c bus: 9
[  613.232349] i2c i2c-11: Detected a Fujitsu mb86a20s frontend
[  613.232385] tda18271 9-0060: attaching existing instance
[  613.232392] DVB: registering new adapter (cx231xx #0)
[  613.232402] usb 1-2: DVB: registering adapter 0 frontend 0 (Fujitsu 
mb86A20s)...
[  613.234528] usb 1-2: Successfully loaded cx231xx-dvb
[  613.234618] usb 1-2: Cx231xx dvb Extension initialized

Still verbose, but at least it doesn't produce extra logs during normal
work.

I2C scan is now fixed and not too verbose:

[  608.371656] usb 1-2: i2c scan: found device @ port 0 addr 0x40  [???]
[  608.374750] usb 1-2: i2c scan: found device @ port 0 addr 0x60  [colibri]
[  608.378433] usb 1-2: i2c scan: found device @ port 0 addr 0x88  [hammerhead]
[  608.380226] usb 1-2: i2c scan: found device @ port 0 addr 0x98  [???]
[  608.405747] usb 1-2: i2c scan: found device @ port 3 addr 0xa0  [eeprom]
[  608.422310] usb 1-2: i2c scan: found device @ port 2 addr 0x60  [colibri]
[  608.430229] usb 1-2: i2c scan: found device @ port 2 addr 0xc0  [tuner]
[  608.438793] usb 1-2: i2c scan: found device @ port 4 addr 0x20  [demod]
[  608.560247] cx25840 7-0044: cx23102 A/V decoder found @ 0x88 (cx231xx #0-0)

Tested with a Pixelview PlayTV USB Hybrid SBTVD.

-

v2:
 - The i2c scan fix patch got replaced by the one sent by Matthias;
 - Converted to dev_foo() instead of pr_foo();
 - Some minor CodingStyle cleanups;
 - Be a little less verbose on i2c_scan;
 - Bumped version string.

Matthias Schwarzott (1):
  [media] cx231xx: use 1 byte read for i2c scan

Mauro Carvalho Chehab (13):
  [media] cx231xx: get rid of driver-defined printk macros
  [media] cx231xx: Fix identation
  [media] cx231xx: Cleanup printk at the driver
  [media] cx25840: Don't report an error if max size is adjusted
  [media] cx25840: convert max_buf_size var to lowercase
  [media] cx231xx: disable I2C errors during i2c_scan
  [media] cx231xx: convert from pr_foo to dev_foo
  [media] cx231xx: get rid of audio debug parameter
  [media] cx231xx: use dev_foo instead of printk
  [media] cx231xx: add addr for demod and make i2c_devs const
  [media] cx231xx: use dev_info() for extension load/unload
  [media] cx231xx: too much changes. Bump version number
  [media] cx231xx: simplify I2C scan debug messages

 drivers/media/i2c/cx25840/cx25840-firmware.c |  11 +-
 drivers/media/usb/cx231xx/cx231xx-417.c  |  53 +++--
 drivers/media/usb/cx231xx/cx231xx-audio.c|  93 +
 drivers/media/usb/cx231xx/cx231xx-avcore.c   | 292 +++
 drivers/media/usb/cx231xx/cx231xx-cards.c| 158 ---
 drivers/media/usb/cx231xx/cx231xx-core.c | 150 +++---
 drivers/media/usb/cx231xx/cx231xx-dvb.c  | 114 ++-
 drivers/media/usb/cx231xx/cx231xx-i2c.c  |  37 ++--
 drivers/media/usb/cx231xx/cx231xx-input.c|   1 -
 drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c  |  47 +++--
 drivers/media/usb/cx231xx/cx231xx-vbi.c  |  48 +++--
 drivers/media/usb/cx231xx/cx231xx-video.c|  85 
 drivers/media/usb/cx231xx/cx231xx.h  |  21 

[PATCHv2 02/14] [media] cx231xx: Fix identation

2014-11-02 Thread Mauro Carvalho Chehab
One of the identation blocks is wrong. Fix it.

While here, replace pr_info by pr_debug inside such block and
add the function name to the print messages, as otherwise they
will not help much.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c 
b/drivers/media/usb/cx231xx/cx231xx-avcore.c
index 9185b05b4fbe..58b42e63405c 100644
--- a/drivers/media/usb/cx231xx/cx231xx-avcore.c
+++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c
@@ -2534,34 +2534,38 @@ int cx231xx_initialize_stream_xfer(struct cx231xx *dev, 
u32 media_type)
break;
 
case TS1_serial_mode:
-   pr_info(%s: set ts1 registers, __func__);
+   pr_debug(%s: set ts1 registers, __func__);
 
-   if (dev-board.has_417) {
-   pr_info( MPEG\n);
-   value = 0xFFFC;
-   value |= 0x3;
+   if (dev-board.has_417) {
+   pr_debug(%s: MPEG\n, __func__);
+   value = 0xFFFC;
+   value |= 0x3;
 
-   status = cx231xx_mode_register(dev, TS_MODE_REG, value);
+   status = cx231xx_mode_register(dev,
+TS_MODE_REG, value);
 
-   val[0] = 0x04;
-   val[1] = 0xA3;
-   val[2] = 0x3B;
-   val[3] = 0x00;
-   status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER,
-TS1_CFG_REG, val, 4);
+   val[0] = 0x04;
+   val[1] = 0xA3;
+   val[2] = 0x3B;
+   val[3] = 0x00;
+   status = cx231xx_write_ctrl_reg(dev,
+   VRT_SET_REGISTER,
+   TS1_CFG_REG, val, 4);
 
-   val[0] = 0x00;
-   val[1] = 0x08;
-   val[2] = 0x00;
-   val[3] = 0x08;
-   status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER,
-TS1_LENGTH_REG, val, 4);
-
-   } else {
-   pr_info( BDA\n);
-   status = cx231xx_mode_register(dev, TS_MODE_REG, 0x101);
-   status = cx231xx_mode_register(dev, TS1_CFG_REG, 0x010);
-   }
+   val[0] = 0x00;
+   val[1] = 0x08;
+   val[2] = 0x00;
+   val[3] = 0x08;
+   status = cx231xx_write_ctrl_reg(dev,
+   VRT_SET_REGISTER,
+   TS1_LENGTH_REG, val, 4);
+   } else {
+   pr_debug(%s: BDA\n, __func__);
+   status = cx231xx_mode_register(dev,
+TS_MODE_REG, 0x101);
+   status = cx231xx_mode_register(dev,
+   TS1_CFG_REG, 0x010);
+   }
break;
 
case TS1_parallel_mode:
-- 
1.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


[PATCHv2 12/14] [media] cx231xx: use dev_info() for extension load/unload

2014-11-02 Thread Mauro Carvalho Chehab
Now that we're using dev_foo, the logs become like:

usb 1-2: DVB: registering adapter 0 frontend 0 (Fujitsu mb86A20s)...
usb 1-2: Successfully loaded cx231xx-dvb
cx231xx: Cx231xx dvb Extension initialized

It is not clear, by the logs, that usb 1-2 name is an alias for
cx231xx. So, we also need to use dvb_info() at extension load/unload.

After the patch, it will print:
usb 1-2: Cx231xx dvb Extension initialized

With is coherent with the other logs.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c 
b/drivers/media/usb/cx231xx/cx231xx-core.c
index 36c3ecf204c1..64e907f02a02 100644
--- a/drivers/media/usb/cx231xx/cx231xx-core.c
+++ b/drivers/media/usb/cx231xx/cx231xx-core.c
@@ -98,10 +98,10 @@ int cx231xx_register_extension(struct cx231xx_ops *ops)
 
mutex_lock(cx231xx_devlist_mutex);
list_add_tail(ops-next, cx231xx_extension_devlist);
-   list_for_each_entry(dev, cx231xx_devlist, devlist)
+   list_for_each_entry(dev, cx231xx_devlist, devlist) {
ops-init(dev);
-
-   printk(KERN_INFO DRIVER_NAME : %s initialized\n, ops-name);
+   dev_info(dev-udev-dev, %s initialized\n, ops-name);
+   }
mutex_unlock(cx231xx_devlist_mutex);
return 0;
 }
@@ -112,11 +112,11 @@ void cx231xx_unregister_extension(struct cx231xx_ops *ops)
struct cx231xx *dev = NULL;
 
mutex_lock(cx231xx_devlist_mutex);
-   list_for_each_entry(dev, cx231xx_devlist, devlist)
+   list_for_each_entry(dev, cx231xx_devlist, devlist) {
ops-fini(dev);
+   dev_info(dev-udev-dev, %s removed\n, ops-name);
+   }
 
-
-   printk(KERN_INFO DRIVER_NAME : %s removed\n, ops-name);
list_del(ops-next);
mutex_unlock(cx231xx_devlist_mutex);
 }
-- 
1.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


[PATCHv2 03/14] [media] cx231xx: Cleanup printk at the driver

2014-11-02 Thread Mauro Carvalho Chehab
There are lots of debug printks printed with pr_info. Also, the
printk's data are not too coherent:

- there are duplicated driver name at the print format;
- function name format string differs from function to function;
- long strings broken into multiple lines;
- some printks just produce ugly reports, being almost useless
  as-is.

Do a cleanup on that.

Still, there are much to be done in order to do a better printk
job on this driver, but, at least it will now be a way less
verbose, if debug printks are disabled, and some logs might
actually be useful.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c 
b/drivers/media/usb/cx231xx/cx231xx-417.c
index d678f4587ab4..a0d1156d1df1 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -90,10 +90,10 @@ static unsigned int v4l_debug = 1;
 module_param(v4l_debug, int, 0644);
 MODULE_PARM_DESC(v4l_debug, enable V4L debug messages);
 
-#define dprintk(level, fmt, arg...)\
-   do { if (v4l_debug = level) \
-   pr_info(%s:  fmt, \
-   (dev) ? dev-name : cx231xx[?], ## arg); \
+#define dprintk(level, fmt, arg...)\
+   do {\
+   if (v4l_debug = level) \
+   printk(KERN_DEBUG pr_fmt(fmt), ## arg); \
} while (0)
 
 static struct cx231xx_tvnorm cx231xx_tvnorms[] = {
@@ -1114,15 +1114,15 @@ static int cx231xx_initialize_codec(struct cx231xx *dev)
cx231xx_disable656(dev);
retval = cx231xx_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0); /* ping */
if (retval  0) {
-   dprintk(2, %s() PING OK\n, __func__);
+   dprintk(2, %s: PING OK\n, __func__);
retval = cx231xx_load_firmware(dev);
if (retval  0) {
-   pr_err(%s() f/w load failed\n, __func__);
+   pr_err(%s: f/w load failed\n, __func__);
return retval;
}
retval = cx231xx_find_mailbox(dev);
if (retval  0) {
-   pr_err(%s() mailbox  0, error\n,
+   pr_err(%s: mailbox  0, error\n,
__func__);
return -1;
}
@@ -1798,7 +1798,6 @@ static unsigned int mpeg_poll(struct file *file,
 static int mpeg_mmap(struct file *file, struct vm_area_struct *vma)
 {
struct cx231xx_fh *fh = file-private_data;
-   struct cx231xx *dev = fh-dev;
 
dprintk(2, %s()\n, __func__);
 
diff --git a/drivers/media/usb/cx231xx/cx231xx-audio.c 
b/drivers/media/usb/cx231xx/cx231xx-audio.c
index 8312388edabb..e96703180c0c 100644
--- a/drivers/media/usb/cx231xx/cx231xx-audio.c
+++ b/drivers/media/usb/cx231xx/cx231xx-audio.c
@@ -277,7 +277,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
int i, errCode;
int sb_size;
 
-   pr_info(%s: Starting ISO AUDIO transfers\n, __func__);
+   pr_debug(%s: Starting ISO AUDIO transfers\n, __func__);
 
if (dev-state  DEV_DISCONNECTED)
return -ENODEV;
@@ -338,7 +338,7 @@ static int cx231xx_init_audio_bulk(struct cx231xx *dev)
int i, errCode;
int sb_size;
 
-   pr_info(%s: Starting BULK AUDIO transfers\n, __func__);
+   pr_debug(%s: Starting BULK AUDIO transfers\n, __func__);
 
if (dev-state  DEV_DISCONNECTED)
return -ENODEV;
@@ -439,8 +439,7 @@ static int snd_cx231xx_capture_open(struct 
snd_pcm_substream *substream)
dprintk(opening device and trying to acquire exclusive lock\n);
 
if (!dev) {
-   pr_err(BUG: cx231xx can't find device struct.
-   Can't proceed with open\n);
+   pr_err(BUG: cx231xx can't find device struct. Can't proceed 
with open\n);
return -ENODEV;
}
 
@@ -662,8 +661,7 @@ static int cx231xx_audio_init(struct cx231xx *dev)
return 0;
}
 
-   pr_info(cx231xx-audio.c: probing for cx231xx 
-non standard usbaudio\n);
+   pr_debug(probing for cx231xx non standard usbaudio\n);
 
err = snd_card_new(dev-udev-dev, index[devnr], Cx231xx Audio,
   THIS_MODULE, 0, card);
@@ -707,14 +705,12 @@ static int cx231xx_audio_init(struct cx231xx *dev)
bEndpointAddress;
 
adev-num_alt = uif-num_altsetting;
-   pr_info(EndPoint Addr 0x%x, Alternate settings: %i\n,
-adev-end_point_addr, adev-num_alt);
+   pr_info(audio EndPoint Addr 0x%x, Alternate settings: %i\n,
+   adev-end_point_addr, adev-num_alt);
adev-alt_max_pkt_size = kmalloc(32 * adev-num_alt, GFP_KERNEL);
 
-   if (adev-alt_max_pkt_size == NULL) {
-   pr_err(out of memory!\n);
+   if (adev-alt_max_pkt_size == NULL)
return -ENOMEM;
-   }
 
for (i = 

[PATCHv2 14/14] [media] cx231xx: simplify I2C scan debug messages

2014-11-02 Thread Mauro Carvalho Chehab
Don't need to show when it starts or stops. Just print lines
when devices are found.

After the changes, the output for i2c scan will be like:

usb 1-2: i2c scan: found device @ port 0 addr 0x40  [???]
usb 1-2: i2c scan: found device @ port 0 addr 0x60  [colibri]
usb 1-2: i2c scan: found device @ port 0 addr 0x88  [hammerhead]
usb 1-2: i2c scan: found device @ port 0 addr 0x98  [???]
usb 1-2: i2c scan: found device @ port 3 addr 0xa0  [eeprom]
usb 1-2: i2c scan: found device @ port 2 addr 0x60  [colibri]
usb 1-2: i2c scan: found device @ port 2 addr 0xc0  [tuner]
usb 1-2: i2c scan: found device @ port 4 addr 0x20  [demod]

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c 
b/drivers/media/usb/cx231xx/cx231xx-i2c.c
index 87b26157cad0..7ccc33d33664 100644
--- a/drivers/media/usb/cx231xx/cx231xx-i2c.c
+++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c
@@ -502,21 +502,17 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int 
i2c_port)
memset(client, 0, sizeof(client));
client.adapter = cx231xx_get_i2c_adap(dev, i2c_port);
 
-   dev_info(dev-udev-dev,
-   i2c_scan: checking for I2C devices on port=%d ..\n,
-   i2c_port);
for (i = 0; i  128; i++) {
client.addr = i;
rc = i2c_master_recv(client, buf, 0);
if (rc  0)
continue;
dev_info(dev-udev-dev,
-i2c scan: found device @ 0x%x  [%s]\n,
+i2c scan: found device @ port %d addr 0x%x  [%s]\n,
+i2c_port,
 i  1,
 i2c_devs[i] ? i2c_devs[i] : ???);
}
-   dev_info(dev-udev-dev, i2c scan: Completed Checking for I2C devices 
on port=%d.\n,
-   i2c_port);
 
dev-i2c_scan_running = false;
 }
-- 
1.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: [PATCHv2 00/14] Reduce cx231xx verbosity and do some cleanups

2014-11-02 Thread Mauro Carvalho Chehab
Em Sun, 02 Nov 2014 10:32:23 -0200
Mauro Carvalho Chehab mche...@osg.samsung.com escreveu:

 The cx231xx driver is too verbose. Several debug messages
 are sent to dmesg. Do some cleanup and fix i2c_scan.
 
 After this patch, it will now produce:
 
 [  608.359255] usb 1-2: New device Conexant Corporation Polaris AV Capturb @ 
 480 Mbps (1554:5010) with 7 interfaces
 [  608.360009] usb 1-2: Identified as Pixelview PlayTV USB Hybrid (card=10)
 [  608.363129] i2c i2c-8: Added multiplexed i2c bus 10
 [  608.363201] i2c i2c-8: Added multiplexed i2c bus 11
 [  610.968904] cx25840 7-0044: loaded v4l-cx231xx-avcore-01.fw firmware 
 (16382 bytes)
 [  611.041317] Chip ID is not zero. It is not a TEA5767
 [  611.041351] tuner 9-0060: Tuner -1 found with type(s) Radio TV.
 [  611.041429] tda18271 9-0060: creating new instance
 [  611.044096] TDA18271HD/C2 detected @ 9-0060
 [  611.239460] tda18271: performing RF tracking filter calibration
 [  612.800569] tda18271: RF tracking filter calibration complete
 [  612.835365] usb 1-2: v4l2 driver version 0.0.3
 [  613.055006] usb 1-2: Registered video device video0 [v4l2]
 [  613.055461] usb 1-2: Registered VBI device vbi0
 [  613.110279] Registered IR keymap rc-pixelview-002t
 [  613.110574] input: i2c IR (Pixelview PlayTV USB Hy as 
 /devices/virtual/rc/rc0/input12
 [  613.111398] rc0: i2c IR (Pixelview PlayTV USB Hy as /devices/virtual/rc/rc0
 [  613.111409] ir-kbd-i2c: i2c IR (Pixelview PlayTV USB Hy detected at 
 i2c-9/9-0030/ir0 [cx231xx #0-2]
 [  613.111444] usb 1-2: video EndPoint Addr 0x84, Alternate settings: 5
 [  613.111454] usb 1-2: VBI EndPoint Addr 0x85, Alternate settings: 2
 [  613.111465] usb 1-2: sliced CC EndPoint Addr 0x86, Alternate settings: 2
 [  613.111474] usb 1-2: TS EndPoint Addr 0x81, Alternate settings: 6
 [  613.111654] usbcore: registered new interface driver cx231xx
 [  613.136510] usb 1-2: audio EndPoint Addr 0x83, Alternate settings: 3
 [  613.136521] usb 1-2: Cx231xx Audio Extension initialized
 [  613.199085] usb 1-2: dvb_init: looking for demod on i2c bus: 9
 [  613.232349] i2c i2c-11: Detected a Fujitsu mb86a20s frontend
 [  613.232385] tda18271 9-0060: attaching existing instance
 [  613.232392] DVB: registering new adapter (cx231xx #0)
 [  613.232402] usb 1-2: DVB: registering adapter 0 frontend 0 (Fujitsu 
 mb86A20s)...
 [  613.234528] usb 1-2: Successfully loaded cx231xx-dvb
 [  613.234618] usb 1-2: Cx231xx dvb Extension initialized
 
 Still verbose, but at least it doesn't produce extra logs during normal
 work.
 
 I2C scan is now fixed and not too verbose:
 
 [  608.371656] usb 1-2: i2c scan: found device @ port 0 addr 0x40  [???]
 [  608.374750] usb 1-2: i2c scan: found device @ port 0 addr 0x60  [colibri]
 [  608.378433] usb 1-2: i2c scan: found device @ port 0 addr 0x88  
 [hammerhead]
 [  608.380226] usb 1-2: i2c scan: found device @ port 0 addr 0x98  [???]
 [  608.405747] usb 1-2: i2c scan: found device @ port 3 addr 0xa0  [eeprom]
 [  608.422310] usb 1-2: i2c scan: found device @ port 2 addr 0x60  [colibri]
 [  608.430229] usb 1-2: i2c scan: found device @ port 2 addr 0xc0  [tuner]
 [  608.438793] usb 1-2: i2c scan: found device @ port 4 addr 0x20  [demod]


 [  608.560247] cx25840 7-0044: cx23102 A/V decoder found @ 0x88 (cx231xx #0-0)

In time:

Too much cut-and-paste... the above line is shown even if i2c_scan parameter
is not used ;)

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] v4l-utils/libdvbv5: restore deleted functions to keep API/ABI compatible

2014-11-02 Thread Gregor Jasny
On 02/11/14 13:01, tsk...@gmail.com wrote:
 From: Akihiro Tsukada tsk...@gmail.com
 
 dvb_new_freq_is_needed() was integrated to dvb_new_entry_is_needed(),
 and dvb_scan_add_entry() was added a new parameter.
 As those changes broke API/ABI compatibility,
 restore the original functions.

I suppose you introduced the new functions to generalize the API.
Can't you keep the new functions and make dvb_new_freq_is_needed a thin
wrapper around them?

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


Re: [PATCH v4] v4l-utils/libdvbv5: add gconv module for the text conversions of ISDB-S/T.

2014-11-02 Thread Gregor Jasny
Hello,

this does not compile for me on my Debian Sid machine:

 make[3]: Entering directory '/home/gjasny/src/linuxtv/v4l-utils/lib/gconv'
 ld -o ARIB-STD-B24.so ARIB-STD-B24.o  -shared --version-script=gconv.map -z 
 combreloc -rpath=/usr/lib/gconv /usr/lib/gconv/libJIS.so 
 /usr/lib/gconv/libJISX0213.so
 ld: cannot find /usr/lib/gconv/libJIS.so: No such file or directory
 ld: cannot find /usr/lib/gconv/libJISX0213.so: No such file or directory
 Makefile:21: recipe for target 'ARIB-STD-B24.so' failed

The library is located in /usr/lib/x86_64-linux-gnu/gconv/libJIS.so.

I would really prefer if you could use the autotools toolchain
(autoconf, automake, libtool) to produce the two gconv modules. You
might be able to have a look at the v4l-plugins Makefiles in this project.

Also without using the autotools toolchain, cross compiling is broken.
Please see the INSTALL file in the root how to test.

Some ARM toolchains are not able to build shared libraries, so it would
be best to make the WITH_GCONV condition based on enable_shared, too.

In the existing Makefile I miss an install target.

Did you write the whole gconv module by yourself? Please clarify
copyright. Because libdvbv5 is useable without the gconv modules I would
move them into /contrib rather than /lib.

Are you aware of any other software that ships gconv modules? I'd like
to take a look how it got packaged for distributions.

Thanks,
Gregor
--
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/libdvbv5: restore deleted functions to keep API/ABI compatible

2014-11-02 Thread Akihiro TSUKADA
Hi,

the patch is aimed to do just as you wrote,
i.e. add wrapper funcs with the original names.
sorry for my bad english.
--
akihiro
--
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 01/13] media: entity: Document the media_entity_ops structure

2014-11-02 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 include/media/media-entity.h | 9 +
 1 file changed, 9 insertions(+)

diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index e004591..786906b 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -44,6 +44,15 @@ struct media_pad {
unsigned long flags;/* Pad flags (MEDIA_PAD_FL_*) */
 };
 
+/**
+ * struct media_entity_operations - Media entity operations
+ * @link_setup:Notify the entity of link changes. The 
operation can
+ * return an error, in which case link setup will be
+ * cancelled. Optional.
+ * @link_validate: Return whether a link is valid from the entity point of
+ * view. The media_entity_pipeline_start() function
+ * validates all links by calling this operation. Optional.
+ */
 struct media_entity_operations {
int (*link_setup)(struct media_entity *entity,
  const struct media_pad *local,
-- 
2.0.4

--
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 02/13] v4l: Add RBG and RGB 8:8:8 media bus formats on 24 and 32 bit busses

2014-11-02 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/DocBook/media/v4l/subdev-formats.xml | 67 ++
 include/uapi/linux/v4l2-mediabus.h |  4 +-
 2 files changed, 70 insertions(+), 1 deletion(-)

diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml 
b/Documentation/DocBook/media/v4l/subdev-formats.xml
index b2d5a03..d0fb3c7 100644
--- a/Documentation/DocBook/media/v4l/subdev-formats.xml
+++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
@@ -424,6 +424,36 @@
  entrybsubscript1/subscript/entry
  entrybsubscript0/subscript/entry
/row
+   row id=V4L2-MBUS-FMT-RBG888-1X24
+ entryV4L2_MBUS_FMT_RBG888_1X24/entry
+ entry0x100e/entry
+ entry/entry
+ dash-ent-8;
+ entryrsubscript7/subscript/entry
+ entryrsubscript6/subscript/entry
+ entryrsubscript5/subscript/entry
+ entryrsubscript4/subscript/entry
+ entryrsubscript3/subscript/entry
+ entryrsubscript2/subscript/entry
+ entryrsubscript1/subscript/entry
+ entryrsubscript0/subscript/entry
+ entrybsubscript7/subscript/entry
+ entrybsubscript6/subscript/entry
+ entrybsubscript5/subscript/entry
+ entrybsubscript4/subscript/entry
+ entrybsubscript3/subscript/entry
+ entrybsubscript2/subscript/entry
+ entrybsubscript1/subscript/entry
+ entrybsubscript0/subscript/entry
+ entrygsubscript7/subscript/entry
+ entrygsubscript6/subscript/entry
+ entrygsubscript5/subscript/entry
+ entrygsubscript4/subscript/entry
+ entrygsubscript3/subscript/entry
+ entrygsubscript2/subscript/entry
+ entrygsubscript1/subscript/entry
+ entrygsubscript0/subscript/entry
+   /row
row id=V4L2-MBUS-FMT-RGB888-1X24
  entryV4L2_MBUS_FMT_RGB888_1X24/entry
  entry0x100a/entry
@@ -563,6 +593,43 @@
  entrybsubscript1/subscript/entry
  entrybsubscript0/subscript/entry
/row
+   row id=V4L2-MBUS-FMT-RGB888-1X32-PADHI
+ entryV4L2_MBUS_FMT_RGB888_1X32_PADHI/entry
+ entry0x100f/entry
+ entry/entry
+ entry0/entry
+ entry0/entry
+ entry0/entry
+ entry0/entry
+ entry0/entry
+ entry0/entry
+ entry0/entry
+ entry0/entry
+ entryrsubscript7/subscript/entry
+ entryrsubscript6/subscript/entry
+ entryrsubscript5/subscript/entry
+ entryrsubscript4/subscript/entry
+ entryrsubscript3/subscript/entry
+ entryrsubscript2/subscript/entry
+ entryrsubscript1/subscript/entry
+ entryrsubscript0/subscript/entry
+ entrygsubscript7/subscript/entry
+ entrygsubscript6/subscript/entry
+ entrygsubscript5/subscript/entry
+ entrygsubscript4/subscript/entry
+ entrygsubscript3/subscript/entry
+ entrygsubscript2/subscript/entry
+ entrygsubscript1/subscript/entry
+ entrygsubscript0/subscript/entry
+ entrybsubscript7/subscript/entry
+ entrybsubscript6/subscript/entry
+ entrybsubscript5/subscript/entry
+ entrybsubscript4/subscript/entry
+ entrybsubscript3/subscript/entry
+ entrybsubscript2/subscript/entry
+ entrybsubscript1/subscript/entry
+ entrybsubscript0/subscript/entry
+   /row
  /tbody
/tgroup
   /table
diff --git a/include/uapi/linux/v4l2-mediabus.h 
b/include/uapi/linux/v4l2-mediabus.h
index 1445e85..8ea4f26 100644
--- a/include/uapi/linux/v4l2-mediabus.h
+++ b/include/uapi/linux/v4l2-mediabus.h
@@ -37,7 +37,7 @@
 enum v4l2_mbus_pixelcode {
V4L2_MBUS_FMT_FIXED = 0x0001,
 
-   /* RGB - next is 0x100e */
+   /* RGB - next is 0x1010 */
V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001,
V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002,
V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003,
@@ -47,10 +47,12 @@ enum v4l2_mbus_pixelcode {
V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,
V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008,
V4L2_MBUS_FMT_RGB666_1X18 = 0x1009,
+   V4L2_MBUS_FMT_RBG888_1X24 = 0x100e,
V4L2_MBUS_FMT_RGB888_1X24 = 0x100a,
V4L2_MBUS_FMT_RGB888_2X12_BE = 0x100b,
V4L2_MBUS_FMT_RGB888_2X12_LE = 0x100c,
V4L2_MBUS_FMT_ARGB_1X32 = 0x100d,
+   V4L2_MBUS_FMT_RGB888_1X32_PADHI = 0x100f,
 
/* YUV (including grey) - next is 0x2024 */
V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to 

[PATCH v2 00/13] Xilinx Video IP Core support

2014-11-02 Thread Laurent Pinchart
Hello,

Here's the second version of the Xilinx FPGA Video IP Cores kernel drivers.

I won't detail in great lengths the Xilinx Video IP architecture here, as that
would result in dozens of pages of documentation. The interested reader can
refer to the Zynq ZC702 Base TRD (Targeted Reference Design) User Guide
(http://www.xilinx.com/support/documentation/boards_and_kits/zc702_zvik/2014_2/ug925-zynq-zc702-base-trd.pdf).

In a nutshell, the Xilinx Video IP Cores architecture specifies how
video-related IP cores need to be designed to interoperate and how to assemble
them in pipelines of various complexities. The concepts map neatly to the
media controller architecture, which this patch set uses extensively.

The series starts with various new V4L2 core features, bug fixes or cleanups,
with a small documentation enhancement (01/13), the addition of new media bus
formats needed by the new drivers (02/13 to 04/13) and a new V4L2 OF link
parsing function (05/13).

The next two patches (06/13 and 07/13) fix two race conditions in videobuf2.
They could be applied seperately from this series as they're not specific to
Xilinx drivers.

The next three patches (08/13 to 10/13) fix bugs in the Xilinx Video DMA
driver. They are required as a runtime dependency but will not break
compilation. I will submit a separate pull request for them through the DMA
engine tree.

The last three patches are the core of this series.

Patch 11/13 adds support for the Xilinx Video IP architecture core in the form
of a base object to model video IP cores (xilinx-vip.c - Video IP), a
framework that parses a DT representation of a video pipeline and connects the
corresponding V4L2 subdevices together (xilinx-vipp.c - Video IP Pipeline) and
a glue between the Video DMA engine driver and the V4L2 API (xilinx-dma.c).

Patch 12/13 adds a driver for the Video Timing Controller (VTC) IP core. While
not strictly a video processing IP core, the VTC is required by other video IP
core drivers.

Finally, patch 13/13 adds a first video IP core driver for the Test Pattern
Generator (TPG). Drivers for other IP cores will be added in the future.

Cc: devicet...@vger.kernel.org

Hyun Kwon (2):
  v4l: Sort YUV formats of v4l2_mbus_pixelcode
  v4l: Add VUY8 24 bits bus format

Laurent Pinchart (8):
  media: entity: Document the media_entity_ops structure
  v4l: Add RBG and RGB 8:8:8 media bus formats on 24 and 32 bit busses
  v4l: of: Add v4l2_of_parse_link() function
  v4l: vb2: Fix race condition in vb2_fop_poll
  v4l: vb2: Fix race condition in _vb2_fop_release
  v4l: xilinx: Add Xilinx Video IP core
  v4l: xilinx: Add Video Timing Controller driver
  v4l: xilinx: Add Test Pattern Generator driver

Srikanth Thokala (3):
  dma: xilinx: vdma: Check if the segment list is empty in a descriptor
  dma: xilinx: vdma: Allow only one chunk in a line
  dma: xilinx: vdma: icg should be difference of stride and hsize

 Documentation/DocBook/media/v4l/subdev-formats.xml | 719 +---
 .../devicetree/bindings/media/xilinx/video.txt |  52 ++
 .../devicetree/bindings/media/xilinx/xlnx,v-tc.txt |  33 +
 .../bindings/media/xilinx/xlnx,v-tpg.txt   |  68 ++
 .../bindings/media/xilinx/xlnx,video.txt   |  55 ++
 MAINTAINERS|  10 +
 drivers/dma/xilinx/xilinx_vdma.c   |  13 +-
 drivers/media/platform/Kconfig |   1 +
 drivers/media/platform/Makefile|   2 +
 drivers/media/platform/xilinx/Kconfig  |  23 +
 drivers/media/platform/xilinx/Makefile |   5 +
 drivers/media/platform/xilinx/xilinx-dma.c | 770 +
 drivers/media/platform/xilinx/xilinx-dma.h | 109 +++
 drivers/media/platform/xilinx/xilinx-tpg.c | 921 +
 drivers/media/platform/xilinx/xilinx-vip.c | 269 ++
 drivers/media/platform/xilinx/xilinx-vip.h | 227 +
 drivers/media/platform/xilinx/xilinx-vipp.c| 669 +++
 drivers/media/platform/xilinx/xilinx-vipp.h|  49 ++
 drivers/media/platform/xilinx/xilinx-vtc.c | 386 +
 drivers/media/platform/xilinx/xilinx-vtc.h |  42 +
 drivers/media/v4l2-core/v4l2-of.c  |  61 ++
 drivers/media/v4l2-core/videobuf2-core.c   |  35 +-
 include/media/media-entity.h   |   9 +
 include/media/v4l2-of.h|  27 +
 include/uapi/linux/Kbuild  |   1 +
 include/uapi/linux/v4l2-mediabus.h |  19 +-
 include/uapi/linux/xilinx-v4l2-controls.h  |  73 ++
 27 files changed, 4302 insertions(+), 346 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/xilinx/video.txt
 create mode 100644 Documentation/devicetree/bindings/media/xilinx/xlnx,v-tc.txt
 create mode 100644 
Documentation/devicetree/bindings/media/xilinx/xlnx,v-tpg.txt
 create mode 100644 

[PATCH v2 12/13] v4l: xilinx: Add Video Timing Controller driver

2014-11-02 Thread Laurent Pinchart
The Video Timing Controller (VTC) includes a timing detector and/or a
timing generator. Only the generator is currently supported.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Michal Simek michal.si...@xilinx.com

---

Cc: devicet...@vger.kernel.org

 .../devicetree/bindings/media/xilinx/xlnx,v-tc.txt |  33 ++
 drivers/media/platform/xilinx/Kconfig  |   6 +
 drivers/media/platform/xilinx/Makefile |   1 +
 drivers/media/platform/xilinx/xilinx-vtc.c | 386 +
 drivers/media/platform/xilinx/xilinx-vtc.h |  42 +++
 5 files changed, 468 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/xilinx/xlnx,v-tc.txt
 create mode 100644 drivers/media/platform/xilinx/xilinx-vtc.c
 create mode 100644 drivers/media/platform/xilinx/xilinx-vtc.h

diff --git a/Documentation/devicetree/bindings/media/xilinx/xlnx,v-tc.txt 
b/Documentation/devicetree/bindings/media/xilinx/xlnx,v-tc.txt
new file mode 100644
index 000..2aed3b4
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/xilinx/xlnx,v-tc.txt
@@ -0,0 +1,33 @@
+Xilinx Video Timing Controller (VTC)
+
+
+The Video Timing Controller is a general purpose video timing generator and
+detector.
+
+Required properties:
+
+  - compatible: Must be xlnx,v-tc-6.1.
+
+  - reg: Physical base address and length of the registers set for the device.
+
+  - clocks: Must contain a clock specifier for the VTC core and timing
+interfaces clock.
+
+Optional properties:
+
+  - xlnx,detector: The VTC has a timing detector
+  - xlnx,generator: The VTC has a timing generator
+
+  At least one of the xlnx,detector and xlnx,generator properties must be
+  specified.
+
+
+Example:
+
+   vtc: vtc@43c4 {
+   compatible = xlnx,v-tc-6.1;
+   reg = 0x43c4 0x1;
+
+   clocks = clkc 15;
+   xlnx,generator;
+   };
diff --git a/drivers/media/platform/xilinx/Kconfig 
b/drivers/media/platform/xilinx/Kconfig
index f4347e9..19db823 100644
--- a/drivers/media/platform/xilinx/Kconfig
+++ b/drivers/media/platform/xilinx/Kconfig
@@ -7,4 +7,10 @@ config VIDEO_XILINX
 
 if VIDEO_XILINX
 
+config VIDEO_XILINX_VTC
+   tristate Xilinx Video Timing Controller
+   depends on VIDEO_XILINX
+   ---help---
+  Driver for the Xilinx Video Timing Controller
+
 endif #VIDEO_XILINX
diff --git a/drivers/media/platform/xilinx/Makefile 
b/drivers/media/platform/xilinx/Makefile
index 3ef9c8e..6611e32 100644
--- a/drivers/media/platform/xilinx/Makefile
+++ b/drivers/media/platform/xilinx/Makefile
@@ -1,3 +1,4 @@
 xilinx-video-objs += xilinx-dma.o xilinx-vip.o xilinx-vipp.o
 
 obj-$(CONFIG_VIDEO_XILINX) += xilinx-video.o
+obj-$(CONFIG_VIDEO_XILINX_VTC) += xilinx-vtc.o
diff --git a/drivers/media/platform/xilinx/xilinx-vtc.c 
b/drivers/media/platform/xilinx/xilinx-vtc.c
new file mode 100644
index 000..949063a
--- /dev/null
+++ b/drivers/media/platform/xilinx/xilinx-vtc.c
@@ -0,0 +1,386 @@
+/*
+ * Xilinx Video Timing Controller
+ *
+ * Copyright (C) 2013-2014 Ideas on Board
+ * Copyright (C) 2013-2014 Xilinx, Inc.
+ *
+ * Contacts: Hyun Kwon hyun.k...@xilinx.com
+ *   Laurent Pinchart laurent.pinch...@ideasonboard.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/clk.h
+#include linux/module.h
+#include linux/of.h
+#include linux/platform_device.h
+#include linux/slab.h
+
+#include xilinx-vip.h
+#include xilinx-vtc.h
+
+#define XVTC_CONTROL_FIELD_ID_POL_SRC  (1  26)
+#define XVTC_CONTROL_ACTIVE_CHROMA_POL_SRC (1  25)
+#define XVTC_CONTROL_ACTIVE_VIDEO_POL_SRC  (1  24)
+#define XVTC_CONTROL_HSYNC_POL_SRC (1  23)
+#define XVTC_CONTROL_VSYNC_POL_SRC (1  22)
+#define XVTC_CONTROL_HBLANK_POL_SRC(1  21)
+#define XVTC_CONTROL_VBLANK_POL_SRC(1  20)
+#define XVTC_CONTROL_CHROMA_SRC(1  18)
+#define XVTC_CONTROL_VBLANK_HOFF_SRC   (1  17)
+#define XVTC_CONTROL_VSYNC_END_SRC (1  16)
+#define XVTC_CONTROL_VSYNC_START_SRC   (1  15)
+#define XVTC_CONTROL_ACTIVE_VSIZE_SRC  (1  14)
+#define XVTC_CONTROL_FRAME_VSIZE_SRC   (1  13)
+#define XVTC_CONTROL_HSYNC_END_SRC (1  11)
+#define XVTC_CONTROL_HSYNC_START_SRC   (1  10)
+#define XVTC_CONTROL_ACTIVE_HSIZE_SRC  (1  9)
+#define XVTC_CONTROL_FRAME_HSIZE_SRC   (1  8)
+#define XVTC_CONTROL_SYNC_ENABLE   (1  5)
+#define XVTC_CONTROL_DET_ENABLE(1  3)
+#define XVTC_CONTROL_GEN_ENABLE(1  2)
+
+#define XVTC_STATUS_FSYNC(n)   ((n)  16)
+#define XVTC_STATUS_GEN_ACTIVE_VIDEO   (1  13)
+#define XVTC_STATUS_GEN_VBLANK (1  12)
+#define 

[PATCH v2 11/13] v4l: xilinx: Add Xilinx Video IP core

2014-11-02 Thread Laurent Pinchart
Xilinx platforms have no hardwired video capture or video processing
interface. Users create capture and memory to memory processing
pipelines in the FPGA fabric to suit their particular needs, by
instantiating video IP cores from a large library.

The Xilinx Video IP core is a framework that models a video pipeline
described in the device tree and expose the pipeline to userspace
through the media controller and V4L2 APIs.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Hyun Kwon hyun.k...@xilinx.com
Signed-off-by: Radhey Shyam Pandey radh...@xilinx.com
Signed-off-by: Michal Simek michal.si...@xilinx.com

---

Cc: devicet...@vger.kernel.org

Changes since v1:

- Remove unnecessary fields from struct xvip_dma_buffer
- Fix querycap capabilities and bus_info reporting
- Refuse to set format when the queue is busy
- Return buffers to vb2 when start_streaming fails
- Use vb2 fops and ioctl ops

v1 was made of the following individual patches.

media: xilinx: vip: Add yuv444 and bayer formats
media: xilinx: vip: Remove _TIMING_ from register definition
media: xilinx: dma: Add vidioc_enum_fmt_vid_cap callback
media: xilinx: dma: Fix alignments of xvip_dma_fops definition
media: xilinx: dma: Workaround for bytesperline
media: xilinx: vip: Add default min/max height/width definitions
media: xilinx: vip: Add common sink/source pad IDs
media: xilinx: vip: Add xvip_set_format_size()
media: xilinx: vip: Add xvip_enum_mbus_code()
media: xilinx: vip: Add xvip_enum_frame_size()
media: xilinx: vip: Add register clear and set functions
media: xilinx: vip: Add xvip_start()
media: xilinx: vip: Add xvip_stop()
media: xilinx: vip: Add xvip_set_frame_size()
media: xilinx: vip: Add enable/disable reg update functions
media: xilinx: vip: Add xvip_print_version()
media: xilinx: vip: Add xvip_reset()
media: xilinx: vip: Add xvip_get_frame_size()
media: xilinx: vip: Add suspend/resume helper functions
media: xilinx: vip: Change the return value of xvip_get_format_by_code()
media: xilinx: vip: Change the return value of xvip_of_get_format()
media: xilinx: vip: Change the return value of xvip_get_format_by_fourcc()
media: xilinx: vipp: Remove of_match_ptr()
media: xilinx: vipp: Add control to inherit subdevice controls
media: xilinx: Make disconnected video nodes return -EPIPE at stream on
media: xilinx: Make links configurable
media: xilinx: Rename xvip_pipeline_entity to xvip_graph_entity
media: xilinx: Rename xvip_pipeline to xvip_composite_device
media: xilinx: Rename xvipp_pipeline_* functions to xvip_graph_*
media: xilinx: Rename xvipp_v4l2_* functions to xvip_composite_v4l2_*
media: xilinx: Rename xvipp_* functions to xvip_composite_*
media: xilinx: Move pipeline management code to xilinx-dma.c
media: xilinx: Add missing mutex_destroy call
media: xilinx: Create xvip_pipeline structure
media: xilinx: Support more than two VDMAs in DT
media: xilinx: dma: Change vdma configuration to cyclic-mode
Revert media: xilinx: dma: Workaround for bytesperline
media: xilinx: Added DMA error handling
media: xilinx: Fix error handling
media: xilinx: Reordered mutexes initialization
media: xilinx: vipp: Add devicetree bindings documentation
media: xilinx: Reordered mutexes initialization
media: xilinx: Set format description in enum_fmt
media: xilinx: Remove global control handler
media: xilinx: dma: Use the interleaved dmaengine API
xilinx: Remove .owner field for drivers
v4l: xilinx: video: Rename compatible string to xlnx,video
v4l: xilinx: Remove axi- prefix from DT properties
v4l: xilinx: dma: Give back queued buffers at streamoff time
---
 .../devicetree/bindings/media/xilinx/video.txt |  52 ++
 .../bindings/media/xilinx/xlnx,video.txt   |  55 ++
 MAINTAINERS|   9 +
 drivers/media/platform/Kconfig |   1 +
 drivers/media/platform/Makefile|   2 +
 drivers/media/platform/xilinx/Kconfig  |  10 +
 drivers/media/platform/xilinx/Makefile |   3 +
 drivers/media/platform/xilinx/xilinx-dma.c | 770 +
 drivers/media/platform/xilinx/xilinx-dma.h | 109 +++
 drivers/media/platform/xilinx/xilinx-vip.c | 269 +++
 drivers/media/platform/xilinx/xilinx-vip.h | 227 ++
 drivers/media/platform/xilinx/xilinx-vipp.c| 669 ++
 drivers/media/platform/xilinx/xilinx-vipp.h|  49 ++
 13 files changed, 2225 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/xilinx/video.txt
 create mode 100644 
Documentation/devicetree/bindings/media/xilinx/xlnx,video.txt
 create mode 100644 drivers/media/platform/xilinx/Kconfig
 create mode 100644 drivers/media/platform/xilinx/Makefile
 create mode 100644 drivers/media/platform/xilinx/xilinx-dma.c
 create mode 100644 drivers/media/platform/xilinx/xilinx-dma.h
 create mode 100644 drivers/media/platform/xilinx/xilinx-vip.c
 create mode 100644 

[PATCH v2 10/13] dma: xilinx: vdma: icg should be difference of stride and hsize

2014-11-02 Thread Laurent Pinchart
From: Srikanth Thokala srikanth.thok...@xilinx.com

This patch modifies the icg field to match the description
as mentioned in the DMA Linux framework.

Signed-off-by: Srikanth Thokala stho...@xilinx.com
Signed-off-by: Michal Simek michal.si...@xilinx.com
---
 drivers/dma/xilinx/xilinx_vdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/xilinx/xilinx_vdma.c b/drivers/dma/xilinx/xilinx_vdma.c
index 3d3f70d..4a3a8f3 100644
--- a/drivers/dma/xilinx/xilinx_vdma.c
+++ b/drivers/dma/xilinx/xilinx_vdma.c
@@ -963,7 +963,7 @@ xilinx_vdma_dma_prep_interleaved(struct dma_chan *dchan,
hw = segment-hw;
hw-vsize = xt-numf;
hw-hsize = xt-sgl[0].size;
-   hw-stride = xt-sgl[0].icg 
+   hw-stride = (xt-sgl[0].icg + xt-sgl[0].size) 
XILINX_VDMA_FRMDLY_STRIDE_STRIDE_SHIFT;
hw-stride |= chan-config.frm_dly 
XILINX_VDMA_FRMDLY_STRIDE_FRMDLY_SHIFT;
-- 
2.0.4

--
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 13/13] v4l: xilinx: Add Test Pattern Generator driver

2014-11-02 Thread Laurent Pinchart
The TPG generates multiple static or dynamic test patterns. The driver
currently hardcodes the pattern to the moving box pattern.

Signed-off-by: Christian Kohn christian.k...@xilinx.com
Signed-off-by: Hyun Kwon hyun.k...@xilinx.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Michal Simek michal.si...@xilinx.com

---

Cc: devicet...@vger.kernel.org

I'd appreciate if DT reviewers could have a look at the xlnx,video-format and
xlnx,video-width properties if nothing else.

Changes since v1:

v4l: xilinx: tpg: Fix typo

v1 was made of the following individual patches.

media: xilinx: tpg: Add the version number in DT compatible string
media: xilinx: tpg: Use linux/device.h instead of linux/slab.h
media: xilinx: tpg: Reset in probe()
media: xilinx: tpg: Add controls for TPG
media: xilinx: tpg: Add the default format
media: xilinx: tpg: Fix alignments around __xtpg_get_pad_format()
media: xilinx: tpg: Change 'format' to 'fmt'
media: xilinx: tpg: Fix alignments
media: xilinx: tpg: Fix the structure comment
media: xilinx: tpg: Use xvip_enum_mbus_code()
media: xilinx: tpg: Use xvip_enum_frame_size()
media: xilinx: tpg: Use xvip_set_format_size()
media: xilinx: tpg: Use xvip_start()
media: xilinx: tpg: Use xvip_stop()
media: xilinx: tpg: Use xvip_set_frame_size()
media: xilinx: tpg: Use xvip_print_version()
media: xilinx: tpg: Add power management functions
media: xilinx: tpg: Remove of_match_ptr()
media: xilinx: tpg: Fix devm_ioremap_resource() return value check
media: xilinx: tpg: Make number of pads dynamic
media: xilinx: tpg: Configure the bayer phase
media: xilinx: tpg: Allocate active formats for each pad
media: xilinx: tpg: Include the format infomation in 'port' node
media: xilinx: tpg: Add VTC support
media: xilinx: tpg: Add video timing mux support
media: xilinx: tpg: Default to the color bars test pattern
media: xilinx: tpg: Disallow switching passthrough mode during streaming
media: xilinx: tpg: Move control IDs to xilinx-controls.h
media: xilinx: tpg: Make horizontal and vertical blanking configurable
media: xilinx: tpg: Ignore unconnected input ports
xilinx: Remove .owner field for drivers
v4l: xilinx: tpg: Rename compatible string to xlnx,v-tpg
v4l: xilinx: tpg: Lock the control handler when modifying control range
v4l: xilinx: tpg: Use devm_gpiod_get_optional
v4l: xilinx: tpg: Remove axi- prefix from DT properties
---
 .../bindings/media/xilinx/xlnx,v-tpg.txt   |  68 ++
 MAINTAINERS|   1 +
 drivers/media/platform/xilinx/Kconfig  |   7 +
 drivers/media/platform/xilinx/Makefile |   1 +
 drivers/media/platform/xilinx/xilinx-tpg.c | 921 +
 include/uapi/linux/Kbuild  |   1 +
 include/uapi/linux/xilinx-v4l2-controls.h  |  73 ++
 7 files changed, 1072 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/media/xilinx/xlnx,v-tpg.txt
 create mode 100644 drivers/media/platform/xilinx/xilinx-tpg.c
 create mode 100644 include/uapi/linux/xilinx-v4l2-controls.h

diff --git a/Documentation/devicetree/bindings/media/xilinx/xlnx,v-tpg.txt 
b/Documentation/devicetree/bindings/media/xilinx/xlnx,v-tpg.txt
new file mode 100644
index 000..c6de1e3
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/xilinx/xlnx,v-tpg.txt
@@ -0,0 +1,68 @@
+Xilinx Video Test Pattern Generator (TPG)
+-
+
+Required properties:
+
+- compatible: Must contain at least one of
+
+xlnx,v-tpg-5.0 (TPG version 5.0)
+xlnx,v-tpg-6.0 (TPG version 6.0)
+
+  TPG versions backward-compatible with previous versions should list all
+  compatible versions in the newer to older order.
+
+- reg: Physical base address and length of the registers set for the device.
+
+- xlnx,video-format, xlnx,video-width: Video format and width, as defined in
+  video.txt.
+
+- port: Video port, using the DT bindings defined in ../video-interfaces.txt.
+  The TPG has a single output port numbered 0.
+
+Optional properties:
+
+- xlnx,vtc: A phandle referencing the Video Timing Controller that generates
+  video timings for the TPG test patterns.
+
+- timing-gpios: Specifier for a GPIO that controls the timing mux at the TPG
+  input. The GPIO active level corresponds to the selection of VTC-generated
+  video timings.
+
+The xlnx,vtc and timing-gpios properties are mandatory when the TPG is
+synthesized with two ports and forbidden when synthesized with one port.
+
+Example:
+
+   tpg_0: tpg@4005 {
+   compatible = xlnx,v-tpg-6.0, xlnx,v-tpg-5.0;
+   reg = 0x4005 0x1;
+
+   xlnx,vtc = vtc_3;
+   timing-gpios = ps7_gpio_0 55 GPIO_ACTIVE_LOW;
+
+   ports {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   port@0 {
+   reg = 0;
+
+   xlnx,video-format 

[PATCH v2 03/13] v4l: Sort YUV formats of v4l2_mbus_pixelcode

2014-11-02 Thread Laurent Pinchart
From: Hyun Kwon hyun.k...@xilinx.com

Keep the formats sorted by type, bus_width, bits per component, samples
per pixel and order of subsamples, in that order.

Signed-off-by: Hyun Kwon hyun.k...@xilinx.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/DocBook/media/v4l/subdev-formats.xml | 600 ++---
 include/uapi/linux/v4l2-mediabus.h |  12 +-
 2 files changed, 306 insertions(+), 306 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml 
b/Documentation/DocBook/media/v4l/subdev-formats.xml
index d0fb3c7..588aed4 100644
--- a/Documentation/DocBook/media/v4l/subdev-formats.xml
+++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
@@ -2239,11 +2239,15 @@
  entryysubscript1/subscript/entry
  entryysubscript0/subscript/entry
/row
-   row id=V4L2-MBUS-FMT-UYVY8-1X16
- entryV4L2_MBUS_FMT_UYVY8_1X16/entry
- entry0x200f/entry
+   row id=V4L2-MBUS-FMT-UYVY12-2X12
+ entryV4L2_MBUS_FMT_UYVY12_2X12/entry
+ entry0x201c/entry
  entry/entry
- dash-ent-16;
+ dash-ent-20;
+ entryusubscript11/subscript/entry
+ entryusubscript10/subscript/entry
+ entryusubscript9/subscript/entry
+ entryusubscript8/subscript/entry
  entryusubscript7/subscript/entry
  entryusubscript6/subscript/entry
  entryusubscript5/subscript/entry
@@ -2252,6 +2256,16 @@
  entryusubscript2/subscript/entry
  entryusubscript1/subscript/entry
  entryusubscript0/subscript/entry
+   /row
+   row
+ entry/entry
+ entry/entry
+ entry/entry
+ dash-ent-20;
+ entryysubscript11/subscript/entry
+ entryysubscript10/subscript/entry
+ entryysubscript9/subscript/entry
+ entryysubscript8/subscript/entry
  entryysubscript7/subscript/entry
  entryysubscript6/subscript/entry
  entryysubscript5/subscript/entry
@@ -2265,7 +2279,11 @@
  entry/entry
  entry/entry
  entry/entry
- dash-ent-16;
+ dash-ent-20;
+ entryvsubscript11/subscript/entry
+ entryvsubscript10/subscript/entry
+ entryvsubscript9/subscript/entry
+ entryvsubscript8/subscript/entry
  entryvsubscript7/subscript/entry
  entryvsubscript6/subscript/entry
  entryvsubscript5/subscript/entry
@@ -2274,6 +2292,16 @@
  entryvsubscript2/subscript/entry
  entryvsubscript1/subscript/entry
  entryvsubscript0/subscript/entry
+   /row
+   row
+ entry/entry
+ entry/entry
+ entry/entry
+ dash-ent-20;
+ entryysubscript11/subscript/entry
+ entryysubscript10/subscript/entry
+ entryysubscript9/subscript/entry
+ entryysubscript8/subscript/entry
  entryysubscript7/subscript/entry
  entryysubscript6/subscript/entry
  entryysubscript5/subscript/entry
@@ -2283,11 +2311,15 @@
  entryysubscript1/subscript/entry
  entryysubscript0/subscript/entry
/row
-   row id=V4L2-MBUS-FMT-VYUY8-1X16
- entryV4L2_MBUS_FMT_VYUY8_1X16/entry
- entry0x2010/entry
+   row id=V4L2-MBUS-FMT-VYUY12-2X12
+ entryV4L2_MBUS_FMT_VYUY12_2X12/entry
+ entry0x201d/entry
  entry/entry
- dash-ent-16;
+ dash-ent-20;
+ entryvsubscript11/subscript/entry
+ entryvsubscript10/subscript/entry
+ entryvsubscript9/subscript/entry
+ entryvsubscript8/subscript/entry
  entryvsubscript7/subscript/entry
  entryvsubscript6/subscript/entry
  entryvsubscript5/subscript/entry
@@ -2296,6 +2328,16 @@
  entryvsubscript2/subscript/entry
  entryvsubscript1/subscript/entry
  entryvsubscript0/subscript/entry
+   /row
+   row
+ entry/entry
+ entry/entry
+ entry/entry
+ dash-ent-20;
+ entryysubscript11/subscript/entry
+ entryysubscript10/subscript/entry
+ entryysubscript9/subscript/entry
+ entryysubscript8/subscript/entry
  entryysubscript7/subscript/entry
  entryysubscript6/subscript/entry
  entryysubscript5/subscript/entry
@@ -2309,7 +2351,11 @@
  entry/entry
  entry/entry
  entry/entry
- dash-ent-16;
+ dash-ent-20;
+ entryusubscript11/subscript/entry
+ entryusubscript10/subscript/entry
+ 

[PATCH v2 09/13] dma: xilinx: vdma: Allow only one chunk in a line

2014-11-02 Thread Laurent Pinchart
From: Srikanth Thokala srikanth.thok...@xilinx.com

This patch adds a sanity check to see if frame_size is 1.

Signed-off-by: Srikanth Thokala stho...@xilinx.com
Signed-off-by: Michal Simek michal.si...@xilinx.com
---
 drivers/dma/xilinx/xilinx_vdma.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/dma/xilinx/xilinx_vdma.c b/drivers/dma/xilinx/xilinx_vdma.c
index 1093794..3d3f70d 100644
--- a/drivers/dma/xilinx/xilinx_vdma.c
+++ b/drivers/dma/xilinx/xilinx_vdma.c
@@ -942,6 +942,9 @@ xilinx_vdma_dma_prep_interleaved(struct dma_chan *dchan,
if (!xt-numf || !xt-sgl[0].size)
return NULL;
 
+   if (xt-frame_size != 1)
+   return NULL;
+
/* Allocate a transaction descriptor. */
desc = xilinx_vdma_alloc_tx_descriptor(chan);
if (!desc)
-- 
2.0.4

--
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 07/13] v4l: vb2: Fix race condition in _vb2_fop_release

2014-11-02 Thread Laurent Pinchart
The function releases the queue if the file being released is the queue
owner. The check reads the queue-owner field without taking the queue
lock, creating a race condition with functions that set the queue owner,
such as vb2_ioctl_reqbufs() for instance.

Fix this by moving the queue-owner check within the mutex protected
section.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/v4l2-core/videobuf2-core.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
b/drivers/media/v4l2-core/videobuf2-core.c
index de59465f..753e6b4 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -3385,14 +3385,14 @@ int _vb2_fop_release(struct file *file, struct mutex 
*lock)
 {
struct video_device *vdev = video_devdata(file);
 
+   if (lock)
+   mutex_lock(lock);
if (file-private_data == vdev-queue-owner) {
-   if (lock)
-   mutex_lock(lock);
vb2_queue_release(vdev-queue);
vdev-queue-owner = NULL;
-   if (lock)
-   mutex_unlock(lock);
}
+   if (lock)
+   mutex_unlock(lock);
return v4l2_fh_release(file);
 }
 EXPORT_SYMBOL_GPL(_vb2_fop_release);
-- 
2.0.4

--
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 08/13] dma: xilinx: vdma: Check if the segment list is empty in a descriptor

2014-11-02 Thread Laurent Pinchart
From: Srikanth Thokala srikanth.thok...@xilinx.com

The segment list in a descriptor should be checked for empty, else
it will try to access invalid address for the first call.  This
patch fixes this issue.

Signed-off-by: Srikanth Thokala stho...@xilinx.com
Signed-off-by: Michal Simek michal.si...@xilinx.com
---
 drivers/dma/xilinx/xilinx_vdma.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/xilinx/xilinx_vdma.c b/drivers/dma/xilinx/xilinx_vdma.c
index a6e6476..1093794 100644
--- a/drivers/dma/xilinx/xilinx_vdma.c
+++ b/drivers/dma/xilinx/xilinx_vdma.c
@@ -971,9 +971,11 @@ xilinx_vdma_dma_prep_interleaved(struct dma_chan *dchan,
hw-buf_addr = xt-src_start;
 
/* Link the previous next descriptor to current */
-   prev = list_last_entry(desc-segments,
-   struct xilinx_vdma_tx_segment, node);
-   prev-hw.next_desc = segment-phys;
+   if (!list_empty(desc-segments)) {
+   prev = list_last_entry(desc-segments,
+  struct xilinx_vdma_tx_segment, node);
+   prev-hw.next_desc = segment-phys;
+   }
 
/* Insert the segment into the descriptor segments list. */
list_add_tail(segment-node, desc-segments);
-- 
2.0.4

--
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 04/13] v4l: Add VUY8 24 bits bus format

2014-11-02 Thread Laurent Pinchart
From: Hyun Kwon hyun.k...@xilinx.com

Add VUY8 24 bits bus format, V4L2_MBUS_FMT_VUY8_1X24.

Signed-off-by: Hyun Kwon hyun.k...@xilinx.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/DocBook/media/v4l/subdev-formats.xml | 30 ++
 include/uapi/linux/v4l2-mediabus.h |  3 ++-
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml 
b/Documentation/DocBook/media/v4l/subdev-formats.xml
index 588aed4..aef3c8b 100644
--- a/Documentation/DocBook/media/v4l/subdev-formats.xml
+++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
@@ -2999,6 +2999,36 @@
  entryusubscript1/subscript/entry
  entryusubscript0/subscript/entry
/row
+   row id=V4L2-MBUS-FMT-VUY8-1X24
+ entryV4L2_MBUS_FMT_VUY8_1X24/entry
+ entry0x201a/entry
+ entry/entry
+ dash-ent-8;
+ entryvsubscript7/subscript/entry
+ entryvsubscript6/subscript/entry
+ entryvsubscript5/subscript/entry
+ entryvsubscript4/subscript/entry
+ entryvsubscript3/subscript/entry
+ entryvsubscript2/subscript/entry
+ entryvsubscript1/subscript/entry
+ entryvsubscript0/subscript/entry
+ entryusubscript7/subscript/entry
+ entryusubscript6/subscript/entry
+ entryusubscript5/subscript/entry
+ entryusubscript4/subscript/entry
+ entryusubscript3/subscript/entry
+ entryusubscript2/subscript/entry
+ entryusubscript1/subscript/entry
+ entryusubscript0/subscript/entry
+ entryysubscript7/subscript/entry
+ entryysubscript6/subscript/entry
+ entryysubscript5/subscript/entry
+ entryysubscript4/subscript/entry
+ entryysubscript3/subscript/entry
+ entryysubscript2/subscript/entry
+ entryysubscript1/subscript/entry
+ entryysubscript0/subscript/entry
+   /row
row id=V4L2-MBUS-FMT-UYVY12-1X24
  entryV4L2_MBUS_FMT_UYVY12_1X24/entry
  entry0x2020/entry
diff --git a/include/uapi/linux/v4l2-mediabus.h 
b/include/uapi/linux/v4l2-mediabus.h
index 9be976f..31b4ce1 100644
--- a/include/uapi/linux/v4l2-mediabus.h
+++ b/include/uapi/linux/v4l2-mediabus.h
@@ -54,7 +54,7 @@ enum v4l2_mbus_pixelcode {
V4L2_MBUS_FMT_ARGB_1X32 = 0x100d,
V4L2_MBUS_FMT_RGB888_1X32_PADHI = 0x100f,
 
-   /* YUV (including grey) - next is 0x2024 */
+   /* YUV (including grey) - next is 0x2025 */
V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
V4L2_MBUS_FMT_UV8_1X8 = 0x2015,
V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002,
@@ -84,6 +84,7 @@ enum v4l2_mbus_pixelcode {
V4L2_MBUS_FMT_VYUY10_1X20 = 0x201b,
V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d,
V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e,
+   V4L2_MBUS_FMT_VUY8_1X24 = 0x2024,
V4L2_MBUS_FMT_UYVY12_1X24 = 0x2020,
V4L2_MBUS_FMT_VYUY12_1X24 = 0x2021,
V4L2_MBUS_FMT_YUYV12_1X24 = 0x2022,
-- 
2.0.4

--
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 05/13] v4l: of: Add v4l2_of_parse_link() function

2014-11-02 Thread Laurent Pinchart
The function fills a link data structure with the device node and port
number at both the local and remote ends of a link defined by one of its
endpoint nodes.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/v4l2-core/v4l2-of.c | 61 +++
 include/media/v4l2-of.h   | 27 +
 2 files changed, 88 insertions(+)

Cc: Sylwester Nawrocki s.nawro...@samsung.com

diff --git a/drivers/media/v4l2-core/v4l2-of.c 
b/drivers/media/v4l2-core/v4l2-of.c
index b4ed9a9..c473479 100644
--- a/drivers/media/v4l2-core/v4l2-of.c
+++ b/drivers/media/v4l2-core/v4l2-of.c
@@ -142,3 +142,64 @@ int v4l2_of_parse_endpoint(const struct device_node *node,
return 0;
 }
 EXPORT_SYMBOL(v4l2_of_parse_endpoint);
+
+/**
+ * v4l2_of_parse_link() - parse a link between two endpoints
+ * @node: pointer to the endpoint at the local end of the link
+ * @link: pointer to the V4L2 OF link data structure
+ *
+ * Fill the link structure with the local and remote nodes and port numbers.
+ * The local_node and remote_node fields are set to point to the local and
+ * remote port parent nodes respectively (the port parent node being the parent
+ * node of the port node if that node isn't a 'ports' node, or the grand-parent
+ * node of the port node otherwise).
+ *
+ * A reference is taken to both the local and remote nodes, the caller must use
+ * v4l2_of_put_link() to drop the references when done with the link.
+ *
+ * Return: 0 on success, or -ENOLINK if the remote endpoint can't be found.
+ */
+int v4l2_of_parse_link(const struct device_node *node,
+  struct v4l2_of_link *link)
+{
+   struct device_node *np;
+
+   memset(link, 0, sizeof(*link));
+
+   np = of_get_parent(node);
+   of_property_read_u32(np, reg, link-local_port);
+   np = of_get_next_parent(np);
+   if (of_node_cmp(np-name, ports) == 0)
+   np = of_get_next_parent(np);
+   link-local_node = np;
+
+   np = of_parse_phandle(node, remote-endpoint, 0);
+   if (!np) {
+   of_node_put(link-local_node);
+   return -ENOLINK;
+   }
+
+   np = of_get_parent(np);
+   of_property_read_u32(np, reg, link-remote_port);
+   np = of_get_next_parent(np);
+   if (of_node_cmp(np-name, ports) == 0)
+   np = of_get_next_parent(np);
+   link-remote_node = np;
+
+   return 0;
+}
+EXPORT_SYMBOL(v4l2_of_parse_link);
+
+/**
+ * v4l2_of_put_link() - drop references to nodes in a link
+ * @link: pointer to the V4L2 OF link data structure
+ *
+ * Drop references to the local and remote nodes in the link. This function 
must
+ * be called on every link parsed with v4l2_of_parse_link().
+ */
+void v4l2_of_put_link(struct v4l2_of_link *link)
+{
+   of_node_put(link-local_node);
+   of_node_put(link-remote_node);
+}
+EXPORT_SYMBOL(v4l2_of_put_link);
diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h
index 70fa7b7..078846d 100644
--- a/include/media/v4l2-of.h
+++ b/include/media/v4l2-of.h
@@ -66,9 +66,26 @@ struct v4l2_of_endpoint {
struct list_head head;
 };
 
+/**
+ * struct v4l2_of_link - a link between two endpoints
+ * @local_node: pointer to device_node of this endpoint
+ * @local_port: identifier of the port this endpoint belongs to
+ * @remote_node: pointer to device_node of the remote endpoint
+ * @remote_port: identifier of the port the remote endpoint belongs to
+ */
+struct v4l2_of_link {
+   struct device_node *local_node;
+   unsigned int local_port;
+   struct device_node *remote_node;
+   unsigned int remote_port;
+};
+
 #ifdef CONFIG_OF
 int v4l2_of_parse_endpoint(const struct device_node *node,
   struct v4l2_of_endpoint *endpoint);
+int v4l2_of_parse_link(const struct device_node *node,
+  struct v4l2_of_link *link);
+void v4l2_of_put_link(struct v4l2_of_link *link);
 #else /* CONFIG_OF */
 
 static inline int v4l2_of_parse_endpoint(const struct device_node *node,
@@ -77,6 +94,16 @@ static inline int v4l2_of_parse_endpoint(const struct 
device_node *node,
return -ENOSYS;
 }
 
+static inline int v4l2_of_parse_link(const struct device_node *node,
+struct v4l2_of_link *link)
+{
+   return -ENOSYS;
+}
+
+static inline void v4l2_of_put_link(struct v4l2_of_link *link)
+{
+}
+
 #endif /* CONFIG_OF */
 
 #endif /* _V4L2_OF_H */
-- 
2.0.4

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


Re: [PATCH v4] v4l-utils/libdvbv5: add gconv module for the text conversions of ISDB-S/T.

2014-11-02 Thread Akihiro TSUKADA
Hi,

 I would really prefer if you could use the autotools toolchain
 (autoconf, automake, libtool) to produce the two gconv modules. You
 might be able to have a look at the v4l-plugins Makefiles in this project.

As the upstream glibc does not use autotools,
I looked through the Makefiles there and they were too complex for me
to convert to the simple version for just building out-of-tree modules.
So the current Makefile is pretty premitive.
But I'll try to investigate it again.

 In the existing Makefile I miss an install target.

Those modules are not intended to be installed,
instead GCONV_PATH is set to the directory at runtime.

 Did you write the whole gconv module by yourself? Please clarify
 copyright. Because libdvbv5 is useable without the gconv modules I would
 move them into /contrib rather than /lib.

the work was done by myself but it is based on the other existing
modules (iso-2022-jp-3 and iso_6937).
I'd like to assign copyrights to FSF as written in a file header,
as I intend to contribute them to the upstream glibc.

 Are you aware of any other software that ships gconv modules? I'd like
 to take a look how it got packaged for distributions.

Unfortunately I don't know one,
and that's why those gconv modules are so badly packaged;)

--
Akihiro

--
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: [PATCHv2 12/14] [media] cx231xx: use dev_info() for extension load/unload

2014-11-02 Thread Antti Palosaari



On 11/02/2014 02:32 PM, Mauro Carvalho Chehab wrote:

Now that we're using dev_foo, the logs become like:

usb 1-2: DVB: registering adapter 0 frontend 0 (Fujitsu mb86A20s)...
usb 1-2: Successfully loaded cx231xx-dvb
cx231xx: Cx231xx dvb Extension initialized

It is not clear, by the logs, that usb 1-2 name is an alias for
cx231xx. So, we also need to use dvb_info() at extension load/unload.

After the patch, it will print:
usb 1-2: Cx231xx dvb Extension initialized

With is coherent with the other logs.



That is not correct as wrong device pointer passed to dev_. Go cx231xx 
usb driver probe function and add following test log to see how is 
should look like:

dev_info(intf-dev, Hello World\n);

It prints something like
cx231xx 1-2-1: Hello World

regards
Antti



Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c 
b/drivers/media/usb/cx231xx/cx231xx-core.c
index 36c3ecf204c1..64e907f02a02 100644
--- a/drivers/media/usb/cx231xx/cx231xx-core.c
+++ b/drivers/media/usb/cx231xx/cx231xx-core.c
@@ -98,10 +98,10 @@ int cx231xx_register_extension(struct cx231xx_ops *ops)

mutex_lock(cx231xx_devlist_mutex);
list_add_tail(ops-next, cx231xx_extension_devlist);
-   list_for_each_entry(dev, cx231xx_devlist, devlist)
+   list_for_each_entry(dev, cx231xx_devlist, devlist) {
ops-init(dev);
-
-   printk(KERN_INFO DRIVER_NAME : %s initialized\n, ops-name);
+   dev_info(dev-udev-dev, %s initialized\n, ops-name);
+   }
mutex_unlock(cx231xx_devlist_mutex);
return 0;
  }
@@ -112,11 +112,11 @@ void cx231xx_unregister_extension(struct cx231xx_ops *ops)
struct cx231xx *dev = NULL;

mutex_lock(cx231xx_devlist_mutex);
-   list_for_each_entry(dev, cx231xx_devlist, devlist)
+   list_for_each_entry(dev, cx231xx_devlist, devlist) {
ops-fini(dev);
+   dev_info(dev-udev-dev, %s removed\n, ops-name);
+   }

-
-   printk(KERN_INFO DRIVER_NAME : %s removed\n, ops-name);
list_del(ops-next);
mutex_unlock(cx231xx_devlist_mutex);
  }



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


Re: (bisected) Logitech C920 (uvcvideo) stutters since 3.9

2014-11-02 Thread Sakari Ailus
Hi Grazvydas,

On Sun, Nov 02, 2014 at 04:03:55AM +0200, Grazvydas Ignotas wrote:
 There is periodic stutter (seen in vlc, for example) since 3.9 where
 the stream stops for around half a second every 3-5 seconds or so.
 Bisecting points to 1b18e7a0be859911b22138ce27258687efc528b8 v4l:
 Tell user space we're using monotonic timestamps. I've verified the
 problem is there on stock Ubuntu 14.04 kernel, 3.16.7 from kernel.org
 and when using media_build.git . The commit does not revert on newer
 kernels as that code changed, but checking out a commit before the one
 mentioned gives properly working kernel.
 
 I'm using Logitech C920 which can do h264 compression and playing the
 video using vlc:
 cvlc v4l2:///dev/video0:chroma=h264:width=1280:height=720

I've got Logitech C270 here but I can't reproduce the problem. The frame
rate with the above command is really low, around 5. With a smaller
resolution it works quite smoothly. The reason might be that the pixel
format is still YUYV. The other option appears to be MJPG.

My vlc is of version 2.0.3 (Debian). Which one do you have, and does it use
libv4l2?

Have you tried with a different application to see if the problem persists?
If the cause of the stutter you described is this patch, it might be how
the information the flag provides is used in the user space.

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


cron job: media_tree daily build: ERRORS

2014-11-02 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:   Mon Nov  3 04:00:19 CET 2014
git branch: test
git hash:   082417d10fafe7be835d143ade7114b5ce26cb50
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-34-g71e642a
host hardware:  x86_64
host os:3.17-2.slh.2-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.32.27-i686: ERRORS
linux-2.6.33.7-i686: ERRORS
linux-2.6.34.7-i686: ERRORS
linux-2.6.35.9-i686: ERRORS
linux-2.6.36.4-i686: ERRORS
linux-2.6.37.6-i686: ERRORS
linux-2.6.38.8-i686: ERRORS
linux-2.6.39.4-i686: ERRORS
linux-3.0.60-i686: ERRORS
linux-3.1.10-i686: ERRORS
linux-3.2.37-i686: ERRORS
linux-3.3.8-i686: ERRORS
linux-3.4.27-i686: ERRORS
linux-3.5.7-i686: ERRORS
linux-3.6.11-i686: ERRORS
linux-3.7.4-i686: WARNINGS
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16-i686: OK
linux-3.17-i686: OK
linux-3.18-rc1-i686: OK
linux-2.6.32.27-x86_64: ERRORS
linux-2.6.33.7-x86_64: ERRORS
linux-2.6.34.7-x86_64: ERRORS
linux-2.6.35.9-x86_64: ERRORS
linux-2.6.36.4-x86_64: ERRORS
linux-2.6.37.6-x86_64: ERRORS
linux-2.6.38.8-x86_64: ERRORS
linux-2.6.39.4-x86_64: ERRORS
linux-3.0.60-x86_64: ERRORS
linux-3.1.10-x86_64: ERRORS
linux-3.2.37-x86_64: ERRORS
linux-3.3.8-x86_64: ERRORS
linux-3.4.27-x86_64: ERRORS
linux-3.5.7-x86_64: ERRORS
linux-3.6.11-x86_64: ERRORS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16-x86_64: OK
linux-3.17-x86_64: OK
linux-3.18-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: ERRORS
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

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