Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Pavan Savoy and committed by
Greg Kroah-Hartman
0d7c5f25 5926cef2

+57 -1
+12
drivers/misc/ti-st/st_kim.c
··· 434 434 { 435 435 long err = 0; 436 436 long retry = POR_RETRY_COUNT; 437 + struct ti_st_plat_data *pdata; 437 438 struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data; 438 439 439 440 pr_info(" %s", __func__); 441 + pdata = kim_gdata->kim_pdev->dev.platform_data; 440 442 441 443 do { 444 + /* platform specific enabling code here */ 445 + if (pdata->chip_enable) 446 + pdata->chip_enable(kim_gdata); 447 + 442 448 /* Configure BT nShutdown to HIGH state */ 443 449 gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); 444 450 mdelay(5); /* FIXME: a proper toggle */ ··· 495 489 { 496 490 long err = 0; 497 491 struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data; 492 + struct ti_st_plat_data *pdata = 493 + kim_gdata->kim_pdev->dev.platform_data; 498 494 499 495 INIT_COMPLETION(kim_gdata->ldisc_installed); 500 496 ··· 523 515 gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH); 524 516 mdelay(1); 525 517 gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); 518 + 519 + /* platform specific disable */ 520 + if (pdata->chip_disable) 521 + pdata->chip_disable(kim_gdata); 526 522 return err; 527 523 } 528 524
+19
drivers/misc/ti-st/st_ll.c
··· 22 22 #define pr_fmt(fmt) "(stll) :" fmt 23 23 #include <linux/skbuff.h> 24 24 #include <linux/module.h> 25 + #include <linux/platform_device.h> 25 26 #include <linux/ti_wilink_st.h> 26 27 27 28 /**********************************************************************/ ··· 38 37 39 38 static void ll_device_want_to_sleep(struct st_data_s *st_data) 40 39 { 40 + struct kim_data_s *kim_data; 41 + struct ti_st_plat_data *pdata; 42 + 41 43 pr_debug("%s", __func__); 42 44 /* sanity check */ 43 45 if (st_data->ll_state != ST_LL_AWAKE) ··· 50 46 send_ll_cmd(st_data, LL_SLEEP_ACK); 51 47 /* update state */ 52 48 st_data->ll_state = ST_LL_ASLEEP; 49 + 50 + /* communicate to platform about chip asleep */ 51 + kim_data = st_data->kim_data; 52 + pdata = kim_data->kim_pdev->dev.platform_data; 53 + if (pdata->chip_asleep) 54 + pdata->chip_asleep(NULL); 53 55 } 54 56 55 57 static void ll_device_want_to_wakeup(struct st_data_s *st_data) 56 58 { 59 + struct kim_data_s *kim_data; 60 + struct ti_st_plat_data *pdata; 61 + 57 62 /* diff actions in diff states */ 58 63 switch (st_data->ll_state) { 59 64 case ST_LL_ASLEEP: ··· 83 70 } 84 71 /* update state */ 85 72 st_data->ll_state = ST_LL_AWAKE; 73 + 74 + /* communicate to platform about chip wakeup */ 75 + kim_data = st_data->kim_data; 76 + pdata = kim_data->kim_pdev->dev.platform_data; 77 + if (pdata->chip_asleep) 78 + pdata->chip_awake(NULL); 86 79 } 87 80 88 81 /**********************************************************************/