summaryrefslogtreecommitdiff
path: root/drivers/gpio/sandbox.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-10-04 11:29:45 -0600
committerSimon Glass <sjg@chromium.org>2014-10-23 19:29:52 -0600
commit699ea9606ca8e4227c8be607197733d348cd12c4 (patch)
tree48e475b9f368ab1d5eefd87ea92889eb7621554f /drivers/gpio/sandbox.c
parent0757535a7eee3ae5603520fe4a0588a01a590ea7 (diff)
downloadu-boot-imx-699ea9606ca8e4227c8be607197733d348cd12c4.zip
u-boot-imx-699ea9606ca8e4227c8be607197733d348cd12c4.tar.gz
u-boot-imx-699ea9606ca8e4227c8be607197733d348cd12c4.tar.bz2
dm: gpio: sandbox: Implement the get_function() method
Implement this method so that the 'gpio' command can do its job correctly. For sandbox we only support input and output states for a gpio. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/gpio/sandbox.c')
-rw-r--r--drivers/gpio/sandbox.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c
index 75ada5d..7aa8b1f 100644
--- a/drivers/gpio/sandbox.c
+++ b/drivers/gpio/sandbox.c
@@ -203,6 +203,13 @@ static int sb_gpio_get_state(struct udevice *dev, unsigned int offset,
return 0;
}
+static int sb_gpio_get_function(struct udevice *dev, unsigned offset)
+{
+ if (get_gpio_flag(dev, offset, GPIOF_OUTPUT))
+ return GPIOF_OUTPUT;
+ return GPIOF_INPUT;
+}
+
static const struct dm_gpio_ops gpio_sandbox_ops = {
.request = sb_gpio_request,
.free = sb_gpio_free,
@@ -210,7 +217,7 @@ static const struct dm_gpio_ops gpio_sandbox_ops = {
.direction_output = sb_gpio_direction_output,
.get_value = sb_gpio_get_value,
.set_value = sb_gpio_set_value,
- .get_state = sb_gpio_get_state,
+ .get_function = sb_gpio_get_function,
};
static int sandbox_gpio_ofdata_to_platdata(struct udevice *dev)