Skip to content

Commit

Permalink
[media] stv090x: added function to control GPIOs from the outside
Browse files Browse the repository at this point in the history
This patch STV090X adds and exports a function to control the GPIOs of
the stv090x-devices.

Cc: Manu Abraham <abraham.manu@gmail.com>
Signed-off-by: Martin Wilks <m.wilks@technisat.com>
Signed-off-by: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Patrick Boettcher authored and Mauro Carvalho Chehab committed Mar 21, 2011
1 parent 521cb40 commit b479704
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
14 changes: 14 additions & 0 deletions drivers/media/dvb/frontends/stv090x.c
Original file line number Diff line number Diff line change
Expand Up @@ -4516,6 +4516,20 @@ static int stv090x_setup(struct dvb_frontend *fe)
return -1;
}

int stv090x_set_gpio(struct dvb_frontend *fe, u8 gpio, u8 dir, u8 value,
u8 xor_value)
{
struct stv090x_state *state = fe->demodulator_priv;
u8 reg = 0;

STV090x_SETFIELD(reg, GPIOx_OPD_FIELD, dir);
STV090x_SETFIELD(reg, GPIOx_CONFIG_FIELD, value);
STV090x_SETFIELD(reg, GPIOx_XOR_FIELD, xor_value);

return stv090x_write_reg(state, STV090x_GPIOxCFG(gpio), reg);
}
EXPORT_SYMBOL(stv090x_set_gpio);

static struct dvb_frontend_ops stv090x_ops = {

.info = {
Expand Down
12 changes: 12 additions & 0 deletions drivers/media/dvb/frontends/stv090x.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ struct stv090x_config {
extern struct dvb_frontend *stv090x_attach(const struct stv090x_config *config,
struct i2c_adapter *i2c,
enum stv090x_demodulator demod);

/* dir = 0 -> output, dir = 1 -> input/open-drain */
extern int stv090x_set_gpio(struct dvb_frontend *fe, u8 gpio,
u8 dir, u8 value, u8 xor_value);

#else

static inline struct dvb_frontend *stv090x_attach(const struct stv090x_config *config,
Expand All @@ -113,6 +118,13 @@ static inline struct dvb_frontend *stv090x_attach(const struct stv090x_config *c
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
return NULL;
}

static inline int stv090x_set_gpio(struct dvb_frontend *fe, u8 gpio,
u8 opd, u8 value, u8 xor_value)
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
return -ENODEV;
}
#endif /* CONFIG_DVB_STV090x */

#endif /* __STV090x_H */

0 comments on commit b479704

Please sign in to comment.