ASoC: Fixes for v5.18

More fixes that have arrived in the past few -rcs, plus a MAINTAINERS
 update.  The biggest update here is the fix for control change
 notifications in ASoC generic controls found by mixer-test.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmIKgz8ACgkQJNaLcl1U
 h9Conwf6A3asUY/E6bxnHR82zjXlTi9h8o4gpduu1v38J+npn37cSz7w50AZq2o3
 SCbedB5LuZpGRKgP9tXPR3jqmXDwBH2D7cazISXLXLq8CKMHxuGuvY6vxaw7x+xz
 T7MIinNr9FGn5uqrTmmucRj7YyxA4YRQteQTRq5ixjUW/XvdIXcmOVY0ZO+P09Iq
 RBAZFtqNOh+AEdKddEfG3yykm1gU6rhvZM52KeJds22MSVCpQSYRe64yIwizERFr
 Jcb3qfuDtrVx0WaIW8H4jxfrHUw4ZbVs8ut2Z7fUwG2S1tiR88uNYiQ1uoMKAdQT
 WKLx/No3uLk2hZ8UszPc6KUqcrbGRA==
 =FeYQ
 -----END PGP SIGNATURE-----

Merge tag 'asoc-fix-v5.17-rc4' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v5.18

More fixes that have arrived in the past few -rcs, plus a MAINTAINERS
update.  The biggest update here is the fix for control change
notifications in ASoC generic controls found by mixer-test.
This commit is contained in:
Takashi Iwai 2022-02-14 17:55:39 +01:00
commit 5948342a52
12 changed files with 72 additions and 45 deletions

View File

@ -8,6 +8,7 @@ title: Audio codec controlled by ChromeOS EC
maintainers:
- Cheng-Yi Chiang <cychiang@chromium.org>
- Tzung-Bi Shih <tzungbi@google.com>
description: |
Google's ChromeOS EC codec is a digital mic codec provided by the

View File

@ -4543,6 +4543,7 @@ F: drivers/platform/chrome/
CHROMEOS EC CODEC DRIVER
M: Cheng-Yi Chiang <cychiang@chromium.org>
M: Tzung-Bi Shih <tzungbi@google.com>
R: Guenter Roeck <groeck@chromium.org>
S: Maintained
F: Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml

View File

@ -411,17 +411,12 @@ out:
return ret;
}
static int init_clks(struct platform_device *pdev, struct clk **clk)
static void init_clks(struct platform_device *pdev, struct clk **clk)
{
int i;
for (i = CLK_NONE + 1; i < CLK_MAX; i++) {
for (i = CLK_NONE + 1; i < CLK_MAX; i++)
clk[i] = devm_clk_get(&pdev->dev, clk_names[i]);
if (IS_ERR(clk[i]))
return PTR_ERR(clk[i]);
}
return 0;
}
static struct scp *init_scp(struct platform_device *pdev,
@ -431,7 +426,7 @@ static struct scp *init_scp(struct platform_device *pdev,
{
struct genpd_onecell_data *pd_data;
struct resource *res;
int i, j, ret;
int i, j;
struct scp *scp;
struct clk *clk[CLK_MAX];
@ -486,9 +481,7 @@ static struct scp *init_scp(struct platform_device *pdev,
pd_data->num_domains = num;
ret = init_clks(pdev, clk);
if (ret)
return ERR_PTR(ret);
init_clks(pdev, clk);
for (i = 0; i < num; i++) {
struct scp_domain *scpd = &scp->domains[i];

View File

@ -21,7 +21,6 @@
#include <linux/gpio/consumer.h>
#define EN_SPKR_GPIO_GB 0x11F
#define EN_SPKR_GPIO_NK 0x146
#define EN_SPKR_GPIO_NONE -EINVAL
enum be_id {

View File

@ -37,7 +37,7 @@ static struct acp_card_drvdata sof_rt5682_max_data = {
.hs_codec_id = RT5682,
.amp_codec_id = MAX98360A,
.dmic_codec_id = DMIC,
.gpio_spkr_en = EN_SPKR_GPIO_NK,
.gpio_spkr_en = EN_SPKR_GPIO_NONE,
};
static struct acp_card_drvdata sof_rt5682s_max_data = {
@ -47,7 +47,7 @@ static struct acp_card_drvdata sof_rt5682s_max_data = {
.hs_codec_id = RT5682S,
.amp_codec_id = MAX98360A,
.dmic_codec_id = DMIC,
.gpio_spkr_en = EN_SPKR_GPIO_NK,
.gpio_spkr_en = EN_SPKR_GPIO_NONE,
};
static const struct snd_kcontrol_new acp_controls[] = {

View File

@ -1022,11 +1022,13 @@ static void rt5668_jack_detect_handler(struct work_struct *work)
container_of(work, struct rt5668_priv, jack_detect_work.work);
int val, btn_type;
while (!rt5668->component)
usleep_range(10000, 15000);
while (!rt5668->component->card->instantiated)
usleep_range(10000, 15000);
if (!rt5668->component || !rt5668->component->card ||
!rt5668->component->card->instantiated) {
/* card not yet ready, try later */
mod_delayed_work(system_power_efficient_wq,
&rt5668->jack_detect_work, msecs_to_jiffies(15));
return;
}
mutex_lock(&rt5668->calibrate_mutex);

View File

@ -1092,11 +1092,13 @@ void rt5682_jack_detect_handler(struct work_struct *work)
struct snd_soc_dapm_context *dapm;
int val, btn_type;
while (!rt5682->component)
usleep_range(10000, 15000);
while (!rt5682->component->card->instantiated)
usleep_range(10000, 15000);
if (!rt5682->component || !rt5682->component->card ||
!rt5682->component->card->instantiated) {
/* card not yet ready, try later */
mod_delayed_work(system_power_efficient_wq,
&rt5682->jack_detect_work, msecs_to_jiffies(15));
return;
}
dapm = snd_soc_component_get_dapm(rt5682->component);

View File

@ -824,11 +824,13 @@ static void rt5682s_jack_detect_handler(struct work_struct *work)
container_of(work, struct rt5682s_priv, jack_detect_work.work);
int val, btn_type;
while (!rt5682s->component)
usleep_range(10000, 15000);
while (!rt5682s->component->card->instantiated)
usleep_range(10000, 15000);
if (!rt5682s->component || !rt5682s->component->card ||
!rt5682s->component->card->instantiated) {
/* card not yet ready, try later */
mod_delayed_work(system_power_efficient_wq,
&rt5682s->jack_detect_work, msecs_to_jiffies(15));
return;
}
mutex_lock(&rt5682s->jdet_mutex);
mutex_lock(&rt5682s->calibrate_mutex);

View File

@ -38,10 +38,12 @@ static void tas2770_reset(struct tas2770_priv *tas2770)
gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
msleep(20);
gpiod_set_value_cansleep(tas2770->reset_gpio, 1);
usleep_range(1000, 2000);
}
snd_soc_component_write(tas2770->component, TAS2770_SW_RST,
TAS2770_RST);
usleep_range(1000, 2000);
}
static int tas2770_set_bias_level(struct snd_soc_component *component,
@ -110,6 +112,7 @@ static int tas2770_codec_resume(struct snd_soc_component *component)
if (tas2770->sdz_gpio) {
gpiod_set_value_cansleep(tas2770->sdz_gpio, 1);
usleep_range(1000, 2000);
} else {
ret = snd_soc_component_update_bits(component, TAS2770_PWR_CTRL,
TAS2770_PWR_CTRL_MASK,
@ -510,8 +513,10 @@ static int tas2770_codec_probe(struct snd_soc_component *component)
tas2770->component = component;
if (tas2770->sdz_gpio)
if (tas2770->sdz_gpio) {
gpiod_set_value_cansleep(tas2770->sdz_gpio, 1);
usleep_range(1000, 2000);
}
tas2770_reset(tas2770);

View File

@ -1441,7 +1441,8 @@ static int wm_adsp_buffer_parse_coeff(struct cs_dsp_coeff_ctl *cs_ctl)
int ret, i;
for (i = 0; i < 5; ++i) {
ret = cs_dsp_coeff_read_ctrl(cs_ctl, 0, &coeff_v1, sizeof(coeff_v1));
ret = cs_dsp_coeff_read_ctrl(cs_ctl, 0, &coeff_v1,
min(cs_ctl->len, sizeof(coeff_v1)));
if (ret < 0)
return ret;

View File

@ -524,7 +524,7 @@ static int lpass_platform_pcmops_trigger(struct snd_soc_component *component,
return -EINVAL;
}
ret = regmap_update_bits(map, reg_irqclr, val_irqclr, val_irqclr);
ret = regmap_write_bits(map, reg_irqclr, val_irqclr, val_irqclr);
if (ret) {
dev_err(soc_runtime->dev, "error writing to irqclear reg: %d\n", ret);
return ret;
@ -665,7 +665,7 @@ static irqreturn_t lpass_dma_interrupt_handler(
return -EINVAL;
}
if (interrupts & LPAIF_IRQ_PER(chan)) {
rv = regmap_update_bits(map, reg, mask, (LPAIF_IRQ_PER(chan) | val));
rv = regmap_write_bits(map, reg, mask, (LPAIF_IRQ_PER(chan) | val));
if (rv) {
dev_err(soc_runtime->dev,
"error writing to irqclear reg: %d\n", rv);
@ -676,7 +676,7 @@ static irqreturn_t lpass_dma_interrupt_handler(
}
if (interrupts & LPAIF_IRQ_XRUN(chan)) {
rv = regmap_update_bits(map, reg, mask, (LPAIF_IRQ_XRUN(chan) | val));
rv = regmap_write_bits(map, reg, mask, (LPAIF_IRQ_XRUN(chan) | val));
if (rv) {
dev_err(soc_runtime->dev,
"error writing to irqclear reg: %d\n", rv);
@ -688,7 +688,7 @@ static irqreturn_t lpass_dma_interrupt_handler(
}
if (interrupts & LPAIF_IRQ_ERR(chan)) {
rv = regmap_update_bits(map, reg, mask, (LPAIF_IRQ_ERR(chan) | val));
rv = regmap_write_bits(map, reg, mask, (LPAIF_IRQ_ERR(chan) | val));
if (rv) {
dev_err(soc_runtime->dev,
"error writing to irqclear reg: %d\n", rv);

View File

@ -308,7 +308,7 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
unsigned int sign_bit = mc->sign_bit;
unsigned int mask = (1 << fls(max)) - 1;
unsigned int invert = mc->invert;
int err;
int err, ret;
bool type_2r = false;
unsigned int val2 = 0;
unsigned int val, val_mask;
@ -350,12 +350,18 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
err = snd_soc_component_update_bits(component, reg, val_mask, val);
if (err < 0)
return err;
ret = err;
if (type_2r)
if (type_2r) {
err = snd_soc_component_update_bits(component, reg2, val_mask,
val2);
val2);
/* Don't discard any error code or drop change flag */
if (ret == 0 || err < 0) {
ret = err;
}
}
return err;
return ret;
}
EXPORT_SYMBOL_GPL(snd_soc_put_volsw);
@ -421,6 +427,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
int min = mc->min;
unsigned int mask = (1U << (fls(min + max) - 1)) - 1;
int err = 0;
int ret;
unsigned int val, val_mask;
if (ucontrol->value.integer.value[0] < 0)
@ -437,6 +444,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
err = snd_soc_component_update_bits(component, reg, val_mask, val);
if (err < 0)
return err;
ret = err;
if (snd_soc_volsw_is_stereo(mc)) {
unsigned int val2;
@ -447,6 +455,11 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
err = snd_soc_component_update_bits(component, reg2, val_mask,
val2);
/* Don't discard any error code or drop change flag */
if (ret == 0 || err < 0) {
ret = err;
}
}
return err;
}
@ -506,7 +519,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
unsigned int mask = (1 << fls(max)) - 1;
unsigned int invert = mc->invert;
unsigned int val, val_mask;
int ret;
int err, ret;
if (invert)
val = (max - ucontrol->value.integer.value[0]) & mask;
@ -515,9 +528,10 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
val_mask = mask << shift;
val = val << shift;
ret = snd_soc_component_update_bits(component, reg, val_mask, val);
if (ret < 0)
return ret;
err = snd_soc_component_update_bits(component, reg, val_mask, val);
if (err < 0)
return err;
ret = err;
if (snd_soc_volsw_is_stereo(mc)) {
if (invert)
@ -527,8 +541,12 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
val_mask = mask << shift;
val = val << shift;
ret = snd_soc_component_update_bits(component, rreg, val_mask,
err = snd_soc_component_update_bits(component, rreg, val_mask,
val);
/* Don't discard any error code or drop change flag */
if (ret == 0 || err < 0) {
ret = err;
}
}
return ret;
@ -877,6 +895,7 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol,
unsigned long mask = (1UL<<mc->nbits)-1;
long max = mc->max;
long val = ucontrol->value.integer.value[0];
int ret = 0;
unsigned int i;
if (val < mc->min || val > mc->max)
@ -891,9 +910,11 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol,
regmask, regval);
if (err < 0)
return err;
if (err > 0)
ret = err;
}
return 0;
return ret;
}
EXPORT_SYMBOL_GPL(snd_soc_put_xr_sx);