| .. | .. |
|---|
| 39 | 39 | #include <linux/fs.h> |
|---|
| 40 | 40 | #include <linux/ip.h> |
|---|
| 41 | 41 | #include <linux/dmapool.h> |
|---|
| 42 | | -#include <linux/gpio.h> |
|---|
| 42 | +#include <linux/gpio/consumer.h> |
|---|
| 43 | 43 | #include <linux/sched.h> |
|---|
| 44 | 44 | #include <linux/time.h> |
|---|
| 45 | 45 | #include <linux/wait.h> |
|---|
| .. | .. |
|---|
| 61 | 61 | #define IFX_SPI_HEADER_F (-2) |
|---|
| 62 | 62 | |
|---|
| 63 | 63 | #define PO_POST_DELAY 200 |
|---|
| 64 | | -#define IFX_MDM_RST_PMU 4 |
|---|
| 65 | 64 | |
|---|
| 66 | 65 | /* forward reference */ |
|---|
| 67 | 66 | static void ifx_spi_handle_srdy(struct ifx_spi_device *ifx_dev); |
|---|
| .. | .. |
|---|
| 81 | 80 | |
|---|
| 82 | 81 | static int ifx_modem_power_off(struct ifx_spi_device *ifx_dev) |
|---|
| 83 | 82 | { |
|---|
| 84 | | - gpio_set_value(IFX_MDM_RST_PMU, 1); |
|---|
| 83 | + gpiod_set_value(ifx_dev->gpio.pmu_reset, 1); |
|---|
| 85 | 84 | msleep(PO_POST_DELAY); |
|---|
| 86 | 85 | |
|---|
| 87 | 86 | return 0; |
|---|
| .. | .. |
|---|
| 107 | 106 | */ |
|---|
| 108 | 107 | static inline void mrdy_set_high(struct ifx_spi_device *ifx) |
|---|
| 109 | 108 | { |
|---|
| 110 | | - gpio_set_value(ifx->gpio.mrdy, 1); |
|---|
| 109 | + gpiod_set_value(ifx->gpio.mrdy, 1); |
|---|
| 111 | 110 | } |
|---|
| 112 | 111 | |
|---|
| 113 | 112 | /** |
|---|
| .. | .. |
|---|
| 117 | 116 | */ |
|---|
| 118 | 117 | static inline void mrdy_set_low(struct ifx_spi_device *ifx) |
|---|
| 119 | 118 | { |
|---|
| 120 | | - gpio_set_value(ifx->gpio.mrdy, 0); |
|---|
| 119 | + gpiod_set_value(ifx->gpio.mrdy, 0); |
|---|
| 121 | 120 | } |
|---|
| 122 | 121 | |
|---|
| 123 | 122 | /** |
|---|
| .. | .. |
|---|
| 244 | 243 | */ |
|---|
| 245 | 244 | static void mrdy_assert(struct ifx_spi_device *ifx_dev) |
|---|
| 246 | 245 | { |
|---|
| 247 | | - int val = gpio_get_value(ifx_dev->gpio.srdy); |
|---|
| 246 | + int val = gpiod_get_value(ifx_dev->gpio.srdy); |
|---|
| 248 | 247 | if (!val) { |
|---|
| 249 | 248 | if (!test_and_set_bit(IFX_SPI_STATE_TIMER_PENDING, |
|---|
| 250 | 249 | &ifx_dev->flags)) { |
|---|
| .. | .. |
|---|
| 258 | 257 | |
|---|
| 259 | 258 | /** |
|---|
| 260 | 259 | * ifx_spi_timeout - SPI timeout |
|---|
| 261 | | - * @arg: our SPI device |
|---|
| 260 | + * @t: timer in our SPI device |
|---|
| 262 | 261 | * |
|---|
| 263 | 262 | * The SPI has timed out: hang up the tty. Users will then see a hangup |
|---|
| 264 | 263 | * and error events. |
|---|
| .. | .. |
|---|
| 278 | 277 | /** |
|---|
| 279 | 278 | * ifx_spi_tiocmget - get modem lines |
|---|
| 280 | 279 | * @tty: our tty device |
|---|
| 281 | | - * @filp: file handle issuing the request |
|---|
| 282 | 280 | * |
|---|
| 283 | 281 | * Map the signal state into Linux modem flags and report the value |
|---|
| 284 | 282 | * in Linux terms |
|---|
| .. | .. |
|---|
| 532 | 530 | |
|---|
| 533 | 531 | /** |
|---|
| 534 | 532 | * ifx_port_hangup |
|---|
| 535 | | - * @port: our tty port |
|---|
| 533 | + * @tty: our tty |
|---|
| 536 | 534 | * |
|---|
| 537 | 535 | * tty port hang up. Called when tty_hangup processing is invoked either |
|---|
| 538 | 536 | * by loss of carrier, or by software (eg vhangup). Serialized against |
|---|
| .. | .. |
|---|
| 612 | 610 | |
|---|
| 613 | 611 | /** |
|---|
| 614 | 612 | * ifx_spi_insert_fip_string - queue received data |
|---|
| 615 | | - * @ifx_ser: our SPI device |
|---|
| 613 | + * @ifx_dev: our SPI device |
|---|
| 616 | 614 | * @chars: buffer we have received |
|---|
| 617 | 615 | * @size: number of chars reeived |
|---|
| 618 | 616 | * |
|---|
| .. | .. |
|---|
| 691 | 689 | clear_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &(ifx_dev->flags)); |
|---|
| 692 | 690 | |
|---|
| 693 | 691 | queue_length = kfifo_len(&ifx_dev->tx_fifo); |
|---|
| 694 | | - srdy = gpio_get_value(ifx_dev->gpio.srdy); |
|---|
| 692 | + srdy = gpiod_get_value(ifx_dev->gpio.srdy); |
|---|
| 695 | 693 | if (!srdy) |
|---|
| 696 | 694 | ifx_spi_power_state_clear(ifx_dev, IFX_SPI_POWER_SRDY); |
|---|
| 697 | 695 | |
|---|
| .. | .. |
|---|
| 726 | 724 | * Queue data for transmission if possible and then kick off the |
|---|
| 727 | 725 | * transfer. |
|---|
| 728 | 726 | */ |
|---|
| 729 | | -static void ifx_spi_io(unsigned long data) |
|---|
| 727 | +static void ifx_spi_io(struct tasklet_struct *t) |
|---|
| 730 | 728 | { |
|---|
| 731 | 729 | int retval; |
|---|
| 732 | | - struct ifx_spi_device *ifx_dev = (struct ifx_spi_device *) data; |
|---|
| 730 | + struct ifx_spi_device *ifx_dev = from_tasklet(ifx_dev, t, |
|---|
| 731 | + io_work_tasklet); |
|---|
| 733 | 732 | |
|---|
| 734 | 733 | if (!test_and_set_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags) && |
|---|
| 735 | 734 | test_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags)) { |
|---|
| .. | .. |
|---|
| 898 | 897 | static irqreturn_t ifx_spi_reset_interrupt(int irq, void *dev) |
|---|
| 899 | 898 | { |
|---|
| 900 | 899 | struct ifx_spi_device *ifx_dev = dev; |
|---|
| 901 | | - int val = gpio_get_value(ifx_dev->gpio.reset_out); |
|---|
| 900 | + int val = gpiod_get_value(ifx_dev->gpio.reset_out); |
|---|
| 902 | 901 | int solreset = test_bit(MR_START, &ifx_dev->mdm_reset_state); |
|---|
| 903 | 902 | |
|---|
| 904 | 903 | if (val == 0) { |
|---|
| .. | .. |
|---|
| 954 | 953 | * to reset properly |
|---|
| 955 | 954 | */ |
|---|
| 956 | 955 | set_bit(MR_START, &ifx_dev->mdm_reset_state); |
|---|
| 957 | | - gpio_set_value(ifx_dev->gpio.po, 0); |
|---|
| 958 | | - gpio_set_value(ifx_dev->gpio.reset, 0); |
|---|
| 956 | + gpiod_set_value(ifx_dev->gpio.po, 0); |
|---|
| 957 | + gpiod_set_value(ifx_dev->gpio.reset, 0); |
|---|
| 959 | 958 | msleep(25); |
|---|
| 960 | | - gpio_set_value(ifx_dev->gpio.reset, 1); |
|---|
| 959 | + gpiod_set_value(ifx_dev->gpio.reset, 1); |
|---|
| 961 | 960 | msleep(1); |
|---|
| 962 | | - gpio_set_value(ifx_dev->gpio.po, 1); |
|---|
| 961 | + gpiod_set_value(ifx_dev->gpio.po, 1); |
|---|
| 963 | 962 | msleep(1); |
|---|
| 964 | | - gpio_set_value(ifx_dev->gpio.po, 0); |
|---|
| 963 | + gpiod_set_value(ifx_dev->gpio.po, 0); |
|---|
| 965 | 964 | ret = wait_event_timeout(ifx_dev->mdm_reset_wait, |
|---|
| 966 | 965 | test_bit(MR_COMPLETE, |
|---|
| 967 | 966 | &ifx_dev->mdm_reset_state), |
|---|
| .. | .. |
|---|
| 992 | 991 | int srdy; |
|---|
| 993 | 992 | struct ifx_modem_platform_data *pl_data; |
|---|
| 994 | 993 | struct ifx_spi_device *ifx_dev; |
|---|
| 994 | + struct device *dev = &spi->dev; |
|---|
| 995 | 995 | |
|---|
| 996 | 996 | if (saved_ifx_dev) { |
|---|
| 997 | | - dev_dbg(&spi->dev, "ignoring subsequent detection"); |
|---|
| 997 | + dev_dbg(dev, "ignoring subsequent detection"); |
|---|
| 998 | 998 | return -ENODEV; |
|---|
| 999 | 999 | } |
|---|
| 1000 | 1000 | |
|---|
| 1001 | | - pl_data = dev_get_platdata(&spi->dev); |
|---|
| 1001 | + pl_data = dev_get_platdata(dev); |
|---|
| 1002 | 1002 | if (!pl_data) { |
|---|
| 1003 | | - dev_err(&spi->dev, "missing platform data!"); |
|---|
| 1003 | + dev_err(dev, "missing platform data!"); |
|---|
| 1004 | 1004 | return -ENODEV; |
|---|
| 1005 | 1005 | } |
|---|
| 1006 | 1006 | |
|---|
| 1007 | 1007 | /* initialize structure to hold our device variables */ |
|---|
| 1008 | 1008 | ifx_dev = kzalloc(sizeof(struct ifx_spi_device), GFP_KERNEL); |
|---|
| 1009 | 1009 | if (!ifx_dev) { |
|---|
| 1010 | | - dev_err(&spi->dev, "spi device allocation failed"); |
|---|
| 1010 | + dev_err(dev, "spi device allocation failed"); |
|---|
| 1011 | 1011 | return -ENOMEM; |
|---|
| 1012 | 1012 | } |
|---|
| 1013 | 1013 | saved_ifx_dev = ifx_dev; |
|---|
| .. | .. |
|---|
| 1026 | 1026 | spi->bits_per_word = spi_bpw; |
|---|
| 1027 | 1027 | ret = spi_setup(spi); |
|---|
| 1028 | 1028 | if (ret) { |
|---|
| 1029 | | - dev_err(&spi->dev, "SPI setup wasn't successful %d", ret); |
|---|
| 1029 | + dev_err(dev, "SPI setup wasn't successful %d", ret); |
|---|
| 1030 | 1030 | kfree(ifx_dev); |
|---|
| 1031 | 1031 | return -ENODEV; |
|---|
| 1032 | 1032 | } |
|---|
| .. | .. |
|---|
| 1049 | 1049 | &ifx_dev->tx_bus, |
|---|
| 1050 | 1050 | GFP_KERNEL); |
|---|
| 1051 | 1051 | if (!ifx_dev->tx_buffer) { |
|---|
| 1052 | | - dev_err(&spi->dev, "DMA-TX buffer allocation failed"); |
|---|
| 1052 | + dev_err(dev, "DMA-TX buffer allocation failed"); |
|---|
| 1053 | 1053 | ret = -ENOMEM; |
|---|
| 1054 | 1054 | goto error_ret; |
|---|
| 1055 | 1055 | } |
|---|
| .. | .. |
|---|
| 1058 | 1058 | &ifx_dev->rx_bus, |
|---|
| 1059 | 1059 | GFP_KERNEL); |
|---|
| 1060 | 1060 | if (!ifx_dev->rx_buffer) { |
|---|
| 1061 | | - dev_err(&spi->dev, "DMA-RX buffer allocation failed"); |
|---|
| 1061 | + dev_err(dev, "DMA-RX buffer allocation failed"); |
|---|
| 1062 | 1062 | ret = -ENOMEM; |
|---|
| 1063 | 1063 | goto error_ret; |
|---|
| 1064 | 1064 | } |
|---|
| .. | .. |
|---|
| 1067 | 1067 | init_waitqueue_head(&ifx_dev->mdm_reset_wait); |
|---|
| 1068 | 1068 | |
|---|
| 1069 | 1069 | spi_set_drvdata(spi, ifx_dev); |
|---|
| 1070 | | - tasklet_init(&ifx_dev->io_work_tasklet, ifx_spi_io, |
|---|
| 1071 | | - (unsigned long)ifx_dev); |
|---|
| 1070 | + tasklet_setup(&ifx_dev->io_work_tasklet, ifx_spi_io); |
|---|
| 1072 | 1071 | |
|---|
| 1073 | 1072 | set_bit(IFX_SPI_STATE_PRESENT, &ifx_dev->flags); |
|---|
| 1074 | 1073 | |
|---|
| 1075 | 1074 | /* create our tty port */ |
|---|
| 1076 | 1075 | ret = ifx_spi_create_port(ifx_dev); |
|---|
| 1077 | 1076 | if (ret != 0) { |
|---|
| 1078 | | - dev_err(&spi->dev, "create default tty port failed"); |
|---|
| 1077 | + dev_err(dev, "create default tty port failed"); |
|---|
| 1079 | 1078 | goto error_ret; |
|---|
| 1080 | 1079 | } |
|---|
| 1081 | 1080 | |
|---|
| 1082 | | - ifx_dev->gpio.reset = pl_data->rst_pmu; |
|---|
| 1083 | | - ifx_dev->gpio.po = pl_data->pwr_on; |
|---|
| 1084 | | - ifx_dev->gpio.mrdy = pl_data->mrdy; |
|---|
| 1085 | | - ifx_dev->gpio.srdy = pl_data->srdy; |
|---|
| 1086 | | - ifx_dev->gpio.reset_out = pl_data->rst_out; |
|---|
| 1087 | | - |
|---|
| 1088 | | - dev_info(&spi->dev, "gpios %d, %d, %d, %d, %d", |
|---|
| 1089 | | - ifx_dev->gpio.reset, ifx_dev->gpio.po, ifx_dev->gpio.mrdy, |
|---|
| 1090 | | - ifx_dev->gpio.srdy, ifx_dev->gpio.reset_out); |
|---|
| 1091 | | - |
|---|
| 1092 | | - /* Configure gpios */ |
|---|
| 1093 | | - ret = gpio_request(ifx_dev->gpio.reset, "ifxModem"); |
|---|
| 1094 | | - if (ret < 0) { |
|---|
| 1095 | | - dev_err(&spi->dev, "Unable to allocate GPIO%d (RESET)", |
|---|
| 1096 | | - ifx_dev->gpio.reset); |
|---|
| 1081 | + ifx_dev->gpio.reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); |
|---|
| 1082 | + if (IS_ERR(ifx_dev->gpio.reset)) { |
|---|
| 1083 | + dev_err(dev, "could not obtain reset GPIO\n"); |
|---|
| 1084 | + ret = PTR_ERR(ifx_dev->gpio.reset); |
|---|
| 1097 | 1085 | goto error_ret; |
|---|
| 1098 | 1086 | } |
|---|
| 1099 | | - ret += gpio_direction_output(ifx_dev->gpio.reset, 0); |
|---|
| 1100 | | - ret += gpio_export(ifx_dev->gpio.reset, 1); |
|---|
| 1101 | | - if (ret) { |
|---|
| 1102 | | - dev_err(&spi->dev, "Unable to configure GPIO%d (RESET)", |
|---|
| 1103 | | - ifx_dev->gpio.reset); |
|---|
| 1104 | | - ret = -EBUSY; |
|---|
| 1105 | | - goto error_ret2; |
|---|
| 1087 | + gpiod_set_consumer_name(ifx_dev->gpio.reset, "ifxModem reset"); |
|---|
| 1088 | + ifx_dev->gpio.po = devm_gpiod_get(dev, "power", GPIOD_OUT_LOW); |
|---|
| 1089 | + if (IS_ERR(ifx_dev->gpio.po)) { |
|---|
| 1090 | + dev_err(dev, "could not obtain power GPIO\n"); |
|---|
| 1091 | + ret = PTR_ERR(ifx_dev->gpio.po); |
|---|
| 1092 | + goto error_ret; |
|---|
| 1106 | 1093 | } |
|---|
| 1094 | + gpiod_set_consumer_name(ifx_dev->gpio.po, "ifxModem power"); |
|---|
| 1095 | + ifx_dev->gpio.mrdy = devm_gpiod_get(dev, "mrdy", GPIOD_OUT_LOW); |
|---|
| 1096 | + if (IS_ERR(ifx_dev->gpio.mrdy)) { |
|---|
| 1097 | + dev_err(dev, "could not obtain mrdy GPIO\n"); |
|---|
| 1098 | + ret = PTR_ERR(ifx_dev->gpio.mrdy); |
|---|
| 1099 | + goto error_ret; |
|---|
| 1100 | + } |
|---|
| 1101 | + gpiod_set_consumer_name(ifx_dev->gpio.mrdy, "ifxModem mrdy"); |
|---|
| 1102 | + ifx_dev->gpio.srdy = devm_gpiod_get(dev, "srdy", GPIOD_IN); |
|---|
| 1103 | + if (IS_ERR(ifx_dev->gpio.srdy)) { |
|---|
| 1104 | + dev_err(dev, "could not obtain srdy GPIO\n"); |
|---|
| 1105 | + ret = PTR_ERR(ifx_dev->gpio.srdy); |
|---|
| 1106 | + goto error_ret; |
|---|
| 1107 | + } |
|---|
| 1108 | + gpiod_set_consumer_name(ifx_dev->gpio.srdy, "ifxModem srdy"); |
|---|
| 1109 | + ifx_dev->gpio.reset_out = devm_gpiod_get(dev, "rst_out", GPIOD_IN); |
|---|
| 1110 | + if (IS_ERR(ifx_dev->gpio.reset_out)) { |
|---|
| 1111 | + dev_err(dev, "could not obtain rst_out GPIO\n"); |
|---|
| 1112 | + ret = PTR_ERR(ifx_dev->gpio.reset_out); |
|---|
| 1113 | + goto error_ret; |
|---|
| 1114 | + } |
|---|
| 1115 | + gpiod_set_consumer_name(ifx_dev->gpio.reset_out, "ifxModem reset out"); |
|---|
| 1116 | + ifx_dev->gpio.pmu_reset = devm_gpiod_get(dev, "pmu_reset", GPIOD_ASIS); |
|---|
| 1117 | + if (IS_ERR(ifx_dev->gpio.pmu_reset)) { |
|---|
| 1118 | + dev_err(dev, "could not obtain pmu_reset GPIO\n"); |
|---|
| 1119 | + ret = PTR_ERR(ifx_dev->gpio.pmu_reset); |
|---|
| 1120 | + goto error_ret; |
|---|
| 1121 | + } |
|---|
| 1122 | + gpiod_set_consumer_name(ifx_dev->gpio.pmu_reset, "ifxModem PMU reset"); |
|---|
| 1107 | 1123 | |
|---|
| 1108 | | - ret = gpio_request(ifx_dev->gpio.po, "ifxModem"); |
|---|
| 1109 | | - ret += gpio_direction_output(ifx_dev->gpio.po, 0); |
|---|
| 1110 | | - ret += gpio_export(ifx_dev->gpio.po, 1); |
|---|
| 1111 | | - if (ret) { |
|---|
| 1112 | | - dev_err(&spi->dev, "Unable to configure GPIO%d (ON)", |
|---|
| 1113 | | - ifx_dev->gpio.po); |
|---|
| 1114 | | - ret = -EBUSY; |
|---|
| 1115 | | - goto error_ret3; |
|---|
| 1116 | | - } |
|---|
| 1117 | | - |
|---|
| 1118 | | - ret = gpio_request(ifx_dev->gpio.mrdy, "ifxModem"); |
|---|
| 1119 | | - if (ret < 0) { |
|---|
| 1120 | | - dev_err(&spi->dev, "Unable to allocate GPIO%d (MRDY)", |
|---|
| 1121 | | - ifx_dev->gpio.mrdy); |
|---|
| 1122 | | - goto error_ret3; |
|---|
| 1123 | | - } |
|---|
| 1124 | | - ret += gpio_export(ifx_dev->gpio.mrdy, 1); |
|---|
| 1125 | | - ret += gpio_direction_output(ifx_dev->gpio.mrdy, 0); |
|---|
| 1126 | | - if (ret) { |
|---|
| 1127 | | - dev_err(&spi->dev, "Unable to configure GPIO%d (MRDY)", |
|---|
| 1128 | | - ifx_dev->gpio.mrdy); |
|---|
| 1129 | | - ret = -EBUSY; |
|---|
| 1130 | | - goto error_ret4; |
|---|
| 1131 | | - } |
|---|
| 1132 | | - |
|---|
| 1133 | | - ret = gpio_request(ifx_dev->gpio.srdy, "ifxModem"); |
|---|
| 1134 | | - if (ret < 0) { |
|---|
| 1135 | | - dev_err(&spi->dev, "Unable to allocate GPIO%d (SRDY)", |
|---|
| 1136 | | - ifx_dev->gpio.srdy); |
|---|
| 1137 | | - ret = -EBUSY; |
|---|
| 1138 | | - goto error_ret4; |
|---|
| 1139 | | - } |
|---|
| 1140 | | - ret += gpio_export(ifx_dev->gpio.srdy, 1); |
|---|
| 1141 | | - ret += gpio_direction_input(ifx_dev->gpio.srdy); |
|---|
| 1142 | | - if (ret) { |
|---|
| 1143 | | - dev_err(&spi->dev, "Unable to configure GPIO%d (SRDY)", |
|---|
| 1144 | | - ifx_dev->gpio.srdy); |
|---|
| 1145 | | - ret = -EBUSY; |
|---|
| 1146 | | - goto error_ret5; |
|---|
| 1147 | | - } |
|---|
| 1148 | | - |
|---|
| 1149 | | - ret = gpio_request(ifx_dev->gpio.reset_out, "ifxModem"); |
|---|
| 1150 | | - if (ret < 0) { |
|---|
| 1151 | | - dev_err(&spi->dev, "Unable to allocate GPIO%d (RESET_OUT)", |
|---|
| 1152 | | - ifx_dev->gpio.reset_out); |
|---|
| 1153 | | - goto error_ret5; |
|---|
| 1154 | | - } |
|---|
| 1155 | | - ret += gpio_export(ifx_dev->gpio.reset_out, 1); |
|---|
| 1156 | | - ret += gpio_direction_input(ifx_dev->gpio.reset_out); |
|---|
| 1157 | | - if (ret) { |
|---|
| 1158 | | - dev_err(&spi->dev, "Unable to configure GPIO%d (RESET_OUT)", |
|---|
| 1159 | | - ifx_dev->gpio.reset_out); |
|---|
| 1160 | | - ret = -EBUSY; |
|---|
| 1161 | | - goto error_ret6; |
|---|
| 1162 | | - } |
|---|
| 1163 | | - |
|---|
| 1164 | | - ret = request_irq(gpio_to_irq(ifx_dev->gpio.reset_out), |
|---|
| 1124 | + ret = request_irq(gpiod_to_irq(ifx_dev->gpio.reset_out), |
|---|
| 1165 | 1125 | ifx_spi_reset_interrupt, |
|---|
| 1166 | 1126 | IRQF_TRIGGER_RISING|IRQF_TRIGGER_FALLING, DRVNAME, |
|---|
| 1167 | 1127 | ifx_dev); |
|---|
| 1168 | 1128 | if (ret) { |
|---|
| 1169 | | - dev_err(&spi->dev, "Unable to get irq %x\n", |
|---|
| 1170 | | - gpio_to_irq(ifx_dev->gpio.reset_out)); |
|---|
| 1171 | | - goto error_ret6; |
|---|
| 1129 | + dev_err(dev, "Unable to get irq %x\n", |
|---|
| 1130 | + gpiod_to_irq(ifx_dev->gpio.reset_out)); |
|---|
| 1131 | + goto error_ret; |
|---|
| 1172 | 1132 | } |
|---|
| 1173 | 1133 | |
|---|
| 1174 | 1134 | ret = ifx_spi_reset(ifx_dev); |
|---|
| 1175 | 1135 | |
|---|
| 1176 | | - ret = request_irq(gpio_to_irq(ifx_dev->gpio.srdy), |
|---|
| 1136 | + ret = request_irq(gpiod_to_irq(ifx_dev->gpio.srdy), |
|---|
| 1177 | 1137 | ifx_spi_srdy_interrupt, IRQF_TRIGGER_RISING, DRVNAME, |
|---|
| 1178 | 1138 | ifx_dev); |
|---|
| 1179 | 1139 | if (ret) { |
|---|
| 1180 | | - dev_err(&spi->dev, "Unable to get irq %x", |
|---|
| 1181 | | - gpio_to_irq(ifx_dev->gpio.srdy)); |
|---|
| 1182 | | - goto error_ret7; |
|---|
| 1140 | + dev_err(dev, "Unable to get irq %x", |
|---|
| 1141 | + gpiod_to_irq(ifx_dev->gpio.srdy)); |
|---|
| 1142 | + goto error_ret2; |
|---|
| 1183 | 1143 | } |
|---|
| 1184 | 1144 | |
|---|
| 1185 | 1145 | /* set pm runtime power state and register with power system */ |
|---|
| 1186 | | - pm_runtime_set_active(&spi->dev); |
|---|
| 1187 | | - pm_runtime_enable(&spi->dev); |
|---|
| 1146 | + pm_runtime_set_active(dev); |
|---|
| 1147 | + pm_runtime_enable(dev); |
|---|
| 1188 | 1148 | |
|---|
| 1189 | 1149 | /* handle case that modem is already signaling SRDY */ |
|---|
| 1190 | 1150 | /* no outgoing tty open at this point, this just satisfies the |
|---|
| 1191 | 1151 | * modem's read and should reset communication properly |
|---|
| 1192 | 1152 | */ |
|---|
| 1193 | | - srdy = gpio_get_value(ifx_dev->gpio.srdy); |
|---|
| 1153 | + srdy = gpiod_get_value(ifx_dev->gpio.srdy); |
|---|
| 1194 | 1154 | |
|---|
| 1195 | 1155 | if (srdy) { |
|---|
| 1196 | 1156 | mrdy_assert(ifx_dev); |
|---|
| .. | .. |
|---|
| 1199 | 1159 | mrdy_set_low(ifx_dev); |
|---|
| 1200 | 1160 | return 0; |
|---|
| 1201 | 1161 | |
|---|
| 1202 | | -error_ret7: |
|---|
| 1203 | | - free_irq(gpio_to_irq(ifx_dev->gpio.reset_out), ifx_dev); |
|---|
| 1204 | | -error_ret6: |
|---|
| 1205 | | - gpio_free(ifx_dev->gpio.srdy); |
|---|
| 1206 | | -error_ret5: |
|---|
| 1207 | | - gpio_free(ifx_dev->gpio.mrdy); |
|---|
| 1208 | | -error_ret4: |
|---|
| 1209 | | - gpio_free(ifx_dev->gpio.reset); |
|---|
| 1210 | | -error_ret3: |
|---|
| 1211 | | - gpio_free(ifx_dev->gpio.po); |
|---|
| 1212 | 1162 | error_ret2: |
|---|
| 1213 | | - gpio_free(ifx_dev->gpio.reset_out); |
|---|
| 1163 | + free_irq(gpiod_to_irq(ifx_dev->gpio.reset_out), ifx_dev); |
|---|
| 1214 | 1164 | error_ret: |
|---|
| 1215 | 1165 | ifx_spi_free_device(ifx_dev); |
|---|
| 1216 | 1166 | saved_ifx_dev = NULL; |
|---|
| .. | .. |
|---|
| 1234 | 1184 | pm_runtime_disable(&spi->dev); |
|---|
| 1235 | 1185 | |
|---|
| 1236 | 1186 | /* free irq */ |
|---|
| 1237 | | - free_irq(gpio_to_irq(ifx_dev->gpio.reset_out), ifx_dev); |
|---|
| 1238 | | - free_irq(gpio_to_irq(ifx_dev->gpio.srdy), ifx_dev); |
|---|
| 1239 | | - |
|---|
| 1240 | | - gpio_free(ifx_dev->gpio.srdy); |
|---|
| 1241 | | - gpio_free(ifx_dev->gpio.mrdy); |
|---|
| 1242 | | - gpio_free(ifx_dev->gpio.reset); |
|---|
| 1243 | | - gpio_free(ifx_dev->gpio.po); |
|---|
| 1244 | | - gpio_free(ifx_dev->gpio.reset_out); |
|---|
| 1187 | + free_irq(gpiod_to_irq(ifx_dev->gpio.reset_out), ifx_dev); |
|---|
| 1188 | + free_irq(gpiod_to_irq(ifx_dev->gpio.srdy), ifx_dev); |
|---|
| 1245 | 1189 | |
|---|
| 1246 | 1190 | /* free allocations */ |
|---|
| 1247 | 1191 | ifx_spi_free_device(ifx_dev); |
|---|