summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRakesh Goyal <rgoyal@nvidia.com>2012-03-10 07:03:17 +0530
committerRohan Somvanshi <rsomvanshi@nvidia.com>2012-03-15 08:45:18 -0700
commit3d77a4f0c1763ecbe41b63e238a9fb82b262bcf5 (patch)
treee5efd0f6caf2e0c66e2cce7457638ed7a27c4d9e /drivers
parentc8c6328fac300f8b93cb61c99e8280981692fa56 (diff)
misc: bluetooth: clean ti_bluesleep patch
Remove dead code Remove whitespace Remove platform callback function and add wake_lock/wake_unlock Fix compilation warnings Bug 933054 Bug 931931 Change-Id: I5b0947ad2053f9e0437ffe89879df2c84786ec9c Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com> Reviewed-on: http://git-master/r/89274 Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com> Tested-by: Nagarjuna Kristam <nkristam@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/bluetooth/ti_bluesleep.c43
-rw-r--r--drivers/misc/ti-st/st_core.c1
-rw-r--r--drivers/misc/ti-st/st_kim.c54
-rw-r--r--drivers/misc/ti-st/st_ll.c42
4 files changed, 42 insertions, 98 deletions
diff --git a/drivers/bluetooth/ti_bluesleep.c b/drivers/bluetooth/ti_bluesleep.c
index 4a7c503f2149..d86fd261e676 100644
--- a/drivers/bluetooth/ti_bluesleep.c
+++ b/drivers/bluetooth/ti_bluesleep.c
@@ -56,7 +56,6 @@
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h> /* event notifications */
-#include <linux/ti_wilink_st.h>
#include "hci_uart.h"
/*
@@ -134,7 +133,6 @@ static void hsuart_power(int on)
static void hostwake_sleep_work(struct work_struct *work)
{
- int retval ;
pr_debug("%s", __func__);
free_irq(bsi->host_wake_irq, "tibluesleep");
/*Activating UART */
@@ -151,7 +149,7 @@ static void hostwake_sleep_work(struct work_struct *work)
/**
- * A tasklet function that runs in tasklet context
+ * A tasklet function that runs in tasklet context
* @param data Not used.
*/
static void bluesleep_hostwake_task(unsigned long data)
@@ -161,7 +159,6 @@ static void bluesleep_hostwake_task(unsigned long data)
spin_lock(&rw_lock);
hostwake_workqueue();
spin_unlock(&rw_lock);
-
}
@@ -190,14 +187,10 @@ static irqreturn_t bluesleep_hostwake_isr(int irq, void *dev_id)
int bluesleep_start(struct uart_port *uport)
{
int retval;
-
bsi->uport = uport;
-
pr_debug("%s", __func__);
if (test_bit(BT_SUSPEND, &flags)) {
-
-
BT_DBG("bluesleep_acquire irq");
if (bsi->irq_polarity == POLARITY_LOW) {
retval = request_irq(bsi->host_wake_irq, bluesleep_hostwake_isr,
@@ -213,19 +206,18 @@ static irqreturn_t bluesleep_hostwake_isr(int irq, void *dev_id)
goto fail;
}
- retval = enable_irq_wake(bsi->host_wake_irq);
- if (retval < 0) {
- BT_ERR("Couldn't enable BT_HOST_WAKE as wakeup interrupt retval %d\n",retval);
- free_irq(bsi->host_wake_irq, NULL);
- goto fail;
- }
-
+ retval = enable_irq_wake(bsi->host_wake_irq);
+ if (retval < 0) {
+ BT_ERR("Couldn't enable BT_HOST_WAKE as wakeup"
+ "interrupt retval %d\n", retval);
+ free_irq(bsi->host_wake_irq, NULL);
+ goto fail;
+ }
}
return 0;
fail:
atomic_inc(&open_count);
-
return retval;
}
@@ -241,7 +233,6 @@ fail:
BT_ERR("Couldn't disable hostwake IRQ wakeup mode\n");
free_irq(bsi->host_wake_irq, NULL);
-
}
static int bluesleep_probe(struct platform_device *pdev)
@@ -249,18 +240,10 @@ static int bluesleep_probe(struct platform_device *pdev)
int ret;
struct resource *res;
- struct kim_data_s *kim_gdata;
- struct st_data_s *core_data;
- kim_gdata = dev_get_drvdata(&pdev->dev);
- core_data = kim_gdata->core_data;
- struct uart_state *state = (struct uart_state *)core_data->tty->driver_data;
-
-
bsi = kzalloc(sizeof(struct bluesleep_info), GFP_KERNEL);
if (!bsi)
return -ENOMEM;
-
res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
"host_wake");
if (!res) {
@@ -269,7 +252,7 @@ static int bluesleep_probe(struct platform_device *pdev)
goto free_bsi;
}
- bsi->host_wake_irq = res->start;
+ bsi->host_wake_irq = res->start;
if (bsi->host_wake_irq < 0) {
BT_ERR("couldn't find host_wake irq");
@@ -287,7 +270,6 @@ static int bluesleep_probe(struct platform_device *pdev)
return 0;
-
free_bsi:
kfree(bsi);
return ret;
@@ -306,12 +288,10 @@ static int bluesleep_resume(struct platform_device *pdev)
pr_debug("%s", __func__);
if (test_bit(BT_SUSPEND, &flags)) {
-
+
if ((bsi->uport != NULL) && (bsi->has_ext_wake)) {
tegra_uart_request_clock_on(bsi->uport);
tegra_uart_set_mctrl(bsi->uport, TIOCM_RTS);
-
-
}
clear_bit(BT_SUSPEND, &flags);
set_bit(BT_ACTIVE, &flags);
@@ -345,13 +325,12 @@ static struct platform_driver bluesleep_driver = {
static int __init bluesleep_init(void)
{
int retval;
- struct proc_dir_entry *ent;
BT_INFO("BlueSleep Mode Driver Ver %s", VERSION);
retval = platform_driver_register(&bluesleep_driver);
if (retval)
- return retval;
+ goto fail;
if (bsi == NULL)
return 0;
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c
index 67026f87dcd9..dde6d57dea55 100644
--- a/drivers/misc/ti-st/st_core.c
+++ b/drivers/misc/ti-st/st_core.c
@@ -50,7 +50,6 @@ static void remove_channel_from_table(struct st_data_s *st_gdata,
struct st_proto_s *proto)
{
pr_info("%s: id %d\n", __func__, proto->chnl_id);
-/* st_gdata->list[proto->chnl_id] = NULL; */
st_gdata->is_registered[proto->chnl_id] = false;
}
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index 5996b934abf0..addb6c5a3a3b 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -451,9 +451,7 @@ long st_kim_start(void *kim_data)
do {
/* platform specific enabling code here */
- if (pdata->chip_enable)
- pdata->chip_enable();
-
+ wake_lock(&kim_gdata->core_data->st_wk_lock);
/* Configure BT nShutdown to HIGH state */
gpio_set_value(kim_gdata->nshutdown, GPIO_LOW);
mdelay(5); /* FIXME: a proper toggle */
@@ -517,8 +515,6 @@ long st_kim_stop(void *kim_data)
{
long err = 0;
struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data;
- struct ti_st_plat_data *pdata =
- kim_gdata->kim_pdev->dev.platform_data;
INIT_COMPLETION(kim_gdata->ldisc_installed);
@@ -547,8 +543,7 @@ long st_kim_stop(void *kim_data)
gpio_set_value(kim_gdata->nshutdown, GPIO_LOW);
/* platform specific disable */
- if (pdata->chip_disable)
- pdata->chip_disable();
+ wake_unlock(&kim_gdata->core_data->st_wk_lock);
return err;
}
@@ -707,6 +702,8 @@ static int kim_probe(struct platform_device *pdev)
/* refer to itself */
kim_gdata->core_data->kim_data = kim_gdata;
+ wake_lock_init(&kim_gdata->core_data->st_wk_lock, WAKE_LOCK_SUSPEND,
+ "st_wake_lock");
/* Claim the chip enable nShutdown gpio from the system */
kim_gdata->nshutdown = pdata->nshutdown_gpio;
status = gpio_request(kim_gdata->nshutdown, "kim");
@@ -715,8 +712,6 @@ static int kim_probe(struct platform_device *pdev)
return status;
}
- tegra_gpio_enable(kim_gdata->nshutdown);
-
/* Configure nShutdown GPIO as output=0 */
status = gpio_direction_output(kim_gdata->nshutdown, 0);
if (unlikely(status)) {
@@ -774,6 +769,7 @@ static int kim_remove(struct platform_device *pdev)
sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp);
pr_info("sysfs entries removed");
+ wake_lock_destroy(&kim_gdata->core_data->st_wk_lock);
kim_gdata->kim_pdev = NULL;
st_core_exit(kim_gdata->core_data);
@@ -783,49 +779,31 @@ static int kim_remove(struct platform_device *pdev)
return 0;
}
-static unsigned long retry_suspend;
-
int kim_suspend(struct platform_device *pdev, pm_message_t state)
{
- struct ti_st_plat_data *pdata = pdev->dev.platform_data;
- int ret;
struct kim_data_s *kim_gdata;
- struct st_data_s *core_data;
- kim_gdata = dev_get_drvdata(&pdev->dev);
- core_data = kim_gdata->core_data;
- struct uart_state *uart_state;
- struct uart_port *uport;
-
+ struct st_data_s *core_data;
+ struct uart_state *uart_state;
+ struct uart_port *uport;
+ kim_gdata = dev_get_drvdata(&pdev->dev);
+ core_data = kim_gdata->core_data;
if (st_ll_getstate(core_data) != ST_LL_INVALID) {
- uart_state = core_data->tty->driver_data;
- uport = uart_state->uart_port;
+ uart_state = core_data->tty->driver_data;
+ uport = uart_state->uart_port;
#ifdef CONFIG_BT_TIBLUESLEEP
- pr_info(" Bluesleep Start");
- bluesleep_start(uport);
+ pr_info(" Bluesleep Start");
+ bluesleep_start(uport);
#endif
-
-
- }
-
- if (pdata->suspend) {
- ret = pdata->suspend(pdev, state);
- return ret;
}
- return -EOPNOTSUPP;
+ return 0;
}
int kim_resume(struct platform_device *pdev)
{
- struct ti_st_plat_data *pdata = pdev->dev.platform_data;
-
- if (pdata->resume) {
- return pdata->resume(pdev);
- }
-
- return -EOPNOTSUPP;
+ return 0;
}
/**********************************************************************/
diff --git a/drivers/misc/ti-st/st_ll.c b/drivers/misc/ti-st/st_ll.c
index 0025dde6a6d9..82558a36ceb2 100644
--- a/drivers/misc/ti-st/st_ll.c
+++ b/drivers/misc/ti-st/st_ll.c
@@ -38,9 +38,6 @@ static void send_ll_cmd(struct st_data_s *st_data,
static void ll_device_want_to_sleep(struct st_data_s *st_data)
{
- struct kim_data_s *kim_data;
- struct ti_st_plat_data *pdata;
-
pr_debug("%s", __func__);
/* sanity check */
if (st_data->ll_state != ST_LL_AWAKE)
@@ -52,24 +49,20 @@ static void ll_device_want_to_sleep(struct st_data_s *st_data)
st_data->ll_state = ST_LL_ASLEEP;
/* communicate to platform about chip asleep */
- kim_data = st_data->kim_data;
- pdata = kim_data->kim_pdev->dev.platform_data;
- if (pdata->chip_asleep)
- pdata->chip_asleep();
+#ifdef CONFIG_WAKELOCK
+ wake_unlock(&st_data->st_wk_lock);
+#endif
}
static void ll_device_want_to_wakeup(struct st_data_s *st_data)
{
- struct kim_data_s *kim_data = st_data->kim_data;
- struct ti_st_plat_data *pdata = kim_data->kim_pdev->dev.platform_data;
-
/* diff actions in diff states */
switch (st_data->ll_state) {
case ST_LL_ASLEEP:
/* communicate to platform about chip wakeup */
- if (pdata->chip_awake)
- pdata->chip_awake();
-
+#ifdef CONFIG_WAKELOCK
+ wake_lock(&st_data->st_wk_lock);
+#endif
send_ll_cmd(st_data, LL_WAKE_UP_ACK); /* send wake_ack */
break;
case ST_LL_ASLEEP_TO_AWAKE:
@@ -97,12 +90,10 @@ 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_data = ll->kim_data;
- struct ti_st_plat_data *pdata = kim_data->kim_pdev->dev.platform_data;
/* communicate to platform about chip enable */
- if (pdata->chip_enable)
- pdata->chip_enable();
-
+#ifdef CONFIG_WAKELOCK
+ wake_lock(&ll->st_wk_lock);
+#endif
ll->ll_state = ST_LL_AWAKE;
}
@@ -110,25 +101,22 @@ 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_data = ll->kim_data;
- struct ti_st_plat_data *pdata = kim_data->kim_pdev->dev.platform_data;
/* communicate to platform about chip disable */
- if (pdata->chip_disable)
- pdata->chip_disable();
-
+#ifdef CONFIG_WAKELOCK
+ wake_unlock(&ll->st_wk_lock);
+#endif
ll->ll_state = ST_LL_INVALID;
}
/* called when ST Core wants to update the state */
void st_ll_wakeup(struct st_data_s *ll)
{
- struct kim_data_s *kim_data = ll->kim_data;
- struct ti_st_plat_data *pdata = kim_data->kim_pdev->dev.platform_data;
if (likely(ll->ll_state != ST_LL_AWAKE)) {
/* communicate to platform about chip wakeup */
- if (pdata->chip_awake)
- pdata->chip_awake();
+#ifdef CONFIG_WAKELOCK
+ wake_lock(&ll->st_wk_lock);
+#endif
send_ll_cmd(ll, LL_WAKE_UP_IND); /* WAKE_IND */
ll->ll_state = ST_LL_ASLEEP_TO_AWAKE;
} else {