drivers: modem: ublox-sara-r4: Convert to the new GPIO API
Convert to the new API using raw access, since it's a common access layer shared by multiple (right now only ublox-sara-r4) modems. Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
parent
3eecab88e6
commit
d7afd55a45
@ -18,20 +18,12 @@
|
||||
|
||||
int modem_pin_read(struct modem_context *ctx, u32_t pin)
|
||||
{
|
||||
int ret = 0;
|
||||
u32_t value = 0;
|
||||
|
||||
if (pin < 0 || pin >= ctx->pins_len) {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = gpio_pin_read(ctx->pins[pin].gpio_port_dev, ctx->pins[pin].pin,
|
||||
&value);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return (int)value;
|
||||
return gpio_pin_get_raw(ctx->pins[pin].gpio_port_dev,
|
||||
ctx->pins[pin].pin);
|
||||
}
|
||||
|
||||
int modem_pin_write(struct modem_context *ctx, u32_t pin, u32_t value)
|
||||
@ -40,8 +32,8 @@ int modem_pin_write(struct modem_context *ctx, u32_t pin, u32_t value)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return gpio_pin_write(ctx->pins[pin].gpio_port_dev, ctx->pins[pin].pin,
|
||||
value);
|
||||
return gpio_pin_set_raw(ctx->pins[pin].gpio_port_dev,
|
||||
ctx->pins[pin].pin, value);
|
||||
}
|
||||
|
||||
int modem_pin_config(struct modem_context *ctx, u32_t pin, int flags)
|
||||
|
||||
@ -40,16 +40,19 @@ enum mdm_control_pins {
|
||||
static struct modem_pin modem_pins[] = {
|
||||
/* MDM_POWER */
|
||||
MODEM_PIN(DT_INST_0_UBLOX_SARA_R4_MDM_POWER_GPIOS_CONTROLLER,
|
||||
DT_INST_0_UBLOX_SARA_R4_MDM_POWER_GPIOS_PIN, GPIO_DIR_OUT),
|
||||
DT_INST_0_UBLOX_SARA_R4_MDM_POWER_GPIOS_PIN,
|
||||
DT_INST_0_UBLOX_SARA_R4_MDM_POWER_GPIOS_FLAGS | GPIO_OUTPUT),
|
||||
|
||||
/* MDM_RESET */
|
||||
MODEM_PIN(DT_INST_0_UBLOX_SARA_R4_MDM_RESET_GPIOS_CONTROLLER,
|
||||
DT_INST_0_UBLOX_SARA_R4_MDM_RESET_GPIOS_PIN, GPIO_DIR_OUT),
|
||||
DT_INST_0_UBLOX_SARA_R4_MDM_RESET_GPIOS_PIN,
|
||||
DT_INST_0_UBLOX_SARA_R4_MDM_RESET_GPIOS_FLAGS | GPIO_OUTPUT),
|
||||
|
||||
#if defined(DT_UBLOX_SARA_R4_0_MDM_VINT_GPIOS_CONTROLLER)
|
||||
/* MDM_VINT */
|
||||
MODEM_PIN(DT_INST_0_UBLOX_SARA_R4_MDM_VINT_GPIOS_CONTROLLER,
|
||||
DT_INST_0_UBLOX_SARA_R4_MDM_VINT_GPIOS_PIN, GPIO_DIR_IN),
|
||||
DT_INST_0_UBLOX_SARA_R4_MDM_VINT_GPIOS_PIN,
|
||||
DT_INST_0_UBLOX_SARA_R4_MDM_VINT_GPIOS_FLAGS | GPIO_INPUT),
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user