Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
95ba2d4
Update ts2020.c
psyborg55 Jan 25, 2022
82fd774
Update m88ds3103.c
psyborg55 Jan 25, 2022
6c3c8d9
Update m88ds3103.c
psyborg55 Jan 26, 2022
80f954f
Update dvb_frontend.c
psyborg55 Jan 29, 2022
eddc75a
Enable CCI
psyborg55 Feb 3, 2022
cf455fc
check ISI/Adaptive equalizer
psyborg55 Feb 3, 2022
92bf381
Set AC coupling
psyborg55 Feb 3, 2022
111068f
fix status parsing
psyborg55 Feb 10, 2022
1235a8d
SNR fix
psyborg55 Feb 10, 2022
743dac8
write SR<5000 registers
psyborg55 Mar 10, 2022
9d2ca13
read ucblocks
psyborg55 Mar 10, 2022
98cdf53
read ucblocks
psyborg55 Mar 10, 2022
0327921
increase ts clock
psyborg55 Mar 11, 2022
16d263b
separate the carrier offset code
psyborg55 Mar 11, 2022
b21c3dc
cleanup
psyborg55 Mar 11, 2022
f4424cd
support SR below 1000kS/s
psyborg55 Mar 15, 2022
fb71087
speed up tuning
psyborg55 Mar 16, 2022
25d2034
add missing DVBS status
psyborg55 Mar 18, 2022
706750f
decrease status update period
psyborg55 Mar 18, 2022
db0c725
improve tuning in tvheadend
psyborg55 Mar 24, 2022
37ff920
add missing frequency conversion for auto delivery system
psyborg55 Mar 24, 2022
e2dcd9c
SNR conversion
psyborg55 Mar 25, 2022
7649c8c
delay before sending diseqc cmd
psyborg55 Mar 26, 2022
1f6b884
retry rf and bb cal if they fail
psyborg55 Mar 29, 2022
821fdd0
add vco correction
psyborg55 Mar 29, 2022
30bbe72
register write bug
psyborg55 Mar 30, 2022
a35dd6f
spectrum scan with SW tune algo
psyborg55 Mar 30, 2022
569ac47
use SW tuning algorithm
psyborg55 Mar 30, 2022
ed3442e
target_mclk / ts_clk changes
psyborg55 Apr 1, 2022
3ee3e8b
complete the SW tune thread
psyborg55 Apr 4, 2022
7d952a9
status read needed for regular tuning only
psyborg55 Apr 4, 2022
50864e1
include SYS_AUTO in the rest of the routines
psyborg55 Apr 5, 2022
45b1105
BER stats fixed
psyborg55 Apr 5, 2022
9765629
move define
psyborg55 Apr 5, 2022
7709933
low sr work
psyborg55 Apr 14, 2022
134c420
support amateur band
psyborg55 Apr 22, 2022
38e92e5
Update m88ds3103.c
psyborg55 Apr 28, 2022
364ef18
fix pctv 461e lockup
psyborg55 May 5, 2022
b97931d
fix pctv 461e lockup
psyborg55 May 5, 2022
c0593af
fix pctv 461e lockup
psyborg55 May 5, 2022
7d1c23a
dvbs status bug
psyborg55 May 6, 2022
9a3f628
revert value
psyborg55 May 15, 2022
4a8c539
build fix
psyborg55 May 20, 2022
9fc3d6c
add variables
psyborg55 May 20, 2022
59f8a22
add blindscan initvals and structure
psyborg55 May 20, 2022
64e31e4
setup demod blindscan mode
psyborg55 May 20, 2022
dfc7a40
avoid compile error
psyborg55 May 20, 2022
81c4287
fft scan based on proprietary algorithm
psyborg55 May 20, 2022
8ce8795
get total carrier offset
psyborg55 May 20, 2022
c013252
main blind scan routine
psyborg55 May 20, 2022
2efd92a
export blindscan via scan call/ include kthread
psyborg55 May 20, 2022
354553a
Update README.md
psyborg55 May 20, 2022
12b9b76
Update README.md
psyborg55 May 21, 2022
d8fa830
wideband support
psyborg55 Jun 7, 2022
ff95e94
Blindscan using wideband LNB
psyborg55 Jun 13, 2022
d429df2
FBC
psyborg55 Jun 13, 2022
21762f4
Update m88ds3103.c
psyborg55 Jun 21, 2022
36a8d28
export gain from tuner driver
psyborg55 Jun 22, 2022
44608fa
export gain from tuner driver
psyborg55 Jun 22, 2022
2eb18db
indicate search capabilites
psyborg55 Jun 25, 2022
a846912
added spectrum routines
psyborg55 Jun 25, 2022
ab8fc79
fft routines for spectrum scan
psyborg55 Jun 25, 2022
fae2d62
defined spectrum structure
psyborg55 Jun 25, 2022
2b36b6e
fix VCO setup
psyborg55 Jun 28, 2022
8330a06
fixed remaining issues
psyborg55 Jun 29, 2022
f894585
lpf bug
psyborg55 Jul 19, 2022
8f12ba4
reduce code size
psyborg55 Jul 25, 2022
e2b8765
blind tune
psyborg55 Jul 30, 2022
9a95bae
add blind parameter
psyborg55 Jul 30, 2022
ebddc02
Update m88ds3103.c
psyborg55 Aug 1, 2022
4fdd6f1
rf level parsing
psyborg55 Aug 3, 2022
498da32
suppres warning on init
psyborg55 Aug 5, 2022
02bcc10
reset carrier offset
psyborg55 Aug 6, 2022
ace78b2
bandwidth+offset, not static value
psyborg55 Aug 13, 2022
6e53959
dvbv3 snr
psyborg55 Aug 15, 2022
81a4c61
skip lock when no transponders detected
psyborg55 Sep 18, 2022
1340aa6
remove useless code
psyborg55 Sep 20, 2022
67462c2
lower LPF threshold
psyborg55 Sep 20, 2022
229e17d
move defines
psyborg55 Sep 20, 2022
b6017e6
delay in high band to stabilize gain
psyborg55 Sep 21, 2022
4af058c
Update m88ds3103.c
psyborg55 Sep 22, 2022
aee4d6b
value is zero in serial mode
psyborg55 Oct 2, 2022
ca315bf
revert useless code
psyborg55 Oct 7, 2022
3c42ce7
revert useless code
psyborg55 Oct 7, 2022
bd646ee
remove strength as it's useless
psyborg55 Oct 7, 2022
c391992
Update m88ds3103_priv.h
psyborg55 Oct 18, 2022
9ad155b
Update frontend.h
psyborg55 Oct 18, 2022
65b9f9a
Update ts2020.c
psyborg55 Oct 18, 2022
87a5278
Update and rename m88ds3103.c to m88ds3103_drv.c
psyborg55 Oct 18, 2022
8d82398
Update Makefile
psyborg55 Oct 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ It contains patches for the following drivers
* stv091x: tbs5927
* tas2101 (incomplete): tbs5990, tbs6904
* si2183 based cards: tbs6504
* m88ds3103: pctv 461e v1(B6H9)/Hauppauge wintv-nova-s2 v1.4(B9H9)

to support blindscan, to fix bugs and to make improvements.

Expand Down
53 changes: 44 additions & 9 deletions drivers/media/dvb-core/dvb_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ static int dvb_frontend_thread(void *data)
if (fe->ops.scan)
fe->ops.scan(fe, fepriv->state & FESTATE_SCAN_NEXT , &fepriv->delay, &s);
fepriv->state = FESTATE_IDLE;
} else if (fepriv->state & FESTATE_GETTING_SPECTRUM) {
} else if (fepriv->state & FESTATE_GETTING_SPECTRUM) {
dev_dbg(fe->dvb->device, "%s: Spectrum requested, DTV_SPECTRUM\n", __func__);
dprintk("starting spectrum scan\n");
if (fe->ops.spectrum_start)
Expand Down Expand Up @@ -792,7 +792,31 @@ static int dvb_frontend_thread(void *data)
break;
case DVBFE_ALGO_SW:
dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_SW\n", __func__);
dvb_frontend_swzigzag(fe);

if (fepriv->state & FESTATE_SCANNING) {
dev_dbg(fe->dvb->device, "%s: Sscan requested, FESTATE_SCANNING\n", __func__);
if (fe->ops.scan)
fe->ops.scan(fe, fepriv->state & FESTATE_SCAN_NEXT , &fepriv->delay, &s);
fepriv->state = FESTATE_IDLE;
} else if (fepriv->state & FESTATE_GETTING_SPECTRUM) {
dev_dbg(fe->dvb->device, "%s: Spectrum requested, DTV_SPECTRUM\n", __func__);
dprintk("starting spectrum scan\n");
if (fe->ops.spectrum_start)
fe->ops.spectrum_start(fe, &fepriv->spectrum, &fepriv->delay, &s);
dprintk("spectrum scan ended s=0x%x\n", s);
fepriv->state = FESTATE_IDLE;
} else {
dvb_frontend_swzigzag(fe);
fe->ops.read_status(fe, &s);
}
if ((s != fepriv->status && !(fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT))
|| (fepriv->heartbeat_interval>0)) {
//dprintk("Adding event val=0x%x\n", s);
dev_dbg(fe->dvb->device, "%s: state changed, adding current state\n", __func__);
dvb_frontend_add_event(fe, s);
fepriv->status = s;
}
atomic_set(&fe->algo_state.task_should_stop, false);
break;
case DVBFE_ALGO_CUSTOM:
dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_CUSTOM, state=%d\n", __func__, fepriv->state);
Expand Down Expand Up @@ -983,6 +1007,7 @@ static void dvb_frontend_get_frequency_limits(struct dvb_frontend *fe,

/* If the standard is for satellite, convert frequencies to kHz */
switch (c->delivery_system) {
case SYS_AUTO:
case SYS_DVBS:
case SYS_DVBS2:
case SYS_TURBO:
Expand All @@ -1008,6 +1033,7 @@ static u32 dvb_frontend_get_stepsize(struct dvb_frontend *fe)
u32 step = max(fe_step, tuner_step);

switch (c->delivery_system) {
case SYS_AUTO:
case SYS_DVBS:
case SYS_DVBS2:
case SYS_TURBO:
Expand Down Expand Up @@ -1035,17 +1061,20 @@ static int dvb_frontend_check_parameters(struct dvb_frontend *fe)
dvb_frontend_get_frequency_limits(fe, &freq_min, &freq_max, NULL);
if ((freq_min && c->frequency < freq_min) ||
(freq_max && c->frequency > freq_max)) {
dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i frequency %u out of range (%u..%u)\n",
if (c->frequency != 0) {
dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i frequency %u out of range (%u..%u)\n",
fe->dvb->num, fe->id, c->frequency,
freq_min, freq_max);
dprintk( "DVB: adapter %i frontend %i frequency %u out of range (%u..%u)\n",
dprintk( "DVB: adapter %i frontend %i frequency %u out of range (%u..%u)\n",
fe->dvb->num, fe->id, c->frequency,
freq_min, freq_max);
return -EINVAL;
return -EINVAL;
}
}

/* range check: symbol rate */
switch (c->delivery_system) {
case SYS_AUTO:
case SYS_DVBS:
case SYS_DVBS2:
case SYS_TURBO:
Expand All @@ -1055,15 +1084,17 @@ static int dvb_frontend_check_parameters(struct dvb_frontend *fe)
c->symbol_rate < fe->ops.info.symbol_rate_min) ||
(fe->ops.info.symbol_rate_max &&
c->symbol_rate > fe->ops.info.symbol_rate_max)) {
dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i symbol rate %u out of range (%u..%u)\n",
if (c->symbol_rate != 0) {
dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i symbol rate %u out of range (%u..%u)\n",
fe->dvb->num, fe->id, c->symbol_rate,
fe->ops.info.symbol_rate_min,
fe->ops.info.symbol_rate_max);
dprintk("DVB: adapter %i frontend %i symbol rate %u out of range (%u..%u)\n",
dprintk("DVB: adapter %i frontend %i symbol rate %u out of range (%u..%u)\n",
fe->dvb->num, fe->id, c->symbol_rate,
fe->ops.info.symbol_rate_min,
fe->ops.info.symbol_rate_max);
return -EINVAL;
return -EINVAL;
}
}
default:
break;
Expand Down Expand Up @@ -1119,6 +1150,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
c->scrambling_sequence_index = 0;/* default sequence */

switch (c->delivery_system) {
case SYS_AUTO:
case SYS_DVBS:
case SYS_DVBS2:
case SYS_TURBO:
Expand Down Expand Up @@ -2624,6 +2656,7 @@ static int dtv_set_frontend(struct dvb_frontend *fe)
case SYS_ISDBS:
rolloff = 135;
break;
case SYS_AUTO:
case SYS_DVBS2:
switch (c->rolloff) {
case ROLLOFF_20:
Expand Down Expand Up @@ -2663,6 +2696,7 @@ static int dtv_set_frontend(struct dvb_frontend *fe)
} else {
/* default values */
switch (c->delivery_system) {
case SYS_AUTO:
case SYS_DVBS:
case SYS_DVBS2:
case SYS_ISDBS:
Expand Down Expand Up @@ -2738,6 +2772,7 @@ static int dtv_get_pls_search_list(struct dvb_frontend *fe, struct dtv_pls_searc
static int dtv_set_pls_search_list(struct dvb_frontend *fe, struct dtv_pls_search_list* user)
{
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int i;
c->pls_search_codes_len = sizeof(c->pls_search_codes)/sizeof(c->pls_search_codes[0]);
if(user->num_codes < c->pls_search_codes_len)
c->pls_search_codes_len = user->num_codes;
Expand All @@ -2749,7 +2784,7 @@ static int dtv_set_pls_search_list(struct dvb_frontend *fe, struct dtv_pls_searc
dprintk("ERROR: len=%d/%d codes=%p", c->pls_search_codes_len, user->num_codes, user->codes);
return -EFAULT;
}
int i;

dprintk("PLS: %d codes:\n", c->pls_search_codes_len);
for(i=0;i< c->pls_search_codes_len;++i)
dprintk("code=0x%x\n", c->pls_search_codes[i]);
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/dvb-frontends/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ drxd-objs := drxd_firm.o drxd_hard.o
cxd2820r-objs := cxd2820r_core.o cxd2820r_c.o cxd2820r_t.o cxd2820r_t2.o
drxk-objs := drxk_hard.o
stv091x-objs := stv091x_chip.o stv091x_drv.o

m88ds3103-objs := m88ds3103_drv.o neumo-scan.o
obj-$(CONFIG_DVB_PLL) += dvb-pll.o
obj-$(CONFIG_DVB_STV0299) += stv0299.o
obj-$(CONFIG_DVB_STB0899) += stb0899.o
Expand Down
141 changes: 138 additions & 3 deletions drivers/media/dvb-frontends/a8293.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,133 @@
struct a8293_dev {
struct i2c_client *client;
u8 reg[2];
int volt_slew_nanos_per_mv;
};

static int a8293_set_voltage(struct dvb_frontend *fe,
enum fe_sec_voltage fe_sec_voltage)
/*
* When increasing voltage, do so in minimal steps over time, minimizing risk of vIN undervoltage.
*/

static int a8293_set_voltage_slew(struct a8293_dev *dev, struct i2c_client *client,
enum fe_sec_voltage fe_sec_voltage, int min_nanos_per_mv)
{
int ret;
u8 reg0, reg1;
int new_volt_idx;
const int idx_to_mv[] = {0, 12709, 13042, 13375, 14042, 15042, 18042, 18709, 19042};
const u8 idx_to_reg[] = {0x00, 0x20, 0x21, 0x22, 0x24, 0x27, 0x28, 0x2A, 0x2B };
int this_volt_idx;
u8 status;
int prev_volt_idx;

dev_dbg(&client->dev, "set_voltage_slew fe_sec_voltage=%d\n", fe_sec_voltage);

/* Read status register to clear any stale faults. */
ret = i2c_master_recv(client, &status, 1);
if (ret < 0)
goto err;

/* Determine previous voltage */
switch (dev->reg[0] & 0x2F) {
case 0x00:
prev_volt_idx = 0;
break;
case 0x20:
prev_volt_idx = 1;
break;
case 0x21:
prev_volt_idx = 2;
break;
case 0x22:
prev_volt_idx = 3;
break;
case 0x24:
prev_volt_idx = 4;
break;
case 0x27:
prev_volt_idx = 5;
break;
case 0x28:
prev_volt_idx = 6;
break;
case 0x2A:
prev_volt_idx = 7;
break;
case 0x2B:
prev_volt_idx = 8;
break;
default:
prev_volt_idx = 0;
}

/* Determine new voltage */
switch (fe_sec_voltage) {
case SEC_VOLTAGE_OFF:
new_volt_idx = 0;
break;
case SEC_VOLTAGE_13:
new_volt_idx = 2;
break;
case SEC_VOLTAGE_18:
new_volt_idx = 6;
break;
default:
ret = -EINVAL;
goto err;
}

/* Slew to new voltage if new voltage is greater than current voltage */
this_volt_idx = prev_volt_idx;
if (this_volt_idx < new_volt_idx) {
while (this_volt_idx < new_volt_idx) {
int delta_mv = idx_to_mv[this_volt_idx+1] - idx_to_mv[this_volt_idx];
int min_wait_time = delta_mv * min_nanos_per_mv;

reg0 = idx_to_reg[this_volt_idx+1];
reg0 |= A8293_FLAG_ODT;

ret = i2c_master_send(client, &reg0, 1);
if (ret < 0)
goto err;
dev->reg[0] = reg0;
this_volt_idx++;
usleep_range(min_wait_time, min_wait_time * 2);
}
} else { /* Else just set the voltage */
reg0 = idx_to_reg[new_volt_idx];
reg0 |= A8293_FLAG_ODT;
ret = i2c_master_send(client, &reg0, 1);
if (ret < 0)
goto err;
dev->reg[0] = reg0;
}

/* TMODE=0, TGATE=1 */
reg1 = 0x82;
if (reg1 != dev->reg[1]) {
ret = i2c_master_send(client, &reg1, 1);
if (ret < 0)
goto err;
dev->reg[1] = reg1;
}

usleep_range(1500, 5000);

return 0;
err:
dev_dbg(&client->dev, "failed=%d\n", ret);
return ret;
}

static int a8293_set_voltage_noslew(struct dvb_frontend *fe,
enum fe_sec_voltage fe_sec_voltage)
{
struct a8293_dev *dev = fe->sec_priv;
struct i2c_client *client = dev->client;
int ret;
u8 reg0, reg1;

dev_dbg(&client->dev, "fe_sec_voltage=%d\n", fe_sec_voltage);
dev_dbg(&client->dev, "set_voltage_noslew fe_sec_voltage=%d\n", fe_sec_voltage);

switch (fe_sec_voltage) {
case SEC_VOLTAGE_OFF:
Expand Down Expand Up @@ -62,6 +178,24 @@ static int a8293_set_voltage(struct dvb_frontend *fe,
return ret;
}

static int a8293_set_voltage(struct dvb_frontend *fe,
enum fe_sec_voltage fe_sec_voltage)
{
struct a8293_dev *dev = fe->sec_priv;
struct i2c_client *client = dev->client;
int volt_slew_nanos_per_mv = dev->volt_slew_nanos_per_mv;

dev_dbg(&client->dev, "set_voltage volt_slew_nanos_per_mv=%d\n", volt_slew_nanos_per_mv);

/* Use slew version if slew rate is set to a sane value */
if (volt_slew_nanos_per_mv > 0 && volt_slew_nanos_per_mv < 1600)
a8293_set_voltage_slew(dev, client, fe_sec_voltage, volt_slew_nanos_per_mv);
else
a8293_set_voltage_noslew(fe, fe_sec_voltage);

return 0;
}

static int a8293_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
Expand All @@ -78,6 +212,7 @@ static int a8293_probe(struct i2c_client *client,
}

dev->client = client;
dev->volt_slew_nanos_per_mv = pdata->volt_slew_nanos_per_mv;

/* check if the SEC is there */
ret = i2c_master_recv(client, buf, 2);
Expand Down
4 changes: 4 additions & 0 deletions drivers/media/dvb-frontends/a8293.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#ifndef A8293_H
#define A8293_H

#define A8293_FLAG_ODT 0x10

#include <media/dvb_frontend.h>

/*
Expand All @@ -18,9 +20,11 @@
/**
* struct a8293_platform_data - Platform data for the a8293 driver
* @dvb_frontend: DVB frontend.
* @volt_slew_nanos_per_mv: Slew rate when increasing LNB voltage, in nanoseconds per millivolt.
*/
struct a8293_platform_data {
struct dvb_frontend *dvb_frontend;
int volt_slew_nanos_per_mv;
};

#endif /* A8293_H */
5 changes: 5 additions & 0 deletions drivers/media/dvb-frontends/m88ds3103.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

#include <linux/dvb/frontend.h>

bool blind;
bool scandone;
u16 tpcnt;
u16 tpnum;

/*
* I2C address
* 0x68,
Expand Down
Loading