diff options
| -rw-r--r-- | drivers/misc/ti-st/st_kim.c | 2 | ||||
| -rw-r--r-- | drivers/misc/ti-st/st_ll.c | 17 | ||||
| -rw-r--r-- | drivers/tty/serial/omap-serial.c | 4 |
3 files changed, 19 insertions, 4 deletions
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index 16e2cd81b10..53ad4fe37a5 100644 --- a/drivers/misc/ti-st/st_kim.c +++ b/drivers/misc/ti-st/st_kim.c @@ -465,7 +465,6 @@ long st_kim_start(void *kim_data) pr_info("%s\n", __func__); pdata = kim_gdata->kim_pdev->dev.platform_data; - omap_serial_runtime_get(pdata->port_index); do { /* platform specific enabling code here */ if (pdata->chip_enable) @@ -507,7 +506,6 @@ long st_kim_start(void *kim_data) } } } while (retry--); - omap_serial_runtime_put(pdata->port_index); return err; } diff --git a/drivers/misc/ti-st/st_ll.c b/drivers/misc/ti-st/st_ll.c index d746071db81..bf8d3d5bc01 100644 --- a/drivers/misc/ti-st/st_ll.c +++ b/drivers/misc/ti-st/st_ll.c @@ -111,6 +111,14 @@ static void ll_device_want_to_wakeup(struct st_data_s *st_data) * enable ST LL */ void st_ll_enable(struct st_data_s *ll) { + struct kim_data_s *kim_plat_data; + struct ti_st_plat_data *pdata; + + if (ll->ll_state == ST_LL_INVALID) { + kim_plat_data = (struct kim_data_s *)ll->kim_data; + pdata = kim_plat_data->kim_pdev->dev.platform_data; + omap_serial_runtime_get(pdata->port_index); + } ll->ll_state = ST_LL_AWAKE; } @@ -118,6 +126,15 @@ void st_ll_enable(struct st_data_s *ll) * disable ST LL */ void st_ll_disable(struct st_data_s *ll) { + struct kim_data_s *kim_plat_data; + struct ti_st_plat_data *pdata; + + if (ll->ll_state == ST_LL_AWAKE || + ll->ll_state == ST_LL_ASLEEP_TO_AWAKE) { + kim_plat_data = (struct kim_data_s *)ll->kim_data; + pdata = kim_plat_data->kim_pdev->dev.platform_data; + omap_serial_runtime_put(pdata->port_index); + } ll->ll_state = ST_LL_INVALID; } diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index e077e996b50..ab5ec0b4c03 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -196,10 +196,10 @@ void omap_serial_runtime_get(int port_index) spin_lock(&up->port.lock); ext_rt_cnt = up->ext_rt_cnt; up->ext_rt_cnt = 1; - spin_unlock(&up->port.lock); if (up->dev && !ext_rt_cnt) pm_runtime_get_sync(up->dev); + spin_unlock(&up->port.lock); } void omap_serial_runtime_put(int port_index) @@ -214,12 +214,12 @@ void omap_serial_runtime_put(int port_index) spin_lock(&up->port.lock); ext_rt_cnt = up->ext_rt_cnt; up->ext_rt_cnt = 0; - spin_unlock(&up->port.lock); if (up->dev && ext_rt_cnt) { pm_runtime_mark_last_busy(up->dev); pm_runtime_put_autosuspend(up->dev); } + spin_unlock(&up->port.lock); } static inline unsigned int serial_in(struct uart_omap_port *up, int offset) |