diff options
| -rw-r--r-- | drivers/misc/ti-st/st_core.c | 2 | ||||
| -rw-r--r-- | drivers/misc/ti-st/st_ll.c | 12 | ||||
| -rw-r--r-- | include/linux/ti_wilink_st.h | 3 |
3 files changed, 15 insertions, 2 deletions
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index e8a8cb4e99c..92449a6a1d6 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c @@ -892,6 +892,7 @@ int st_core_init(struct st_data_s **core_data) pr_err("unable to un-register ldisc\n"); return err; } + wake_lock_init(&st_gdata->st_awake, WAKE_LOCK_SUSPEND, "st_alive"); *core_data = st_gdata; return 0; } @@ -905,6 +906,7 @@ void st_core_exit(struct st_data_s *st_gdata) pr_err("error during deinit of ST LL %ld\n", err); if (st_gdata != NULL) { + wake_lock_destroy(&st_gdata->st_awake); /* Free ST Tx Qs and skbs */ skb_queue_purge(&st_gdata->txq); skb_queue_purge(&st_gdata->tx_waitq); diff --git a/drivers/misc/ti-st/st_ll.c b/drivers/misc/ti-st/st_ll.c index bf8d3d5bc01..fa4b8e48ada 100644 --- a/drivers/misc/ti-st/st_ll.c +++ b/drivers/misc/ti-st/st_ll.c @@ -24,6 +24,7 @@ #include <linux/module.h> #include <linux/platform_device.h> #include <linux/ti_wilink_st.h> +#include <linux/wakelock.h> /**********************************************************************/ /* internal functions */ @@ -37,13 +38,17 @@ static void send_ll_cmd(struct st_data_s *st_data, kim_plat_data = (struct kim_data_s *)st_data->kim_data; pdata = kim_plat_data->kim_pdev->dev.platform_data; - if (cmd == LL_WAKE_UP_IND || cmd == LL_WAKE_UP_ACK) + if (cmd == LL_WAKE_UP_IND || cmd == LL_WAKE_UP_ACK) { + wake_lock(&st_data->st_awake); omap_serial_runtime_get(pdata->port_index); + } st_int_write(st_data, &cmd, 1); - if (cmd == LL_SLEEP_ACK) + if (cmd == LL_SLEEP_ACK) { + wake_unlock(&st_data->st_awake); omap_serial_runtime_put(pdata->port_index); + } return; } @@ -117,6 +122,7 @@ void st_ll_enable(struct st_data_s *ll) 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; + wake_lock(&ll->st_awake); omap_serial_runtime_get(pdata->port_index); } ll->ll_state = ST_LL_AWAKE; @@ -133,6 +139,7 @@ void st_ll_disable(struct st_data_s *ll) 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; + wake_unlock(&ll->st_awake); omap_serial_runtime_put(pdata->port_index); } ll->ll_state = ST_LL_INVALID; @@ -194,6 +201,7 @@ long st_ll_init(struct st_data_s *ll) { /* set state to invalid */ ll->ll_state = ST_LL_INVALID; + return 0; } diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h index cf71cdea9f9..3ef81ae5f19 100644 --- a/include/linux/ti_wilink_st.h +++ b/include/linux/ti_wilink_st.h @@ -26,6 +26,7 @@ #define TI_WILINK_ST_H #include <linux/skbuff.h> +#include <linux/wakelock.h> /** * enum proto-type - The protocol on WiLink chips which share a @@ -158,6 +159,8 @@ struct st_data_s { unsigned long ll_state; void *kim_data; struct tty_struct *tty; + + struct wake_lock st_awake; /* Held while controller is awake */ }; /* |