Skip to content

Commit ee71a70

Browse files
committed
Merge tag 'asoc-v3.13-5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v3.13 A bunch of device specific fixes, nothing with a general impact here.
2 parents b8362e7 + 9a5c543 commit ee71a70

File tree

5 files changed

+86
-42
lines changed

5 files changed

+86
-42
lines changed

sound/soc/codecs/ab8500-codec.c

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ struct ab8500_codec_drvdata_dbg {
126126

127127
/* Private data for AB8500 device-driver */
128128
struct ab8500_codec_drvdata {
129-
struct regmap *regmap;
130-
131129
/* Sidetone */
132130
long *sid_fir_values;
133131
enum sid_state sid_status;
@@ -168,34 +166,48 @@ static inline const char *amic_type_str(enum amic_type type)
168166
*/
169167

170168
/* Read a register from the audio-bank of AB8500 */
171-
static int ab8500_codec_read_reg(void *context, unsigned int reg,
172-
unsigned int *value)
169+
static unsigned int ab8500_codec_read_reg(struct snd_soc_codec *codec,
170+
unsigned int reg)
173171
{
174-
struct device *dev = context;
175172
int status;
173+
unsigned int value = 0;
176174

177175
u8 value8;
178-
status = abx500_get_register_interruptible(dev, AB8500_AUDIO,
179-
reg, &value8);
180-
*value = (unsigned int)value8;
176+
status = abx500_get_register_interruptible(codec->dev, AB8500_AUDIO,
177+
reg, &value8);
178+
if (status < 0) {
179+
dev_err(codec->dev,
180+
"%s: ERROR: Register (0x%02x:0x%02x) read failed (%d).\n",
181+
__func__, (u8)AB8500_AUDIO, (u8)reg, status);
182+
} else {
183+
dev_dbg(codec->dev,
184+
"%s: Read 0x%02x from register 0x%02x:0x%02x\n",
185+
__func__, value8, (u8)AB8500_AUDIO, (u8)reg);
186+
value = (unsigned int)value8;
187+
}
181188

182-
return status;
189+
return value;
183190
}
184191

185192
/* Write to a register in the audio-bank of AB8500 */
186-
static int ab8500_codec_write_reg(void *context, unsigned int reg,
187-
unsigned int value)
193+
static int ab8500_codec_write_reg(struct snd_soc_codec *codec,
194+
unsigned int reg, unsigned int value)
188195
{
189-
struct device *dev = context;
196+
int status;
190197

191-
return abx500_set_register_interruptible(dev, AB8500_AUDIO,
192-
reg, value);
193-
}
198+
status = abx500_set_register_interruptible(codec->dev, AB8500_AUDIO,
199+
reg, value);
200+
if (status < 0)
201+
dev_err(codec->dev,
202+
"%s: ERROR: Register (%02x:%02x) write failed (%d).\n",
203+
__func__, (u8)AB8500_AUDIO, (u8)reg, status);
204+
else
205+
dev_dbg(codec->dev,
206+
"%s: Wrote 0x%02x into register %02x:%02x\n",
207+
__func__, (u8)value, (u8)AB8500_AUDIO, (u8)reg);
194208

195-
static const struct regmap_config ab8500_codec_regmap = {
196-
.reg_read = ab8500_codec_read_reg,
197-
.reg_write = ab8500_codec_write_reg,
198-
};
209+
return status;
210+
}
199211

200212
/*
201213
* Controls - DAPM
@@ -2473,13 +2485,9 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
24732485

24742486
dev_dbg(dev, "%s: Enter.\n", __func__);
24752487

2476-
snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);
2477-
24782488
/* Setup AB8500 according to board-settings */
24792489
pdata = dev_get_platdata(dev->parent);
24802490

2481-
codec->control_data = drvdata->regmap;
2482-
24832491
if (np) {
24842492
if (!pdata)
24852493
pdata = devm_kzalloc(dev,
@@ -2557,6 +2565,9 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
25572565

25582566
static struct snd_soc_codec_driver ab8500_codec_driver = {
25592567
.probe = ab8500_codec_probe,
2568+
.read = ab8500_codec_read_reg,
2569+
.write = ab8500_codec_write_reg,
2570+
.reg_word_size = sizeof(u8),
25602571
.controls = ab8500_ctrls,
25612572
.num_controls = ARRAY_SIZE(ab8500_ctrls),
25622573
.dapm_widgets = ab8500_dapm_widgets,
@@ -2581,15 +2592,6 @@ static int ab8500_codec_driver_probe(struct platform_device *pdev)
25812592
drvdata->anc_status = ANC_UNCONFIGURED;
25822593
dev_set_drvdata(&pdev->dev, drvdata);
25832594

2584-
drvdata->regmap = devm_regmap_init(&pdev->dev, NULL, &pdev->dev,
2585-
&ab8500_codec_regmap);
2586-
if (IS_ERR(drvdata->regmap)) {
2587-
status = PTR_ERR(drvdata->regmap);
2588-
dev_err(&pdev->dev, "%s: Failed to allocate regmap: %d\n",
2589-
__func__, status);
2590-
return status;
2591-
}
2592-
25932595
dev_dbg(&pdev->dev, "%s: Register codec.\n", __func__);
25942596
status = snd_soc_register_codec(&pdev->dev, &ab8500_codec_driver,
25952597
ab8500_codec_dai,

sound/soc/codecs/arizona.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,8 @@ static void arizona_enable_fll(struct arizona_fll *fll,
15281528
/* Clear any pending completions */
15291529
try_wait_for_completion(&fll->ok);
15301530

1531+
regmap_update_bits(arizona->regmap, fll->base + 1,
1532+
ARIZONA_FLL1_FREERUN, 0);
15311533
regmap_update_bits(arizona->regmap, fll->base + 1,
15321534
ARIZONA_FLL1_ENA, ARIZONA_FLL1_ENA);
15331535
if (use_sync)
@@ -1546,6 +1548,8 @@ static void arizona_disable_fll(struct arizona_fll *fll)
15461548
struct arizona *arizona = fll->arizona;
15471549
bool change;
15481550

1551+
regmap_update_bits(arizona->regmap, fll->base + 1,
1552+
ARIZONA_FLL1_FREERUN, ARIZONA_FLL1_FREERUN);
15491553
regmap_update_bits_check(arizona->regmap, fll->base + 1,
15501554
ARIZONA_FLL1_ENA, 0, &change);
15511555
regmap_update_bits(arizona->regmap, fll->base + 0x11,

sound/soc/codecs/wm5110.c

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,47 @@ struct wm5110_priv {
3737
struct arizona_fll fll[2];
3838
};
3939

40+
static const struct reg_default wm5110_sysclk_revd_patch[] = {
41+
{ 0x3093, 0x1001 },
42+
{ 0x30E3, 0x1301 },
43+
{ 0x3133, 0x1201 },
44+
{ 0x3183, 0x1501 },
45+
{ 0x31D3, 0x1401 },
46+
};
47+
48+
static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w,
49+
struct snd_kcontrol *kcontrol, int event)
50+
{
51+
struct snd_soc_codec *codec = w->codec;
52+
struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
53+
struct regmap *regmap = codec->control_data;
54+
const struct reg_default *patch = NULL;
55+
int i, patch_size;
56+
57+
switch (arizona->rev) {
58+
case 3:
59+
patch = wm5110_sysclk_revd_patch;
60+
patch_size = ARRAY_SIZE(wm5110_sysclk_revd_patch);
61+
break;
62+
default:
63+
return 0;
64+
}
65+
66+
switch (event) {
67+
case SND_SOC_DAPM_POST_PMU:
68+
if (patch)
69+
for (i = 0; i < patch_size; i++)
70+
regmap_write(regmap, patch[i].reg,
71+
patch[i].def);
72+
break;
73+
74+
default:
75+
break;
76+
}
77+
78+
return 0;
79+
}
80+
4081
static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
4182
static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
4283
static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
@@ -400,7 +441,7 @@ static const struct snd_kcontrol_new wm5110_aec_loopback_mux =
400441

401442
static const struct snd_soc_dapm_widget wm5110_dapm_widgets[] = {
402443
SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT,
403-
0, NULL, 0),
444+
0, wm5110_sysclk_ev, SND_SOC_DAPM_POST_PMU),
404445
SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
405446
ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0),
406447
SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,

sound/soc/sh/rcar/core.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,8 @@ static void rsnd_dma_do_work(struct work_struct *work)
200200
return;
201201
}
202202

203+
dma_async_issue_pending(dma->chan);
203204
}
204-
205-
dma_async_issue_pending(dma->chan);
206205
}
207206

208207
int rsnd_dma_available(struct rsnd_dma *dma)
@@ -288,15 +287,13 @@ int rsnd_dai_connect(struct rsnd_dai *rdai,
288287
struct rsnd_mod *mod,
289288
struct rsnd_dai_stream *io)
290289
{
291-
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
292-
struct device *dev = rsnd_priv_to_dev(priv);
293-
294-
if (!mod) {
295-
dev_err(dev, "NULL mod\n");
290+
if (!mod)
296291
return -EIO;
297-
}
298292

299293
if (!list_empty(&mod->list)) {
294+
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
295+
struct device *dev = rsnd_priv_to_dev(priv);
296+
300297
dev_err(dev, "%s%d is not empty\n",
301298
rsnd_mod_name(mod),
302299
rsnd_mod_id(mod));

sound/soc/sh/rcar/scu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static int rsnd_scu_set_route(struct rsnd_priv *priv,
6868
return 0;
6969

7070
id = rsnd_mod_id(mod);
71-
if (id < 0 || id > ARRAY_SIZE(routes))
71+
if (id < 0 || id >= ARRAY_SIZE(routes))
7272
return -EIO;
7373

7474
/*

0 commit comments

Comments
 (0)