gpio: dln2: use bus_sync_unlock instead of scheduling work
[cascardo/linux.git] / drivers / gpio / gpio-mxs.c
index 8ffdd7d..84cbda6 100644 (file)
@@ -227,6 +227,18 @@ static int mxs_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
        return irq_find_mapping(port->domain, offset);
 }
 
+static int mxs_gpio_get_direction(struct gpio_chip *gc, unsigned offset)
+{
+       struct bgpio_chip *bgc = to_bgpio_chip(gc);
+       struct mxs_gpio_port *port =
+               container_of(bgc, struct mxs_gpio_port, bgc);
+       u32 mask = 1 << offset;
+       u32 dir;
+
+       dir = readl(port->base + PINCTRL_DOE(port));
+       return !(dir & mask);
+}
+
 static struct platform_device_id mxs_gpio_ids[] = {
        {
                .name = "imx23-gpio",
@@ -320,6 +332,7 @@ static int mxs_gpio_probe(struct platform_device *pdev)
                goto out_irqdesc_free;
 
        port->bgc.gc.to_irq = mxs_gpio_to_irq;
+       port->bgc.gc.get_direction = mxs_gpio_get_direction;
        port->bgc.gc.base = port->id * 32;
 
        err = gpiochip_add(&port->bgc.gc);
@@ -338,7 +351,6 @@ out_irqdesc_free:
 static struct platform_driver mxs_gpio_driver = {
        .driver         = {
                .name   = "gpio-mxs",
-               .owner  = THIS_MODULE,
                .of_match_table = mxs_gpio_dt_ids,
        },
        .probe          = mxs_gpio_probe,