Commit bda7f4ee authored by Devin Heitmueller's avatar Devin Heitmueller Committed by Mauro Carvalho Chehab

[media] s5h1432: fix codingstyle issues

Run Lindent and fix a few spacing issues.

This patch makes no functional change to the driver.
Signed-off-by: default avatarDevin Heitmueller <dheitmueller@hauppauge.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 9dfde557
...@@ -53,14 +53,13 @@ static int debug; ...@@ -53,14 +53,13 @@ static int debug;
printk(arg); \ printk(arg); \
} while (0) } while (0)
static int s5h1432_writereg(struct s5h1432_state *state, static int s5h1432_writereg(struct s5h1432_state *state,
u8 addr, u8 reg, u8 data) u8 addr, u8 reg, u8 data)
{ {
int ret; int ret;
u8 buf[] = { reg, data }; u8 buf[] = { reg, data };
struct i2c_msg msg = { .addr = addr, .flags = 0, .buf = buf, .len = 2 }; struct i2c_msg msg = {.addr = addr, .flags = 0, .buf = buf, .len = 2 };
ret = i2c_transfer(state->i2c, &msg, 1); ret = i2c_transfer(state->i2c, &msg, 1);
...@@ -78,8 +77,9 @@ static u8 s5h1432_readreg(struct s5h1432_state *state, u8 addr, u8 reg) ...@@ -78,8 +77,9 @@ static u8 s5h1432_readreg(struct s5h1432_state *state, u8 addr, u8 reg)
u8 b1[] = { 0 }; u8 b1[] = { 0 };
struct i2c_msg msg[] = { struct i2c_msg msg[] = {
{ .addr = addr, .flags = 0, .buf = b0, .len = 1 }, {.addr = addr, .flags = 0, .buf = b0, .len = 1},
{ .addr = addr, .flags = I2C_M_RD, .buf = b1, .len = 1 } }; {.addr = addr, .flags = I2C_M_RD, .buf = b1, .len = 1}
};
ret = i2c_transfer(state->i2c, msg, 2); ret = i2c_transfer(state->i2c, msg, 2);
...@@ -94,15 +94,14 @@ static int s5h1432_sleep(struct dvb_frontend *fe) ...@@ -94,15 +94,14 @@ static int s5h1432_sleep(struct dvb_frontend *fe)
return 0; return 0;
} }
static int s5h1432_set_channel_bandwidth(struct dvb_frontend *fe, u32 bandwidth) static int s5h1432_set_channel_bandwidth(struct dvb_frontend *fe,
u32 bandwidth)
{ {
struct s5h1432_state *state = fe->demodulator_priv; struct s5h1432_state *state = fe->demodulator_priv;
u8 reg = 0; u8 reg = 0;
/* Register [0x2E] bit 3:2 : 8MHz = 0; 7MHz = 1; 6MHz = 2 */
/* Register [0x2E] bit 3:2 : 8MHz = 0; 7MHz = 1; 6MHz = 2*/
reg = s5h1432_readreg(state, S5H1432_I2C_TOP_ADDR, 0x2E); reg = s5h1432_readreg(state, S5H1432_I2C_TOP_ADDR, 0x2E);
reg &= ~(0x0C); reg &= ~(0x0C);
switch (bandwidth) { switch (bandwidth) {
...@@ -124,65 +123,53 @@ static int s5h1432_set_channel_bandwidth(struct dvb_frontend *fe, u32 bandwidth) ...@@ -124,65 +123,53 @@ static int s5h1432_set_channel_bandwidth(struct dvb_frontend *fe, u32 bandwidth)
static int s5h1432_set_IF(struct dvb_frontend *fe, u32 ifFreqHz) static int s5h1432_set_IF(struct dvb_frontend *fe, u32 ifFreqHz)
{ {
struct s5h1432_state *state = fe->demodulator_priv; struct s5h1432_state *state = fe->demodulator_priv;
switch (ifFreqHz) { switch (ifFreqHz) {
case TAIWAN_HI_IF_FREQ_44_MHZ: case TAIWAN_HI_IF_FREQ_44_MHZ:
{ s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe4, 0x55);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe4 , 0x55); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe5, 0x55);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe5 , 0x55); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe7, 0x15);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe7 , 0x15);
break; break;
}
case EUROPE_HI_IF_FREQ_36_MHZ: case EUROPE_HI_IF_FREQ_36_MHZ:
{ s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe4, 0x00);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe4 , 0x00); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe5, 0x00);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe5 , 0x00); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe7, 0x40);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe7 , 0x40);
break; break;
}
case IF_FREQ_6_MHZ: case IF_FREQ_6_MHZ:
{ s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe4, 0x00);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe4 , 0x00); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe5, 0x00);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe5 , 0x00); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe7, 0xe0);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe7 , 0xe0);
break; break;
}
case IF_FREQ_3point3_MHZ: case IF_FREQ_3point3_MHZ:
{ s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe4, 0x66);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe4 , 0x66); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe5, 0x66);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe5 , 0x66); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe7, 0xEE);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe7 , 0xEE);
break; break;
}
case IF_FREQ_3point5_MHZ: case IF_FREQ_3point5_MHZ:
{ s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe4, 0x55);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe4 , 0x55); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe5, 0x55);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe5 , 0x55); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe7, 0xED);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe7 , 0xED);
break; break;
}
case IF_FREQ_4_MHZ: case IF_FREQ_4_MHZ:
{ s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe4, 0xAA);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe4 , 0xAA); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe5, 0xAA);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe5 , 0xAA); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe7, 0xEA);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe7 , 0xEA);
break; break;
}
default: default:
{ {
u32 value = 0; u32 value = 0;
value = (u32) (((48000 - (ifFreqHz / 1000)) * 512 * value = (u32) (((48000 - (ifFreqHz / 1000)) * 512 *
(u32) 32768) / (48 * 1000)); (u32) 32768) / (48 * 1000));
printk(KERN_INFO "Default IFFreq %d :reg value = 0x%x \n", printk(KERN_INFO
"Default IFFreq %d :reg value = 0x%x \n",
ifFreqHz, value); ifFreqHz, value);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe4 , s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe4,
(u8) value & 0xFF); (u8) value & 0xFF);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe5 , s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe5,
(u8)(value>>8) & 0xFF); (u8) (value >> 8) & 0xFF);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe7 , s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe7,
(u8)(value>>16) & 0xFF); (u8) (value >> 16) & 0xFF);
break; break;
} }
...@@ -199,10 +186,11 @@ static int s5h1432_set_frontend(struct dvb_frontend *fe, ...@@ -199,10 +186,11 @@ static int s5h1432_set_frontend(struct dvb_frontend *fe,
struct s5h1432_state *state = fe->demodulator_priv; struct s5h1432_state *state = fe->demodulator_priv;
if (p->frequency == state->current_frequency) { if (p->frequency == state->current_frequency) {
/*current_frequency = p->frequency;*/ /*current_frequency = p->frequency; */
/*state->current_frequency = p->frequency;*/ /*state->current_frequency = p->frequency; */
} else { } else {
fe->ops.tuner_ops.set_params(fe, p); msleep(300); fe->ops.tuner_ops.set_params(fe, p);
msleep(300);
s5h1432_set_channel_bandwidth(fe, dvb_bandwidth); s5h1432_set_channel_bandwidth(fe, dvb_bandwidth);
switch (p->u.ofdm.bandwidth) { switch (p->u.ofdm.bandwidth) {
case BANDWIDTH_6_MHZ: case BANDWIDTH_6_MHZ:
...@@ -220,14 +208,13 @@ static int s5h1432_set_frontend(struct dvb_frontend *fe, ...@@ -220,14 +208,13 @@ static int s5h1432_set_frontend(struct dvb_frontend *fe,
default: default:
return 0; return 0;
} }
/*fe->ops.tuner_ops.set_params(fe, p);*/ /*fe->ops.tuner_ops.set_params(fe, p); */
/*Soft Reset chip*/ /*Soft Reset chip*/
msleep(30); msleep(30);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0x09, 0x1a); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0x09, 0x1a);
msleep(30); msleep(30);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0x09, 0x1b); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0x09, 0x1b);
s5h1432_set_channel_bandwidth(fe, dvb_bandwidth); s5h1432_set_channel_bandwidth(fe, dvb_bandwidth);
switch (p->u.ofdm.bandwidth) { switch (p->u.ofdm.bandwidth) {
case BANDWIDTH_6_MHZ: case BANDWIDTH_6_MHZ:
...@@ -245,8 +232,8 @@ static int s5h1432_set_frontend(struct dvb_frontend *fe, ...@@ -245,8 +232,8 @@ static int s5h1432_set_frontend(struct dvb_frontend *fe,
default: default:
return 0; return 0;
} }
/*fe->ops.tuner_ops.set_params(fe,p);*/ /*fe->ops.tuner_ops.set_params(fe,p); */
/*Soft Reset chip*/ /*Soft Reset chip*/
msleep(30); msleep(30);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0x09, 0x1a); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0x09, 0x1a);
msleep(30); msleep(30);
...@@ -259,7 +246,6 @@ static int s5h1432_set_frontend(struct dvb_frontend *fe, ...@@ -259,7 +246,6 @@ static int s5h1432_set_frontend(struct dvb_frontend *fe,
return 0; return 0;
} }
static int s5h1432_init(struct dvb_frontend *fe) static int s5h1432_init(struct dvb_frontend *fe)
{ {
struct s5h1432_state *state = fe->demodulator_priv; struct s5h1432_state *state = fe->demodulator_priv;
...@@ -268,9 +254,8 @@ static int s5h1432_init(struct dvb_frontend *fe) ...@@ -268,9 +254,8 @@ static int s5h1432_init(struct dvb_frontend *fe)
state->current_frequency = 0; state->current_frequency = 0;
printk(KERN_INFO " s5h1432_init().\n"); printk(KERN_INFO " s5h1432_init().\n");
/*Set VSB mode as default, this also does a soft reset */
/*Set VSB mode as default, this also does a soft reset*/ /*Initialize registers */
/*Initialize registers*/
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0x04, 0xa8); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0x04, 0xa8);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0x05, 0x01); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0x05, 0x01);
...@@ -290,25 +275,25 @@ static int s5h1432_init(struct dvb_frontend *fe) ...@@ -290,25 +275,25 @@ static int s5h1432_init(struct dvb_frontend *fe)
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xcc, 0x9c); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xcc, 0x9c);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xDA, 0x00); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xDA, 0x00);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe1, 0x94); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe1, 0x94);
/* s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xf4, 0xa1);*/ /* s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xf4, 0xa1); */
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xf9, 0x00); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xf9, 0x00);
/*For NXP tuner*/ /*For NXP tuner*/
/*Set 3.3MHz as default IF frequency*/ /*Set 3.3MHz as default IF frequency */
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe4 , 0x66); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe4, 0x66);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe5 , 0x66); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe5, 0x66);
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe7 , 0xEE); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0xe7, 0xEE);
/* Set reg 0x1E to get the full dynamic range */ /* Set reg 0x1E to get the full dynamic range */
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0x1e, 0x31); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0x1e, 0x31);
/*Mode setting in demod*/ /* Mode setting in demod */
reg = s5h1432_readreg(state, S5H1432_I2C_TOP_ADDR, 0x42); reg = s5h1432_readreg(state, S5H1432_I2C_TOP_ADDR, 0x42);
reg |= 0x80; reg |= 0x80;
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0x42, reg); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0x42, reg);
/*Serial mode*/ /* Serial mode */
/*Soft Reset chip*/ /* Soft Reset chip */
s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0x09, 0x1a); s5h1432_writereg(state, S5H1432_I2C_TOP_ADDR, 0x09, 0x1a);
msleep(30); msleep(30);
...@@ -318,14 +303,11 @@ static int s5h1432_init(struct dvb_frontend *fe) ...@@ -318,14 +303,11 @@ static int s5h1432_init(struct dvb_frontend *fe)
return 0; return 0;
} }
static int s5h1432_read_status(struct dvb_frontend *fe, fe_status_t *status) static int s5h1432_read_status(struct dvb_frontend *fe, fe_status_t *status)
{ {
return 0; return 0;
} }
static int s5h1432_read_signal_strength(struct dvb_frontend *fe, static int s5h1432_read_signal_strength(struct dvb_frontend *fe,
u16 *signal_strength) u16 *signal_strength)
{ {
...@@ -397,6 +379,7 @@ struct dvb_frontend *s5h1432_attach(const struct s5h1432_config *config, ...@@ -397,6 +379,7 @@ struct dvb_frontend *s5h1432_attach(const struct s5h1432_config *config,
kfree(state); kfree(state);
return NULL; return NULL;
} }
EXPORT_SYMBOL(s5h1432_attach); EXPORT_SYMBOL(s5h1432_attach);
static struct dvb_frontend_ops s5h1432_ops = { static struct dvb_frontend_ops s5h1432_ops = {
...@@ -411,8 +394,7 @@ static struct dvb_frontend_ops s5h1432_ops = { ...@@ -411,8 +394,7 @@ static struct dvb_frontend_ops s5h1432_ops = {
FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO | FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO |
FE_CAN_HIERARCHY_AUTO | FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_HIERARCHY_AUTO | FE_CAN_GUARD_INTERVAL_AUTO |
FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_RECOVER FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_RECOVER},
},
.init = s5h1432_init, .init = s5h1432_init,
.sleep = s5h1432_sleep, .sleep = s5h1432_sleep,
......
...@@ -79,8 +79,8 @@ struct s5h1432_config { ...@@ -79,8 +79,8 @@ struct s5h1432_config {
extern struct dvb_frontend *s5h1432_attach(const struct s5h1432_config *config, extern struct dvb_frontend *s5h1432_attach(const struct s5h1432_config *config,
struct i2c_adapter *i2c); struct i2c_adapter *i2c);
#else #else
static inline struct dvb_frontend *s5h1432_attach( static inline struct dvb_frontend *s5h1432_attach(const struct s5h1432_config
const struct s5h1432_config *config, *config,
struct i2c_adapter *i2c) struct i2c_adapter *i2c)
{ {
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment