diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2008-11-27 23:02:56 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-01-02 14:15:11 -0500 |
commit | dd72f31b4fa87c68e16484a3ed3e4d1843ad7f06 (patch) | |
tree | b2fd87fc7029e24052a23a2a4f52acbe7d623700 /drivers/media | |
parent | e4cda3e0728156c6be1d03e72ef20ea811da4ad5 (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.c | 17 |
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) | |||
131 | return &sms_boards[id]; | 131 | return &sms_boards[id]; |
132 | } | 132 | } |
133 | 133 | ||
134 | static int sms_set_gpio(struct smscore_device_t *coredev, u32 pin, int enable) | 134 | static int sms_set_gpio(struct smscore_device_t *coredev, int pin, int enable) |
135 | { | 135 | { |
136 | int ret; | 136 | int lvl, ret; |
137 | u32 gpio; | ||
137 | struct smscore_gpio_config gpioconfig = { | 138 | struct smscore_gpio_config gpioconfig = { |
138 | .direction = SMS_GPIO_DIRECTION_OUTPUT, | 139 | .direction = SMS_GPIO_DIRECTION_OUTPUT, |
139 | .pullupdown = SMS_GPIO_PULLUPDOWN_NONE, | 140 | .pullupdown = SMS_GPIO_PULLUPDOWN_NONE, |
@@ -145,12 +146,20 @@ static int sms_set_gpio(struct smscore_device_t *coredev, u32 pin, int enable) | |||
145 | if (pin == 0) | 146 | if (pin == 0) |
146 | return -EINVAL; | 147 | return -EINVAL; |
147 | 148 | ||
148 | ret = smscore_configure_gpio(coredev, pin, &gpioconfig); | 149 | if (pin < 0) { |
150 | /* inverted gpio */ | ||
151 | gpio = pin * -1; | ||
152 | lvl = enable ? 0 : 1; | ||
153 | } else { | ||
154 | gpio = pin; | ||
155 | lvl = enable ? 1 : 0; | ||
156 | } | ||
149 | 157 | ||
158 | ret = smscore_configure_gpio(coredev, gpio, &gpioconfig); | ||
150 | if (ret < 0) | 159 | if (ret < 0) |
151 | return ret; | 160 | return ret; |
152 | 161 | ||
153 | return smscore_set_gpio(coredev, pin, enable); | 162 | return smscore_set_gpio(coredev, gpio, lvl); |
154 | } | 163 | } |
155 | 164 | ||
156 | int sms_board_setup(struct smscore_device_t *coredev) | 165 | int sms_board_setup(struct smscore_device_t *coredev) |