Commit 3873dd04 authored by Michael Krufky's avatar Michael Krufky Committed by Mauro Carvalho Chehab

V4L/DVB (5950): whitespace cleanup for mt2131 and s5h1409

- trivial whitespace cleanups
- add "c-basic-offset: 8" to enforce tabbing style in emacs
Signed-off-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent a45c9275
...@@ -53,8 +53,10 @@ static u8 mt2131_config2[] = { ...@@ -53,8 +53,10 @@ static u8 mt2131_config2[] = {
static int mt2131_readreg(struct mt2131_priv *priv, u8 reg, u8 *val) static int mt2131_readreg(struct mt2131_priv *priv, u8 reg, u8 *val)
{ {
struct i2c_msg msg[2] = { struct i2c_msg msg[2] = {
{ .addr = priv->cfg->i2c_address, .flags = 0, .buf = &reg, .len = 1 }, { .addr = priv->cfg->i2c_address, .flags = 0,
{ .addr = priv->cfg->i2c_address, .flags = I2C_M_RD, .buf = val, .len = 1 }, .buf = &reg, .len = 1 },
{ .addr = priv->cfg->i2c_address, .flags = I2C_M_RD,
.buf = val, .len = 1 },
}; };
if (i2c_transfer(priv->i2c, msg, 2) != 2) { if (i2c_transfer(priv->i2c, msg, 2) != 2) {
...@@ -67,7 +69,8 @@ static int mt2131_readreg(struct mt2131_priv *priv, u8 reg, u8 *val) ...@@ -67,7 +69,8 @@ static int mt2131_readreg(struct mt2131_priv *priv, u8 reg, u8 *val)
static int mt2131_writereg(struct mt2131_priv *priv, u8 reg, u8 val) static int mt2131_writereg(struct mt2131_priv *priv, u8 reg, u8 val)
{ {
u8 buf[2] = { reg, val }; u8 buf[2] = { reg, val };
struct i2c_msg msg = { .addr = priv->cfg->i2c_address, .flags = 0, .buf = buf, .len = 2 }; struct i2c_msg msg = { .addr = priv->cfg->i2c_address, .flags = 0,
.buf = buf, .len = 2 };
if (i2c_transfer(priv->i2c, &msg, 1) != 1) { if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
printk(KERN_WARNING "mt2131 I2C write failed\n"); printk(KERN_WARNING "mt2131 I2C write failed\n");
...@@ -78,10 +81,12 @@ static int mt2131_writereg(struct mt2131_priv *priv, u8 reg, u8 val) ...@@ -78,10 +81,12 @@ static int mt2131_writereg(struct mt2131_priv *priv, u8 reg, u8 val)
static int mt2131_writeregs(struct mt2131_priv *priv,u8 *buf, u8 len) static int mt2131_writeregs(struct mt2131_priv *priv,u8 *buf, u8 len)
{ {
struct i2c_msg msg = { .addr = priv->cfg->i2c_address, .flags = 0, .buf = buf, .len = len }; struct i2c_msg msg = { .addr = priv->cfg->i2c_address,
.flags = 0, .buf = buf, .len = len };
if (i2c_transfer(priv->i2c, &msg, 1) != 1) { if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
printk(KERN_WARNING "mt2131 I2C write failed (len=%i)\n",(int)len); printk(KERN_WARNING "mt2131 I2C write failed (len=%i)\n",
(int)len);
return -EREMOTEIO; return -EREMOTEIO;
} }
return 0; return 0;
...@@ -98,14 +103,15 @@ static int mt2131_set_gpo(struct dvb_frontend *fe, u8 val) ...@@ -98,14 +103,15 @@ static int mt2131_set_gpo(struct dvb_frontend *fe, u8 val)
return 0; return 0;
} }
static int mt2131_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) static int mt2131_set_params(struct dvb_frontend *fe,
struct dvb_frontend_parameters *params)
{ {
struct mt2131_priv *priv; struct mt2131_priv *priv;
int ret=0, i; int ret=0, i;
u32 freq; u32 freq;
u8 if_band_center; u8 if_band_center;
u32 f_lo1,f_lo2; u32 f_lo1, f_lo2;
u32 div1,num1,div2,num2; u32 div1, num1, div2, num2;
u8 b[8]; u8 b[8];
u8 lockval = 0; u8 lockval = 0;
...@@ -231,7 +237,8 @@ static int mt2131_init(struct dvb_frontend *fe) ...@@ -231,7 +237,8 @@ static int mt2131_init(struct dvb_frontend *fe)
int ret; int ret;
dprintk(1, "%s()\n", __FUNCTION__); dprintk(1, "%s()\n", __FUNCTION__);
if ((ret = mt2131_writeregs(priv, mt2131_config1, sizeof(mt2131_config1))) < 0) if ((ret = mt2131_writeregs(priv, mt2131_config1,
sizeof(mt2131_config1))) < 0)
return ret; return ret;
mt2131_writereg(priv, 0x0b, 0x09); mt2131_writereg(priv, 0x0b, 0x09);
...@@ -239,7 +246,8 @@ static int mt2131_init(struct dvb_frontend *fe) ...@@ -239,7 +246,8 @@ static int mt2131_init(struct dvb_frontend *fe)
mt2131_writereg(priv, 0x07, 0xf2); mt2131_writereg(priv, 0x07, 0xf2);
mt2131_writereg(priv, 0x0b, 0x01); mt2131_writereg(priv, 0x0b, 0x01);
if ((ret = mt2131_writeregs(priv, mt2131_config2, sizeof(mt2131_config2))) < 0) if ((ret = mt2131_writeregs(priv, mt2131_config2,
sizeof(mt2131_config2))) < 0)
return ret; return ret;
return ret; return ret;
...@@ -270,7 +278,9 @@ static const struct dvb_tuner_ops mt2131_tuner_ops = { ...@@ -270,7 +278,9 @@ static const struct dvb_tuner_ops mt2131_tuner_ops = {
.get_status = mt2131_get_status .get_status = mt2131_get_status
}; };
struct dvb_frontend * mt2131_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2131_config *cfg, u16 if1) struct dvb_frontend * mt2131_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c,
struct mt2131_config *cfg, u16 if1)
{ {
struct mt2131_priv *priv = NULL; struct mt2131_priv *priv = NULL;
u8 id = 0; u8 id = 0;
...@@ -290,13 +300,16 @@ struct dvb_frontend * mt2131_attach(struct dvb_frontend *fe, struct i2c_adapter ...@@ -290,13 +300,16 @@ struct dvb_frontend * mt2131_attach(struct dvb_frontend *fe, struct i2c_adapter
return NULL; return NULL;
} }
if ( (id != 0x3E) && (id != 0x3F) ) { if ( (id != 0x3E) && (id != 0x3F) ) {
printk(KERN_ERR "MT2131: Device not found at addr 0x%02x\n", cfg->i2c_address); printk(KERN_ERR "MT2131: Device not found at addr 0x%02x\n",
cfg->i2c_address);
kfree(priv); kfree(priv);
return NULL; return NULL;
} }
printk(KERN_INFO "MT2131: successfully identified at address 0x%02x\n", cfg->i2c_address); printk(KERN_INFO "MT2131: successfully identified at address 0x%02x\n",
memcpy(&fe->ops.tuner_ops, &mt2131_tuner_ops, sizeof(struct dvb_tuner_ops)); cfg->i2c_address);
memcpy(&fe->ops.tuner_ops, &mt2131_tuner_ops,
sizeof(struct dvb_tuner_ops));
fe->tuner_priv = priv; fe->tuner_priv = priv;
return fe; return fe;
...@@ -306,3 +319,8 @@ EXPORT_SYMBOL(mt2131_attach); ...@@ -306,3 +319,8 @@ EXPORT_SYMBOL(mt2131_attach);
MODULE_AUTHOR("Steven Toth"); MODULE_AUTHOR("Steven Toth");
MODULE_DESCRIPTION("Microtune MT2131 silicon tuner driver"); MODULE_DESCRIPTION("Microtune MT2131 silicon tuner driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/*
* Local variables:
* c-basic-offset: 8
*/
...@@ -44,6 +44,11 @@ static inline struct dvb_frontend* mt2131_attach(struct dvb_frontend *fe, ...@@ -44,6 +44,11 @@ static inline struct dvb_frontend* mt2131_attach(struct dvb_frontend *fe,
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
return NULL; return NULL;
} }
#endif // CONFIG_DVB_TUNER_MT2131 #endif /* CONFIG_DVB_TUNER_MT2131 */
#endif // __MT2131_H__ #endif /* __MT2131_H__ */
/*
* Local variables:
* c-basic-offset: 8
*/
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef MT2131_PRIV_H #ifndef __MT2131_PRIV_H__
#define MT2131_PRIV_H #define __MT2131_PRIV_H__
/* Regs */ /* Regs */
#define MT2131_PWR 0x07 #define MT2131_PWR 0x07
...@@ -41,4 +41,9 @@ struct mt2131_priv { ...@@ -41,4 +41,9 @@ struct mt2131_priv {
u32 bandwidth; u32 bandwidth;
}; };
#endif #endif /* __MT2131_PRIV_H__ */
/*
* Local variables:
* c-basic-offset: 8
*/
...@@ -296,13 +296,14 @@ static int s5h1409_writereg(struct s5h1409_state* state, u8 reg, u16 data) ...@@ -296,13 +296,14 @@ static int s5h1409_writereg(struct s5h1409_state* state, u8 reg, u16 data)
int ret; int ret;
u8 buf [] = { reg, data >> 8, data & 0xff }; u8 buf [] = { reg, data >> 8, data & 0xff };
struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 3 }; struct i2c_msg msg = { .addr = state->config->demod_address,
.flags = 0, .buf = buf, .len = 3 };
ret = i2c_transfer(state->i2c, &msg, 1); ret = i2c_transfer(state->i2c, &msg, 1);
if (ret != 1) if (ret != 1)
printk("%s: writereg error (reg == 0x%02x, val == 0x%04x, ret == %i)\n", printk("%s: writereg error (reg == 0x%02x, val == 0x%04x, "
__FUNCTION__, reg, data, ret); "ret == %i)\n", __FUNCTION__, reg, data, ret);
return (ret != 1) ? -1 : 0; return (ret != 1) ? -1 : 0;
} }
...@@ -314,14 +315,15 @@ static u16 s5h1409_readreg(struct s5h1409_state* state, u8 reg) ...@@ -314,14 +315,15 @@ static u16 s5h1409_readreg(struct s5h1409_state* state, u8 reg)
u8 b1 [] = { 0, 0 }; u8 b1 [] = { 0, 0 };
struct i2c_msg msg [] = { struct i2c_msg msg [] = {
{ .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 }, { .addr = state->config->demod_address, .flags = 0,
{ .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 2 } }; .buf = b0, .len = 1 },
{ .addr = state->config->demod_address, .flags = I2C_M_RD,
.buf = b1, .len = 2 } };
ret = i2c_transfer(state->i2c, msg, 2); ret = i2c_transfer(state->i2c, msg, 2);
if (ret != 2) if (ret != 2)
printk("%s: readreg error (ret == %i)\n", __FUNCTION__, ret) printk("%s: readreg error (ret == %i)\n", __FUNCTION__, ret);
;
return (b1[0] << 8) | b1[1]; return (b1[0] << 8) | b1[1];
} }
...@@ -343,8 +345,7 @@ static int s5h1409_set_if_freq(struct dvb_frontend* fe, int KHz) ...@@ -343,8 +345,7 @@ static int s5h1409_set_if_freq(struct dvb_frontend* fe, int KHz)
dprintk("%s(%d KHz)\n", __FUNCTION__, KHz); dprintk("%s(%d KHz)\n", __FUNCTION__, KHz);
if( (KHz == 44000) || (KHz == 5380) ) if( (KHz == 44000) || (KHz == 5380) ) {
{
s5h1409_writereg(state, 0x87, 0x01be); s5h1409_writereg(state, 0x87, 0x01be);
s5h1409_writereg(state, 0x88, 0x0436); s5h1409_writereg(state, 0x88, 0x0436);
s5h1409_writereg(state, 0x89, 0x054d); s5h1409_writereg(state, 0x89, 0x054d);
...@@ -368,7 +369,8 @@ static int s5h1409_set_spectralinversion(struct dvb_frontend* fe, int inverted) ...@@ -368,7 +369,8 @@ static int s5h1409_set_spectralinversion(struct dvb_frontend* fe, int inverted)
return s5h1409_writereg(state, 0x1b, 0x0110); /* Normal */ return s5h1409_writereg(state, 0x1b, 0x0110); /* Normal */
} }
static int s5h1409_enable_modulation(struct dvb_frontend* fe, fe_modulation_t m) static int s5h1409_enable_modulation(struct dvb_frontend* fe,
fe_modulation_t m)
{ {
struct s5h1409_state* state = fe->demodulator_priv; struct s5h1409_state* state = fe->demodulator_priv;
...@@ -443,7 +445,8 @@ static int s5h1409_register_reset(struct dvb_frontend* fe) ...@@ -443,7 +445,8 @@ static int s5h1409_register_reset(struct dvb_frontend* fe)
} }
/* Talk to the demod, set the FEC, GUARD, QAM settings etc */ /* Talk to the demod, set the FEC, GUARD, QAM settings etc */
static int s5h1409_set_frontend (struct dvb_frontend* fe, struct dvb_frontend_parameters *p) static int s5h1409_set_frontend (struct dvb_frontend* fe,
struct dvb_frontend_parameters *p)
{ {
struct s5h1409_state* state = fe->demodulator_priv; struct s5h1409_state* state = fe->demodulator_priv;
...@@ -521,11 +524,13 @@ static int s5h1409_read_status(struct dvb_frontend* fe, fe_status_t* status) ...@@ -521,11 +524,13 @@ static int s5h1409_read_status(struct dvb_frontend* fe, fe_status_t* status)
case S5H1409_TUNERLOCKING: case S5H1409_TUNERLOCKING:
/* Get the tuner status */ /* Get the tuner status */
if (fe->ops.tuner_ops.get_status) { if (fe->ops.tuner_ops.get_status) {
if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
fe->ops.tuner_ops.get_status(fe, &tuner_status); fe->ops.tuner_ops.get_status(fe, &tuner_status);
if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0);
} }
if (tuner_status) if (tuner_status)
*status |= FE_HAS_CARRIER | FE_HAS_SIGNAL; *status |= FE_HAS_CARRIER | FE_HAS_SIGNAL;
...@@ -605,7 +610,8 @@ static int s5h1409_read_snr(struct dvb_frontend* fe, u16* snr) ...@@ -605,7 +610,8 @@ static int s5h1409_read_snr(struct dvb_frontend* fe, u16* snr)
return -EINVAL; return -EINVAL;
} }
static int s5h1409_read_signal_strength(struct dvb_frontend* fe, u16* signal_strength) static int s5h1409_read_signal_strength(struct dvb_frontend* fe,
u16* signal_strength)
{ {
return s5h1409_read_snr(fe, signal_strength); return s5h1409_read_snr(fe, signal_strength);
} }
...@@ -624,7 +630,8 @@ static int s5h1409_read_ber(struct dvb_frontend* fe, u32* ber) ...@@ -624,7 +630,8 @@ static int s5h1409_read_ber(struct dvb_frontend* fe, u32* ber)
return s5h1409_read_ucblocks(fe, ber); return s5h1409_read_ucblocks(fe, ber);
} }
static int s5h1409_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) static int s5h1409_get_frontend(struct dvb_frontend* fe,
struct dvb_frontend_parameters *p)
{ {
struct s5h1409_state* state = fe->demodulator_priv; struct s5h1409_state* state = fe->demodulator_priv;
...@@ -634,7 +641,8 @@ static int s5h1409_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par ...@@ -634,7 +641,8 @@ static int s5h1409_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
return 0; return 0;
} }
static int s5h1409_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) static int s5h1409_get_tune_settings(struct dvb_frontend* fe,
struct dvb_frontend_tune_settings *tune)
{ {
tune->min_delay_ms = 1000; tune->min_delay_ms = 1000;
return 0; return 0;
...@@ -668,7 +676,8 @@ struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config, ...@@ -668,7 +676,8 @@ struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config,
goto error; goto error;
/* create dvb_frontend */ /* create dvb_frontend */
memcpy(&state->frontend.ops, &s5h1409_ops, sizeof(struct dvb_frontend_ops)); memcpy(&state->frontend.ops, &s5h1409_ops,
sizeof(struct dvb_frontend_ops));
state->frontend.demodulator_priv = state; state->frontend.demodulator_priv = state;
/* Note: Leaving the I2C gate open here. */ /* Note: Leaving the I2C gate open here. */
...@@ -713,3 +722,8 @@ MODULE_AUTHOR("Steven Toth"); ...@@ -713,3 +722,8 @@ MODULE_AUTHOR("Steven Toth");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
EXPORT_SYMBOL(s5h1409_attach); EXPORT_SYMBOL(s5h1409_attach);
/*
* Local variables:
* c-basic-offset: 8
*/
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
*/ */
#ifndef S5H1409_H #ifndef __S5H1409_H__
#define S5H1409_H #define __S5H1409_H__
#include <linux/dvb/frontend.h> #include <linux/dvb/frontend.h>
...@@ -58,11 +58,16 @@ extern struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config, ...@@ -58,11 +58,16 @@ extern struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config,
struct i2c_adapter* i2c); struct i2c_adapter* i2c);
#else #else
static inline struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config, static inline struct dvb_frontend* s5h1409_attach(const struct s5h1409_config* config,
struct i2c_adapter* i2c) struct i2c_adapter* i2c)
{ {
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
return NULL; return NULL;
} }
#endif // CONFIG_DVB_S5H1409 #endif /* CONFIG_DVB_S5H1409 */
#endif // S5H1409_H #endif /* __S5H1409_H__ */
/*
* Local variables:
* c-basic-offset: 8
*/
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