GPIO: i.MX: Implement get_direction()
Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
6ca980c096
commit
e9ab71561b
|
@ -113,11 +113,21 @@ static int imx_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
|
|||
return val & (1 << gpio) ? 1 : 0;
|
||||
}
|
||||
|
||||
static int imx_get_direction(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
struct imx_gpio_chip *imxgpio = container_of(chip, struct imx_gpio_chip, chip);
|
||||
void __iomem *base = imxgpio->base;
|
||||
u32 val = readl(base + imxgpio->regs->gdir);
|
||||
|
||||
return (val & (1 << offset)) ? GPIOF_DIR_OUT : GPIOF_DIR_IN;
|
||||
}
|
||||
|
||||
static struct gpio_ops imx_gpio_ops = {
|
||||
.direction_input = imx_gpio_direction_input,
|
||||
.direction_output = imx_gpio_direction_output,
|
||||
.get = imx_gpio_get_value,
|
||||
.set = imx_gpio_set_value,
|
||||
.get_direction = imx_get_direction,
|
||||
};
|
||||
|
||||
static int imx_gpio_probe(struct device_d *dev)
|
||||
|
|
Loading…
Reference in New Issue