diff --git a/drivers/modem/CMakeLists.txt b/drivers/modem/CMakeLists.txt index b65e9d3ecec..f1f11706a76 100644 --- a/drivers/modem/CMakeLists.txt +++ b/drivers/modem/CMakeLists.txt @@ -5,10 +5,7 @@ zephyr_library() zephyr_library_sources_ifdef(CONFIG_MODEM_RECEIVER modem_receiver.c) zephyr_library_sources_ifdef(CONFIG_MODEM_SHELL modem_shell.c) -zephyr_library_sources_ifdef(CONFIG_MODEM_CONTEXT - modem_context.c - modem_pin.c -) +zephyr_library_sources_ifdef(CONFIG_MODEM_CONTEXT modem_context.c) zephyr_library_sources_ifdef(CONFIG_MODEM_IFACE_UART_INTERRUPT modem_iface_uart_interrupt.c) zephyr_library_sources_ifdef(CONFIG_MODEM_IFACE_UART_ASYNC modem_iface_uart_async.c) diff --git a/drivers/modem/modem_context.c b/drivers/modem/modem_context.c index 12d907b5655..777f988fd52 100644 --- a/drivers/modem/modem_context.c +++ b/drivers/modem/modem_context.c @@ -128,22 +128,9 @@ struct modem_context *modem_context_from_id(int id) int modem_context_register(struct modem_context *ctx) { - int ret; - if (!ctx) { return -EINVAL; } - ret = modem_context_get(ctx); - if (ret < 0) { - return ret; - } - - ret = modem_pin_init(ctx); - if (ret < 0) { - LOG_ERR("modem pin init error: %d", ret); - return ret; - } - - return 0; + return modem_context_get(ctx); } diff --git a/drivers/modem/modem_context.h b/drivers/modem/modem_context.h index 1aa8fa77749..38586761ed1 100644 --- a/drivers/modem/modem_context.h +++ b/drivers/modem/modem_context.h @@ -24,12 +24,6 @@ extern "C" { #endif -#define MODEM_PIN(name_, pin_, flags_) { \ - .dev_name = name_, \ - .pin = pin_, \ - .init_flags = flags_ \ -} - struct modem_iface { const struct device *dev; @@ -49,13 +43,6 @@ struct modem_cmd_handler { void *cmd_handler_data; }; -struct modem_pin { - const struct device *gpio_port_dev; - char *dev_name; - gpio_pin_t pin; - gpio_flags_t init_flags; -}; - struct modem_context { /* modem data */ char *data_manufacturer; @@ -73,9 +60,6 @@ struct modem_context { #endif int *data_rssi; bool is_automatic_oper; - /* pin config */ - struct modem_pin *pins; - size_t pins_len; /* interface config */ struct modem_iface iface; @@ -137,12 +121,6 @@ struct modem_context *modem_context_from_iface_dev(const struct device *dev); */ int modem_context_register(struct modem_context *ctx); -/* pin config functions */ -int modem_pin_read(struct modem_context *ctx, uint32_t pin); -int modem_pin_write(struct modem_context *ctx, uint32_t pin, uint32_t value); -int modem_pin_config(struct modem_context *ctx, uint32_t pin, bool enable); -int modem_pin_init(struct modem_context *ctx); - #ifdef __cplusplus } #endif diff --git a/drivers/modem/modem_pin.c b/drivers/modem/modem_pin.c deleted file mode 100644 index e854af46227..00000000000 --- a/drivers/modem/modem_pin.c +++ /dev/null @@ -1,71 +0,0 @@ -/** @file - * @brief Modem pin setup for modem context driver - * - * GPIO-based pin handling for the modem context driver - */ - -/* - * Copyright (c) 2019 Foundries.io - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -#include "modem_context.h" - -int modem_pin_read(struct modem_context *ctx, uint32_t pin) -{ - if (pin >= ctx->pins_len) { - return -ENODEV; - } - - return gpio_pin_get(ctx->pins[pin].gpio_port_dev, - ctx->pins[pin].pin); -} - -int modem_pin_write(struct modem_context *ctx, uint32_t pin, uint32_t value) -{ - if (pin >= ctx->pins_len) { - return -ENODEV; - } - - return gpio_pin_set(ctx->pins[pin].gpio_port_dev, - ctx->pins[pin].pin, value); -} - -int modem_pin_config(struct modem_context *ctx, uint32_t pin, bool enable) -{ - if (pin >= ctx->pins_len) { - return -ENODEV; - } - - return gpio_pin_configure(ctx->pins[pin].gpio_port_dev, - ctx->pins[pin].pin, - enable ? ctx->pins[pin].init_flags : - GPIO_INPUT); -} - -int modem_pin_init(struct modem_context *ctx) -{ - int ret; - size_t i; - - /* setup port devices and pin directions */ - for (i = 0; i < ctx->pins_len; i++) { - ctx->pins[i].gpio_port_dev = - device_get_binding(ctx->pins[i].dev_name); - if (!ctx->pins[i].gpio_port_dev) { - return -ENODEV; - } - - ret = modem_pin_config(ctx, i, true); - if (ret < 0) { - return ret; - } - } - - return 0; -}