diff options
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) |