Lines Matching refs:ifx_dev
66 static void ifx_spi_handle_srdy(struct ifx_spi_device *ifx_dev);
69 static int ifx_modem_power_off(struct ifx_spi_device *ifx_dev);
81 static int ifx_modem_power_off(struct ifx_spi_device *ifx_dev) in ifx_modem_power_off() argument
83 gpiod_set_value(ifx_dev->gpio.pmu_reset, 1); in ifx_modem_power_off()
130 ifx_spi_power_state_set(struct ifx_spi_device *ifx_dev, unsigned char val) in ifx_spi_power_state_set() argument
134 spin_lock_irqsave(&ifx_dev->power_lock, flags); in ifx_spi_power_state_set()
140 if (!ifx_dev->power_status) in ifx_spi_power_state_set()
141 pm_runtime_get(&ifx_dev->spi_dev->dev); in ifx_spi_power_state_set()
142 ifx_dev->power_status |= val; in ifx_spi_power_state_set()
144 spin_unlock_irqrestore(&ifx_dev->power_lock, flags); in ifx_spi_power_state_set()
155 ifx_spi_power_state_clear(struct ifx_spi_device *ifx_dev, unsigned char val) in ifx_spi_power_state_clear() argument
159 spin_lock_irqsave(&ifx_dev->power_lock, flags); in ifx_spi_power_state_clear()
161 if (ifx_dev->power_status) { in ifx_spi_power_state_clear()
162 ifx_dev->power_status &= ~val; in ifx_spi_power_state_clear()
163 if (!ifx_dev->power_status) in ifx_spi_power_state_clear()
164 pm_runtime_put(&ifx_dev->spi_dev->dev); in ifx_spi_power_state_clear()
167 spin_unlock_irqrestore(&ifx_dev->power_lock, flags); in ifx_spi_power_state_clear()
244 static void mrdy_assert(struct ifx_spi_device *ifx_dev) in mrdy_assert() argument
246 int val = gpiod_get_value(ifx_dev->gpio.srdy); in mrdy_assert()
249 &ifx_dev->flags)) { in mrdy_assert()
250 mod_timer(&ifx_dev->spi_timer,jiffies + IFX_SPI_TIMEOUT_SEC*HZ); in mrdy_assert()
254 ifx_spi_power_state_set(ifx_dev, IFX_SPI_POWER_DATA_PENDING); in mrdy_assert()
255 mrdy_set_high(ifx_dev); in mrdy_assert()
267 struct ifx_spi_device *ifx_dev = from_timer(ifx_dev, t, spi_timer); in ifx_spi_timeout() local
269 dev_warn(&ifx_dev->spi_dev->dev, "*** SPI Timeout ***"); in ifx_spi_timeout()
270 tty_port_tty_hangup(&ifx_dev->tty_port, false); in ifx_spi_timeout()
271 mrdy_set_low(ifx_dev); in ifx_spi_timeout()
272 clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags); in ifx_spi_timeout()
287 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_tiocmget() local
290 (test_bit(IFX_SPI_RTS, &ifx_dev->signal_state) ? TIOCM_RTS : 0) | in ifx_spi_tiocmget()
291 (test_bit(IFX_SPI_DTR, &ifx_dev->signal_state) ? TIOCM_DTR : 0) | in ifx_spi_tiocmget()
292 (test_bit(IFX_SPI_CTS, &ifx_dev->signal_state) ? TIOCM_CTS : 0) | in ifx_spi_tiocmget()
293 (test_bit(IFX_SPI_DSR, &ifx_dev->signal_state) ? TIOCM_DSR : 0) | in ifx_spi_tiocmget()
294 (test_bit(IFX_SPI_DCD, &ifx_dev->signal_state) ? TIOCM_CAR : 0) | in ifx_spi_tiocmget()
295 (test_bit(IFX_SPI_RI, &ifx_dev->signal_state) ? TIOCM_RNG : 0); in ifx_spi_tiocmget()
313 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_tiocmset() local
316 set_bit(IFX_SPI_RTS, &ifx_dev->signal_state); in ifx_spi_tiocmset()
318 set_bit(IFX_SPI_DTR, &ifx_dev->signal_state); in ifx_spi_tiocmset()
320 clear_bit(IFX_SPI_RTS, &ifx_dev->signal_state); in ifx_spi_tiocmset()
322 clear_bit(IFX_SPI_DTR, &ifx_dev->signal_state); in ifx_spi_tiocmset()
324 set_bit(IFX_SPI_UPDATE, &ifx_dev->signal_state); in ifx_spi_tiocmset()
353 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_close() local
354 tty_port_close(&ifx_dev->tty_port, tty, filp); in ifx_spi_close()
427 static int ifx_spi_prepare_tx_buffer(struct ifx_spi_device *ifx_dev) in ifx_spi_prepare_tx_buffer() argument
434 tx_buffer = ifx_dev->tx_buffer; in ifx_spi_prepare_tx_buffer()
442 ifx_dev->spi_more = 0; in ifx_spi_prepare_tx_buffer()
445 if (!ifx_dev->spi_slave_cts) { in ifx_spi_prepare_tx_buffer()
447 queue_length = kfifo_len(&ifx_dev->tx_fifo); in ifx_spi_prepare_tx_buffer()
451 temp_count = kfifo_out_locked(&ifx_dev->tx_fifo, in ifx_spi_prepare_tx_buffer()
453 &ifx_dev->fifo_lock); in ifx_spi_prepare_tx_buffer()
460 tty_port_tty_wakeup(&ifx_dev->tty_port); in ifx_spi_prepare_tx_buffer()
462 ifx_dev->spi_more = 1; in ifx_spi_prepare_tx_buffer()
467 ifx_spi_setup_spi_header(ifx_dev->tx_buffer, in ifx_spi_prepare_tx_buffer()
469 ifx_dev->spi_more); in ifx_spi_prepare_tx_buffer()
471 ifx_dev->swap_buf((ifx_dev->tx_buffer), tx_count, in ifx_spi_prepare_tx_buffer()
472 &ifx_dev->tx_buffer[IFX_SPI_TRANSFER_SIZE]); in ifx_spi_prepare_tx_buffer()
489 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_write() local
495 spin_lock_irqsave(&ifx_dev->fifo_lock, flags); in ifx_spi_write()
496 is_fifo_empty = kfifo_is_empty(&ifx_dev->tx_fifo); in ifx_spi_write()
497 tx_count = kfifo_in(&ifx_dev->tx_fifo, tmp_buf, count); in ifx_spi_write()
498 spin_unlock_irqrestore(&ifx_dev->fifo_lock, flags); in ifx_spi_write()
500 mrdy_assert(ifx_dev); in ifx_spi_write()
514 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_write_room() local
515 return IFX_SPI_FIFO_SIZE - kfifo_len(&ifx_dev->tx_fifo); in ifx_spi_write_room()
527 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_chars_in_buffer() local
528 return kfifo_len(&ifx_dev->tx_fifo); in ifx_spi_chars_in_buffer()
541 struct ifx_spi_device *ifx_dev = tty->driver_data; in ifx_spi_hangup() local
542 tty_port_hangup(&ifx_dev->tty_port); in ifx_spi_hangup()
554 struct ifx_spi_device *ifx_dev = in ifx_port_activate() local
558 kfifo_reset(&ifx_dev->tx_fifo); in ifx_port_activate()
561 clear_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags); in ifx_port_activate()
562 clear_bit(IFX_SPI_STATE_IO_READY, &ifx_dev->flags); in ifx_port_activate()
565 tty->driver_data = ifx_dev; in ifx_port_activate()
571 set_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags); in ifx_port_activate()
585 struct ifx_spi_device *ifx_dev = in ifx_port_shutdown() local
588 clear_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags); in ifx_port_shutdown()
589 mrdy_set_low(ifx_dev); in ifx_port_shutdown()
590 del_timer(&ifx_dev->spi_timer); in ifx_port_shutdown()
591 clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags); in ifx_port_shutdown()
592 tasklet_kill(&ifx_dev->io_work_tasklet); in ifx_port_shutdown()
620 static void ifx_spi_insert_flip_string(struct ifx_spi_device *ifx_dev, in ifx_spi_insert_flip_string() argument
623 tty_insert_flip_string(&ifx_dev->tty_port, chars, size); in ifx_spi_insert_flip_string()
624 tty_flip_buffer_push(&ifx_dev->tty_port); in ifx_spi_insert_flip_string()
636 struct ifx_spi_device *ifx_dev = ctx; in ifx_spi_complete() local
646 mrdy_set_low(ifx_dev); in ifx_spi_complete()
648 if (!ifx_dev->spi_msg.status) { in ifx_spi_complete()
650 ifx_dev->swap_buf(ifx_dev->rx_buffer, IFX_SPI_HEADER_OVERHEAD, in ifx_spi_complete()
651 &ifx_dev->rx_buffer[IFX_SPI_HEADER_OVERHEAD]); in ifx_spi_complete()
652 decode_result = ifx_spi_decode_spi_header(ifx_dev->rx_buffer, in ifx_spi_complete()
655 dev_dbg(&ifx_dev->spi_dev->dev, in ifx_spi_complete()
657 ifx_dev->spi_slave_cts = 0; in ifx_spi_complete()
660 dev_dbg(&ifx_dev->spi_dev->dev, in ifx_spi_complete()
665 ifx_dev->spi_slave_cts = cts; in ifx_spi_complete()
668 ifx_dev->spi_msg.actual_length); in ifx_spi_complete()
669 ifx_dev->swap_buf( in ifx_spi_complete()
670 (ifx_dev->rx_buffer + IFX_SPI_HEADER_OVERHEAD), in ifx_spi_complete()
672 &ifx_dev->rx_buffer[IFX_SPI_TRANSFER_SIZE]); in ifx_spi_complete()
674 ifx_dev, in ifx_spi_complete()
675 ifx_dev->rx_buffer + IFX_SPI_HEADER_OVERHEAD, in ifx_spi_complete()
679 dev_dbg(&ifx_dev->spi_dev->dev, "SPI transfer error %d", in ifx_spi_complete()
680 ifx_dev->spi_msg.status); in ifx_spi_complete()
684 if (ifx_dev->write_pending) { in ifx_spi_complete()
685 ifx_dev->write_pending = 0; in ifx_spi_complete()
689 clear_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &(ifx_dev->flags)); in ifx_spi_complete()
691 queue_length = kfifo_len(&ifx_dev->tx_fifo); in ifx_spi_complete()
692 srdy = gpiod_get_value(ifx_dev->gpio.srdy); in ifx_spi_complete()
694 ifx_spi_power_state_clear(ifx_dev, IFX_SPI_POWER_SRDY); in ifx_spi_complete()
697 if (test_and_clear_bit(IFX_SPI_STATE_IO_READY, &ifx_dev->flags)) in ifx_spi_complete()
698 tasklet_schedule(&ifx_dev->io_work_tasklet); in ifx_spi_complete()
700 if (more || ifx_dev->spi_more || queue_length > 0 || in ifx_spi_complete()
702 if (ifx_dev->spi_slave_cts) { in ifx_spi_complete()
704 mrdy_assert(ifx_dev); in ifx_spi_complete()
706 mrdy_assert(ifx_dev); in ifx_spi_complete()
713 ifx_spi_power_state_clear(ifx_dev, in ifx_spi_complete()
715 tty_port_tty_wakeup(&ifx_dev->tty_port); in ifx_spi_complete()
730 struct ifx_spi_device *ifx_dev = from_tasklet(ifx_dev, t, in ifx_spi_io() local
733 if (!test_and_set_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags) && in ifx_spi_io()
734 test_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags)) { in ifx_spi_io()
735 if (ifx_dev->gpio.unack_srdy_int_nb > 0) in ifx_spi_io()
736 ifx_dev->gpio.unack_srdy_int_nb--; in ifx_spi_io()
738 ifx_spi_prepare_tx_buffer(ifx_dev); in ifx_spi_io()
740 spi_message_init(&ifx_dev->spi_msg); in ifx_spi_io()
741 INIT_LIST_HEAD(&ifx_dev->spi_msg.queue); in ifx_spi_io()
743 ifx_dev->spi_msg.context = ifx_dev; in ifx_spi_io()
744 ifx_dev->spi_msg.complete = ifx_spi_complete; in ifx_spi_io()
748 ifx_dev->spi_xfer.len = IFX_SPI_TRANSFER_SIZE; in ifx_spi_io()
749 ifx_dev->spi_xfer.cs_change = 0; in ifx_spi_io()
750 ifx_dev->spi_xfer.speed_hz = ifx_dev->spi_dev->max_speed_hz; in ifx_spi_io()
752 ifx_dev->spi_xfer.bits_per_word = in ifx_spi_io()
753 ifx_dev->spi_dev->bits_per_word; in ifx_spi_io()
755 ifx_dev->spi_xfer.tx_buf = ifx_dev->tx_buffer; in ifx_spi_io()
756 ifx_dev->spi_xfer.rx_buf = ifx_dev->rx_buffer; in ifx_spi_io()
761 if (ifx_dev->use_dma) { in ifx_spi_io()
762 ifx_dev->spi_msg.is_dma_mapped = 1; in ifx_spi_io()
763 ifx_dev->tx_dma = ifx_dev->tx_bus; in ifx_spi_io()
764 ifx_dev->rx_dma = ifx_dev->rx_bus; in ifx_spi_io()
765 ifx_dev->spi_xfer.tx_dma = ifx_dev->tx_dma; in ifx_spi_io()
766 ifx_dev->spi_xfer.rx_dma = ifx_dev->rx_dma; in ifx_spi_io()
768 ifx_dev->spi_msg.is_dma_mapped = 0; in ifx_spi_io()
769 ifx_dev->tx_dma = (dma_addr_t)0; in ifx_spi_io()
770 ifx_dev->rx_dma = (dma_addr_t)0; in ifx_spi_io()
771 ifx_dev->spi_xfer.tx_dma = (dma_addr_t)0; in ifx_spi_io()
772 ifx_dev->spi_xfer.rx_dma = (dma_addr_t)0; in ifx_spi_io()
775 spi_message_add_tail(&ifx_dev->spi_xfer, &ifx_dev->spi_msg); in ifx_spi_io()
780 mrdy_assert(ifx_dev); in ifx_spi_io()
782 retval = spi_async(ifx_dev->spi_dev, &ifx_dev->spi_msg); in ifx_spi_io()
785 &ifx_dev->flags); in ifx_spi_io()
786 tasklet_schedule(&ifx_dev->io_work_tasklet); in ifx_spi_io()
790 ifx_dev->write_pending = 1; in ifx_spi_io()
799 static void ifx_spi_free_port(struct ifx_spi_device *ifx_dev) in ifx_spi_free_port() argument
801 if (ifx_dev->tty_dev) in ifx_spi_free_port()
802 tty_unregister_device(tty_drv, ifx_dev->minor); in ifx_spi_free_port()
803 tty_port_destroy(&ifx_dev->tty_port); in ifx_spi_free_port()
804 kfifo_free(&ifx_dev->tx_fifo); in ifx_spi_free_port()
814 static int ifx_spi_create_port(struct ifx_spi_device *ifx_dev) in ifx_spi_create_port() argument
817 struct tty_port *pport = &ifx_dev->tty_port; in ifx_spi_create_port()
819 spin_lock_init(&ifx_dev->fifo_lock); in ifx_spi_create_port()
820 lockdep_set_class_and_subclass(&ifx_dev->fifo_lock, in ifx_spi_create_port()
823 if (kfifo_alloc(&ifx_dev->tx_fifo, IFX_SPI_FIFO_SIZE, GFP_KERNEL)) { in ifx_spi_create_port()
830 ifx_dev->minor = IFX_SPI_TTY_ID; in ifx_spi_create_port()
831 ifx_dev->tty_dev = tty_port_register_device(pport, tty_drv, in ifx_spi_create_port()
832 ifx_dev->minor, &ifx_dev->spi_dev->dev); in ifx_spi_create_port()
833 if (IS_ERR(ifx_dev->tty_dev)) { in ifx_spi_create_port()
834 dev_dbg(&ifx_dev->spi_dev->dev, in ifx_spi_create_port()
836 ret = PTR_ERR(ifx_dev->tty_dev); in ifx_spi_create_port()
844 ifx_spi_free_port(ifx_dev); in ifx_spi_create_port()
856 static void ifx_spi_handle_srdy(struct ifx_spi_device *ifx_dev) in ifx_spi_handle_srdy() argument
858 if (test_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags)) { in ifx_spi_handle_srdy()
859 del_timer(&ifx_dev->spi_timer); in ifx_spi_handle_srdy()
860 clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags); in ifx_spi_handle_srdy()
863 ifx_spi_power_state_set(ifx_dev, IFX_SPI_POWER_SRDY); in ifx_spi_handle_srdy()
865 if (!test_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags)) in ifx_spi_handle_srdy()
866 tasklet_schedule(&ifx_dev->io_work_tasklet); in ifx_spi_handle_srdy()
868 set_bit(IFX_SPI_STATE_IO_READY, &ifx_dev->flags); in ifx_spi_handle_srdy()
880 struct ifx_spi_device *ifx_dev = dev; in ifx_spi_srdy_interrupt() local
881 ifx_dev->gpio.unack_srdy_int_nb++; in ifx_spi_srdy_interrupt()
882 ifx_spi_handle_srdy(ifx_dev); in ifx_spi_srdy_interrupt()
899 struct ifx_spi_device *ifx_dev = dev; in ifx_spi_reset_interrupt() local
900 int val = gpiod_get_value(ifx_dev->gpio.reset_out); in ifx_spi_reset_interrupt()
901 int solreset = test_bit(MR_START, &ifx_dev->mdm_reset_state); in ifx_spi_reset_interrupt()
905 set_bit(MR_INPROGRESS, &ifx_dev->mdm_reset_state); in ifx_spi_reset_interrupt()
908 tty_port_tty_hangup(&ifx_dev->tty_port, false); in ifx_spi_reset_interrupt()
912 clear_bit(MR_INPROGRESS, &ifx_dev->mdm_reset_state); in ifx_spi_reset_interrupt()
914 set_bit(MR_COMPLETE, &ifx_dev->mdm_reset_state); in ifx_spi_reset_interrupt()
915 wake_up(&ifx_dev->mdm_reset_wait); in ifx_spi_reset_interrupt()
927 static void ifx_spi_free_device(struct ifx_spi_device *ifx_dev) in ifx_spi_free_device() argument
929 ifx_spi_free_port(ifx_dev); in ifx_spi_free_device()
930 dma_free_coherent(&ifx_dev->spi_dev->dev, in ifx_spi_free_device()
932 ifx_dev->tx_buffer, in ifx_spi_free_device()
933 ifx_dev->tx_bus); in ifx_spi_free_device()
934 dma_free_coherent(&ifx_dev->spi_dev->dev, in ifx_spi_free_device()
936 ifx_dev->rx_buffer, in ifx_spi_free_device()
937 ifx_dev->rx_bus); in ifx_spi_free_device()
946 static int ifx_spi_reset(struct ifx_spi_device *ifx_dev) in ifx_spi_reset() argument
955 set_bit(MR_START, &ifx_dev->mdm_reset_state); in ifx_spi_reset()
956 gpiod_set_value(ifx_dev->gpio.po, 0); in ifx_spi_reset()
957 gpiod_set_value(ifx_dev->gpio.reset, 0); in ifx_spi_reset()
959 gpiod_set_value(ifx_dev->gpio.reset, 1); in ifx_spi_reset()
961 gpiod_set_value(ifx_dev->gpio.po, 1); in ifx_spi_reset()
963 gpiod_set_value(ifx_dev->gpio.po, 0); in ifx_spi_reset()
964 ret = wait_event_timeout(ifx_dev->mdm_reset_wait, in ifx_spi_reset()
966 &ifx_dev->mdm_reset_state), in ifx_spi_reset()
969 dev_warn(&ifx_dev->spi_dev->dev, "Modem reset timeout: (state:%lx)", in ifx_spi_reset()
970 ifx_dev->mdm_reset_state); in ifx_spi_reset()
972 ifx_dev->mdm_reset_state = 0; in ifx_spi_reset()
993 struct ifx_spi_device *ifx_dev; in ifx_spi_spi_probe() local
1008 ifx_dev = kzalloc(sizeof(struct ifx_spi_device), GFP_KERNEL); in ifx_spi_spi_probe()
1009 if (!ifx_dev) { in ifx_spi_spi_probe()
1013 saved_ifx_dev = ifx_dev; in ifx_spi_spi_probe()
1014 ifx_dev->spi_dev = spi; in ifx_spi_spi_probe()
1015 clear_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags); in ifx_spi_spi_probe()
1016 spin_lock_init(&ifx_dev->write_lock); in ifx_spi_spi_probe()
1017 spin_lock_init(&ifx_dev->power_lock); in ifx_spi_spi_probe()
1018 ifx_dev->power_status = 0; in ifx_spi_spi_probe()
1019 timer_setup(&ifx_dev->spi_timer, ifx_spi_timeout, 0); in ifx_spi_spi_probe()
1020 ifx_dev->modem = pl_data->modem_type; in ifx_spi_spi_probe()
1021 ifx_dev->use_dma = pl_data->use_dma; in ifx_spi_spi_probe()
1022 ifx_dev->max_hz = pl_data->max_hz; in ifx_spi_spi_probe()
1024 spi->max_speed_hz = ifx_dev->max_hz; in ifx_spi_spi_probe()
1030 kfree(ifx_dev); in ifx_spi_spi_probe()
1036 ifx_dev->swap_buf = swap_buf_32; in ifx_spi_spi_probe()
1038 ifx_dev->swap_buf = swap_buf_16; in ifx_spi_spi_probe()
1040 ifx_dev->swap_buf = swap_buf_8; in ifx_spi_spi_probe()
1043 ifx_dev->spi_more = 0; in ifx_spi_spi_probe()
1044 ifx_dev->spi_slave_cts = 0; in ifx_spi_spi_probe()
1047 ifx_dev->tx_buffer = dma_alloc_coherent(ifx_dev->spi_dev->dev.parent, in ifx_spi_spi_probe()
1049 &ifx_dev->tx_bus, in ifx_spi_spi_probe()
1051 if (!ifx_dev->tx_buffer) { in ifx_spi_spi_probe()
1056 ifx_dev->rx_buffer = dma_alloc_coherent(ifx_dev->spi_dev->dev.parent, in ifx_spi_spi_probe()
1058 &ifx_dev->rx_bus, in ifx_spi_spi_probe()
1060 if (!ifx_dev->rx_buffer) { in ifx_spi_spi_probe()
1067 init_waitqueue_head(&ifx_dev->mdm_reset_wait); in ifx_spi_spi_probe()
1069 spi_set_drvdata(spi, ifx_dev); in ifx_spi_spi_probe()
1070 tasklet_setup(&ifx_dev->io_work_tasklet, ifx_spi_io); in ifx_spi_spi_probe()
1072 set_bit(IFX_SPI_STATE_PRESENT, &ifx_dev->flags); in ifx_spi_spi_probe()
1075 ret = ifx_spi_create_port(ifx_dev); in ifx_spi_spi_probe()
1081 ifx_dev->gpio.reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); in ifx_spi_spi_probe()
1082 if (IS_ERR(ifx_dev->gpio.reset)) { in ifx_spi_spi_probe()
1084 ret = PTR_ERR(ifx_dev->gpio.reset); in ifx_spi_spi_probe()
1087 gpiod_set_consumer_name(ifx_dev->gpio.reset, "ifxModem reset"); in ifx_spi_spi_probe()
1088 ifx_dev->gpio.po = devm_gpiod_get(dev, "power", GPIOD_OUT_LOW); in ifx_spi_spi_probe()
1089 if (IS_ERR(ifx_dev->gpio.po)) { in ifx_spi_spi_probe()
1091 ret = PTR_ERR(ifx_dev->gpio.po); in ifx_spi_spi_probe()
1094 gpiod_set_consumer_name(ifx_dev->gpio.po, "ifxModem power"); in ifx_spi_spi_probe()
1095 ifx_dev->gpio.mrdy = devm_gpiod_get(dev, "mrdy", GPIOD_OUT_LOW); in ifx_spi_spi_probe()
1096 if (IS_ERR(ifx_dev->gpio.mrdy)) { in ifx_spi_spi_probe()
1098 ret = PTR_ERR(ifx_dev->gpio.mrdy); in ifx_spi_spi_probe()
1101 gpiod_set_consumer_name(ifx_dev->gpio.mrdy, "ifxModem mrdy"); in ifx_spi_spi_probe()
1102 ifx_dev->gpio.srdy = devm_gpiod_get(dev, "srdy", GPIOD_IN); in ifx_spi_spi_probe()
1103 if (IS_ERR(ifx_dev->gpio.srdy)) { in ifx_spi_spi_probe()
1105 ret = PTR_ERR(ifx_dev->gpio.srdy); in ifx_spi_spi_probe()
1108 gpiod_set_consumer_name(ifx_dev->gpio.srdy, "ifxModem srdy"); in ifx_spi_spi_probe()
1109 ifx_dev->gpio.reset_out = devm_gpiod_get(dev, "rst_out", GPIOD_IN); in ifx_spi_spi_probe()
1110 if (IS_ERR(ifx_dev->gpio.reset_out)) { in ifx_spi_spi_probe()
1112 ret = PTR_ERR(ifx_dev->gpio.reset_out); in ifx_spi_spi_probe()
1115 gpiod_set_consumer_name(ifx_dev->gpio.reset_out, "ifxModem reset out"); in ifx_spi_spi_probe()
1116 ifx_dev->gpio.pmu_reset = devm_gpiod_get(dev, "pmu_reset", GPIOD_ASIS); in ifx_spi_spi_probe()
1117 if (IS_ERR(ifx_dev->gpio.pmu_reset)) { in ifx_spi_spi_probe()
1119 ret = PTR_ERR(ifx_dev->gpio.pmu_reset); in ifx_spi_spi_probe()
1122 gpiod_set_consumer_name(ifx_dev->gpio.pmu_reset, "ifxModem PMU reset"); in ifx_spi_spi_probe()
1124 ret = request_irq(gpiod_to_irq(ifx_dev->gpio.reset_out), in ifx_spi_spi_probe()
1127 ifx_dev); in ifx_spi_spi_probe()
1130 gpiod_to_irq(ifx_dev->gpio.reset_out)); in ifx_spi_spi_probe()
1134 ret = ifx_spi_reset(ifx_dev); in ifx_spi_spi_probe()
1136 ret = request_irq(gpiod_to_irq(ifx_dev->gpio.srdy), in ifx_spi_spi_probe()
1138 ifx_dev); in ifx_spi_spi_probe()
1141 gpiod_to_irq(ifx_dev->gpio.srdy)); in ifx_spi_spi_probe()
1153 srdy = gpiod_get_value(ifx_dev->gpio.srdy); in ifx_spi_spi_probe()
1156 mrdy_assert(ifx_dev); in ifx_spi_spi_probe()
1157 ifx_spi_handle_srdy(ifx_dev); in ifx_spi_spi_probe()
1159 mrdy_set_low(ifx_dev); in ifx_spi_spi_probe()
1163 free_irq(gpiod_to_irq(ifx_dev->gpio.reset_out), ifx_dev); in ifx_spi_spi_probe()
1165 ifx_spi_free_device(ifx_dev); in ifx_spi_spi_probe()
1180 struct ifx_spi_device *ifx_dev = spi_get_drvdata(spi); in ifx_spi_spi_remove() local
1182 tasklet_kill(&ifx_dev->io_work_tasklet); in ifx_spi_spi_remove()
1187 free_irq(gpiod_to_irq(ifx_dev->gpio.reset_out), ifx_dev); in ifx_spi_spi_remove()
1188 free_irq(gpiod_to_irq(ifx_dev->gpio.srdy), ifx_dev); in ifx_spi_spi_remove()
1191 ifx_spi_free_device(ifx_dev); in ifx_spi_spi_remove()
1206 struct ifx_spi_device *ifx_dev = spi_get_drvdata(spi); in ifx_spi_spi_shutdown() local
1208 ifx_modem_power_off(ifx_dev); in ifx_spi_spi_shutdown()
1273 struct ifx_spi_device *ifx_dev = spi_get_drvdata(spi); in ifx_spi_pm_runtime_idle() local
1275 if (!ifx_dev->power_status) in ifx_spi_pm_runtime_idle()