diff options
author | Pavan Savoy <pavan_savoy@ti.com> | 2011-02-04 03:23:15 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-02-04 15:41:21 -0500 |
commit | 781a7395d239dbdb59738ca7fe08e71641bf583c (patch) | |
tree | fb57da5401614e1b727457b78c7582327be61265 | |
parent | 6d71ba2105a1d8c1712cdfcf46fc6040e4707cb9 (diff) |
drivers:misc: ti-st: remove multiple gpio handling
TI shared transport driver previously intended to expose rfkill
entries for each of the protocol gpio that the chip would have.
However now in case such gpios exist, which requires to be enabled
for a specific protocol, the responsibility lay on protocol driver.
This patch removes the request/free of multiple gpios, rfkill struct
references and also removes the chip_toggle function.
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/misc/ti-st/st_core.c | 11 | ||||
-rw-r--r-- | drivers/misc/ti-st/st_kim.c | 117 | ||||
-rw-r--r-- | include/linux/ti_wilink_st.h | 19 |
3 files changed, 26 insertions, 121 deletions
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index f0d24d852078..1847c477c0c0 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c | |||
@@ -515,7 +515,6 @@ long st_register(struct st_proto_s *new_proto) | |||
515 | if (test_bit(ST_REG_IN_PROGRESS, &st_gdata->st_state)) { | 515 | if (test_bit(ST_REG_IN_PROGRESS, &st_gdata->st_state)) { |
516 | pr_info(" ST_REG_IN_PROGRESS:%d ", new_proto->chnl_id); | 516 | pr_info(" ST_REG_IN_PROGRESS:%d ", new_proto->chnl_id); |
517 | /* fw download in progress */ | 517 | /* fw download in progress */ |
518 | st_kim_chip_toggle(new_proto->chnl_id, KIM_GPIO_ACTIVE); | ||
519 | 518 | ||
520 | add_channel_to_table(st_gdata, new_proto); | 519 | add_channel_to_table(st_gdata, new_proto); |
521 | st_gdata->protos_registered++; | 520 | st_gdata->protos_registered++; |
@@ -548,10 +547,6 @@ long st_register(struct st_proto_s *new_proto) | |||
548 | return -EINVAL; | 547 | return -EINVAL; |
549 | } | 548 | } |
550 | 549 | ||
551 | /* the chnl_id might require other gpios to be toggled | ||
552 | */ | ||
553 | st_kim_chip_toggle(new_proto->chnl_id, KIM_GPIO_ACTIVE); | ||
554 | |||
555 | clear_bit(ST_REG_IN_PROGRESS, &st_gdata->st_state); | 550 | clear_bit(ST_REG_IN_PROGRESS, &st_gdata->st_state); |
556 | st_recv = st_int_recv; | 551 | st_recv = st_int_recv; |
557 | 552 | ||
@@ -622,12 +617,6 @@ long st_unregister(struct st_proto_s *proto) | |||
622 | 617 | ||
623 | st_gdata->protos_registered--; | 618 | st_gdata->protos_registered--; |
624 | remove_channel_from_table(st_gdata, proto); | 619 | remove_channel_from_table(st_gdata, proto); |
625 | |||
626 | /* kim ignores BT in the below function | ||
627 | * and handles the rest, BT is toggled | ||
628 | * only in kim_start and kim_stop | ||
629 | */ | ||
630 | st_kim_chip_toggle(proto->chnl_id, KIM_GPIO_INACTIVE); | ||
631 | spin_unlock_irqrestore(&st_gdata->lock, flags); | 620 | spin_unlock_irqrestore(&st_gdata->lock, flags); |
632 | 621 | ||
633 | if ((st_gdata->protos_registered == ST_EMPTY) && | 622 | if ((st_gdata->protos_registered == ST_EMPTY) && |
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index 2c096ccd53b0..9ee4c788aa69 100644 --- a/drivers/misc/ti-st/st_kim.c +++ b/drivers/misc/ti-st/st_kim.c | |||
@@ -390,49 +390,6 @@ static long download_firmware(struct kim_data_s *kim_gdata) | |||
390 | 390 | ||
391 | /**********************************************************************/ | 391 | /**********************************************************************/ |
392 | /* functions called from ST core */ | 392 | /* functions called from ST core */ |
393 | /* function to toggle the GPIO | ||
394 | * needs to know whether the GPIO is active high or active low | ||
395 | */ | ||
396 | void st_kim_chip_toggle(enum proto_type type, enum kim_gpio_state state) | ||
397 | { | ||
398 | struct platform_device *kim_pdev; | ||
399 | struct kim_data_s *kim_gdata; | ||
400 | pr_info(" %s ", __func__); | ||
401 | |||
402 | kim_pdev = st_get_plat_device(0); | ||
403 | kim_gdata = dev_get_drvdata(&kim_pdev->dev); | ||
404 | |||
405 | if (kim_gdata->gpios[type] == -1) { | ||
406 | pr_info("gpio not requested for protocol %d", type); | ||
407 | return; | ||
408 | } | ||
409 | switch (type) { | ||
410 | case ST_BT: | ||
411 | /*Do Nothing */ | ||
412 | break; | ||
413 | |||
414 | case ST_FM: | ||
415 | if (state == KIM_GPIO_ACTIVE) | ||
416 | gpio_set_value(kim_gdata->gpios[ST_FM], GPIO_LOW); | ||
417 | else | ||
418 | gpio_set_value(kim_gdata->gpios[ST_FM], GPIO_HIGH); | ||
419 | break; | ||
420 | |||
421 | case ST_GPS: | ||
422 | if (state == KIM_GPIO_ACTIVE) | ||
423 | gpio_set_value(kim_gdata->gpios[ST_GPS], GPIO_HIGH); | ||
424 | else | ||
425 | gpio_set_value(kim_gdata->gpios[ST_GPS], GPIO_LOW); | ||
426 | break; | ||
427 | |||
428 | case ST_MAX_CHANNELS: | ||
429 | default: | ||
430 | break; | ||
431 | } | ||
432 | |||
433 | return; | ||
434 | } | ||
435 | |||
436 | /* called from ST Core, when REG_IN_PROGRESS (registration in progress) | 393 | /* called from ST Core, when REG_IN_PROGRESS (registration in progress) |
437 | * can be because of | 394 | * can be because of |
438 | * 1. response to read local version | 395 | * 1. response to read local version |
@@ -482,9 +439,9 @@ long st_kim_start(void *kim_data) | |||
482 | 439 | ||
483 | do { | 440 | do { |
484 | /* Configure BT nShutdown to HIGH state */ | 441 | /* Configure BT nShutdown to HIGH state */ |
485 | gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_LOW); | 442 | gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); |
486 | mdelay(5); /* FIXME: a proper toggle */ | 443 | mdelay(5); /* FIXME: a proper toggle */ |
487 | gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_HIGH); | 444 | gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH); |
488 | mdelay(100); | 445 | mdelay(100); |
489 | /* re-initialize the completion */ | 446 | /* re-initialize the completion */ |
490 | INIT_COMPLETION(kim_gdata->ldisc_installed); | 447 | INIT_COMPLETION(kim_gdata->ldisc_installed); |
@@ -552,11 +509,11 @@ long st_kim_stop(void *kim_data) | |||
552 | } | 509 | } |
553 | 510 | ||
554 | /* By default configure BT nShutdown to LOW state */ | 511 | /* By default configure BT nShutdown to LOW state */ |
555 | gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_LOW); | 512 | gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); |
556 | mdelay(1); | 513 | mdelay(1); |
557 | gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_HIGH); | 514 | gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH); |
558 | mdelay(1); | 515 | mdelay(1); |
559 | gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_LOW); | 516 | gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); |
560 | return err; | 517 | return err; |
561 | } | 518 | } |
562 | 519 | ||
@@ -685,10 +642,8 @@ struct dentry *kim_debugfs_dir; | |||
685 | static int kim_probe(struct platform_device *pdev) | 642 | static int kim_probe(struct platform_device *pdev) |
686 | { | 643 | { |
687 | long status; | 644 | long status; |
688 | long proto; | ||
689 | struct kim_data_s *kim_gdata; | 645 | struct kim_data_s *kim_gdata; |
690 | struct ti_st_plat_data *pdata = pdev->dev.platform_data; | 646 | struct ti_st_plat_data *pdata = pdev->dev.platform_data; |
691 | long *gpios = pdata->gpios; | ||
692 | 647 | ||
693 | if ((pdev->id != -1) && (pdev->id < MAX_ST_DEVICES)) { | 648 | if ((pdev->id != -1) && (pdev->id < MAX_ST_DEVICES)) { |
694 | /* multiple devices could exist */ | 649 | /* multiple devices could exist */ |
@@ -713,40 +668,19 @@ static int kim_probe(struct platform_device *pdev) | |||
713 | /* refer to itself */ | 668 | /* refer to itself */ |
714 | kim_gdata->core_data->kim_data = kim_gdata; | 669 | kim_gdata->core_data->kim_data = kim_gdata; |
715 | 670 | ||
716 | for (proto = 0; proto < ST_MAX_CHANNELS; proto++) { | 671 | /* Claim the chip enable nShutdown gpio from the system */ |
717 | kim_gdata->gpios[proto] = gpios[proto]; | 672 | kim_gdata->nshutdown = pdata->nshutdown_gpio; |
718 | pr_info(" %ld gpio to be requested", gpios[proto]); | 673 | status = gpio_request(kim_gdata->nshutdown, "kim"); |
674 | if (unlikely(status)) { | ||
675 | pr_err(" gpio %ld request failed ", kim_gdata->nshutdown); | ||
676 | return status; | ||
719 | } | 677 | } |
720 | 678 | ||
721 | for (proto = 0; (proto < ST_MAX_CHANNELS) | 679 | /* Configure nShutdown GPIO as output=0 */ |
722 | && (gpios[proto] != -1); proto++) { | 680 | status = gpio_direction_output(kim_gdata->nshutdown, 0); |
723 | /* Claim the Bluetooth/FM/GPIO | 681 | if (unlikely(status)) { |
724 | * nShutdown gpio from the system | 682 | pr_err(" unable to configure gpio %ld", kim_gdata->nshutdown); |
725 | */ | 683 | return status; |
726 | status = gpio_request(gpios[proto], "kim"); | ||
727 | if (unlikely(status)) { | ||
728 | pr_err(" gpio %ld request failed ", gpios[proto]); | ||
729 | proto -= 1; | ||
730 | while (proto >= 0) { | ||
731 | if (gpios[proto] != -1) | ||
732 | gpio_free(gpios[proto]); | ||
733 | } | ||
734 | return status; | ||
735 | } | ||
736 | |||
737 | /* Configure nShutdown GPIO as output=0 */ | ||
738 | status = | ||
739 | gpio_direction_output(gpios[proto], 0); | ||
740 | if (unlikely(status)) { | ||
741 | pr_err(" unable to configure gpio %ld", | ||
742 | gpios[proto]); | ||
743 | proto -= 1; | ||
744 | while (proto >= 0) { | ||
745 | if (gpios[proto] != -1) | ||
746 | gpio_free(gpios[proto]); | ||
747 | } | ||
748 | return status; | ||
749 | } | ||
750 | } | 684 | } |
751 | /* get reference of pdev for request_firmware | 685 | /* get reference of pdev for request_firmware |
752 | */ | 686 | */ |
@@ -785,23 +719,20 @@ static int kim_remove(struct platform_device *pdev) | |||
785 | { | 719 | { |
786 | /* free the GPIOs requested */ | 720 | /* free the GPIOs requested */ |
787 | struct ti_st_plat_data *pdata = pdev->dev.platform_data; | 721 | struct ti_st_plat_data *pdata = pdev->dev.platform_data; |
788 | long *gpios = pdata->gpios; | ||
789 | long proto; | ||
790 | struct kim_data_s *kim_gdata; | 722 | struct kim_data_s *kim_gdata; |
791 | 723 | ||
792 | kim_gdata = dev_get_drvdata(&pdev->dev); | 724 | kim_gdata = dev_get_drvdata(&pdev->dev); |
793 | 725 | ||
794 | for (proto = 0; (proto < ST_MAX_CHANNELS) | 726 | /* Free the Bluetooth/FM/GPIO |
795 | && (gpios[proto] != -1); proto++) { | 727 | * nShutdown gpio from the system |
796 | /* Claim the Bluetooth/FM/GPIO | 728 | */ |
797 | * nShutdown gpio from the system | 729 | gpio_free(pdata->nshutdown_gpio); |
798 | */ | 730 | pr_info("nshutdown GPIO Freed"); |
799 | gpio_free(gpios[proto]); | ||
800 | } | ||
801 | pr_info("kim: GPIO Freed"); | ||
802 | debugfs_remove_recursive(kim_debugfs_dir); | ||
803 | 731 | ||
732 | debugfs_remove_recursive(kim_debugfs_dir); | ||
804 | sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp); | 733 | sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp); |
734 | pr_info("sysfs entries removed"); | ||
735 | |||
805 | kim_gdata->kim_pdev = NULL; | 736 | kim_gdata->kim_pdev = NULL; |
806 | st_core_exit(kim_gdata->core_data); | 737 | st_core_exit(kim_gdata->core_data); |
807 | 738 | ||
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h index 7885a779c588..7071ec5d0118 100644 --- a/include/linux/ti_wilink_st.h +++ b/include/linux/ti_wilink_st.h | |||
@@ -26,15 +26,6 @@ | |||
26 | #define TI_WILINK_ST_H | 26 | #define TI_WILINK_ST_H |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * enum kim_gpio_state - Few protocols such as FM have ACTIVE LOW | ||
30 | * gpio states for their chip/core enable gpios | ||
31 | */ | ||
32 | enum kim_gpio_state { | ||
33 | KIM_GPIO_INACTIVE, | ||
34 | KIM_GPIO_ACTIVE, | ||
35 | }; | ||
36 | |||
37 | /** | ||
38 | * enum proto-type - The protocol on WiLink chips which share a | 29 | * enum proto-type - The protocol on WiLink chips which share a |
39 | * common physical interface like UART. | 30 | * common physical interface like UART. |
40 | */ | 31 | */ |
@@ -252,14 +243,11 @@ struct chip_version { | |||
252 | * the ldisc was properly installed. | 243 | * the ldisc was properly installed. |
253 | * @resp_buffer: data buffer for the .bts fw file name. | 244 | * @resp_buffer: data buffer for the .bts fw file name. |
254 | * @fw_entry: firmware class struct to request/release the fw. | 245 | * @fw_entry: firmware class struct to request/release the fw. |
255 | * @gpios: the list of core/chip enable gpios for BT, FM and GPS cores. | ||
256 | * @rx_state: the rx state for kim's receive func during fw download. | 246 | * @rx_state: the rx state for kim's receive func during fw download. |
257 | * @rx_count: the rx count for the kim's receive func during fw download. | 247 | * @rx_count: the rx count for the kim's receive func during fw download. |
258 | * @rx_skb: all of fw data might not come at once, and hence data storage for | 248 | * @rx_skb: all of fw data might not come at once, and hence data storage for |
259 | * whole of the fw response, only HCI_EVENTs and hence diff from ST's | 249 | * whole of the fw response, only HCI_EVENTs and hence diff from ST's |
260 | * response. | 250 | * response. |
261 | * @rfkill: rfkill data for each of the cores to be registered with rfkill. | ||
262 | * @rf_protos: proto types of the data registered with rfkill sub-system. | ||
263 | * @core_data: ST core's data, which mainly is the tty's disc_data | 251 | * @core_data: ST core's data, which mainly is the tty's disc_data |
264 | * @version: chip version available via a sysfs entry. | 252 | * @version: chip version available via a sysfs entry. |
265 | * | 253 | * |
@@ -270,12 +258,10 @@ struct kim_data_s { | |||
270 | struct completion kim_rcvd, ldisc_installed; | 258 | struct completion kim_rcvd, ldisc_installed; |
271 | char resp_buffer[30]; | 259 | char resp_buffer[30]; |
272 | const struct firmware *fw_entry; | 260 | const struct firmware *fw_entry; |
273 | long gpios[ST_MAX_CHANNELS]; | 261 | long nshutdown; |
274 | unsigned long rx_state; | 262 | unsigned long rx_state; |
275 | unsigned long rx_count; | 263 | unsigned long rx_count; |
276 | struct sk_buff *rx_skb; | 264 | struct sk_buff *rx_skb; |
277 | struct rfkill *rfkill[ST_MAX_CHANNELS]; | ||
278 | enum proto_type rf_protos[ST_MAX_CHANNELS]; | ||
279 | struct st_data_s *core_data; | 265 | struct st_data_s *core_data; |
280 | struct chip_version version; | 266 | struct chip_version version; |
281 | unsigned char ldisc_install; | 267 | unsigned char ldisc_install; |
@@ -293,7 +279,6 @@ long st_kim_start(void *); | |||
293 | long st_kim_stop(void *); | 279 | long st_kim_stop(void *); |
294 | 280 | ||
295 | void st_kim_recv(void *, const unsigned char *, long count); | 281 | void st_kim_recv(void *, const unsigned char *, long count); |
296 | void st_kim_chip_toggle(enum proto_type, enum kim_gpio_state); | ||
297 | void st_kim_complete(void *); | 282 | void st_kim_complete(void *); |
298 | void kim_st_list_protocols(struct st_data_s *, void *); | 283 | void kim_st_list_protocols(struct st_data_s *, void *); |
299 | 284 | ||
@@ -426,7 +411,7 @@ struct gps_event_hdr { | |||
426 | 411 | ||
427 | /* platform data */ | 412 | /* platform data */ |
428 | struct ti_st_plat_data { | 413 | struct ti_st_plat_data { |
429 | long gpios[ST_MAX_CHANNELS]; /* BT, FM and GPS */ | 414 | long nshutdown_gpio; |
430 | unsigned char dev_name[UART_DEV_NAME_LEN]; /* uart name */ | 415 | unsigned char dev_name[UART_DEV_NAME_LEN]; /* uart name */ |
431 | unsigned char flow_cntrl; /* flow control flag */ | 416 | unsigned char flow_cntrl; /* flow control flag */ |
432 | unsigned long baud_rate; | 417 | unsigned long baud_rate; |