Commit Graph

262 Commits

Author SHA1 Message Date
Antti Palosaari 08272db62a [media] si2157: change firmware variable name and type
Rename firmware variable from fw_file to fw_name and change its
type from u8 to const char as request_firmware() input is.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:50:28 -02:00
Antti Palosaari 6c3725332d [media] si2157: print chip version
Print chip version once using log level into when init() is called.
Remove cold/warm state printing as those are not very useful.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:50:06 -02:00
Antti Palosaari c7011845ca [media] si2157: print firmware version
Firmware version could be printed similarly than si2168 driver does.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:49:45 -02:00
Antti Palosaari e7f3f9f362 [media] si2157: add own goto label for kfree() on probe error
Use own goto label for error case mem free is needed, even kfree could
be called with NULL. I think it is better to have it, even not required.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:49:25 -02:00
Antti Palosaari c12922338c [media] si2157: trivial ID table changes
- Rename ID table.
- Remove magic numbers from ID table driver data field.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:49:09 -02:00
Antti Palosaari 78dab40a51 [media] si2157: change firmware download error handling
Rename firmare download error path goto label. Remove firmware NULL
set as NULL value is not needed anymore, due to recent change which
started using goto labels for firmware error handling.

Cc: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:48:39 -02:00
Antti Palosaari 8fe51725d8 [media] si2157: carry pointer to client instead of state in tuner_priv
Carry struct i2c_client pointer in tuner_priv. This driver is I2C driver,
which is represented as a struct i2c_client, so better to carry this top
level structure for each routine in order to unify things.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:48:14 -02:00
Antti Palosaari 7cbf5d7651 [media] si2157: simplify si2157_cmd_execute() error path
Remove if () from firmware command error path as there should not be
any error prone conditional logic there. Use goto labels instead.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:47:45 -02:00
Antti Palosaari 70f13ff091 [media] si2157: rename device state variable from 's' to 'dev'
'dev' is likely most common name in kernel for structure containing
device state instance, so rename it in order to keep things
consistent.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:47:21 -02:00
Hans Verkuil 215cedec37 [media] media: remove emacs editor variables
1) This is not allowed by the kernel coding style
2) Just configure your editor correctly
3) It's really ugly

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-22 17:52:20 -02:00
Markus Elfring e358c8a60f [media] si2157: One function call less in si2157_init() after error
The release_firmware() function was called in some cases by the si2157_init()
function during error handling even if the passed variable contained still
a null pointer. This implementation detail could be improved
by the introduction of another jump label.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04 15:28:51 -02:00
Markus Elfring dc89cfcf33 [media] tuners: remove uneeded checks before release_firmware()
The release_firmware() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04 15:28:51 -02:00
Mauro Carvalho Chehab 5836b4c3ec [media] tda18271: Fix identation
As reported by smatch:
	drivers/media/tuners/tda18271-common.c:176 tda18271_read_extended() warn: if statement not indented

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04 13:55:05 -02:00
CrazyCat 17ad09f110 [media] si2157: Si2148 support
Si2148-A20 silicon tuner support.

[Antti: Resolved conflict]

Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 09:14:14 -02:00
Olli Salonen b7fca5b06d [media] si2157: make checkpatch.pl happy (remove break after goto)
Break after goto is unnecessary.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 09:13:35 -02:00
Olli Salonen 073f38494a [media] si2157: Add support for Si2146-A10
The Silicon Labs Si2146 tuner seems to work with the same driver as the Si2157,
but there a few exceptions. The powerup command seems to be quite a bit
different. In addition there's a property 0207 that requires a different value.
Thus another entry is created in the si2157_id table to support also si2146 in
this driver.

The datasheet is available on manufacturer's website:
http://www.silabs.com/support%20documents/technicaldocs/Si2146-short.pdf

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 09:11:54 -02:00
Antti Palosaari b936d16608 [media] r820t: add DVB-C config
Add config values for SYS_DVBC_ANNEX_A.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:28:00 -02:00
Jose Alberto Reguero 02f9cf96df [media] [PATH,2/2] mxl5007 move loop_thru to attach
This patch move the loop_thru configuration to the attach function,
because with dual tuners until loop_tru configuration the other tuner
don't work.

Signed-off-by: Jose Alberto Reguero <jareguero@telefonica.net>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-11 08:38:46 -02:00
Jose Alberto Reguero fe4860af00 [media] [PATH,1/2] mxl5007 move reset to attach
This patch move the soft reset to the attach function because with dual
tuners, when one tuner do reset, the other one is perturbed, and the
stream has errors.

Signed-off-by: Jose Alberto Reguero <jareguero@telefonica.net>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-11 08:38:28 -02:00
nibble.max 333829110f [media] m88rs6000t: add new dvb-s/s2 tuner for integrated chip M88RS6000
M88RS6000 is the integrated chip, which includes tuner and demod.
Here splite its tuner as a standalone driver.
.set_config is used to config its demod clock, which sits inside tuner die.

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 18:23:43 -02:00
Richard Vollkommer 52e269b133 [media] xc5000: add IF output level control
Adds control of the IF output level to the xc5000 tuner
configuration structure.  Increases the IF level to the
demodulator to fix failure to lock and picture breakup
issues (with the au8522 demodulator, in the case of the
Hauppauge HVR950Q).

This patch works with all XC5000 firmware versions.

Signed-off-by: Richard Vollkommer <linux@hauppauge.com>
Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Reviewed-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 12:24:52 -02:00
nibble.max 4954578efb [media] m88ts2022: return the err code in its probe function when error occurs
if "chip_id" is wrong or "dev->cfg.clock_out" is invalid, the i2c model is still loaded.
It will cause "kernel NULL pointer dereference" oops when the i2c model remove.
returning the err code will prevent the i2c model load.

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 11:53:00 -02:00
Olli Salonen 0d1165fcaf [media] si2157: add support for SYS_DVBC_ANNEX_B
Set the property for delivery system also in case of SYS_DVBC_ANNEX_B.
This behaviour is observed in the sniffs taken with Hauppauge HVR-955Q
Windows driver.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-30 09:06:28 -02:00
Dan Carpenter 4961a5323f [media] xc5000: use after free in release()
I moved the call to hybrid_tuner_release_state(priv) after
"priv->firmware" dereference.

Fixes: 5264a522a5 ('[media] media: tuner xc5000 - release firmwware from xc5000_release()')

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-24 09:29:28 -02:00
Mauro Carvalho Chehab 46cebe017a [media] qm1d1c0042: fix compilation on 32 bits
drivers/built-in.o: In function `qm1d1c0042_set_params':
>> qm1d1c0042.c:(.text+0x2519730): undefined reference to `__divdi3'

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-26 06:47:42 -03:00
Akihiro Tsukada 7608f575b8 [media] qm1d1c0042: add driver for Sharp QM1D1C0042 ISDB-S tuner
This patch adds driver for qm1d1c0042 tuner chips.
It is used as an ISDB-S tuner in earthsoft pt3 cards.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 17:04:00 -03:00
Akihiro Tsukada aff0c42a78 [media] mxl301rf: add driver for MaxLinear MxL301RF OFDM tuner
This patch adds driver for mxl301rf OFDM tuner chips.
It is used as an ISDB-T tuner in earthsoft pt3 cards.

Note that this driver does not initilize the chip,
because the initilization sequence / register setting is not disclosed.
Thus, the driver assumes that the chips are initilized externally
by its parent board driver before tuner_ops->init() are called,
like in PT3 driver where the bridge chip contains the init sequence
in its private memory and provides a command to trigger the sequence.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 17:03:59 -03:00
Joe Perches 0f531e7356 [media] tda18271-common: Convert _tda_printk to return void
No caller or macro uses the return value so make it void.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 17:03:59 -03:00
Shuah Khan 27ccd694bb [media] media: tuner xc5000 - try to avoid firmware load in resume path
xc5000 doesn't load firmware at attach time instead loads it
when it needs to set and change configuration from its init,
frequency, digital and analog mode set interffaces. As a result,
when system is suspended before firmware is loaded, firmware
load can be avoided during resume. Loading formware in this
scenario results in slowpath warnings during resume as it won't
be in the suspend firmware cache.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:49 -03:00
Shuah Khan 5264a522a5 [media] media: tuner xc5000 - release firmwware from xc5000_release()
xc5000 releases firmware right after loading it. Change it to
save the firmware and release it from xc5000_release(). This
helps avoid fecthing firmware when forced firmware load requests
come in to change analog tv frequence and when firmware needs to
be reloaded after suspend and resume.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:48 -03:00
Olli Salonen d87a50586d [media] si2157: Add support for Si2147-A30 tuner
This patch adds support for Si2147-A30 tuner. Fairly trivial, no firmware needed for this tuner. However, command 14 00 02 07 01 00 seems to be mandatory. On Si2157 and Si2158 the value 0x0100 is the default value, so this patch does not impact the existing tuners/devices. On Si2147 the default is 0x0000 and I can't get a lock with that value.

While here, fix the return length of the previous set command to 4 bytes.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Acked-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-23 16:13:39 -03:00
Antti Palosaari 3b60b761cb [media] tda18212: convert to RegMap API
Use RegMap API to handle all the boring I2C register access
boilerplate stuff.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 20:06:23 -03:00
Antti Palosaari e4a42e1866 [media] tda18212: rename state from 'priv' to 'dev'
foo_dev seems to be most correct term for the structure holding data
of each device instance. It is most used term in Kernel codebase and also
examples from book Linux Device Drivers, Third Edition, uses it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 20:05:46 -03:00
Antti Palosaari bdb32655f2 [media] tda18212: clean logging
There is no need to print module name nor function name as those
are done by kernel logging system when dev_xxx logging is used and
driver is proper I2C driver.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 20:05:20 -03:00
Antti Palosaari 0e584cc295 [media] tda18212: convert driver to I2C binding
Convert driver from DVB proprietary model to common I2C model.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 20:04:55 -03:00
Antti Palosaari 3ab779c039 [media] tda18212: prepare for I2C client conversion
We need carry pointer to frontend via config struct
(I2C platform_data ptr) when I2C model is used. Add that pointer
first in order to keep build unbreakable during conversion.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 19:57:56 -03:00
Antti Palosaari 5190ff3e3e [media] it913x: replace udelay polling with jiffies
udelay based I/O polling loop is a bad idea, especially system
performance point of view. Kernel jiffies are preferred solution
for such situations. Use it instead.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 18:29:34 -03:00
Antti Palosaari 17027b9620 [media] it913x: refactor code largely
Refactor code largely.

Try to keep order of register read/write same as windows driver does as
it makes comparing sniffs easier.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 18:28:18 -03:00
Antti Palosaari 3d2f18d346 [media] it913x: get rid of script loader and and private header file
Used script loader is quite useless and hides register numbers
making code hard to understand. Get rid of it and use standard
RegMap register write functions directly.

it913x_priv.h file leaves empty after that change and is also
removed.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 18:25:44 -03:00
Antti Palosaari b7413c800f [media] it913x: remove dead code
Remove unused tuner set template.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 18:24:59 -03:00
Antti Palosaari 676c350f97 [media] it913x: re-implement sleep
Re-implement sleep. Based USB sniffs taken from the latest Hauppauge
windows driver version 07/10/2014, 14.6.23.32191.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 18:24:32 -03:00
Antti Palosaari d2dbc00cea [media] it913x: convert to RegMap API
Use RegMap API to cover I2C register access routines.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 18:23:27 -03:00
Antti Palosaari a71b65e8c5 [media] it913x: rename 'state' to 'dev'
foo_dev seems to be most correct term for the structure holding data
of each device instance. It is most used term in Kernel and also
examples from book Linux Device Drivers, Third Edition, uses it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 18:22:17 -03:00
Antti Palosaari 8da55c94dd [media] it913x: change reg read/write routines more common
Change register write and read routines to similar which are
typically used. We have to add processor core as a part of register
address in order to simplify register access. Chip has two cores,
called link and ofdm. As for now, use address bit 24 to address used
core. Bits 15:0 are register address in given core.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 18:17:42 -03:00
Antti Palosaari 3b2a5e8c08 [media] it913x: convert to I2C driver
Change the it913x driver to use the I2C high lever tuner
binding model. As af9035 depends on it, add a code there
to do the binding.

[mchehab@osg.samsung.com: Merge 3 patches into one, because
 we don't want to break bisect due to the conversion]
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 17:48:23 -03:00
Antti Palosaari c2ba9726c3 [media] it913x: rename tuner_it913x => it913x
Remove tuner_ prefix from module name and file names. Prefix was
added due to file name conflict on media out-tree build system.
Demodulator having same name does not exists anymore. So lets
remove dumb prefix.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 17:45:00 -03:00
Antti Palosaari d111324115 [media] it913x: make checkpatch.pl happy
Correct issues reported by checkpatch.pl

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 17:44:12 -03:00
Antti Palosaari 9e0a976ed6 [media] it913x: fix IT9135 AX sleep
Old IT9135 AX needs a little bit different register settings for
sleep than newer IT9135 BX. This has been broken always, as power
management of the whole driver, but it started to be problem as I
fixed clock. Earlier clock was disabled very first on sleep and
rest of the commands were skipped by the chip as no clock, leaving
tuner full power state. When I fixed clocks these PM bugs started
raising out as I/O errors.

Cc: Bimow Chen <Bimow.Chen@ite.com.tw>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 17:24:31 -03:00
Antti Palosaari 66f6319936 [media] it913x: avoid division by zero on error case
Error on init leaves some internal divisor zero, which causes oops
later. Fix it by populating divisors even it fails.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 17:23:45 -03:00
Antti Palosaari f69429447a [media] it913x: fix tuner sleep power leak
IT913x tuner driver disables own clock, provided by demod core, as
very a first operation when tuner is put on *sleep*. That likely
causes failure of all the rest commands on sleep sequence, which
leads situation where tuner is not actually on sleep, but consuming
a lot of power.

I measured 102mA current consumption from the USB before change
and after change it was only 32mA. Used device was single tuner
IT9135 BX.

Second reason to remove that register from tuner driver is reason
it is simply on wrong driver (demod vs. tuner), breaking the
principle of correct driver.

Clock is now provided more correctly af9033 demod driver as a
config option.

Cc: Bimow Chen <Bimow.Chen@ite.com.tw>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 17:22:11 -03:00