Commit 3a230f7d authored by Takashi Iwai's avatar Takashi Iwai

Merge tag 'asoc-fix-4.17-rc2' of...

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

ASoC: Fixes for v4.17

A small batch of fixes collected since the merge window, none of which
are particularly large or remarkable.  They've all been cooking in -next
for a while.
parents 65811834 a8419a0c
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#define DUAL_CHANNEL 2 #define DUAL_CHANNEL 2
static struct snd_soc_jack cz_jack; static struct snd_soc_jack cz_jack;
struct clk *da7219_dai_clk; static struct clk *da7219_dai_clk;
static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
{ {
......
...@@ -502,7 +502,7 @@ static int adau17x1_hw_params(struct snd_pcm_substream *substream, ...@@ -502,7 +502,7 @@ static int adau17x1_hw_params(struct snd_pcm_substream *substream,
} }
if (adau->sigmadsp) { if (adau->sigmadsp) {
ret = adau17x1_setup_firmware(adau, params_rate(params)); ret = adau17x1_setup_firmware(component, params_rate(params));
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
...@@ -835,26 +835,40 @@ bool adau17x1_volatile_register(struct device *dev, unsigned int reg) ...@@ -835,26 +835,40 @@ bool adau17x1_volatile_register(struct device *dev, unsigned int reg)
} }
EXPORT_SYMBOL_GPL(adau17x1_volatile_register); EXPORT_SYMBOL_GPL(adau17x1_volatile_register);
int adau17x1_setup_firmware(struct adau *adau, unsigned int rate) int adau17x1_setup_firmware(struct snd_soc_component *component,
unsigned int rate)
{ {
int ret; int ret;
int dspsr; int dspsr, dsp_run;
struct adau *adau = snd_soc_component_get_drvdata(component);
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
snd_soc_dapm_mutex_lock(dapm);
ret = regmap_read(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, &dspsr); ret = regmap_read(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, &dspsr);
if (ret) if (ret)
return ret; goto err;
ret = regmap_read(adau->regmap, ADAU17X1_DSP_RUN, &dsp_run);
if (ret)
goto err;
regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 1); regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 1);
regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, 0xf); regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, 0xf);
regmap_write(adau->regmap, ADAU17X1_DSP_RUN, 0);
ret = sigmadsp_setup(adau->sigmadsp, rate); ret = sigmadsp_setup(adau->sigmadsp, rate);
if (ret) { if (ret) {
regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 0); regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 0);
return ret; goto err;
} }
regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, dspsr); regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, dspsr);
regmap_write(adau->regmap, ADAU17X1_DSP_RUN, dsp_run);
return 0; err:
snd_soc_dapm_mutex_unlock(dapm);
return ret;
} }
EXPORT_SYMBOL_GPL(adau17x1_setup_firmware); EXPORT_SYMBOL_GPL(adau17x1_setup_firmware);
......
...@@ -68,7 +68,8 @@ int adau17x1_resume(struct snd_soc_component *component); ...@@ -68,7 +68,8 @@ int adau17x1_resume(struct snd_soc_component *component);
extern const struct snd_soc_dai_ops adau17x1_dai_ops; extern const struct snd_soc_dai_ops adau17x1_dai_ops;
int adau17x1_setup_firmware(struct adau *adau, unsigned int rate); int adau17x1_setup_firmware(struct snd_soc_component *component,
unsigned int rate);
bool adau17x1_has_dsp(struct adau *adau); bool adau17x1_has_dsp(struct adau *adau);
#define ADAU17X1_CLOCK_CONTROL 0x4000 #define ADAU17X1_CLOCK_CONTROL 0x4000
......
...@@ -1187,7 +1187,8 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev) ...@@ -1187,7 +1187,8 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)
return irq; return irq;
} }
ret = devm_request_irq(dev, irq, pm8916_mbhc_switch_irq_handler, ret = devm_request_threaded_irq(dev, irq, NULL,
pm8916_mbhc_switch_irq_handler,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
IRQF_ONESHOT, IRQF_ONESHOT,
"mbhc switch irq", priv); "mbhc switch irq", priv);
...@@ -1201,7 +1202,8 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev) ...@@ -1201,7 +1202,8 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)
return irq; return irq;
} }
ret = devm_request_irq(dev, irq, mbhc_btn_press_irq_handler, ret = devm_request_threaded_irq(dev, irq, NULL,
mbhc_btn_press_irq_handler,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_RISING |
IRQF_TRIGGER_FALLING | IRQF_ONESHOT, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
"mbhc btn press irq", priv); "mbhc btn press irq", priv);
...@@ -1214,7 +1216,8 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev) ...@@ -1214,7 +1216,8 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)
return irq; return irq;
} }
ret = devm_request_irq(dev, irq, mbhc_btn_release_irq_handler, ret = devm_request_threaded_irq(dev, irq, NULL,
mbhc_btn_release_irq_handler,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_RISING |
IRQF_TRIGGER_FALLING | IRQF_ONESHOT, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
"mbhc btn release irq", priv); "mbhc btn release irq", priv);
......
...@@ -89,6 +89,7 @@ static const struct reg_default rt5514_reg[] = { ...@@ -89,6 +89,7 @@ static const struct reg_default rt5514_reg[] = {
{RT5514_PLL3_CALIB_CTRL5, 0x40220012}, {RT5514_PLL3_CALIB_CTRL5, 0x40220012},
{RT5514_DELAY_BUF_CTRL1, 0x7fff006a}, {RT5514_DELAY_BUF_CTRL1, 0x7fff006a},
{RT5514_DELAY_BUF_CTRL3, 0x00000000}, {RT5514_DELAY_BUF_CTRL3, 0x00000000},
{RT5514_ASRC_IN_CTRL1, 0x00000003},
{RT5514_DOWNFILTER0_CTRL1, 0x00020c2f}, {RT5514_DOWNFILTER0_CTRL1, 0x00020c2f},
{RT5514_DOWNFILTER0_CTRL2, 0x00020c2f}, {RT5514_DOWNFILTER0_CTRL2, 0x00020c2f},
{RT5514_DOWNFILTER0_CTRL3, 0x10000362}, {RT5514_DOWNFILTER0_CTRL3, 0x10000362},
...@@ -181,6 +182,7 @@ static bool rt5514_readable_register(struct device *dev, unsigned int reg) ...@@ -181,6 +182,7 @@ static bool rt5514_readable_register(struct device *dev, unsigned int reg)
case RT5514_PLL3_CALIB_CTRL5: case RT5514_PLL3_CALIB_CTRL5:
case RT5514_DELAY_BUF_CTRL1: case RT5514_DELAY_BUF_CTRL1:
case RT5514_DELAY_BUF_CTRL3: case RT5514_DELAY_BUF_CTRL3:
case RT5514_ASRC_IN_CTRL1:
case RT5514_DOWNFILTER0_CTRL1: case RT5514_DOWNFILTER0_CTRL1:
case RT5514_DOWNFILTER0_CTRL2: case RT5514_DOWNFILTER0_CTRL2:
case RT5514_DOWNFILTER0_CTRL3: case RT5514_DOWNFILTER0_CTRL3:
...@@ -238,6 +240,7 @@ static bool rt5514_i2c_readable_register(struct device *dev, ...@@ -238,6 +240,7 @@ static bool rt5514_i2c_readable_register(struct device *dev,
case RT5514_DSP_MAPPING | RT5514_PLL3_CALIB_CTRL5: case RT5514_DSP_MAPPING | RT5514_PLL3_CALIB_CTRL5:
case RT5514_DSP_MAPPING | RT5514_DELAY_BUF_CTRL1: case RT5514_DSP_MAPPING | RT5514_DELAY_BUF_CTRL1:
case RT5514_DSP_MAPPING | RT5514_DELAY_BUF_CTRL3: case RT5514_DSP_MAPPING | RT5514_DELAY_BUF_CTRL3:
case RT5514_DSP_MAPPING | RT5514_ASRC_IN_CTRL1:
case RT5514_DSP_MAPPING | RT5514_DOWNFILTER0_CTRL1: case RT5514_DSP_MAPPING | RT5514_DOWNFILTER0_CTRL1:
case RT5514_DSP_MAPPING | RT5514_DOWNFILTER0_CTRL2: case RT5514_DSP_MAPPING | RT5514_DOWNFILTER0_CTRL2:
case RT5514_DSP_MAPPING | RT5514_DOWNFILTER0_CTRL3: case RT5514_DSP_MAPPING | RT5514_DOWNFILTER0_CTRL3:
......
...@@ -144,6 +144,13 @@ static int fsl_esai_divisor_cal(struct snd_soc_dai *dai, bool tx, u32 ratio, ...@@ -144,6 +144,13 @@ static int fsl_esai_divisor_cal(struct snd_soc_dai *dai, bool tx, u32 ratio,
psr = ratio <= 256 * maxfp ? ESAI_xCCR_xPSR_BYPASS : ESAI_xCCR_xPSR_DIV8; psr = ratio <= 256 * maxfp ? ESAI_xCCR_xPSR_BYPASS : ESAI_xCCR_xPSR_DIV8;
/* Do not loop-search if PM (1 ~ 256) alone can serve the ratio */
if (ratio <= 256) {
pm = ratio;
fp = 1;
goto out;
}
/* Set the max fluctuation -- 0.1% of the max devisor */ /* Set the max fluctuation -- 0.1% of the max devisor */
savesub = (psr ? 1 : 8) * 256 * maxfp / 1000; savesub = (psr ? 1 : 8) * 256 * maxfp / 1000;
......
...@@ -217,6 +217,7 @@ struct fsl_ssi_soc_data { ...@@ -217,6 +217,7 @@ struct fsl_ssi_soc_data {
* @dai_fmt: DAI configuration this device is currently used with * @dai_fmt: DAI configuration this device is currently used with
* @streams: Mask of current active streams: BIT(TX) and BIT(RX) * @streams: Mask of current active streams: BIT(TX) and BIT(RX)
* @i2s_net: I2S and Network mode configurations of SCR register * @i2s_net: I2S and Network mode configurations of SCR register
* (this is the initial settings based on the DAI format)
* @synchronous: Use synchronous mode - both of TX and RX use STCK and SFCK * @synchronous: Use synchronous mode - both of TX and RX use STCK and SFCK
* @use_dma: DMA is used or FIQ with stream filter * @use_dma: DMA is used or FIQ with stream filter
* @use_dual_fifo: DMA with support for dual FIFO mode * @use_dual_fifo: DMA with support for dual FIFO mode
...@@ -829,16 +830,23 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream, ...@@ -829,16 +830,23 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
} }
if (!fsl_ssi_is_ac97(ssi)) { if (!fsl_ssi_is_ac97(ssi)) {
/*
* Keep the ssi->i2s_net intact while having a local variable
* to override settings for special use cases. Otherwise, the
* ssi->i2s_net will lose the settings for regular use cases.
*/
u8 i2s_net = ssi->i2s_net;
/* Normal + Network mode to send 16-bit data in 32-bit frames */ /* Normal + Network mode to send 16-bit data in 32-bit frames */
if (fsl_ssi_is_i2s_cbm_cfs(ssi) && sample_size == 16) if (fsl_ssi_is_i2s_cbm_cfs(ssi) && sample_size == 16)
ssi->i2s_net = SSI_SCR_I2S_MODE_NORMAL | SSI_SCR_NET; i2s_net = SSI_SCR_I2S_MODE_NORMAL | SSI_SCR_NET;
/* Use Normal mode to send mono data at 1st slot of 2 slots */ /* Use Normal mode to send mono data at 1st slot of 2 slots */
if (channels == 1) if (channels == 1)
ssi->i2s_net = SSI_SCR_I2S_MODE_NORMAL; i2s_net = SSI_SCR_I2S_MODE_NORMAL;
regmap_update_bits(regs, REG_SSI_SCR, regmap_update_bits(regs, REG_SSI_SCR,
SSI_SCR_I2S_NET_MASK, ssi->i2s_net); SSI_SCR_I2S_NET_MASK, i2s_net);
} }
/* In synchronous mode, the SSI uses STCCR for capture */ /* In synchronous mode, the SSI uses STCCR for capture */
......
...@@ -72,24 +72,28 @@ config SND_SOC_INTEL_BAYTRAIL ...@@ -72,24 +72,28 @@ config SND_SOC_INTEL_BAYTRAIL
for Baytrail Chromebooks but this option is now deprecated and is for Baytrail Chromebooks but this option is now deprecated and is
not recommended, use SND_SST_ATOM_HIFI2_PLATFORM instead. not recommended, use SND_SST_ATOM_HIFI2_PLATFORM instead.
config SND_SST_ATOM_HIFI2_PLATFORM
tristate
select SND_SOC_COMPRESS
config SND_SST_ATOM_HIFI2_PLATFORM_PCI config SND_SST_ATOM_HIFI2_PLATFORM_PCI
tristate "PCI HiFi2 (Medfield, Merrifield) Platforms" tristate "PCI HiFi2 (Merrifield) Platforms"
depends on X86 && PCI depends on X86 && PCI
select SND_SST_IPC_PCI select SND_SST_IPC_PCI
select SND_SOC_COMPRESS select SND_SST_ATOM_HIFI2_PLATFORM
help help
If you have a Intel Medfield or Merrifield/Edison platform, then If you have a Intel Merrifield/Edison platform, then
enable this option by saying Y or m. Distros will typically not enable this option by saying Y or m. Distros will typically not
enable this option: Medfield devices are not available to enable this option: while Merrifield/Edison can run a mainline
developers and while Merrifield/Edison can run a mainline kernel with kernel with limited functionality it will require a firmware file
limited functionality it will require a firmware file which which is not in the standard firmware tree
is not in the standard firmware tree
config SND_SST_ATOM_HIFI2_PLATFORM config SND_SST_ATOM_HIFI2_PLATFORM_ACPI
tristate "ACPI HiFi2 (Baytrail, Cherrytrail) Platforms" tristate "ACPI HiFi2 (Baytrail, Cherrytrail) Platforms"
default ACPI
depends on X86 && ACPI depends on X86 && ACPI
select SND_SST_IPC_ACPI select SND_SST_IPC_ACPI
select SND_SOC_COMPRESS select SND_SST_ATOM_HIFI2_PLATFORM
select SND_SOC_ACPI_INTEL_MATCH select SND_SOC_ACPI_INTEL_MATCH
select IOSF_MBI select IOSF_MBI
help help
......
...@@ -281,7 +281,7 @@ static int omap_dmic_dai_trigger(struct snd_pcm_substream *substream, ...@@ -281,7 +281,7 @@ static int omap_dmic_dai_trigger(struct snd_pcm_substream *substream,
static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id, static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
unsigned int freq) unsigned int freq)
{ {
struct clk *parent_clk; struct clk *parent_clk, *mux;
char *parent_clk_name; char *parent_clk_name;
int ret = 0; int ret = 0;
...@@ -329,14 +329,21 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id, ...@@ -329,14 +329,21 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
return -ENODEV; return -ENODEV;
} }
mux = clk_get_parent(dmic->fclk);
if (IS_ERR(mux)) {
dev_err(dmic->dev, "can't get fck mux parent\n");
clk_put(parent_clk);
return -ENODEV;
}
mutex_lock(&dmic->mutex); mutex_lock(&dmic->mutex);
if (dmic->active) { if (dmic->active) {
/* disable clock while reparenting */ /* disable clock while reparenting */
pm_runtime_put_sync(dmic->dev); pm_runtime_put_sync(dmic->dev);
ret = clk_set_parent(dmic->fclk, parent_clk); ret = clk_set_parent(mux, parent_clk);
pm_runtime_get_sync(dmic->dev); pm_runtime_get_sync(dmic->dev);
} else { } else {
ret = clk_set_parent(dmic->fclk, parent_clk); ret = clk_set_parent(mux, parent_clk);
} }
mutex_unlock(&dmic->mutex); mutex_unlock(&dmic->mutex);
...@@ -349,6 +356,7 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id, ...@@ -349,6 +356,7 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
dmic->fclk_freq = freq; dmic->fclk_freq = freq;
err_busy: err_busy:
clk_put(mux);
clk_put(parent_clk); clk_put(parent_clk);
return ret; return ret;
......
...@@ -1536,7 +1536,7 @@ static int rsnd_remove(struct platform_device *pdev) ...@@ -1536,7 +1536,7 @@ static int rsnd_remove(struct platform_device *pdev)
return ret; return ret;
} }
static int rsnd_suspend(struct device *dev) static int __maybe_unused rsnd_suspend(struct device *dev)
{ {
struct rsnd_priv *priv = dev_get_drvdata(dev); struct rsnd_priv *priv = dev_get_drvdata(dev);
...@@ -1545,7 +1545,7 @@ static int rsnd_suspend(struct device *dev) ...@@ -1545,7 +1545,7 @@ static int rsnd_suspend(struct device *dev)
return 0; return 0;
} }
static int rsnd_resume(struct device *dev) static int __maybe_unused rsnd_resume(struct device *dev)
{ {
struct rsnd_priv *priv = dev_get_drvdata(dev); struct rsnd_priv *priv = dev_get_drvdata(dev);
......
...@@ -513,7 +513,7 @@ static void remove_widget(struct snd_soc_component *comp, ...@@ -513,7 +513,7 @@ static void remove_widget(struct snd_soc_component *comp,
*/ */
if (dobj->widget.kcontrol_type == SND_SOC_TPLG_TYPE_ENUM) { if (dobj->widget.kcontrol_type == SND_SOC_TPLG_TYPE_ENUM) {
/* enumerated widget mixer */ /* enumerated widget mixer */
for (i = 0; i < w->num_kcontrols; i++) { for (i = 0; w->kcontrols != NULL && i < w->num_kcontrols; i++) {
struct snd_kcontrol *kcontrol = w->kcontrols[i]; struct snd_kcontrol *kcontrol = w->kcontrols[i];
struct soc_enum *se = struct soc_enum *se =
(struct soc_enum *)kcontrol->private_value; (struct soc_enum *)kcontrol->private_value;
...@@ -530,7 +530,7 @@ static void remove_widget(struct snd_soc_component *comp, ...@@ -530,7 +530,7 @@ static void remove_widget(struct snd_soc_component *comp,
} }
} else { } else {
/* volume mixer or bytes controls */ /* volume mixer or bytes controls */
for (i = 0; i < w->num_kcontrols; i++) { for (i = 0; w->kcontrols != NULL && i < w->num_kcontrols; i++) {
struct snd_kcontrol *kcontrol = w->kcontrols[i]; struct snd_kcontrol *kcontrol = w->kcontrols[i];
if (dobj->widget.kcontrol_type if (dobj->widget.kcontrol_type
...@@ -1325,8 +1325,10 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_denum_create( ...@@ -1325,8 +1325,10 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_denum_create(
ec->hdr.name); ec->hdr.name);
kc[i].name = kstrdup(ec->hdr.name, GFP_KERNEL); kc[i].name = kstrdup(ec->hdr.name, GFP_KERNEL);
if (kc[i].name == NULL) if (kc[i].name == NULL) {
kfree(se);
goto err_se; goto err_se;
}
kc[i].private_value = (long)se; kc[i].private_value = (long)se;
kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER; kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER;
kc[i].access = ec->hdr.access; kc[i].access = ec->hdr.access;
...@@ -1442,8 +1444,10 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dbytes_create( ...@@ -1442,8 +1444,10 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dbytes_create(
be->hdr.name, be->hdr.access); be->hdr.name, be->hdr.access);
kc[i].name = kstrdup(be->hdr.name, GFP_KERNEL); kc[i].name = kstrdup(be->hdr.name, GFP_KERNEL);
if (kc[i].name == NULL) if (kc[i].name == NULL) {
kfree(sbe);
goto err; goto err;
}
kc[i].private_value = (long)sbe; kc[i].private_value = (long)sbe;
kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER; kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER;
kc[i].access = be->hdr.access; kc[i].access = be->hdr.access;
...@@ -2576,7 +2580,7 @@ int snd_soc_tplg_component_remove(struct snd_soc_component *comp, u32 index) ...@@ -2576,7 +2580,7 @@ int snd_soc_tplg_component_remove(struct snd_soc_component *comp, u32 index)
/* match index */ /* match index */
if (dobj->index != index && if (dobj->index != index &&
dobj->index != SND_SOC_TPLG_INDEX_ALL) index != SND_SOC_TPLG_INDEX_ALL)
continue; continue;
switch (dobj->type) { switch (dobj->type) {
......
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