Skip to contentSkip to conversation

ASOC: wm8962: add some operation in wm8962_runtime_resume()

PATCH Mark Brown 1 participant 1 message Jan 29, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Mark Brown

author
#1 lore raw
Quoted 4 lines · Gary Zhang

1. in this function, after wm8962_reset() is called, WM8962_SYSCLK_ENA bit is reset to 1. make sure it is off so we can safely write to registers if the device is declocked.
2. add bias level management

Split separate changes into separate patches; obviously there's bias level management in the driver since otherwise it'd be totally non-functional.

Review static int wm8962_runtime_resume(struct device *dev) · line 3726

Quoted 7 lines
(quoted diff) +3 -0
@@ -3721,6 +3721,24 @@ static int wm8962_runtime_resume(struct device *dev)
 
 	regcache_sync(wm8962->regmap);
 
+	regmap_update_bits(wm8962->regmap, WM8962_CLOCKING2,
+				WM8962_SYSCLK_ENA, 0);
+

This seems like a bodge to work around some other problem in your system. The device should never be runtime suspended with an active clock, and this seems like it isn't going to work as most of the register cache restore will be done with SYSCLK enabled. We need to figure out what went wrong to allow the device to enter runtime suspend with SYSCLK on.

Quoted 4 lines
(quoted diff) +4 -0
+	regmap_update_bits(wm8962->regmap, WM8962_ANTI_POP,
+				WM8962_STARTUP_BIAS_ENA | WM8962_VMID_BUF_ENA,
+				WM8962_STARTUP_BIAS_ENA | WM8962_VMID_BUF_ENA);
+

Review static int wm8962_runtime_resume(struct device *dev) · line 3740

Quoted 10 lines
(quoted diff) +10 -0
+	/* Bias enable at 2*50k for ramp */
+	regmap_update_bits(wm8962->regmap, WM8962_PWR_MGMT_1,
+				WM8962_VMID_SEL_MASK | WM8962_BIAS_ENA,
+				WM8962_BIAS_ENA | 0x180);
+
+	msleep(5);
+
+	/* VMID back to 2x250k for standby */
+	regmap_update_bits(wm8962->regmap, WM8962_PWR_MGMT_1,
+				WM8962_VMID_SEL_MASK, 0x100);

We already have code to ramp VMID when exiting _OFF...