Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 138198
b: refs/heads/master
c: 209fdf6
h: refs/heads/master
v: v3
  • Loading branch information
Devin Heitmueller authored and Mauro Carvalho Chehab committed Mar 30, 2009
1 parent b035f4f commit 87dd3a7
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7bf63eda681e095ca3c39d075354053107febf80
refs/heads/master: 209fdf66b8699a6b2998b58e572d67230dae507f
45 changes: 38 additions & 7 deletions trunk/drivers/media/dvb/frontends/au8522_dig.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@

static int debug;

/* Despite the name "hybrid_tuner", the framework works just as well for
hybrid demodulators as well... */
static LIST_HEAD(hybrid_tuner_instance_list);

#define dprintk(arg...) do { \
if (debug) \
printk(arg); \
Expand Down Expand Up @@ -786,23 +790,50 @@ static int au8522_get_tune_settings(struct dvb_frontend *fe,
return 0;
}

static struct dvb_frontend_ops au8522_ops;

int au8522_get_state(struct au8522_state **state, struct i2c_adapter *i2c,
u8 client_address)
{
return hybrid_tuner_request_state(struct au8522_state, (*state),
hybrid_tuner_instance_list,
i2c, client_address, "au8522");
}

void au8522_release_state(struct au8522_state *state)
{
if (state != NULL)
hybrid_tuner_release_state(state);
}


static void au8522_release(struct dvb_frontend *fe)
{
struct au8522_state *state = fe->demodulator_priv;
kfree(state);
au8522_release_state(state);
}

static struct dvb_frontend_ops au8522_ops;

struct dvb_frontend *au8522_attach(const struct au8522_config *config,
struct i2c_adapter *i2c)
{
struct au8522_state *state = NULL;
int instance;

/* allocate memory for the internal state */
state = kmalloc(sizeof(struct au8522_state), GFP_KERNEL);
if (state == NULL)
goto error;
instance = au8522_get_state(&state, i2c, config->demod_address);
switch (instance) {
case 0:
dprintk("%s state allocation failed\n", __func__);
break;
case 1:
/* new demod instance */
dprintk("%s using new instance\n", __func__);
break;
default:
/* existing demod instance */
dprintk("%s using existing instance\n", __func__);
break;
}

/* setup the state */
state->config = config;
Expand All @@ -824,7 +855,7 @@ struct dvb_frontend *au8522_attach(const struct au8522_config *config,
return &state->frontend;

error:
kfree(state);
au8522_release_state(state);
return NULL;
}
EXPORT_SYMBOL(au8522_attach);
Expand Down
8 changes: 8 additions & 0 deletions trunk/drivers/media/dvb/frontends/au8522_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
struct au8522_state {
struct i2c_adapter *i2c;

/* Used for sharing of the state between analog and digital mode */
struct tuner_i2c_props i2c_props;
struct list_head hybrid_tuner_instance_list;

/* configuration settings */
const struct au8522_config *config;

Expand All @@ -55,3 +59,7 @@ int au8522_writereg(struct au8522_state *state, u16 reg, u8 data);
u8 au8522_readreg(struct au8522_state *state, u16 reg);
int au8522_init(struct dvb_frontend *fe);
int au8522_sleep(struct dvb_frontend *fe);

int au8522_get_state(struct au8522_state **state, struct i2c_adapter *i2c,
u8 client_address);
void au8522_release_state(struct au8522_state *state);

0 comments on commit 87dd3a7

Please sign in to comment.