Commit 87bee386 authored by David Brownell's avatar David Brownell Committed by Tony Lindgren

twl4030-gpio: remove legacy irq triggering calls and user

Make the hsmmc code use genirq interfaces to make sure the
card detect IRQ triggers on both edges.  Remove the older
TWL-specific infrastructure for making that happen.
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 4f02b5d7
...@@ -65,11 +65,6 @@ static int hsmmc_late_init(struct device *dev) ...@@ -65,11 +65,6 @@ static int hsmmc_late_init(struct device *dev)
if (ret) if (ret)
goto err; goto err;
ret = twl4030_set_gpio_edge_ctrl(MMC1_CD_IRQ,
TWL4030_GPIO_EDGE_RISING | TWL4030_GPIO_EDGE_FALLING);
if (ret)
goto err;
ret = twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x02, ret = twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x02,
TWL_GPIO_PUPDCTR1); TWL_GPIO_PUPDCTR1);
if (ret) if (ret)
......
...@@ -509,10 +509,7 @@ int twl4030_set_gpio_pull(int gpio, int pull_dircn) ...@@ -509,10 +509,7 @@ int twl4030_set_gpio_pull(int gpio, int pull_dircn)
} }
#endif #endif
/* static int twl4030_set_gpio_edge_ctrl(int gpio, int edge)
* Configure Edge control for a GPIO pin on TWL4030
*/
int twl4030_set_gpio_edge_ctrl(int gpio, int edge)
{ {
u8 c_bnk = GET_GPIO_CTL_BANK(gpio); u8 c_bnk = GET_GPIO_CTL_BANK(gpio);
u8 c_off = GET_GPIO_CTL_OFF(gpio); u8 c_off = GET_GPIO_CTL_OFF(gpio);
...@@ -521,33 +518,26 @@ int twl4030_set_gpio_edge_ctrl(int gpio, int edge) ...@@ -521,33 +518,26 @@ int twl4030_set_gpio_edge_ctrl(int gpio, int edge)
u8 base = 0; u8 base = 0;
int ret = 0; int ret = 0;
if (unlikely((gpio >= TWL4030_GPIO_MAX)
|| !(gpio_usage_count & (0x1 << gpio))))
return -EPERM;
base = REG_GPIO_EDR1 + c_bnk; base = REG_GPIO_EDR1 + c_bnk;
if (edge & TWL4030_GPIO_EDGE_RISING) if (edge & IRQ_TYPE_EDGE_RISING)
c_msk |= MASK_GPIO_EDR1_GPIOxRISING(c_off); c_msk |= MASK_GPIO_EDR1_GPIOxRISING(c_off);
if (edge & IRQ_TYPE_EDGE_FALLING)
if (edge & TWL4030_GPIO_EDGE_FALLING)
c_msk |= MASK_GPIO_EDR1_GPIOxFALLING(c_off); c_msk |= MASK_GPIO_EDR1_GPIOxFALLING(c_off);
mutex_lock(&gpio_lock); mutex_lock(&gpio_lock);
ret = gpio_twl4030_read(base); ret = gpio_twl4030_read(base);
if (ret >= 0) { if (ret >= 0) {
/* clear the previous rising/falling values */ /* clear the previous rising/falling values */
reg = reg = (u8) ret;
(u8) (ret & reg &= ~( MASK_GPIO_EDR1_GPIOxFALLING(c_off)
~(MASK_GPIO_EDR1_GPIOxFALLING(c_off) | | MASK_GPIO_EDR1_GPIOxRISING(c_off));
MASK_GPIO_EDR1_GPIOxRISING(c_off)));
reg |= c_msk; reg |= c_msk;
ret = gpio_twl4030_write(base, reg); ret = gpio_twl4030_write(base, reg);
} }
mutex_unlock(&gpio_lock); mutex_unlock(&gpio_lock);
return ret; return ret;
} }
EXPORT_SYMBOL(twl4030_set_gpio_edge_ctrl);
/* /*
* Configure debounce timing value for a GPIO pin on TWL4030 * Configure debounce timing value for a GPIO pin on TWL4030
...@@ -652,7 +642,7 @@ static int twl4030_gpio_unmask_thread(void *data) ...@@ -652,7 +642,7 @@ static int twl4030_gpio_unmask_thread(void *data)
gpio_trigger; gpio_trigger;
gpio_trigger >>= 1, irq++) { gpio_trigger >>= 1, irq++) {
struct irq_desc *desc; struct irq_desc *desc;
unsigned type, edge; unsigned type;
if (!(gpio_trigger & 0x1)) if (!(gpio_trigger & 0x1))
continue; continue;
...@@ -662,19 +652,8 @@ static int twl4030_gpio_unmask_thread(void *data) ...@@ -662,19 +652,8 @@ static int twl4030_gpio_unmask_thread(void *data)
type = desc->status & IRQ_TYPE_SENSE_MASK; type = desc->status & IRQ_TYPE_SENSE_MASK;
spin_unlock_irq(&desc->lock); spin_unlock_irq(&desc->lock);
switch (type) { twl4030_set_gpio_edge_ctrl(irq - twl4030_gpio_irq_base,
case IRQ_TYPE_EDGE_RISING: type);
edge = TWL4030_GPIO_EDGE_RISING;
break;
case IRQ_TYPE_EDGE_FALLING:
edge = TWL4030_GPIO_EDGE_FALLING;
break;
default:
edge = TWL4030_GPIO_EDGE_RISING
| TWL4030_GPIO_EDGE_FALLING;
break;
}
twl4030_set_gpio_edge_ctrl(irq, edge);
} }
local_irq_disable(); local_irq_disable();
......
...@@ -928,7 +928,9 @@ static int __init omap_mmc_probe(struct platform_device *pdev) ...@@ -928,7 +928,9 @@ static int __init omap_mmc_probe(struct platform_device *pdev)
/* Request IRQ for card detect */ /* Request IRQ for card detect */
if ((mmc_slot(host).card_detect_irq) && (mmc_slot(host).card_detect)) { if ((mmc_slot(host).card_detect_irq) && (mmc_slot(host).card_detect)) {
ret = request_irq(mmc_slot(host).card_detect_irq, ret = request_irq(mmc_slot(host).card_detect_irq,
omap_mmc_cd_handler, IRQF_DISABLED, omap_mmc_cd_handler,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING
| IRQF_DISABLED,
mmc_hostname(mmc), host); mmc_hostname(mmc), host);
if (ret) { if (ret) {
dev_dbg(mmc_dev(host->mmc), dev_dbg(mmc_dev(host->mmc),
......
...@@ -149,9 +149,6 @@ struct twl4030_platform_data { ...@@ -149,9 +149,6 @@ struct twl4030_platform_data {
#define TWL4030_GPIO_PULL_UP 0 #define TWL4030_GPIO_PULL_UP 0
#define TWL4030_GPIO_PULL_DOWN 1 #define TWL4030_GPIO_PULL_DOWN 1
#define TWL4030_GPIO_PULL_NONE 2 #define TWL4030_GPIO_PULL_NONE 2
#define TWL4030_GPIO_EDGE_NONE 0
#define TWL4030_GPIO_EDGE_RISING 1
#define TWL4030_GPIO_EDGE_FALLING 2
/* Functions to read and write from TWL4030 */ /* Functions to read and write from TWL4030 */
...@@ -177,7 +174,6 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, u8 num_bytes); ...@@ -177,7 +174,6 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, u8 num_bytes);
*/ */
int twl4030_get_gpio_datain(int gpio); int twl4030_get_gpio_datain(int gpio);
int twl4030_request_gpio(int gpio); int twl4030_request_gpio(int gpio);
int twl4030_set_gpio_edge_ctrl(int gpio, int edge);
int twl4030_set_gpio_debounce(int gpio, int enable); int twl4030_set_gpio_debounce(int gpio, int enable);
int twl4030_free_gpio(int gpio); int twl4030_free_gpio(int gpio);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment