aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/ifx6x60.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/serial/ifx6x60.c')
-rw-r--r--drivers/tty/serial/ifx6x60.c80
1 files changed, 4 insertions, 76 deletions
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 68d7ce997ede..8b1534c424af 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -270,23 +270,6 @@ static void mrdy_assert(struct ifx_spi_device *ifx_dev)
270} 270}
271 271
272/** 272/**
273 * ifx_spi_hangup - hang up an IFX device
274 * @ifx_dev: our SPI device
275 *
276 * Hang up the tty attached to the IFX device if one is currently
277 * open. If not take no action
278 */
279static void ifx_spi_ttyhangup(struct ifx_spi_device *ifx_dev)
280{
281 struct tty_port *pport = &ifx_dev->tty_port;
282 struct tty_struct *tty = tty_port_tty_get(pport);
283 if (tty) {
284 tty_hangup(tty);
285 tty_kref_put(tty);
286 }
287}
288
289/**
290 * ifx_spi_timeout - SPI timeout 273 * ifx_spi_timeout - SPI timeout
291 * @arg: our SPI device 274 * @arg: our SPI device
292 * 275 *
@@ -298,7 +281,7 @@ static void ifx_spi_timeout(unsigned long arg)
298 struct ifx_spi_device *ifx_dev = (struct ifx_spi_device *)arg; 281 struct ifx_spi_device *ifx_dev = (struct ifx_spi_device *)arg;
299 282
300 dev_warn(&ifx_dev->spi_dev->dev, "*** SPI Timeout ***"); 283 dev_warn(&ifx_dev->spi_dev->dev, "*** SPI Timeout ***");
301 ifx_spi_ttyhangup(ifx_dev); 284 tty_port_tty_hangup(&ifx_dev->tty_port, false);
302 mrdy_set_low(ifx_dev); 285 mrdy_set_low(ifx_dev);
303 clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags); 286 clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags);
304} 287}
@@ -443,25 +426,6 @@ static void ifx_spi_setup_spi_header(unsigned char *txbuffer, int tx_count,
443} 426}
444 427
445/** 428/**
446 * ifx_spi_wakeup_serial - SPI space made
447 * @port_data: our SPI device
448 *
449 * We have emptied the FIFO enough that we want to get more data
450 * queued into it. Poke the line discipline via tty_wakeup so that
451 * it will feed us more bits
452 */
453static void ifx_spi_wakeup_serial(struct ifx_spi_device *ifx_dev)
454{
455 struct tty_struct *tty;
456
457 tty = tty_port_tty_get(&ifx_dev->tty_port);
458 if (!tty)
459 return;
460 tty_wakeup(tty);
461 tty_kref_put(tty);
462}
463
464/**
465 * ifx_spi_prepare_tx_buffer - prepare transmit frame 429 * ifx_spi_prepare_tx_buffer - prepare transmit frame
466 * @ifx_dev: our SPI device 430 * @ifx_dev: our SPI device
467 * 431 *
@@ -506,7 +470,7 @@ static int ifx_spi_prepare_tx_buffer(struct ifx_spi_device *ifx_dev)
506 tx_count += temp_count; 470 tx_count += temp_count;
507 if (temp_count == queue_length) 471 if (temp_count == queue_length)
508 /* poke port to get more data */ 472 /* poke port to get more data */
509 ifx_spi_wakeup_serial(ifx_dev); 473 tty_port_tty_wakeup(&ifx_dev->tty_port);
510 else /* more data in port, use next SPI message */ 474 else /* more data in port, use next SPI message */
511 ifx_dev->spi_more = 1; 475 ifx_dev->spi_more = 1;
512 } 476 }
@@ -683,8 +647,6 @@ static void ifx_spi_insert_flip_string(struct ifx_spi_device *ifx_dev,
683static void ifx_spi_complete(void *ctx) 647static void ifx_spi_complete(void *ctx)
684{ 648{
685 struct ifx_spi_device *ifx_dev = ctx; 649 struct ifx_spi_device *ifx_dev = ctx;
686 struct tty_struct *tty;
687 struct tty_ldisc *ldisc = NULL;
688 int length; 650 int length;
689 int actual_length; 651 int actual_length;
690 unsigned char more; 652 unsigned char more;
@@ -762,15 +724,7 @@ complete_exit:
762 */ 724 */
763 ifx_spi_power_state_clear(ifx_dev, 725 ifx_spi_power_state_clear(ifx_dev,
764 IFX_SPI_POWER_DATA_PENDING); 726 IFX_SPI_POWER_DATA_PENDING);
765 tty = tty_port_tty_get(&ifx_dev->tty_port); 727 tty_port_tty_wakeup(&ifx_dev->tty_port);
766 if (tty) {
767 ldisc = tty_ldisc_ref(tty);
768 if (ldisc) {
769 ldisc->ops->write_wakeup(tty);
770 tty_ldisc_deref(ldisc);
771 }
772 tty_kref_put(tty);
773 }
774 } 728 }
775 } 729 }
776} 730}
@@ -962,7 +916,7 @@ static irqreturn_t ifx_spi_reset_interrupt(int irq, void *dev)
962 set_bit(MR_INPROGRESS, &ifx_dev->mdm_reset_state); 916 set_bit(MR_INPROGRESS, &ifx_dev->mdm_reset_state);
963 if (!solreset) { 917 if (!solreset) {
964 /* unsolicited reset */ 918 /* unsolicited reset */
965 ifx_spi_ttyhangup(ifx_dev); 919 tty_port_tty_hangup(&ifx_dev->tty_port, false);
966 } 920 }
967 } else { 921 } else {
968 /* exited reset */ 922 /* exited reset */
@@ -1325,30 +1279,6 @@ static void ifx_spi_spi_shutdown(struct spi_device *spi)
1325 */ 1279 */
1326 1280
1327/** 1281/**
1328 * ifx_spi_spi_suspend - suspend SPI on system suspend
1329 * @dev: device being suspended
1330 *
1331 * Suspend the SPI side. No action needed on Intel MID platforms, may
1332 * need extending for other systems.
1333 */
1334static int ifx_spi_spi_suspend(struct spi_device *spi, pm_message_t msg)
1335{
1336 return 0;
1337}
1338
1339/**
1340 * ifx_spi_spi_resume - resume SPI side on system resume
1341 * @dev: device being suspended
1342 *
1343 * Suspend the SPI side. No action needed on Intel MID platforms, may
1344 * need extending for other systems.
1345 */
1346static int ifx_spi_spi_resume(struct spi_device *spi)
1347{
1348 return 0;
1349}
1350
1351/**
1352 * ifx_spi_pm_suspend - suspend modem on system suspend 1282 * ifx_spi_pm_suspend - suspend modem on system suspend
1353 * @dev: device being suspended 1283 * @dev: device being suspended
1354 * 1284 *
@@ -1437,8 +1367,6 @@ static struct spi_driver ifx_spi_driver = {
1437 .probe = ifx_spi_spi_probe, 1367 .probe = ifx_spi_spi_probe,
1438 .shutdown = ifx_spi_spi_shutdown, 1368 .shutdown = ifx_spi_spi_shutdown,
1439 .remove = ifx_spi_spi_remove, 1369 .remove = ifx_spi_spi_remove,
1440 .suspend = ifx_spi_spi_suspend,
1441 .resume = ifx_spi_spi_resume,
1442 .id_table = ifx_id_table 1370 .id_table = ifx_id_table
1443}; 1371};
1444 1372