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 /drivers/misc/ti-st | |
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>
Diffstat (limited to 'drivers/misc/ti-st')
-rw-r--r-- | drivers/misc/ti-st/st_core.c | 11 | ||||
-rw-r--r-- | drivers/misc/ti-st/st_kim.c | 117 |
2 files changed, 24 insertions, 104 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 | ||