modem: simcom-sim7080: use 'gpio_dt_spec' instead of 'modem_pin'
Move away from 'modem_pin' abstraction as it has not obvious value compared to generic 'gpio_dt_spec'. Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
This commit is contained in:
parent
9353b6e98a
commit
41c618dbf7
3 changed files with 12 additions and 11 deletions
|
@ -30,6 +30,9 @@ static K_KERNEL_STACK_DEFINE(modem_rx_stack, CONFIG_MODEM_SIMCOM_SIM7080_RX_STAC
|
||||||
static K_KERNEL_STACK_DEFINE(modem_workq_stack, CONFIG_MODEM_SIMCOM_SIM7080_RX_WORKQ_STACK_SIZE);
|
static K_KERNEL_STACK_DEFINE(modem_workq_stack, CONFIG_MODEM_SIMCOM_SIM7080_RX_WORKQ_STACK_SIZE);
|
||||||
NET_BUF_POOL_DEFINE(mdm_recv_pool, MDM_RECV_MAX_BUF, MDM_RECV_BUF_SIZE, 0, NULL);
|
NET_BUF_POOL_DEFINE(mdm_recv_pool, MDM_RECV_MAX_BUF, MDM_RECV_BUF_SIZE, 0, NULL);
|
||||||
|
|
||||||
|
/* pin settings */
|
||||||
|
static const struct gpio_dt_spec power_gpio = GPIO_DT_SPEC_INST_GET(0, mdm_power_gpios);
|
||||||
|
|
||||||
static void socket_close(struct modem_socket *sock);
|
static void socket_close(struct modem_socket *sock);
|
||||||
const struct socket_dns_offload offload_dns_ops;
|
const struct socket_dns_offload offload_dns_ops;
|
||||||
|
|
||||||
|
@ -1225,9 +1228,9 @@ error:
|
||||||
static void modem_pwrkey(void)
|
static void modem_pwrkey(void)
|
||||||
{
|
{
|
||||||
/* Power pin should be high for 1.5 seconds. */
|
/* Power pin should be high for 1.5 seconds. */
|
||||||
modem_pin_write(&mctx, 0, 1);
|
gpio_pin_set_dt(&power_gpio, 1);
|
||||||
k_sleep(K_MSEC(1500));
|
k_sleep(K_MSEC(1500));
|
||||||
modem_pin_write(&mctx, 0, 0);
|
gpio_pin_set_dt(&power_gpio, 0);
|
||||||
k_sleep(K_SECONDS(5));
|
k_sleep(K_SECONDS(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2371,8 +2374,12 @@ static int modem_init(const struct device *dev)
|
||||||
#endif /* #if defined(CONFIG_MODEM_SIM_NUMBERS) */
|
#endif /* #if defined(CONFIG_MODEM_SIM_NUMBERS) */
|
||||||
mctx.data_rssi = &mdata.mdm_rssi;
|
mctx.data_rssi = &mdata.mdm_rssi;
|
||||||
|
|
||||||
mctx.pins = modem_pins;
|
ret = gpio_pin_configure_dt(&power_gpio, GPIO_OUTPUT_LOW);
|
||||||
mctx.pins_len = ARRAY_SIZE(modem_pins);
|
if (ret < 0) {
|
||||||
|
LOG_ERR("Failed to configure %s pin", "power");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
mctx.driver_data = &mdata;
|
mctx.driver_data = &mdata;
|
||||||
|
|
||||||
memset(&gnss_data, 0, sizeof(gnss_data));
|
memset(&gnss_data, 0, sizeof(gnss_data));
|
||||||
|
|
|
@ -167,13 +167,6 @@ struct sim7080_data {
|
||||||
struct k_sem sem_ftp;
|
struct k_sem sem_ftp;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* Pin definitions
|
|
||||||
*/
|
|
||||||
static struct modem_pin modem_pins[] = { MODEM_PIN(
|
|
||||||
DT_INST_GPIO_LABEL(0, mdm_power_gpios), DT_INST_GPIO_PIN(0, mdm_power_gpios),
|
|
||||||
DT_INST_GPIO_FLAGS(0, mdm_power_gpios) | GPIO_OUTPUT_LOW) };
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Socket read callback data.
|
* Socket read callback data.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
CONFIG_TEST=y
|
CONFIG_TEST=y
|
||||||
CONFIG_TEST_RANDOM_GENERATOR=y
|
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||||
CONFIG_SERIAL=y
|
CONFIG_SERIAL=y
|
||||||
|
CONFIG_GPIO=y
|
||||||
CONFIG_NETWORKING=y
|
CONFIG_NETWORKING=y
|
||||||
CONFIG_NET_SOCKETS=y
|
CONFIG_NET_SOCKETS=y
|
||||||
CONFIG_MODEM=y
|
CONFIG_MODEM=y
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue