summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-11-27 23:02:56 -0500
committerMichael Krufky <mkrufky@linuxtv.org>2008-11-27 23:02:56 -0500
commit1bdf13c6e1a9e64fb3074d35ed38f92b737088e1 (patch)
treea73b06a61db74856be9c202984a19406eba2027c
parent18efb709ad3602aebb032ef3f23aba5d45a44d38 (diff)
downloadmediapointer-dvb-s2-1bdf13c6e1a9e64fb3074d35ed38f92b737088e1.tar.gz
mediapointer-dvb-s2-1bdf13c6e1a9e64fb3074d35ed38f92b737088e1.tar.bz2
sms1xxx: add support for inverted gpio
From: Michael Krufky <mkrufky@linuxtv.org> negative gpio values signify inverted polarity Priority: normal Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
-rw-r--r--linux/drivers/media/dvb/siano/sms-cards.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/linux/drivers/media/dvb/siano/sms-cards.c b/linux/drivers/media/dvb/siano/sms-cards.c
index fd62e0b85..5a9882ffe 100644
--- a/linux/drivers/media/dvb/siano/sms-cards.c
+++ b/linux/drivers/media/dvb/siano/sms-cards.c
@@ -131,9 +131,10 @@ struct sms_board *sms_get_board(int id)
return &sms_boards[id];
}
-static int sms_set_gpio(struct smscore_device_t *coredev, u32 pin, int enable)
+static int sms_set_gpio(struct smscore_device_t *coredev, int pin, int enable)
{
- int ret;
+ int lvl, ret;
+ u32 gpio;
struct smscore_gpio_config gpioconfig = {
.direction = SMS_GPIO_DIRECTION_OUTPUT,
.pullupdown = SMS_GPIO_PULLUPDOWN_NONE,
@@ -145,12 +146,20 @@ static int sms_set_gpio(struct smscore_device_t *coredev, u32 pin, int enable)
if (pin == 0)
return -EINVAL;
- ret = smscore_configure_gpio(coredev, pin, &gpioconfig);
+ if (pin < 0) {
+ /* inverted gpio */
+ gpio = pin * -1;
+ lvl = enable ? 0 : 1;
+ } else {
+ gpio = pin;
+ lvl = enable ? 1 : 0;
+ }
+ ret = smscore_configure_gpio(coredev, gpio, &gpioconfig);
if (ret < 0)
return ret;
- return smscore_set_gpio(coredev, pin, enable);
+ return smscore_set_gpio(coredev, gpio, lvl);
}
int sms_board_setup(struct smscore_device_t *coredev)