summaryrefslogtreecommitdiff
path: root/drivers/media/usb/cx231xx/cx231xx-core.c
AgeCommit message (Collapse)Author
2018-01-04media: replace all <spaces><tab> occurrencesMauro Carvalho Chehab
There are a lot of places where sequences of space/tabs are found. Get rid of all spaces before tabs. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-09media: cx231xx: only unregister successfully registered i2c adaptersPeter Rosin
This prevents potentially scary debug messages from the i2c core. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-02-07[media] cx231xx: Fix I2C on Internal Master 3 BusOleh Kravchenko
Internal Master 3 Bus can send and receive only 4 bytes per time. Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-10-21[media] cx231xx: don't break long linesMauro Carvalho Chehab
Due to the 80-cols restrictions, and latter due to checkpatch warnings, several strings were broken into multiple lines. This is not considered a good practice anymore, as it makes harder to grep for strings at the source code. As we're right now fixing other drivers due to KERN_CONT, we need to be able to identify what printk strings don't end with a "\n". It is a way easier to detect those if we don't break long lines. So, join those continuation lines. The patch was generated via the script below, and manually adjusted if needed. </script> use Text::Tabs; while (<>) { if ($next ne "") { $c=$_; if ($c =~ /^\s+\"(.*)/) { $c2=$1; $next =~ s/\"\n$//; $n = expand($next); $funpos = index($n, '('); $pos = index($c2, '",'); if ($funpos && $pos > 0) { $s1 = substr $c2, 0, $pos + 2; $s2 = ' ' x ($funpos + 1) . substr $c2, $pos + 2; $s2 =~ s/^\s+//; $s2 = ' ' x ($funpos + 1) . $s2 if ($s2 ne ""); print unexpand("$next$s1\n"); print unexpand("$s2\n") if ($s2 ne ""); } else { print "$next$c2\n"; } $next=""; next; } else { print $next; } $next=""; } else { if (m/\"$/) { if (!m/\\n\"$/) { $next=$_; next; } } } print $_; } </script> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-05[media] cx231xx: can't proceed if I2C bus register failsMauro Carvalho Chehab
The driver should not ignore errors while registering the I2C bus, as this device can't even minimally work without the buses, as it uses those buses internally to talk with the several IP blocks inside the chip. Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-05[media] cx231xx-core: fix GPIO commentsMauro Carvalho Chehab
The number of the cx231xx REQ for GPIO register set/get are wrong. They should follow what's there at cx231xx-pcb-cfg.h. Noticed while checking the cx231xx parser at the v4l-utils. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-05[media] cx231xx: prints error code if can't switch TV modeMauro Carvalho Chehab
If something bad happens when switching between digital and analog mode, prints an error and outputs the returned code. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-05[media] cx231xx: fix GPIOs for Pixelview SBTVD hybridMauro Carvalho Chehab
This device uses GPIOs: 28 to switch between analog and digital modes: on digital mode, it should be set to 1. The code that sets it on analog mode is OK, but it misses the logic that sets it on digital mode. Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-24[media] media: usb: cx231xx: cx231xx-core: don't print error when allocating ↵Wolfram Sang
urb fails kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-06[media] cx231xx: reset pipe endpoint when it is stalledTerry Heo
Sometimes, the USB pipe could enter into a stalled state, and may need a reset to rework. Add such logic. [mchehab@osg.samsung.com: ported from Android's source: https://android.googlesource.com/kernel/x86_64/+/3a322adc0084fd277b43070712c7dc0dc9245435%5E%21] Signed-off-by: Terry Heo <terryheo@google.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-05-19Merge branch 'i2c/for-4.7' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c updates from Wolfram Sang: - Peter Rosin did some major rework on the locking of i2c muxes by seperating parent-locked muxes and mux-locked muxes. This avoids deadlocks/workarounds when the mux itself needs i2c commands for muxing. And as a side-effect, other workarounds in the media layer could be eliminated. Also, Peter stepped up as the i2c mux maintainer and will keep an eye on these changes. - major updates to the octeon driver - add a helper to the core to generate the address+rw_bit octal and make drivers use it - quite a bunch of driver updates * 'i2c/for-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (84 commits) i2c: rcar: add DMA support i2c: st: Implement bus clear i2c: only check scl functions when using generic recovery i2c: algo-bit: declare i2c_bit_quirk_no_clk_stretch as static i2c: tegra: disable clock before returning error [media] rtl2832: regmap is aware of lockdep, drop local locking hack [media] rtl2832_sdr: get rid of empty regmap wrappers [media] rtl2832: change the i2c gate to be mux-locked [media] si2168: change the i2c gate to be mux-locked iio: imu: inv_mpu6050: change the i2c gate to be mux-locked i2c: mux: document i2c muxes and elaborate on parent-/mux-locked muxes i2c: mux: relax locking of the top i2c adapter during mux-locked muxing i2c: muxes always lock the parent adapter i2c: allow adapter drivers to override the adapter locking i2c: uniphier: add "\n" at the end of error log i2c: mv64xxx: remove CONFIG_HAVE_CLK conditionals i2c: mv64xxx: use clk_{prepare_enable,disable_unprepare} i2c: mv64xxx: handle probe deferral for the clock i2c: mv64xxx: enable the driver on ARCH_MVEBU i2c: octeon: Add workaround for broken irqs on CN3860 ...
2016-04-25[media] cx231xx: silence uninitialized variable warningDan Carpenter
We print an uninitialized "actlen" variable on the error path. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-04-22[media] cx231xx: convert to use an explicit i2c mux corePeter Rosin
Allocate an explicit i2c mux core to handle parent and child adapters etc. Update the select op to be in terms of the i2c mux core instead of the child adapter. Tested-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2015-11-17[media] cx231xx: fix bulk transfer modeTerry Heo
The current cx231xx driver doesn't work with bulk transfer mode. This patch makes it possible to use bulk transfer mode. Signed-off-by: Terry Heo <terryheo@google.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01[media] cx231xx: fix bad indentingMauro Carvalho Chehab
drivers/media/usb/cx231xx/cx231xx-avcore.c:1598 cx231xx_set_DIF_bandpass() warn: inconsistent indenting drivers/media/usb/cx231xx/cx231xx-core.c:656 cx231xx_demod_reset() warn: inconsistent indenting drivers/media/usb/cx231xx/cx231xx-core.c:659 cx231xx_demod_reset() warn: inconsistent indenting drivers/media/usb/cx231xx/cx231xx-core.c:664 cx231xx_demod_reset() warn: inconsistent indenting drivers/media/usb/cx231xx/cx231xx-core.c:669 cx231xx_demod_reset() warn: inconsistent indenting drivers/media/usb/cx231xx/cx231xx-core.c:673 cx231xx_demod_reset() warn: inconsistent indenting drivers/media/usb/cx231xx/cx231xx-417.c:1164 cx231xx_initialize_codec() warn: inconsistent indenting Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02[media] cx231xx: drop condition with no effectNicholas Mc Guire
The if and the else code are identical - so the condition has no effect on the effective code. This patch removes the condition and the duplicated code. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03[media] cx231xx: Improve the log messageMauro Carvalho Chehab
Unfortunately, on devices that have multiple interfaces, udev->dev points to the parent device (usb) instead of the cx231xx specific one. Due to that the logs don't look too nice, as they'll print messages as if they were produced by USB core: usb-1-2: New device Conexant Corporation Polaris AV Capturb @ 480 Mbps (1554:5010) with 7 interfaces Instead of using the name of the parent device, let's use the name of the first cx231xx interface for all cx231xx sub-modules. With this path, the logs will be nicer: cx231xx 1-2:1.1: New device Conexant Corporation Polaris AV Capturb @ 480 Mbps (1554:5010) with 7 interfaces Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03[media] cx231xx: use dev_info() for extension load/unloadMauro 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 <mchehab@osg.samsung.com>
2014-11-03[media] cx231xx: convert from pr_foo to dev_fooMauro Carvalho Chehab
Replace all pr_foo occurrences by dev_foo, as this is the recommended way for drivers. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03[media] cx231xx: disable I2C errors during i2c_scanMauro 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 <mchehab@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03[media] cx231xx: Cleanup printk at the driverMauro 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 <mchehab@osg.samsung.com>
2014-11-03[media] cx231xx: get rid of driver-defined printk macrosMauro 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 <mchehab@osg.samsung.com>
2014-10-30[media] cx231xx: scan all four existing i2c busses instead of the 3 mastersMatthias Schwarzott
The scanning itself just fails (as before this series) but now the correct busses are scanned. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30[media] cx231xx: drop unconditional port3 switchingMatthias Schwarzott
All switching should be done by i2c mux adapters. Drop explicit dont_use_port_3 flag. Drop info message about switch. Only the removed code in start_streaming is questionable: It did switch the port_3 flag without accessing i2c in between. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30[media] cx231xx: register i2c mux adapters for bus 1Matthias Schwarzott
I2C bus 1 has internally a switch. Use it as I2C_1_MUX_1 and I2C_1_MUX_3, letting the I2C core handling the switch. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-03[media] cx231xx: fix sparse warningsHans Verkuil
drivers/media/usb/cx231xx/cx231xx-avcore.c:2226:15: warning: cast to restricted __le32 drivers/media/usb/cx231xx/cx231xx-avcore.c:2447:15: warning: cast to restricted __le32 drivers/media/usb/cx231xx/cx231xx-avcore.c:2475:15: warning: cast to restricted __le32 drivers/media/usb/cx231xx/cx231xx-avcore.c:2500:15: warning: cast to restricted __le32 drivers/media/usb/cx231xx/cx231xx-avcore.c:2647:18: warning: incorrect type in assignment (different base types) drivers/media/usb/cx231xx/cx231xx-avcore.c:2659:21: warning: cast to restricted __le32 drivers/media/usb/cx231xx/cx231xx-dvb.c:743:57: warning: Using plain integer as NULL pointer drivers/media/usb/cx231xx/cx231xx-dvb.c:776:57: warning: Using plain integer as NULL pointer Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27[media] cx231xx: Add digital support for HVR 930c-HD model 1113xxMatthias Schwarzott
Add support for: [2040:b130] Hauppauge WinTV 930C-HD (model 1113xx) After loading the driver the first open to dvb device node fails. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-03-05[media] cx231xx: fix big-endian problemsHans Verkuil
Tested on my big-endian ppc-based test machine. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-15[media] rename most media/video usb drivers to media/usbMauro Carvalho Chehab
Rename all USB drivers with their own directory under drivers/media/video into drivers/media/usb and update the building system. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>