Skip to content

Commit ae763db

Browse files
committed
Merge tag 'char-misc-3.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull drivers/misc fix from Greg Kroah-Hartman: "Here is a single revert for the ti-st misc driver, fixing problem that was introduced in 3.7-rc1 that has been bothering people." * tag 'char-misc-3.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: Revert "drivers/misc/ti-st: remove gpio handling"
2 parents 6f48ea5 + a7e2ca1 commit ae763db

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

drivers/misc/ti-st/st_kim.c

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,11 @@ long st_kim_start(void *kim_data)
468468
if (pdata->chip_enable)
469469
pdata->chip_enable(kim_gdata);
470470

471+
/* Configure BT nShutdown to HIGH state */
472+
gpio_set_value(kim_gdata->nshutdown, GPIO_LOW);
473+
mdelay(5); /* FIXME: a proper toggle */
474+
gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH);
475+
mdelay(100);
471476
/* re-initialize the completion */
472477
INIT_COMPLETION(kim_gdata->ldisc_installed);
473478
/* send notification to UIM */
@@ -509,7 +514,8 @@ long st_kim_start(void *kim_data)
509514
* (b) upon failure to either install ldisc or download firmware.
510515
* The function is responsible to (a) notify UIM about un-installation,
511516
* (b) flush UART if the ldisc was installed.
512-
* (c) invoke platform's chip disabling routine.
517+
* (c) reset BT_EN - pull down nshutdown at the end.
518+
* (d) invoke platform's chip disabling routine.
513519
*/
514520
long st_kim_stop(void *kim_data)
515521
{
@@ -541,6 +547,13 @@ long st_kim_stop(void *kim_data)
541547
err = -ETIMEDOUT;
542548
}
543549

550+
/* By default configure BT nShutdown to LOW state */
551+
gpio_set_value(kim_gdata->nshutdown, GPIO_LOW);
552+
mdelay(1);
553+
gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH);
554+
mdelay(1);
555+
gpio_set_value(kim_gdata->nshutdown, GPIO_LOW);
556+
544557
/* platform specific disable */
545558
if (pdata->chip_disable)
546559
pdata->chip_disable(kim_gdata);
@@ -733,6 +746,20 @@ static int kim_probe(struct platform_device *pdev)
733746
/* refer to itself */
734747
kim_gdata->core_data->kim_data = kim_gdata;
735748

749+
/* Claim the chip enable nShutdown gpio from the system */
750+
kim_gdata->nshutdown = pdata->nshutdown_gpio;
751+
err = gpio_request(kim_gdata->nshutdown, "kim");
752+
if (unlikely(err)) {
753+
pr_err(" gpio %ld request failed ", kim_gdata->nshutdown);
754+
return err;
755+
}
756+
757+
/* Configure nShutdown GPIO as output=0 */
758+
err = gpio_direction_output(kim_gdata->nshutdown, 0);
759+
if (unlikely(err)) {
760+
pr_err(" unable to configure gpio %ld", kim_gdata->nshutdown);
761+
return err;
762+
}
736763
/* get reference of pdev for request_firmware
737764
*/
738765
kim_gdata->kim_pdev = pdev;
@@ -779,10 +806,18 @@ static int kim_probe(struct platform_device *pdev)
779806

780807
static int kim_remove(struct platform_device *pdev)
781808
{
809+
/* free the GPIOs requested */
810+
struct ti_st_plat_data *pdata = pdev->dev.platform_data;
782811
struct kim_data_s *kim_gdata;
783812

784813
kim_gdata = dev_get_drvdata(&pdev->dev);
785814

815+
/* Free the Bluetooth/FM/GPIO
816+
* nShutdown gpio from the system
817+
*/
818+
gpio_free(pdata->nshutdown_gpio);
819+
pr_info("nshutdown GPIO Freed");
820+
786821
debugfs_remove_recursive(kim_debugfs_dir);
787822
sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp);
788823
pr_info("sysfs entries removed");

0 commit comments

Comments
 (0)