aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2008-05-27 01:37:19 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-05-27 01:37:19 -0400
commit5de4cd431db749bdca58ec88862462729f6159b2 (patch)
tree86a4d81c487645e3bdb87c0ee31cf3ba62c9dc7e /drivers/input
parentef9db4929a4d9559abf1812fd89cc3b09c56b49b (diff)
Input: wm97xx-core - fix race on PHY init
The chip phy_init() function must be called before the dig_enable() function but dig_enable() is called when the device is opened and we only call phy_init() after having reigstered the device, meaning the two can race. Fix this by doing the phy_init() before we register the input device. Thanks to Rodolfo Giometti <giometti@enneenne.com> for the report. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/wm97xx-core.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c
index 8a00918cfa46..cdc24ad314e0 100644
--- a/drivers/input/touchscreen/wm97xx-core.c
+++ b/drivers/input/touchscreen/wm97xx-core.c
@@ -608,6 +608,17 @@ static int wm97xx_probe(struct device *dev)
608 goto alloc_err; 608 goto alloc_err;
609 } 609 }
610 610
611 /* set up physical characteristics */
612 wm->codec->phy_init(wm);
613
614 /* load gpio cache */
615 wm->gpio[0] = wm97xx_reg_read(wm, AC97_GPIO_CFG);
616 wm->gpio[1] = wm97xx_reg_read(wm, AC97_GPIO_POLARITY);
617 wm->gpio[2] = wm97xx_reg_read(wm, AC97_GPIO_STICKY);
618 wm->gpio[3] = wm97xx_reg_read(wm, AC97_GPIO_WAKEUP);
619 wm->gpio[4] = wm97xx_reg_read(wm, AC97_GPIO_STATUS);
620 wm->gpio[5] = wm97xx_reg_read(wm, AC97_MISC_AFE);
621
611 wm->input_dev = input_allocate_device(); 622 wm->input_dev = input_allocate_device();
612 if (wm->input_dev == NULL) { 623 if (wm->input_dev == NULL) {
613 ret = -ENOMEM; 624 ret = -ENOMEM;
@@ -635,17 +646,6 @@ static int wm97xx_probe(struct device *dev)
635 if (ret < 0) 646 if (ret < 0)
636 goto dev_alloc_err; 647 goto dev_alloc_err;
637 648
638 /* set up physical characteristics */
639 wm->codec->phy_init(wm);
640
641 /* load gpio cache */
642 wm->gpio[0] = wm97xx_reg_read(wm, AC97_GPIO_CFG);
643 wm->gpio[1] = wm97xx_reg_read(wm, AC97_GPIO_POLARITY);
644 wm->gpio[2] = wm97xx_reg_read(wm, AC97_GPIO_STICKY);
645 wm->gpio[3] = wm97xx_reg_read(wm, AC97_GPIO_WAKEUP);
646 wm->gpio[4] = wm97xx_reg_read(wm, AC97_GPIO_STATUS);
647 wm->gpio[5] = wm97xx_reg_read(wm, AC97_MISC_AFE);
648
649 /* register our battery device */ 649 /* register our battery device */
650 wm->battery_dev = platform_device_alloc("wm97xx-battery", -1); 650 wm->battery_dev = platform_device_alloc("wm97xx-battery", -1);
651 if (!wm->battery_dev) { 651 if (!wm->battery_dev) {