Skip to content

Commit

Permalink
Merge tag 'sound-5.0-rc4' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "A significant amount of fixes at this time, mostly for covering the
  recent ASoC issues.

   - Fixes for the missing ASoC driver initialization with non-deferred
     probes; these triggered other problems in chain, which resulted in
     yet more fix commits

   - DaVinci runtime PM fix; the diff looks large but it's just a code
     shuffling

   - Various fixes for ASoC Intel drivers: a regression in HD-A HDMI,
     Kconfig dependency, machine driver adjustments, PLL fix.

   - Other ASoC driver-specific stuff including the trivial fixes caught
     by static analysis

   - Usual HD-audio quirks"

* tag 'sound-5.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (30 commits)
  ALSA: hda - Add mute LED support for HP ProBook 470 G5
  ASoC: amd: Fix potential NULL pointer dereference
  ASoC: imx-audmux: change snprintf to scnprintf for possible overflow
  ASoC: rt5514-spi: Fix potential NULL pointer dereference
  ASoC: dapm: change snprintf to scnprintf for possible overflow
  ASoC: rt5682: Fix PLL source register definitions
  ASoC: core: Don't defer probe on optional, NULL components
  ASoC: core: Make snd_soc_find_component() more robust
  ASoC: soc-core: fix init platform memory handling
  ASoC: intel: skl: Fix display power regression
  ALSA: hda/realtek - Fix typo for ALC225 model
  ASoC: soc-core: Hold client_mutex around soc_init_dai_link()
  ASoC: Intel: Boards: move the codec PLL configuration to _init
  ASoC: soc-core: defer card probe until all component is added to list
  ASoC: atom: fix a missing check of snd_pcm_lib_malloc_pages
  ASoC: tlv320aic32x4: Kernel OOPS while entering DAPM standby mode
  ASoC: ti: davinci-mcasp: Move context save/restore to runtime_pm callbacks
  ASoC: Variable "val" in function rt274_i2c_probe() could be uninitialized
  ASoC: rt5682: Fix recording no sound issue
  ASoC: Intel: atom: Make PCI dependency explicit
  ...
  • Loading branch information
torvalds committed Jan 24, 2019
2 parents 30bac16 + 6993903 commit aa7b984
Show file tree
Hide file tree
Showing 27 changed files with 227 additions and 297 deletions.
6 changes: 6 additions & 0 deletions include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,12 @@ struct snd_soc_dai_link {
/* Do not create a PCM for this DAI link (Backend link) */
unsigned int ignore:1;

/*
* This driver uses legacy platform naming. Set by the core, machine
* drivers should not modify this value.
*/
unsigned int legacy_platform:1;

struct list_head list; /* DAI link list of the soc card */
struct snd_soc_dobj dobj; /* For topology */
};
Expand Down
3 changes: 2 additions & 1 deletion sound/core/compress_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,8 @@ static int snd_compress_check_input(struct snd_compr_params *params)
{
/* first let's check the buffer parameter's */
if (params->buffer.fragment_size == 0 ||
params->buffer.fragments > INT_MAX / params->buffer.fragment_size)
params->buffer.fragments > INT_MAX / params->buffer.fragment_size ||
params->buffer.fragments == 0)
return -EINVAL;

/* now codec parameters */
Expand Down
1 change: 1 addition & 0 deletions sound/pci/hda/patch_conexant.c
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO),
SND_PCI_QUIRK(0x103c, 0x822e, "HP ProBook 440 G4", CXT_FIXUP_MUTE_LED_GPIO),
SND_PCI_QUIRK(0x103c, 0x836e, "HP ProBook 455 G5", CXT_FIXUP_MUTE_LED_GPIO),
SND_PCI_QUIRK(0x103c, 0x837f, "HP ProBook 470 G5", CXT_FIXUP_MUTE_LED_GPIO),
SND_PCI_QUIRK(0x103c, 0x8299, "HP 800 G3 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x103c, 0x8455, "HP Z2 G4", CXT_FIXUP_HP_MIC_NO_PRESENCE),
Expand Down
2 changes: 1 addition & 1 deletion sound/pci/hda/patch_realtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -6926,7 +6926,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
{.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
{.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
{.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
{.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
{.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
{.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
{.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
{.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
Expand Down
6 changes: 4 additions & 2 deletions sound/soc/amd/raven/acp3x-pcm-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,14 +611,16 @@ static int acp3x_audio_probe(struct platform_device *pdev)
}
irqflags = *((unsigned int *)(pdev->dev.platform_data));

adata = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dev_data),
GFP_KERNEL);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(&pdev->dev, "IORESOURCE_IRQ FAILED\n");
return -ENODEV;
}

adata = devm_kzalloc(&pdev->dev, sizeof(*adata), GFP_KERNEL);
if (!adata)
return -ENOMEM;

adata->acp3x_base = devm_ioremap(&pdev->dev, res->start,
resource_size(res));

Expand Down
116 changes: 13 additions & 103 deletions sound/soc/codecs/hdac_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1890,51 +1890,31 @@ static void hdmi_codec_remove(struct snd_soc_component *component)
pm_runtime_disable(&hdev->dev);
}

#ifdef CONFIG_PM
static int hdmi_codec_prepare(struct device *dev)
{
struct hdac_device *hdev = dev_to_hdac_dev(dev);

pm_runtime_get_sync(&hdev->dev);

/*
* Power down afg.
* codec_read is preferred over codec_write to set the power state.
* This way verb is send to set the power state and response
* is received. So setting power state is ensured without using loop
* to read the state.
*/
snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
AC_PWRST_D3);

return 0;
}

static void hdmi_codec_complete(struct device *dev)
#ifdef CONFIG_PM_SLEEP
static int hdmi_codec_resume(struct device *dev)
{
struct hdac_device *hdev = dev_to_hdac_dev(dev);
struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
int ret;

/* Power up afg */
snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
AC_PWRST_D0);

hdac_hdmi_skl_enable_all_pins(hdev);
hdac_hdmi_skl_enable_dp12(hdev);

ret = pm_runtime_force_resume(dev);
if (ret < 0)
return ret;
/*
* As the ELD notify callback request is not entertained while the
* device is in suspend state. Need to manually check detection of
* all pins here. pin capablity change is not support, so use the
* already set pin caps.
*
* NOTE: this is safe to call even if the codec doesn't actually resume.
* The pin check involves only with DRM audio component hooks, so it
* works even if the HD-audio side is still dreaming peacefully.
*/
hdac_hdmi_present_sense_all_pins(hdev, hdmi, false);

pm_runtime_put_sync(&hdev->dev);
return 0;
}
#else
#define hdmi_codec_prepare NULL
#define hdmi_codec_complete NULL
#define hdmi_codec_resume NULL
#endif

static const struct snd_soc_component_driver hdmi_hda_codec = {
Expand Down Expand Up @@ -2135,75 +2115,6 @@ static int hdac_hdmi_dev_remove(struct hdac_device *hdev)
}

#ifdef CONFIG_PM
/*
* Power management sequences
* ==========================
*
* The following explains the PM handling of HDAC HDMI with its parent
* device SKL and display power usage
*
* Probe
* -----
* In SKL probe,
* 1. skl_probe_work() powers up the display (refcount++ -> 1)
* 2. enumerates the codecs on the link
* 3. powers down the display (refcount-- -> 0)
*
* In HDAC HDMI probe,
* 1. hdac_hdmi_dev_probe() powers up the display (refcount++ -> 1)
* 2. probe the codec
* 3. put the HDAC HDMI device to runtime suspend
* 4. hdac_hdmi_runtime_suspend() powers down the display (refcount-- -> 0)
*
* Once children are runtime suspended, SKL device also goes to runtime
* suspend
*
* HDMI Playback
* -------------
* Open HDMI device,
* 1. skl_runtime_resume() invoked
* 2. hdac_hdmi_runtime_resume() powers up the display (refcount++ -> 1)
*
* Close HDMI device,
* 1. hdac_hdmi_runtime_suspend() powers down the display (refcount-- -> 0)
* 2. skl_runtime_suspend() invoked
*
* S0/S3 Cycle with playback in progress
* -------------------------------------
* When the device is opened for playback, the device is runtime active
* already and the display refcount is 1 as explained above.
*
* Entering to S3,
* 1. hdmi_codec_prepare() invoke the runtime resume of codec which just
* increments the PM runtime usage count of the codec since the device
* is in use already
* 2. skl_suspend() powers down the display (refcount-- -> 0)
*
* Wakeup from S3,
* 1. skl_resume() powers up the display (refcount++ -> 1)
* 2. hdmi_codec_complete() invokes the runtime suspend of codec which just
* decrements the PM runtime usage count of the codec since the device
* is in use already
*
* Once playback is stopped, the display refcount is set to 0 as explained
* above in the HDMI playback sequence. The PM handlings are designed in
* such way that to balance the refcount of display power when the codec
* device put to S3 while playback is going on.
*
* S0/S3 Cycle without playback in progress
* ----------------------------------------
* Entering to S3,
* 1. hdmi_codec_prepare() invoke the runtime resume of codec
* 2. skl_runtime_resume() invoked
* 3. hdac_hdmi_runtime_resume() powers up the display (refcount++ -> 1)
* 4. skl_suspend() powers down the display (refcount-- -> 0)
*
* Wakeup from S3,
* 1. skl_resume() powers up the display (refcount++ -> 1)
* 2. hdmi_codec_complete() invokes the runtime suspend of codec
* 3. hdac_hdmi_runtime_suspend() powers down the display (refcount-- -> 0)
* 4. skl_runtime_suspend() invoked
*/
static int hdac_hdmi_runtime_suspend(struct device *dev)
{
struct hdac_device *hdev = dev_to_hdac_dev(dev);
Expand Down Expand Up @@ -2277,8 +2188,7 @@ static int hdac_hdmi_runtime_resume(struct device *dev)

static const struct dev_pm_ops hdac_hdmi_pm = {
SET_RUNTIME_PM_OPS(hdac_hdmi_runtime_suspend, hdac_hdmi_runtime_resume, NULL)
.prepare = hdmi_codec_prepare,
.complete = hdmi_codec_complete,
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, hdmi_codec_resume)
};

static const struct hda_device_id hdmi_list[] = {
Expand Down
11 changes: 4 additions & 7 deletions sound/soc/codecs/pcm512x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1400,24 +1400,20 @@ static int pcm512x_digital_mute(struct snd_soc_dai *dai, int mute)
if (ret != 0) {
dev_err(component->dev,
"Failed to set digital mute: %d\n", ret);
mutex_unlock(&pcm512x->mutex);
return ret;
goto unlock;
}

regmap_read_poll_timeout(pcm512x->regmap,
PCM512x_ANALOG_MUTE_DET,
mute_det, (mute_det & 0x3) == 0,
200, 10000);

mutex_unlock(&pcm512x->mutex);
} else {
pcm512x->mute &= ~0x1;
ret = pcm512x_update_mute(pcm512x);
if (ret != 0) {
dev_err(component->dev,
"Failed to update digital mute: %d\n", ret);
mutex_unlock(&pcm512x->mutex);
return ret;
goto unlock;
}

regmap_read_poll_timeout(pcm512x->regmap,
Expand All @@ -1428,9 +1424,10 @@ static int pcm512x_digital_mute(struct snd_soc_dai *dai, int mute)
200, 10000);
}

unlock:
mutex_unlock(&pcm512x->mutex);

return 0;
return ret;
}

static const struct snd_soc_dai_ops pcm512x_dai_ops = {
Expand Down
5 changes: 4 additions & 1 deletion sound/soc/codecs/rt274.c
Original file line number Diff line number Diff line change
Expand Up @@ -1128,8 +1128,11 @@ static int rt274_i2c_probe(struct i2c_client *i2c,
return ret;
}

regmap_read(rt274->regmap,
ret = regmap_read(rt274->regmap,
RT274_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID), &val);
if (ret)
return ret;

if (val != RT274_VENDOR_ID) {
dev_err(&i2c->dev,
"Device with ID register %#x is not rt274\n", val);
Expand Down
2 changes: 2 additions & 0 deletions sound/soc/codecs/rt5514-spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ static int rt5514_spi_pcm_probe(struct snd_soc_component *component)

rt5514_dsp = devm_kzalloc(component->dev, sizeof(*rt5514_dsp),
GFP_KERNEL);
if (!rt5514_dsp)
return -ENOMEM;

rt5514_dsp->dev = &rt5514_spi->dev;
mutex_init(&rt5514_dsp->dma_lock);
Expand Down
1 change: 1 addition & 0 deletions sound/soc/codecs/rt5682.c
Original file line number Diff line number Diff line change
Expand Up @@ -2512,6 +2512,7 @@ static void rt5682_calibrate(struct rt5682_priv *rt5682)
regmap_write(rt5682->regmap, RT5682_PWR_DIG_1, 0x0000);
regmap_write(rt5682->regmap, RT5682_CHOP_DAC, 0x2000);
regmap_write(rt5682->regmap, RT5682_CALIB_ADC_CTRL, 0x2005);
regmap_write(rt5682->regmap, RT5682_STO1_ADC_MIXER, 0xc0c4);

mutex_unlock(&rt5682->calibrate_mutex);

Expand Down
24 changes: 12 additions & 12 deletions sound/soc/codecs/rt5682.h
Original file line number Diff line number Diff line change
Expand Up @@ -849,18 +849,18 @@
#define RT5682_SCLK_SRC_PLL2 (0x2 << 13)
#define RT5682_SCLK_SRC_SDW (0x3 << 13)
#define RT5682_SCLK_SRC_RCCLK (0x4 << 13)
#define RT5682_PLL1_SRC_MASK (0x3 << 10)
#define RT5682_PLL1_SRC_SFT 10
#define RT5682_PLL1_SRC_MCLK (0x0 << 10)
#define RT5682_PLL1_SRC_BCLK1 (0x1 << 10)
#define RT5682_PLL1_SRC_SDW (0x2 << 10)
#define RT5682_PLL1_SRC_RC (0x3 << 10)
#define RT5682_PLL2_SRC_MASK (0x3 << 8)
#define RT5682_PLL2_SRC_SFT 8
#define RT5682_PLL2_SRC_MCLK (0x0 << 8)
#define RT5682_PLL2_SRC_BCLK1 (0x1 << 8)
#define RT5682_PLL2_SRC_SDW (0x2 << 8)
#define RT5682_PLL2_SRC_RC (0x3 << 8)
#define RT5682_PLL2_SRC_MASK (0x3 << 10)
#define RT5682_PLL2_SRC_SFT 10
#define RT5682_PLL2_SRC_MCLK (0x0 << 10)
#define RT5682_PLL2_SRC_BCLK1 (0x1 << 10)
#define RT5682_PLL2_SRC_SDW (0x2 << 10)
#define RT5682_PLL2_SRC_RC (0x3 << 10)
#define RT5682_PLL1_SRC_MASK (0x3 << 8)
#define RT5682_PLL1_SRC_SFT 8
#define RT5682_PLL1_SRC_MCLK (0x0 << 8)
#define RT5682_PLL1_SRC_BCLK1 (0x1 << 8)
#define RT5682_PLL1_SRC_SDW (0x2 << 8)
#define RT5682_PLL1_SRC_RC (0x3 << 8)



Expand Down
4 changes: 4 additions & 0 deletions sound/soc/codecs/tlv320aic32x4.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,10 @@ static int aic32x4_set_bias_level(struct snd_soc_component *component,
case SND_SOC_BIAS_PREPARE:
break;
case SND_SOC_BIAS_STANDBY:
/* Initial cold start */
if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF)
break;

/* Switch off BCLK_N Divider */
snd_soc_component_update_bits(component, AIC32X4_BCLKN,
AIC32X4_BCLKEN, 0);
Expand Down
24 changes: 12 additions & 12 deletions sound/soc/fsl/imx-audmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,49 +86,49 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
if (!buf)
return -ENOMEM;

ret = snprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n",
ret = scnprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n",
pdcr, ptcr);

if (ptcr & IMX_AUDMUX_V2_PTCR_TFSDIR)
ret += snprintf(buf + ret, PAGE_SIZE - ret,
ret += scnprintf(buf + ret, PAGE_SIZE - ret,
"TxFS output from %s, ",
audmux_port_string((ptcr >> 27) & 0x7));
else
ret += snprintf(buf + ret, PAGE_SIZE - ret,
ret += scnprintf(buf + ret, PAGE_SIZE - ret,
"TxFS input, ");

if (ptcr & IMX_AUDMUX_V2_PTCR_TCLKDIR)
ret += snprintf(buf + ret, PAGE_SIZE - ret,
ret += scnprintf(buf + ret, PAGE_SIZE - ret,
"TxClk output from %s",
audmux_port_string((ptcr >> 22) & 0x7));
else
ret += snprintf(buf + ret, PAGE_SIZE - ret,
ret += scnprintf(buf + ret, PAGE_SIZE - ret,
"TxClk input");

ret += snprintf(buf + ret, PAGE_SIZE - ret, "\n");
ret += scnprintf(buf + ret, PAGE_SIZE - ret, "\n");

if (ptcr & IMX_AUDMUX_V2_PTCR_SYN) {
ret += snprintf(buf + ret, PAGE_SIZE - ret,
ret += scnprintf(buf + ret, PAGE_SIZE - ret,
"Port is symmetric");
} else {
if (ptcr & IMX_AUDMUX_V2_PTCR_RFSDIR)
ret += snprintf(buf + ret, PAGE_SIZE - ret,
ret += scnprintf(buf + ret, PAGE_SIZE - ret,
"RxFS output from %s, ",
audmux_port_string((ptcr >> 17) & 0x7));
else
ret += snprintf(buf + ret, PAGE_SIZE - ret,
ret += scnprintf(buf + ret, PAGE_SIZE - ret,
"RxFS input, ");

if (ptcr & IMX_AUDMUX_V2_PTCR_RCLKDIR)
ret += snprintf(buf + ret, PAGE_SIZE - ret,
ret += scnprintf(buf + ret, PAGE_SIZE - ret,
"RxClk output from %s",
audmux_port_string((ptcr >> 12) & 0x7));
else
ret += snprintf(buf + ret, PAGE_SIZE - ret,
ret += scnprintf(buf + ret, PAGE_SIZE - ret,
"RxClk input");
}

ret += snprintf(buf + ret, PAGE_SIZE - ret,
ret += scnprintf(buf + ret, PAGE_SIZE - ret,
"\nData received from %s\n",
audmux_port_string((pdcr >> 13) & 0x7));

Expand Down
2 changes: 1 addition & 1 deletion sound/soc/intel/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ config SND_SST_ATOM_HIFI2_PLATFORM_PCI
config SND_SST_ATOM_HIFI2_PLATFORM_ACPI
tristate "ACPI HiFi2 (Baytrail, Cherrytrail) Platforms"
default ACPI
depends on X86 && ACPI
depends on X86 && ACPI && PCI
select SND_SST_IPC_ACPI
select SND_SST_ATOM_HIFI2_PLATFORM
select SND_SOC_ACPI_INTEL_MATCH
Expand Down
Loading

0 comments on commit aa7b984

Please sign in to comment.