Skip to content

Commit e463480

Browse files
committed
ASoC: wm8991: Move basic initialisation to I2C level probe
This is better practice, though some of this stuff ought not to be here at all. Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
1 parent a86652e commit e463480

1 file changed

Lines changed: 25 additions & 25 deletions

File tree

‎sound/soc/codecs/wm8991.c‎

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ static bool wm8991_volatile(struct device *dev, unsigned int reg)
111111
}
112112
}
113113

114-
#define wm8991_reset(c) snd_soc_write(c, WM8991_RESET, 0)
115-
116114
static const unsigned int rec_mix_tlv[] = {
117115
TLV_DB_RANGE_HEAD(1),
118116
0, 7, TLV_DB_LINEAR_ITEM(-1500, 600),
@@ -1264,31 +1262,8 @@ static int wm8991_probe(struct snd_soc_codec *codec)
12641262
return ret;
12651263
}
12661264

1267-
ret = wm8991_reset(codec);
1268-
if (ret < 0) {
1269-
dev_err(codec->dev, "Failed to issue reset\n");
1270-
return ret;
1271-
}
1272-
12731265
wm8991_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
12741266

1275-
snd_soc_update_bits(codec, WM8991_AUDIO_INTERFACE_4,
1276-
WM8991_ALRCGPIO1, WM8991_ALRCGPIO1);
1277-
1278-
snd_soc_update_bits(codec, WM8991_GPIO1_GPIO2,
1279-
WM8991_GPIO1_SEL_MASK, 1);
1280-
1281-
snd_soc_update_bits(codec, WM8991_POWER_MANAGEMENT_1,
1282-
WM8991_VREF_ENA | WM8991_VMID_MODE_MASK,
1283-
WM8991_VREF_ENA | WM8991_VMID_MODE_MASK);
1284-
1285-
snd_soc_update_bits(codec, WM8991_POWER_MANAGEMENT_2,
1286-
WM8991_OPCLK_ENA, WM8991_OPCLK_ENA);
1287-
1288-
snd_soc_write(codec, WM8991_DAC_CTRL, 0);
1289-
snd_soc_write(codec, WM8991_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8));
1290-
snd_soc_write(codec, WM8991_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8));
1291-
12921267
return 0;
12931268
}
12941269

@@ -1372,6 +1347,31 @@ static int wm8991_i2c_probe(struct i2c_client *i2c,
13721347

13731348
i2c_set_clientdata(i2c, wm8991);
13741349

1350+
ret = regmap_write(wm8991->regmap, WM8991_RESET, 0);
1351+
if (ret < 0) {
1352+
dev_err(&i2c->dev, "Failed to issue reset: %d\n", ret);
1353+
return ret;
1354+
}
1355+
1356+
regmap_update_bits(wm8991->regmap, WM8991_AUDIO_INTERFACE_4,
1357+
WM8991_ALRCGPIO1, WM8991_ALRCGPIO1);
1358+
1359+
regmap_update_bits(wm8991->regmap, WM8991_GPIO1_GPIO2,
1360+
WM8991_GPIO1_SEL_MASK, 1);
1361+
1362+
regmap_update_bits(wm8991->regmap, WM8991_POWER_MANAGEMENT_1,
1363+
WM8991_VREF_ENA | WM8991_VMID_MODE_MASK,
1364+
WM8991_VREF_ENA | WM8991_VMID_MODE_MASK);
1365+
1366+
regmap_update_bits(wm8991->regmap, WM8991_POWER_MANAGEMENT_2,
1367+
WM8991_OPCLK_ENA, WM8991_OPCLK_ENA);
1368+
1369+
regmap_write(wm8991->regmap, WM8991_DAC_CTRL, 0);
1370+
regmap_write(wm8991->regmap, WM8991_LEFT_OUTPUT_VOLUME,
1371+
0x50 | (1<<8));
1372+
regmap_write(wm8991->regmap, WM8991_RIGHT_OUTPUT_VOLUME,
1373+
0x50 | (1<<8));
1374+
13751375
ret = snd_soc_register_codec(&i2c->dev,
13761376
&soc_codec_dev_wm8991, &wm8991_dai, 1);
13771377

0 commit comments

Comments
 (0)