summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends/m88ds3103.c
AgeCommit message (Collapse)Author
2015-10-22[media] m88ds3103: use own reg update_bits() implementationAntti Palosaari
Device stopped to tuning some channels after regmap conversion. Reason is that regmap_update_bits() works a bit differently for partially volatile registers than old homemade routine. Return back to old routine in order to fix issue. Fixes: 478932b16052f5ded74685d096ae920cd17d6424 Cc: <stable@kernel.org> # 4.2+ Reported-by: Mark Clarkstone <hello@markclarkstone.co.uk> Tested-by: Mark Clarkstone <hello@markclarkstone.co.uk> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11[media] dvb-frontends: Drop owner assignment from i2c_driverKrzysztof Kozlowski
i2c_driver does not need to set an owner because i2c_register_driver() will set it. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10[media] TS2020: Calculate tuner gain correctlyDavid Howells
The TS2020 and TS2022 tuners take an input from the demodulator indicating the AGC setting on that component that is then used to influence the tuner's own gain. This should be taken into account when calculating the gain and signal strength. Further, the existing TS2020 driver miscalculates the signal strength as the result of its calculations can exceed the storage capacity of the 16-bit word used to return it to userspace. To this end: (1) Add a callback function (->get_agc_pwm()) in the ts2020_config struct that the tuner can call to get the AGC PWM value from the demodulator. (2) Modify the TS2020 driver to calculate the gain according to Montage's specification with the adjustment that we produce a negative value and scale it to 0.001dB units (which is what the DVBv5 API will require): (a) Callback to the demodulator to retrieve the AGC PWM value and then turn that into Vagc for incorporation in the calculations. If the callback is unset, assume a Vagc of 0. (b) Calculate the tuner gain from a combination of Vagc and the tuner's RF gain and baseband gain settings. (3) Turn this into a percentage signal strength as per Montage's specification for return to userspace with the DVBv3 API. (4) Provide a function in the M88DS3103 demodulator driver that can be used to get the AGC PWM value on behalf of the tuner. (5) The ts2020_config.get_agc_pwm function should be set by the code that stitches together the drivers for each card. For the DVBSky cards that use the M88DS3103 with the TS2020 or the TS2022, set the get_agc_pwm function to point to m88ds3103_get_agc_pwm. I have tested this with a DVBSky S952 card which has an M88DS3103 and a TS2022. Thanks to Montage for providing access to information about the workings of these parts. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10[media] m88ds3103: use regmap for I2C register accessAntti Palosaari
Use regmap for I2C register access. Remove own I2C repeated mutex as it should not be needed. I2C adapter lock is already taken when I2C mux adapter is called, no need for double locking. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10[media] m88ds3103: rename variables and correct loggingAntti Palosaari
Rename driver state from priv to dev. Use I2C client for correct logging. Use adapter and address from I2C client structure where needed. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-09[media] dvb: Get rid of typedev usage for enumsMauro Carvalho Chehab
The DVB API was originally defined using typedefs. This is against Kernel CodingStyle, and there's no good usage here. While we can't remove its usage on userspace, we can avoid its usage in Kernelspace. So, let's do it. This patch was generated by this shell script: for j in $(grep typedef include/uapi/linux/dvb/frontend.h |cut -d' ' -f 3); do for i in $(find drivers/media -name '*.[ch]' -type f) $(find drivers/staging/media -name '*.[ch]' -type f); do sed "s,${j}_t,enum $j," <$i >a && mv a $i; done; done While here, make CodingStyle fixes on the affected lines. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de> # for drivers/media/firewire/*
2015-06-09[media] m88ds3103: a couple missing error codesDan Carpenter
We need to set some error codes here. Fixes: f01919e8f54f ('[media] m88ds3103: add I2C client binding') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30[media] m88ds3103: add I2C client bindingAntti Palosaari
Implement I2C client device binding. Wrap media attach to driver I2C probe. Add wrapper from m88ds3103_attach() to m88ds3103_probe() via driver core in order to provide proper I2C client for legacy media attach binding. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30[media] m88ds3103: use jiffies when polling DiSEqC TX readyAntti Palosaari
Use jiffies to set timeout for DiSEqC TX ready polling. Using jiffies is more elegant solution than looping N times with sleep. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30[media] m88ds3103: implement DVBv5 BERAntti Palosaari
Implement DVBv5 BER statistics. Wrap legacy DVBv3 BER to DVBv5 BER. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30[media] m88ds3103: implement DVBv5 CNR statisticsAntti Palosaari
Implement DVBv5 CNR statistics. Wrap legacy DVBv3 SNR to DVBv5 CNR. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30[media] m88ds3103: do not return error from get_frontend() when not readyAntti Palosaari
Do not return error from get_frontend() when status is queried, but the frontend didn't lock yet. The proper behavior is to only update the cache after having a lock. [mchehab@osg.samsung.com: fix the patch description] Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-08[media] si2168: tda10071: m88ds3103: Fix trivial typosYannick Guerrini
Change 'firmare' to 'firmware' Signed-off-by: Yannick Guerrini <yguerrini@tomshardware.fr> Acked-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25[media] m88ds3103: One function call less in m88ds3103_init() after error ↵Markus Elfring
detection GIT_AUTHOR_DATE=1416472158 The release_firmware() function was called in some cases by the m88ds3103_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-11-25[media] DVB-frontends: Deletion of unnecessary checks before the function ↵Markus Elfring
call "release_firmware" GIT_AUTHOR_DATE=1416472432 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-11-11[media] m88ds3103: change ts clock config for serial modenibble.max
1> When m88ds3103 works in serial ts mode, its serial ts clock is equal to ts master clock and the clock divider is bypassed. 2> The serial ts clock is configed by the bridge driver just like parallel ts clock. Signed-off-by: Nibble Max <nibble.max@gmail.com> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03[media] m88ds3103: add support for the demod of M88RS6000nibble.max
M88RS6000 is the integrated chip, which includes tuner and demod. Its internal demod is similar with M88DS3103 except some registers definition. The main different part of this internal demod from others is its clock/pll generation IP block sitting inside the tuner die. So clock/pll functions should be configed through its tuner i2c bus, NOT its demod i2c bus. The demod of M88RS6000 need the firmware: dvb-demod-m88rs6000.fw firmware download link: http://www.dvbsky.net/download/linux/dvbsky-firmware.tar.gz Signed-off-by: Nibble Max <nibble.max@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-03[media] m88ds3103: use true/false for boolean varsMauro Carvalho Chehab
Instead of using 0 or 1 for boolean, use the true/false defines. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02[media] m88ds3103: fix coding style issuesAntti Palosaari
Fix coding style issues pointed out by checkpatch.pl. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02[media] m88ds3103: change .set_voltage() implementationAntti Palosaari
Add some error checking and implement functionality a little bit differently. Cc: Nibble Max <nibble.max@gmail.com> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02[media] m88ds3103: implement set voltage and TS clocknibble.max
Implement set voltage operation. Separate TS clock as a own configuration parameter. Add TS clock polarity parameter. [crope@iki.fi: merge em28xx driver m88ds3103 config change patch to that one, in order to keep build unbroken] Signed-off-by: Nibble Max <nibble.max@gmail.com> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22[media] m88ds3103: implement BERAntti Palosaari
Implement read_ber for BER estimate. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22[media] m88ds3103: fix SNR reporting on 32-bit archAntti Palosaari
There was 32-bit calculation overflow. Use div_u64. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-28[media] m88ds3103: fix bug on .set_tone()Antti Palosaari
Band switching didn't worked always reliably as there was one register bit set wrong. Thanks to Robert Schlabbach for pointing this bug and solution. Reported-by: Robert Schlabbach <Robert.Schlabbach@gmx.net> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-12[media] m88ds3103: possible uninitialized scalar variableAntti Palosaari
It was possible that tuner_frequency variable, used for carrier offset compensation, was uninitialized. That happens when tuner .get_frequency() callback is not defined. Currently that case is not possible as only used tuner has this callback. Coverity CID 1166057: Uninitialized scalar variable (UNINIT) Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-12[media] m88ds3103: remove dead code 2nd partAntti Palosaari
Coverity CID 1166051: Logically dead code (DEADCODE) TS clock calculation could be more accurate, but as it is not, remove those unused clock speeds. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-12[media] m88ds3103: remove dead codeAntti Palosaari
Coverity CID 1166050: Dead default in switch (DEADCODE) Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-12-19[media] m88ds3103: fix some style issues reported by checkpatch.plAntti Palosaari
* remove Free Software Foundation postal address * add one pair of parenthesis * use sizeof(*foo), not sizeof(struct foo) Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-12-19[media] m88ds3103: fix possible i2c deadlockAntti Palosaari
Adapter is locked by I2C core already. Use unlocked i2c_transfer() version __i2c_transfer() to avoid deadlock. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-12-19[media] m88ds3103: I/O optimize inittab writeAntti Palosaari
Write inittab using reg address auto-increment in order to reduce I/O a little bit. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-12-19[media] m88ds3103: fix TS mode configAntti Palosaari
TS mode was configured wrongly. Reported-by: David Howells <dhowells@redhat.com> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-12-19[media] m88ds3103: use kernel macro to round divisionAntti Palosaari
DIV_ROUND_CLOSEST does the job and looks better. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-12-19[media] m88ds3103: use I2C mux for tuner I2C adapterAntti Palosaari
Switch standard I2C adapter to muxed I2C adapter. David reported that I2C adapter implementation caused deadlock. I discussed with Jean and he suggested to implement it as a multiplexed i2c adapter because tuner I2C bus could be seen like own I2C segment. Reported-by: David Howells <dhowells@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-12-19[media] m88ds3103: do not use dynamic stack allocationAntti Palosaari
I2C transfer were using dynamic stack allocation. Get rid of it. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-12-19[media] Montage M88DS3103 DVB-S/S2 demodulator driverAntti Palosaari
DVB-S/S2 satellite television demodulator driver. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>