aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Dunn <mikedunn@newsguy.com>2013-01-07 16:55:13 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-08 06:27:35 -0500
commit3b4bc7bccc7857274705b05cf81a0c72cfd0b0dd (patch)
treef7369b4d829bad786dff482f6cc369073373cf4a
parent41b645c8624df6ace020a8863ad1449d69140f7d (diff)
ALSA: pxa27x: fix ac97 warm reset
This patch fixes some code that implements a work-around to a hardware bug in the ac97 controller on the pxa27x. A bug in the controller's warm reset functionality requires that the mfp used by the controller as the AC97_nRESET line be temporarily reconfigured as a generic output gpio (AF0) and manually held high for the duration of the warm reset cycle. This is what was done in the original code, but it was broken long ago by commit fb1bf8cd ([ARM] pxa: introduce processor specific pxa27x_assert_ac97reset()) which changed the mfp to a GPIO input instead of a high output. The fix requires the ac97 controller to obtain the gpio via gpio_request_one(), with arguments that configure the gpio as an output initially driven high. Tested on a palm treo 680 machine. Reportedly, this broken code only prevents a warm reset on hardware that lacks a pull-up on the line, which appears to be the case for me. Signed-off-by: Mike Dunn <mikedunn@newsguy.com> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@vger.kernel.org
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa27x.h3
-rw-r--r--arch/arm/mach-pxa/pxa27x.c4
-rw-r--r--sound/arm/pxa2xx-ac97-lib.c18
3 files changed, 22 insertions, 3 deletions
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
index a611ad3153c..b6132aa95dc 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
@@ -463,6 +463,9 @@
463 GPIO76_LCD_PCLK, \ 463 GPIO76_LCD_PCLK, \
464 GPIO77_LCD_BIAS 464 GPIO77_LCD_BIAS
465 465
466/* these enable a work-around for a hw bug in pxa27x during ac97 warm reset */
467#define GPIO113_AC97_nRESET_GPIO_HIGH MFP_CFG_OUT(GPIO113, AF0, DEFAULT)
468#define GPIO95_AC97_nRESET_GPIO_HIGH MFP_CFG_OUT(GPIO95, AF0, DEFAULT)
466 469
467extern int keypad_set_wake(unsigned int on); 470extern int keypad_set_wake(unsigned int on);
468#endif /* __ASM_ARCH_MFP_PXA27X_H */ 471#endif /* __ASM_ARCH_MFP_PXA27X_H */
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 8047ee0effc..616cb87b617 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -47,9 +47,9 @@ void pxa27x_clear_otgph(void)
47EXPORT_SYMBOL(pxa27x_clear_otgph); 47EXPORT_SYMBOL(pxa27x_clear_otgph);
48 48
49static unsigned long ac97_reset_config[] = { 49static unsigned long ac97_reset_config[] = {
50 GPIO113_GPIO, 50 GPIO113_AC97_nRESET_GPIO_HIGH,
51 GPIO113_AC97_nRESET, 51 GPIO113_AC97_nRESET,
52 GPIO95_GPIO, 52 GPIO95_AC97_nRESET_GPIO_HIGH,
53 GPIO95_AC97_nRESET, 53 GPIO95_AC97_nRESET,
54}; 54};
55 55
diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c
index 1ecd0a66ecd..fff7753e35c 100644
--- a/sound/arm/pxa2xx-ac97-lib.c
+++ b/sound/arm/pxa2xx-ac97-lib.c
@@ -18,6 +18,7 @@
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/gpio.h>
21 22
22#include <sound/ac97_codec.h> 23#include <sound/ac97_codec.h>
23#include <sound/pxa2xx-lib.h> 24#include <sound/pxa2xx-lib.h>
@@ -344,8 +345,21 @@ int pxa2xx_ac97_hw_probe(struct platform_device *dev)
344 } 345 }
345 346
346 if (cpu_is_pxa27x()) { 347 if (cpu_is_pxa27x()) {
347 /* Use GPIO 113 as AC97 Reset on Bulverde */ 348 /*
349 * This gpio is needed for a work-around to a bug in the ac97
350 * controller during warm reset. The direction and level is set
351 * here so that it is an output driven high when switching from
352 * AC97_nRESET alt function to generic gpio.
353 */
354 ret = gpio_request_one(reset_gpio, GPIOF_OUT_INIT_HIGH,
355 "pxa27x ac97 reset");
356 if (ret < 0) {
357 pr_err("%s: gpio_request_one() failed: %d\n",
358 __func__, ret);
359 goto err_conf;
360 }
348 pxa27x_assert_ac97reset(reset_gpio, 0); 361 pxa27x_assert_ac97reset(reset_gpio, 0);
362
349 ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK"); 363 ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK");
350 if (IS_ERR(ac97conf_clk)) { 364 if (IS_ERR(ac97conf_clk)) {
351 ret = PTR_ERR(ac97conf_clk); 365 ret = PTR_ERR(ac97conf_clk);
@@ -388,6 +402,8 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_probe);
388 402
389void pxa2xx_ac97_hw_remove(struct platform_device *dev) 403void pxa2xx_ac97_hw_remove(struct platform_device *dev)
390{ 404{
405 if (cpu_is_pxa27x())
406 gpio_free(reset_gpio);
391 GCR |= GCR_ACLINK_OFF; 407 GCR |= GCR_ACLINK_OFF;
392 free_irq(IRQ_AC97, NULL); 408 free_irq(IRQ_AC97, NULL);
393 if (ac97conf_clk) { 409 if (ac97conf_clk) {