提交 5d1c17e9 编写于 作者: S Simon Glass

dm: gpio: Mark the old GPIO API deprecated

Add a deprecation notice to each function so that it is more obvious that we
are moving GPIOs to driver model.
Signed-off-by: NSimon Glass <sjg@chromium.org>
上级 3669e0e7
...@@ -10,6 +10,15 @@ ...@@ -10,6 +10,15 @@
/* /*
* Generic GPIO API for U-Boot * Generic GPIO API for U-Boot
* *
* --
* NB: This is deprecated. Please use the driver model functions instead:
*
* - gpio_request_by_name()
* - dm_gpio_get_value() etc.
*
* For now we need a dm_ prefix on some functions to avoid name collision.
* --
*
* GPIOs are numbered from 0 to GPIO_COUNT-1 which value is defined * GPIOs are numbered from 0 to GPIO_COUNT-1 which value is defined
* by the SOC/architecture. * by the SOC/architecture.
* *
...@@ -26,6 +35,7 @@ ...@@ -26,6 +35,7 @@
*/ */
/** /**
* @deprecated Please use driver model instead
* Request a GPIO. This should be called before any of the other functions * Request a GPIO. This should be called before any of the other functions
* are used on this GPIO. * are used on this GPIO.
* *
...@@ -39,6 +49,7 @@ ...@@ -39,6 +49,7 @@
int gpio_request(unsigned gpio, const char *label); int gpio_request(unsigned gpio, const char *label);
/** /**
* @deprecated Please use driver model instead
* Stop using the GPIO. This function should not alter pin configuration. * Stop using the GPIO. This function should not alter pin configuration.
* *
* @param gpio GPIO number * @param gpio GPIO number
...@@ -47,6 +58,7 @@ int gpio_request(unsigned gpio, const char *label); ...@@ -47,6 +58,7 @@ int gpio_request(unsigned gpio, const char *label);
int gpio_free(unsigned gpio); int gpio_free(unsigned gpio);
/** /**
* @deprecated Please use driver model instead
* Make a GPIO an input. * Make a GPIO an input.
* *
* @param gpio GPIO number * @param gpio GPIO number
...@@ -55,6 +67,7 @@ int gpio_free(unsigned gpio); ...@@ -55,6 +67,7 @@ int gpio_free(unsigned gpio);
int gpio_direction_input(unsigned gpio); int gpio_direction_input(unsigned gpio);
/** /**
* @deprecated Please use driver model instead
* Make a GPIO an output, and set its value. * Make a GPIO an output, and set its value.
* *
* @param gpio GPIO number * @param gpio GPIO number
...@@ -64,6 +77,7 @@ int gpio_direction_input(unsigned gpio); ...@@ -64,6 +77,7 @@ int gpio_direction_input(unsigned gpio);
int gpio_direction_output(unsigned gpio, int value); int gpio_direction_output(unsigned gpio, int value);
/** /**
* @deprecated Please use driver model instead
* Get a GPIO's value. This will work whether the GPIO is an input * Get a GPIO's value. This will work whether the GPIO is an input
* or an output. * or an output.
* *
...@@ -73,6 +87,7 @@ int gpio_direction_output(unsigned gpio, int value); ...@@ -73,6 +87,7 @@ int gpio_direction_output(unsigned gpio, int value);
int gpio_get_value(unsigned gpio); int gpio_get_value(unsigned gpio);
/** /**
* @deprecated Please use driver model instead
* Set an output GPIO's value. The GPIO must already be an output or * Set an output GPIO's value. The GPIO must already be an output or
* this function may have no effect. * this function may have no effect.
* *
...@@ -134,6 +149,8 @@ static inline bool dm_gpio_is_valid(struct gpio_desc *desc) ...@@ -134,6 +149,8 @@ static inline bool dm_gpio_is_valid(struct gpio_desc *desc)
* which means this is GPIO bank b, offset 4, currently set to input, current * which means this is GPIO bank b, offset 4, currently set to input, current
* value 1, [x] means that it is requested and the owner is 'sdmmc_cd' * value 1, [x] means that it is requested and the owner is 'sdmmc_cd'
* *
* TODO(sjg@chromium.org): This should use struct gpio_desc
*
* @dev: Device to check * @dev: Device to check
* @offset: Offset of device GPIO to check * @offset: Offset of device GPIO to check
* @buf: Place to put string * @buf: Place to put string
...@@ -146,6 +163,8 @@ int gpio_get_status(struct udevice *dev, int offset, char *buf, int buffsize); ...@@ -146,6 +163,8 @@ int gpio_get_status(struct udevice *dev, int offset, char *buf, int buffsize);
* *
* Note this returns GPIOF_UNUSED if the GPIO is not requested. * Note this returns GPIOF_UNUSED if the GPIO is not requested.
* *
* TODO(sjg@chromium.org): This should use struct gpio_desc
*
* @dev: Device to check * @dev: Device to check
* @offset: Offset of device GPIO to check * @offset: Offset of device GPIO to check
* @namep: If non-NULL, this is set to the nane given when the GPIO * @namep: If non-NULL, this is set to the nane given when the GPIO
...@@ -163,6 +182,8 @@ int gpio_get_function(struct udevice *dev, int offset, const char **namep); ...@@ -163,6 +182,8 @@ int gpio_get_function(struct udevice *dev, int offset, const char **namep);
* Note this does not return GPIOF_UNUSED - it will always return the GPIO * Note this does not return GPIOF_UNUSED - it will always return the GPIO
* driver's view of a pin function, even if it is not correctly set up. * driver's view of a pin function, even if it is not correctly set up.
* *
* TODO(sjg@chromium.org): This should use struct gpio_desc
*
* @dev: Device to check * @dev: Device to check
* @offset: Offset of device GPIO to check * @offset: Offset of device GPIO to check
* @namep: If non-NULL, this is set to the nane given when the GPIO * @namep: If non-NULL, this is set to the nane given when the GPIO
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册