mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-19 11:24:42 +00:00
gpio: add function _gpio_get_value
Introduce the function _gpio_get_value to get the GPIO value without check if it is reserved. This patch prepare new ops introduction. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
9f2b066cda
commit
8a9140cd38
1 changed files with 10 additions and 4 deletions
|
@ -476,18 +476,24 @@ int gpio_direction_output(unsigned gpio, int value)
|
||||||
desc.offset, value);
|
desc.offset, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dm_gpio_get_value(const struct gpio_desc *desc)
|
static int _gpio_get_value(const struct gpio_desc *desc)
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
|
value = gpio_get_ops(desc->dev)->get_value(desc->dev, desc->offset);
|
||||||
|
|
||||||
|
return desc->flags & GPIOD_ACTIVE_LOW ? !value : value;
|
||||||
|
}
|
||||||
|
|
||||||
|
int dm_gpio_get_value(const struct gpio_desc *desc)
|
||||||
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = check_reserved(desc, "get_value");
|
ret = check_reserved(desc, "get_value");
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
value = gpio_get_ops(desc->dev)->get_value(desc->dev, desc->offset);
|
return _gpio_get_value(desc);
|
||||||
|
|
||||||
return desc->flags & GPIOD_ACTIVE_LOW ? !value : value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int dm_gpio_set_value(const struct gpio_desc *desc, int value)
|
int dm_gpio_set_value(const struct gpio_desc *desc, int value)
|
||||||
|
|
Loading…
Add table
Reference in a new issue