Skip to content

Commit

Permalink
Merge tag 'sound-5.10-rc3' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "Quite a bunch of small fixes that have been gathered since the last
  pull, including changes like below:

   - HD-audio runtime PM fixes and refactoring

   - HD-audio and USB-audio quirks

   - SOF warning fix

   - Various ASoC device-specific fixes for Intel, Qualcomm, etc"

* tag 'sound-5.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (26 commits)
  ALSA: usb-audio: Add implicit feedback quirk for Qu-16
  ASoC: mchp-spdiftx: Do not set Validity bit(s)
  ALSA: usb-audio: Add implicit feedback quirk for MODX
  ALSA: usb-audio: add usb vendor id as DSD-capable for Khadas devices
  ALSA: hda/realtek - Enable headphone for ASUS TM420
  ALSA: hda: prevent undefined shift in snd_hdac_ext_bus_get_link()
  ASoC: qcom: lpass-cpu: Fix clock disable failure
  ASoC: qcom: lpass-sc7180: Fix MI2S bitwidth field bit positions
  ASoC: codecs: wcd9335: Set digital gain range correctly
  ASoC: codecs: wcd934x: Set digital gain range correctly
  ALSA: hda: Reinstate runtime_allow() for all hda controllers
  ALSA: hda: Separate runtime and system suspend
  ALSA: hda: Refactor codec PM to use direct-complete optimization
  ALSA: hda/realtek - Fixed HP headset Mic can't be detected
  ALSA: usb-audio: Add implicit feedback quirk for Zoom UAC-2
  ALSA: make snd_kcontrol_new name a normal string
  ALSA: fix kernel-doc markups
  ASoC: SOF: loader: handle all SOF_IPC_EXT types
  ASoC: cs42l51: manage mclk shutdown delay
  ASoC: qcom: sdm845: set driver name correctly
  ...
  • Loading branch information
Linus Torvalds committed Nov 6, 2020
2 parents fc7b66e + a6c9667 commit bb72bbe
Show file tree
Hide file tree
Showing 33 changed files with 265 additions and 117 deletions.
2 changes: 1 addition & 1 deletion include/sound/control.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct snd_kcontrol_new {
snd_ctl_elem_iface_t iface; /* interface identifier */
unsigned int device; /* device/client number */
unsigned int subdevice; /* subdevice (substream) number */
const unsigned char *name; /* ASCII name of item */
const char *name; /* ASCII name of item */
unsigned int index; /* index of item */
unsigned int access; /* access rights */
unsigned int count; /* count of same elements */
Expand Down
3 changes: 2 additions & 1 deletion include/sound/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ void __snd_printk(unsigned int level, const char *file, int line,
#define snd_BUG() WARN(1, "BUG?\n")

/**
* Suppress high rates of output when CONFIG_SND_DEBUG is enabled.
* snd_printd_ratelimit - Suppress high rates of output when
* CONFIG_SND_DEBUG is enabled.
*/
#define snd_printd_ratelimit() printk_ratelimit()

Expand Down
4 changes: 2 additions & 2 deletions include/sound/pcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1284,8 +1284,8 @@ snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs)
}

/**
* snd_pcm_sgbuf_chunk_size - Compute the max size that fits within the contig.
* page from the given size
* snd_pcm_sgbuf_get_chunk_size - Compute the max size that fits within the
* contig. page from the given size
* @substream: PCM substream
* @ofs: byte offset
* @size: byte size to examine
Expand Down
2 changes: 1 addition & 1 deletion include/uapi/sound/compress_offload.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ struct snd_compr_metadata {
__u32 value[8];
} __attribute__((packed, aligned(4)));

/**
/*
* compress path ioctl definitions
* SNDRV_COMPRESS_GET_CAPS: Query capability of DSP
* SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec
Expand Down
4 changes: 2 additions & 2 deletions sound/core/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -1925,8 +1925,8 @@ EXPORT_SYMBOL(snd_ctl_unregister_ioctl);

#ifdef CONFIG_COMPAT
/**
* snd_ctl_unregister_ioctl - de-register the device-specific compat 32bit
* control-ioctls
* snd_ctl_unregister_ioctl_compat - de-register the device-specific compat
* 32bit control-ioctls
* @fcn: ioctl callback function to unregister
*/
int snd_ctl_unregister_ioctl_compat(snd_kctl_ioctl_func_t fcn)
Expand Down
3 changes: 2 additions & 1 deletion sound/core/pcm_dmaengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream)
EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close);

/**
* snd_dmaengine_pcm_release_chan_close - Close a dmaengine based PCM substream and release channel
* snd_dmaengine_pcm_close_release_chan - Close a dmaengine based PCM
* substream and release channel
* @substream: PCM substream
*
* Releases the DMA channel associated with the PCM substream.
Expand Down
2 changes: 1 addition & 1 deletion sound/core/pcm_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ void snd_pcm_set_ops(struct snd_pcm *pcm, int direction,
EXPORT_SYMBOL(snd_pcm_set_ops);

/**
* snd_pcm_sync - set the PCM sync id
* snd_pcm_set_sync - set the PCM sync id
* @substream: the pcm substream
*
* Sets the PCM sync identifier for the card.
Expand Down
4 changes: 2 additions & 2 deletions sound/core/pcm_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void snd_pcm_stream_lock(struct snd_pcm_substream *substream)
EXPORT_SYMBOL_GPL(snd_pcm_stream_lock);

/**
* snd_pcm_stream_lock - Unlock the PCM stream
* snd_pcm_stream_unlock - Unlock the PCM stream
* @substream: PCM substream
*
* This unlocks the PCM stream that has been locked via snd_pcm_stream_lock().
Expand Down Expand Up @@ -595,7 +595,7 @@ static void snd_pcm_sync_stop(struct snd_pcm_substream *substream)
}

/**
* snd_pcm_hw_param_choose - choose a configuration defined by @params
* snd_pcm_hw_params_choose - choose a configuration defined by @params
* @pcm: PCM instance
* @params: the hw_params instance
*
Expand Down
2 changes: 2 additions & 0 deletions sound/hda/ext/hdac_ext_controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus,
return NULL;
if (bus->idx != bus_idx)
return NULL;
if (addr < 0 || addr > 31)
return NULL;

list_for_each_entry(hlink, &bus->hlink_list, list) {
for (i = 0; i < HDA_MAX_CODECS; i++) {
Expand Down
45 changes: 29 additions & 16 deletions sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -2934,7 +2934,7 @@ static void hda_call_codec_resume(struct hda_codec *codec)
snd_hdac_leave_pm(&codec->core);
}

static int hda_codec_runtime_suspend(struct device *dev)
static int hda_codec_suspend(struct device *dev)
{
struct hda_codec *codec = dev_to_hda_codec(dev);
unsigned int state;
Expand All @@ -2953,7 +2953,7 @@ static int hda_codec_runtime_suspend(struct device *dev)
return 0;
}

static int hda_codec_runtime_resume(struct device *dev)
static int hda_codec_resume(struct device *dev)
{
struct hda_codec *codec = dev_to_hda_codec(dev);

Expand All @@ -2967,57 +2967,70 @@ static int hda_codec_runtime_resume(struct device *dev)
pm_runtime_mark_last_busy(dev);
return 0;
}

static int hda_codec_runtime_suspend(struct device *dev)
{
return hda_codec_suspend(dev);
}

static int hda_codec_runtime_resume(struct device *dev)
{
return hda_codec_resume(dev);
}

#endif /* CONFIG_PM */

#ifdef CONFIG_PM_SLEEP
static int hda_codec_force_resume(struct device *dev)
static int hda_codec_pm_prepare(struct device *dev)
{
return pm_runtime_suspended(dev);
}

static void hda_codec_pm_complete(struct device *dev)
{
struct hda_codec *codec = dev_to_hda_codec(dev);
int ret;

ret = pm_runtime_force_resume(dev);
/* schedule jackpoll work for jack detection update */
if (codec->jackpoll_interval ||
(pm_runtime_suspended(dev) && hda_codec_need_resume(codec)))
schedule_delayed_work(&codec->jackpoll_work,
codec->jackpoll_interval);
return ret;
if (pm_runtime_suspended(dev) && (codec->jackpoll_interval ||
hda_codec_need_resume(codec) || codec->forced_resume))
pm_request_resume(dev);
}

static int hda_codec_pm_suspend(struct device *dev)
{
dev->power.power_state = PMSG_SUSPEND;
return pm_runtime_force_suspend(dev);
return hda_codec_suspend(dev);
}

static int hda_codec_pm_resume(struct device *dev)
{
dev->power.power_state = PMSG_RESUME;
return hda_codec_force_resume(dev);
return hda_codec_resume(dev);
}

static int hda_codec_pm_freeze(struct device *dev)
{
dev->power.power_state = PMSG_FREEZE;
return pm_runtime_force_suspend(dev);
return hda_codec_suspend(dev);
}

static int hda_codec_pm_thaw(struct device *dev)
{
dev->power.power_state = PMSG_THAW;
return hda_codec_force_resume(dev);
return hda_codec_resume(dev);
}

static int hda_codec_pm_restore(struct device *dev)
{
dev->power.power_state = PMSG_RESTORE;
return hda_codec_force_resume(dev);
return hda_codec_resume(dev);
}
#endif /* CONFIG_PM_SLEEP */

/* referred in hda_bind.c */
const struct dev_pm_ops hda_codec_driver_pm = {
#ifdef CONFIG_PM_SLEEP
.prepare = hda_codec_pm_prepare,
.complete = hda_codec_pm_complete,
.suspend = hda_codec_pm_suspend,
.resume = hda_codec_pm_resume,
.freeze = hda_codec_pm_freeze,
Expand Down
3 changes: 2 additions & 1 deletion sound/pci/hda/hda_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
/* 24 unused */
#define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */
#define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */
#define AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP (1 << 27) /* Workaround for spurious wakeups after suspend */
/* 27 unused */
#define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */
#define AZX_DCAPS_NO_MSI64 (1 << 29) /* Stick to 32-bit MSIs */
#define AZX_DCAPS_SEPARATE_STREAM_TAG (1 << 30) /* capture and playback use separate stream tag */
Expand Down Expand Up @@ -143,6 +143,7 @@ struct azx {
unsigned int align_buffer_size:1;
unsigned int region_requested:1;
unsigned int disabled:1; /* disabled by vga_switcheroo */
unsigned int pm_prepared:1;

/* GTS present */
unsigned int gts_present:1;
Expand Down
63 changes: 35 additions & 28 deletions sound/pci/hda/hda_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,7 @@ enum {
/* PCH for HSW/BDW; with runtime PM */
/* no i915 binding for this as HSW/BDW has another controller for HDMI */
#define AZX_DCAPS_INTEL_PCH \
(AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME |\
AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP)
(AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME)

/* HSW HDMI */
#define AZX_DCAPS_INTEL_HASWELL \
Expand Down Expand Up @@ -985,7 +984,7 @@ static void __azx_runtime_suspend(struct azx *chip)
display_power(chip, false);
}

static void __azx_runtime_resume(struct azx *chip, bool from_rt)
static void __azx_runtime_resume(struct azx *chip)
{
struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
struct hdac_bus *bus = azx_bus(chip);
Expand All @@ -1002,7 +1001,8 @@ static void __azx_runtime_resume(struct azx *chip, bool from_rt)
azx_init_pci(chip);
hda_intel_init_chip(chip, true);

if (from_rt) {
/* Avoid codec resume if runtime resume is for system suspend */
if (!chip->pm_prepared) {
list_for_each_codec(codec, &chip->bus) {
if (codec->relaxed_resume)
continue;
Expand All @@ -1018,6 +1018,29 @@ static void __azx_runtime_resume(struct azx *chip, bool from_rt)
}

#ifdef CONFIG_PM_SLEEP
static int azx_prepare(struct device *dev)
{
struct snd_card *card = dev_get_drvdata(dev);
struct azx *chip;

chip = card->private_data;
chip->pm_prepared = 1;

/* HDA controller always requires different WAKEEN for runtime suspend
* and system suspend, so don't use direct-complete here.
*/
return 0;
}

static void azx_complete(struct device *dev)
{
struct snd_card *card = dev_get_drvdata(dev);
struct azx *chip;

chip = card->private_data;
chip->pm_prepared = 0;
}

static int azx_suspend(struct device *dev)
{
struct snd_card *card = dev_get_drvdata(dev);
Expand All @@ -1029,15 +1052,7 @@ static int azx_suspend(struct device *dev)

chip = card->private_data;
bus = azx_bus(chip);
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
/* An ugly workaround: direct call of __azx_runtime_suspend() and
* __azx_runtime_resume() for old Intel platforms that suffer from
* spurious wakeups after S3 suspend
*/
if (chip->driver_caps & AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP)
__azx_runtime_suspend(chip);
else
pm_runtime_force_suspend(dev);
__azx_runtime_suspend(chip);
if (bus->irq >= 0) {
free_irq(bus->irq, chip);
bus->irq = -1;
Expand Down Expand Up @@ -1066,11 +1081,7 @@ static int azx_resume(struct device *dev)
if (azx_acquire_irq(chip, 1) < 0)
return -EIO;

if (chip->driver_caps & AZX_DCAPS_SUSPEND_SPURIOUS_WAKEUP)
__azx_runtime_resume(chip, false);
else
pm_runtime_force_resume(dev);
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
__azx_runtime_resume(chip);

trace_azx_resume(chip);
return 0;
Expand Down Expand Up @@ -1118,10 +1129,7 @@ static int azx_runtime_suspend(struct device *dev)
chip = card->private_data;

/* enable controller wake up event */
if (snd_power_get_state(card) == SNDRV_CTL_POWER_D0) {
azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) |
STATESTS_INT_MASK);
}
azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | STATESTS_INT_MASK);

__azx_runtime_suspend(chip);
trace_azx_runtime_suspend(chip);
Expand All @@ -1132,18 +1140,14 @@ static int azx_runtime_resume(struct device *dev)
{
struct snd_card *card = dev_get_drvdata(dev);
struct azx *chip;
bool from_rt = snd_power_get_state(card) == SNDRV_CTL_POWER_D0;

if (!azx_is_pm_ready(card))
return 0;
chip = card->private_data;
__azx_runtime_resume(chip, from_rt);
__azx_runtime_resume(chip);

/* disable controller Wake Up event*/
if (from_rt) {
azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) &
~STATESTS_INT_MASK);
}
azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & ~STATESTS_INT_MASK);

trace_azx_runtime_resume(chip);
return 0;
Expand Down Expand Up @@ -1177,6 +1181,8 @@ static int azx_runtime_idle(struct device *dev)
static const struct dev_pm_ops azx_pm = {
SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume)
#ifdef CONFIG_PM_SLEEP
.prepare = azx_prepare,
.complete = azx_complete,
.freeze_noirq = azx_freeze_noirq,
.thaw_noirq = azx_thaw_noirq,
#endif
Expand Down Expand Up @@ -2356,6 +2362,7 @@ static int azx_probe_continue(struct azx *chip)

if (azx_has_pm_runtime(chip)) {
pm_runtime_use_autosuspend(&pci->dev);
pm_runtime_allow(&pci->dev);
pm_runtime_put_autosuspend(&pci->dev);
}

Expand Down
Loading

0 comments on commit bb72bbe

Please sign in to comment.