2019-05-27 14:55:06 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* descriptions + helper functions for simple dvb plls.
|
|
|
|
*
|
|
|
|
* (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
|
|
|
|
*/
|
|
|
|
|
2016-10-14 02:32:32 +08:00
|
|
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
|
|
|
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 16:04:11 +08:00
|
|
|
#include <linux/slab.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/dvb/frontend.h>
|
|
|
|
#include <asm/types.h>
|
|
|
|
|
|
|
|
#include "dvb-pll.h"
|
|
|
|
|
2016-10-14 02:32:32 +08:00
|
|
|
#define dprintk(fmt, arg...) \
|
|
|
|
printk(KERN_DEBUG pr_fmt("%s: " fmt), __func__, ##arg)
|
|
|
|
|
2007-09-08 05:19:57 +08:00
|
|
|
struct dvb_pll_priv {
|
|
|
|
/* pll number */
|
|
|
|
int nr;
|
|
|
|
|
|
|
|
/* i2c details */
|
|
|
|
int pll_i2c_address;
|
|
|
|
struct i2c_adapter *i2c;
|
|
|
|
|
|
|
|
/* the PLL descriptor */
|
2015-07-31 01:08:53 +08:00
|
|
|
const struct dvb_pll_desc *pll_desc;
|
2007-09-08 05:19:57 +08:00
|
|
|
|
|
|
|
/* cached frequency/bandwidth */
|
|
|
|
u32 frequency;
|
|
|
|
u32 bandwidth;
|
|
|
|
};
|
|
|
|
|
2007-09-10 00:00:45 +08:00
|
|
|
#define DVB_PLL_MAX 64
|
2007-09-08 05:19:57 +08:00
|
|
|
|
|
|
|
static unsigned int dvb_pll_devcount;
|
|
|
|
|
2008-04-23 01:41:48 +08:00
|
|
|
static int debug;
|
2007-09-08 05:19:57 +08:00
|
|
|
module_param(debug, int, 0644);
|
|
|
|
MODULE_PARM_DESC(debug, "enable verbose debug messages");
|
|
|
|
|
2007-09-08 05:27:43 +08:00
|
|
|
static unsigned int id[DVB_PLL_MAX] =
|
|
|
|
{ [ 0 ... (DVB_PLL_MAX-1) ] = DVB_PLL_UNDEFINED };
|
|
|
|
module_param_array(id, int, NULL, 0644);
|
|
|
|
MODULE_PARM_DESC(id, "force pll id to use (DEBUG ONLY)");
|
|
|
|
|
2007-09-08 05:19:57 +08:00
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
struct dvb_pll_desc {
|
2015-07-31 01:08:53 +08:00
|
|
|
const char *name;
|
2007-06-13 03:10:51 +08:00
|
|
|
u32 min;
|
|
|
|
u32 max;
|
|
|
|
u32 iffreq;
|
2011-12-21 22:16:39 +08:00
|
|
|
void (*set)(struct dvb_frontend *fe, u8 *buf);
|
2007-06-13 03:10:51 +08:00
|
|
|
u8 *initdata;
|
2011-02-06 23:29:51 +08:00
|
|
|
u8 *initdata2;
|
2007-06-13 03:10:51 +08:00
|
|
|
u8 *sleepdata;
|
|
|
|
int count;
|
|
|
|
struct {
|
|
|
|
u32 limit;
|
|
|
|
u32 stepsize;
|
|
|
|
u8 config;
|
|
|
|
u8 cb;
|
2015-07-31 01:08:53 +08:00
|
|
|
} entries[];
|
2007-06-13 03:10:51 +08:00
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* descriptions */
|
|
|
|
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_thomson_dtt7579 = {
|
2005-04-17 06:20:36 +08:00
|
|
|
.name = "Thomson dtt7579",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 177 * MHz,
|
|
|
|
.max = 858 * MHz,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36166667,
|
2007-03-19 13:24:09 +08:00
|
|
|
.sleepdata = (u8[]){ 2, 0xb4, 0x03 },
|
|
|
|
.count = 4,
|
2005-04-17 06:20:36 +08:00
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 443250000, 166667, 0xb4, 0x02 },
|
|
|
|
{ 542000000, 166667, 0xb4, 0x08 },
|
|
|
|
{ 771000000, 166667, 0xbc, 0x08 },
|
|
|
|
{ 999999999, 166667, 0xf4, 0x08 },
|
2005-04-17 06:20:36 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2011-12-21 22:16:39 +08:00
|
|
|
static void thomson_dtt759x_bw(struct dvb_frontend *fe, u8 *buf)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2011-12-21 22:16:39 +08:00
|
|
|
u32 bw = fe->dtv_property_cache.bandwidth_hz;
|
|
|
|
if (bw == 7000000)
|
2005-04-17 06:20:36 +08:00
|
|
|
buf[3] |= 0x10;
|
|
|
|
}
|
|
|
|
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_thomson_dtt759x = {
|
2005-04-17 06:20:36 +08:00
|
|
|
.name = "Thomson dtt759x",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 177 * MHz,
|
|
|
|
.max = 896 * MHz,
|
2007-05-05 23:05:39 +08:00
|
|
|
.set = thomson_dtt759x_bw,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36166667,
|
2007-03-19 13:24:09 +08:00
|
|
|
.sleepdata = (u8[]){ 2, 0x84, 0x03 },
|
|
|
|
.count = 5,
|
2005-04-17 06:20:36 +08:00
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 264000000, 166667, 0xb4, 0x02 },
|
|
|
|
{ 470000000, 166667, 0xbc, 0x02 },
|
|
|
|
{ 735000000, 166667, 0xbc, 0x08 },
|
|
|
|
{ 835000000, 166667, 0xf4, 0x08 },
|
|
|
|
{ 999999999, 166667, 0xfc, 0x08 },
|
2005-04-17 06:20:36 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2012-08-01 02:31:20 +08:00
|
|
|
static void thomson_dtt7520x_bw(struct dvb_frontend *fe, u8 *buf)
|
|
|
|
{
|
|
|
|
u32 bw = fe->dtv_property_cache.bandwidth_hz;
|
|
|
|
if (bw == 8000000)
|
|
|
|
buf[3] ^= 0x10;
|
|
|
|
}
|
|
|
|
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_thomson_dtt7520x = {
|
2012-08-01 02:31:20 +08:00
|
|
|
.name = "Thomson dtt7520x",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 185 * MHz,
|
|
|
|
.max = 900 * MHz,
|
2012-08-01 02:31:20 +08:00
|
|
|
.set = thomson_dtt7520x_bw,
|
|
|
|
.iffreq = 36166667,
|
|
|
|
.count = 7,
|
|
|
|
.entries = {
|
|
|
|
{ 305000000, 166667, 0xb4, 0x12 },
|
|
|
|
{ 405000000, 166667, 0xbc, 0x12 },
|
|
|
|
{ 445000000, 166667, 0xbc, 0x12 },
|
|
|
|
{ 465000000, 166667, 0xf4, 0x18 },
|
|
|
|
{ 735000000, 166667, 0xfc, 0x18 },
|
|
|
|
{ 835000000, 166667, 0xbc, 0x18 },
|
|
|
|
{ 999999999, 166667, 0xfc, 0x18 },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_lg_z201 = {
|
2005-04-17 06:20:36 +08:00
|
|
|
.name = "LG z201",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 174 * MHz,
|
|
|
|
.max = 862 * MHz,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36166667,
|
2007-03-19 13:24:09 +08:00
|
|
|
.sleepdata = (u8[]){ 2, 0xbc, 0x03 },
|
|
|
|
.count = 5,
|
2005-04-17 06:20:36 +08:00
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 157500000, 166667, 0xbc, 0x01 },
|
|
|
|
{ 443250000, 166667, 0xbc, 0x02 },
|
|
|
|
{ 542000000, 166667, 0xbc, 0x04 },
|
|
|
|
{ 830000000, 166667, 0xf4, 0x04 },
|
|
|
|
{ 999999999, 166667, 0xfc, 0x04 },
|
2005-04-17 06:20:36 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_unknown_1 = {
|
2005-04-17 06:20:36 +08:00
|
|
|
.name = "unknown 1", /* used by dntv live dvb-t */
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 174 * MHz,
|
|
|
|
.max = 862 * MHz,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36166667,
|
2005-04-17 06:20:36 +08:00
|
|
|
.count = 9,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 150000000, 166667, 0xb4, 0x01 },
|
|
|
|
{ 173000000, 166667, 0xbc, 0x01 },
|
|
|
|
{ 250000000, 166667, 0xb4, 0x02 },
|
|
|
|
{ 400000000, 166667, 0xbc, 0x02 },
|
|
|
|
{ 420000000, 166667, 0xf4, 0x02 },
|
|
|
|
{ 470000000, 166667, 0xfc, 0x02 },
|
|
|
|
{ 600000000, 166667, 0xbc, 0x08 },
|
|
|
|
{ 730000000, 166667, 0xf4, 0x08 },
|
|
|
|
{ 999999999, 166667, 0xfc, 0x08 },
|
2005-04-17 06:20:36 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2005-06-24 13:02:35 +08:00
|
|
|
/* Infineon TUA6010XS
|
|
|
|
* used in Thomson Cable Tuner
|
|
|
|
*/
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_tua6010xs = {
|
2005-06-24 13:02:35 +08:00
|
|
|
.name = "Infineon TUA6010XS",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 44250 * kHz,
|
|
|
|
.max = 858 * MHz,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36125000,
|
2005-06-24 13:02:35 +08:00
|
|
|
.count = 3,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 115750000, 62500, 0x8e, 0x03 },
|
|
|
|
{ 403250000, 62500, 0x8e, 0x06 },
|
|
|
|
{ 999999999, 62500, 0x8e, 0x85 },
|
2005-06-24 13:02:35 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Panasonic env57h1xd5 (some Philips PLL ?) */
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_env57h1xd5 = {
|
2005-06-24 13:02:35 +08:00
|
|
|
.name = "Panasonic ENV57H1XD5",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 44250 * kHz,
|
|
|
|
.max = 858 * MHz,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36125000,
|
2005-06-24 13:02:35 +08:00
|
|
|
.count = 4,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 153000000, 166667, 0xc2, 0x41 },
|
|
|
|
{ 470000000, 166667, 0xc2, 0x42 },
|
|
|
|
{ 526000000, 166667, 0xc2, 0x84 },
|
|
|
|
{ 999999999, 166667, 0xc2, 0xa4 },
|
2005-06-24 13:02:35 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Philips TDA6650/TDA6651
|
|
|
|
* used in Panasonic ENV77H11D5
|
|
|
|
*/
|
2011-12-21 22:16:39 +08:00
|
|
|
static void tda665x_bw(struct dvb_frontend *fe, u8 *buf)
|
2005-06-24 13:02:35 +08:00
|
|
|
{
|
2011-12-21 22:16:39 +08:00
|
|
|
u32 bw = fe->dtv_property_cache.bandwidth_hz;
|
|
|
|
if (bw == 8000000)
|
2005-06-24 13:02:35 +08:00
|
|
|
buf[3] |= 0x08;
|
|
|
|
}
|
|
|
|
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_tda665x = {
|
2005-06-24 13:02:35 +08:00
|
|
|
.name = "Philips TDA6650/TDA6651",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 44250 * kHz,
|
|
|
|
.max = 858 * MHz,
|
2007-05-05 23:05:39 +08:00
|
|
|
.set = tda665x_bw,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36166667,
|
2007-05-10 02:58:17 +08:00
|
|
|
.initdata = (u8[]){ 4, 0x0b, 0xf5, 0x85, 0xab },
|
2005-06-24 13:02:35 +08:00
|
|
|
.count = 12,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 93834000, 166667, 0xca, 0x61 /* 011 0 0 0 01 */ },
|
|
|
|
{ 123834000, 166667, 0xca, 0xa1 /* 101 0 0 0 01 */ },
|
|
|
|
{ 161000000, 166667, 0xca, 0xa1 /* 101 0 0 0 01 */ },
|
|
|
|
{ 163834000, 166667, 0xca, 0xc2 /* 110 0 0 0 10 */ },
|
|
|
|
{ 253834000, 166667, 0xca, 0x62 /* 011 0 0 0 10 */ },
|
|
|
|
{ 383834000, 166667, 0xca, 0xa2 /* 101 0 0 0 10 */ },
|
|
|
|
{ 443834000, 166667, 0xca, 0xc2 /* 110 0 0 0 10 */ },
|
|
|
|
{ 444000000, 166667, 0xca, 0xc4 /* 110 0 0 1 00 */ },
|
|
|
|
{ 583834000, 166667, 0xca, 0x64 /* 011 0 0 1 00 */ },
|
|
|
|
{ 793834000, 166667, 0xca, 0xa4 /* 101 0 0 1 00 */ },
|
|
|
|
{ 444834000, 166667, 0xca, 0xc4 /* 110 0 0 1 00 */ },
|
|
|
|
{ 861000000, 166667, 0xca, 0xe4 /* 111 0 0 1 00 */ },
|
2005-06-24 13:02:35 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Infineon TUA6034
|
|
|
|
* used in LG TDTP E102P
|
|
|
|
*/
|
2011-12-21 22:16:39 +08:00
|
|
|
static void tua6034_bw(struct dvb_frontend *fe, u8 *buf)
|
2005-06-24 13:02:35 +08:00
|
|
|
{
|
2011-12-21 22:16:39 +08:00
|
|
|
u32 bw = fe->dtv_property_cache.bandwidth_hz;
|
|
|
|
if (bw == 7000000)
|
2005-06-24 13:02:35 +08:00
|
|
|
buf[3] |= 0x08;
|
|
|
|
}
|
|
|
|
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_tua6034 = {
|
2005-06-24 13:02:35 +08:00
|
|
|
.name = "Infineon TUA6034",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 44250 * kHz,
|
|
|
|
.max = 858 * MHz,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36166667,
|
2005-06-24 13:02:35 +08:00
|
|
|
.count = 3,
|
2007-05-05 23:05:39 +08:00
|
|
|
.set = tua6034_bw,
|
2005-06-24 13:02:35 +08:00
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 174500000, 62500, 0xce, 0x01 },
|
|
|
|
{ 230000000, 62500, 0xce, 0x02 },
|
|
|
|
{ 999999999, 62500, 0xce, 0x04 },
|
2005-06-24 13:02:35 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2005-07-08 08:58:12 +08:00
|
|
|
/* ALPS TDED4
|
|
|
|
* used in Nebula-Cards and USB boxes
|
|
|
|
*/
|
2011-12-21 22:16:39 +08:00
|
|
|
static void tded4_bw(struct dvb_frontend *fe, u8 *buf)
|
2005-07-08 08:58:12 +08:00
|
|
|
{
|
2011-12-21 22:16:39 +08:00
|
|
|
u32 bw = fe->dtv_property_cache.bandwidth_hz;
|
|
|
|
if (bw == 8000000)
|
2005-07-08 08:58:12 +08:00
|
|
|
buf[3] |= 0x04;
|
|
|
|
}
|
|
|
|
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_tded4 = {
|
2005-07-08 08:58:12 +08:00
|
|
|
.name = "ALPS TDED4",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 47 * MHz,
|
|
|
|
.max = 863 * MHz,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 36166667,
|
2007-05-05 23:05:39 +08:00
|
|
|
.set = tded4_bw,
|
2005-07-08 08:58:12 +08:00
|
|
|
.count = 4,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 153000000, 166667, 0x85, 0x01 },
|
|
|
|
{ 470000000, 166667, 0x85, 0x02 },
|
|
|
|
{ 823000000, 166667, 0x85, 0x08 },
|
|
|
|
{ 999999999, 166667, 0x85, 0x88 },
|
2005-07-08 08:58:12 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2005-11-09 13:35:39 +08:00
|
|
|
/* ALPS TDHU2
|
|
|
|
* used in AverTVHD MCE A180
|
|
|
|
*/
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_tdhu2 = {
|
2005-11-09 13:35:39 +08:00
|
|
|
.name = "ALPS TDHU2",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 54 * MHz,
|
|
|
|
.max = 864 * MHz,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 44000000,
|
2005-11-09 13:35:39 +08:00
|
|
|
.count = 4,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 162000000, 62500, 0x85, 0x01 },
|
|
|
|
{ 426000000, 62500, 0x85, 0x02 },
|
|
|
|
{ 782000000, 62500, 0x85, 0x08 },
|
|
|
|
{ 999999999, 62500, 0x85, 0x88 },
|
2005-11-09 13:35:39 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2006-01-24 03:11:06 +08:00
|
|
|
/* Samsung TBMV30111IN / TBMV30712IN1
|
2005-11-09 13:35:39 +08:00
|
|
|
* used in Air2PC ATSC - 2nd generation (nxt2002)
|
|
|
|
*/
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_samsung_tbmv = {
|
2006-01-24 03:11:07 +08:00
|
|
|
.name = "Samsung TBMV30111IN / TBMV30712IN1",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 54 * MHz,
|
|
|
|
.max = 860 * MHz,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 44000000,
|
2006-01-16 05:04:04 +08:00
|
|
|
.count = 6,
|
2005-11-09 13:35:39 +08:00
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 172000000, 166667, 0xb4, 0x01 },
|
|
|
|
{ 214000000, 166667, 0xb4, 0x02 },
|
|
|
|
{ 467000000, 166667, 0xbc, 0x02 },
|
|
|
|
{ 721000000, 166667, 0xbc, 0x08 },
|
|
|
|
{ 841000000, 166667, 0xf4, 0x08 },
|
|
|
|
{ 999999999, 166667, 0xfc, 0x02 },
|
2005-11-09 13:35:39 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2006-01-12 09:31:53 +08:00
|
|
|
/*
|
|
|
|
* Philips SD1878 Tuner.
|
|
|
|
*/
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261 = {
|
2006-01-12 09:31:53 +08:00
|
|
|
.name = "Philips SD1878",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 950 * MHz,
|
|
|
|
.max = 2150 * MHz,
|
2007-03-19 13:24:04 +08:00
|
|
|
.iffreq= 249, /* zero-IF, offset 249 is to round up */
|
2006-01-12 09:31:53 +08:00
|
|
|
.count = 4,
|
|
|
|
.entries = {
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 1250000, 500, 0xc4, 0x00},
|
2007-07-03 20:58:57 +08:00
|
|
|
{ 1450000, 500, 0xc4, 0x40},
|
2007-03-19 13:24:04 +08:00
|
|
|
{ 2050000, 500, 0xc4, 0x80},
|
|
|
|
{ 2150000, 500, 0xc4, 0xc0},
|
2006-01-12 09:31:53 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2011-12-21 22:16:39 +08:00
|
|
|
static void opera1_bw(struct dvb_frontend *fe, u8 *buf)
|
2007-04-19 22:26:47 +08:00
|
|
|
{
|
2011-12-21 22:16:39 +08:00
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
2011-02-06 23:29:51 +08:00
|
|
|
struct dvb_pll_priv *priv = fe->tuner_priv;
|
2011-12-21 22:16:39 +08:00
|
|
|
u32 b_w = (c->symbol_rate * 27) / 32000;
|
2011-02-06 23:29:51 +08:00
|
|
|
struct i2c_msg msg = {
|
|
|
|
.addr = priv->pll_i2c_address,
|
|
|
|
.flags = 0,
|
|
|
|
.buf = buf,
|
|
|
|
.len = 4
|
|
|
|
};
|
|
|
|
int result;
|
|
|
|
u8 lpf;
|
|
|
|
|
|
|
|
if (fe->ops.i2c_gate_ctrl)
|
|
|
|
fe->ops.i2c_gate_ctrl(fe, 1);
|
|
|
|
|
|
|
|
result = i2c_transfer(priv->i2c, &msg, 1);
|
|
|
|
if (result != 1)
|
2016-10-14 02:32:32 +08:00
|
|
|
pr_err("%s: i2c_transfer failed:%d",
|
2011-02-06 23:29:51 +08:00
|
|
|
__func__, result);
|
|
|
|
|
|
|
|
if (b_w <= 10000)
|
|
|
|
lpf = 0xc;
|
|
|
|
else if (b_w <= 12000)
|
|
|
|
lpf = 0x2;
|
|
|
|
else if (b_w <= 14000)
|
|
|
|
lpf = 0xa;
|
|
|
|
else if (b_w <= 16000)
|
|
|
|
lpf = 0x6;
|
|
|
|
else if (b_w <= 18000)
|
|
|
|
lpf = 0xe;
|
|
|
|
else if (b_w <= 20000)
|
|
|
|
lpf = 0x1;
|
|
|
|
else if (b_w <= 22000)
|
|
|
|
lpf = 0x9;
|
|
|
|
else if (b_w <= 24000)
|
|
|
|
lpf = 0x5;
|
|
|
|
else if (b_w <= 26000)
|
|
|
|
lpf = 0xd;
|
|
|
|
else if (b_w <= 28000)
|
|
|
|
lpf = 0x3;
|
|
|
|
else
|
|
|
|
lpf = 0xb;
|
|
|
|
buf[2] ^= 0x1c; /* Flip bits 3-5 */
|
|
|
|
/* Set lpf */
|
|
|
|
buf[2] |= ((lpf >> 2) & 0x3) << 3;
|
|
|
|
buf[3] |= (lpf & 0x3) << 2;
|
|
|
|
|
|
|
|
return;
|
2007-04-19 22:26:47 +08:00
|
|
|
}
|
|
|
|
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_opera1 = {
|
2007-04-19 22:26:47 +08:00
|
|
|
.name = "Opera Tuner",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 900 * MHz,
|
|
|
|
.max = 2250 * MHz,
|
2011-02-06 23:29:51 +08:00
|
|
|
.initdata = (u8[]){ 4, 0x08, 0xe5, 0xe1, 0x00 },
|
|
|
|
.initdata2 = (u8[]){ 4, 0x08, 0xe5, 0xe5, 0x00 },
|
2007-04-19 22:26:47 +08:00
|
|
|
.iffreq= 0,
|
2007-05-05 23:05:39 +08:00
|
|
|
.set = opera1_bw,
|
2007-04-19 22:26:47 +08:00
|
|
|
.count = 8,
|
|
|
|
.entries = {
|
2011-02-06 23:29:51 +08:00
|
|
|
{ 1064000, 500, 0xf9, 0xc2 },
|
|
|
|
{ 1169000, 500, 0xf9, 0xe2 },
|
|
|
|
{ 1299000, 500, 0xf9, 0x20 },
|
|
|
|
{ 1444000, 500, 0xf9, 0x40 },
|
|
|
|
{ 1606000, 500, 0xf9, 0x60 },
|
|
|
|
{ 1777000, 500, 0xf9, 0x80 },
|
|
|
|
{ 1941000, 500, 0xf9, 0xa0 },
|
|
|
|
{ 2250000, 500, 0xf9, 0xc0 },
|
2007-04-19 22:26:47 +08:00
|
|
|
}
|
|
|
|
};
|
2007-06-13 03:10:51 +08:00
|
|
|
|
2011-12-21 22:16:39 +08:00
|
|
|
static void samsung_dtos403ih102a_set(struct dvb_frontend *fe, u8 *buf)
|
2008-05-18 10:02:00 +08:00
|
|
|
{
|
|
|
|
struct dvb_pll_priv *priv = fe->tuner_priv;
|
|
|
|
struct i2c_msg msg = {
|
|
|
|
.addr = priv->pll_i2c_address,
|
|
|
|
.flags = 0,
|
|
|
|
.buf = buf,
|
|
|
|
.len = 4
|
|
|
|
};
|
|
|
|
int result;
|
|
|
|
|
|
|
|
if (fe->ops.i2c_gate_ctrl)
|
|
|
|
fe->ops.i2c_gate_ctrl(fe, 1);
|
|
|
|
|
|
|
|
result = i2c_transfer(priv->i2c, &msg, 1);
|
|
|
|
if (result != 1)
|
2016-10-14 02:32:32 +08:00
|
|
|
pr_err("%s: i2c_transfer failed:%d",
|
2008-05-18 10:02:00 +08:00
|
|
|
__func__, result);
|
|
|
|
|
|
|
|
buf[2] = 0x9e;
|
|
|
|
buf[3] = 0x90;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* unknown pll used in Samsung DTOS403IH102A DVB-C tuner */
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_samsung_dtos403ih102a = {
|
2008-05-18 10:02:00 +08:00
|
|
|
.name = "Samsung DTOS403IH102A",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 44250 * kHz,
|
|
|
|
.max = 858 * MHz,
|
2008-05-18 10:02:00 +08:00
|
|
|
.iffreq = 36125000,
|
|
|
|
.count = 8,
|
|
|
|
.set = samsung_dtos403ih102a_set,
|
|
|
|
.entries = {
|
|
|
|
{ 135000000, 62500, 0xbe, 0x01 },
|
|
|
|
{ 177000000, 62500, 0xf6, 0x01 },
|
|
|
|
{ 370000000, 62500, 0xbe, 0x02 },
|
|
|
|
{ 450000000, 62500, 0xf6, 0x02 },
|
|
|
|
{ 466000000, 62500, 0xfe, 0x02 },
|
|
|
|
{ 538000000, 62500, 0xbe, 0x08 },
|
|
|
|
{ 826000000, 62500, 0xf6, 0x08 },
|
|
|
|
{ 999999999, 62500, 0xfe, 0x08 },
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-06-12 06:21:34 +08:00
|
|
|
/* Samsung TDTC9251DH0 DVB-T NIM, as used on AirStar 2 */
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_samsung_tdtc9251dh0 = {
|
2009-06-12 06:21:34 +08:00
|
|
|
.name = "Samsung TDTC9251DH0",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 48 * MHz,
|
|
|
|
.max = 863 * MHz,
|
2009-06-12 06:21:34 +08:00
|
|
|
.iffreq = 36166667,
|
|
|
|
.count = 3,
|
|
|
|
.entries = {
|
|
|
|
{ 157500000, 166667, 0xcc, 0x09 },
|
|
|
|
{ 443000000, 166667, 0xcc, 0x0a },
|
|
|
|
{ 863000000, 166667, 0xcc, 0x08 },
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-06-12 06:21:34 +08:00
|
|
|
/* Samsung TBDU18132 DVB-S NIM with TSA5059 PLL, used in SkyStar2 DVB-S 2.3 */
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_samsung_tbdu18132 = {
|
2009-06-12 06:21:34 +08:00
|
|
|
.name = "Samsung TBDU18132",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 950 * MHz,
|
|
|
|
.max = 2150 * MHz, /* guesses */
|
2009-06-12 06:21:34 +08:00
|
|
|
.iffreq = 0,
|
|
|
|
.count = 2,
|
|
|
|
.entries = {
|
|
|
|
{ 1550000, 125, 0x84, 0x82 },
|
|
|
|
{ 4095937, 125, 0x84, 0x80 },
|
|
|
|
}
|
|
|
|
/* TSA5059 PLL has a 17 bit divisor rather than the 15 bits supported
|
|
|
|
* by this driver. The two extra bits are 0x60 in the third byte. 15
|
|
|
|
* bits is enough for over 4 GHz, which is enough to cover the range
|
|
|
|
* of this tuner. We could use the additional divisor bits by adding
|
|
|
|
* more entries, e.g.
|
|
|
|
{ 0x0ffff * 125 + 125/2, 125, 0x84 | 0x20, },
|
|
|
|
{ 0x17fff * 125 + 125/2, 125, 0x84 | 0x40, },
|
|
|
|
{ 0x1ffff * 125 + 125/2, 125, 0x84 | 0x60, }, */
|
|
|
|
};
|
|
|
|
|
2009-06-12 06:21:34 +08:00
|
|
|
/* Samsung TBMU24112 DVB-S NIM with SL1935 zero-IF tuner */
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_samsung_tbmu24112 = {
|
2009-06-12 06:21:34 +08:00
|
|
|
.name = "Samsung TBMU24112",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 950 * MHz,
|
|
|
|
.max = 2150 * MHz, /* guesses */
|
2009-06-12 06:21:34 +08:00
|
|
|
.iffreq = 0,
|
|
|
|
.count = 2,
|
|
|
|
.entries = {
|
|
|
|
{ 1500000, 125, 0x84, 0x18 },
|
|
|
|
{ 9999999, 125, 0x84, 0x08 },
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-06-12 06:24:00 +08:00
|
|
|
/* Alps TDEE4 DVB-C NIM, used on Cablestar 2 */
|
|
|
|
/* byte 4 : 1 * * AGD R3 R2 R1 R0
|
|
|
|
* byte 5 : C1 * RE RTS BS4 BS3 BS2 BS1
|
|
|
|
* AGD = 1, R3 R2 R1 R0 = 0 1 0 1 => byte 4 = 1**10101 = 0x95
|
|
|
|
* Range(MHz) C1 * RE RTS BS4 BS3 BS2 BS1 Byte 5
|
|
|
|
* 47 - 153 0 * 0 0 0 0 0 1 0x01
|
|
|
|
* 153 - 430 0 * 0 0 0 0 1 0 0x02
|
|
|
|
* 430 - 822 0 * 0 0 1 0 0 0 0x08
|
|
|
|
* 822 - 862 1 * 0 0 1 0 0 0 0x88 */
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc dvb_pll_alps_tdee4 = {
|
2009-06-12 06:24:00 +08:00
|
|
|
.name = "ALPS TDEE4",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 47 * MHz,
|
|
|
|
.max = 862 * MHz,
|
2009-06-12 06:24:00 +08:00
|
|
|
.iffreq = 36125000,
|
|
|
|
.count = 4,
|
|
|
|
.entries = {
|
|
|
|
{ 153000000, 62500, 0x95, 0x01 },
|
|
|
|
{ 430000000, 62500, 0x95, 0x02 },
|
|
|
|
{ 822000000, 62500, 0x95, 0x08 },
|
|
|
|
{ 999999999, 62500, 0x95, 0x88 },
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-04-09 01:21:35 +08:00
|
|
|
/* Infineon TUA6034 ISDB-T, used in Friio */
|
|
|
|
/* CP cur. 50uA, AGC takeover: 103dBuV, PORT3 on */
|
|
|
|
static const struct dvb_pll_desc dvb_pll_tua6034_friio = {
|
|
|
|
.name = "Infineon TUA6034 ISDB-T (Friio)",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 90 * MHz,
|
|
|
|
.max = 770 * MHz,
|
2018-04-09 01:21:35 +08:00
|
|
|
.iffreq = 57000000,
|
|
|
|
.initdata = (u8[]){ 4, 0x9a, 0x50, 0xb2, 0x08 },
|
|
|
|
.sleepdata = (u8[]){ 4, 0x9a, 0x70, 0xb3, 0x0b },
|
|
|
|
.count = 3,
|
|
|
|
.entries = {
|
|
|
|
{ 170000000, 142857, 0xba, 0x09 },
|
|
|
|
{ 470000000, 142857, 0xba, 0x0a },
|
|
|
|
{ 770000000, 142857, 0xb2, 0x08 },
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-04-09 01:39:49 +08:00
|
|
|
/* Philips TDA6651 ISDB-T, used in Earthsoft PT1 */
|
|
|
|
static const struct dvb_pll_desc dvb_pll_tda665x_earth_pt1 = {
|
|
|
|
.name = "Philips TDA6651 ISDB-T (EarthSoft PT1)",
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
.min = 90 * MHz,
|
|
|
|
.max = 770 * MHz,
|
2018-04-09 01:39:49 +08:00
|
|
|
.iffreq = 57000000,
|
|
|
|
.initdata = (u8[]){ 5, 0x0e, 0x7f, 0xc1, 0x80, 0x80 },
|
|
|
|
.count = 10,
|
|
|
|
.entries = {
|
|
|
|
{ 140000000, 142857, 0xc1, 0x81 },
|
|
|
|
{ 170000000, 142857, 0xc1, 0xa1 },
|
|
|
|
{ 220000000, 142857, 0xc1, 0x62 },
|
|
|
|
{ 330000000, 142857, 0xc1, 0xa2 },
|
|
|
|
{ 402000000, 142857, 0xc1, 0xe2 },
|
|
|
|
{ 450000000, 142857, 0xc1, 0x64 },
|
|
|
|
{ 550000000, 142857, 0xc1, 0x84 },
|
|
|
|
{ 600000000, 142857, 0xc1, 0xa4 },
|
|
|
|
{ 700000000, 142857, 0xc1, 0xc4 },
|
|
|
|
{ 770000000, 142857, 0xc1, 0xe4 },
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
|
2015-07-31 01:08:53 +08:00
|
|
|
static const struct dvb_pll_desc *pll_list[] = {
|
2007-06-13 03:10:51 +08:00
|
|
|
[DVB_PLL_UNDEFINED] = NULL,
|
|
|
|
[DVB_PLL_THOMSON_DTT7579] = &dvb_pll_thomson_dtt7579,
|
|
|
|
[DVB_PLL_THOMSON_DTT759X] = &dvb_pll_thomson_dtt759x,
|
2012-08-01 02:31:20 +08:00
|
|
|
[DVB_PLL_THOMSON_DTT7520X] = &dvb_pll_thomson_dtt7520x,
|
2007-06-13 03:10:51 +08:00
|
|
|
[DVB_PLL_LG_Z201] = &dvb_pll_lg_z201,
|
|
|
|
[DVB_PLL_UNKNOWN_1] = &dvb_pll_unknown_1,
|
|
|
|
[DVB_PLL_TUA6010XS] = &dvb_pll_tua6010xs,
|
|
|
|
[DVB_PLL_ENV57H1XD5] = &dvb_pll_env57h1xd5,
|
|
|
|
[DVB_PLL_TUA6034] = &dvb_pll_tua6034,
|
|
|
|
[DVB_PLL_TDA665X] = &dvb_pll_tda665x,
|
|
|
|
[DVB_PLL_TDED4] = &dvb_pll_tded4,
|
2009-06-12 06:24:00 +08:00
|
|
|
[DVB_PLL_TDEE4] = &dvb_pll_alps_tdee4,
|
2007-06-13 03:10:51 +08:00
|
|
|
[DVB_PLL_TDHU2] = &dvb_pll_tdhu2,
|
|
|
|
[DVB_PLL_SAMSUNG_TBMV] = &dvb_pll_samsung_tbmv,
|
|
|
|
[DVB_PLL_PHILIPS_SD1878_TDA8261] = &dvb_pll_philips_sd1878_tda8261,
|
|
|
|
[DVB_PLL_OPERA1] = &dvb_pll_opera1,
|
2008-05-18 10:02:00 +08:00
|
|
|
[DVB_PLL_SAMSUNG_DTOS403IH102A] = &dvb_pll_samsung_dtos403ih102a,
|
2009-06-12 06:21:34 +08:00
|
|
|
[DVB_PLL_SAMSUNG_TDTC9251DH0] = &dvb_pll_samsung_tdtc9251dh0,
|
2009-06-12 06:21:34 +08:00
|
|
|
[DVB_PLL_SAMSUNG_TBDU18132] = &dvb_pll_samsung_tbdu18132,
|
2009-06-12 06:21:34 +08:00
|
|
|
[DVB_PLL_SAMSUNG_TBMU24112] = &dvb_pll_samsung_tbmu24112,
|
2018-04-09 01:21:35 +08:00
|
|
|
[DVB_PLL_TUA6034_FRIIO] = &dvb_pll_tua6034_friio,
|
2018-04-09 01:39:49 +08:00
|
|
|
[DVB_PLL_TDA665X_EARTH_PT1] = &dvb_pll_tda665x_earth_pt1,
|
2007-06-13 03:10:51 +08:00
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* ----------------------------------------------------------- */
|
|
|
|
/* code */
|
|
|
|
|
2007-09-08 05:03:58 +08:00
|
|
|
static int dvb_pll_configure(struct dvb_frontend *fe, u8 *buf,
|
2011-12-21 22:16:39 +08:00
|
|
|
const u32 frequency)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2007-09-08 05:03:58 +08:00
|
|
|
struct dvb_pll_priv *priv = fe->tuner_priv;
|
2015-07-31 01:08:53 +08:00
|
|
|
const struct dvb_pll_desc *desc = priv->pll_desc;
|
2005-04-17 06:20:36 +08:00
|
|
|
u32 div;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < desc->count; i++) {
|
2011-12-21 22:16:39 +08:00
|
|
|
if (frequency > desc->entries[i].limit)
|
2005-04-17 06:20:36 +08:00
|
|
|
continue;
|
|
|
|
break;
|
|
|
|
}
|
2007-05-05 23:05:39 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
if (debug)
|
2016-10-14 02:32:32 +08:00
|
|
|
dprintk("pll: %s: freq=%d | i=%d/%d\n", desc->name,
|
2011-12-21 22:16:39 +08:00
|
|
|
frequency, i, desc->count);
|
2006-04-19 04:47:12 +08:00
|
|
|
if (i == desc->count)
|
|
|
|
return -EINVAL;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2011-12-21 22:16:39 +08:00
|
|
|
div = (frequency + desc->iffreq +
|
2007-05-05 23:05:39 +08:00
|
|
|
desc->entries[i].stepsize/2) / desc->entries[i].stepsize;
|
2005-04-17 06:20:36 +08:00
|
|
|
buf[0] = div >> 8;
|
|
|
|
buf[1] = div & 0xff;
|
2006-01-24 03:11:11 +08:00
|
|
|
buf[2] = desc->entries[i].config;
|
|
|
|
buf[3] = desc->entries[i].cb;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-05-05 23:05:39 +08:00
|
|
|
if (desc->set)
|
2011-12-21 22:16:39 +08:00
|
|
|
desc->set(fe, buf);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (debug)
|
2016-10-14 02:32:32 +08:00
|
|
|
dprintk("pll: %s: div=%d | buf=0x%02x,0x%02x,0x%02x,0x%02x\n",
|
2005-04-17 06:20:36 +08:00
|
|
|
desc->name, div, buf[0], buf[1], buf[2], buf[3]);
|
|
|
|
|
2006-11-21 03:45:29 +08:00
|
|
|
// calculate the frequency we set it to
|
2007-03-19 13:24:04 +08:00
|
|
|
return (div * desc->entries[i].stepsize) - desc->iffreq;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2016-11-19 06:30:51 +08:00
|
|
|
static void dvb_pll_release(struct dvb_frontend *fe)
|
|
|
|
{
|
|
|
|
kfree(fe->tuner_priv);
|
|
|
|
fe->tuner_priv = NULL;
|
|
|
|
}
|
|
|
|
|
2006-04-19 04:47:12 +08:00
|
|
|
static int dvb_pll_sleep(struct dvb_frontend *fe)
|
|
|
|
{
|
|
|
|
struct dvb_pll_priv *priv = fe->tuner_priv;
|
|
|
|
|
2006-08-09 02:48:08 +08:00
|
|
|
if (priv->i2c == NULL)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2007-03-19 13:24:09 +08:00
|
|
|
if (priv->pll_desc->sleepdata) {
|
|
|
|
struct i2c_msg msg = { .flags = 0,
|
|
|
|
.addr = priv->pll_i2c_address,
|
|
|
|
.buf = priv->pll_desc->sleepdata + 1,
|
|
|
|
.len = priv->pll_desc->sleepdata[0] };
|
2006-04-19 04:47:12 +08:00
|
|
|
|
2007-03-19 13:24:09 +08:00
|
|
|
int result;
|
2006-04-19 04:47:12 +08:00
|
|
|
|
2007-03-19 13:24:09 +08:00
|
|
|
if (fe->ops.i2c_gate_ctrl)
|
|
|
|
fe->ops.i2c_gate_ctrl(fe, 1);
|
|
|
|
if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
return 0;
|
2006-04-19 04:47:12 +08:00
|
|
|
}
|
2007-03-19 13:24:09 +08:00
|
|
|
/* Shouldn't be called when initdata is NULL, maybe BUG()? */
|
|
|
|
return -EINVAL;
|
2006-04-19 04:47:12 +08:00
|
|
|
}
|
|
|
|
|
2011-12-24 23:24:33 +08:00
|
|
|
static int dvb_pll_set_params(struct dvb_frontend *fe)
|
2006-04-19 04:47:12 +08:00
|
|
|
{
|
2011-12-21 22:16:39 +08:00
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
2006-04-19 04:47:12 +08:00
|
|
|
struct dvb_pll_priv *priv = fe->tuner_priv;
|
|
|
|
u8 buf[4];
|
|
|
|
struct i2c_msg msg =
|
2006-11-21 03:38:42 +08:00
|
|
|
{ .addr = priv->pll_i2c_address, .flags = 0,
|
|
|
|
.buf = buf, .len = sizeof(buf) };
|
2006-04-19 04:47:12 +08:00
|
|
|
int result;
|
2007-05-05 23:05:39 +08:00
|
|
|
u32 frequency = 0;
|
2006-04-19 04:47:12 +08:00
|
|
|
|
|
|
|
if (priv->i2c == NULL)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2011-12-21 22:16:39 +08:00
|
|
|
result = dvb_pll_configure(fe, buf, c->frequency);
|
|
|
|
if (result < 0)
|
2006-04-19 04:47:12 +08:00
|
|
|
return result;
|
2006-11-21 03:45:29 +08:00
|
|
|
else
|
|
|
|
frequency = result;
|
2006-04-19 04:47:12 +08:00
|
|
|
|
2006-05-14 16:01:31 +08:00
|
|
|
if (fe->ops.i2c_gate_ctrl)
|
|
|
|
fe->ops.i2c_gate_ctrl(fe, 1);
|
2006-04-19 04:47:12 +08:00
|
|
|
if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2006-11-21 03:45:29 +08:00
|
|
|
priv->frequency = frequency;
|
2011-12-27 07:02:28 +08:00
|
|
|
priv->bandwidth = c->bandwidth_hz;
|
2006-04-19 04:47:12 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-11-21 03:38:42 +08:00
|
|
|
static int dvb_pll_calc_regs(struct dvb_frontend *fe,
|
|
|
|
u8 *buf, int buf_len)
|
2006-04-19 04:47:12 +08:00
|
|
|
{
|
2011-12-24 23:03:05 +08:00
|
|
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
2006-04-19 04:47:12 +08:00
|
|
|
struct dvb_pll_priv *priv = fe->tuner_priv;
|
|
|
|
int result;
|
2007-05-05 23:05:39 +08:00
|
|
|
u32 frequency = 0;
|
2006-04-19 04:47:12 +08:00
|
|
|
|
|
|
|
if (buf_len < 5)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2011-12-24 23:03:05 +08:00
|
|
|
result = dvb_pll_configure(fe, buf + 1, c->frequency);
|
2011-12-21 22:16:39 +08:00
|
|
|
if (result < 0)
|
2006-04-19 04:47:12 +08:00
|
|
|
return result;
|
2006-11-21 03:45:29 +08:00
|
|
|
else
|
|
|
|
frequency = result;
|
|
|
|
|
2006-04-19 04:47:12 +08:00
|
|
|
buf[0] = priv->pll_i2c_address;
|
|
|
|
|
2006-11-21 03:45:29 +08:00
|
|
|
priv->frequency = frequency;
|
2011-12-24 23:03:05 +08:00
|
|
|
priv->bandwidth = c->bandwidth_hz;
|
2006-04-19 04:47:12 +08:00
|
|
|
|
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int dvb_pll_get_frequency(struct dvb_frontend *fe, u32 *frequency)
|
|
|
|
{
|
|
|
|
struct dvb_pll_priv *priv = fe->tuner_priv;
|
|
|
|
*frequency = priv->frequency;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int dvb_pll_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
|
|
|
|
{
|
|
|
|
struct dvb_pll_priv *priv = fe->tuner_priv;
|
|
|
|
*bandwidth = priv->bandwidth;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-04-27 23:31:29 +08:00
|
|
|
static int dvb_pll_init(struct dvb_frontend *fe)
|
|
|
|
{
|
|
|
|
struct dvb_pll_priv *priv = fe->tuner_priv;
|
|
|
|
|
|
|
|
if (priv->i2c == NULL)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (priv->pll_desc->initdata) {
|
|
|
|
struct i2c_msg msg = { .flags = 0,
|
|
|
|
.addr = priv->pll_i2c_address,
|
|
|
|
.buf = priv->pll_desc->initdata + 1,
|
|
|
|
.len = priv->pll_desc->initdata[0] };
|
|
|
|
|
|
|
|
int result;
|
|
|
|
if (fe->ops.i2c_gate_ctrl)
|
|
|
|
fe->ops.i2c_gate_ctrl(fe, 1);
|
2011-02-06 23:29:51 +08:00
|
|
|
result = i2c_transfer(priv->i2c, &msg, 1);
|
|
|
|
if (result != 1)
|
2007-04-27 23:31:29 +08:00
|
|
|
return result;
|
2011-02-06 23:29:51 +08:00
|
|
|
if (priv->pll_desc->initdata2) {
|
|
|
|
msg.buf = priv->pll_desc->initdata2 + 1;
|
|
|
|
msg.len = priv->pll_desc->initdata2[0];
|
|
|
|
if (fe->ops.i2c_gate_ctrl)
|
|
|
|
fe->ops.i2c_gate_ctrl(fe, 1);
|
|
|
|
result = i2c_transfer(priv->i2c, &msg, 1);
|
|
|
|
if (result != 1)
|
|
|
|
return result;
|
2007-04-27 23:31:29 +08:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* Shouldn't be called when initdata is NULL, maybe BUG()? */
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2016-09-11 22:44:12 +08:00
|
|
|
static const struct dvb_tuner_ops dvb_pll_tuner_ops = {
|
2016-11-19 06:30:51 +08:00
|
|
|
.release = dvb_pll_release,
|
2006-04-19 04:47:12 +08:00
|
|
|
.sleep = dvb_pll_sleep,
|
2007-03-19 13:24:09 +08:00
|
|
|
.init = dvb_pll_init,
|
2006-04-19 04:47:12 +08:00
|
|
|
.set_params = dvb_pll_set_params,
|
2006-04-19 08:38:49 +08:00
|
|
|
.calc_regs = dvb_pll_calc_regs,
|
2006-04-19 04:47:12 +08:00
|
|
|
.get_frequency = dvb_pll_get_frequency,
|
|
|
|
.get_bandwidth = dvb_pll_get_bandwidth,
|
|
|
|
};
|
|
|
|
|
2006-11-21 03:38:42 +08:00
|
|
|
struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr,
|
|
|
|
struct i2c_adapter *i2c,
|
2007-06-13 03:10:51 +08:00
|
|
|
unsigned int pll_desc_id)
|
2006-04-19 04:47:12 +08:00
|
|
|
{
|
2017-09-02 19:42:42 +08:00
|
|
|
u8 *b1;
|
|
|
|
struct i2c_msg msg = { .addr = pll_addr, .flags = I2C_M_RD, .len = 1 };
|
2006-04-19 04:47:12 +08:00
|
|
|
struct dvb_pll_priv *priv = NULL;
|
2006-07-10 14:34:14 +08:00
|
|
|
int ret;
|
2015-07-31 01:08:53 +08:00
|
|
|
const struct dvb_pll_desc *desc;
|
2007-06-13 03:10:51 +08:00
|
|
|
|
2017-09-02 19:42:42 +08:00
|
|
|
b1 = kmalloc(1, GFP_KERNEL);
|
|
|
|
if (!b1)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
b1[0] = 0;
|
|
|
|
msg.buf = b1;
|
|
|
|
|
2007-09-08 05:27:43 +08:00
|
|
|
if ((id[dvb_pll_devcount] > DVB_PLL_UNDEFINED) &&
|
|
|
|
(id[dvb_pll_devcount] < ARRAY_SIZE(pll_list)))
|
|
|
|
pll_desc_id = id[dvb_pll_devcount];
|
|
|
|
|
2007-06-13 03:10:51 +08:00
|
|
|
BUG_ON(pll_desc_id < 1 || pll_desc_id >= ARRAY_SIZE(pll_list));
|
|
|
|
|
|
|
|
desc = pll_list[pll_desc_id];
|
2006-07-10 14:34:14 +08:00
|
|
|
|
2006-07-17 06:41:41 +08:00
|
|
|
if (i2c != NULL) {
|
|
|
|
if (fe->ops.i2c_gate_ctrl)
|
|
|
|
fe->ops.i2c_gate_ctrl(fe, 1);
|
|
|
|
|
2006-07-19 03:37:13 +08:00
|
|
|
ret = i2c_transfer (i2c, &msg, 1);
|
2017-09-02 19:42:42 +08:00
|
|
|
if (ret != 1) {
|
|
|
|
kfree(b1);
|
2006-08-08 20:10:08 +08:00
|
|
|
return NULL;
|
2017-09-02 19:42:42 +08:00
|
|
|
}
|
2006-07-17 06:41:41 +08:00
|
|
|
if (fe->ops.i2c_gate_ctrl)
|
|
|
|
fe->ops.i2c_gate_ctrl(fe, 0);
|
|
|
|
}
|
2006-04-19 04:47:12 +08:00
|
|
|
|
|
|
|
priv = kzalloc(sizeof(struct dvb_pll_priv), GFP_KERNEL);
|
2017-09-02 19:42:42 +08:00
|
|
|
if (!priv) {
|
|
|
|
kfree(b1);
|
2006-08-08 20:10:08 +08:00
|
|
|
return NULL;
|
2017-09-02 19:42:42 +08:00
|
|
|
}
|
2006-04-19 04:47:12 +08:00
|
|
|
|
|
|
|
priv->pll_i2c_address = pll_addr;
|
|
|
|
priv->i2c = i2c;
|
|
|
|
priv->pll_desc = desc;
|
2007-09-08 05:11:15 +08:00
|
|
|
priv->nr = dvb_pll_devcount++;
|
2006-04-19 04:47:12 +08:00
|
|
|
|
2006-11-21 03:38:42 +08:00
|
|
|
memcpy(&fe->ops.tuner_ops, &dvb_pll_tuner_ops,
|
|
|
|
sizeof(struct dvb_tuner_ops));
|
|
|
|
|
2018-09-10 20:19:16 +08:00
|
|
|
strscpy(fe->ops.tuner_ops.info.name, desc->name,
|
2007-04-27 23:31:27 +08:00
|
|
|
sizeof(fe->ops.tuner_ops.info.name));
|
media: dvb-pll: fix tuner frequency ranges
Tuners should report frequencies in Hz. That works fine on most
drivers, but, in the case of dvb-pll, some settings are for
satellite tuners, while others are for terrestrial/cable ones.
The code was trying to solve it at probing time, but that doesn't
work, as, when _attach is called, the delivery system may be wrong.
Fix it by ensuring that all frequencies are in Hz at the per-tuner
max/min values.
While here, add a debug message, as this would help to debug any
issues there.
It partially fixes the following bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1116374
Fixes: a3f90c75b833 ("media: dvb: convert tuner_info frequencies to Hz")
Reported-by: Stakanov Schufter <stakanov@eclipso.eu>
Reported-by: Takashi Iwai <tiwai@suse.de>
Cc: stable@vger.kernel.org # For 4.19
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-20 18:19:36 +08:00
|
|
|
|
|
|
|
fe->ops.tuner_ops.info.frequency_min_hz = desc->min;
|
|
|
|
fe->ops.tuner_ops.info.frequency_max_hz = desc->max;
|
|
|
|
|
|
|
|
dprintk("%s tuner, frequency range: %u...%u\n",
|
|
|
|
desc->name, desc->min, desc->max);
|
2018-07-06 06:59:35 +08:00
|
|
|
|
2007-03-19 13:24:09 +08:00
|
|
|
if (!desc->initdata)
|
|
|
|
fe->ops.tuner_ops.init = NULL;
|
|
|
|
if (!desc->sleepdata)
|
|
|
|
fe->ops.tuner_ops.sleep = NULL;
|
2006-04-19 04:47:12 +08:00
|
|
|
|
|
|
|
fe->tuner_priv = priv;
|
2007-09-08 05:11:15 +08:00
|
|
|
|
2007-09-09 16:08:30 +08:00
|
|
|
if ((debug) || (id[priv->nr] == pll_desc_id)) {
|
2016-10-14 02:32:32 +08:00
|
|
|
dprintk("dvb-pll[%d]", priv->nr);
|
2007-09-08 05:11:15 +08:00
|
|
|
if (i2c != NULL)
|
2016-10-14 02:32:32 +08:00
|
|
|
pr_cont(" %d-%04x", i2c_adapter_id(i2c), pll_addr);
|
|
|
|
pr_cont(": id# %d (%s) attached, %s\n", pll_desc_id, desc->name,
|
2007-09-08 05:27:43 +08:00
|
|
|
id[priv->nr] == pll_desc_id ?
|
|
|
|
"insmod option" : "autodetected");
|
2007-09-09 16:16:34 +08:00
|
|
|
}
|
2007-09-08 05:11:15 +08:00
|
|
|
|
2017-09-02 19:42:42 +08:00
|
|
|
kfree(b1);
|
|
|
|
|
2006-08-08 20:10:08 +08:00
|
|
|
return fe;
|
2006-04-19 04:47:12 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(dvb_pll_attach);
|
|
|
|
|
2018-04-09 01:21:34 +08:00
|
|
|
|
|
|
|
static int
|
|
|
|
dvb_pll_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
|
|
|
{
|
|
|
|
struct dvb_pll_config *cfg;
|
|
|
|
struct dvb_frontend *fe;
|
|
|
|
unsigned int desc_id;
|
|
|
|
|
|
|
|
cfg = client->dev.platform_data;
|
|
|
|
fe = cfg->fe;
|
|
|
|
i2c_set_clientdata(client, fe);
|
|
|
|
desc_id = (unsigned int) id->driver_data;
|
|
|
|
|
|
|
|
if (!dvb_pll_attach(fe, client->addr, client->adapter, desc_id))
|
|
|
|
return -ENOMEM;
|
|
|
|
|
2018-06-10 22:49:15 +08:00
|
|
|
/*
|
|
|
|
* Unset tuner_ops.release (== dvb_pll_release)
|
|
|
|
* which has been just set in the above dvb_pll_attach(),
|
|
|
|
* because if tuner_ops.release was left defined,
|
|
|
|
* this module would be 'put' twice on exit:
|
|
|
|
* once by dvb_frontend_detach() and another by dvb_module_release().
|
|
|
|
*
|
|
|
|
* dvb_pll_release is instead executed in the i2c driver's .remove(),
|
|
|
|
* keeping dvb_pll_attach untouched for legacy (dvb_attach) drivers.
|
|
|
|
*/
|
|
|
|
fe->ops.tuner_ops.release = NULL;
|
2018-04-09 01:21:34 +08:00
|
|
|
dev_info(&client->dev, "DVB Simple Tuner attached.\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int dvb_pll_remove(struct i2c_client *client)
|
|
|
|
{
|
|
|
|
struct dvb_frontend *fe;
|
|
|
|
|
|
|
|
fe = i2c_get_clientdata(client);
|
|
|
|
dvb_pll_release(fe);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const struct i2c_device_id dvb_pll_id[] = {
|
|
|
|
{"dtt7579", DVB_PLL_THOMSON_DTT7579},
|
|
|
|
{"dtt759x", DVB_PLL_THOMSON_DTT759X},
|
|
|
|
{"z201", DVB_PLL_LG_Z201},
|
|
|
|
{"unknown_1", DVB_PLL_UNKNOWN_1},
|
|
|
|
{"tua6010xs", DVB_PLL_TUA6010XS},
|
|
|
|
{"env57h1xd5", DVB_PLL_ENV57H1XD5},
|
|
|
|
{"tua6034", DVB_PLL_TUA6034},
|
|
|
|
{"tda665x", DVB_PLL_TDA665X},
|
|
|
|
{"tded4", DVB_PLL_TDED4},
|
|
|
|
{"tdhu2", DVB_PLL_TDHU2},
|
|
|
|
{"tbmv", DVB_PLL_SAMSUNG_TBMV},
|
|
|
|
{"sd1878_tda8261", DVB_PLL_PHILIPS_SD1878_TDA8261},
|
|
|
|
{"opera1", DVB_PLL_OPERA1},
|
|
|
|
{"dtos403ih102a", DVB_PLL_SAMSUNG_DTOS403IH102A},
|
|
|
|
{"tdtc9251dh0", DVB_PLL_SAMSUNG_TDTC9251DH0},
|
|
|
|
{"tbdu18132", DVB_PLL_SAMSUNG_TBDU18132},
|
|
|
|
{"tbmu24112", DVB_PLL_SAMSUNG_TBMU24112},
|
|
|
|
{"tdee4", DVB_PLL_TDEE4},
|
|
|
|
{"dtt7520x", DVB_PLL_THOMSON_DTT7520X},
|
2018-04-09 01:21:35 +08:00
|
|
|
{"tua6034_friio", DVB_PLL_TUA6034_FRIIO},
|
2018-04-09 01:39:49 +08:00
|
|
|
{"tda665x_earthpt1", DVB_PLL_TDA665X_EARTH_PT1},
|
2018-04-09 01:21:34 +08:00
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
MODULE_DEVICE_TABLE(i2c, dvb_pll_id);
|
|
|
|
|
|
|
|
static struct i2c_driver dvb_pll_driver = {
|
|
|
|
.driver = {
|
|
|
|
.name = "dvb_pll",
|
|
|
|
},
|
|
|
|
.probe = dvb_pll_probe,
|
|
|
|
.remove = dvb_pll_remove,
|
|
|
|
.id_table = dvb_pll_id,
|
|
|
|
};
|
|
|
|
|
|
|
|
module_i2c_driver(dvb_pll_driver);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
MODULE_DESCRIPTION("dvb pll library");
|
|
|
|
MODULE_AUTHOR("Gerd Knorr");
|
|
|
|
MODULE_LICENSE("GPL");
|