Skip to content

Commit f219b16

Browse files
ericnelsonazbroonie
authored andcommitted
ASoC: sgtl5000: Write all default registers
If an error occurs writing defaults, produce an error message but continue writing other registers. The failure of a single write should not cause catastrophic device failure. In at least one occurrence, I2C writes of CHIP_ANA_POWER were nacked, though continuing allowed the device to operate properly. Signed-off-by: Eric Nelson <[email protected]> Signed-off-by: Clemens Gruber <[email protected]> Tested-by: Fabio Estevam <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 940adb2 commit f219b16

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

sound/soc/codecs/sgtl5000.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,19 +1219,20 @@ static const struct regmap_config sgtl5000_regmap = {
12191219
* and avoid problems like, not being able to probe after an audio playback
12201220
* followed by a system reset or a 'reboot' command in Linux
12211221
*/
1222-
static int sgtl5000_fill_defaults(struct sgtl5000_priv *sgtl5000)
1222+
static void sgtl5000_fill_defaults(struct i2c_client *client)
12231223
{
1224+
struct sgtl5000_priv *sgtl5000 = i2c_get_clientdata(client);
12241225
int i, ret, val, index;
12251226

12261227
for (i = 0; i < ARRAY_SIZE(sgtl5000_reg_defaults); i++) {
12271228
val = sgtl5000_reg_defaults[i].def;
12281229
index = sgtl5000_reg_defaults[i].reg;
12291230
ret = regmap_write(sgtl5000->regmap, index, val);
12301231
if (ret)
1231-
return ret;
1232+
dev_err(&client->dev,
1233+
"%s: error %d setting reg 0x%02x to 0x%04x\n",
1234+
__func__, ret, index, val);
12321235
}
1233-
1234-
return 0;
12351236
}
12361237

12371238
static int sgtl5000_i2c_probe(struct i2c_client *client,
@@ -1364,9 +1365,7 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
13641365
}
13651366

13661367
/* Ensure sgtl5000 will start with sane register values */
1367-
ret = sgtl5000_fill_defaults(sgtl5000);
1368-
if (ret)
1369-
goto disable_clk;
1368+
sgtl5000_fill_defaults(client);
13701369

13711370
ret = snd_soc_register_codec(&client->dev,
13721371
&sgtl5000_driver, &sgtl5000_dai, 1);

0 commit comments

Comments
 (0)