gpio: Remove obsolete API 1.0 callback mechanism
In 1.0 you could set only one callback on the whole gpio controller. It was impossible for another sub-system to add another callback, without overwritting an existing one. Such API has been obsolete for a long time and no one is using it anymore. Thus removing it entirely. Change-Id: I6a17fd99373dc6cef1fa2ebb421e992412d5015e Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
7e6dacd65f
commit
a6cf6038e3
16 changed files with 3 additions and 275 deletions
|
@ -1,7 +1,5 @@
|
|||
ccflags-y +=-I$(srctree)/drivers
|
||||
|
||||
obj-y += gpio_api_compat.o
|
||||
|
||||
obj-$(CONFIG_GPIO_DW) += gpio_dw.o
|
||||
obj-$(CONFIG_GPIO_PCAL9535A) += gpio_pcal9535a.o
|
||||
obj-$(CONFIG_GPIO_MMIO) += gpio_mmio.o
|
||||
|
|
|
@ -1,102 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file Implementation of the API 1.0 GPIO compatibility layer
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <gpio.h>
|
||||
#include <misc/util.h>
|
||||
|
||||
#include "gpio_api_compat.h"
|
||||
|
||||
/** These are maintained in a dedicated .gpio_compat section
|
||||
* See relevant arch's linker definitions in include/arch/
|
||||
*/
|
||||
extern struct gpio_compat_cb __gpio_compat_start[];
|
||||
extern struct gpio_compat_cb __gpio_compat_end[];
|
||||
|
||||
static struct gpio_compat_cb *_gpio_compat_dev_lookup(struct device *dev)
|
||||
{
|
||||
struct gpio_compat_cb *cb;
|
||||
|
||||
for (cb = __gpio_compat_start; cb != __gpio_compat_end; cb++) {
|
||||
if (cb->dev == dev) {
|
||||
return cb;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void _gpio_compat_handler(struct device *dev,
|
||||
struct gpio_callback *cb, uint32_t pins)
|
||||
{
|
||||
struct _gpio_compat_data *data;
|
||||
int bit;
|
||||
|
||||
data = CONTAINER_OF(cb, struct _gpio_compat_data, cb);
|
||||
|
||||
for (bit = 0; bit < 32; bit++) {
|
||||
if (pins & BIT(bit)) {
|
||||
data->handler(dev, bit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int gpio_set_callback(struct device *dev, gpio_callback_t callback)
|
||||
{
|
||||
struct gpio_compat_cb *compat = _gpio_compat_dev_lookup(dev);
|
||||
int ret;
|
||||
|
||||
if (!compat) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
ret = gpio_remove_callback(dev, &compat->d->cb);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!callback) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
compat->d->handler = callback;
|
||||
compat->d->cb.handler = _gpio_compat_handler;
|
||||
|
||||
return gpio_add_callback(dev, &compat->d->cb);
|
||||
}
|
||||
|
||||
void _gpio_enable_callback(struct device *dev, uint32_t pins)
|
||||
{
|
||||
struct gpio_compat_cb *compat = _gpio_compat_dev_lookup(dev);
|
||||
|
||||
if (compat) {
|
||||
compat->d->cb.pin_mask |= pins;
|
||||
}
|
||||
}
|
||||
|
||||
void _gpio_disable_callback(struct device *dev, uint32_t pins)
|
||||
{
|
||||
struct gpio_compat_cb *compat = _gpio_compat_dev_lookup(dev);
|
||||
|
||||
if (compat) {
|
||||
compat->d->cb.pin_mask &= ~(pins);
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file Header for the API 1.0 GPIO compatibility code
|
||||
*/
|
||||
|
||||
#ifndef __GPIO_API_COMPAT_H__
|
||||
#define __GPIO_API_COMPAT_H__
|
||||
|
||||
struct _gpio_compat_data {
|
||||
struct gpio_callback cb;
|
||||
gpio_callback_t handler;
|
||||
};
|
||||
|
||||
struct gpio_compat_cb {
|
||||
struct device *dev;
|
||||
struct _gpio_compat_data *d;
|
||||
};
|
||||
|
||||
/** This macro is mandatory to be used in order to enable the API 1.0
|
||||
* support on GPIO drivers.
|
||||
*/
|
||||
#define GPIO_SETUP_COMPAT_DEV(dev_name) \
|
||||
static struct _gpio_compat_data (__gcd_##dev_name) = {}; \
|
||||
\
|
||||
static struct gpio_compat_cb (__gpio_compat_##dev_name) __used \
|
||||
__attribute__((__section__(".gpio_compat.init"))) = { \
|
||||
.dev = &(__device_##dev_name), \
|
||||
.d = &(__gcd_##dev_name) \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable the API v1.0 callback on given pins
|
||||
*
|
||||
* @param port device driver instance pointer to affect
|
||||
* @param pins mask of pins to enable
|
||||
*/
|
||||
void _gpio_enable_callback(struct device *port, uint32_t pins);
|
||||
|
||||
/**
|
||||
* @brief Disable the API v1.0 callback on given pins
|
||||
*
|
||||
* @param port device driver instance pointer to affect
|
||||
* @param pins mask of pins to disable
|
||||
*/
|
||||
void _gpio_disable_callback(struct device *port, uint32_t pins);
|
||||
|
||||
#endif /* __GPIO_API_COMPAT_H__ */
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
#include <gpio.h>
|
||||
#include "gpio_utils.h"
|
||||
#include "gpio_api_compat.h"
|
||||
|
||||
typedef void (*config_func_t)(struct device *port);
|
||||
|
||||
|
@ -240,7 +239,6 @@ static int gpio_sam3_enable_callback(struct device *dev,
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
_gpio_enable_callback(dev, mask);
|
||||
cfg->port->ier |= mask;
|
||||
|
||||
return 0;
|
||||
|
@ -263,7 +261,6 @@ static int gpio_sam3_disable_callback(struct device *dev,
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
_gpio_disable_callback(dev, mask);
|
||||
cfg->port->idr |= mask;
|
||||
|
||||
return 0;
|
||||
|
@ -307,7 +304,6 @@ DEVICE_AND_API_INIT(gpio_sam3_a, CONFIG_GPIO_ATMEL_SAM3_PORTA_DEV_NAME,
|
|||
gpio_sam3_init, NULL, &gpio_sam3_a_cfg,
|
||||
SECONDARY, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
&gpio_sam3_drv_api_funcs);
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_sam3_a);
|
||||
|
||||
void gpio_sam3_config_a(struct device *dev)
|
||||
{
|
||||
|
@ -334,7 +330,6 @@ DEVICE_AND_API_INIT(gpio_sam3_b, CONFIG_GPIO_ATMEL_SAM3_PORTB_DEV_NAME,
|
|||
gpio_sam3_init, NULL, &gpio_sam3_b_cfg,
|
||||
SECONDARY, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
&gpio_sam3_drv_api_funcs);
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_sam3_b);
|
||||
|
||||
void gpio_sam3_config_b(struct device *dev)
|
||||
{
|
||||
|
@ -361,7 +356,6 @@ DEVICE_AND_API_INIT(gpio_sam3_c, CONFIG_GPIO_ATMEL_SAM3_PORTC_DEV_NAME,
|
|||
gpio_sam3_init, NULL, &gpio_sam3_c_cfg,
|
||||
SECONDARY, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
&gpio_sam3_drv_api_funcs);
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_sam3_c);
|
||||
|
||||
void gpio_sam3_config_c(struct device *dev)
|
||||
{
|
||||
|
@ -388,7 +382,6 @@ DEVICE_AND_API_INIT(gpio_sam3_d, CONFIG_GPIO_ATMEL_SAM3_PORTD_DEV_NAME,
|
|||
gpio_sam3_init, NULL, &gpio_sam3_d_cfg,
|
||||
SECONDARY, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
&gpio_sam3_drv_api_funcs);
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_sam3_d);
|
||||
|
||||
void gpio_sam3_config_d(struct device *dev)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <gpio.h>
|
||||
#include "gpio_dw.h"
|
||||
#include "gpio_utils.h"
|
||||
#include "gpio_api_compat.h"
|
||||
|
||||
#include <board.h>
|
||||
#include <sys_io.h>
|
||||
|
@ -313,11 +312,9 @@ static inline int gpio_dw_enable_callback(struct device *port, int access_op,
|
|||
if (GPIO_ACCESS_BY_PIN == access_op) {
|
||||
dw_write(base_addr, PORTA_EOI, BIT(pin));
|
||||
dw_set_bit(base_addr, INTMASK, pin, 0);
|
||||
_gpio_enable_callback(port, BIT(pin));
|
||||
} else {
|
||||
dw_write(base_addr, PORTA_EOI, BIT_MASK(config->bits));
|
||||
dw_write(base_addr, INTMASK, 0);
|
||||
_gpio_enable_callback(port, BIT_MASK(config->bits));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -331,10 +328,8 @@ static inline int gpio_dw_disable_callback(struct device *port, int access_op,
|
|||
|
||||
if (GPIO_ACCESS_BY_PIN == access_op) {
|
||||
dw_set_bit(base_addr, INTMASK, pin, 1);
|
||||
_gpio_disable_callback(port, BIT(pin));
|
||||
} else {
|
||||
dw_write(base_addr, INTMASK, BIT_MASK(config->bits));
|
||||
_gpio_disable_callback(port, BIT_MASK(config->bits));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -511,7 +506,6 @@ DEVICE_AND_API_INIT(gpio_dw_0, CONFIG_GPIO_DW_0_NAME, gpio_dw_initialize,
|
|||
SECONDARY, CONFIG_GPIO_DW_INIT_PRIORITY,
|
||||
&api_funcs);
|
||||
#endif
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_dw_0);
|
||||
|
||||
void gpio_config_0_irq(struct device *port)
|
||||
{
|
||||
|
@ -579,7 +573,6 @@ DEVICE_AND_API_INIT(gpio_dw_1, CONFIG_GPIO_DW_1_NAME, gpio_dw_initialize,
|
|||
SECONDARY, CONFIG_GPIO_DW_INIT_PRIORITY,
|
||||
&api_funcs);
|
||||
#endif
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_dw_1);
|
||||
|
||||
void gpio_config_1_irq(struct device *port)
|
||||
{
|
||||
|
@ -646,7 +639,6 @@ DEVICE_AND_API_INIT(gpio_dw_2, CONFIG_GPIO_DW_2_NAME, gpio_dw_initialize,
|
|||
SECONDARY, CONFIG_GPIO_DW_INIT_PRIORITY,
|
||||
&api_funcs);
|
||||
#endif
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_dw_2);
|
||||
|
||||
void gpio_config_2_irq(struct device *port)
|
||||
{
|
||||
|
@ -713,7 +705,6 @@ DEVICE_AND_API_INIT(gpio_dw_3, CONFIG_GPIO_DW_3_NAME, gpio_dw_initialize,
|
|||
SECONDARY, CONFIG_GPIO_DW_INIT_PRIORITY,
|
||||
&api_funcs);
|
||||
#endif
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_dw_3);
|
||||
|
||||
void gpio_config_3_irq(struct device *port)
|
||||
{
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
#include "gpio_k64.h"
|
||||
#include "gpio_utils.h"
|
||||
#include "gpio_api_compat.h"
|
||||
|
||||
static int gpio_k64_config(struct device *dev,
|
||||
int access_op, uint32_t pin, int flags)
|
||||
|
@ -202,10 +201,8 @@ static int gpio_k64_enable_callback(struct device *dev,
|
|||
struct gpio_k64_data *data = dev->driver_data;
|
||||
|
||||
if (access_op == GPIO_ACCESS_BY_PIN) {
|
||||
_gpio_enable_callback(dev, BIT(pin));
|
||||
data->pin_callback_enables |= BIT(pin);
|
||||
} else {
|
||||
_gpio_enable_callback(dev, 0xFFFFFFFF);
|
||||
data->pin_callback_enables = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
|
@ -219,10 +216,8 @@ static int gpio_k64_disable_callback(struct device *dev,
|
|||
struct gpio_k64_data *data = dev->driver_data;
|
||||
|
||||
if (access_op == GPIO_ACCESS_BY_PIN) {
|
||||
_gpio_disable_callback(dev, BIT(pin));
|
||||
data->pin_callback_enables &= ~BIT(pin);
|
||||
} else {
|
||||
_gpio_disable_callback(dev, 0xFFFFFFFF);
|
||||
data->pin_callback_enables = 0;
|
||||
}
|
||||
|
||||
|
@ -282,7 +277,6 @@ DEVICE_AND_API_INIT(gpio_k64_A, CONFIG_GPIO_K64_A_DEV_NAME, gpio_k64_A_init,
|
|||
&gpio_data_A, &gpio_k64_A_cfg,
|
||||
SECONDARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&gpio_k64_drv_api_funcs);
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_k64_A);
|
||||
|
||||
static int gpio_k64_A_init(struct device *dev)
|
||||
{
|
||||
|
@ -312,7 +306,6 @@ DEVICE_AND_API_INIT(gpio_k64_B, CONFIG_GPIO_K64_B_DEV_NAME, gpio_k64_B_init,
|
|||
&gpio_data_B, &gpio_k64_B_cfg,
|
||||
SECONDARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&gpio_k64_drv_api_funcs);
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_k64_B);
|
||||
|
||||
static int gpio_k64_B_init(struct device *dev)
|
||||
{
|
||||
|
@ -342,7 +335,6 @@ DEVICE_AND_API_INIT(gpio_k64_C, CONFIG_GPIO_K64_C_DEV_NAME, gpio_k64_C_init,
|
|||
&gpio_data_C, &gpio_k64_C_cfg,
|
||||
SECONDARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&gpio_k64_drv_api_funcs);
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_k64_C);
|
||||
|
||||
static int gpio_k64_C_init(struct device *dev)
|
||||
{
|
||||
|
@ -372,7 +364,6 @@ DEVICE_AND_API_INIT(gpio_k64_D, CONFIG_GPIO_K64_D_DEV_NAME, gpio_k64_D_init,
|
|||
&gpio_data_D, &gpio_k64_D_cfg,
|
||||
SECONDARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&gpio_k64_drv_api_funcs);
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_k64_D);
|
||||
|
||||
static int gpio_k64_D_init(struct device *dev)
|
||||
{
|
||||
|
@ -402,7 +393,6 @@ DEVICE_AND_API_INIT(gpio_k64_E, CONFIG_GPIO_K64_E_DEV_NAME, gpio_k64_E_init,
|
|||
&gpio_data_E, &gpio_k64_E_cfg,
|
||||
SECONDARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&gpio_k64_drv_api_funcs);
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_k64_E);
|
||||
|
||||
static int gpio_k64_E_init(struct device *dev)
|
||||
{
|
||||
|
|
|
@ -75,8 +75,6 @@ struct gpio_nrf5_config {
|
|||
};
|
||||
|
||||
struct gpio_nrf5_data {
|
||||
/* port ISR callback routine address */
|
||||
gpio_callback_t callback_func;
|
||||
/* pin callback routine enable flags, by pin number */
|
||||
uint32_t pin_callback_enables;
|
||||
/* port callback routine enable flag */
|
||||
|
@ -229,4 +227,3 @@ static int gpio_nrf5_P0_init(struct device *dev)
|
|||
}
|
||||
|
||||
#endif /* CONFIG_GPIO_NRF5_P0 */
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include "qm_gpio.h"
|
||||
#include "gpio_utils.h"
|
||||
#include "gpio_api_compat.h"
|
||||
#include "qm_isr.h"
|
||||
#include "clk.h"
|
||||
#include <power.h>
|
||||
|
@ -136,7 +135,6 @@ DEVICE_INIT_PM(gpio_0, CONFIG_GPIO_QMSI_0_NAME, &gpio_qmsi_init,
|
|||
DEVICE_PM_OPS_GET(gpio), &gpio_0_runtime, &gpio_0_config,
|
||||
SECONDARY, CONFIG_GPIO_QMSI_INIT_PRIORITY);
|
||||
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_0);
|
||||
#endif /* CONFIG_GPIO_QMSI_0 */
|
||||
|
||||
#ifdef CONFIG_GPIO_QMSI_AON
|
||||
|
@ -175,7 +173,6 @@ DEFINE_DEVICE_PM_OPS(gpio_aon, gpio_aon_suspend_device, gpio_aon_resume_device);
|
|||
DEVICE_INIT_PM(gpio_aon, CONFIG_GPIO_QMSI_AON_NAME, &gpio_qmsi_init,
|
||||
DEVICE_PM_OPS_GET(gpio_aon), &gpio_aon_runtime,
|
||||
&gpio_aon_config, SECONDARY, CONFIG_GPIO_QMSI_INIT_PRIORITY);
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_aon);
|
||||
|
||||
#endif /* CONFIG_GPIO_QMSI_AON */
|
||||
|
||||
|
@ -360,10 +357,8 @@ static inline int gpio_qmsi_enable_callback(struct device *port,
|
|||
gpio_critical_region_start(port);
|
||||
|
||||
if (access_op == GPIO_ACCESS_BY_PIN) {
|
||||
_gpio_enable_callback(port, BIT(pin));
|
||||
context->pin_callbacks |= BIT(pin);
|
||||
} else {
|
||||
_gpio_enable_callback(port, 0xffffffff);
|
||||
context->pin_callbacks = 0xffffffff;
|
||||
}
|
||||
|
||||
|
@ -379,10 +374,8 @@ static inline int gpio_qmsi_disable_callback(struct device *port,
|
|||
gpio_critical_region_start(port);
|
||||
|
||||
if (access_op == GPIO_ACCESS_BY_PIN) {
|
||||
_gpio_disable_callback(port, BIT(pin));
|
||||
context->pin_callbacks &= ~BIT(pin);
|
||||
} else {
|
||||
_gpio_disable_callback(port, 0xffffffff);
|
||||
context->pin_callbacks = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "qm_ss_isr.h"
|
||||
#include "ss_clk.h"
|
||||
#include "gpio_utils.h"
|
||||
#include "gpio_api_compat.h"
|
||||
|
||||
struct ss_gpio_qmsi_config {
|
||||
qm_ss_gpio_t gpio;
|
||||
|
@ -88,7 +87,6 @@ static struct ss_gpio_qmsi_runtime ss_gpio_0_runtime;
|
|||
DEVICE_INIT(ss_gpio_0, CONFIG_GPIO_QMSI_SS_0_NAME, &ss_gpio_qmsi_init,
|
||||
&ss_gpio_0_runtime, &ss_gpio_0_config,
|
||||
SECONDARY, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
|
||||
GPIO_SETUP_COMPAT_DEV(ss_gpio_0);
|
||||
|
||||
#endif /* CONFIG_GPIO_QMSI_SS_0 */
|
||||
|
||||
|
@ -103,7 +101,6 @@ static struct ss_gpio_qmsi_runtime gpio_1_runtime;
|
|||
DEVICE_INIT(ss_gpio_1, CONFIG_GPIO_QMSI_SS_1_NAME, &ss_gpio_qmsi_init,
|
||||
&gpio_1_runtime, &ss_gpio_1_config,
|
||||
SECONDARY, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
|
||||
GPIO_SETUP_COMPAT_DEV(ss_gpio_1);
|
||||
|
||||
#endif /* CONFIG_GPIO_QMSI_SS_1 */
|
||||
|
||||
|
@ -289,10 +286,8 @@ static inline int ss_gpio_qmsi_enable_callback(struct device *port,
|
|||
|
||||
gpio_critical_region_start(port);
|
||||
if (access_op == GPIO_ACCESS_BY_PIN) {
|
||||
_gpio_enable_callback(port, BIT(pin));
|
||||
context->pin_callbacks |= BIT(pin);
|
||||
} else {
|
||||
_gpio_enable_callback(port, 0xffffffff);
|
||||
context->pin_callbacks = 0xffffffff;
|
||||
}
|
||||
gpio_critical_region_end(port);
|
||||
|
@ -307,10 +302,8 @@ static inline int ss_gpio_qmsi_disable_callback(struct device *port,
|
|||
|
||||
gpio_critical_region_start(port);
|
||||
if (access_op == GPIO_ACCESS_BY_PIN) {
|
||||
_gpio_disable_callback(port, BIT(pin));
|
||||
context->pin_callbacks &= ~BIT(pin);
|
||||
} else {
|
||||
_gpio_disable_callback(port, 0xffffffff);
|
||||
context->pin_callbacks = 0;
|
||||
}
|
||||
gpio_critical_region_end(port);
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include "gpio_sch.h"
|
||||
#include "gpio_utils.h"
|
||||
#include "gpio_api_compat.h"
|
||||
|
||||
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_GPIO_LEVEL
|
||||
#include <misc/sys_log.h>
|
||||
|
@ -274,7 +273,6 @@ static int gpio_sch_enable_callback(struct device *dev,
|
|||
gpio->cb_enabled = BIT_MASK(info->bits);
|
||||
}
|
||||
|
||||
_gpio_enable_callback(dev, gpio->cb_enabled);
|
||||
_gpio_sch_manage_callback(dev);
|
||||
|
||||
return 0;
|
||||
|
@ -295,13 +293,11 @@ static int gpio_sch_disable_callback(struct device *dev,
|
|||
_set_bit_gtne(info->regs, pin, 0);
|
||||
|
||||
gpio->cb_enabled &= ~BIT(pin);
|
||||
_gpio_disable_callback(dev, BIT(pin));
|
||||
} else {
|
||||
_write_gtpe(0, info->regs);
|
||||
_write_gtne(0, info->regs);
|
||||
|
||||
gpio->cb_enabled = 0;
|
||||
_gpio_disable_callback(dev, BIT_MASK(info->bits));
|
||||
}
|
||||
|
||||
_gpio_sch_manage_callback(dev);
|
||||
|
@ -343,7 +339,6 @@ struct gpio_sch_data gpio_data_0;
|
|||
DEVICE_INIT(gpio_0, CONFIG_GPIO_SCH_0_DEV_NAME, gpio_sch_init,
|
||||
&gpio_data_0, &gpio_sch_0_config,
|
||||
SECONDARY, CONFIG_GPIO_SCH_INIT_PRIORITY);
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_0);
|
||||
|
||||
#endif /* CONFIG_GPIO_SCH_0 */
|
||||
#if CONFIG_GPIO_SCH_1
|
||||
|
@ -358,6 +353,5 @@ struct gpio_sch_data gpio_data_1;
|
|||
DEVICE_INIT(gpio_1, CONFIG_GPIO_SCH_1_DEV_NAME, gpio_sch_init,
|
||||
&gpio_data_1, &gpio_sch_1_config,
|
||||
SECONDARY, CONFIG_GPIO_SCH_INIT_PRIORITY);
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_1);
|
||||
|
||||
#endif /* CONFIG_GPIO_SCH_1 */
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <interrupt_controller/exti_stm32.h>
|
||||
|
||||
#include "gpio_utils.h"
|
||||
#include "gpio_api_compat.h"
|
||||
|
||||
/**
|
||||
* @brief Common GPIO driver for STM32 MCUs. Each SoC must implement a
|
||||
|
@ -214,8 +213,7 @@ DEVICE_AND_API_INIT(gpio_stm32_## __suffix, \
|
|||
&gpio_stm32_cfg_## __suffix, \
|
||||
SECONDARY, \
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
|
||||
&gpio_stm32_driver); \
|
||||
GPIO_SETUP_COMPAT_DEV(gpio_stm32_## __suffix)
|
||||
&gpio_stm32_driver);
|
||||
|
||||
#ifdef CONFIG_GPIO_STM32_PORTA
|
||||
GPIO_DEVICE_INIT("GPIOA", a, GPIOA_BASE, STM32_PORTA,
|
||||
|
|
|
@ -123,14 +123,6 @@ SECTIONS {
|
|||
__devconfig_end = .;
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
||||
SECTION_PROLOGUE(gpio_compat, (OPTIONAL),)
|
||||
{
|
||||
__gpio_compat_start = .;
|
||||
*(".gpio_compat.*")
|
||||
KEEP(*(SORT_BY_NAME(".gpio_compat*")))
|
||||
__gpio_compat_end = .;
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
||||
#ifdef CONFIG_CPLUSPLUS
|
||||
SECTION_PROLOGUE(_CTOR_SECTION_NAME,,) {
|
||||
/*
|
||||
|
|
|
@ -125,14 +125,6 @@ SECTIONS
|
|||
__devconfig_end = .;
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
||||
SECTION_PROLOGUE(gpio_compat, (OPTIONAL),)
|
||||
{
|
||||
__gpio_compat_start = .;
|
||||
*(".gpio_compat.*")
|
||||
KEEP(*(SORT_BY_NAME(".gpio_compat*")))
|
||||
__gpio_compat_end = .;
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
||||
SECTION_PROLOGUE(.ARM.exidx,,)
|
||||
{
|
||||
/*
|
||||
|
|
|
@ -125,14 +125,6 @@ SECTIONS
|
|||
__devconfig_end = .;
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
||||
SECTION_PROLOGUE(gpio_compat, (OPTIONAL),)
|
||||
{
|
||||
__gpio_compat_start = .;
|
||||
*(".gpio_compat.*")
|
||||
KEEP(*(SORT_BY_NAME(".gpio_compat*")))
|
||||
__gpio_compat_end = .;
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
||||
SECTION_PROLOGUE(_RODATA_SECTION_NAME, (OPTIONAL),)
|
||||
{
|
||||
*(.rodata)
|
||||
|
|
|
@ -125,20 +125,6 @@ extern "C" {
|
|||
/** Disable GPIO pin. */
|
||||
#define GPIO_PIN_DISABLE (1 << 11)
|
||||
|
||||
/**
|
||||
* @typedef gpio_callback_t
|
||||
* @brief Define the application callback function signature.
|
||||
*
|
||||
* @param "struct device *port" Device struct for the GPIO device.
|
||||
* @param "uint32_t pin" The pin that triggers the callback.
|
||||
*
|
||||
* Note: This is the former callback signature used to set a unique
|
||||
* callback (API v1.0) through gpio_set_callback(). The new
|
||||
* struct gpio_callback below is now the preferred way.
|
||||
*/
|
||||
typedef void (*gpio_callback_t)(struct device *port, uint32_t pin);
|
||||
|
||||
|
||||
struct gpio_callback;
|
||||
|
||||
/**
|
||||
|
@ -266,21 +252,6 @@ static inline int gpio_pin_read(struct device *port, uint32_t pin,
|
|||
return api->read(port, GPIO_ACCESS_BY_PIN, pin, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn int gpio_set_callback(struct device *port, gpio_callback_t callback)
|
||||
* @brief Former way of setting the application's callback.
|
||||
* @param port Pointer to the device structure for the driver instance.
|
||||
* @param callback Application's callback (or NULL to unset).
|
||||
*
|
||||
* Note: This function sets a unique callback for the driver instance,
|
||||
* i.e. another call to this function will overwrite it. This is
|
||||
* the old way of doing things (API v1.0) and should be replaced
|
||||
* by gpio_add_callback() and gpio_remove_callback().
|
||||
* Using this function will not collide with the new ones.
|
||||
*/
|
||||
int __deprecated gpio_set_callback(struct device *port,
|
||||
gpio_callback_t callback);
|
||||
|
||||
/**
|
||||
* @brief Helper to initialize a struct gpio_callback properly
|
||||
* @param callback A valid Application's callback structure pointer.
|
||||
|
@ -304,7 +275,6 @@ static inline void gpio_init_callback(struct gpio_callback *callback,
|
|||
* @param callback A valid Application's callback structure pointer.
|
||||
*
|
||||
* Note: enables to add as many callback as needed on the same port.
|
||||
* This is the preferred way and is replacing gpio_set_callback().
|
||||
*/
|
||||
static inline int gpio_add_callback(struct device *port,
|
||||
struct gpio_callback *callback)
|
||||
|
@ -323,8 +293,7 @@ static inline int gpio_add_callback(struct device *port,
|
|||
* @param callback A valid application's callback structure pointer.
|
||||
*
|
||||
* Note: enables to remove as many callacks as added through
|
||||
* gpio_add_callback(). This is the preferred way and it's
|
||||
* replacing gpio_set_callback() with a NULL pointer as a callback.
|
||||
* gpio_add_callback().
|
||||
*/
|
||||
static inline int gpio_remove_callback(struct device *port,
|
||||
struct gpio_callback *callback)
|
||||
|
|
|
@ -396,7 +396,7 @@ class SizeCalculator:
|
|||
"exceptions"]
|
||||
# These get copied into RAM only on non-XIP
|
||||
ro_sections = ["text", "ctors", "init_array", "reset",
|
||||
"rodata", "devconfig", "gpio_compat"]
|
||||
"rodata", "devconfig"]
|
||||
|
||||
def __init__(self, filename):
|
||||
"""Constructor
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue