mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
Merge tag 'sound-7.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai:
"A collection of (unsurprisingly high amount of) small fixes since the
previous PR. Majority of changes are device-specific quirks and driver
fixes, along with a few ALSA core fixes and USB-audio driver
hardening.
ALSA Core:
- Fix page leak on WC DMA buffer allocation failure
- Prevent O_APPEND on OSS streams to avoid UAF
- A PCM regression fix for PulseAudio to allow hw_refine with mmap
- Serialize DSP image loading requests in hwdep
- Clear user-provided numid before adding a control
- Fix dropped data bytes in UMP to MIDI 1.0 System message conversion
HD-audio:
- Fix double-free on stream page allocation failure in core
- Stop capability walk cleanly on empty capability header
- Fix silent output on Nvidia codecs due to shared converters
- Restore audio registers after AE-5 LED strip transmission
- Calibration data validation and custom address fixes for TAS2781
- Shared boot wait and reset helpers for CS35L41
- Cleanups and fixes for CS35L56 and AW88399
- Add Tegra268 HDMI/DP codec ID
- Device quirks for Acer, Alienware, ASUS, HP, Huawei, Lenovo, MSI
USB-audio:
- Hardening and bug fixes for usx2y and us122l drivers
- Delay MIDI URB retry on -EPIPE to allow disconnect handling
- Fix use-after-free of MIDI URBs on close in bcd2000
- Reject undersized capture buffers in line6 driver
- Fix URB leak on input setup failure in caiaq driver
- Check return value of qmi_handle_init() in Qualcomm offload driver
- Quirks for Yamaha ZG02, HIK camera, and CVT Touch Device
ASoC:
- AMD: Support more ACP7.0 projects, quirks for HP and Lenovo models
- Intel: Dummy topology for SN624x codec, SOF BPT DMA stream fix
- Qualcomm: Guard q6apm callbacks, fix runtime PM refcount leak
- Rockchip: Add missing REGMAP_MMIO Kconfig dependencies
- Meson: Request IRQ with clock enabled in axg-fifo
- Codec fixes for cs35l41, cs_dsp, wm_adsp, wm8904, ES8389, tas2770,
sn624x, and aw88399
Misc:
- FireWire: Fix inverted streaming speed in firewire-tascam
- PCI: Check SCB creation failures in legacy cs46xx driver"
* tag 'sound-7.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (72 commits)
ALSA: hda/realtek: Add quirk for Acer Predator PHN16-71
ALSA: hda/realtek: Use inverted mute LED quirk for HP ZBook 8 G2a
ALSA: hda: cs35l41: Add support for HP OmniBook 7 Laptop 16-ay0xxx
ALSA: usx2y: Guard the playback copy
ALSA: usx2y: Require a buffer of two URBs
ALSA: hda: cs35l56: Stop cs_dsp before calling cs_dsp_power_down()
ALSA: doc: cs35l56: Update calibration write failure message info
ALSA: hda: cs35l56: Fix mixed cleanup and goto in cs35l56_hda_fw_load()
ALSA: hda/tegra: Add Tegra268 HDMI/DP codec ID
ALSA: hda/realtek: Fix pop noise on ASUS PRIME B650M-K
ALSA: hda/realtek: Fix DAC binding for Legion Pro 7 16ARX8H variant
ALSA: hda/realtek: Fix DAC binding for Lenovo Legion Pro 7 16ARX8H
ALSA: caiaq: free the EP4 URB when input setup fails
ALSA: line6: Reject capture buffers smaller than two packets
ALSA: pcm: Allow HW_REFINE queries with mapped buffers
ALSA: hda/ca0132: Restore AE-5 audio registers after LED strip send
ALSA: hda/tas2781: Only accept CRC-less V1 data if all entries are valid
ALSA: hda/realtek: Enable mute and mic-mute LEDs on HP ENVY 17-cr0xxx
ALSA: usb-audio: Add quirk for Yamaha ZG02
ALSA: pcm: Prevent O_APPEND open on OSS streams
...
This commit is contained in:
@@ -235,19 +235,28 @@ No %s for algorithm %x
|
||||
HDA driver did not find a .bin file that matches this hardware.
|
||||
|
||||
Calibration disabled due to missing firmware controls
|
||||
Driver was not able to write EFI calibration data to firmware registers.
|
||||
This typically means that either:
|
||||
This isn't necessarily an error, only informative. The amplifier can
|
||||
operate without calibration, as the firmware contains a default
|
||||
calibration for the speakers, but it will tend to over-protect the
|
||||
speakers.
|
||||
|
||||
* The driver did not find a suitable wmfw for this hardware, or
|
||||
This message typically means that either:
|
||||
* The driver did not find a suitable firmware .wmfw file for this
|
||||
hardware, or
|
||||
* The amplifier has already been patched with firmware by something
|
||||
previously, and the driver does not have control of a hard RESET line
|
||||
to be able to reset the amplifier and download the firmware files it
|
||||
found. This situation is indicated by the device identification
|
||||
string in the kernel log shows "(patched=1)"
|
||||
string in the kernel log showing "(patched=1)"
|
||||
|
||||
Failed to write calibration
|
||||
Same meaning and cause as "Calibration disabled due to missing firmware
|
||||
controls"
|
||||
If the error code is -2 (ENOENT):
|
||||
* The driver has been unbound and rebound without reprobing.
|
||||
* The wrong firmware .wmfw file was loaded for this hardware so the
|
||||
algorithm IDs in the firmware do not match what the driver is
|
||||
looking for.
|
||||
|
||||
Other error codes likely indicate a problem communicating with the hardware.
|
||||
|
||||
Failed to read calibration data from EFI
|
||||
Factory calibration data in EFI is missing, empty or corrupt.
|
||||
|
||||
@@ -2793,6 +2793,7 @@ int cs_dsp_power_up(struct cs_dsp *dsp,
|
||||
const struct firmware *coeff_firmware, const char *coeff_filename,
|
||||
const char *fw_name)
|
||||
{
|
||||
struct cs_dsp_coeff_ctl *ctl;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&dsp->pwr_lock);
|
||||
@@ -2838,6 +2839,11 @@ int cs_dsp_power_up(struct cs_dsp *dsp,
|
||||
|
||||
return 0;
|
||||
err_ena:
|
||||
list_for_each_entry(ctl, &dsp->ctl_list, list)
|
||||
ctl->enabled = 0;
|
||||
|
||||
cs_dsp_free_alg_regions(dsp);
|
||||
|
||||
if (dsp->ops->disable_core)
|
||||
dsp->ops->disable_core(dsp);
|
||||
err_mem:
|
||||
|
||||
@@ -924,5 +924,7 @@ bool cs35l41_safe_reset(struct regmap *regmap, enum cs35l41_boost_type b_type);
|
||||
int cs35l41_mdsync_up(struct regmap *regmap);
|
||||
int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l41_boost_type b_type,
|
||||
int enable, struct cs_dsp *dsp);
|
||||
int cs35l41_wait_boot_done(struct device *dev, struct regmap *regmap);
|
||||
int cs35l41_reset_and_boot(struct device *dev, struct regmap *regmap);
|
||||
|
||||
#endif /* __CS35L41_H */
|
||||
|
||||
@@ -57,6 +57,7 @@ struct snd_hwdep {
|
||||
|
||||
struct mutex open_mutex;
|
||||
int used; /* reference counter */
|
||||
struct mutex dsp_mutex; /* serializes DSP load requests */
|
||||
unsigned int dsp_loaded; /* bit fields of loaded dsp indices */
|
||||
unsigned int exclusive:1; /* exclusive access mode */
|
||||
};
|
||||
|
||||
@@ -1759,9 +1759,10 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
|
||||
if (strnlen(info->id.name, sizeof(info->id.name)) >= sizeof(info->id.name))
|
||||
return -EINVAL;
|
||||
|
||||
info->id.numid = 0;
|
||||
|
||||
/* Delete a control to replace them if needed. */
|
||||
if (replace) {
|
||||
info->id.numid = 0;
|
||||
err = snd_ctl_remove_user_ctl(file, &info->id);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -212,6 +212,7 @@ static int snd_hwdep_dsp_load(struct snd_hwdep *hw,
|
||||
return -ENXIO;
|
||||
if (info->index >= 32)
|
||||
return -EINVAL;
|
||||
guard(mutex)(&hw->dsp_mutex);
|
||||
/* check whether the dsp was already loaded */
|
||||
if (hw->dsp_loaded & (1u << info->index))
|
||||
return -EBUSY;
|
||||
@@ -380,6 +381,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,
|
||||
|
||||
init_waitqueue_head(&hwdep->open_wait);
|
||||
mutex_init(&hwdep->open_mutex);
|
||||
mutex_init(&hwdep->dsp_mutex);
|
||||
hwdep->card = card;
|
||||
hwdep->device = device;
|
||||
if (id)
|
||||
|
||||
@@ -506,7 +506,7 @@ static void *snd_dma_wc_alloc(struct snd_dma_buffer *dmab, size_t size)
|
||||
return NULL;
|
||||
dmab->addr = dma_map_single(dmab->dev.dev, p, size, DMA_BIDIRECTIONAL);
|
||||
if (dma_mapping_error(dmab->dev.dev, dmab->addr)) {
|
||||
do_free_pages(dmab->area, size, true);
|
||||
do_free_pages(p, size, true);
|
||||
return NULL;
|
||||
}
|
||||
return p;
|
||||
|
||||
@@ -929,6 +929,8 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
|
||||
return -ENODEV;
|
||||
if (! SUBSTREAM_BUSY(substream))
|
||||
return -EBADFD;
|
||||
if (is_oss_stream(substream))
|
||||
return -EINVAL;
|
||||
substream->ref_count++;
|
||||
*rsubstream = substream;
|
||||
return 0;
|
||||
|
||||
@@ -80,4 +80,10 @@ static inline void snd_pcm_dma_buffer_sync(struct snd_pcm_substream *substream,
|
||||
snd_dma_buffer_sync(snd_pcm_get_dma_buf(substream), mode);
|
||||
}
|
||||
|
||||
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
|
||||
#define is_oss_stream(substream) ((substream)->oss.oss)
|
||||
#else
|
||||
#define is_oss_stream(substream) false
|
||||
#endif
|
||||
|
||||
#endif /* __SOUND_CORE_PCM_LOCAL_H */
|
||||
|
||||
+6
-10
@@ -749,12 +749,6 @@ int snd_pcm_runtime_buffer_set_silence(struct snd_pcm_runtime *runtime)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_pcm_runtime_buffer_set_silence);
|
||||
|
||||
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
|
||||
#define is_oss_stream(substream) ((substream)->oss.oss)
|
||||
#else
|
||||
#define is_oss_stream(substream) false
|
||||
#endif
|
||||
|
||||
static void pcm_qos_req_clear(struct snd_pcm_substream *substream)
|
||||
{
|
||||
if (cpu_latency_qos_request_active(&substream->latency_pm_qos_req))
|
||||
@@ -776,14 +770,15 @@ static void pcm_qos_req_update(struct snd_pcm_substream *substream, int usecs)
|
||||
usecs);
|
||||
}
|
||||
|
||||
static int hw_params_state_check(struct snd_pcm_substream *substream)
|
||||
static int hw_params_state_check(struct snd_pcm_substream *substream,
|
||||
bool check_mmap)
|
||||
{
|
||||
guard(pcm_stream_lock_irq)(substream);
|
||||
switch (substream->runtime->state) {
|
||||
case SNDRV_PCM_STATE_OPEN:
|
||||
case SNDRV_PCM_STATE_SETUP:
|
||||
case SNDRV_PCM_STATE_PREPARED:
|
||||
if (!is_oss_stream(substream) &&
|
||||
if (check_mmap && !is_oss_stream(substream) &&
|
||||
atomic_read(&substream->mmap_count))
|
||||
return -EBADFD;
|
||||
return 0;
|
||||
@@ -806,7 +801,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
err = snd_pcm_buffer_access_lock(runtime);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = hw_params_state_check(substream);
|
||||
err = hw_params_state_check(substream, true);
|
||||
if (err)
|
||||
goto unlock;
|
||||
|
||||
@@ -944,7 +939,8 @@ static int snd_pcm_hw_refine_with_lock(struct snd_pcm_substream *substream,
|
||||
err = snd_pcm_buffer_access_lock(runtime);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = hw_params_state_check(substream);
|
||||
/* Refinement queries constraints without changing the mapped buffer. */
|
||||
err = hw_params_state_check(substream, false);
|
||||
if (err)
|
||||
goto unlock;
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ static u32 upscale_14_to_32bit(u16 src)
|
||||
static int cvt_ump_system_to_legacy(u32 data, unsigned char *buf)
|
||||
{
|
||||
buf[0] = ump_message_status_channel(data);
|
||||
switch (ump_message_status_code(data)) {
|
||||
switch (buf[0]) {
|
||||
case UMP_SYSTEM_STATUS_MIDI_TIME_CODE:
|
||||
case UMP_SYSTEM_STATUS_SONG_SELECT:
|
||||
buf[1] = (data >> 8) & 0x7f;
|
||||
|
||||
@@ -287,10 +287,10 @@ static int keep_resources(struct snd_tscm *tscm, unsigned int rate,
|
||||
|
||||
if (stream == &tscm->tx_stream) {
|
||||
resources = &tscm->tx_resources;
|
||||
speed = fw_parent_device(tscm->unit)->max_speed;
|
||||
speed = SCODE_400;
|
||||
} else {
|
||||
resources = &tscm->rx_resources;
|
||||
speed = SCODE_400;
|
||||
speed = fw_parent_device(tscm->unit)->max_speed;
|
||||
}
|
||||
|
||||
err = amdtp_tscm_set_parameters(stream, rate);
|
||||
|
||||
@@ -8416,6 +8416,10 @@ static int ae5_strip_send_frame(struct hda_codec *codec, const u32 *grb_colors,
|
||||
struct hdac_stream *hstr = NULL;
|
||||
unsigned int format, stream_tag;
|
||||
u32 enc_words[4];
|
||||
struct {
|
||||
u32 r100, r104, r400, r408, r40c, r410, rc04;
|
||||
u32 ser_base[4], ser_clk[4], ser_out[4];
|
||||
} saved;
|
||||
__le32 *dst;
|
||||
int word_idx = 0;
|
||||
int frame_words;
|
||||
@@ -8501,6 +8505,24 @@ static int ae5_strip_send_frame(struct hda_codec *codec, const u32 *grb_colors,
|
||||
/* Ensure DMA buffer writes are committed before triggering the HDA stream */
|
||||
wmb();
|
||||
|
||||
/*
|
||||
* Save every BAR2 register the strip transport reprograms, so that the
|
||||
* audio serializer/clock/routing setup done at codec init can be put
|
||||
* back afterwards. Leaving them modified silences the analog outputs.
|
||||
*/
|
||||
saved.r100 = readl(spec->mem_base + 0x100);
|
||||
saved.r104 = readl(spec->mem_base + 0x104);
|
||||
saved.r400 = readl(spec->mem_base + 0x400);
|
||||
saved.r408 = readl(spec->mem_base + 0x408);
|
||||
saved.r40c = readl(spec->mem_base + 0x40c);
|
||||
saved.r410 = readl(spec->mem_base + 0x410);
|
||||
saved.rc04 = readl(spec->mem_base + 0xc04);
|
||||
for (i = 0; i < 4; i++) {
|
||||
saved.ser_base[i] = readl(CA0113_SERIALIZER_BASE(spec, i));
|
||||
saved.ser_clk[i] = readl(CA0113_SERIALIZER_CLK(spec, i));
|
||||
saved.ser_out[i] = readl(CA0113_SERIALIZER_OUT(spec, i));
|
||||
}
|
||||
|
||||
/* 2. Configure CA0113 BAR2 hardware registers */
|
||||
/* Power up clocks (CtxHdb 0x141b7 / 0x14210) */
|
||||
writel(readl(spec->mem_base + 0xc04) | 0x7, spec->mem_base + 0xc04);
|
||||
@@ -8559,8 +8581,19 @@ static int ae5_strip_send_frame(struct hda_codec *codec, const u32 *grb_colors,
|
||||
snd_hdac_dsp_trigger(hstr, false);
|
||||
codec_dbg(codec, "AE5 strip: trigger complete\n");
|
||||
|
||||
/* Teardown: clear 0x104 pin mux back to 0 */
|
||||
writel(0x00000000, spec->mem_base + 0x104);
|
||||
/* Teardown: put back the registers exactly as the audio path left them */
|
||||
writel(saved.r104, spec->mem_base + 0x104);
|
||||
for (i = 0; i < 4; i++) {
|
||||
writel(saved.ser_out[i], CA0113_SERIALIZER_OUT(spec, i));
|
||||
writel(saved.ser_clk[i], CA0113_SERIALIZER_CLK(spec, i));
|
||||
writel(saved.ser_base[i], CA0113_SERIALIZER_BASE(spec, i));
|
||||
}
|
||||
writel(saved.r100, spec->mem_base + 0x100);
|
||||
writel(saved.r410, spec->mem_base + 0x410);
|
||||
writel(saved.r40c, spec->mem_base + 0x40c);
|
||||
writel(saved.r408, spec->mem_base + 0x408);
|
||||
writel(saved.r400, spec->mem_base + 0x400);
|
||||
writel(saved.rc04, spec->mem_base + 0xc04);
|
||||
|
||||
snd_hdac_dsp_cleanup(hstr, &dmab);
|
||||
scoped_guard(spinlock_irq, &bus->reg_lock)
|
||||
@@ -8613,6 +8646,12 @@ static int ae5_strip_ctl_put(struct snd_kcontrol *kcontrol,
|
||||
}
|
||||
change = memcmp(spec->ae5_strip_cur_colors, colors,
|
||||
sizeof(spec->ae5_strip_cur_colors)) != 0;
|
||||
/*
|
||||
* alsactl restores this control at every card probe with the saved
|
||||
* values; do not run the whole transmit routine when nothing changed.
|
||||
*/
|
||||
if (!change)
|
||||
return 0;
|
||||
num_leds = spec->ae5_strip_cur_num_leds;
|
||||
ret = ae5_strip_send_frame(codec, colors, num_leds);
|
||||
if (ret < 0)
|
||||
|
||||
@@ -1193,6 +1193,7 @@ static const struct hda_quirk cxt5066_fixups[] = {
|
||||
SND_PCI_QUIRK(0x1025, 0x1937, "Acer Aspire Go 16", CXT_FIXUP_ACER_ASPIRE_GO_MUTE_LED),
|
||||
SND_PCI_QUIRK(0x103c, 0x8079, "HP EliteBook 840 G3", CXT_FIXUP_HP_DOCK),
|
||||
SND_PCI_QUIRK(0x103c, 0x807C, "HP EliteBook 820 G3", CXT_FIXUP_HP_DOCK),
|
||||
SND_PCI_QUIRK(0x103c, 0x80d6, "HP ZBook 17 G3", CXT_FIXUP_MUTE_LED_GPIO),
|
||||
SND_PCI_QUIRK(0x103c, 0x80FD, "HP ProBook 640 G2", CXT_FIXUP_HP_DOCK),
|
||||
SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC),
|
||||
SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO),
|
||||
|
||||
@@ -66,6 +66,102 @@ static const struct drm_audio_component_audio_ops nvhdmi_audio_ops = {
|
||||
.master_unbind = snd_hda_hdmi_acomp_master_unbind,
|
||||
};
|
||||
|
||||
/*
|
||||
* All pins of these codecs share one connection list, as on Intel. An idle
|
||||
* pin left selecting the converter that another pin streams on takes that
|
||||
* stream: the display that plays stays silent and the audio goes to the
|
||||
* other display instead. Seen on GB202 (0x10de00aa) with an HDMI TV and a
|
||||
* DP monitor: whenever the monitor's PCM was opened first (PipeWire probes
|
||||
* every PCM at start-up), its pin kept the converter the TV got next.
|
||||
*
|
||||
* Move every other connected pin off the converter just assigned, to a
|
||||
* converter nobody uses.
|
||||
*/
|
||||
static void nvhdmi_not_share_assigned_cvt(struct hda_codec *codec,
|
||||
hda_nid_t pin_nid, int dev_id,
|
||||
hda_nid_t cvt_nid)
|
||||
{
|
||||
struct hdmi_spec *spec = codec->spec;
|
||||
struct hdmi_spec_per_pin *per_pin;
|
||||
struct hdmi_spec_per_cvt *per_cvt;
|
||||
int pin_idx, cvt_idx, mux_idx, curr, dev_id_saved;
|
||||
|
||||
if (!cvt_nid)
|
||||
return;
|
||||
|
||||
for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
|
||||
per_pin = get_pin(spec, pin_idx);
|
||||
/* no display on this pin */
|
||||
if (!per_pin->pcm)
|
||||
continue;
|
||||
if (per_pin->pin_nid == pin_nid && per_pin->dev_id == dev_id)
|
||||
continue;
|
||||
if (per_pin->dev_id >=
|
||||
snd_hda_get_num_devices(codec, per_pin->pin_nid) + 1)
|
||||
continue;
|
||||
|
||||
dev_id_saved = snd_hda_get_dev_select(codec, per_pin->pin_nid);
|
||||
snd_hda_set_dev_select(codec, per_pin->pin_nid, per_pin->dev_id);
|
||||
curr = snd_hda_codec_read(codec, per_pin->pin_nid, 0,
|
||||
AC_VERB_GET_CONNECT_SEL, 0);
|
||||
if (curr < 0 || curr >= per_pin->num_mux_nids ||
|
||||
per_pin->mux_nids[curr] != cvt_nid)
|
||||
goto restore;
|
||||
|
||||
for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) {
|
||||
per_cvt = get_cvt(spec, cvt_idx);
|
||||
if (per_cvt->assigned || per_cvt->cvt_nid == cvt_nid)
|
||||
continue;
|
||||
for (mux_idx = 0; mux_idx < per_pin->num_mux_nids; mux_idx++)
|
||||
if (per_pin->mux_nids[mux_idx] == per_cvt->cvt_nid)
|
||||
break;
|
||||
if (mux_idx == per_pin->num_mux_nids)
|
||||
continue;
|
||||
codec_dbg(codec,
|
||||
"hdmi: move pin 0x%x off cvt 0x%x to cvt 0x%x\n",
|
||||
per_pin->pin_nid, cvt_nid, per_cvt->cvt_nid);
|
||||
snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0,
|
||||
AC_VERB_SET_CONNECT_SEL,
|
||||
mux_idx);
|
||||
break;
|
||||
}
|
||||
restore:
|
||||
snd_hda_set_dev_select(codec, per_pin->pin_nid, dev_id_saved);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The hardware can drop a pin's converter selection, e.g. on a display
|
||||
* reset. snd_hda_hdmi_generic_pcm_prepare() relies on pin_cvt_fixup() to
|
||||
* restore it, as i915_pin_cvt_fixup() does on Intel.
|
||||
*/
|
||||
static void nvhdmi_verify_pin_cvt_connect(struct hda_codec *codec,
|
||||
struct hdmi_spec_per_pin *per_pin)
|
||||
{
|
||||
int curr;
|
||||
|
||||
curr = snd_hda_codec_read(codec, per_pin->pin_nid, 0,
|
||||
AC_VERB_GET_CONNECT_SEL, 0);
|
||||
if (curr != per_pin->mux_idx)
|
||||
snd_hda_codec_write_cache(codec, per_pin->pin_nid, 0,
|
||||
AC_VERB_SET_CONNECT_SEL,
|
||||
per_pin->mux_idx);
|
||||
}
|
||||
|
||||
static void nvhdmi_pin_cvt_fixup(struct hda_codec *codec,
|
||||
struct hdmi_spec_per_pin *per_pin,
|
||||
hda_nid_t cvt_nid)
|
||||
{
|
||||
if (per_pin) {
|
||||
snd_hda_set_dev_select(codec, per_pin->pin_nid, per_pin->dev_id);
|
||||
nvhdmi_verify_pin_cvt_connect(codec, per_pin);
|
||||
nvhdmi_not_share_assigned_cvt(codec, per_pin->pin_nid,
|
||||
per_pin->dev_id, per_pin->cvt_nid);
|
||||
} else {
|
||||
nvhdmi_not_share_assigned_cvt(codec, 0, 0, cvt_nid);
|
||||
}
|
||||
}
|
||||
|
||||
static int probe_generic(struct hda_codec *codec)
|
||||
{
|
||||
struct hdmi_spec *spec;
|
||||
@@ -77,6 +173,7 @@ static int probe_generic(struct hda_codec *codec)
|
||||
codec->dp_mst = true;
|
||||
|
||||
spec = codec->spec;
|
||||
spec->ops.pin_cvt_fixup = nvhdmi_pin_cvt_fixup;
|
||||
|
||||
err = snd_hda_hdmi_parse_codec(codec);
|
||||
if (err < 0) {
|
||||
|
||||
@@ -338,6 +338,7 @@ static const struct hda_device_id snd_hda_id_tegrahdmi[] = {
|
||||
HDA_CODEC_ID_MODEL(0x10de0033, "SoC 33 HDMI/DP", MODEL_TEGRA234),
|
||||
HDA_CODEC_ID_MODEL(0x10de0034, "Tegra264 HDMI/DP", MODEL_TEGRA234),
|
||||
HDA_CODEC_ID_MODEL(0x10de0035, "SoC 35 HDMI/DP", MODEL_TEGRA234),
|
||||
HDA_CODEC_ID_MODEL(0x10de0037, "Tegra268 HDMI/DP", MODEL_TEGRA234),
|
||||
{} /* terminator */
|
||||
};
|
||||
MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_tegrahdmi);
|
||||
|
||||
@@ -4330,6 +4330,7 @@ enum {
|
||||
ALC255_FIXUP_DELL_HEADSET_MIC,
|
||||
ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
|
||||
ALC256_FIXUP_HUAWEI_MACHR_WX9_PINS,
|
||||
ALC256_FIXUP_HUAWEI_MACHC_WAX9_PINS,
|
||||
ALC298_FIXUP_HUAWEI_MBX_STEREO,
|
||||
ALC295_FIXUP_HP_X360,
|
||||
ALC295_FIXUP_HP_PAVILION_X360,
|
||||
@@ -4552,6 +4553,7 @@ enum {
|
||||
ALC256_FIXUP_IPASON_SMARTBOOK_S1,
|
||||
ALC256_FIXUP_ASUS_SPEAKER_COEFS,
|
||||
ALC245_FIXUP_MINISFORUM_V3_MIC_NO_PRESENCE,
|
||||
ALC287_FIXUP_TAS2781_I2C_DAC,
|
||||
};
|
||||
|
||||
/* A special fixup for Lenovo C940 and Yoga Duet 7;
|
||||
@@ -5063,6 +5065,15 @@ static const struct hda_fixup alc269_fixups[] = {
|
||||
.chained = true,
|
||||
.chain_id = ALC269_FIXUP_HEADSET_MODE
|
||||
},
|
||||
[ALC256_FIXUP_HUAWEI_MACHC_WAX9_PINS] = {
|
||||
.type = HDA_FIXUP_PINS,
|
||||
.v.pins = (const struct hda_pintbl[]) {
|
||||
{ 0x19, 0x04a11140 }, /* use as headset mic, without its own jack detect */
|
||||
{ }
|
||||
},
|
||||
.chained = true,
|
||||
.chain_id = ALC269_FIXUP_HEADSET_MODE
|
||||
},
|
||||
[ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
|
||||
.type = HDA_FIXUP_FUNC,
|
||||
.v.func = alc298_fixup_huawei_mbx_stereo,
|
||||
@@ -7051,6 +7062,12 @@ static const struct hda_fixup alc269_fixups[] = {
|
||||
.chained = true,
|
||||
.chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
|
||||
},
|
||||
[ALC287_FIXUP_TAS2781_I2C_DAC] = {
|
||||
.type = HDA_FIXUP_FUNC,
|
||||
.v.func = alc295_fixup_asus_dacs,
|
||||
.chained_before = true,
|
||||
.chain_id = ALC287_FIXUP_TAS2781_I2C,
|
||||
},
|
||||
[ALC287_FIXUP_ASUS_ALLY_X] = {
|
||||
.type = HDA_FIXUP_PINS,
|
||||
.v.pins = (const struct hda_pintbl[]) {
|
||||
@@ -7533,6 +7550,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
|
||||
SND_PCI_QUIRK(0x1025, 0x166c, "Acer Predator PH16-71", ALC2XX_FIXUP_HEADSET_MIC),
|
||||
SND_PCI_QUIRK(0x1025, 0x1679, "Acer Nitro 16 AN16-41", ALC2XX_FIXUP_HEADSET_MIC),
|
||||
SND_PCI_QUIRK(0x1025, 0x169a, "Acer Swift SFG16", ALC256_FIXUP_ACER_SFG16_MICMUTE_LED),
|
||||
SND_PCI_QUIRK(0x1025, 0x170f, "Acer Predator PHN16-71", ALC2XX_FIXUP_HEADSET_MIC),
|
||||
SND_PCI_QUIRK(0x1025, 0x171e, "Acer Nitro ANV15-51", ALC245_FIXUP_ACER_MICMUTE_LED),
|
||||
SND_PCI_QUIRK(0x1025, 0x172c, "Acer Nitro ANV16-41", ALC2XX_FIXUP_HEADSET_MIC),
|
||||
SND_PCI_QUIRK(0x1025, 0x1731, "Acer Predator PHN16-72", ALC2XX_FIXUP_HEADSET_MIC),
|
||||
@@ -7594,6 +7612,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
|
||||
SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
|
||||
SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
|
||||
SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
|
||||
SND_PCI_QUIRK(0x1028, 0x09d1, "Alienware m17 R3", ALC289_FIXUP_DUAL_SPK),
|
||||
SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
|
||||
SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
|
||||
SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET),
|
||||
@@ -7867,7 +7886,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
|
||||
SND_PCI_QUIRK(0x103c, 0x8a2b, "HP Envy 15", ALC287_FIXUP_CS35L41_I2C_2),
|
||||
SND_PCI_QUIRK(0x103c, 0x8a2c, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
|
||||
SND_PCI_QUIRK(0x103c, 0x8a2d, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
|
||||
SND_PCI_QUIRK(0x103c, 0x8a2e, "HP Envy 16", ALC287_FIXUP_CS35L41_I2C_2),
|
||||
SND_PCI_QUIRK(0x103c, 0x8a2e, "HP ENVY Laptop 17-cr0xxx", ALC287_FIXUP_CS35L41_I2C_2_HP_MUTE_LEDS),
|
||||
SND_PCI_QUIRK(0x103c, 0x8a30, "HP Envy 17", ALC287_FIXUP_CS35L41_I2C_2),
|
||||
SND_PCI_QUIRK(0x103c, 0x8a31, "HP ENVY x360 2-in-1 Laptop 15-ey0xxx", ALC287_FIXUP_CS35L41_I2C_2_HP_MUTE_LEDS),
|
||||
SND_PCI_QUIRK(0x103c, 0x8a34, "HP Pavilion x360 2-in-1 Laptop 14-ek0xxx", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
|
||||
@@ -8067,7 +8086,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
|
||||
SND_PCI_QUIRK(0x103c, 0x8e36, "HP 14 Enstrom OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
|
||||
SND_PCI_QUIRK(0x103c, 0x8e37, "HP 16 Piston OmniBook X", ALC287_FIXUP_CS35L41_I2C_2),
|
||||
SND_PCI_QUIRK(0x103c, 0x8e3a, "HP Agusta", ALC287_FIXUP_CS35L41_I2C_2),
|
||||
SND_PCI_QUIRK(0x103c, 0x8e3b, "HP Agusta", ALC287_FIXUP_CS35L41_I2C_2),
|
||||
SND_PCI_QUIRK(0x103c, 0x8e3b, "HP OmniBook 7", ALC245_FIXUP_CS35L41_I2C_2_MUTE_MICMUTE_LED),
|
||||
SND_PCI_QUIRK(0x103c, 0x8e43, "HP Laptop 15-fd2xxx", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO),
|
||||
HDA_CODEC_QUIRK(0x103c, 0x84ee, "HP Pavilion AiO 24", ALC225_FIXUP_HP_AIO_SPK),
|
||||
SND_PCI_QUIRK(0x103c, 0x8e60, "HP OmniBook 7 Laptop 16-bh0xxx", ALC245_FIXUP_CS35L41_I2C_2_MUTE_LED),
|
||||
@@ -8106,11 +8125,11 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
|
||||
SND_PCI_QUIRK(0x103c, 0x8f3a, "HP EliteBook 6 G2i", ALC236_FIXUP_HP_GPIO_LED),
|
||||
SND_PCI_QUIRK(0x103c, 0x8f3c, "HP EliteBook 6 G2a", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
|
||||
SND_PCI_QUIRK(0x103c, 0x8f3d, "HP EliteBook 6 G2a", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
|
||||
SND_PCI_QUIRK(0x103c, 0x8f40, "HP ZBook 8 G2a 14", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED),
|
||||
SND_PCI_QUIRK(0x103c, 0x8f41, "HP ZBook 8 G2a 16", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED),
|
||||
SND_PCI_QUIRK(0x103c, 0x8f42, "HP ZBook 8 G2a 14W", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED),
|
||||
SND_PCI_QUIRK(0x103c, 0x8f40, "HP ZBook 8 G2a 14", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED_INVERTED),
|
||||
SND_PCI_QUIRK(0x103c, 0x8f41, "HP ZBook 8 G2a 16", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED_INVERTED),
|
||||
SND_PCI_QUIRK(0x103c, 0x8f42, "HP ZBook 8 G2a 14W", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED_INVERTED),
|
||||
SND_PCI_QUIRK(0x103c, 0x8f57, "HP Trekker G7JC", ALC287_FIXUP_CS35L41_I2C_2),
|
||||
SND_PCI_QUIRK(0x103c, 0x8f62, "HP ZBook 8 G2a 16W", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED),
|
||||
SND_PCI_QUIRK(0x103c, 0x8f62, "HP ZBook 8 G2a 16W", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED_INVERTED),
|
||||
SND_PCI_QUIRK(0x103c, 0x8f7e, "HP Messi", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED),
|
||||
SND_PCI_QUIRK(0x103c, 0x8f94, "HP ZBook 8 G2a 14", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED_INVERTED),
|
||||
SND_PCI_QUIRK(0x103c, 0x8f95, "HP ZBook 8 G2a 16", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED_INVERTED),
|
||||
@@ -8342,8 +8361,8 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
|
||||
SND_PCI_QUIRK(0x144d, 0xc1cc, "Samsung Galaxy Book3 Ultra (NT960XFH)", ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS),
|
||||
SND_PCI_QUIRK(0x1458, 0x900e, "Gigabyte G5 KF5 (2023)", ALC2XX_FIXUP_HEADSET_MIC),
|
||||
SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
|
||||
SND_PCI_QUIRK(0x1462, 0x12fb, "MSI GE66 Raider 11UE",
|
||||
ALC298_FIXUP_MSI_GE66_ALC1316_AMP),
|
||||
SND_PCI_QUIRK(0x1462, 0x12fb, "MSI GE66 Raider 11UE", ALC298_FIXUP_MSI_GE66_ALC1316_AMP),
|
||||
SND_PCI_QUIRK(0x1462, 0x1305, "MSI GE76 Raider 11UG", ALC298_FIXUP_MSI_GE66_ALC1316_AMP),
|
||||
SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
|
||||
SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
|
||||
SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
|
||||
@@ -8557,8 +8576,8 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
|
||||
HDA_CODEC_QUIRK(0x17aa, 0x386a, "Lenovo Yoga 7 16IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
|
||||
HDA_CODEC_QUIRK(0x17aa, 0x386e, "Legion Y9000X 2022 IAH7", ALC287_FIXUP_CS35L41_I2C_2),
|
||||
SND_PCI_QUIRK(0x17aa, 0x386e, "Yoga Pro 7 14ARP8", ALC285_FIXUP_YOGA_SPEAKER2_TO_DAC1),
|
||||
HDA_CODEC_QUIRK(0x17aa, 0x38a7, "Legion Pro 7 16ARX8H", ALC287_FIXUP_TAS2781_I2C), /* this must match before PCI SSID 17aa:386f below */
|
||||
HDA_CODEC_QUIRK(0x17aa, 0x38a8, "Legion Pro 7 16ARX8H", ALC287_FIXUP_TAS2781_I2C), /* this must match before PCI SSID 17aa:386f below */
|
||||
HDA_CODEC_QUIRK(0x17aa, 0x38a7, "Legion Pro 7 16ARX8H", ALC287_FIXUP_TAS2781_I2C_DAC), /* this must match before PCI SSID 17aa:386f below */
|
||||
HDA_CODEC_QUIRK(0x17aa, 0x38a8, "Legion Pro 7 16ARX8H", ALC287_FIXUP_TAS2781_I2C_DAC), /* this must match before PCI SSID 17aa:386f below */
|
||||
SND_PCI_QUIRK(0x17aa, 0x386f, "Legion Pro 7i 16IAX7", ALC287_FIXUP_CS35L41_I2C_2),
|
||||
SND_PCI_QUIRK(0x17aa, 0x3870, "Lenovo Yoga 7 14ARB7", ALC287_FIXUP_YOGA7_14ARB7_I2C),
|
||||
SND_PCI_QUIRK(0x17aa, 0x3871, "Lenovo ThinkBook 16p Gen 3 ARH", ALC287_FIXUP_YOGA7_14ARB7_I2C),
|
||||
@@ -8683,6 +8702,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
|
||||
SND_PCI_QUIRK(0x1854, 0x0490, "LG Gram Style 14 (14Z90RS)", ALC298_FIXUP_LG_GRAM_STYLE_14),
|
||||
SND_PCI_QUIRK(0x1854, 0x0554, "LG gram 16 (16Z90TR)", ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS),
|
||||
SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
|
||||
SND_PCI_QUIRK(0x19e5, 0x320d, "Huawei WRT-WX9", ALC269_FIXUP_HEADSET_MODE),
|
||||
SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
|
||||
SND_PCI_QUIRK(0x19e5, 0x3212, "Huawei KLV-WX9 ", ALC256_FIXUP_ACER_HEADSET_MIC),
|
||||
SND_PCI_QUIRK(0x19e5, 0x3e13, "Huawei MACHR-WX9", ALC256_FIXUP_HUAWEI_MACHR_WX9_PINS),
|
||||
@@ -8727,6 +8747,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
|
||||
SND_PCI_QUIRK(0x1e50, 0x7007, "Positivo DN50E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
|
||||
SND_PCI_QUIRK(0x1e50, 0x7036, "Acer Gadget E10 ETBook", ALC233_FIXUP_WUJIE_SPEAKERS),
|
||||
SND_PCI_QUIRK(0x1e50, 0x7038, "Positivo DN140", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
|
||||
SND_PCI_QUIRK(0x1e83, 0x3e21, "Huawei MACHC-WAX9", ALC256_FIXUP_HUAWEI_MACHC_WAX9_PINS),
|
||||
SND_PCI_QUIRK(0x1ee7, 0x204e, "HONOR DRA-XX M1020", ALC256_FIXUP_HONOR_DRA_XX_SPEAKERS),
|
||||
SND_PCI_QUIRK(0x1ee7, 0x2078, "HONOR BRB-X M1010", ALC2XX_FIXUP_HEADSET_MIC),
|
||||
SND_PCI_QUIRK(0x1ee7, 0x2081, "HONOR MRB-XXX M1020", ALC256_FIXUP_HONOR_MRB_XXX_M1020_AUDIO),
|
||||
|
||||
@@ -284,6 +284,21 @@ static void alc662_fixup_csl_amp(struct hda_codec *codec,
|
||||
}
|
||||
}
|
||||
|
||||
static void alc897_fixup_asus_b650m_depop(struct hda_codec *codec,
|
||||
const struct hda_fixup *fix, int action)
|
||||
{
|
||||
if (action != HDA_FIXUP_ACT_INIT)
|
||||
return;
|
||||
|
||||
alc_auto_setup_eapd(codec, false);
|
||||
snd_hda_codec_write(codec, 0x1b, 0,
|
||||
AC_VERB_SET_EAPD_BTLENABLE, 0);
|
||||
msleep(200);
|
||||
alc_auto_setup_eapd(codec, true);
|
||||
snd_hda_codec_write(codec, 0x1b, 0,
|
||||
AC_VERB_SET_EAPD_BTLENABLE, 2);
|
||||
}
|
||||
|
||||
enum {
|
||||
ALC662_FIXUP_ASPIRE,
|
||||
ALC662_FIXUP_LED_GPIO1,
|
||||
@@ -345,6 +360,7 @@ enum {
|
||||
ALC662_FIXUP_CSL_GPIO,
|
||||
ALC897_FIXUP_BEELINK_SER6_AMP,
|
||||
ALC897_FIXUP_LIMIT_LINEIN_BOOST,
|
||||
ALC897_FIXUP_ASUS_B650M_DEPOP,
|
||||
};
|
||||
|
||||
static const struct hda_fixup alc662_fixups[] = {
|
||||
@@ -810,6 +826,10 @@ static const struct hda_fixup alc662_fixups[] = {
|
||||
.type = HDA_FIXUP_FUNC,
|
||||
.v.func = alc897_fixup_limit_linein_boost,
|
||||
},
|
||||
[ALC897_FIXUP_ASUS_B650M_DEPOP] = {
|
||||
.type = HDA_FIXUP_FUNC,
|
||||
.v.func = alc897_fixup_asus_b650m_depop,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct hda_quirk alc662_fixup_tbl[] = {
|
||||
@@ -858,6 +878,7 @@ static const struct hda_quirk alc662_fixup_tbl[] = {
|
||||
SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
|
||||
SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
|
||||
SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
|
||||
SND_PCI_QUIRK(0x1043, 0x87fb, "ASUS PRIME B650M-K", ALC897_FIXUP_ASUS_B650M_DEPOP),
|
||||
SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
|
||||
SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
|
||||
SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
|
||||
|
||||
@@ -184,7 +184,6 @@ static const struct aw88399_prop_model aw88399_prop_model_table[] = {
|
||||
static int aw88399_hda_acpi_probe(struct aw88399_hda *aw88399)
|
||||
{
|
||||
struct acpi_device *adev;
|
||||
const char *sub;
|
||||
const struct aw88399_prop_model *model;
|
||||
|
||||
aw88399->index = aw88399_hda_index_from_i2c(aw88399);
|
||||
@@ -202,14 +201,13 @@ static int aw88399_hda_acpi_probe(struct aw88399_hda *aw88399)
|
||||
if (!physdev)
|
||||
return -ENODEV;
|
||||
|
||||
sub = acpi_get_subsystem_id(ACPI_HANDLE(physdev));
|
||||
const char *sub __free(kfree) = acpi_get_subsystem_id(ACPI_HANDLE(physdev));
|
||||
if (IS_ERR_OR_NULL(sub)) {
|
||||
dev_err(aw88399->dev, "ACPI subsystem ID not available\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
aw88399->acpi_subsystem_id = devm_kstrdup(aw88399->dev, sub, GFP_KERNEL);
|
||||
kfree(sub);
|
||||
if (!aw88399->acpi_subsystem_id)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -356,6 +354,7 @@ const struct dev_pm_ops aw88399_hda_pm_ops = {
|
||||
EXPORT_SYMBOL_NS_GPL(aw88399_hda_pm_ops, "SND_HDA_SCODEC_AW88399");
|
||||
|
||||
MODULE_DESCRIPTION("AW88399 HDA driver");
|
||||
MODULE_IMPORT_NS("SND_SOC_AW88399_LIB");
|
||||
MODULE_AUTHOR("Yakov Till <[email protected]>");
|
||||
MODULE_AUTHOR("Marco Giunta <[email protected]>");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -50,5 +50,7 @@ module_i2c_driver(aw88399_hda_i2c_driver);
|
||||
|
||||
MODULE_DESCRIPTION("HDA AW88399 I2C driver");
|
||||
MODULE_IMPORT_NS("SND_HDA_SCODEC_AW88399");
|
||||
MODULE_IMPORT_NS("SND_SOC_AW88399_LIB");
|
||||
MODULE_AUTHOR("Yakov Till <[email protected]>");
|
||||
MODULE_AUTHOR("Marco Giunta <[email protected]>");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -974,30 +974,6 @@ static int cs35l41_system_suspend(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cs35l41_wait_boot_done(struct cs35l41_hda *cs35l41)
|
||||
{
|
||||
unsigned int int_status;
|
||||
int ret;
|
||||
|
||||
ret = regmap_read_poll_timeout(cs35l41->regmap, CS35L41_IRQ1_STATUS4, int_status,
|
||||
int_status & CS35L41_OTP_BOOT_DONE, 1000, 100000);
|
||||
if (ret) {
|
||||
dev_err(cs35l41->dev, "Failed waiting for OTP_BOOT_DONE\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = regmap_read(cs35l41->regmap, CS35L41_IRQ1_STATUS3, &int_status);
|
||||
if (ret || (int_status & CS35L41_OTP_BOOT_ERR)) {
|
||||
dev_err(cs35l41->dev, "OTP Boot status %x error\n",
|
||||
int_status & CS35L41_OTP_BOOT_ERR);
|
||||
if (!ret)
|
||||
ret = -EIO;
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs35l41_system_resume(struct device *dev)
|
||||
{
|
||||
struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
|
||||
@@ -1020,10 +996,7 @@ static int cs35l41_system_resume(struct device *dev)
|
||||
|
||||
regcache_cache_only(cs35l41->regmap, false);
|
||||
|
||||
regmap_write(cs35l41->regmap, CS35L41_SFT_RESET, CS35L41_SOFTWARE_RESET);
|
||||
usleep_range(2000, 2100);
|
||||
|
||||
ret = cs35l41_wait_boot_done(cs35l41);
|
||||
ret = cs35l41_reset_and_boot(cs35l41->dev, cs35l41->regmap);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -2003,11 +1976,9 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
|
||||
gpiod_set_value_cansleep(cs35l41->reset_gpio, 1);
|
||||
}
|
||||
|
||||
usleep_range(2000, 2100);
|
||||
regmap_write(cs35l41->regmap, CS35L41_SFT_RESET, CS35L41_SOFTWARE_RESET);
|
||||
usleep_range(2000, 2100);
|
||||
|
||||
ret = cs35l41_wait_boot_done(cs35l41);
|
||||
ret = cs35l41_reset_and_boot(cs35l41->dev, cs35l41->regmap);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ static const struct cs35l41_config cs35l41_config_table[] = {
|
||||
{ "103C8C51", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
|
||||
{ "103C8CDD", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4100, 24 },
|
||||
{ "103C8CDE", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 3900, 24 },
|
||||
{ "103C8E13", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
|
||||
{ "103C8E60", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
|
||||
{ "103C8F07", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 3900, 24 },
|
||||
{ "104312AF", 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
|
||||
@@ -543,6 +544,7 @@ static const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
|
||||
{ "CSC3551", "103C8C6A", hp_i2c_int_2amp_dual_spkid },
|
||||
{ "CSC3551", "103C8CDD", generic_dsd_config },
|
||||
{ "CSC3551", "103C8CDE", generic_dsd_config },
|
||||
{ "CSC3551", "103C8E13", generic_dsd_config },
|
||||
{ "CSC3551", "103C8E60", generic_dsd_config },
|
||||
{ "CSC3551", "103C8F07", generic_dsd_config },
|
||||
{ "CSC3551", "104312AF", generic_dsd_config },
|
||||
|
||||
@@ -562,7 +562,7 @@ static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56)
|
||||
* downloaded previously then it needs to be powered down so that it
|
||||
* can be updated.
|
||||
*/
|
||||
if (cs35l56->base.fw_patched)
|
||||
if (cs35l56->cs_dsp.booted)
|
||||
cs_dsp_power_down(&cs35l56->cs_dsp);
|
||||
|
||||
cs35l56->base.fw_patched = false;
|
||||
@@ -634,7 +634,7 @@ static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56)
|
||||
regcache_mark_dirty(cs35l56->base.regmap);
|
||||
ret = cs35l56_wait_for_firmware_boot(&cs35l56->base);
|
||||
if (ret)
|
||||
goto err_powered_up;
|
||||
return;
|
||||
|
||||
regcache_cache_only(cs35l56->base.regmap, false);
|
||||
}
|
||||
@@ -642,7 +642,7 @@ static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56)
|
||||
/* Disable auto-hibernate so that runtime_pm has control */
|
||||
ret = cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_PREVENT_AUTO_HIBERNATE);
|
||||
if (ret)
|
||||
goto err_powered_up;
|
||||
return;
|
||||
|
||||
regcache_sync(cs35l56->base.regmap);
|
||||
|
||||
@@ -663,10 +663,6 @@ static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56)
|
||||
cs_dsp_stop(&cs35l56->cs_dsp);
|
||||
|
||||
cs35l56_log_tuning(&cs35l56->base, &cs35l56->cs_dsp);
|
||||
|
||||
err_powered_up:
|
||||
if (!cs35l56->base.fw_patched)
|
||||
cs_dsp_power_down(&cs35l56->cs_dsp);
|
||||
}
|
||||
|
||||
static void cs35l56_hda_dsp_work(struct work_struct *work)
|
||||
@@ -813,8 +809,10 @@ static void cs35l56_hda_unbind(struct device *dev, struct device *master, void *
|
||||
cs_dsp_cleanup_debugfs(&cs35l56->cs_dsp);
|
||||
debugfs_remove_recursive(cs35l56->debugfs_root);
|
||||
#endif
|
||||
if (cs35l56->cs_dsp.running)
|
||||
cs_dsp_stop(&cs35l56->cs_dsp);
|
||||
|
||||
if (cs35l56->base.fw_patched)
|
||||
if (cs35l56->cs_dsp.booted)
|
||||
cs_dsp_power_down(&cs35l56->cs_dsp);
|
||||
|
||||
comp = hda_component_from_index(parent, cs35l56->index);
|
||||
|
||||
@@ -50,6 +50,31 @@ static void cali_cnv(unsigned char *data, unsigned int base, int offset)
|
||||
(u32 *)®_data, TASDEV_CALIB_N);
|
||||
}
|
||||
|
||||
/*
|
||||
* V1 data without CRC is only trusted if every expected device has a
|
||||
* populated, self-consistent entry: R0 (Q27) * 1/R0 (Q31) must be
|
||||
* close to 1.0 in Q58.
|
||||
*/
|
||||
static bool tas2781_v1_nocrc_valid(const unsigned int *v, int ndev)
|
||||
{
|
||||
const u64 one = 1ULL << 58;
|
||||
int i;
|
||||
|
||||
if (ndev <= 0 || ndev > 4)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < ndev; i++) {
|
||||
const unsigned int *e = &v[i * 5];
|
||||
u64 prod = (u64)e[0] * e[1];
|
||||
|
||||
if (!e[0] || !e[1] ||
|
||||
prod < one - one / 10 || prod > one + one / 10)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void tas2781_apply_calib(struct tasdevice_priv *p)
|
||||
{
|
||||
struct calidata *cali_data = &p->cali_data;
|
||||
@@ -64,6 +89,7 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
|
||||
TASDEVICE_REG(0, 0x18, 0x7c),
|
||||
};
|
||||
unsigned int crc, oft, node_num;
|
||||
bool custom_addr = false;
|
||||
unsigned char *buf;
|
||||
int i, j, k, l;
|
||||
|
||||
@@ -104,6 +130,7 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
|
||||
for (j = 0, k = 0; j < node_num; j++) {
|
||||
oft = j * 6 + 3;
|
||||
if (tmp_val[oft] == TASDEV_UEFI_CALI_REG_ADDR_FLG) {
|
||||
custom_addr = true;
|
||||
for (i = 0; i < TASDEV_CALIB_N; i++) {
|
||||
buf = &data[(oft + i + 1) * 4];
|
||||
cali_reg[i] = TASDEVICE_REG(buf[1],
|
||||
@@ -145,7 +172,7 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
|
||||
* but leave TimeStamp and CRC zeroed.
|
||||
*/
|
||||
if (!tmp_val[20] && !tmp_val[21] &&
|
||||
tmp_val[0] && tmp_val[1]) {
|
||||
tas2781_v1_nocrc_valid(tmp_val, p->ndev)) {
|
||||
dev_warn(p->dev,
|
||||
"%s: V1 data without CRC, accepting\n",
|
||||
__func__);
|
||||
@@ -163,7 +190,7 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
|
||||
}
|
||||
}
|
||||
|
||||
if (p->dspbin_typ == TASDEV_BASIC) {
|
||||
if (custom_addr || p->dspbin_typ == TASDEV_BASIC) {
|
||||
r->r0_reg = cali_reg[0];
|
||||
r->invr0_reg = cali_reg[1];
|
||||
r->r0_low_reg = cali_reg[2];
|
||||
|
||||
@@ -445,6 +445,13 @@ int snd_hdac_bus_parse_capabilities(struct hdac_bus *bus)
|
||||
break;
|
||||
}
|
||||
|
||||
/* An all-zero header means no capability is present here */
|
||||
if (!cur_cap) {
|
||||
dev_dbg(bus->dev, "Empty capability header at offset 0x%x\n",
|
||||
offset);
|
||||
break;
|
||||
}
|
||||
|
||||
switch ((cur_cap & AZX_CAP_HDR_ID_MASK) >> AZX_CAP_HDR_ID_OFF) {
|
||||
case AZX_ML_CAP_ID:
|
||||
dev_dbg(bus->dev, "Found ML capability\n");
|
||||
@@ -475,7 +482,8 @@ int snd_hdac_bus_parse_capabilities(struct hdac_bus *bus)
|
||||
break;
|
||||
|
||||
default:
|
||||
dev_err(bus->dev, "Unknown capability %d\n", cur_cap);
|
||||
dev_err(bus->dev, "Unknown capability ID 0x%x\n",
|
||||
(cur_cap & AZX_CAP_HDR_ID_MASK) >> AZX_CAP_HDR_ID_OFF);
|
||||
cur_cap = 0;
|
||||
break;
|
||||
}
|
||||
@@ -764,10 +772,13 @@ int snd_hdac_bus_alloc_stream_pages(struct hdac_bus *bus)
|
||||
|
||||
error_posbuf:
|
||||
snd_dma_free_pages(&bus->posbuf);
|
||||
bus->posbuf.area = NULL;
|
||||
error_bdl:
|
||||
list_for_each_entry(s, &bus->stream_list, list) {
|
||||
if (s->bdl.area)
|
||||
if (s->bdl.area) {
|
||||
snd_dma_free_pages(&s->bdl);
|
||||
s->bdl.area = NULL;
|
||||
}
|
||||
}
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -1104,6 +1104,8 @@ int cs46xx_dsp_scb_and_task_init (struct snd_cs46xx *chip)
|
||||
|
||||
null_scb.entry_point = null_algorithm->address;
|
||||
ins->the_null_scb = cs46xx_dsp_create_scb(chip, "nullSCB", (u32 *)&null_scb, NULL_SCB_ADDR);
|
||||
if (!ins->the_null_scb)
|
||||
return -ENOMEM;
|
||||
ins->the_null_scb->task_entry = null_algorithm;
|
||||
ins->the_null_scb->sub_list_ptr = ins->the_null_scb;
|
||||
ins->the_null_scb->next_scb_ptr = ins->the_null_scb;
|
||||
|
||||
@@ -274,7 +274,8 @@ _dsp_create_generic_scb (struct snd_cs46xx *chip, char * name, u32 * scb_data, u
|
||||
dev_dbg(chip->card->dev, "dsp_spos: creating SCB <%s>\n", name);
|
||||
|
||||
scb = cs46xx_dsp_create_scb(chip,name,scb_data,dest);
|
||||
|
||||
if (!scb)
|
||||
return NULL;
|
||||
|
||||
scb->sub_list_ptr = ins->the_null_scb;
|
||||
scb->next_scb_ptr = ins->the_null_scb;
|
||||
|
||||
@@ -98,6 +98,41 @@ static const struct dmi_system_id acp70_acpi_flag_override_table[] = {
|
||||
DMI_MATCH(DMI_BOARD_NAME, "8EA2"),
|
||||
},
|
||||
},
|
||||
{
|
||||
/* HP Cashmere-A */
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_BOARD_VENDOR, "HP"),
|
||||
DMI_MATCH(DMI_BOARD_NAME, "8EF5"),
|
||||
},
|
||||
},
|
||||
{
|
||||
/* HP Sundae */
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_BOARD_VENDOR, "HP"),
|
||||
DMI_MATCH(DMI_BOARD_NAME, "8F6D"),
|
||||
},
|
||||
},
|
||||
{
|
||||
/* HP SundaeWhip UMA */
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_BOARD_VENDOR, "HP"),
|
||||
DMI_MATCH(DMI_BOARD_NAME, "8FA4"),
|
||||
},
|
||||
},
|
||||
{
|
||||
/* HP SundaeWhip DSC */
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_BOARD_VENDOR, "HP"),
|
||||
DMI_MATCH(DMI_BOARD_NAME, "8FA5"),
|
||||
},
|
||||
},
|
||||
{
|
||||
/* HP Kata-A */
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_BOARD_VENDOR, "HP"),
|
||||
DMI_MATCH(DMI_BOARD_NAME, "9056"),
|
||||
},
|
||||
},
|
||||
{
|
||||
/* Dell 14S DS14265 */
|
||||
.matches = {
|
||||
|
||||
@@ -87,13 +87,6 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "21D0"),
|
||||
}
|
||||
},
|
||||
{
|
||||
.driver_data = &acp6x_card,
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "21D0"),
|
||||
}
|
||||
},
|
||||
{
|
||||
.driver_data = &acp6x_card,
|
||||
.matches = {
|
||||
@@ -395,6 +388,20 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "83UU"),
|
||||
}
|
||||
},
|
||||
{
|
||||
.driver_data = &acp6x_card,
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "84CS"),
|
||||
}
|
||||
},
|
||||
{
|
||||
.driver_data = &acp6x_card,
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "83VD"),
|
||||
}
|
||||
},
|
||||
{
|
||||
.driver_data = &acp6x_card,
|
||||
.matches = {
|
||||
@@ -766,6 +773,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
|
||||
DMI_MATCH(DMI_BOARD_NAME, "8DC2"),
|
||||
}
|
||||
},
|
||||
{
|
||||
.driver_data = &acp6x_card,
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_BOARD_VENDOR, "HP"),
|
||||
DMI_MATCH(DMI_BOARD_NAME, "8EE3"),
|
||||
}
|
||||
},
|
||||
{
|
||||
.driver_data = &acp6x_card,
|
||||
.matches = {
|
||||
@@ -878,13 +892,6 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
|
||||
DMI_MATCH(DMI_BOARD_NAME, "BM1403CDA"),
|
||||
}
|
||||
},
|
||||
{
|
||||
.driver_data = &acp6x_card,
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."),
|
||||
DMI_MATCH(DMI_BOARD_NAME, "BM1403CDA"),
|
||||
}
|
||||
},
|
||||
{
|
||||
.driver_data = &acp6x_card,
|
||||
.matches = {
|
||||
|
||||
@@ -23,7 +23,7 @@ const struct regmap_config aw88399_remap_config = {
|
||||
.reg_format_endian = REGMAP_ENDIAN_LITTLE,
|
||||
.val_format_endian = REGMAP_ENDIAN_BIG,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(aw88399_remap_config);
|
||||
EXPORT_SYMBOL_NS_GPL(aw88399_remap_config, "SND_SOC_AW88399_LIB");
|
||||
|
||||
static void aw_dev_pwd(struct aw_device *aw_dev, bool pwd)
|
||||
{
|
||||
@@ -165,7 +165,7 @@ int aw_dev_check_syspll(struct aw_device *aw_dev)
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(aw_dev_check_syspll);
|
||||
EXPORT_SYMBOL_NS_GPL(aw_dev_check_syspll, "SND_SOC_AW88399_LIB");
|
||||
|
||||
static int aw_dev_check_sysst(struct aw_device *aw_dev)
|
||||
{
|
||||
@@ -241,7 +241,7 @@ void aw_dev_dsp_enable(struct aw_device *aw_dev, bool is_enable)
|
||||
if (ret)
|
||||
dev_dbg(aw_dev->dev, "%s failed\n", __func__);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(aw_dev_dsp_enable);
|
||||
EXPORT_SYMBOL_NS_GPL(aw_dev_dsp_enable, "SND_SOC_AW88399_LIB");
|
||||
|
||||
static int aw88399_dev_get_icalk(struct aw88399 *aw88399, int16_t *icalk)
|
||||
{
|
||||
@@ -418,7 +418,7 @@ int aw_dev_update_cali_re(struct aw_cali_desc *cali_desc)
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(aw_dev_update_cali_re);
|
||||
EXPORT_SYMBOL_NS_GPL(aw_dev_update_cali_re, "SND_SOC_AW88399_LIB");
|
||||
|
||||
static int aw_dev_fw_crc_check(struct aw_device *aw_dev)
|
||||
{
|
||||
@@ -572,7 +572,7 @@ int aw_dev_get_dsp_status(struct aw_device *aw_dev)
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(aw_dev_get_dsp_status);
|
||||
EXPORT_SYMBOL_NS_GPL(aw_dev_get_dsp_status, "SND_SOC_AW88399_LIB");
|
||||
|
||||
static int aw_dev_dsp_check(struct aw_device *aw_dev)
|
||||
{
|
||||
@@ -625,7 +625,7 @@ int aw_dev_set_volume(struct aw_device *aw_dev, unsigned int value)
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(aw_dev_set_volume);
|
||||
EXPORT_SYMBOL_NS_GPL(aw_dev_set_volume, "SND_SOC_AW88399_LIB");
|
||||
|
||||
static void aw_dev_fade_in(struct aw_device *aw_dev)
|
||||
{
|
||||
@@ -682,7 +682,7 @@ void aw88399_dev_mute(struct aw_device *aw_dev, bool is_mute)
|
||||
aw_dev_fade_in(aw_dev);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(aw88399_dev_mute);
|
||||
EXPORT_SYMBOL_NS_GPL(aw88399_dev_mute, "SND_SOC_AW88399_LIB");
|
||||
|
||||
static void aw88399_dev_set_dither(struct aw88399 *aw88399, bool dither)
|
||||
{
|
||||
@@ -1038,7 +1038,7 @@ int aw88399_dev_get_prof_name(struct aw_device *aw_dev, int index, char **prof_n
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(aw88399_dev_get_prof_name);
|
||||
EXPORT_SYMBOL_NS_GPL(aw88399_dev_get_prof_name, "SND_SOC_AW88399_LIB");
|
||||
|
||||
static int aw88399_dev_get_prof_data(struct aw_device *aw_dev, int index,
|
||||
struct aw_prof_desc **prof_desc)
|
||||
@@ -1163,7 +1163,7 @@ void aw88399_startup_work(struct work_struct *work)
|
||||
aw88399_start_pa(aw88399);
|
||||
mutex_unlock(&aw88399->lock);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(aw88399_startup_work);
|
||||
EXPORT_SYMBOL_NS_GPL(aw88399_startup_work, "SND_SOC_AW88399_LIB");
|
||||
|
||||
void aw88399_start(struct aw88399 *aw88399, bool sync_start)
|
||||
{
|
||||
@@ -1191,7 +1191,7 @@ void aw88399_start(struct aw88399 *aw88399, bool sync_start)
|
||||
&aw88399->start_work,
|
||||
AW88399_START_WORK_DELAY_MS);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(aw88399_start);
|
||||
EXPORT_SYMBOL_NS_GPL(aw88399_start, "SND_SOC_AW88399_LIB");
|
||||
|
||||
static int aw_dev_check_sysint(struct aw_device *aw_dev)
|
||||
{
|
||||
@@ -1244,7 +1244,7 @@ int aw88399_stop(struct aw_device *aw_dev)
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(aw88399_stop);
|
||||
EXPORT_SYMBOL_NS_GPL(aw88399_stop, "SND_SOC_AW88399_LIB");
|
||||
|
||||
static int aw88399_dev_init(struct aw88399 *aw88399, struct aw_container *aw_cfg)
|
||||
{
|
||||
@@ -1323,7 +1323,7 @@ int aw88399_request_firmware_file(struct aw88399 *aw88399, const char *fw_name)
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(aw88399_request_firmware_file);
|
||||
EXPORT_SYMBOL_NS_GPL(aw88399_request_firmware_file, "SND_SOC_AW88399_LIB");
|
||||
|
||||
void aw88399_hw_reset(struct aw88399 *aw88399)
|
||||
{
|
||||
@@ -1336,7 +1336,7 @@ void aw88399_hw_reset(struct aw88399 *aw88399)
|
||||
usleep_range(AW88399_1000_US, AW88399_1000_US + 10);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(aw88399_hw_reset);
|
||||
EXPORT_SYMBOL_NS_GPL(aw88399_hw_reset, "SND_SOC_AW88399_LIB");
|
||||
|
||||
static void aw88399_parse_channel_dt(struct aw_device *aw_dev)
|
||||
{
|
||||
@@ -1401,13 +1401,13 @@ int aw88399_init(struct aw88399 *aw88399, struct i2c_client *i2c, struct regmap
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(aw88399_init);
|
||||
EXPORT_SYMBOL_NS_GPL(aw88399_init, "SND_SOC_AW88399_LIB");
|
||||
|
||||
void aw88399_dev_set_channel(struct aw88399 *aw88399, int channel)
|
||||
{
|
||||
aw88399->aw_pa->channel = channel;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(aw88399_dev_set_channel);
|
||||
EXPORT_SYMBOL_NS_GPL(aw88399_dev_set_channel, "SND_SOC_AW88399_LIB");
|
||||
|
||||
MODULE_DESCRIPTION("AW88399 common device library");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -818,4 +818,5 @@ static struct i2c_driver aw88399_i2c_driver = {
|
||||
module_i2c_driver(aw88399_i2c_driver);
|
||||
|
||||
MODULE_DESCRIPTION("ASoC AW88399 Smart PA Driver");
|
||||
MODULE_IMPORT_NS("SND_SOC_AW88399_LIB");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include <sound/cs35l41.h>
|
||||
|
||||
#define CS35L41_FIRMWARE_OLD_VERSION 0x001C00 /* v0.28.0 */
|
||||
#define CS35L41_GLOBAL_BOOT_DONE_TIMEOUT_US 100000
|
||||
#define CS35L41_GLOBAL_BOOT_DONE_SLEEP_US 2000
|
||||
|
||||
static const struct reg_default cs35l41_reg[] = {
|
||||
{ CS35L41_PWR_CTRL1, 0x00000000 },
|
||||
@@ -1586,6 +1588,71 @@ int cs35l41_exit_hibernate(struct device *dev, struct regmap *regmap)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cs35l41_exit_hibernate);
|
||||
|
||||
int cs35l41_wait_boot_done(struct device *dev, struct regmap *regmap)
|
||||
{
|
||||
ktime_t timeout;
|
||||
unsigned int val = 0;
|
||||
int ret = 0;
|
||||
|
||||
/*
|
||||
* The chip could NAK a read request while it is booting so ignore
|
||||
* errors from regmap_read.
|
||||
*/
|
||||
timeout = ktime_add_us(ktime_get(), CS35L41_GLOBAL_BOOT_DONE_TIMEOUT_US);
|
||||
regmap_read(regmap, CS35L41_IRQ1_STATUS4, &val);
|
||||
while (!(val & CS35L41_OTP_BOOT_DONE) && !ktime_after(ktime_get(), timeout)) {
|
||||
usleep_range(CS35L41_GLOBAL_BOOT_DONE_SLEEP_US / 2,
|
||||
CS35L41_GLOBAL_BOOT_DONE_SLEEP_US);
|
||||
regmap_read(regmap, CS35L41_IRQ1_STATUS4, &val);
|
||||
}
|
||||
|
||||
if (!(val & CS35L41_OTP_BOOT_DONE)) {
|
||||
dev_err(dev, "Timeout waiting for OTP_BOOT_DONE\n");
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
ret = regmap_read(regmap, CS35L41_IRQ1_STATUS3, &val);
|
||||
if (ret || (val & CS35L41_OTP_BOOT_ERR)) {
|
||||
dev_err(dev, "OTP Boot status %x error\n",
|
||||
val & CS35L41_OTP_BOOT_ERR);
|
||||
if (!ret)
|
||||
ret = -EIO;
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cs35l41_wait_boot_done);
|
||||
|
||||
int cs35l41_reset_and_boot(struct device *dev, struct regmap *regmap)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = regmap_write(regmap, CS35L41_SFT_RESET, CS35L41_SOFTWARE_RESET);
|
||||
if (ret) {
|
||||
dev_warn(dev, "Failed to write software reset: %d\n", ret);
|
||||
|
||||
/*
|
||||
* If the write failed, it is likely because the chip is still booting after a
|
||||
* reset. Wait for boot, then retry the software reset. If the initial write failed
|
||||
* for another reason, then either waiting for boot, or the second write will fail,
|
||||
* So we can return the error then.
|
||||
*/
|
||||
ret = cs35l41_wait_boot_done(dev, regmap);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = regmap_write(regmap, CS35L41_SFT_RESET, CS35L41_SOFTWARE_RESET);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to write software reset on retry: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
usleep_range(2000, 2100);
|
||||
|
||||
return cs35l41_wait_boot_done(dev, regmap);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cs35l41_reset_and_boot);
|
||||
|
||||
MODULE_DESCRIPTION("CS35L41 library");
|
||||
MODULE_AUTHOR("David Rhodes, Cirrus Logic Inc, <[email protected]>");
|
||||
MODULE_AUTHOR("Lucas Tanure, Cirrus Logic Inc, <[email protected]>");
|
||||
|
||||
@@ -1211,7 +1211,7 @@ err:
|
||||
|
||||
int cs35l41_probe(struct cs35l41_private *cs35l41, const struct cs35l41_hw_cfg *hw_cfg)
|
||||
{
|
||||
u32 regid, reg_revid, i, mtl_revid, int_status, chipid_match;
|
||||
u32 regid, reg_revid, i, mtl_revid, chipid_match;
|
||||
int irq_pol = 0;
|
||||
int ret;
|
||||
|
||||
@@ -1260,21 +1260,9 @@ int cs35l41_probe(struct cs35l41_private *cs35l41, const struct cs35l41_hw_cfg *
|
||||
|
||||
usleep_range(2000, 2100);
|
||||
|
||||
ret = regmap_read_poll_timeout(cs35l41->regmap, CS35L41_IRQ1_STATUS4,
|
||||
int_status, int_status & CS35L41_OTP_BOOT_DONE,
|
||||
1000, 100000);
|
||||
if (ret) {
|
||||
dev_err_probe(cs35l41->dev, ret,
|
||||
"Failed waiting for OTP_BOOT_DONE\n");
|
||||
ret = cs35l41_reset_and_boot(cs35l41->dev, cs35l41->regmap);
|
||||
if (ret)
|
||||
goto err;
|
||||
}
|
||||
|
||||
regmap_read(cs35l41->regmap, CS35L41_IRQ1_STATUS3, &int_status);
|
||||
if (int_status & CS35L41_OTP_BOOT_ERR) {
|
||||
dev_err(cs35l41->dev, "OTP Boot error\n");
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = regmap_read(cs35l41->regmap, CS35L41_DEVID, ®id);
|
||||
if (ret < 0) {
|
||||
|
||||
@@ -99,7 +99,7 @@ static const u32 hpf_table[10][10] = {
|
||||
{496, 244, 121, 60, 31, 17, 11, 8, 0, 0}
|
||||
};
|
||||
|
||||
static bool find_best_hpf_freq(u32 target_hz, u8 *hpf1, u8 *hpf2, u32 *out)
|
||||
static bool find_best_hpf_freq(u32 target_hz, u8 *hpf1, u8 *hpf2)
|
||||
{
|
||||
int best_row = -1, best_col = -1;
|
||||
u32 min_diff = U32_MAX;
|
||||
@@ -118,7 +118,6 @@ static bool find_best_hpf_freq(u32 target_hz, u8 *hpf1, u8 *hpf2, u32 *out)
|
||||
min_diff = diff;
|
||||
best_row = i;
|
||||
best_col = j;
|
||||
*out = f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,27 +146,25 @@ static int es8389_hpf_set(struct snd_kcontrol *kcontrol,
|
||||
u32 freq;
|
||||
bool hpf;
|
||||
|
||||
if ((ucontrol->value.integer.value[0] > 1020) || (ucontrol->value.integer.value[0] < 0))
|
||||
return -EINVAL;
|
||||
|
||||
if (es8389->hpf_freq == ucontrol->value.integer.value[0])
|
||||
return 0;
|
||||
|
||||
if (es8389->capture_rate) {
|
||||
freq = (ucontrol->value.integer.value[0] * 48000) / es8389->capture_rate;
|
||||
|
||||
hpf = find_best_hpf_freq(freq, &es8389->hpfl, &es8389->hpfr, &es8389->hpf_freq);
|
||||
hpf = find_best_hpf_freq(freq, &es8389->hpfl, &es8389->hpfr);
|
||||
if (!hpf)
|
||||
return -EBUSY;
|
||||
|
||||
if (es8389->hpf_freq != ucontrol->value.integer.value[0])
|
||||
dev_dbg(component->dev, "At the %u Hz sampling rate, %ld Hz could not be obtained."
|
||||
"the frequency has been set to the closest value, %u Hz\n",
|
||||
es8389->capture_rate, ucontrol->value.integer.value[0], es8389->hpf_freq);
|
||||
|
||||
regmap_update_bits(es8389->regmap, ES8389_ADC_HPF1, 0x0f, es8389->hpfl);
|
||||
regmap_update_bits(es8389->regmap, ES8389_ADC_HPF2, 0x0f, es8389->hpfr);
|
||||
} else {
|
||||
es8389->hpf_freq = ucontrol->value.integer.value[0];
|
||||
dev_dbg(component->dev, "PCM_STREAM_CAPTURE is not active.retain the input frequency\n");
|
||||
}
|
||||
es8389->hpf_freq = ucontrol->value.integer.value[0];
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -790,7 +787,7 @@ static int es8389_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
|
||||
es8389->capture_rate = params_rate(params);
|
||||
freq = (es8389->hpf_freq * 48000) / params_rate(params);
|
||||
hpf = find_best_hpf_freq(freq, &es8389->hpfl, &es8389->hpfr, &es8389->hpf_freq);
|
||||
hpf = find_best_hpf_freq(freq, &es8389->hpfl, &es8389->hpfr);
|
||||
if (!hpf) {
|
||||
dev_err(component->dev, "The HPF frequency is invalid\n");
|
||||
return -EINVAL;
|
||||
|
||||
@@ -3681,7 +3681,7 @@ static int swclk_gate_enable(struct clk_hw *hw)
|
||||
|
||||
ret = rx_macro_mclk_enable(rx, true);
|
||||
if (ret) {
|
||||
clk_disable_unprepare(rx->mclk);
|
||||
pm_runtime_put_autosuspend(rx->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -1669,7 +1669,7 @@ static struct snd_soc_dai_driver sn624x_sdca_dai[] = {
|
||||
.capture = {
|
||||
.stream_name = "DMic Capture",
|
||||
.channels_min = 1,
|
||||
.channels_max = 4,
|
||||
.channels_max = 2,
|
||||
.rates = SN624X_STEREO_RATES,
|
||||
.formats = SN624X_FORMATS,
|
||||
},
|
||||
|
||||
@@ -353,6 +353,7 @@ static int tas2770_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
||||
struct tas2770_priv *tas2770 =
|
||||
snd_soc_component_get_drvdata(component);
|
||||
u8 tdm_rx_start_slot = 0, invert_fpol = 0, fpol_preinv = 0, asi_cfg_1 = 0;
|
||||
u8 tx_edge;
|
||||
int ret;
|
||||
|
||||
switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
|
||||
@@ -369,12 +370,14 @@ static int tas2770_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
||||
fallthrough;
|
||||
case SND_SOC_DAIFMT_NB_NF:
|
||||
asi_cfg_1 |= TAS2770_TDM_CFG_REG1_RX_RSING;
|
||||
tx_edge = TAS2770_TDM_CFG_REG4_TX_FALING;
|
||||
break;
|
||||
case SND_SOC_DAIFMT_IB_IF:
|
||||
invert_fpol = 1;
|
||||
fallthrough;
|
||||
case SND_SOC_DAIFMT_IB_NF:
|
||||
asi_cfg_1 |= TAS2770_TDM_CFG_REG1_RX_FALING;
|
||||
tx_edge = TAS2770_TDM_CFG_REG4_TX_RISING;
|
||||
break;
|
||||
default:
|
||||
dev_err(tas2770->dev, "ASI format Inverse is not found\n");
|
||||
@@ -387,6 +390,12 @@ static int tas2770_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4,
|
||||
TAS2770_TDM_CFG_REG4_TX_EDGE,
|
||||
tx_edge);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
|
||||
case SND_SOC_DAIFMT_I2S:
|
||||
tdm_rx_start_slot = 1;
|
||||
@@ -513,7 +522,7 @@ static int tas2770_set_dai_tdm_idle(struct snd_soc_dai *dai,
|
||||
ret = snd_soc_component_update_bits(component, TAS2770_DIN_PD,
|
||||
TAS2770_DIN_PD_SDOUT,
|
||||
TAS2770_DIN_PD_SDOUT);
|
||||
if (ret)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
break;
|
||||
@@ -521,12 +530,12 @@ static int tas2770_set_dai_tdm_idle(struct snd_soc_dai *dai,
|
||||
ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4,
|
||||
TAS2770_TDM_CFG_REG4_TX_KEEPER,
|
||||
TAS2770_TDM_CFG_REG4_TX_KEEPER);
|
||||
if (ret)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4,
|
||||
TAS2770_TDM_CFG_REG4_TX_FILL, 0);
|
||||
if (ret)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
break;
|
||||
@@ -534,25 +543,25 @@ static int tas2770_set_dai_tdm_idle(struct snd_soc_dai *dai,
|
||||
ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4,
|
||||
TAS2770_TDM_CFG_REG4_TX_KEEPER,
|
||||
TAS2770_TDM_CFG_REG4_TX_KEEPER);
|
||||
if (ret)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4,
|
||||
TAS2770_TDM_CFG_REG4_TX_FILL,
|
||||
TAS2770_TDM_CFG_REG4_TX_FILL);
|
||||
if (ret)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
break;
|
||||
case SND_SOC_DAI_TDM_IDLE_OFF:
|
||||
ret = snd_soc_component_update_bits(component, TAS2770_DIN_PD,
|
||||
TAS2770_DIN_PD_SDOUT, 0);
|
||||
if (ret)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4,
|
||||
TAS2770_TDM_CFG_REG4_TX_KEEPER, 0);
|
||||
if (ret)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
break;
|
||||
|
||||
@@ -74,7 +74,9 @@
|
||||
#define TAS2770_TDM_CFG_REG4_TX_KEEPER BIT(5)
|
||||
#define TAS2770_TDM_CFG_REG4_TX_FILL BIT(4)
|
||||
#define TAS2770_TDM_CFG_REG4_TX_OFFSET_MASK GENMASK(3, 1)
|
||||
#define TAS2770_TDM_CFG_REG4_TX_EDGE_FALLING BIT(0)
|
||||
#define TAS2770_TDM_CFG_REG4_TX_EDGE BIT(0)
|
||||
#define TAS2770_TDM_CFG_REG4_TX_RISING 0x0
|
||||
#define TAS2770_TDM_CFG_REG4_TX_FALING 0x1
|
||||
/* TDM Configuration Reg5 */
|
||||
#define TAS2770_TDM_CFG_REG5 TAS2770_REG(0X0, 0x0F)
|
||||
#define TAS2770_TDM_CFG_REG5_VSNS_MASK BIT(6)
|
||||
|
||||
@@ -338,6 +338,20 @@ static int wm8904_configure_clocking(struct snd_soc_component *component)
|
||||
dev_dbg(component->dev, "Using %dHz FLL clock\n",
|
||||
wm8904->fll_fout);
|
||||
|
||||
/* The SYSCLK may already be on; if source changes to FLL, ensure
|
||||
* FLL is enabled before selecting it as SYSCLK source.
|
||||
*/
|
||||
if (clock2 & WM8904_CLK_SYS_ENA) {
|
||||
snd_soc_component_update_bits(component,
|
||||
WM8904_FLL_CONTROL_1,
|
||||
WM8904_FLL_OSC_ENA,
|
||||
WM8904_FLL_OSC_ENA);
|
||||
snd_soc_component_update_bits(component,
|
||||
WM8904_FLL_CONTROL_1,
|
||||
WM8904_FLL_ENA,
|
||||
WM8904_FLL_ENA);
|
||||
}
|
||||
|
||||
clock2 |= WM8904_SYSCLK_SRC;
|
||||
rate = wm8904->fll_fout;
|
||||
break;
|
||||
|
||||
@@ -46,6 +46,9 @@
|
||||
#define adsp_dbg(_dsp, fmt, ...) \
|
||||
dev_dbg(_dsp->cs_dsp.dev, "%s: " fmt, _dsp->cs_dsp.name, ##__VA_ARGS__)
|
||||
|
||||
#define adsp_warn_once(_dsp, fmt, ...) \
|
||||
dev_warn_once(_dsp->cs_dsp.dev, "%s: " fmt, _dsp->cs_dsp.name, ##__VA_ARGS__)
|
||||
|
||||
#define compr_err(_obj, fmt, ...) \
|
||||
adsp_err(_obj->dsp, "%s: " fmt, _obj->name ? _obj->name : "legacy", \
|
||||
##__VA_ARGS__)
|
||||
@@ -625,6 +628,13 @@ int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl)
|
||||
if (dsp->component->name_prefix)
|
||||
avail -= strlen(dsp->component->name_prefix) + 1;
|
||||
|
||||
if (avail < 1) {
|
||||
adsp_warn_once(dsp,
|
||||
"%.*s: ALSA prefix too long: control not created\n",
|
||||
cs_ctl->subname_len, cs_ctl->subname);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Truncate the subname from the start if it is too long */
|
||||
if (cs_ctl->subname_len > avail)
|
||||
skip = cs_ctl->subname_len - avail;
|
||||
|
||||
@@ -769,14 +769,14 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_sdw_machines[] = {
|
||||
.link_mask = BIT(0),
|
||||
.links = arl_link_sn6242,
|
||||
.drv_name = "sof_sdw",
|
||||
.sof_tplg_filename = "sof-arl-sn624x.tplg",
|
||||
.sof_tplg_filename = "sof-arl-dummy.tplg",
|
||||
.get_function_tplg_files = sof_sdw_get_tplg_files,
|
||||
},
|
||||
{
|
||||
.link_mask = BIT(0),
|
||||
.links = arl_link_sn6244,
|
||||
.drv_name = "sof_sdw",
|
||||
.sof_tplg_filename = "sof-arl-sn624x.tplg",
|
||||
.sof_tplg_filename = "sof-arl-dummy.tplg",
|
||||
.get_function_tplg_files = sof_sdw_get_tplg_files,
|
||||
},
|
||||
{},
|
||||
|
||||
@@ -867,14 +867,14 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[] = {
|
||||
.link_mask = BIT(0),
|
||||
.links = lnl_link_sn6242,
|
||||
.drv_name = "sof_sdw",
|
||||
.sof_tplg_filename = "sof-lnl-sn624x.tplg",
|
||||
.sof_tplg_filename = "sof-lnl-dummy.tplg",
|
||||
.get_function_tplg_files = sof_sdw_get_tplg_files,
|
||||
},
|
||||
{
|
||||
.link_mask = BIT(0),
|
||||
.links = lnl_link_sn6244,
|
||||
.drv_name = "sof_sdw",
|
||||
.sof_tplg_filename = "sof-lnl-sn624x.tplg",
|
||||
.sof_tplg_filename = "sof-lnl-dummy.tplg",
|
||||
.get_function_tplg_files = sof_sdw_get_tplg_files,
|
||||
},
|
||||
{},
|
||||
|
||||
@@ -1564,14 +1564,14 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = {
|
||||
.link_mask = BIT(0),
|
||||
.links = mtl_link_sn6242,
|
||||
.drv_name = "sof_sdw",
|
||||
.sof_tplg_filename = "sof-mtl-sn624x.tplg",
|
||||
.sof_tplg_filename = "sof-mtl-dummy.tplg",
|
||||
.get_function_tplg_files = sof_sdw_get_tplg_files,
|
||||
},
|
||||
{
|
||||
.link_mask = BIT(0),
|
||||
.links = mtl_link_sn6244,
|
||||
.drv_name = "sof_sdw",
|
||||
.sof_tplg_filename = "sof-mtl-sn624x.tplg",
|
||||
.sof_tplg_filename = "sof-mtl-dummy.tplg",
|
||||
.get_function_tplg_files = sof_sdw_get_tplg_files,
|
||||
},
|
||||
{},
|
||||
|
||||
@@ -599,21 +599,21 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[] = {
|
||||
.link_mask = BIT(3),
|
||||
.links = ptl_link_sn6242,
|
||||
.drv_name = "sof_sdw",
|
||||
.sof_tplg_filename = "sof-ptl-sn624x.tplg",
|
||||
.sof_tplg_filename = "sof-ptl-dummy.tplg",
|
||||
.get_function_tplg_files = sof_sdw_get_tplg_files,
|
||||
},
|
||||
{
|
||||
.link_mask = BIT(3),
|
||||
.links = ptl_link_sn6244,
|
||||
.drv_name = "sof_sdw",
|
||||
.sof_tplg_filename = "sof-ptl-sn624x.tplg",
|
||||
.sof_tplg_filename = "sof-ptl-dummy.tplg",
|
||||
.get_function_tplg_files = sof_sdw_get_tplg_files,
|
||||
},
|
||||
{
|
||||
.link_mask = BIT(3),
|
||||
.links = ptl_link_sn6247,
|
||||
.drv_name = "sof_sdw",
|
||||
.sof_tplg_filename = "sof-ptl-sn624x.tplg",
|
||||
.sof_tplg_filename = "sof-ptl-dummy.tplg",
|
||||
.get_function_tplg_files = sof_sdw_get_tplg_files,
|
||||
},
|
||||
{},
|
||||
|
||||
+15
-15
@@ -244,17 +244,10 @@ int axg_fifo_pcm_open(struct snd_soc_component *component,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Use the threaded irq handler only with non-atomic links */
|
||||
ret = request_threaded_irq(fifo->irq, NULL,
|
||||
axg_fifo_pcm_irq_block,
|
||||
IRQF_ONESHOT, dev_name(dev), ss);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Enable pclk to access registers and clock the fifo ip */
|
||||
ret = clk_prepare_enable(fifo->pclk);
|
||||
if (ret)
|
||||
goto free_irq;
|
||||
return ret;
|
||||
|
||||
/* Setup status2 so it reports the memory pointer */
|
||||
regmap_update_bits(fifo->map, FIFO_CTRL1,
|
||||
@@ -271,17 +264,24 @@ int axg_fifo_pcm_open(struct snd_soc_component *component,
|
||||
/* Clear any pending interrupt */
|
||||
axg_fifo_ack_irq(fifo, FIFO_INT_MASK);
|
||||
|
||||
/* Take memory arbitror out of reset */
|
||||
ret = reset_control_deassert(fifo->arb);
|
||||
/* Use the threaded irq handler only with non-atomic links */
|
||||
ret = request_threaded_irq(fifo->irq, NULL,
|
||||
axg_fifo_pcm_irq_block,
|
||||
IRQF_ONESHOT, dev_name(dev), ss);
|
||||
if (ret)
|
||||
goto free_clk;
|
||||
|
||||
/* Take memory arbitror out of reset */
|
||||
ret = reset_control_deassert(fifo->arb);
|
||||
if (ret)
|
||||
goto free_irq;
|
||||
|
||||
return 0;
|
||||
|
||||
free_clk:
|
||||
clk_disable_unprepare(fifo->pclk);
|
||||
free_irq:
|
||||
free_irq(fifo->irq, ss);
|
||||
free_clk:
|
||||
clk_disable_unprepare(fifo->pclk);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(axg_fifo_pcm_open);
|
||||
@@ -295,12 +295,12 @@ int axg_fifo_pcm_close(struct snd_soc_component *component,
|
||||
/* Put the memory arbitror back in reset */
|
||||
ret = reset_control_assert(fifo->arb);
|
||||
|
||||
/* Disable fifo ip and register access */
|
||||
clk_disable_unprepare(fifo->pclk);
|
||||
|
||||
/* remove IRQ */
|
||||
free_irq(fifo->irq, ss);
|
||||
|
||||
/* Disable fifo ip and register access */
|
||||
clk_disable_unprepare(fifo->pclk);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(axg_fifo_pcm_close);
|
||||
|
||||
@@ -890,8 +890,6 @@ static int apm_probe(gpr_device_t *gdev)
|
||||
if (!apm)
|
||||
return -ENOMEM;
|
||||
|
||||
dev_set_drvdata(dev, apm);
|
||||
|
||||
mutex_init(&apm->lock);
|
||||
apm->dev = dev;
|
||||
apm->gdev = gdev;
|
||||
@@ -905,6 +903,7 @@ static int apm_probe(gpr_device_t *gdev)
|
||||
|
||||
idr_init(&apm->modules_idr);
|
||||
|
||||
dev_set_drvdata(dev, apm);
|
||||
g_apm = apm;
|
||||
|
||||
q6apm_get_apm_state(apm);
|
||||
@@ -949,6 +948,9 @@ static int apm_callback(const struct gpr_resp_pkt *data, void *priv, int op)
|
||||
const struct gpr_hdr *hdr = &data->hdr;
|
||||
int graph_id, is_pos_buf;
|
||||
|
||||
if (!apm)
|
||||
return 0;
|
||||
|
||||
result = data->payload;
|
||||
|
||||
switch (hdr->opcode) {
|
||||
|
||||
@@ -194,6 +194,9 @@ static int prm_callback(const struct gpr_resp_pkt *data, void *priv, int op)
|
||||
const struct gpr_ibasic_rsp_result_t *result;
|
||||
const struct gpr_hdr *hdr = &data->hdr;
|
||||
|
||||
if (!prm)
|
||||
return 0;
|
||||
|
||||
switch (hdr->opcode) {
|
||||
case PRM_CMD_RSP_REQUEST_HW_RSC:
|
||||
case PRM_CMD_RSP_RELEASE_HW_RSC:
|
||||
|
||||
@@ -5,6 +5,7 @@ menu "Rockchip"
|
||||
|
||||
config SND_SOC_ROCKCHIP_I2S
|
||||
tristate "Rockchip I2S Device Driver"
|
||||
select REGMAP_MMIO
|
||||
select SND_SOC_GENERIC_DMAENGINE_PCM
|
||||
help
|
||||
Say Y or M if you want to add support for I2S driver for
|
||||
@@ -13,6 +14,7 @@ config SND_SOC_ROCKCHIP_I2S
|
||||
|
||||
config SND_SOC_ROCKCHIP_I2S_TDM
|
||||
tristate "Rockchip I2S/TDM Device Driver"
|
||||
select REGMAP_MMIO
|
||||
select SND_SOC_GENERIC_DMAENGINE_PCM
|
||||
help
|
||||
Say Y or M if you want to add support for the I2S/TDM driver for
|
||||
@@ -23,6 +25,7 @@ config SND_SOC_ROCKCHIP_I2S_TDM
|
||||
|
||||
config SND_SOC_ROCKCHIP_PDM
|
||||
tristate "Rockchip PDM Controller Driver"
|
||||
select REGMAP_MMIO
|
||||
select SND_SOC_GENERIC_DMAENGINE_PCM
|
||||
select RATIONAL
|
||||
help
|
||||
@@ -32,6 +35,7 @@ config SND_SOC_ROCKCHIP_PDM
|
||||
|
||||
config SND_SOC_ROCKCHIP_SAI
|
||||
tristate "Rockchip SAI Controller Driver"
|
||||
select REGMAP_MMIO
|
||||
select SND_SOC_GENERIC_DMAENGINE_PCM
|
||||
help
|
||||
Say Y or M if you want to add support for the Rockchip Serial Audio
|
||||
@@ -41,6 +45,7 @@ config SND_SOC_ROCKCHIP_SAI
|
||||
|
||||
config SND_SOC_ROCKCHIP_SPDIF
|
||||
tristate "Rockchip SPDIF Device Driver"
|
||||
select REGMAP_MMIO
|
||||
select SND_PCM_IEC958
|
||||
select SND_SOC_GENERIC_DMAENGINE_PCM
|
||||
help
|
||||
|
||||
@@ -456,6 +456,12 @@ int hda_sdw_bpt_close(struct device *dev, int link_id, struct hdac_ext_stream *b
|
||||
int ret;
|
||||
int ret1;
|
||||
|
||||
if (bpt_rx_stream && hdac_stream(bpt_rx_stream)->running)
|
||||
hda_sdw_bpt_dma_disable(dev, bpt_rx_stream);
|
||||
|
||||
if (bpt_tx_stream && hdac_stream(bpt_tx_stream)->running)
|
||||
hda_sdw_bpt_dma_disable(dev, bpt_tx_stream);
|
||||
|
||||
/*
|
||||
* In the case of SoundWire we need to reset the PCMSyCM registers.
|
||||
* Need to continue depreparing the DMA buffers even if this fails.
|
||||
|
||||
@@ -183,10 +183,24 @@ static int bcd2000_midi_output_open(struct snd_rawmidi_substream *substream)
|
||||
static int bcd2000_midi_output_close(struct snd_rawmidi_substream *substream)
|
||||
{
|
||||
struct bcd2000 *bcd2k = substream->rmidi->private_data;
|
||||
struct urb *urb = NULL;
|
||||
|
||||
if (bcd2k->midi_out_active && bcd2k->midi_out_urb) {
|
||||
usb_kill_urb(bcd2k->midi_out_urb);
|
||||
bcd2k->midi_out_active = 0;
|
||||
/*
|
||||
* Reference the URB under the lock so that it stays valid until
|
||||
* usb_kill_urb() returns, even if a disconnect frees it in the
|
||||
* meantime. usb_kill_urb() cannot run under the lock, as the
|
||||
* completion handler takes the same lock.
|
||||
*/
|
||||
scoped_guard(spinlock_irqsave, &bcd2k->midi_lock) {
|
||||
if (bcd2k->midi_out_active && bcd2k->midi_out_urb) {
|
||||
urb = usb_get_urb(bcd2k->midi_out_urb);
|
||||
bcd2k->midi_out_active = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (urb) {
|
||||
usb_kill_urb(urb);
|
||||
usb_put_urb(urb);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -863,6 +863,8 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *cdev)
|
||||
return 0;
|
||||
|
||||
exit_free_idev:
|
||||
usb_free_urb(cdev->ep4_in_urb);
|
||||
cdev->ep4_in_urb = NULL;
|
||||
input_free_device(input);
|
||||
cdev->input_dev = NULL;
|
||||
return ret;
|
||||
|
||||
@@ -94,6 +94,18 @@ void line6_capture_copy(struct snd_line6_pcm *line6pcm, char *fbuf, int fsize)
|
||||
if (runtime == NULL)
|
||||
return;
|
||||
|
||||
/*
|
||||
* snd_line6_capture_open() constrains the buffer to hold at least
|
||||
* two packets, so this cannot happen for a conforming device. Drop
|
||||
* the packet rather than overrun the single wrap below.
|
||||
*/
|
||||
if (unlikely(frames > runtime->buffer_size)) {
|
||||
dev_err_ratelimited(line6pcm->line6->ifcdev,
|
||||
"packet of %d frames exceeds %lu-frame buffer, dropping\n",
|
||||
frames, runtime->buffer_size);
|
||||
return;
|
||||
}
|
||||
|
||||
if (line6pcm->in.pos_done + frames > runtime->buffer_size) {
|
||||
/*
|
||||
The transferred area goes over buffer boundary,
|
||||
@@ -232,6 +244,23 @@ static int snd_line6_capture_open(struct snd_pcm_substream *substream)
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
/*
|
||||
* line6_capture_copy() wraps the ring buffer once per packet and
|
||||
* advances pos_done by the packet, which only works when the buffer
|
||||
* holds more than one packet: with exactly one, pos_done gains a
|
||||
* buffer and loses it again on every packet. The packet size comes
|
||||
* from the device, so bound the buffer by two packets here. The
|
||||
* impulse-response path copies a playback URB into this ring, so
|
||||
* take the larger of the two endpoints.
|
||||
*/
|
||||
err = snd_pcm_hw_constraint_minmax(runtime,
|
||||
SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
|
||||
2 * max(line6pcm->max_packet_size_in,
|
||||
line6pcm->max_packet_size_out),
|
||||
UINT_MAX);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
line6_pcm_acquire(line6pcm, LINE6_STREAM_CAPTURE_HELPER, false);
|
||||
|
||||
runtime->hw = line6pcm->properties->capture_hw;
|
||||
|
||||
+2
-1
@@ -194,10 +194,11 @@ static int snd_usbmidi_urb_error(const struct urb *urb)
|
||||
case -ESHUTDOWN:
|
||||
case -ENODEV:
|
||||
return -ENODEV;
|
||||
/* errors that might occur during unplugging */
|
||||
/* errors that might occur during unplugging or switching off */
|
||||
case -EPROTO:
|
||||
case -ETIME:
|
||||
case -EILSEQ:
|
||||
case -EPIPE:
|
||||
return -EIO;
|
||||
default:
|
||||
dev_err(&urb->dev->dev, "urb status %d\n", urb->status);
|
||||
|
||||
@@ -1969,8 +1969,13 @@ static int qc_usb_audio_probe(struct auxiliary_device *auxdev,
|
||||
QMI_UAUDIO_STREAM_REQ_MSG_V01_MAX_MSG_LEN,
|
||||
&uaudio_svc_ops_options,
|
||||
&uaudio_stream_req_handlers);
|
||||
if (ret)
|
||||
goto free_qmi_hdl;
|
||||
|
||||
ret = qmi_add_server(svc->uaudio_svc_hdl, UAUDIO_STREAM_SERVICE_ID_V01,
|
||||
UAUDIO_STREAM_SERVICE_VERS_V01, 0);
|
||||
if (ret)
|
||||
goto release_qmi_hdl;
|
||||
|
||||
uaudio_svc = svc;
|
||||
|
||||
@@ -1987,7 +1992,9 @@ static int qc_usb_audio_probe(struct auxiliary_device *auxdev,
|
||||
|
||||
release_qmi:
|
||||
qc_usb_audio_cleanup_qmi_dev();
|
||||
release_qmi_hdl:
|
||||
qmi_handle_release(svc->uaudio_svc_hdl);
|
||||
free_qmi_hdl:
|
||||
kfree(svc->uaudio_svc_hdl);
|
||||
free_svc:
|
||||
kfree(svc);
|
||||
|
||||
@@ -404,6 +404,20 @@ YAMAHA_DEVICE(0x105d, NULL),
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
USB_DEVICE(0x0499, 0x1516),
|
||||
QUIRK_DRIVER_INFO {
|
||||
/* .vendor_name = "Yamaha", */
|
||||
/* .product_name = "ZG02", */
|
||||
QUIRK_DATA_COMPOSITE {
|
||||
{ QUIRK_DATA_STANDARD_AUDIO(1) },
|
||||
{ QUIRK_DATA_STANDARD_AUDIO(2) },
|
||||
{ QUIRK_DATA_MIDI_YAMAHA(3) },
|
||||
{ QUIRK_DATA_IGNORE(4) },
|
||||
QUIRK_COMPOSITE_END
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
USB_DEVICE(0x0499, 0x1718),
|
||||
QUIRK_DRIVER_INFO {
|
||||
@@ -4437,6 +4451,27 @@ QUIRK_RME_DIGIFACE(0x3fa0),
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* CVT Touch Device (1ff7:0f33) is a USB composite device with HID + UAC
|
||||
* audio interfaces. The device iProduct is "Touch Device" but Windows
|
||||
* displays the audio function as "MAXHUB Speaker" (from iTerminal).
|
||||
* Override the card shortname to match the Windows display name, while
|
||||
* keeping normal stream/mixer creation (ifnum = QUIRK_NO_INTERFACE).
|
||||
*/
|
||||
{
|
||||
.match_flags = USB_DEVICE_ID_MATCH_DEVICE |
|
||||
USB_DEVICE_ID_MATCH_INT_CLASS |
|
||||
USB_DEVICE_ID_MATCH_INT_SUBCLASS,
|
||||
.idVendor = 0x1ff7,
|
||||
.idProduct = 0x0f33,
|
||||
.bInterfaceClass = USB_CLASS_AUDIO,
|
||||
.bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL,
|
||||
.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
|
||||
.product_name = "MAXHUB Speaker",
|
||||
.ifnum = QUIRK_NO_INTERFACE,
|
||||
}
|
||||
},
|
||||
|
||||
#undef QUIRK_AF16RIG_CLOCK
|
||||
#undef QUIRK_AF16RIG
|
||||
|
||||
|
||||
@@ -2556,6 +2556,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
|
||||
QUIRK_FLAG_GENERIC_IMPLICIT_FB),
|
||||
DEVICE_FLG(0x0499, 0x1509, /* Steinberg UR22 */
|
||||
QUIRK_FLAG_GENERIC_IMPLICIT_FB),
|
||||
DEVICE_FLG(0x0499, 0x1516, /* Yamaha ZG02 */
|
||||
QUIRK_FLAG_GENERIC_IMPLICIT_FB),
|
||||
DEVICE_FLG(0x0499, 0x3108, /* Yamaha YIT-W12TX */
|
||||
QUIRK_FLAG_GET_SAMPLE_RATE),
|
||||
DEVICE_FLG(0x04d8, 0xfeea, /* Benchmark DAC1 Pre */
|
||||
@@ -2809,6 +2811,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
|
||||
QUIRK_FLAG_GENERIC_IMPLICIT_FB),
|
||||
DEVICE_FLG(0x2b73, 0x0047, /* AlphaTheta EUPHONIA */
|
||||
QUIRK_FLAG_PLAYBACK_FIRST | QUIRK_FLAG_GENERIC_IMPLICIT_FB),
|
||||
DEVICE_FLG(0x2bdf, 0x0280, /* HIK 1080P Camera */
|
||||
QUIRK_FLAG_CTL_MSG_DELAY_1M),
|
||||
DEVICE_FLG(0x2d95, 0x8011, /* VIVO USB-C HEADSET */
|
||||
QUIRK_FLAG_CTL_MSG_DELAY_1M),
|
||||
DEVICE_FLG(0x2d95, 0x8021, /* VIVO USB-C-XE710 HEADSET */
|
||||
|
||||
@@ -129,19 +129,26 @@ static const struct vm_operations_struct usb_stream_hwdep_vm_ops = {
|
||||
static int usb_stream_hwdep_open(struct snd_hwdep *hw, struct file *file)
|
||||
{
|
||||
struct us122l *us122l = hw->private_data;
|
||||
struct usb_interface *iface;
|
||||
struct usb_interface *iface, *iface0 = NULL;
|
||||
|
||||
if (hw->used >= 2)
|
||||
return -EBUSY;
|
||||
|
||||
if (us122l->is_us144) {
|
||||
iface0 = usb_ifnum_to_if(us122l->dev, 0);
|
||||
if (!iface0)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
iface = usb_ifnum_to_if(us122l->dev, 1);
|
||||
if (!iface)
|
||||
return -ENODEV;
|
||||
|
||||
if (!us122l->first)
|
||||
us122l->first = file;
|
||||
|
||||
if (us122l->is_us144) {
|
||||
iface = usb_ifnum_to_if(us122l->dev, 0);
|
||||
usb_autopm_get_interface(iface);
|
||||
}
|
||||
iface = usb_ifnum_to_if(us122l->dev, 1);
|
||||
if (iface0)
|
||||
usb_autopm_get_interface(iface0);
|
||||
usb_autopm_get_interface(iface);
|
||||
return 0;
|
||||
}
|
||||
@@ -153,10 +160,12 @@ static int usb_stream_hwdep_release(struct snd_hwdep *hw, struct file *file)
|
||||
|
||||
if (us122l->is_us144) {
|
||||
iface = usb_ifnum_to_if(us122l->dev, 0);
|
||||
usb_autopm_put_interface(iface);
|
||||
if (iface)
|
||||
usb_autopm_put_interface(iface);
|
||||
}
|
||||
iface = usb_ifnum_to_if(us122l->dev, 1);
|
||||
usb_autopm_put_interface(iface);
|
||||
if (iface)
|
||||
usb_autopm_put_interface(iface);
|
||||
if (us122l->first == file)
|
||||
us122l->first = NULL;
|
||||
guard(mutex)(&us122l->mutex);
|
||||
@@ -179,6 +188,8 @@ static int usb_stream_hwdep_mmap(struct snd_hwdep *hw,
|
||||
offset = area->vm_pgoff << PAGE_SHIFT;
|
||||
guard(mutex)(&us122l->mutex);
|
||||
s = us122l->sk.s;
|
||||
if (!s)
|
||||
return -ENODEV;
|
||||
read = offset < s->read_size;
|
||||
if (read) {
|
||||
if (area->vm_flags & VM_WRITE)
|
||||
|
||||
@@ -179,6 +179,9 @@ static int snd_usx2y_hwdep_dsp_load(struct snd_hwdep *hw,
|
||||
int lret, err;
|
||||
char *buf;
|
||||
|
||||
if (priv->chip_status & USX2Y_STAT_CHIP_HUP)
|
||||
return -ENODEV;
|
||||
|
||||
buf = memdup_user(dsp->image, dsp->length);
|
||||
if (IS_ERR(buf))
|
||||
return PTR_ERR(buf);
|
||||
@@ -201,11 +204,13 @@ static int snd_usx2y_hwdep_dsp_load(struct snd_hwdep *hw,
|
||||
err = usx2y_in04_init(priv);
|
||||
if (err) {
|
||||
dev_err(&dev->dev, "usx2y_in04_init error\n");
|
||||
priv->chip_status |= USX2Y_STAT_CHIP_HUP;
|
||||
return err;
|
||||
}
|
||||
err = usx2y_create_alsa_devices(hw->card);
|
||||
if (err) {
|
||||
dev_err(&dev->dev, "usx2y_create_alsa_devices error %i\n", err);
|
||||
priv->chip_status |= USX2Y_STAT_CHIP_HUP;
|
||||
return err;
|
||||
}
|
||||
priv->chip_status |= USX2Y_STAT_CHIP_INIT;
|
||||
|
||||
@@ -682,16 +682,17 @@ dotry:
|
||||
s->sync_packet = -1;
|
||||
s->inpacket_head = -1;
|
||||
sk->iso_frame_balance = 0;
|
||||
sk->idle_inurb = sk->inurb[USB_STREAM_NURBS - 2];
|
||||
sk->idle_outurb = sk->outurb[USB_STREAM_NURBS - 2];
|
||||
sk->completed_inurb = sk->inurb[USB_STREAM_NURBS - 1];
|
||||
sk->completed_outurb = sk->outurb[USB_STREAM_NURBS - 1];
|
||||
++try;
|
||||
for (u = 0; u < 2; u++) {
|
||||
struct urb *inurb = sk->inurb[u];
|
||||
struct urb *outurb = sk->outurb[u];
|
||||
|
||||
playback_prep_freqn(sk, outurb);
|
||||
inurb->number_of_packets = outurb->number_of_packets;
|
||||
inurb->transfer_buffer_length =
|
||||
inurb->number_of_packets *
|
||||
inurb->iso_frame_desc[0].length;
|
||||
prepare_inurb(outurb->number_of_packets, inurb);
|
||||
|
||||
if (u == 0) {
|
||||
int now;
|
||||
@@ -739,11 +740,6 @@ check_retry:
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
sk->idle_inurb = sk->inurb[USB_STREAM_NURBS - 2];
|
||||
sk->idle_outurb = sk->outurb[USB_STREAM_NURBS - 2];
|
||||
sk->completed_inurb = sk->inurb[USB_STREAM_NURBS - 1];
|
||||
sk->completed_outurb = sk->outurb[USB_STREAM_NURBS - 1];
|
||||
|
||||
/* wait, check */
|
||||
{
|
||||
int wait_ms = 3000;
|
||||
|
||||
@@ -51,6 +51,18 @@ static int usx2y_urb_capt_retire(struct snd_usx2y_substream *subs)
|
||||
dev_dbg(&usx2y->dev->dev, "%s: 0 == len ERROR!\n", __func__);
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* snd_usx2y_pcm_open() constrains the buffer to hold at least
|
||||
* two URBs, so this cannot happen for a device that keeps its
|
||||
* packets at 50 frames. Drop the packet rather than exceed the
|
||||
* single wrap below.
|
||||
*/
|
||||
if (unlikely(len > runtime->buffer_size)) {
|
||||
dev_err_ratelimited(&usx2y->dev->dev,
|
||||
"%s: packet of %i frames exceeds %lu-frame buffer, dropping\n",
|
||||
__func__, len, runtime->buffer_size);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* copy a data chunk */
|
||||
if ((hwptr_done + len) > runtime->buffer_size) {
|
||||
@@ -106,14 +118,31 @@ static int usx2y_urb_play_prepare(struct snd_usx2y_substream *subs,
|
||||
__func__, counts);
|
||||
return -EPIPE;
|
||||
}
|
||||
if (counts * usx2y->stride > subs->maxpacksize) {
|
||||
dev_err_ratelimited(&usx2y->dev->dev,
|
||||
"%s: packet of %i bytes exceeds maxpacksize %u\n",
|
||||
__func__, counts * usx2y->stride,
|
||||
subs->maxpacksize);
|
||||
return -EPIPE;
|
||||
}
|
||||
/* set up descriptor */
|
||||
urb->iso_frame_desc[pack].offset = pack ?
|
||||
urb->iso_frame_desc[pack - 1].offset +
|
||||
urb->iso_frame_desc[pack - 1].length :
|
||||
0;
|
||||
urb->iso_frame_desc[pack].length = cap_urb->iso_frame_desc[pack].actual_length;
|
||||
urb->iso_frame_desc[pack].length = counts * usx2y->stride;
|
||||
}
|
||||
if (atomic_read(&subs->state) >= STATE_PRERUNNING) {
|
||||
/*
|
||||
* The copy below wraps once, which needs count <= buffer_size.
|
||||
* snd_usx2y_pcm_open() guarantees it; guard anyway.
|
||||
*/
|
||||
if (unlikely(count > runtime->buffer_size)) {
|
||||
dev_err_ratelimited(&usx2y->dev->dev,
|
||||
"%s: URB of %i frames exceeds %lu-frame buffer, stopping\n",
|
||||
__func__, count, runtime->buffer_size);
|
||||
return -EPIPE;
|
||||
}
|
||||
if (subs->hwptr + count > runtime->buffer_size) {
|
||||
/* err, the transferred area goes over buffer boundary.
|
||||
* copy the data to the temp buffer.
|
||||
@@ -888,6 +917,18 @@ static int snd_usx2y_pcm_open(struct snd_pcm_substream *substream)
|
||||
runtime->private_data = subs;
|
||||
subs->pcm_substream = substream;
|
||||
snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_TIME, 1000, 200000);
|
||||
/*
|
||||
* Capture wraps the ring buffer once per packet and playback once
|
||||
* per URB of nr_of_packs() packets of at most 50 frames (see
|
||||
* usx2y_urb_play_prepare()). Playback needs the buffer to hold more
|
||||
* than one URB and capture more than one packet; use the URB bound
|
||||
* for both, and two URBs rather than one, because the position only
|
||||
* advances when a URB is less than the whole buffer. The bound is in
|
||||
* frames and does not depend on the altsetting, which is selected
|
||||
* in prepare.
|
||||
*/
|
||||
snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
|
||||
2 * nr_of_packs() * 50, UINT_MAX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user