aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/misc/ti-st/st_kim.c12
-rw-r--r--drivers/misc/ti-st/st_ll.c19
-rw-r--r--include/linux/ti_wilink_st.h27
3 files changed, 57 insertions, 1 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
38static void ll_device_want_to_sleep(struct st_data_s *st_data) 39static 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
51static void ll_device_want_to_wakeup(struct st_data_s *st_data) 61static 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/**********************************************************************/
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
index b004e557caa9..2ef4385da6bf 100644
--- a/include/linux/ti_wilink_st.h
+++ b/include/linux/ti_wilink_st.h
@@ -410,7 +410,28 @@ struct gps_event_hdr {
410 u16 plen; 410 u16 plen;
411} __attribute__ ((packed)); 411} __attribute__ ((packed));
412 412
413/* platform data */ 413/**
414 * struct ti_st_plat_data - platform data shared between ST driver and
415 * platform specific board file which adds the ST device.
416 * @nshutdown_gpio: Host's GPIO line to which chip's BT_EN is connected.
417 * @dev_name: The UART/TTY name to which chip is interfaced. (eg: /dev/ttyS1)
418 * @flow_cntrl: Should always be 1, since UART's CTS/RTS is used for PM
419 * purposes.
420 * @baud_rate: The baud rate supported by the Host UART controller, this will
421 * be shared across with the chip via a HCI VS command from User-Space Init
422 * Mgr application.
423 * @suspend:
424 * @resume: legacy PM routines hooked to platform specific board file, so as
425 * to take chip-host interface specific action.
426 * @chip_enable:
427 * @chip_disable: Platform/Interface specific mux mode setting, GPIO
428 * configuring, Host side PM disabling etc.. can be done here.
429 * @chip_asleep:
430 * @chip_awake: Chip specific deep sleep states is communicated to Host
431 * specific board-xx.c to take actions such as cut UART clocks when chip
432 * asleep or run host faster when chip awake etc..
433 *
434 */
414struct ti_st_plat_data { 435struct ti_st_plat_data {
415 long nshutdown_gpio; 436 long nshutdown_gpio;
416 unsigned char dev_name[UART_DEV_NAME_LEN]; /* uart name */ 437 unsigned char dev_name[UART_DEV_NAME_LEN]; /* uart name */
@@ -418,6 +439,10 @@ struct ti_st_plat_data {
418 unsigned long baud_rate; 439 unsigned long baud_rate;
419 int (*suspend)(struct platform_device *, pm_message_t); 440 int (*suspend)(struct platform_device *, pm_message_t);
420 int (*resume)(struct platform_device *); 441 int (*resume)(struct platform_device *);
442 int (*chip_enable) (struct kim_data_s *);
443 int (*chip_disable) (struct kim_data_s *);
444 int (*chip_asleep) (struct kim_data_s *);
445 int (*chip_awake) (struct kim_data_s *);
421}; 446};
422 447
423#endif /* TI_WILINK_ST_H */ 448#endif /* TI_WILINK_ST_H */