mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
gpio: Modify common gpio.h to more closely match Linux
Change "int gp" to "unsigned gpio" Add request and free entry-points Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Cc: Joe Hershberger <joe.hershberger@gmail.com> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
This commit is contained in:
parent
9a420986cc
commit
5f533aeb51
1 changed files with 33 additions and 10 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2011 The Chromium OS Authors.
|
||||
* Copyright (c) 2011, NVIDIA Corp. All rights reserved.
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
|
@ -19,6 +20,9 @@
|
|||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _ASM_GENERIC_GPIO_H_
|
||||
#define _ASM_GENERIC_GPIO_H_
|
||||
|
||||
/*
|
||||
* Generic GPIO API for U-Boot
|
||||
*
|
||||
|
@ -38,37 +42,56 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Make a GPIO an input.
|
||||
* Request ownership of a GPIO.
|
||||
*
|
||||
* @param gp GPIO number
|
||||
* @param gpio GPIO number
|
||||
* @param label Name given to the GPIO
|
||||
* @return 0 if ok, -1 on error
|
||||
*/
|
||||
int gpio_direction_input(int gp);
|
||||
int gpio_request(unsigned gpio, const char *label);
|
||||
|
||||
/**
|
||||
* Stop using the GPIO. This function should not alter pin configuration.
|
||||
*
|
||||
* @param gpio GPIO number
|
||||
* @return 0 if ok, -1 on error
|
||||
*/
|
||||
int gpio_free(unsigned gpio);
|
||||
|
||||
/**
|
||||
* Make a GPIO an input.
|
||||
*
|
||||
* @param gpio GPIO number
|
||||
* @return 0 if ok, -1 on error
|
||||
*/
|
||||
int gpio_direction_input(unsigned gpio);
|
||||
|
||||
/**
|
||||
* Make a GPIO an output, and set its value.
|
||||
*
|
||||
* @param gp GPIO number
|
||||
* @param gpio GPIO number
|
||||
* @param value GPIO value (0 for low or 1 for high)
|
||||
* @return 0 if ok, -1 on error
|
||||
*/
|
||||
int gpio_direction_output(int gp, int value);
|
||||
int gpio_direction_output(unsigned gpio, int value);
|
||||
|
||||
/**
|
||||
* Get a GPIO's value. This will work whether the GPIO is an input
|
||||
* or an output.
|
||||
*
|
||||
* @param gp GPIO number
|
||||
* @param gpio GPIO number
|
||||
* @return 0 if low, 1 if high, -1 on error
|
||||
*/
|
||||
int gpio_get_value(int gp);
|
||||
int gpio_get_value(unsigned gpio);
|
||||
|
||||
/**
|
||||
* Set an output GPIO's value. The GPIO must already be an output of
|
||||
* Set an output GPIO's value. The GPIO must already be an output or
|
||||
* this function may have no effect.
|
||||
*
|
||||
* @param gp GPIO number
|
||||
* @param gpio GPIO number
|
||||
* @param value GPIO value (0 for low or 1 for high)
|
||||
* @return 0 if ok, -1 on error
|
||||
*/
|
||||
int gpio_set_value(int gp, int value);
|
||||
int gpio_set_value(unsigned gpio, int value);
|
||||
|
||||
#endif /* _ASM_GENERIC_GPIO_H_ */
|
||||
|
|
Loading…
Reference in a new issue