aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Boettcher <pboettcher@kernellabs.com>2010-10-10 12:45:54 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-21 19:31:32 -0400
commitb4797048f70e142a65ee2139085edb44b166d238 (patch)
tree1a5bd74dfdde3936251f962bbafd848a57d86d95
parent521cb40b0c44418a4fd36dc633f575813d59a43d (diff)
[media] stv090x: added function to control GPIOs from the outside
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>
-rw-r--r--drivers/media/dvb/frontends/stv090x.c14
-rw-r--r--drivers/media/dvb/frontends/stv090x.h12
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c
index 4e0fc2c8a41c..63cb4f8fa6c8 100644
--- a/drivers/media/dvb/frontends/stv090x.c
+++ b/drivers/media/dvb/frontends/stv090x.c
@@ -4516,6 +4516,20 @@ err:
4516 return -1; 4516 return -1;
4517} 4517}
4518 4518
4519int stv090x_set_gpio(struct dvb_frontend *fe, u8 gpio, u8 dir, u8 value,
4520 u8 xor_value)
4521{
4522 struct stv090x_state *state = fe->demodulator_priv;
4523 u8 reg = 0;
4524
4525 STV090x_SETFIELD(reg, GPIOx_OPD_FIELD, dir);
4526 STV090x_SETFIELD(reg, GPIOx_CONFIG_FIELD, value);
4527 STV090x_SETFIELD(reg, GPIOx_XOR_FIELD, xor_value);
4528
4529 return stv090x_write_reg(state, STV090x_GPIOxCFG(gpio), reg);
4530}
4531EXPORT_SYMBOL(stv090x_set_gpio);
4532
4519static struct dvb_frontend_ops stv090x_ops = { 4533static struct dvb_frontend_ops stv090x_ops = {
4520 4534
4521 .info = { 4535 .info = {
diff --git a/drivers/media/dvb/frontends/stv090x.h b/drivers/media/dvb/frontends/stv090x.h
index dd1b93ae4e9d..11754f2f6437 100644
--- a/drivers/media/dvb/frontends/stv090x.h
+++ b/drivers/media/dvb/frontends/stv090x.h
@@ -104,6 +104,11 @@ struct stv090x_config {
104extern struct dvb_frontend *stv090x_attach(const struct stv090x_config *config, 104extern struct dvb_frontend *stv090x_attach(const struct stv090x_config *config,
105 struct i2c_adapter *i2c, 105 struct i2c_adapter *i2c,
106 enum stv090x_demodulator demod); 106 enum stv090x_demodulator demod);
107
108/* dir = 0 -> output, dir = 1 -> input/open-drain */
109extern int stv090x_set_gpio(struct dvb_frontend *fe, u8 gpio,
110 u8 dir, u8 value, u8 xor_value);
111
107#else 112#else
108 113
109static inline struct dvb_frontend *stv090x_attach(const struct stv090x_config *config, 114static inline struct dvb_frontend *stv090x_attach(const struct stv090x_config *config,
@@ -113,6 +118,13 @@ static inline struct dvb_frontend *stv090x_attach(const struct stv090x_config *c
113 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 118 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
114 return NULL; 119 return NULL;
115} 120}
121
122static inline int stv090x_set_gpio(struct dvb_frontend *fe, u8 gpio,
123 u8 opd, u8 value, u8 xor_value)
124{
125 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
126 return -ENODEV;
127}
116#endif /* CONFIG_DVB_STV090x */ 128#endif /* CONFIG_DVB_STV090x */
117 129
118#endif /* __STV090x_H */ 130#endif /* __STV090x_H */