diff options
author | Pavan Savoy <pavan_savoy@ti.com> | 2011-08-10 11:18:31 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-22 17:13:32 -0400 |
commit | 0d7c5f2572ccfa7bf83292b1506926663f2d164a (patch) | |
tree | 7ad38fe6af0fd468aa7c1af654ce2d7addbea622 /drivers/misc/ti-st | |
parent | 5926cef26c72cd121266b000b8975e6373cbf2b3 (diff) |
drivers:misc:ti-st: platform hooks for chip states
Certain platform specific or Host-WiLink Interface specific actions would be
required to be taken when the chip is being enabled and after the chip is
disabled such as configuration of the mux modes for the GPIO of host connected
to the nshutdown of the chip or relinquishing UART after the chip is disabled.
Similar actions can also be taken when the chip is in deep sleep or when the
chip is awake. Performance enhancements such as configuring the host to run
faster when chip is awake and slower when chip is asleep can also be made
here.
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/misc/ti-st')
-rw-r--r-- | drivers/misc/ti-st/st_kim.c | 12 | ||||
-rw-r--r-- | drivers/misc/ti-st/st_ll.c | 19 |
2 files changed, 31 insertions, 0 deletions
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index 38fd2f04c07e..6884dd1c997b 100644 --- a/drivers/misc/ti-st/st_kim.c +++ b/drivers/misc/ti-st/st_kim.c | |||
@@ -434,11 +434,17 @@ long st_kim_start(void *kim_data) | |||
434 | { | 434 | { |
435 | long err = 0; | 435 | long err = 0; |
436 | long retry = POR_RETRY_COUNT; | 436 | long retry = POR_RETRY_COUNT; |
437 | struct ti_st_plat_data *pdata; | ||
437 | struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data; | 438 | struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data; |
438 | 439 | ||
439 | pr_info(" %s", __func__); | 440 | pr_info(" %s", __func__); |
441 | pdata = kim_gdata->kim_pdev->dev.platform_data; | ||
440 | 442 | ||
441 | do { | 443 | do { |
444 | /* platform specific enabling code here */ | ||
445 | if (pdata->chip_enable) | ||
446 | pdata->chip_enable(kim_gdata); | ||
447 | |||
442 | /* Configure BT nShutdown to HIGH state */ | 448 | /* Configure BT nShutdown to HIGH state */ |
443 | gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); | 449 | gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); |
444 | mdelay(5); /* FIXME: a proper toggle */ | 450 | mdelay(5); /* FIXME: a proper toggle */ |
@@ -489,6 +495,8 @@ long st_kim_stop(void *kim_data) | |||
489 | { | 495 | { |
490 | long err = 0; | 496 | long err = 0; |
491 | struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data; | 497 | struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data; |
498 | struct ti_st_plat_data *pdata = | ||
499 | kim_gdata->kim_pdev->dev.platform_data; | ||
492 | 500 | ||
493 | INIT_COMPLETION(kim_gdata->ldisc_installed); | 501 | INIT_COMPLETION(kim_gdata->ldisc_installed); |
494 | 502 | ||
@@ -515,6 +523,10 @@ long st_kim_stop(void *kim_data) | |||
515 | gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH); | 523 | gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH); |
516 | mdelay(1); | 524 | mdelay(1); |
517 | gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); | 525 | gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); |
526 | |||
527 | /* platform specific disable */ | ||
528 | if (pdata->chip_disable) | ||
529 | pdata->chip_disable(kim_gdata); | ||
518 | return err; | 530 | return err; |
519 | } | 531 | } |
520 | 532 | ||
diff --git a/drivers/misc/ti-st/st_ll.c b/drivers/misc/ti-st/st_ll.c index 3f2495138855..1ff460a8e9c7 100644 --- a/drivers/misc/ti-st/st_ll.c +++ b/drivers/misc/ti-st/st_ll.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #define pr_fmt(fmt) "(stll) :" fmt | 22 | #define pr_fmt(fmt) "(stll) :" fmt |
23 | #include <linux/skbuff.h> | 23 | #include <linux/skbuff.h> |
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/platform_device.h> | ||
25 | #include <linux/ti_wilink_st.h> | 26 | #include <linux/ti_wilink_st.h> |
26 | 27 | ||
27 | /**********************************************************************/ | 28 | /**********************************************************************/ |
@@ -37,6 +38,9 @@ static void send_ll_cmd(struct st_data_s *st_data, | |||
37 | 38 | ||
38 | static void ll_device_want_to_sleep(struct st_data_s *st_data) | 39 | static void ll_device_want_to_sleep(struct st_data_s *st_data) |
39 | { | 40 | { |
41 | struct kim_data_s *kim_data; | ||
42 | struct ti_st_plat_data *pdata; | ||
43 | |||
40 | pr_debug("%s", __func__); | 44 | pr_debug("%s", __func__); |
41 | /* sanity check */ | 45 | /* sanity check */ |
42 | if (st_data->ll_state != ST_LL_AWAKE) | 46 | if (st_data->ll_state != ST_LL_AWAKE) |
@@ -46,10 +50,19 @@ static void ll_device_want_to_sleep(struct st_data_s *st_data) | |||
46 | send_ll_cmd(st_data, LL_SLEEP_ACK); | 50 | send_ll_cmd(st_data, LL_SLEEP_ACK); |
47 | /* update state */ | 51 | /* update state */ |
48 | st_data->ll_state = ST_LL_ASLEEP; | 52 | st_data->ll_state = ST_LL_ASLEEP; |
53 | |||
54 | /* communicate to platform about chip asleep */ | ||
55 | kim_data = st_data->kim_data; | ||
56 | pdata = kim_data->kim_pdev->dev.platform_data; | ||
57 | if (pdata->chip_asleep) | ||
58 | pdata->chip_asleep(NULL); | ||
49 | } | 59 | } |
50 | 60 | ||
51 | static void ll_device_want_to_wakeup(struct st_data_s *st_data) | 61 | static void ll_device_want_to_wakeup(struct st_data_s *st_data) |
52 | { | 62 | { |
63 | struct kim_data_s *kim_data; | ||
64 | struct ti_st_plat_data *pdata; | ||
65 | |||
53 | /* diff actions in diff states */ | 66 | /* diff actions in diff states */ |
54 | switch (st_data->ll_state) { | 67 | switch (st_data->ll_state) { |
55 | case ST_LL_ASLEEP: | 68 | case ST_LL_ASLEEP: |
@@ -70,6 +83,12 @@ static void ll_device_want_to_wakeup(struct st_data_s *st_data) | |||
70 | } | 83 | } |
71 | /* update state */ | 84 | /* update state */ |
72 | st_data->ll_state = ST_LL_AWAKE; | 85 | st_data->ll_state = ST_LL_AWAKE; |
86 | |||
87 | /* communicate to platform about chip wakeup */ | ||
88 | kim_data = st_data->kim_data; | ||
89 | pdata = kim_data->kim_pdev->dev.platform_data; | ||
90 | if (pdata->chip_asleep) | ||
91 | pdata->chip_awake(NULL); | ||
73 | } | 92 | } |
74 | 93 | ||
75 | /**********************************************************************/ | 94 | /**********************************************************************/ |