mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 08:15:07 -04:00
powerpc: implement get_direction() in cpm2
The lack of get_direction() callback in this driver causes GPIOLIB to
emit a warning. Implement it.
Fixes: e623c4303e ("gpiolib: sanitize the return value of gpio_chip::get_direction()")
Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/c6eb70aa0e1ba6e15f947c827006aa79edace05c.1785318836.git.chleroy@kernel.org
This commit is contained in:
committed by
Madhavan Srinivasan
parent
be57ed7694
commit
ca16219e9b
@@ -181,6 +181,18 @@ static int cpm2_gpio32_dir_in(struct gpio_chip *gc, unsigned int gpio)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpm2_gpio32_get_direction(struct gpio_chip *gc, unsigned int gpio)
|
||||
{
|
||||
struct cpm2_gpio32_chip *cpm2_gc = gpiochip_get_data(gc);
|
||||
struct cpm2_ioports __iomem *iop = cpm2_gc->regs;
|
||||
u32 pin_mask = 1 << (31 - gpio);
|
||||
|
||||
if (in_be32(&iop->dir) & pin_mask)
|
||||
return GPIO_LINE_DIRECTION_OUT;
|
||||
|
||||
return GPIO_LINE_DIRECTION_IN;
|
||||
}
|
||||
|
||||
int cpm2_gpiochip_add32(struct device *dev)
|
||||
{
|
||||
struct device_node *np = dev->of_node;
|
||||
@@ -199,6 +211,7 @@ int cpm2_gpiochip_add32(struct device *dev)
|
||||
gc->ngpio = 32;
|
||||
gc->direction_input = cpm2_gpio32_dir_in;
|
||||
gc->direction_output = cpm2_gpio32_dir_out;
|
||||
gc->get_direction = cpm2_gpio32_get_direction;
|
||||
gc->get = cpm2_gpio32_get;
|
||||
gc->set = cpm2_gpio32_set;
|
||||
gc->parent = dev;
|
||||
|
||||
Reference in New Issue
Block a user