Skip to contentSkip to conversation

stv0910/stv6111 updates

PATCH In review Daniel Scheller 2 participants 9 messages Jul 23, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover stv0910/stv6111 updates

From: Daniel Scheller <[email protected]>

Several, mostly cosmetic updates and fixes to these two new drivers, and one additional functionality:

- Make both drivers 99% checkpatch-strict clean. stv0910_regs.h still has "CHECK: 'VALIDE' may be misspelled - perhaps 'VALID'?", which is left as-is intentionally (unclear if this really is a typo, or wanted or documented in vendor specs)
- Fixup comments (block comment format, c++-style comments, whitespace etc)
- Const'ify all tables
- Better identifier strings
- Signal strength assignment fixed and unneeded var removed (uvalue vs svalue)
- Support/Implement the disecq_send_burst fe_op

Based on https://patchwork.linuxtv.org/patch/42702/ and thus requires that one to be merged beforehand, else this series conflicts in patch 4/7.

Build and runtime tested.

Daniel Scheller (7):
[media] dvb-frontends/stv0910: fix STR assignment, remove unneeded var [media] dvb-frontends/stv0910: implement diseqc_send_burst [media] dvb-frontends/stv0910: further coding style cleanup [media] dvb-frontends/stv0910: cosmetics: fixup comments, misc [media] dvb-frontends/stv6111: coding style cleanup [media] dvb-frontends/stv6111: cosmetics: comments fixup, misc [media] dvb-frontends/stv{0910,6111}: constify tables

 drivers/media/dvb-frontends/stv0910.c      |  543 ++++----
 drivers/media/dvb-frontends/stv0910.h      |    4 +-
 drivers/media/dvb-frontends/stv0910_regs.h | 1953 ++++++++++++++--------------
 drivers/media/dvb-frontends/stv6111.c      |   85 +-
 drivers/media/dvb-frontends/stv6111.h      |    7 +-
 5 files changed, 1313 insertions(+), 1279 deletions(-)
Signature · 1 line
2.13.0
#1 lore raw

PATCH 1/7 dvb-frontends/stv0910: fix STR assignment, remove unneeded var

From: Daniel Scheller <[email protected]>

According to the documentation, FE_SCALE_DECIBEL values should be assigned to .svalue and not .uvalue, so let's do this. While at it, remove the unneeded strength var from read_signal_strength().

---
 drivers/media/dvb-frontends/stv0910.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/media/dvb-frontends/stv0910.c +1 -4
index bae1da3fdb2d..4084c142f1e4 100644
@@ -1321,7 +1321,6 @@ static void read_signal_strength(struct dvb_frontend *fe)
 {
 	struct stv *state = fe->demodulator_priv;
 	struct dtv_frontend_properties *p = &state->fe.dtv_property_cache;
-	s64 strength;
 	u8 reg[2];
 	u16 agc;
 	s32 padc, power = 0;
@@ -1341,10 +1340,8 @@ static void read_signal_strength(struct dvb_frontend *fe)
 
 	padc = table_lookup(padc_lookup, ARRAY_SIZE(padc_lookup), power) + 352;
 
-	strength = (padc - agc);
-
 	p->strength.stat[0].scale = FE_SCALE_DECIBEL;
-	p->strength.stat[0].uvalue = strength;
+	p->strength.stat[0].svalue = (padc - agc);
 }
 
 static int read_status(struct dvb_frontend *fe, enum fe_status *status)
Signature · 1 line
2.13.0
#2 lore raw

PATCH 2/7 dvb-frontends/stv0910: implement diseqc_send_burst

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

This implements the diseqc_send_burst frontend op to support sending mini-DISEQC bursts. Picked up from dddvb's driver package where this specific block was disabled via #if 0/#endif, but is still working according to feedback from upstream, so add it.

---
 drivers/media/dvb-frontends/stv0910.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
drivers/media/dvb-frontends/stv0910.c +22 -0
index 4084c142f1e4..bbe609143497 100644
@@ -1638,6 +1638,27 @@ static int send_master_cmd(struct dvb_frontend *fe,
 	return 0;
 }
 
+static int send_burst(struct dvb_frontend *fe, enum fe_sec_mini_cmd burst)
+{
+	struct stv *state = fe->demodulator_priv;
+	u16 offs = state->nr ? 0x40 : 0;
+	u8 value;
+
+	if (burst == SEC_MINI_A) {
+		write_reg(state, RSTV0910_P1_DISTXCFG + offs, 0x3F);
+		value = 0x00;
+	} else {
+		write_reg(state, RSTV0910_P1_DISTXCFG + offs, 0x3E);
+		value = 0xFF;
+	}
+	wait_dis(state, 0x40, 0x00);
+	write_reg(state, RSTV0910_P1_DISTXFIFO + offs, value);
+	write_reg(state, RSTV0910_P1_DISTXCFG + offs, 0x3A);
+	wait_dis(state, 0x20, 0x20);
+
+	return 0;
+}
+
 static int sleep(struct dvb_frontend *fe)
 {
 	struct stv *state = fe->demodulator_priv;
@@ -1673,6 +1694,7 @@ static struct dvb_frontend_ops stv0910_ops = {
 	.set_tone			= set_tone,
 
 	.diseqc_send_master_cmd		= send_master_cmd,
+	.diseqc_send_burst              = send_burst,
 };
 
 static struct stv_base *match_base(struct i2c_adapter  *i2c, u8 adr)
Signature · 1 line
2.13.0
#3 lore raw

PATCH 3/7 dvb-frontends/stv0910: further coding style cleanup

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Fixes up all remainders reported by "checkpatch.pl --strict"

---
 drivers/media/dvb-frontends/stv0910.c | 93 +++++++++++++++++------------------
 drivers/media/dvb-frontends/stv0910.h |  4 +-
 2 files changed, 48 insertions(+), 49 deletions(-)
drivers/media/dvb-frontends/stv0910.c +46 -47
index bbe609143497..8dc767a118a0 100644
@@ -71,7 +71,7 @@ static inline u32 muldiv32(u32 a, u32 b, u32 c)
 	tmp64 = (u64)a * (u64)b;
 	do_div(tmp64, c);
 
-	return (u32) tmp64;
+	return (u32)tmp64;
 }
 
 struct stv_base {
@@ -79,8 +79,8 @@ struct stv_base {
 
 	u8                   adr;
 	struct i2c_adapter  *i2c;
-	struct mutex         i2c_lock;
-	struct mutex         reg_lock;
+	struct mutex         i2c_lock; /* shared I2C access protect */
+	struct mutex         reg_lock; /* shared register write protect */
 	int                  count;
 
 	u32                  extclk;
@@ -146,8 +146,8 @@ static inline int i2c_write(struct i2c_adapter *adap, u8 adr,
 
 	if (i2c_transfer(adap, &msg, 1) != 1) {
 		dev_warn(&adap->dev, "i2c write error ([%02x] %04x: %02x)\n",
-			adr, (data[0] << 8) | data[1],
-			(len > 2 ? data[2] : 0));
+			 adr, (data[0] << 8) | data[1],
+			 (len > 2 ? data[2] : 0));
 		return -EREMOTEIO;
 	}
 	return 0;
@@ -166,7 +166,7 @@ static int write_reg(struct stv *state, u16 reg, u8 val)
 }
 
 static inline int i2c_read_regs16(struct i2c_adapter *adapter, u8 adr,
-				 u16 reg, u8 *val, int count)
+				  u16 reg, u8 *val, int count)
 {
 	u8 msg[2] = {reg >> 8, reg & 0xff};
 	struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0,
@@ -176,7 +176,7 @@ static inline int i2c_read_regs16(struct i2c_adapter *adapter, u8 adr,
 
 	if (i2c_transfer(adapter, msgs, 2) != 2) {
 		dev_warn(&adapter->dev, "i2c read error ([%02x] %04x)\n",
-			adr, reg);
+			 adr, reg);
 		return -EREMOTEIO;
 	}
 	return 0;
@@ -185,7 +185,7 @@ static inline int i2c_read_regs16(struct i2c_adapter *adapter, u8 adr,
 static int read_reg(struct stv *state, u16 reg, u8 *val)
 {
 	return i2c_read_regs16(state->base->i2c, state->base->adr,
-		reg, val, 1);
+			       reg, val, 1);
 }
 
 static int read_regs(struct stv *state, u16 reg, u8 *val, int len)
@@ -473,16 +473,16 @@ static int get_cur_symbol_rate(struct stv *state, u32 *p_symbol_rate)
 	read_reg(state, RSTV0910_P2_TMGREG1 + state->regoff, &tim_offs1);
 	read_reg(state, RSTV0910_P2_TMGREG0 + state->regoff, &tim_offs0);
 
-	symbol_rate = ((u32) symb_freq3 << 24) | ((u32) symb_freq2 << 16) |
-		((u32) symb_freq1 << 8) | (u32) symb_freq0;
-	timing_offset = ((u32) tim_offs2 << 16) | ((u32) tim_offs1 << 8) |
-		(u32) tim_offs0;
+	symbol_rate = ((u32)symb_freq3 << 24) | ((u32)symb_freq2 << 16) |
+		((u32)symb_freq1 << 8) | (u32)symb_freq0;
+	timing_offset = ((u32)tim_offs2 << 16) | ((u32)tim_offs1 << 8) |
+		(u32)tim_offs0;
 
-	if ((timing_offset & (1<<23)) != 0)
+	if ((timing_offset & (1 << 23)) != 0)
 		timing_offset |= 0xFF000000; /* Sign extent */
 
-	symbol_rate = (u32) (((u64) symbol_rate * state->base->mclk) >> 32);
-	timing_offset = (s32) (((s64) symbol_rate * (s64) timing_offset) >> 29);
+	symbol_rate = (u32)(((u64)symbol_rate * state->base->mclk) >> 32);
+	timing_offset = (s32)(((s64)symbol_rate * (s64)timing_offset) >> 29);
 
 	*p_symbol_rate = symbol_rate + timing_offset;
 
@@ -498,9 +498,9 @@ static int get_signal_parameters(struct stv *state)
 
 	if (state->receive_mode == RCVMODE_DVBS2) {
 		read_reg(state, RSTV0910_P2_DMDMODCOD + state->regoff, &tmp);
-		state->mod_cod = (enum fe_stv0910_mod_cod) ((tmp & 0x7c) >> 2);
+		state->mod_cod = (enum fe_stv0910_mod_cod)((tmp & 0x7c) >> 2);
 		state->pilots = (tmp & 0x01) != 0;
-		state->fectype = (enum dvbs2_fectype) ((tmp & 0x02) >> 1);
+		state->fectype = (enum dvbs2_fectype)((tmp & 0x02) >> 1);
 
 	} else if (state->receive_mode == RCVMODE_DVBS) {
 		read_reg(state, RSTV0910_P2_VITCURPUN + state->regoff, &tmp);
@@ -586,7 +586,7 @@ static int tracking_optimization(struct stv *state)
 }
 
 static s32 table_lookup(struct slookup *table,
-		       int table_size, u32 reg_value)
+			int table_size, u32 reg_value)
 {
 	s32 value;
 	int imin = 0;
@@ -595,15 +595,15 @@ static s32 table_lookup(struct slookup *table,
 	s32 reg_diff;
 
 	/* Assumes Table[0].RegValue > Table[imax].RegValue */
-	if (reg_value >= table[0].reg_value)
+	if (reg_value >= table[0].reg_value) {
 		value = table[0].value;
-	else if (reg_value <= table[imax].reg_value)
+	} else if (reg_value <= table[imax].reg_value) {
 		value = table[imax].value;
-	else {
-		while (imax-imin > 1) {
+	} else {
+		while ((imax - imin) > 1) {
 			i = (imax + imin) / 2;
 			if ((table[imin].reg_value >= reg_value) &&
-				(reg_value >= table[i].reg_value))
+			    (reg_value >= table[i].reg_value))
 				imax = i;
 			else
 				imin = i;
@@ -649,13 +649,13 @@ static int get_signal_to_noise(struct stv *state, s32 *signal_to_noise)
 		n_lookup = ARRAY_SIZE(s1_sn_lookup);
 		lookup = s1_sn_lookup;
 	}
-	data = (((u16)data1) << 8) | (u16) data0;
+	data = (((u16)data1) << 8) | (u16)data0;
 	*signal_to_noise = table_lookup(lookup, n_lookup, data);
 	return 0;
 }
 
 static int get_bit_error_rate_s(struct stv *state, u32 *bernumerator,
-			    u32 *berdenominator)
+				u32 *berdenominator)
 {
 	u8 regs[3];
 
@@ -669,8 +669,8 @@ static int get_bit_error_rate_s(struct stv *state, u32 *bernumerator,
 	if ((regs[0] & 0x80) == 0) {
 		state->last_berdenominator = 1 << ((state->berscale * 2) +
 						  10 + 3);
-		state->last_bernumerator = ((u32) (regs[0] & 0x7F) << 16) |
-			((u32) regs[1] << 8) | regs[2];
+		state->last_bernumerator = ((u32)(regs[0] & 0x7F) << 16) |
+			((u32)regs[1] << 8) | regs[2];
 		if (state->last_bernumerator < 256 && state->berscale < 6) {
 			state->berscale += 1;
 			status = write_reg(state, RSTV0910_P2_ERRCTRL1 +
@@ -730,7 +730,7 @@ static u32 dvbs2_nbch(enum dvbs2_mod_cod mod_cod, enum dvbs2_fectype fectype)
 }
 
 static int get_bit_error_rate_s2(struct stv *state, u32 *bernumerator,
-			     u32 *berdenominator)
+				 u32 *berdenominator)
 {
 	u8 regs[3];
 
@@ -742,11 +742,11 @@ static int get_bit_error_rate_s2(struct stv *state, u32 *bernumerator,
 
 	if ((regs[0] & 0x80) == 0) {
 		state->last_berdenominator =
-			dvbs2_nbch((enum dvbs2_mod_cod) state->mod_cod,
+			dvbs2_nbch((enum dvbs2_mod_cod)state->mod_cod,
 				   state->fectype) <<
 			(state->berscale * 2);
-		state->last_bernumerator = (((u32) regs[0] & 0x7F) << 16) |
-			((u32) regs[1] << 8) | regs[2];
+		state->last_bernumerator = (((u32)regs[0] & 0x7F) << 16) |
+			((u32)regs[1] << 8) | regs[2];
 		if (state->last_bernumerator < 256 && state->berscale < 6) {
 			state->berscale += 1;
 			write_reg(state, RSTV0910_P2_ERRCTRL1 + state->regoff,
@@ -764,7 +764,7 @@ static int get_bit_error_rate_s2(struct stv *state, u32 *bernumerator,
 }
 
 static int get_bit_error_rate(struct stv *state, u32 *bernumerator,
-			   u32 *berdenominator)
+			      u32 *berdenominator)
 {
 	*bernumerator = 0;
 	*berdenominator = 1;
@@ -1211,7 +1211,6 @@ static int probe(struct stv *state)
 	return 0;
 }
 
-
 static int gate_ctrl(struct dvb_frontend *fe, int enable)
 {
 	struct stv *state = fe->demodulator_priv;
@@ -1273,9 +1272,9 @@ static int manage_matype_info(struct stv *state)
 		u8 bbheader[2];
 
 		read_regs(state, RSTV0910_P2_MATSTR1 + state->regoff,
-			bbheader, 2);
+			  bbheader, 2);
 		state->feroll_off =
-			(enum fe_stv0910_roll_off) (bbheader[0] & 0x03);
+			(enum fe_stv0910_roll_off)(bbheader[0] & 0x03);
 		state->is_vcm = (bbheader[0] & 0x10) == 0;
 		state->is_standard_broadcast = (bbheader[0] & 0xFC) == 0xF0;
 	} else if (state->receive_mode == RCVMODE_DVBS) {
@@ -1295,8 +1294,9 @@ static int read_snr(struct dvb_frontend *fe)
 	if (!get_signal_to_noise(state, &snrval)) {
 		p->cnr.stat[0].scale = FE_SCALE_DECIBEL;
 		p->cnr.stat[0].uvalue = 100 * snrval; /* fix scale */
-	} else
+	} else {
 		p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
+	}
 
 	return 0;
 }
@@ -1328,12 +1328,12 @@ static void read_signal_strength(struct dvb_frontend *fe)
 
 	read_regs(state, RSTV0910_P2_AGCIQIN1 + state->regoff, reg, 2);
 
-	agc = (((u32) reg[0]) << 8) | reg[1];
+	agc = (((u32)reg[0]) << 8) | reg[1];
 
 	for (i = 0; i < 5; i += 1) {
 		read_regs(state, RSTV0910_P2_POWERI + state->regoff, reg, 2);
-		power += (u32) reg[0] * (u32) reg[0]
-			+ (u32) reg[1] * (u32) reg[1];
+		power += (u32)reg[0] * (u32)reg[0]
+			+ (u32)reg[1] * (u32)reg[1];
 		usleep_range(3000, 4000);
 	}
 	power /= 5;
@@ -1490,9 +1490,9 @@ static int read_status(struct dvb_frontend *fe, enum fe_status *status)
 		p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
 
 	/* read ber */
-	if (*status & FE_HAS_VITERBI)
+	if (*status & FE_HAS_VITERBI) {
 		read_ber(fe);
-	else {
+	} else {
 		p->pre_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
 		p->pre_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
 	}
@@ -1584,7 +1584,6 @@ static int tune(struct dvb_frontend *fe, bool re_tune,
 	return 0;
 }
 
-
 static int get_algo(struct dvb_frontend *fe)
 {
 	return DVBFE_ALGO_HW;
@@ -1697,7 +1696,7 @@ static struct dvb_frontend_ops stv0910_ops = {
 	.diseqc_send_burst              = send_burst,
 };
 
-static struct stv_base *match_base(struct i2c_adapter  *i2c, u8 adr)
+static struct stv_base *match_base(struct i2c_adapter *i2c, u8 adr)
 {
 	struct stv_base *p;
 
@@ -1728,7 +1727,7 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c,
 	struct stv *state;
 	struct stv_base *base;
 
-	state = kzalloc(sizeof(struct stv), GFP_KERNEL);
+	state = kzalloc(sizeof(*state), GFP_KERNEL);
 	if (!state)
 		return NULL;
 
@@ -1749,7 +1748,7 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c,
 		base->count++;
 		state->base = base;
 	} else {
-		base = kzalloc(sizeof(struct stv_base), GFP_KERNEL);
+		base = kzalloc(sizeof(*base), GFP_KERNEL);
 		if (!base)
 			goto fail;
 		base->i2c = i2c;
@@ -1762,7 +1761,7 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c,
 		state->base = base;
 		if (probe(state) < 0) {
 			dev_info(&i2c->dev, "No demod found at adr %02X on %s\n",
-				cfg->adr, dev_name(&i2c->dev));
+				 cfg->adr, dev_name(&i2c->dev));
 			kfree(base);
 			goto fail;
 		}
@@ -1773,7 +1772,7 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c,
 	state->nr = nr;
 
 	dev_info(&i2c->dev, "%s demod found at adr %02X on %s\n",
-		state->fe.ops.info.name, cfg->adr, dev_name(&i2c->dev));
+		 state->fe.ops.info.name, cfg->adr, dev_name(&i2c->dev));
 
 	stv0910_init_stats(state);
 
drivers/media/dvb-frontends/stv0910.h +2 -2
index e1ab6df7c805..fccd8d9b665f 100644
@@ -14,8 +14,8 @@ struct stv0910_cfg {
 
 #if IS_REACHABLE(CONFIG_DVB_STV0910)
 
-extern struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c,
-					   struct stv0910_cfg *cfg, int nr);
+struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c,
+				    struct stv0910_cfg *cfg, int nr);
 
 #else
 
Signature · 1 line
2.13.0
#4 lore raw

PATCH 4/7 dvb-frontends/stv0910: cosmetics: fixup comments, misc

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Fix up block comment style, whitespaces, c++ style comments et al.

---
 drivers/media/dvb-frontends/stv0910.c      |  401 +++---
 drivers/media/dvb-frontends/stv0910_regs.h | 1953 ++++++++++++++--------------
 2 files changed, 1181 insertions(+), 1173 deletions(-)
drivers/media/dvb-frontends/stv0910.c +204 -197
index 8dc767a118a0..e2162fa8cad6 100644
@@ -208,135 +208,135 @@ static int write_shared_reg(struct stv *state, u16 reg, u8 mask, u8 val)
 }
 
 static struct slookup s1_sn_lookup[] = {
-	{   0,    9242  },  /*C/N=  0dB*/
-	{   5,    9105  },  /*C/N=0.5dB*/
-	{  10,    8950  },  /*C/N=1.0dB*/
-	{  15,    8780  },  /*C/N=1.5dB*/
-	{  20,    8566  },  /*C/N=2.0dB*/
-	{  25,    8366  },  /*C/N=2.5dB*/
-	{  30,    8146  },  /*C/N=3.0dB*/
-	{  35,    7908  },  /*C/N=3.5dB*/
-	{  40,    7666  },  /*C/N=4.0dB*/
-	{  45,    7405  },  /*C/N=4.5dB*/
-	{  50,    7136  },  /*C/N=5.0dB*/
-	{  55,    6861  },  /*C/N=5.5dB*/
-	{  60,    6576  },  /*C/N=6.0dB*/
-	{  65,    6330  },  /*C/N=6.5dB*/
-	{  70,    6048  },  /*C/N=7.0dB*/
-	{  75,    5768  },  /*C/N=7.5dB*/
-	{  80,    5492  },  /*C/N=8.0dB*/
-	{  85,    5224  },  /*C/N=8.5dB*/
-	{  90,    4959  },  /*C/N=9.0dB*/
-	{  95,    4709  },  /*C/N=9.5dB*/
-	{  100,   4467  },  /*C/N=10.0dB*/
-	{  105,   4236  },  /*C/N=10.5dB*/
-	{  110,   4013  },  /*C/N=11.0dB*/
-	{  115,   3800  },  /*C/N=11.5dB*/
-	{  120,   3598  },  /*C/N=12.0dB*/
-	{  125,   3406  },  /*C/N=12.5dB*/
-	{  130,   3225  },  /*C/N=13.0dB*/
-	{  135,   3052  },  /*C/N=13.5dB*/
-	{  140,   2889  },  /*C/N=14.0dB*/
-	{  145,   2733  },  /*C/N=14.5dB*/
-	{  150,   2587  },  /*C/N=15.0dB*/
-	{  160,   2318  },  /*C/N=16.0dB*/
-	{  170,   2077  },  /*C/N=17.0dB*/
-	{  180,   1862  },  /*C/N=18.0dB*/
-	{  190,   1670  },  /*C/N=19.0dB*/
-	{  200,   1499  },  /*C/N=20.0dB*/
-	{  210,   1347  },  /*C/N=21.0dB*/
-	{  220,   1213  },  /*C/N=22.0dB*/
-	{  230,   1095  },  /*C/N=23.0dB*/
-	{  240,    992  },  /*C/N=24.0dB*/
-	{  250,    900  },  /*C/N=25.0dB*/
-	{  260,    826  },  /*C/N=26.0dB*/
-	{  270,    758  },  /*C/N=27.0dB*/
-	{  280,    702  },  /*C/N=28.0dB*/
-	{  290,    653  },  /*C/N=29.0dB*/
-	{  300,    613  },  /*C/N=30.0dB*/
-	{  310,    579  },  /*C/N=31.0dB*/
-	{  320,    550  },  /*C/N=32.0dB*/
-	{  330,    526  },  /*C/N=33.0dB*/
-	{  350,    490  },  /*C/N=33.0dB*/
-	{  400,    445  },  /*C/N=40.0dB*/
-	{  450,    430  },  /*C/N=45.0dB*/
-	{  500,    426  },  /*C/N=50.0dB*/
-	{  510,    425  }   /*C/N=51.0dB*/
+	{   0,    9242  }, /* C/N=   0dB */
+	{   5,    9105  }, /* C/N= 0.5dB */
+	{  10,    8950  }, /* C/N= 1.0dB */
+	{  15,    8780  }, /* C/N= 1.5dB */
+	{  20,    8566  }, /* C/N= 2.0dB */
+	{  25,    8366  }, /* C/N= 2.5dB */
+	{  30,    8146  }, /* C/N= 3.0dB */
+	{  35,    7908  }, /* C/N= 3.5dB */
+	{  40,    7666  }, /* C/N= 4.0dB */
+	{  45,    7405  }, /* C/N= 4.5dB */
+	{  50,    7136  }, /* C/N= 5.0dB */
+	{  55,    6861  }, /* C/N= 5.5dB */
+	{  60,    6576  }, /* C/N= 6.0dB */
+	{  65,    6330  }, /* C/N= 6.5dB */
+	{  70,    6048  }, /* C/N= 7.0dB */
+	{  75,    5768  }, /* C/N= 7.5dB */
+	{  80,    5492  }, /* C/N= 8.0dB */
+	{  85,    5224  }, /* C/N= 8.5dB */
+	{  90,    4959  }, /* C/N= 9.0dB */
+	{  95,    4709  }, /* C/N= 9.5dB */
+	{  100,   4467  }, /* C/N=10.0dB */
+	{  105,   4236  }, /* C/N=10.5dB */
+	{  110,   4013  }, /* C/N=11.0dB */
+	{  115,   3800  }, /* C/N=11.5dB */
+	{  120,   3598  }, /* C/N=12.0dB */
+	{  125,   3406  }, /* C/N=12.5dB */
+	{  130,   3225  }, /* C/N=13.0dB */
+	{  135,   3052  }, /* C/N=13.5dB */
+	{  140,   2889  }, /* C/N=14.0dB */
+	{  145,   2733  }, /* C/N=14.5dB */
+	{  150,   2587  }, /* C/N=15.0dB */
+	{  160,   2318  }, /* C/N=16.0dB */
+	{  170,   2077  }, /* C/N=17.0dB */
+	{  180,   1862  }, /* C/N=18.0dB */
+	{  190,   1670  }, /* C/N=19.0dB */
+	{  200,   1499  }, /* C/N=20.0dB */
+	{  210,   1347  }, /* C/N=21.0dB */
+	{  220,   1213  }, /* C/N=22.0dB */
+	{  230,   1095  }, /* C/N=23.0dB */
+	{  240,    992  }, /* C/N=24.0dB */
+	{  250,    900  }, /* C/N=25.0dB */
+	{  260,    826  }, /* C/N=26.0dB */
+	{  270,    758  }, /* C/N=27.0dB */
+	{  280,    702  }, /* C/N=28.0dB */
+	{  290,    653  }, /* C/N=29.0dB */
+	{  300,    613  }, /* C/N=30.0dB */
+	{  310,    579  }, /* C/N=31.0dB */
+	{  320,    550  }, /* C/N=32.0dB */
+	{  330,    526  }, /* C/N=33.0dB */
+	{  350,    490  }, /* C/N=33.0dB */
+	{  400,    445  }, /* C/N=40.0dB */
+	{  450,    430  }, /* C/N=45.0dB */
+	{  500,    426  }, /* C/N=50.0dB */
+	{  510,    425  }  /* C/N=51.0dB */
 };
 
 static struct slookup s2_sn_lookup[] = {
-	{  -30,  13950  },  /*C/N=-2.5dB*/
-	{  -25,  13580  },  /*C/N=-2.5dB*/
-	{  -20,  13150  },  /*C/N=-2.0dB*/
-	{  -15,  12760  },  /*C/N=-1.5dB*/
-	{  -10,  12345  },  /*C/N=-1.0dB*/
-	{   -5,  11900  },  /*C/N=-0.5dB*/
-	{    0,  11520  },  /*C/N=   0dB*/
-	{    5,  11080  },  /*C/N= 0.5dB*/
-	{   10,  10630  },  /*C/N= 1.0dB*/
-	{   15,  10210  },  /*C/N= 1.5dB*/
-	{   20,   9790  },  /*C/N= 2.0dB*/
-	{   25,   9390  },  /*C/N= 2.5dB*/
-	{   30,   8970  },  /*C/N= 3.0dB*/
-	{   35,   8575  },  /*C/N= 3.5dB*/
-	{   40,   8180  },  /*C/N= 4.0dB*/
-	{   45,   7800  },  /*C/N= 4.5dB*/
-	{   50,   7430  },  /*C/N= 5.0dB*/
-	{   55,   7080  },  /*C/N= 5.5dB*/
-	{   60,   6720  },  /*C/N= 6.0dB*/
-	{   65,   6320  },  /*C/N= 6.5dB*/
-	{   70,   6060  },  /*C/N= 7.0dB*/
-	{   75,   5760  },  /*C/N= 7.5dB*/
-	{   80,   5480  },  /*C/N= 8.0dB*/
-	{   85,   5200  },  /*C/N= 8.5dB*/
-	{   90,   4930  },  /*C/N= 9.0dB*/
-	{   95,   4680  },  /*C/N= 9.5dB*/
-	{  100,   4425  },  /*C/N=10.0dB*/
-	{  105,   4210  },  /*C/N=10.5dB*/
-	{  110,   3980  },  /*C/N=11.0dB*/
-	{  115,   3765  },  /*C/N=11.5dB*/
-	{  120,   3570  },  /*C/N=12.0dB*/
-	{  125,   3315  },  /*C/N=12.5dB*/
-	{  130,   3140  },  /*C/N=13.0dB*/
-	{  135,   2980  },  /*C/N=13.5dB*/
-	{  140,   2820  },  /*C/N=14.0dB*/
-	{  145,   2670  },  /*C/N=14.5dB*/
-	{  150,   2535  },  /*C/N=15.0dB*/
-	{  160,   2270  },  /*C/N=16.0dB*/
-	{  170,   2035  },  /*C/N=17.0dB*/
-	{  180,   1825  },  /*C/N=18.0dB*/
-	{  190,   1650  },  /*C/N=19.0dB*/
-	{  200,   1485  },  /*C/N=20.0dB*/
-	{  210,   1340  },  /*C/N=21.0dB*/
-	{  220,   1212  },  /*C/N=22.0dB*/
-	{  230,   1100  },  /*C/N=23.0dB*/
-	{  240,   1000  },  /*C/N=24.0dB*/
-	{  250,    910  },  /*C/N=25.0dB*/
-	{  260,    836  },  /*C/N=26.0dB*/
-	{  270,    772  },  /*C/N=27.0dB*/
-	{  280,    718  },  /*C/N=28.0dB*/
-	{  290,    671  },  /*C/N=29.0dB*/
-	{  300,    635  },  /*C/N=30.0dB*/
-	{  310,    602  },  /*C/N=31.0dB*/
-	{  320,    575  },  /*C/N=32.0dB*/
-	{  330,    550  },  /*C/N=33.0dB*/
-	{  350,    517  },  /*C/N=35.0dB*/
-	{  400,    480  },  /*C/N=40.0dB*/
-	{  450,    466  },  /*C/N=45.0dB*/
-	{  500,    464  },  /*C/N=50.0dB*/
-	{  510,    463  },  /*C/N=51.0dB*/
+	{  -30,  13950  }, /* C/N=-2.5dB */
+	{  -25,  13580  }, /* C/N=-2.5dB */
+	{  -20,  13150  }, /* C/N=-2.0dB */
+	{  -15,  12760  }, /* C/N=-1.5dB */
+	{  -10,  12345  }, /* C/N=-1.0dB */
+	{   -5,  11900  }, /* C/N=-0.5dB */
+	{    0,  11520  }, /* C/N=   0dB */
+	{    5,  11080  }, /* C/N= 0.5dB */
+	{   10,  10630  }, /* C/N= 1.0dB */
+	{   15,  10210  }, /* C/N= 1.5dB */
+	{   20,   9790  }, /* C/N= 2.0dB */
+	{   25,   9390  }, /* C/N= 2.5dB */
+	{   30,   8970  }, /* C/N= 3.0dB */
+	{   35,   8575  }, /* C/N= 3.5dB */
+	{   40,   8180  }, /* C/N= 4.0dB */
+	{   45,   7800  }, /* C/N= 4.5dB */
+	{   50,   7430  }, /* C/N= 5.0dB */
+	{   55,   7080  }, /* C/N= 5.5dB */
+	{   60,   6720  }, /* C/N= 6.0dB */
+	{   65,   6320  }, /* C/N= 6.5dB */
+	{   70,   6060  }, /* C/N= 7.0dB */
+	{   75,   5760  }, /* C/N= 7.5dB */
+	{   80,   5480  }, /* C/N= 8.0dB */
+	{   85,   5200  }, /* C/N= 8.5dB */
+	{   90,   4930  }, /* C/N= 9.0dB */
+	{   95,   4680  }, /* C/N= 9.5dB */
+	{  100,   4425  }, /* C/N=10.0dB */
+	{  105,   4210  }, /* C/N=10.5dB */
+	{  110,   3980  }, /* C/N=11.0dB */
+	{  115,   3765  }, /* C/N=11.5dB */
+	{  120,   3570  }, /* C/N=12.0dB */
+	{  125,   3315  }, /* C/N=12.5dB */
+	{  130,   3140  }, /* C/N=13.0dB */
+	{  135,   2980  }, /* C/N=13.5dB */
+	{  140,   2820  }, /* C/N=14.0dB */
+	{  145,   2670  }, /* C/N=14.5dB */
+	{  150,   2535  }, /* C/N=15.0dB */
+	{  160,   2270  }, /* C/N=16.0dB */
+	{  170,   2035  }, /* C/N=17.0dB */
+	{  180,   1825  }, /* C/N=18.0dB */
+	{  190,   1650  }, /* C/N=19.0dB */
+	{  200,   1485  }, /* C/N=20.0dB */
+	{  210,   1340  }, /* C/N=21.0dB */
+	{  220,   1212  }, /* C/N=22.0dB */
+	{  230,   1100  }, /* C/N=23.0dB */
+	{  240,   1000  }, /* C/N=24.0dB */
+	{  250,    910  }, /* C/N=25.0dB */
+	{  260,    836  }, /* C/N=26.0dB */
+	{  270,    772  }, /* C/N=27.0dB */
+	{  280,    718  }, /* C/N=28.0dB */
+	{  290,    671  }, /* C/N=29.0dB */
+	{  300,    635  }, /* C/N=30.0dB */
+	{  310,    602  }, /* C/N=31.0dB */
+	{  320,    575  }, /* C/N=32.0dB */
+	{  330,    550  }, /* C/N=33.0dB */
+	{  350,    517  }, /* C/N=35.0dB */
+	{  400,    480  }, /* C/N=40.0dB */
+	{  450,    466  }, /* C/N=45.0dB */
+	{  500,    464  }, /* C/N=50.0dB */
+	{  510,    463  }, /* C/N=51.0dB */
 };
 
 static struct slookup padc_lookup[] = {
-	{    0,  118000 }, /* PADC=+0dBm  */
-	{ -100,  93600  }, /* PADC=-1dBm  */
-	{ -200,  74500  }, /* PADC=-2dBm  */
-	{ -300,  59100  }, /* PADC=-3dBm  */
-	{ -400,  47000  }, /* PADC=-4dBm  */
-	{ -500,  37300  }, /* PADC=-5dBm  */
-	{ -600,  29650  }, /* PADC=-6dBm  */
-	{ -700,  23520  }, /* PADC=-7dBm  */
-	{ -900,  14850  }, /* PADC=-9dBm  */
+	{    0,  118000 }, /* PADC= +0dBm */
+	{ -100,  93600  }, /* PADC= -1dBm */
+	{ -200,  74500  }, /* PADC= -2dBm */
+	{ -300,  59100  }, /* PADC= -3dBm */
+	{ -400,  47000  }, /* PADC= -4dBm */
+	{ -500,  37300  }, /* PADC= -5dBm */
+	{ -600,  29650  }, /* PADC= -6dBm */
+	{ -700,  23520  }, /* PADC= -7dBm */
+	{ -900,  14850  }, /* PADC= -9dBm */
 	{ -1100, 9380   }, /* PADC=-11dBm */
 	{ -1300, 5910   }, /* PADC=-13dBm */
 	{ -1500, 3730   }, /* PADC=-15dBm */
@@ -350,7 +350,8 @@ static struct slookup padc_lookup[] = {
  * Tracking carrier loop carrier QPSK 1/4 to 8PSK 9/10 long Frame
  *********************************************************************/
 static u8 s2car_loop[] =	{
-	/* Modcod  2MPon 2MPoff 5MPon 5MPoff 10MPon 10MPoff
+	/*
+	 * Modcod  2MPon 2MPoff 5MPon 5MPoff 10MPon 10MPoff
 	 * 20MPon 20MPoff 30MPon 30MPoff
 	 */
 
@@ -393,7 +394,8 @@ static u8 s2car_loop[] =	{
 	 * Tracking carrier loop carrier 16APSK 2/3 to 32APSK 9/10 long Frame
 	 **********************************************************************/
 
-	/* Modcod 2MPon  2MPoff 5MPon 5MPoff 10MPon 10MPoff 20MPon
+	/*
+	 * Modcod 2MPon  2MPoff 5MPon 5MPoff 10MPon 10MPoff 20MPon
 	 * 20MPoff 30MPon 30MPoff
 	 */
 
@@ -692,24 +694,24 @@ static int get_bit_error_rate_s(struct stv *state, u32 *bernumerator,
 static u32 dvbs2_nbch(enum dvbs2_mod_cod mod_cod, enum dvbs2_fectype fectype)
 {
 	static u32 nbch[][2] = {
-		{    0,     0}, /* DUMMY_PLF */
-		{16200,  3240}, /* QPSK_1_4, */
-		{21600,  5400}, /* QPSK_1_3, */
-		{25920,  6480}, /* QPSK_2_5, */
-		{32400,  7200}, /* QPSK_1_2, */
-		{38880,  9720}, /* QPSK_3_5, */
-		{43200, 10800}, /* QPSK_2_3, */
-		{48600, 11880}, /* QPSK_3_4, */
-		{51840, 12600}, /* QPSK_4_5, */
-		{54000, 13320}, /* QPSK_5_6, */
-		{57600, 14400}, /* QPSK_8_9, */
-		{58320, 16000}, /* QPSK_9_10, */
-		{43200,  9720}, /* 8PSK_3_5, */
-		{48600, 10800}, /* 8PSK_2_3, */
-		{51840, 11880}, /* 8PSK_3_4, */
-		{54000, 13320}, /* 8PSK_5_6, */
-		{57600, 14400}, /* 8PSK_8_9, */
-		{58320, 16000}, /* 8PSK_9_10, */
+		{    0,     0}, /* DUMMY_PLF   */
+		{16200,  3240}, /* QPSK_1_4,   */
+		{21600,  5400}, /* QPSK_1_3,   */
+		{25920,  6480}, /* QPSK_2_5,   */
+		{32400,  7200}, /* QPSK_1_2,   */
+		{38880,  9720}, /* QPSK_3_5,   */
+		{43200, 10800}, /* QPSK_2_3,   */
+		{48600, 11880}, /* QPSK_3_4,   */
+		{51840, 12600}, /* QPSK_4_5,   */
+		{54000, 13320}, /* QPSK_5_6,   */
+		{57600, 14400}, /* QPSK_8_9,   */
+		{58320, 16000}, /* QPSK_9_10,  */
+		{43200,  9720}, /* 8PSK_3_5,   */
+		{48600, 10800}, /* 8PSK_2_3,   */
+		{51840, 11880}, /* 8PSK_3_4,   */
+		{54000, 13320}, /* 8PSK_5_6,   */
+		{57600, 14400}, /* 8PSK_8_9,   */
+		{58320, 16000}, /* 8PSK_9_10,  */
 		{43200, 10800}, /* 16APSK_2_3, */
 		{48600, 11880}, /* 16APSK_3_4, */
 		{51840, 12600}, /* 16APSK_4_5, */
@@ -853,7 +855,7 @@ static int stop(struct stv *state)
 		write_reg(state, RSTV0910_P2_TSCFGH + state->regoff,
 			  state->tscfgh | 0x01);
 		read_reg(state, RSTV0910_P2_PDELCTRL1 + state->regoff, &tmp);
-		tmp &= ~0x01; /*release reset DVBS2 packet delin*/
+		tmp &= ~0x01; /* release reset DVBS2 packet delin */
 		write_reg(state, RSTV0910_P2_PDELCTRL1 + state->regoff, tmp);
 		/* Blind optim*/
 		write_reg(state, RSTV0910_P2_AGC2O + state->regoff, 0x5B);
@@ -870,38 +872,38 @@ static int init_search_param(struct stv *state)
 	u8 tmp;
 
 	read_reg(state, RSTV0910_P2_PDELCTRL1 + state->regoff, &tmp);
-	tmp |= 0x20; // Filter_en (no effect if SIS=non-MIS
+	tmp |= 0x20; /* Filter_en (no effect if SIS=non-MIS */
 	write_reg(state, RSTV0910_P2_PDELCTRL1 + state->regoff, tmp);
 
 	read_reg(state, RSTV0910_P2_PDELCTRL2 + state->regoff, &tmp);
-	tmp &= ~0x02; // frame mode = 0
+	tmp &= ~0x02; /* frame mode = 0 */
 	write_reg(state, RSTV0910_P2_PDELCTRL2 + state->regoff, tmp);
 
 	write_reg(state, RSTV0910_P2_UPLCCST0 + state->regoff, 0xe0);
 	write_reg(state, RSTV0910_P2_ISIBITENA + state->regoff, 0x00);
 
 	read_reg(state, RSTV0910_P2_TSSTATEM + state->regoff, &tmp);
-	tmp &= ~0x01; // nosync = 0, in case next signal is standard TS
+	tmp &= ~0x01; /* nosync = 0, in case next signal is standard TS */
 	write_reg(state, RSTV0910_P2_TSSTATEM + state->regoff, tmp);
 
 	read_reg(state, RSTV0910_P2_TSCFGL + state->regoff, &tmp);
-	tmp &= ~0x04; // embindvb = 0
+	tmp &= ~0x04; /* embindvb = 0 */
 	write_reg(state, RSTV0910_P2_TSCFGL + state->regoff, tmp);
 
 	read_reg(state, RSTV0910_P2_TSINSDELH + state->regoff, &tmp);
-	tmp &= ~0x80; // syncbyte = 0
+	tmp &= ~0x80; /* syncbyte = 0 */
 	write_reg(state, RSTV0910_P2_TSINSDELH + state->regoff, tmp);
 
 	read_reg(state, RSTV0910_P2_TSINSDELM + state->regoff, &tmp);
-	tmp &= ~0x08; // token = 0
+	tmp &= ~0x08; /* token = 0 */
 	write_reg(state, RSTV0910_P2_TSINSDELM + state->regoff, tmp);
 
 	read_reg(state, RSTV0910_P2_TSDLYSET2 + state->regoff, &tmp);
-	tmp &= ~0x30; // hysteresis threshold = 0
+	tmp &= ~0x30; /* hysteresis threshold = 0 */
 	write_reg(state, RSTV0910_P2_TSDLYSET2 + state->regoff, tmp);
 
 	read_reg(state, RSTV0910_P2_PDELCTRL0 + state->regoff, &tmp);
-	tmp = (tmp & ~0x30) | 0x10; // isi obs mode = 1, observe min ISI
+	tmp = (tmp & ~0x30) | 0x10; /* isi obs mode = 1, observe min ISI */
 	write_reg(state, RSTV0910_P2_PDELCTRL0 + state->regoff, tmp);
 
 	return 0;
@@ -952,11 +954,11 @@ static int set_vth_default(struct stv *state)
 static int set_vth(struct stv *state)
 {
 	static struct slookup vthlookup_table[] = {
-		{250,	8780}, /*C/N=1.5dB*/
-		{100,	7405}, /*C/N=4.5dB*/
-		{40,	6330}, /*C/N=6.5dB*/
-		{12,	5224}, /*C/N=8.5dB*/
-		{5,	4236} /*C/N=10.5dB*/
+		{250,	8780}, /* C/N= 1.5dB */
+		{100,	7405}, /* C/N= 4.5dB */
+		{40,	6330}, /* C/N= 6.5dB */
+		{12,	5224}, /* C/N= 8.5dB */
+		{5,	4236}  /* C/N=10.5dB */
 	};
 
 	int i;
@@ -1001,7 +1003,8 @@ static int start(struct stv *state, struct dtv_frontend_properties *p)
 	init_search_param(state);
 
 	if (p->stream_id != NO_STREAM_ID_FILTER) {
-		/* Backwards compatibility to "crazy" API.
+		/*
+		 * Backwards compatibility to "crazy" API.
 		 * PRBS X root cannot be 0, so this should always work.
 		 */
 		if (p->stream_id & 0xffffff00)
@@ -1022,22 +1025,22 @@ static int start(struct stv *state, struct dtv_frontend_properties *p)
 		state->cur_scrambling_code = scrambling_code;
 	}
 
-	if (p->symbol_rate <= 1000000) {  /* SR <=1Msps */
+	if (p->symbol_rate <= 1000000) { /* SR <=1Msps */
 		state->demod_timeout = 3000;
 		state->fec_timeout = 2000;
-	} else if (p->symbol_rate <= 2000000) {  /* 1Msps < SR <=2Msps */
+	} else if (p->symbol_rate <= 2000000) { /* 1Msps < SR <=2Msps */
 		state->demod_timeout = 2500;
 		state->fec_timeout = 1300;
-	} else if (p->symbol_rate <= 5000000) {  /* 2Msps< SR <=5Msps */
+	} else if (p->symbol_rate <= 5000000) { /* 2Msps< SR <=5Msps */
 		state->demod_timeout = 1000;
 		state->fec_timeout = 650;
-	} else if (p->symbol_rate <= 10000000) {  /* 5Msps< SR <=10Msps */
+	} else if (p->symbol_rate <= 10000000) { /* 5Msps< SR <=10Msps */
 		state->demod_timeout = 700;
 		state->fec_timeout = 350;
-	} else if (p->symbol_rate < 20000000) {  /* 10Msps< SR <=20Msps */
+	} else if (p->symbol_rate < 20000000) { /* 10Msps< SR <=20Msps */
 		state->demod_timeout = 400;
 		state->fec_timeout = 200;
-	} else {  /* SR >=20Msps */
+	} else { /* SR >=20Msps */
 		state->demod_timeout = 300;
 		state->fec_timeout = 200;
 	}
@@ -1065,7 +1068,7 @@ static int start(struct stv *state, struct dtv_frontend_properties *p)
 
 	enable_puncture_rate(state, FEC_NONE);
 
-	/* 8PSK 3/5, 8PSK 2/3 Poff tracking optimization WA*/
+	/* 8PSK 3/5, 8PSK 2/3 Poff tracking optimization WA */
 	write_reg(state, RSTV0910_P2_ACLC2S2Q + state->regoff, 0x0B);
 	write_reg(state, RSTV0910_P2_ACLC2S28 + state->regoff, 0x0A);
 	write_reg(state, RSTV0910_P2_BCLC2S2Q + state->regoff, 0x84);
@@ -1078,8 +1081,10 @@ static int start(struct stv *state, struct dtv_frontend_properties *p)
 	write_reg(state, RSTV0910_P2_BCLC2S216A + state->regoff, 0x84);
 	write_reg(state, RSTV0910_P2_BCLC2S232A + state->regoff, 0x84);
 
-	/* Reset CAR3, bug DVBS2->DVBS1 lock*/
-	/* Note: The bit is only pulsed -> no lock on shared register needed */
+	/*
+	 * Reset CAR3, bug DVBS2->DVBS1 lock
+	 * Note: The bit is only pulsed -> no lock on shared register needed
+	 */
 	write_reg(state, RSTV0910_TSTRES0, state->nr ? 0x04 : 0x08);
 	write_reg(state, RSTV0910_TSTRES0, 0);
 
@@ -1098,7 +1103,7 @@ static int start(struct stv *state, struct dtv_frontend_properties *p)
 	write_reg(state, RSTV0910_P2_CFRUP1 + state->regoff,
 		  (freq >> 8) & 0xff);
 	write_reg(state, RSTV0910_P2_CFRUP0 + state->regoff, (freq & 0xff));
-	/*CFR Low Setting*/
+	/* CFR Low Setting */
 	freq = -freq;
 	write_reg(state, RSTV0910_P2_CFRLOW1 + state->regoff,
 		  (freq >> 8) & 0xff);
@@ -1120,7 +1125,7 @@ static int start(struct stv *state, struct dtv_frontend_properties *p)
 
 static int init_diseqc(struct stv *state)
 {
-	u16 offs = state->nr ? 0x40 : 0;  /* Address offset */
+	u16 offs = state->nr ? 0x40 : 0; /* Address offset */
 	u8 freq = ((state->base->mclk + 11000 * 32) / (22000 * 32));
 
 	/* Disable receiver */
@@ -1144,26 +1149,26 @@ static int probe(struct stv *state)
 	if (id != 0x51)
 		return -EINVAL;
 
-	 /* Configure the I2C repeater to off */
+	/* Configure the I2C repeater to off */
 	write_reg(state, RSTV0910_P1_I2CRPT, 0x24);
 	/* Configure the I2C repeater to off */
 	write_reg(state, RSTV0910_P2_I2CRPT, 0x24);
 	/* Set the I2C to oversampling ratio */
 	write_reg(state, RSTV0910_I2CCFG, 0x88); /* state->i2ccfg */
 
-	write_reg(state, RSTV0910_OUTCFG,    0x00);  /* OUTCFG */
-	write_reg(state, RSTV0910_PADCFG,    0x05);  /* RFAGC Pads Dev = 05 */
-	write_reg(state, RSTV0910_SYNTCTRL,  0x02);  /* SYNTCTRL */
-	write_reg(state, RSTV0910_TSGENERAL, state->tsgeneral);  /* TSGENERAL */
-	write_reg(state, RSTV0910_CFGEXT,    0x02);  /* CFGEXT */
+	write_reg(state, RSTV0910_OUTCFG,    0x00); /* OUTCFG */
+	write_reg(state, RSTV0910_PADCFG,    0x05); /* RFAGC Pads Dev = 05 */
+	write_reg(state, RSTV0910_SYNTCTRL,  0x02); /* SYNTCTRL */
+	write_reg(state, RSTV0910_TSGENERAL, state->tsgeneral); /* TSGENERAL */
+	write_reg(state, RSTV0910_CFGEXT,    0x02); /* CFGEXT */
 
 	if (state->single)
-		write_reg(state, RSTV0910_GENCFG, 0x14);  /* GENCFG */
+		write_reg(state, RSTV0910_GENCFG, 0x14); /* GENCFG */
 	else
-		write_reg(state, RSTV0910_GENCFG, 0x15);  /* GENCFG */
+		write_reg(state, RSTV0910_GENCFG, 0x15); /* GENCFG */
 
-	write_reg(state, RSTV0910_P1_TNRCFG2, 0x02);  /* IQSWAP = 0 */
-	write_reg(state, RSTV0910_P2_TNRCFG2, 0x82);  /* IQSWAP = 1 */
+	write_reg(state, RSTV0910_P1_TNRCFG2, 0x02); /* IQSWAP = 0 */
+	write_reg(state, RSTV0910_P2_TNRCFG2, 0x82); /* IQSWAP = 1 */
 
 	write_reg(state, RSTV0910_P1_CAR3CFG, 0x02);
 	write_reg(state, RSTV0910_P2_CAR3CFG, 0x02);
@@ -1184,7 +1189,7 @@ static int probe(struct stv *state)
 	/* TS output */
 	write_reg(state, RSTV0910_P1_TSCFGH, state->tscfgh | 0x01);
 	write_reg(state, RSTV0910_P1_TSCFGH, state->tscfgh);
-	write_reg(state, RSTV0910_P1_TSCFGM, 0xC0);  /* Manual speed */
+	write_reg(state, RSTV0910_P1_TSCFGM, 0xC0); /* Manual speed */
 	write_reg(state, RSTV0910_P1_TSCFGL, 0x20);
 
 	/* Speed = 67.5 MHz */
@@ -1192,7 +1197,7 @@ static int probe(struct stv *state)
 
 	write_reg(state, RSTV0910_P2_TSCFGH, state->tscfgh | 0x01);
 	write_reg(state, RSTV0910_P2_TSCFGH, state->tscfgh);
-	write_reg(state, RSTV0910_P2_TSCFGM, 0xC0);  /* Manual speed */
+	write_reg(state, RSTV0910_P2_TSCFGM, 0xC0); /* Manual speed */
 	write_reg(state, RSTV0910_P2_TSCFGL, 0x20);
 
 	/* Speed = 67.5 MHz */
@@ -1425,7 +1430,8 @@ static int read_status(struct dvb_frontend *fe, enum fe_status *status)
 			manage_matype_info(state);
 
 			if (state->receive_mode == RCVMODE_DVBS2) {
-				/* FSTV0910_P2_MANUALSX_ROLLOFF,
+				/*
+				 * FSTV0910_P2_MANUALSX_ROLLOFF,
 				 * FSTV0910_P2_MANUALS2_ROLLOFF = 0
 				 */
 				state->demod_bits &= ~0x84;
@@ -1435,12 +1441,12 @@ static int read_status(struct dvb_frontend *fe, enum fe_status *status)
 				read_reg(state,
 					 RSTV0910_P2_PDELCTRL2 + state->regoff,
 					 &tmp);
-				/*reset DVBS2 packet delinator error counter */
+				/* reset DVBS2 packet delinator error counter */
 				tmp |= 0x40;
 				write_reg(state,
 					  RSTV0910_P2_PDELCTRL2 + state->regoff,
 					  tmp);
-				/*reset DVBS2 packet delinator error counter */
+				/* reset DVBS2 packet delinator error counter */
 				tmp &= ~0x40;
 				write_reg(state,
 					  RSTV0910_P2_PDELCTRL2 + state->regoff,
@@ -1462,11 +1468,12 @@ static int read_status(struct dvb_frontend *fe, enum fe_status *status)
 					  RSTV0910_P2_ERRCTRL1 + state->regoff,
 					  BER_SRC_S | state->berscale);
 			}
-			/*Reset the Total packet counter */
+			/* Reset the Total packet counter */
 			write_reg(state,
 				  RSTV0910_P2_FBERCPT4 + state->regoff, 0x00);
-			/* Reset the packet Error counter2 (and Set it to
-			 * infinit error count mode )
+			/*
+			 * Reset the packet Error counter2 (and Set it to
+			 * infinit error count mode)
 			 */
 			write_reg(state,
 				  RSTV0910_P2_ERRCTRL2 + state->regoff, 0xc1);
@@ -1683,17 +1690,17 @@ static struct dvb_frontend_ops stv0910_ops = {
 					  FE_CAN_MULTISTREAM
 	},
 	.sleep				= sleep,
-	.release                        = release,
-	.i2c_gate_ctrl                  = gate_ctrl,
+	.release			= release,
+	.i2c_gate_ctrl			= gate_ctrl,
 	.set_frontend			= set_parameters,
-	.get_frontend_algo              = get_algo,
-	.get_frontend                   = get_frontend,
-	.tune                           = tune,
+	.get_frontend_algo		= get_algo,
+	.get_frontend			= get_frontend,
+	.tune				= tune,
 	.read_status			= read_status,
 	.set_tone			= set_tone,
 
 	.diseqc_send_master_cmd		= send_master_cmd,
-	.diseqc_send_burst              = send_burst,
+	.diseqc_send_burst		= send_burst,
 };
 
 static struct stv_base *match_base(struct i2c_adapter *i2c, u8 adr)
@@ -1738,8 +1745,8 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c,
 	state->nr = nr;
 	state->regoff = state->nr ? 0 : 0x200;
 	state->search_range = 16000000;
-	state->demod_bits = 0x10;     /* Inversion : Auto with reset to 0 */
-	state->receive_mode   = RCVMODE_NONE;
+	state->demod_bits = 0x10; /* Inversion : Auto with reset to 0 */
+	state->receive_mode = RCVMODE_NONE;
 	state->cur_scrambling_code = (~0U);
 	state->single = cfg->single ? 1 : 0;
 
@@ -1767,8 +1774,8 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c,
 		}
 		list_add(&base->stvlist, &stvlist);
 	}
-	state->fe.ops               = stv0910_ops;
-	state->fe.demodulator_priv  = state;
+	state->fe.ops = stv0910_ops;
+	state->fe.demodulator_priv = state;
 	state->nr = nr;
 
 	dev_info(&i2c->dev, "%s demod found at adr %02X on %s\n",
drivers/media/dvb-frontends/stv0910_regs.h +977 -976

2,406 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.13.0

Part of the diff is not shown here. View the raw message.

#5 lore raw

PATCH 5/7 dvb-frontends/stv6111: coding style cleanup

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Fix up all remainders reported by checkpatch-strict.

---
 drivers/media/dvb-frontends/stv6111.c | 38 ++++++++++++++++++++---------------
 drivers/media/dvb-frontends/stv6111.h |  7 ++++---
 2 files changed, 26 insertions(+), 19 deletions(-)
drivers/media/dvb-frontends/stv6111.c +22 -16
index ce5b5ff936d5..91e24ba44c30 100644
@@ -298,7 +298,7 @@ static inline u32 muldiv32(u32 a, u32 b, u32 c)
 	tmp64 = (u64)a * (u64)b;
 	do_div(tmp64, c);
 
-	return (u32) tmp64;
+	return (u32)tmp64;
 }
 
 static int i2c_read(struct i2c_adapter *adap,
@@ -429,10 +429,10 @@ static int set_bandwidth(struct dvb_frontend *fe, u32 cutoff_frequency)
 		index = 6;
 	if (index > 50)
 		index = 50;
-	if ((state->reg[0x08] & ~0xFC) == ((index-6) << 2))
+	if ((state->reg[0x08] & ~0xFC) == ((index - 6) << 2))
 		return 0;
 
-	state->reg[0x08] = (state->reg[0x08] & ~0xFC) | ((index-6) << 2);
+	state->reg[0x08] = (state->reg[0x08] & ~0xFC) | ((index - 6) << 2);
 	state->reg[0x09] = (state->reg[0x09] & ~0x0C) | 0x08;
 	if (fe->ops.i2c_gate_ctrl)
 		fe->ops.i2c_gate_ctrl(fe, 1);
@@ -542,12 +542,12 @@ static s32 table_lookup(struct slookup *table, int table_size, u16 reg_value)
 	int i;
 
 	/* Assumes Table[0].RegValue < Table[imax].RegValue */
-	if (reg_value <= table[0].reg_value)
+	if (reg_value <= table[0].reg_value) {
 		gain = table[0].value;
-	else if (reg_value >= table[imax].reg_value)
+	} else if (reg_value >= table[imax].reg_value) {
 		gain = table[imax].value;
-	else {
-		while (imax-imin > 1) {
+	} else {
+		while ((imax - imin) > 1) {
 			i = (imax + imin) / 2;
 			if ((table[imin].reg_value <= reg_value) &&
 			    (reg_value <= table[i].reg_value))
@@ -558,9 +558,9 @@ static s32 table_lookup(struct slookup *table, int table_size, u16 reg_value)
 		reg_diff = table[imax].reg_value - table[imin].reg_value;
 		gain = table[imin].value;
 		if (reg_diff != 0)
-			gain += ((s32) (reg_value - table[imin].reg_value) *
+			gain += ((s32)(reg_value - table[imin].reg_value) *
 				(s32)(table[imax].value
-				- table[imin].value))/(reg_diff);
+				- table[imin].value)) / reg_diff;
 	}
 	return gain;
 }
@@ -587,27 +587,33 @@ static int get_rf_strength(struct dvb_frontend *fe, u16 *st)
 		if ((state->reg[0x02] & 0x80) == 0)
 			/* NF */
 			gain = table_lookup(lnagain_nf_lookup,
-				ARRAY_SIZE(lnagain_nf_lookup), reg & 0x1F);
+					    ARRAY_SIZE(lnagain_nf_lookup),
+					    reg & 0x1F);
 		else
 			/* IIP3 */
 			gain = table_lookup(lnagain_iip3_lookup,
-				ARRAY_SIZE(lnagain_iip3_lookup), reg & 0x1F);
+					    ARRAY_SIZE(lnagain_iip3_lookup),
+					    reg & 0x1F);
 
 		gain += table_lookup(gain_rfagc_lookup,
-				ARRAY_SIZE(gain_rfagc_lookup), rfagc);
+				     ARRAY_SIZE(gain_rfagc_lookup), rfagc);
+
 		gain -= 2400;
 	} else {
 		/* Channel Mode */
 		if ((state->reg[0x02] & 0x80) == 0) {
 			/* NF */
-			gain = table_lookup(gain_channel_agc_nf_lookup,
+			gain = table_lookup(
+				gain_channel_agc_nf_lookup,
 				ARRAY_SIZE(gain_channel_agc_nf_lookup), rfagc);
+
 			gain += 600;
 		} else {
 			/* IIP3 */
-			gain = table_lookup(gain_channel_agc_iip3_lookup,
+			gain = table_lookup(
+				gain_channel_agc_iip3_lookup,
 				ARRAY_SIZE(gain_channel_agc_iip3_lookup),
-					rfagc);
+				rfagc);
 		}
 	}
 
@@ -647,7 +653,7 @@ struct dvb_frontend *stv6111_attach(struct dvb_frontend *fe,
 	struct stv *state;
 	int stat;
 
-	state = kzalloc(sizeof(struct stv), GFP_KERNEL);
+	state = kzalloc(sizeof(*state), GFP_KERNEL);
 	if (!state)
 		return NULL;
 	state->adr = adr;
drivers/media/dvb-frontends/stv6111.h +4 -3
index 066dd70c9426..5bc1228dc9bd 100644
@@ -3,13 +3,14 @@
 
 #if IS_REACHABLE(CONFIG_DVB_STV6111)
 
-extern struct dvb_frontend *stv6111_attach(struct dvb_frontend *fe,
-				struct i2c_adapter *i2c, u8 adr);
+struct dvb_frontend *stv6111_attach(struct dvb_frontend *fe,
+				    struct i2c_adapter *i2c, u8 adr);
 
 #else
 
 static inline struct dvb_frontend *stv6111_attach(struct dvb_frontend *fe,
-				struct i2c_adapter *i2c, u8 adr)
+						  struct i2c_adapter *i2c,
+						  u8 adr)
 {
 	pr_warn("%s: Driver disabled by Kconfig\n", __func__);
 	return NULL;
Signature · 1 line
2.13.0
#6 lore raw

PATCH 6/7 dvb-frontends/stv6111: cosmetics: comments fixup, misc

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

---
 drivers/media/dvb-frontends/stv6111.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/media/dvb-frontends/stv6111.c +15 -15
index 91e24ba44c30..c4db5e6c18af 100644
@@ -42,7 +42,7 @@ struct slookup {
 };
 
 static struct slookup lnagain_nf_lookup[] = {
-	/*Gain *100dB*/      /*Reg*/
+	/* Gain *100dB // Reg */
 	{ 2572,	0 },
 	{ 2575, 1 },
 	{ 2580, 2 },
@@ -78,7 +78,7 @@ static struct slookup lnagain_nf_lookup[] = {
 };
 
 static struct slookup lnagain_iip3_lookup[] = {
-	/*Gain *100dB*/   /*reg*/
+	/* Gain *100dB // reg */
 	{ 1548,	0 },
 	{ 1552,	1 },
 	{ 1569,	2 },
@@ -114,7 +114,7 @@ static struct slookup lnagain_iip3_lookup[] = {
 };
 
 static struct slookup gain_rfagc_lookup[] = {
-	/*Gain *100dB*/   /*reg*/
+	/* Gain *100dB // reg */
 	{ 4870,	0x3000 },
 	{ 4850,	0x3C00 },
 	{ 4800,	0x4500 },
@@ -174,7 +174,7 @@ static struct slookup gain_rfagc_lookup[] = {
  * a different BB_MAG setting)
  */
 static struct slookup gain_channel_agc_nf_lookup[] = {
-	/*Gain *100dB*/   /*reg*/
+	/* Gain *100dB // reg */
 	{ 7082,	0x3000 },
 	{ 7052,	0x4000 },
 	{ 7007,	0x4600 },
@@ -233,7 +233,7 @@ static struct slookup gain_channel_agc_nf_lookup[] = {
 };
 
 static struct slookup gain_channel_agc_iip3_lookup[] = {
-	/*Gain *100dB*/   /*reg*/
+	/* Gain *100dB // reg */
 	{ 7070,	0x3000 },
 	{ 7028,	0x4000 },
 	{ 7019,	0x4600 },
@@ -483,7 +483,7 @@ static int set_lof(struct stv *state, u32 local_frequency, u32 cutoff_frequency)
 	else
 		icp = 7;
 
-	state->reg[0x02] |= 0x80;   /* LNA IIP3 Mode */
+	state->reg[0x02] |= 0x80; /* LNA IIP3 Mode */
 
 	state->reg[0x03] = (state->reg[0x03] & ~0x80) | (psel << 7);
 	state->reg[0x04] = (div & 0xFF);
@@ -503,7 +503,7 @@ static int set_lof(struct stv *state, u32 local_frequency, u32 cutoff_frequency)
 
 	read_reg(state, 0x03, &tmp);
 	if (tmp & 0x10)	{
-		state->reg[0x02] &= ~0x80;   /* LNA NF Mode */
+		state->reg[0x02] &= ~0x80; /* LNA NF Mode */
 		write_regs(state, 2, 1);
 	}
 	read_reg(state, 0x08, &tmp);
@@ -636,15 +636,15 @@ static int get_rf_strength(struct dvb_frontend *fe, u16 *st)
 
 static struct dvb_tuner_ops tuner_ops = {
 	.info = {
-		.name = "STV6111",
-		.frequency_min  =  950000,
-		.frequency_max  = 2150000,
-		.frequency_step =       0
+		.name		= "STV6111",
+		.frequency_min	= 950000,
+		.frequency_max	= 2150000,
+		.frequency_step	= 0
 	},
-	.set_params        = set_params,
-	.release           = release,
-	.get_rf_strength   = get_rf_strength,
-	.set_bandwidth     = set_bandwidth,
+	.set_params		= set_params,
+	.release		= release,
+	.get_rf_strength	= get_rf_strength,
+	.set_bandwidth		= set_bandwidth,
 };
 
 struct dvb_frontend *stv6111_attach(struct dvb_frontend *fe,
Signature · 1 line
2.13.0
#7 lore raw

PATCH 7/7 dvb-frontends/stv{0910,6111}: constify tables

In reply to Daniel Scheller

From: Daniel Scheller <[email protected]>

Mark lookup tables and fe_ops things const so the compiler can put them into .rodata.

While at it, improve name and identifier strings (moddesc, fe_ops).

---
 drivers/media/dvb-frontends/stv0910.c | 24 ++++++++++++------------
 drivers/media/dvb-frontends/stv6111.c | 19 ++++++++++---------
 2 files changed, 22 insertions(+), 21 deletions(-)
drivers/media/dvb-frontends/stv0910.c +12 -12
index e2162fa8cad6..a2648dd91a57 100644
@@ -207,7 +207,7 @@ static int write_shared_reg(struct stv *state, u16 reg, u8 mask, u8 val)
 	return status;
 }
 
-static struct slookup s1_sn_lookup[] = {
+static const struct slookup s1_sn_lookup[] = {
 	{   0,    9242  }, /* C/N=   0dB */
 	{   5,    9105  }, /* C/N= 0.5dB */
 	{  10,    8950  }, /* C/N= 1.0dB */
@@ -264,7 +264,7 @@ static struct slookup s1_sn_lookup[] = {
 	{  510,    425  }  /* C/N=51.0dB */
 };
 
-static struct slookup s2_sn_lookup[] = {
+static const struct slookup s2_sn_lookup[] = {
 	{  -30,  13950  }, /* C/N=-2.5dB */
 	{  -25,  13580  }, /* C/N=-2.5dB */
 	{  -20,  13150  }, /* C/N=-2.0dB */
@@ -327,7 +327,7 @@ static struct slookup s2_sn_lookup[] = {
 	{  510,    463  }, /* C/N=51.0dB */
 };
 
-static struct slookup padc_lookup[] = {
+static const struct slookup padc_lookup[] = {
 	{    0,  118000 }, /* PADC= +0dBm */
 	{ -100,  93600  }, /* PADC= -1dBm */
 	{ -200,  74500  }, /* PADC= -2dBm */
@@ -349,7 +349,7 @@ static struct slookup padc_lookup[] = {
 /*********************************************************************
  * Tracking carrier loop carrier QPSK 1/4 to 8PSK 9/10 long Frame
  *********************************************************************/
-static u8 s2car_loop[] =	{
+static const u8 s2car_loop[] =	{
 	/*
 	 * Modcod  2MPon 2MPoff 5MPon 5MPoff 10MPon 10MPoff
 	 * 20MPon 20MPoff 30MPon 30MPoff
@@ -587,7 +587,7 @@ static int tracking_optimization(struct stv *state)
 	return 0;
 }
 
-static s32 table_lookup(struct slookup *table,
+static s32 table_lookup(const struct slookup *table,
 			int table_size, u32 reg_value)
 {
 	s32 value;
@@ -629,7 +629,7 @@ static int get_signal_to_noise(struct stv *state, s32 *signal_to_noise)
 	u8 data1;
 	u16 data;
 	int n_lookup;
-	struct slookup *lookup;
+	const struct slookup *lookup;
 
 	*signal_to_noise = 0;
 
@@ -693,7 +693,7 @@ static int get_bit_error_rate_s(struct stv *state, u32 *bernumerator,
 
 static u32 dvbs2_nbch(enum dvbs2_mod_cod mod_cod, enum dvbs2_fectype fectype)
 {
-	static u32 nbch[][2] = {
+	static const u32 nbch[][2] = {
 		{    0,     0}, /* DUMMY_PLF   */
 		{16200,  3240}, /* QPSK_1_4,   */
 		{21600,  5400}, /* QPSK_1_3,   */
@@ -953,7 +953,7 @@ static int set_vth_default(struct stv *state)
 
 static int set_vth(struct stv *state)
 {
-	static struct slookup vthlookup_table[] = {
+	static const struct slookup vthlookup_table[] = {
 		{250,	8780}, /* C/N= 1.5dB */
 		{100,	7405}, /* C/N= 4.5dB */
 		{40,	6330}, /* C/N= 6.5dB */
@@ -1515,7 +1515,7 @@ static int get_frontend(struct dvb_frontend *fe,
 
 	if (state->receive_mode == RCVMODE_DVBS2) {
 		u32 mc;
-		enum fe_modulation modcod2mod[0x20] = {
+		const enum fe_modulation modcod2mod[0x20] = {
 			QPSK, QPSK, QPSK, QPSK,
 			QPSK, QPSK, QPSK, QPSK,
 			QPSK, QPSK, QPSK, QPSK,
@@ -1525,7 +1525,7 @@ static int get_frontend(struct dvb_frontend *fe,
 			APSK_32, APSK_32, APSK_32, APSK_32,
 			APSK_32,
 		};
-		enum fe_code_rate modcod2fec[0x20] = {
+		const enum fe_code_rate modcod2fec[0x20] = {
 			FEC_NONE, FEC_NONE, FEC_NONE, FEC_2_5,
 			FEC_1_2, FEC_3_5, FEC_2_3, FEC_3_4,
 			FEC_4_5, FEC_5_6, FEC_8_9, FEC_9_10,
@@ -1673,10 +1673,10 @@ static int sleep(struct dvb_frontend *fe)
 	return 0;
 }
 
-static struct dvb_frontend_ops stv0910_ops = {
+static const struct dvb_frontend_ops stv0910_ops = {
 	.delsys = { SYS_DVBS, SYS_DVBS2, SYS_DSS },
 	.info = {
-		.name			= "STV0910",
+		.name			= "ST STV0910",
 		.frequency_min		= 950000,
 		.frequency_max		= 2150000,
 		.frequency_stepsize	= 0,
drivers/media/dvb-frontends/stv6111.c +10 -9
index c4db5e6c18af..9a59fa318207 100644
@@ -41,7 +41,7 @@ struct slookup {
 	u16 reg_value;
 };
 
-static struct slookup lnagain_nf_lookup[] = {
+static const struct slookup lnagain_nf_lookup[] = {
 	/* Gain *100dB // Reg */
 	{ 2572,	0 },
 	{ 2575, 1 },
@@ -77,7 +77,7 @@ static struct slookup lnagain_nf_lookup[] = {
 	{ 5102,	31 }
 };
 
-static struct slookup lnagain_iip3_lookup[] = {
+static const struct slookup lnagain_iip3_lookup[] = {
 	/* Gain *100dB // reg */
 	{ 1548,	0 },
 	{ 1552,	1 },
@@ -113,7 +113,7 @@ static struct slookup lnagain_iip3_lookup[] = {
 	{ 4535,	31 }
 };
 
-static struct slookup gain_rfagc_lookup[] = {
+static const struct slookup gain_rfagc_lookup[] = {
 	/* Gain *100dB // reg */
 	{ 4870,	0x3000 },
 	{ 4850,	0x3C00 },
@@ -173,7 +173,7 @@ static struct slookup gain_rfagc_lookup[] = {
  * This table is 6 dB too low comapred to the others (probably created with
  * a different BB_MAG setting)
  */
-static struct slookup gain_channel_agc_nf_lookup[] = {
+static const struct slookup gain_channel_agc_nf_lookup[] = {
 	/* Gain *100dB // reg */
 	{ 7082,	0x3000 },
 	{ 7052,	0x4000 },
@@ -232,7 +232,7 @@ static struct slookup gain_channel_agc_nf_lookup[] = {
 	{ 1927,	0xFF00 }
 };
 
-static struct slookup gain_channel_agc_iip3_lookup[] = {
+static const struct slookup gain_channel_agc_iip3_lookup[] = {
 	/* Gain *100dB // reg */
 	{ 7070,	0x3000 },
 	{ 7028,	0x4000 },
@@ -533,7 +533,8 @@ static int set_params(struct dvb_frontend *fe)
 	return 0;
 }
 
-static s32 table_lookup(struct slookup *table, int table_size, u16 reg_value)
+static s32 table_lookup(const struct slookup *table,
+			int table_size, u16 reg_value)
 {
 	s32 gain;
 	s32 reg_diff;
@@ -634,9 +635,9 @@ static int get_rf_strength(struct dvb_frontend *fe, u16 *st)
 	return 0;
 }
 
-static struct dvb_tuner_ops tuner_ops = {
+static const struct dvb_tuner_ops tuner_ops = {
 	.info = {
-		.name		= "STV6111",
+		.name		= "ST STV6111",
 		.frequency_min	= 950000,
 		.frequency_max	= 2150000,
 		.frequency_step	= 0
@@ -675,6 +676,6 @@ struct dvb_frontend *stv6111_attach(struct dvb_frontend *fe,
 }
 EXPORT_SYMBOL_GPL(stv6111_attach);
 
-MODULE_DESCRIPTION("STV6111 driver");
+MODULE_DESCRIPTION("ST STV6111 satellite tuner driver");
 MODULE_AUTHOR("Ralph Metzler, Manfred Voelkel");
 MODULE_LICENSE("GPL");
Signature · 1 line
2.13.0
Tested-by on the v1 series
#8 lore raw
In reply to Daniel Scheller

Hello!

I tested this patch series with:
DD Cine S2 V6
DD Duoflex CI (single)
DD Duoflex S2 V4 (stv0910/stv6111)
VDR 2.3.8, ddci2 Plugin 1.5.0

The SAT cables were connected to the DD DuoFlex S2 V4 card and VDR was instructed to use this device only.
I checked the signal values with VDR and dvb-fe-tool and both showed the same values than before (without the patches).
I did a recording of ORF I (Austrian TV) and was also watching ZDF (German TV) simultaneously. All worked as expected!

With this eMail I add my

for this series.

BR,
Jasmin