[media] fc0012: use struct for driver config
I need even more configuration options and overloading dvb_attach() for all those sounds quite stupid. Due to that switch struct and make room for new options. Signed-off-by: Antti Palosaari <crope@iki.fi> Acked-by: Hans-Frieder Vogt <hfvogt@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
bf97b6373b
commit
ad3a758bb3
4 changed files with 34 additions and 12 deletions
|
@ -436,8 +436,7 @@ static const struct dvb_tuner_ops fc0012_tuner_ops = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
|
struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
|
||||||
struct i2c_adapter *i2c, u8 i2c_address, int dual_master,
|
struct i2c_adapter *i2c, const struct fc0012_config *cfg)
|
||||||
enum fc001x_xtal_freq xtal_freq)
|
|
||||||
{
|
{
|
||||||
struct fc0012_priv *priv = NULL;
|
struct fc0012_priv *priv = NULL;
|
||||||
|
|
||||||
|
@ -446,9 +445,9 @@ struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
priv->i2c = i2c;
|
priv->i2c = i2c;
|
||||||
priv->dual_master = dual_master;
|
priv->dual_master = cfg->dual_master;
|
||||||
priv->addr = i2c_address;
|
priv->addr = cfg->i2c_address;
|
||||||
priv->xtal_freq = xtal_freq;
|
priv->xtal_freq = cfg->xtal_freq;
|
||||||
|
|
||||||
info("Fitipower FC0012 successfully attached.");
|
info("Fitipower FC0012 successfully attached.");
|
||||||
|
|
||||||
|
|
|
@ -24,17 +24,29 @@
|
||||||
#include "dvb_frontend.h"
|
#include "dvb_frontend.h"
|
||||||
#include "fc001x-common.h"
|
#include "fc001x-common.h"
|
||||||
|
|
||||||
|
struct fc0012_config {
|
||||||
|
/*
|
||||||
|
* I2C address
|
||||||
|
*/
|
||||||
|
u8 i2c_address;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* clock
|
||||||
|
*/
|
||||||
|
enum fc001x_xtal_freq xtal_freq;
|
||||||
|
|
||||||
|
int dual_master;
|
||||||
|
};
|
||||||
|
|
||||||
#if defined(CONFIG_MEDIA_TUNER_FC0012) || \
|
#if defined(CONFIG_MEDIA_TUNER_FC0012) || \
|
||||||
(defined(CONFIG_MEDIA_TUNER_FC0012_MODULE) && defined(MODULE))
|
(defined(CONFIG_MEDIA_TUNER_FC0012_MODULE) && defined(MODULE))
|
||||||
extern struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
|
extern struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
|
||||||
struct i2c_adapter *i2c,
|
struct i2c_adapter *i2c,
|
||||||
u8 i2c_address, int dual_master,
|
const struct fc0012_config *cfg);
|
||||||
enum fc001x_xtal_freq xtal_freq);
|
|
||||||
#else
|
#else
|
||||||
static inline struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
|
static inline struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
|
||||||
struct i2c_adapter *i2c,
|
struct i2c_adapter *i2c,
|
||||||
u8 i2c_address, int dual_master,
|
const struct fc0012_config *cfg)
|
||||||
enum fc001x_xtal_freq xtal_freq)
|
|
||||||
{
|
{
|
||||||
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
|
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -900,6 +900,12 @@ static const struct fc2580_config af9035_fc2580_config = {
|
||||||
.clock = 16384000,
|
.clock = 16384000,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct fc0012_config af9035_fc0012_config = {
|
||||||
|
.i2c_address = 0x63,
|
||||||
|
.xtal_freq = FC_XTAL_36_MHZ,
|
||||||
|
.dual_master = 1,
|
||||||
|
};
|
||||||
|
|
||||||
static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
|
static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
|
||||||
{
|
{
|
||||||
struct state *state = adap_to_priv(adap);
|
struct state *state = adap_to_priv(adap);
|
||||||
|
@ -1043,8 +1049,8 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
|
||||||
|
|
||||||
usleep_range(10000, 50000);
|
usleep_range(10000, 50000);
|
||||||
|
|
||||||
fe = dvb_attach(fc0012_attach, adap->fe[0], &d->i2c_adap, 0x63,
|
fe = dvb_attach(fc0012_attach, adap->fe[0], &d->i2c_adap,
|
||||||
1, FC_XTAL_36_MHZ);
|
&af9035_fc0012_config);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fe = NULL;
|
fe = NULL;
|
||||||
|
|
|
@ -835,6 +835,11 @@ static struct tua9001_config rtl2832u_tua9001_config = {
|
||||||
.i2c_addr = 0x60,
|
.i2c_addr = 0x60,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct fc0012_config rtl2832u_fc0012_config = {
|
||||||
|
.i2c_address = 0x63, /* 0xc6 >> 1 */
|
||||||
|
.xtal_freq = FC_XTAL_28_8_MHZ,
|
||||||
|
};
|
||||||
|
|
||||||
static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
|
static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -847,7 +852,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
|
||||||
switch (priv->tuner) {
|
switch (priv->tuner) {
|
||||||
case TUNER_RTL2832_FC0012:
|
case TUNER_RTL2832_FC0012:
|
||||||
fe = dvb_attach(fc0012_attach, adap->fe[0],
|
fe = dvb_attach(fc0012_attach, adap->fe[0],
|
||||||
&d->i2c_adap, 0xc6>>1, 0, FC_XTAL_28_8_MHZ);
|
&d->i2c_adap, &rtl2832u_fc0012_config);
|
||||||
|
|
||||||
/* since fc0012 includs reading the signal strength delegate
|
/* since fc0012 includs reading the signal strength delegate
|
||||||
* that to the tuner driver */
|
* that to the tuner driver */
|
||||||
|
|
Loading…
Add table
Reference in a new issue