summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-11-28 01:02:56 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-01-02 17:15:11 -0200
commitdd72f31b4fa87c68e16484a3ed3e4d1843ad7f06 (patch)
treeb2fd87fc7029e24052a23a2a4f52acbe7d623700 /drivers/media
parente4cda3e0728156c6be1d03e72ef20ea811da4ad5 (diff)
V4L/DVB (10167): sms1xxx: add support for inverted gpio
negative gpio values signify inverted polarity Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/siano/sms-cards.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/media/dvb/siano/sms-cards.c b/drivers/media/dvb/siano/sms-cards.c
index fd62e0b85621..5a9882ffeb42 100644
--- a/drivers/media/dvb/siano/sms-cards.c
+++ b/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)