diff options
Diffstat (limited to 'drivers/gpio/gpio-rockchip.c')
| -rw-r--r-- | drivers/gpio/gpio-rockchip.c | 56 | 
1 files changed, 29 insertions, 27 deletions
diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c index a4c4e4584f5b..099e358d2491 100644 --- a/drivers/gpio/gpio-rockchip.c +++ b/drivers/gpio/gpio-rockchip.c @@ -410,10 +410,8 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)  	level = rockchip_gpio_readl(bank, bank->gpio_regs->int_type);  	polarity = rockchip_gpio_readl(bank, bank->gpio_regs->int_polarity); -	switch (type) { -	case IRQ_TYPE_EDGE_BOTH: +	if (type == IRQ_TYPE_EDGE_BOTH) {  		if (bank->gpio_type == GPIO_TYPE_V2) { -			bank->toggle_edge_mode &= ~mask;  			rockchip_gpio_writel_bit(bank, d->hwirq, 1,  						 bank->gpio_regs->int_bothedge);  			goto out; @@ -431,30 +429,34 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)  			else  				polarity |= mask;  		} -		break; -	case IRQ_TYPE_EDGE_RISING: -		bank->toggle_edge_mode &= ~mask; -		level |= mask; -		polarity |= mask; -		break; -	case IRQ_TYPE_EDGE_FALLING: -		bank->toggle_edge_mode &= ~mask; -		level |= mask; -		polarity &= ~mask; -		break; -	case IRQ_TYPE_LEVEL_HIGH: -		bank->toggle_edge_mode &= ~mask; -		level &= ~mask; -		polarity |= mask; -		break; -	case IRQ_TYPE_LEVEL_LOW: -		bank->toggle_edge_mode &= ~mask; -		level &= ~mask; -		polarity &= ~mask; -		break; -	default: -		ret = -EINVAL; -		goto out; +	} else { +		if (bank->gpio_type == GPIO_TYPE_V2) { +			rockchip_gpio_writel_bit(bank, d->hwirq, 0, +						 bank->gpio_regs->int_bothedge); +		} else { +			bank->toggle_edge_mode &= ~mask; +		} +		switch (type) { +		case IRQ_TYPE_EDGE_RISING: +			level |= mask; +			polarity |= mask; +			break; +		case IRQ_TYPE_EDGE_FALLING: +			level |= mask; +			polarity &= ~mask; +			break; +		case IRQ_TYPE_LEVEL_HIGH: +			level &= ~mask; +			polarity |= mask; +			break; +		case IRQ_TYPE_LEVEL_LOW: +			level &= ~mask; +			polarity &= ~mask; +			break; +		default: +			ret = -EINVAL; +			goto out; +		}  	}  	rockchip_gpio_writel(bank, level, bank->gpio_regs->int_type);  |