Commit e5dbdcb3 authored by Takashi Iwai's avatar Takashi Iwai

Merge tag 'asoc-fix-v5.5-rc6' of...

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

ASoC: Fixes for v5.5

This is mostly driver specific fixes, plus an error handling fix
in the core.  There is a rather large diffstat for the stm32 SAI
driver, this is a very large but mostly mechanical update which
wraps every register access in the driver to allow a fix to the
locking which avoids circular locks, the active change is much
smaller and more reasonably sized.
parents 60adcfde 85578bbd
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <crypto/hash.h> #include <crypto/hash.h>
#include <crypto/sha.h> #include <crypto/sha.h>
#include <linux/acpi.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -1047,10 +1048,17 @@ static const struct of_device_id cros_ec_codec_of_match[] = { ...@@ -1047,10 +1048,17 @@ static const struct of_device_id cros_ec_codec_of_match[] = {
MODULE_DEVICE_TABLE(of, cros_ec_codec_of_match); MODULE_DEVICE_TABLE(of, cros_ec_codec_of_match);
#endif #endif
static const struct acpi_device_id cros_ec_codec_acpi_id[] = {
{ "GOOG0013", 0 },
{ }
};
MODULE_DEVICE_TABLE(acpi, cros_ec_codec_acpi_id);
static struct platform_driver cros_ec_codec_platform_driver = { static struct platform_driver cros_ec_codec_platform_driver = {
.driver = { .driver = {
.name = "cros-ec-codec", .name = "cros-ec-codec",
.of_match_table = of_match_ptr(cros_ec_codec_of_match), .of_match_table = of_match_ptr(cros_ec_codec_of_match),
.acpi_match_table = ACPI_PTR(cros_ec_codec_acpi_id),
}, },
.probe = cros_ec_codec_platform_probe, .probe = cros_ec_codec_platform_probe,
}; };
......
...@@ -588,7 +588,9 @@ static int hdac_hda_dev_remove(struct hdac_device *hdev) ...@@ -588,7 +588,9 @@ static int hdac_hda_dev_remove(struct hdac_device *hdev)
struct hdac_hda_priv *hda_pvt; struct hdac_hda_priv *hda_pvt;
hda_pvt = dev_get_drvdata(&hdev->dev); hda_pvt = dev_get_drvdata(&hdev->dev);
cancel_delayed_work_sync(&hda_pvt->codec.jackpoll_work); if (hda_pvt && hda_pvt->codec.registered)
cancel_delayed_work_sync(&hda_pvt->codec.jackpoll_work);
return 0; return 0;
} }
......
...@@ -396,9 +396,6 @@ static int pm8916_wcd_analog_enable_micbias_int(struct snd_soc_component ...@@ -396,9 +396,6 @@ static int pm8916_wcd_analog_enable_micbias_int(struct snd_soc_component
switch (event) { switch (event) {
case SND_SOC_DAPM_PRE_PMU: case SND_SOC_DAPM_PRE_PMU:
snd_soc_component_update_bits(component, CDC_A_MICB_1_INT_RBIAS,
MICB_1_INT_TX2_INT_RBIAS_EN_MASK,
MICB_1_INT_TX2_INT_RBIAS_EN_ENABLE);
snd_soc_component_update_bits(component, reg, MICB_1_EN_PULL_DOWN_EN_MASK, 0); snd_soc_component_update_bits(component, reg, MICB_1_EN_PULL_DOWN_EN_MASK, 0);
snd_soc_component_update_bits(component, CDC_A_MICB_1_EN, snd_soc_component_update_bits(component, CDC_A_MICB_1_EN,
MICB_1_EN_OPA_STG2_TAIL_CURR_MASK, MICB_1_EN_OPA_STG2_TAIL_CURR_MASK,
...@@ -448,6 +445,14 @@ static int pm8916_wcd_analog_enable_micbias_int1(struct ...@@ -448,6 +445,14 @@ static int pm8916_wcd_analog_enable_micbias_int1(struct
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct pm8916_wcd_analog_priv *wcd = snd_soc_component_get_drvdata(component); struct pm8916_wcd_analog_priv *wcd = snd_soc_component_get_drvdata(component);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
snd_soc_component_update_bits(component, CDC_A_MICB_1_INT_RBIAS,
MICB_1_INT_TX1_INT_RBIAS_EN_MASK,
MICB_1_INT_TX1_INT_RBIAS_EN_ENABLE);
break;
}
return pm8916_wcd_analog_enable_micbias_int(component, event, w->reg, return pm8916_wcd_analog_enable_micbias_int(component, event, w->reg,
wcd->micbias1_cap_mode); wcd->micbias1_cap_mode);
} }
...@@ -558,6 +563,11 @@ static int pm8916_wcd_analog_enable_micbias_int2(struct ...@@ -558,6 +563,11 @@ static int pm8916_wcd_analog_enable_micbias_int2(struct
struct pm8916_wcd_analog_priv *wcd = snd_soc_component_get_drvdata(component); struct pm8916_wcd_analog_priv *wcd = snd_soc_component_get_drvdata(component);
switch (event) { switch (event) {
case SND_SOC_DAPM_PRE_PMU:
snd_soc_component_update_bits(component, CDC_A_MICB_1_INT_RBIAS,
MICB_1_INT_TX2_INT_RBIAS_EN_MASK,
MICB_1_INT_TX2_INT_RBIAS_EN_ENABLE);
break;
case SND_SOC_DAPM_POST_PMU: case SND_SOC_DAPM_POST_PMU:
pm8916_mbhc_configure_bias(wcd, true); pm8916_mbhc_configure_bias(wcd, true);
break; break;
...@@ -938,10 +948,10 @@ static const struct snd_soc_dapm_widget pm8916_wcd_analog_dapm_widgets[] = { ...@@ -938,10 +948,10 @@ static const struct snd_soc_dapm_widget pm8916_wcd_analog_dapm_widgets[] = {
SND_SOC_DAPM_SUPPLY("MIC BIAS External1", CDC_A_MICB_1_EN, 7, 0, SND_SOC_DAPM_SUPPLY("MIC BIAS External1", CDC_A_MICB_1_EN, 7, 0,
pm8916_wcd_analog_enable_micbias_ext1, pm8916_wcd_analog_enable_micbias_ext1,
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_POST_PMU),
SND_SOC_DAPM_SUPPLY("MIC BIAS External2", CDC_A_MICB_2_EN, 7, 0, SND_SOC_DAPM_SUPPLY("MIC BIAS External2", CDC_A_MICB_2_EN, 7, 0,
pm8916_wcd_analog_enable_micbias_ext2, pm8916_wcd_analog_enable_micbias_ext2,
SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_POST_PMU),
SND_SOC_DAPM_ADC_E("ADC1", NULL, CDC_A_TX_1_EN, 7, 0, SND_SOC_DAPM_ADC_E("ADC1", NULL, CDC_A_TX_1_EN, 7, 0,
pm8916_wcd_analog_enable_adc, pm8916_wcd_analog_enable_adc,
......
...@@ -586,6 +586,12 @@ static int msm8916_wcd_digital_enable_interpolator( ...@@ -586,6 +586,12 @@ static int msm8916_wcd_digital_enable_interpolator(
snd_soc_component_write(component, rx_gain_reg[w->shift], snd_soc_component_write(component, rx_gain_reg[w->shift],
snd_soc_component_read32(component, rx_gain_reg[w->shift])); snd_soc_component_read32(component, rx_gain_reg[w->shift]));
break; break;
case SND_SOC_DAPM_POST_PMD:
snd_soc_component_update_bits(component, LPASS_CDC_CLK_RX_RESET_CTL,
1 << w->shift, 1 << w->shift);
snd_soc_component_update_bits(component, LPASS_CDC_CLK_RX_RESET_CTL,
1 << w->shift, 0x0);
break;
} }
return 0; return 0;
} }
......
...@@ -2432,6 +2432,13 @@ static void rt5640_disable_jack_detect(struct snd_soc_component *component) ...@@ -2432,6 +2432,13 @@ static void rt5640_disable_jack_detect(struct snd_soc_component *component)
{ {
struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
/*
* soc_remove_component() force-disables jack and thus rt5640->jack
* could be NULL at the time of driver's module unloading.
*/
if (!rt5640->jack)
return;
disable_irq(rt5640->irq); disable_irq(rt5640->irq);
rt5640_cancel_work(rt5640); rt5640_cancel_work(rt5640);
......
...@@ -442,7 +442,8 @@ static const struct dmi_system_id byt_cht_es8316_quirk_table[] = { ...@@ -442,7 +442,8 @@ static const struct dmi_system_id byt_cht_es8316_quirk_table[] = {
DMI_MATCH(DMI_SYS_VENDOR, "IRBIS"), DMI_MATCH(DMI_SYS_VENDOR, "IRBIS"),
DMI_MATCH(DMI_PRODUCT_NAME, "NB41"), DMI_MATCH(DMI_PRODUCT_NAME, "NB41"),
}, },
.driver_data = (void *)(BYT_CHT_ES8316_INTMIC_IN2_MAP .driver_data = (void *)(BYT_CHT_ES8316_SSP0
| BYT_CHT_ES8316_INTMIC_IN2_MAP
| BYT_CHT_ES8316_JD_INVERTED), | BYT_CHT_ES8316_JD_INVERTED),
}, },
{ /* Teclast X98 Plus II */ { /* Teclast X98 Plus II */
......
...@@ -539,6 +539,9 @@ void snd_soc_pcm_component_free(struct snd_soc_pcm_runtime *rtd) ...@@ -539,6 +539,9 @@ void snd_soc_pcm_component_free(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *component; struct snd_soc_component *component;
if (!rtd->pcm)
return;
for_each_rtd_components(rtd, rtdcom, component) for_each_rtd_components(rtd, rtdcom, component)
if (component->driver->pcm_destruct) if (component->driver->pcm_destruct)
component->driver->pcm_destruct(component, rtd->pcm); component->driver->pcm_destruct(component, rtd->pcm);
......
...@@ -24,19 +24,18 @@ ...@@ -24,19 +24,18 @@
#define IDISP_VID_INTEL 0x80860000 #define IDISP_VID_INTEL 0x80860000
/* load the legacy HDA codec driver */ /* load the legacy HDA codec driver */
#ifdef MODULE static int hda_codec_load_module(struct hda_codec *codec)
static void hda_codec_load_module(struct hda_codec *codec)
{ {
#ifdef MODULE
char alias[MODULE_NAME_LEN]; char alias[MODULE_NAME_LEN];
const char *module = alias; const char *module = alias;
snd_hdac_codec_modalias(&codec->core, alias, sizeof(alias)); snd_hdac_codec_modalias(&codec->core, alias, sizeof(alias));
dev_dbg(&codec->core.dev, "loading codec module: %s\n", module); dev_dbg(&codec->core.dev, "loading codec module: %s\n", module);
request_module(module); request_module(module);
}
#else
static void hda_codec_load_module(struct hda_codec *codec) {}
#endif #endif
return device_attach(hda_codec_dev(codec));
}
/* enable controller wake up event for all codecs with jack connectors */ /* enable controller wake up event for all codecs with jack connectors */
void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev) void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev)
...@@ -129,10 +128,16 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address) ...@@ -129,10 +128,16 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address)
if ((mach_params && mach_params->common_hdmi_codec_drv) || if ((mach_params && mach_params->common_hdmi_codec_drv) ||
(resp & 0xFFFF0000) != IDISP_VID_INTEL) { (resp & 0xFFFF0000) != IDISP_VID_INTEL) {
hdev->type = HDA_DEV_LEGACY; hdev->type = HDA_DEV_LEGACY;
hda_codec_load_module(&hda_priv->codec); ret = hda_codec_load_module(&hda_priv->codec);
/*
* handle ret==0 (no driver bound) as an error, but pass
* other return codes without modification
*/
if (ret == 0)
ret = -ENOENT;
} }
return 0; return ret;
#else #else
hdev = devm_kzalloc(sdev->dev, sizeof(*hdev), GFP_KERNEL); hdev = devm_kzalloc(sdev->dev, sizeof(*hdev), GFP_KERNEL);
if (!hdev) if (!hdev)
......
...@@ -329,13 +329,13 @@ int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev) ...@@ -329,13 +329,13 @@ int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev)
if (!ret) if (!ret)
break; break;
dev_err(sdev->dev, "error: Error code=0x%x: FW status=0x%x\n", dev_dbg(sdev->dev, "iteration %d of Core En/ROM load failed: %d\n",
i, ret);
dev_dbg(sdev->dev, "Error code=0x%x: FW status=0x%x\n",
snd_sof_dsp_read(sdev, HDA_DSP_BAR, snd_sof_dsp_read(sdev, HDA_DSP_BAR,
HDA_DSP_SRAM_REG_ROM_ERROR), HDA_DSP_SRAM_REG_ROM_ERROR),
snd_sof_dsp_read(sdev, HDA_DSP_BAR, snd_sof_dsp_read(sdev, HDA_DSP_BAR,
HDA_DSP_SRAM_REG_ROM_STATUS)); HDA_DSP_SRAM_REG_ROM_STATUS));
dev_err(sdev->dev, "error: iteration %d of Core En/ROM load failed: %d\n",
i, ret);
} }
if (i == HDA_FW_BOOT_ATTEMPTS) { if (i == HDA_FW_BOOT_ATTEMPTS) {
......
...@@ -226,7 +226,6 @@ static void uni_player_set_channel_status(struct uniperif *player, ...@@ -226,7 +226,6 @@ static void uni_player_set_channel_status(struct uniperif *player,
* sampling frequency. If no sample rate is already specified, then * sampling frequency. If no sample rate is already specified, then
* set one. * set one.
*/ */
mutex_lock(&player->ctrl_lock);
if (runtime) { if (runtime) {
switch (runtime->rate) { switch (runtime->rate) {
case 22050: case 22050:
...@@ -303,7 +302,6 @@ static void uni_player_set_channel_status(struct uniperif *player, ...@@ -303,7 +302,6 @@ static void uni_player_set_channel_status(struct uniperif *player,
player->stream_settings.iec958.status[3 + (n * 4)] << 24; player->stream_settings.iec958.status[3 + (n * 4)] << 24;
SET_UNIPERIF_CHANNEL_STA_REGN(player, n, status); SET_UNIPERIF_CHANNEL_STA_REGN(player, n, status);
} }
mutex_unlock(&player->ctrl_lock);
/* Update the channel status */ /* Update the channel status */
if (player->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0) if (player->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0)
...@@ -365,8 +363,10 @@ static int uni_player_prepare_iec958(struct uniperif *player, ...@@ -365,8 +363,10 @@ static int uni_player_prepare_iec958(struct uniperif *player,
SET_UNIPERIF_CTRL_ZERO_STUFF_HW(player); SET_UNIPERIF_CTRL_ZERO_STUFF_HW(player);
mutex_lock(&player->ctrl_lock);
/* Update the channel status */ /* Update the channel status */
uni_player_set_channel_status(player, runtime); uni_player_set_channel_status(player, runtime);
mutex_unlock(&player->ctrl_lock);
/* Clear the user validity user bits */ /* Clear the user validity user bits */
SET_UNIPERIF_USER_VALIDITY_VALIDITY_LR(player, 0); SET_UNIPERIF_USER_VALIDITY_VALIDITY_LR(player, 0);
...@@ -598,7 +598,6 @@ static int uni_player_ctl_iec958_put(struct snd_kcontrol *kcontrol, ...@@ -598,7 +598,6 @@ static int uni_player_ctl_iec958_put(struct snd_kcontrol *kcontrol,
iec958->status[1] = ucontrol->value.iec958.status[1]; iec958->status[1] = ucontrol->value.iec958.status[1];
iec958->status[2] = ucontrol->value.iec958.status[2]; iec958->status[2] = ucontrol->value.iec958.status[2];
iec958->status[3] = ucontrol->value.iec958.status[3]; iec958->status[3] = ucontrol->value.iec958.status[3];
mutex_unlock(&player->ctrl_lock);
spin_lock_irqsave(&player->irq_lock, flags); spin_lock_irqsave(&player->irq_lock, flags);
if (player->substream && player->substream->runtime) if (player->substream && player->substream->runtime)
...@@ -608,6 +607,8 @@ static int uni_player_ctl_iec958_put(struct snd_kcontrol *kcontrol, ...@@ -608,6 +607,8 @@ static int uni_player_ctl_iec958_put(struct snd_kcontrol *kcontrol,
uni_player_set_channel_status(player, NULL); uni_player_set_channel_status(player, NULL);
spin_unlock_irqrestore(&player->irq_lock, flags); spin_unlock_irqrestore(&player->irq_lock, flags);
mutex_unlock(&player->ctrl_lock);
return 0; return 0;
} }
......
...@@ -153,13 +153,13 @@ static const struct snd_soc_component_driver stm32_adfsdm_dai_component = { ...@@ -153,13 +153,13 @@ static const struct snd_soc_component_driver stm32_adfsdm_dai_component = {
.name = "stm32_dfsdm_audio", .name = "stm32_dfsdm_audio",
}; };
static void memcpy_32to16(void *dest, const void *src, size_t n) static void stm32_memcpy_32to16(void *dest, const void *src, size_t n)
{ {
unsigned int i = 0; unsigned int i = 0;
u16 *d = (u16 *)dest, *s = (u16 *)src; u16 *d = (u16 *)dest, *s = (u16 *)src;
s++; s++;
for (i = n; i > 0; i--) { for (i = n >> 1; i > 0; i--) {
*d++ = *s++; *d++ = *s++;
s++; s++;
} }
...@@ -186,8 +186,8 @@ static int stm32_afsdm_pcm_cb(const void *data, size_t size, void *private) ...@@ -186,8 +186,8 @@ static int stm32_afsdm_pcm_cb(const void *data, size_t size, void *private)
if ((priv->pos + src_size) > buff_size) { if ((priv->pos + src_size) > buff_size) {
if (format == SNDRV_PCM_FORMAT_S16_LE) if (format == SNDRV_PCM_FORMAT_S16_LE)
memcpy_32to16(&pcm_buff[priv->pos], src_buff, stm32_memcpy_32to16(&pcm_buff[priv->pos], src_buff,
buff_size - priv->pos); buff_size - priv->pos);
else else
memcpy(&pcm_buff[priv->pos], src_buff, memcpy(&pcm_buff[priv->pos], src_buff,
buff_size - priv->pos); buff_size - priv->pos);
...@@ -196,8 +196,8 @@ static int stm32_afsdm_pcm_cb(const void *data, size_t size, void *private) ...@@ -196,8 +196,8 @@ static int stm32_afsdm_pcm_cb(const void *data, size_t size, void *private)
} }
if (format == SNDRV_PCM_FORMAT_S16_LE) if (format == SNDRV_PCM_FORMAT_S16_LE)
memcpy_32to16(&pcm_buff[priv->pos], stm32_memcpy_32to16(&pcm_buff[priv->pos],
&src_buff[src_size - cur_size], cur_size); &src_buff[src_size - cur_size], cur_size);
else else
memcpy(&pcm_buff[priv->pos], &src_buff[src_size - cur_size], memcpy(&pcm_buff[priv->pos], &src_buff[src_size - cur_size],
cur_size); cur_size);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment