···103103 int ports[SNDRV_EMUX_MAX_PORTS]; /* The ports for this device */104104 struct snd_emux_port *portptrs[SNDRV_EMUX_MAX_PORTS];105105 int used; /* use counter */106106- char *name; /* name of the device (internal) */106106+ const char *name; /* name of the device (internal) */107107 struct snd_rawmidi **vmidi;108108 struct timer_list tlist; /* for pending note-offs */109109 int timer_active;
+12
include/sound/pcm.h
···659659 flags = _snd_pcm_stream_lock_irqsave_nested(substream); \660660 } while (0)661661662662+/* definitions for guard(); use like guard(pcm_stream_lock) */663663+DEFINE_LOCK_GUARD_1(pcm_stream_lock, struct snd_pcm_substream,664664+ snd_pcm_stream_lock(_T->lock),665665+ snd_pcm_stream_unlock(_T->lock))666666+DEFINE_LOCK_GUARD_1(pcm_stream_lock_irq, struct snd_pcm_substream,667667+ snd_pcm_stream_lock_irq(_T->lock),668668+ snd_pcm_stream_unlock_irq(_T->lock))669669+DEFINE_LOCK_GUARD_1(pcm_stream_lock_irqsave, struct snd_pcm_substream,670670+ snd_pcm_stream_lock_irqsave(_T->lock, _T->flags),671671+ snd_pcm_stream_unlock_irqrestore(_T->lock, _T->flags),672672+ unsigned long flags)673673+662674/**663675 * snd_pcm_group_for_each_entry - iterate over the linked substreams664676 * @s: the iterator
···3939 legacy MIDI 1.0 byte streams is created for each UMP Endpoint.4040 The device contains 16 substreams corresponding to UMP groups.41414242+config SND_CORE_TEST4343+ tristate "Sound core KUnit test"4444+ depends on KUNIT4545+ select SND_PCM4646+ default KUNIT_ALL_TESTS4747+ help4848+ This options enables the sound core functions KUnit test.4949+5050+ KUnit tests run during boot and output the results to the debug5151+ log in TAP format (https://testanything.org/). Only useful for5252+ kernel devs running KUnit test harness and are not for inclusion5353+ into a production build.5454+5555+ For more information on KUnit and unit tests in general, refer5656+ to the KUnit documentation in Documentation/dev-tools/kunit/.5757+5858+4259config SND_COMPRESS_OFFLOAD4360 tristate4461
···3737 * the value of current SYT_INTERVAL; e.g. initial value is not zero.3838 * @CIP_UNAWARE_SYT: For outgoing packet, the value in SYT field of CIP is 0xffff.3939 * For incoming packet, the value in SYT field of CIP is not handled.4040+ * @CIP_DBC_IS_PAYLOAD_QUADLETS: Available for incoming packet, and only effective with4141+ * CIP_DBC_IS_END_EVENT flag. The value of dbc field is the number of accumulated quadlets4242+ * in CIP payload, instead of the number of accumulated data blocks.4043 */4144enum cip_flags {4245 CIP_NONBLOCKING = 0x00,···5451 CIP_NO_HEADER = 0x100,5552 CIP_UNALIGHED_DBC = 0x200,5653 CIP_UNAWARE_SYT = 0x400,5454+ CIP_DBC_IS_PAYLOAD_QUADLETS = 0x800,5755};58565957/**
···177177 flags |= CIP_JUMBO_PAYLOAD;178178 if (oxfw->quirks & SND_OXFW_QUIRK_WRONG_DBS)179179 flags |= CIP_WRONG_DBS;180180+ if (oxfw->quirks & SND_OXFW_QUIRK_DBC_IS_TOTAL_PAYLOAD_QUADLETS)181181+ flags |= CIP_DBC_IS_END_EVENT | CIP_DBC_IS_PAYLOAD_QUADLETS;180182 } else {181183 conn = &oxfw->in_conn;182184 c_dir = CMP_INPUT;···488486 enum avc_general_plug_dir dir,489487 struct snd_oxfw_stream_formation *formation)490488{491491- u8 *format;492492- unsigned int len;493489 int err;494490495495- len = AVC_GENERIC_FRAME_MAXIMUM_BYTES;496496- format = kmalloc(len, GFP_KERNEL);497497- if (format == NULL)498498- return -ENOMEM;491491+ if (!(oxfw->quirks & SND_OXFW_QUIRK_STREAM_FORMAT_INFO_UNSUPPORTED)) {492492+ u8 *format;493493+ unsigned int len;499494500500- err = avc_stream_get_format_single(oxfw->unit, dir, 0, format, &len);501501- if (err < 0)502502- goto end;503503- if (len < 3) {504504- err = -EIO;505505- goto end;495495+ len = AVC_GENERIC_FRAME_MAXIMUM_BYTES;496496+ format = kmalloc(len, GFP_KERNEL);497497+ if (format == NULL)498498+ return -ENOMEM;499499+500500+ err = avc_stream_get_format_single(oxfw->unit, dir, 0, format, &len);501501+ if (err >= 0) {502502+ if (len < 3)503503+ err = -EIO;504504+ else505505+ err = snd_oxfw_stream_parse_format(format, formation);506506+ }507507+508508+ kfree(format);509509+ } else {510510+ // Miglia Harmony Audio does not support Extended Stream Format Information511511+ // command. Use the duplicated hard-coded format, instead.512512+ unsigned int rate;513513+ u8 *const *formats;514514+ int i;515515+516516+ err = avc_general_get_sig_fmt(oxfw->unit, &rate, dir, 0);517517+ if (err < 0)518518+ return err;519519+520520+ if (dir == AVC_GENERAL_PLUG_DIR_IN)521521+ formats = oxfw->rx_stream_formats;522522+ else523523+ formats = oxfw->tx_stream_formats;524524+525525+ for (i = 0; (i < SND_OXFW_STREAM_FORMAT_ENTRIES); ++i) {526526+ if (!formats[i])527527+ continue;528528+529529+ err = snd_oxfw_stream_parse_format(formats[i], formation);530530+ if (err < 0)531531+ continue;532532+533533+ if (formation->rate == rate)534534+ break;535535+ }536536+ if (i == SND_OXFW_STREAM_FORMAT_ENTRIES)537537+ return -EIO;506538 }507539508508- err = snd_oxfw_stream_parse_format(format, formation);509509-end:510510- kfree(format);511540 return err;512541}513542···548515 * in AV/C Stream Format Information Specification 1.1 (Apr 2005, 1394TA)549516 * Also 'Clause 12 AM824 sequence adaption layers' in IEC 61883-6:2005550517 */551551-int snd_oxfw_stream_parse_format(u8 *format,518518+int snd_oxfw_stream_parse_format(const u8 *format,552519 struct snd_oxfw_stream_formation *formation)553520{554521 unsigned int i, e, channels, type;···633600 unsigned int i, eid;634601 int err;635602636636- /* get format at current sampling rate */637637- err = avc_stream_get_format_single(oxfw->unit, dir, pid, buf, len);638638- if (err < 0) {639639- dev_err(&oxfw->unit->device,640640- "fail to get current stream format for isoc %s plug %d:%d\n",641641- (dir == AVC_GENERAL_PLUG_DIR_IN) ? "in" : "out",642642- pid, err);643643- goto end;603603+ // get format at current sampling rate.604604+ if (!(oxfw->quirks & SND_OXFW_QUIRK_STREAM_FORMAT_INFO_UNSUPPORTED)) {605605+ err = avc_stream_get_format_single(oxfw->unit, dir, pid, buf, len);606606+ if (err < 0) {607607+ dev_err(&oxfw->unit->device,608608+ "fail to get current stream format for isoc %s plug %d:%d\n",609609+ (dir == AVC_GENERAL_PLUG_DIR_IN) ? "in" : "out",610610+ pid, err);611611+ goto end;612612+ }613613+ } else {614614+ // Miglia Harmony Audio does not support Extended Stream Format Information615615+ // command. Use the hard-coded format, instead.616616+ buf[0] = 0x90;617617+ buf[1] = 0x40;618618+ buf[2] = avc_stream_rate_table[0];619619+ buf[3] = 0x00;620620+ buf[4] = 0x01;621621+622622+ if (dir == AVC_GENERAL_PLUG_DIR_IN)623623+ buf[5] = 0x08;624624+ else625625+ buf[5] = 0x02;626626+627627+ buf[6] = 0x06;628628+629629+ *len = 7;644630 }645631646632 /* parse and set stream format */
+9-1
sound/firewire/oxfw/oxfw.c
···2121#define VENDOR_TASCAM 0x00022e2222#define OUI_STANTON 0x0012602323#define OUI_APOGEE 0x0003db2424+#define OUI_OXFORD 0x0030e024252526#define MODEL_SATELLITE 0x00200f2627#define MODEL_SCS1M 0x001000···233232 if (err < 0)234233 goto error;235234235235+ if (entry->vendor_id == OUI_OXFORD && entry->model_id == 0x00f970) {236236+ oxfw->quirks |= SND_OXFW_QUIRK_STREAM_FORMAT_INFO_UNSUPPORTED |237237+ SND_OXFW_QUIRK_DBC_IS_TOTAL_PAYLOAD_QUADLETS;238238+ }239239+236240 err = snd_oxfw_stream_discover(oxfw);237241 if (err < 0)238242 goto error;···336330 //337331 OXFW_DEV_ENTRY(VENDOR_GRIFFIN, 0x00f970, &griffin_firewave),338332 OXFW_DEV_ENTRY(VENDOR_LACIE, 0x00f970, &lacie_speakers),333333+ // Miglia HarmonyAudio (HA02). The numeric vendor ID is ASIC vendor and the model ID is the334334+ // default value of ASIC.335335+ OXFW_DEV_ENTRY(OUI_OXFORD, 0x00f970, NULL),339336 // Behringer,F-Control Audio 202. The value of SYT field is not reliable at all.340337 OXFW_DEV_ENTRY(VENDOR_BEHRINGER, 0x00fc22, NULL),341338 // Loud Technologies, Tapco Link.FireWire 4x6. The value of SYT field is always 0xffff.···346337 // Loud Technologies, Mackie Onyx Satellite. Although revised version of firmware is347338 // installed to avoid the postpone, the value of SYT field is always 0xffff.348339 OXFW_DEV_ENTRY(VENDOR_LOUD, MODEL_SATELLITE, NULL),349349- // Miglia HarmonyAudio. Not yet identified.350340351341 //352342 // OXFW971 devices:
+6-1
sound/firewire/oxfw/oxfw.h
···5252 // performs media clock recovery voluntarily. In the recovery, the packets with NO_INFO5353 // are ignored, thus driver should transfer packets with timestamp.5454 SND_OXFW_QUIRK_VOLUNTARY_RECOVERY = 0x20,5555+ // Miglia Harmony Audio does not support AV/C Stream Format Information command.5656+ SND_OXFW_QUIRK_STREAM_FORMAT_INFO_UNSUPPORTED = 0x40,5757+ // Miglia Harmony Audio transmits CIP in which the value of dbc field expresses the number5858+ // of accumulated payload quadlets including the packet.5959+ SND_OXFW_QUIRK_DBC_IS_TOTAL_PAYLOAD_QUADLETS = 0x80,5560};56615762/* This is an arbitrary number for convinience. */···141136 unsigned int pcm;142137 unsigned int midi;143138};144144-int snd_oxfw_stream_parse_format(u8 *format,139139+int snd_oxfw_stream_parse_format(const u8 *format,145140 struct snd_oxfw_stream_formation *formation);146141int snd_oxfw_stream_get_current_formation(struct snd_oxfw *oxfw,147142 enum avc_general_plug_dir dir,
···116116 tristate117117 select FW_CS_DSP118118119119+config SND_HDA_SCODEC_COMPONENT120120+ tristate121121+119122config SND_HDA_SCODEC_CS35L41_I2C120123 tristate "Build CS35L41 HD-audio side codec support for I2C Bus"121124 depends on I2C···204201 tristate "Build Realtek HD-audio codec support"205202 select SND_HDA_GENERIC206203 select SND_HDA_GENERIC_LEDS204204+ select SND_HDA_SCODEC_COMPONENT207205 help208206 Say Y or M here to include Realtek HD-audio codec support in209207 snd-hda-intel driver, such as ALC880.
+2
sound/pci/hda/Makefile
···3737snd-hda-scodec-cs35l56-i2c-objs := cs35l56_hda_i2c.o3838snd-hda-scodec-cs35l56-spi-objs := cs35l56_hda_spi.o3939snd-hda-cs-dsp-ctls-objs := hda_cs_dsp_ctl.o4040+snd-hda-scodec-component-objs := hda_component.o4041snd-hda-scodec-tas2781-i2c-objs := tas2781_hda_i2c.o41424243# common driver···6867obj-$(CONFIG_SND_HDA_SCODEC_CS35L56_I2C) += snd-hda-scodec-cs35l56-i2c.o6968obj-$(CONFIG_SND_HDA_SCODEC_CS35L56_SPI) += snd-hda-scodec-cs35l56-spi.o7069obj-$(CONFIG_SND_HDA_CS_DSP_CONTROLS) += snd-hda-cs-dsp-ctls.o7070+obj-$(CONFIG_SND_HDA_SCODEC_COMPONENT) += snd-hda-scodec-component.o7171obj-$(CONFIG_SND_HDA_SCODEC_TAS2781_I2C) += snd-hda-scodec-tas2781-i2c.o72727373# this must be the last entry after codec drivers;
···693693 devid &= CS35L56_DEVID_MASK;694694695695 switch (devid) {696696+ case 0x35A54:696697 case 0x35A56:698698+ case 0x35A57:697699 break;698700 default:699701 dev_err(cs35l56_base->dev, "Unknown device %x\n", devid);700702 return ret;701703 }704704+705705+ cs35l56_base->type = devid & 0xFF;702706703707 ret = regmap_read(cs35l56_base->regmap, CS35L56_DSP_RESTRICT_STS1, &secured);704708 if (ret) {···724720 if (ret)725721 return ret;726722727727- dev_info(cs35l56_base->dev, "Cirrus Logic CS35L56%s Rev %02X OTP%d fw:%d.%d.%d (patched=%u)\n",728728- cs35l56_base->secured ? "s" : "", cs35l56_base->rev, otpid,723723+ dev_info(cs35l56_base->dev, "Cirrus Logic CS35L%02X%s Rev %02X OTP%d fw:%d.%d.%d (patched=%u)\n",724724+ cs35l56_base->type, cs35l56_base->secured ? "s" : "", cs35l56_base->rev, otpid,729725 fw_ver >> 16, (fw_ver >> 8) & 0xff, fw_ver & 0xff, !fw_missing);730726731727 /* Wake source and *_BLOCKED interrupts default to unmasked, so mask them */
+13-1
sound/soc/codecs/cs35l56.c
···972972 return -ENODEV;973973 }974974975975+ cs35l56->dsp.part = kasprintf(GFP_KERNEL, "cs35l%02x", cs35l56->base.type);976976+ if (!cs35l56->dsp.part)977977+ return -ENOMEM;978978+975979 cs35l56->component = component;976980 wm_adsp2_component_probe(&cs35l56->dsp, component);977981···10051001 wm_adsp_power_down(&cs35l56->dsp);1006100210071003 wm_adsp2_component_remove(&cs35l56->dsp, component);10041004+10051005+ kfree(cs35l56->dsp.part);10061006+ cs35l56->dsp.part = NULL;1008100710091008 kfree(cs35l56->dsp.fwf_name);10101009 cs35l56->dsp.fwf_name = NULL;···1228122112291222 dsp = &cs35l56->dsp;12301223 cs35l56_init_cs_dsp(&cs35l56->base, &dsp->cs_dsp);12311231- dsp->part = "cs35l56";12241224+12251225+ /*12261226+ * dsp->part is filled in later as it is based on the DEVID. In a12271227+ * SoundWire system that cannot be read until enumeration has occurred12281228+ * and the device has attached.12291229+ */12321230 dsp->fw = 12;12331231 dsp->wmfw_optional = true;12341232
+10-5
sound/soc/codecs/hda.c
···198198 ret = snd_hda_codec_device_new(codec->bus, component->card->snd_card, hdev->addr, codec,199199 false);200200 if (ret < 0) {201201- dev_err(&hdev->dev, "create hda codec failed: %d\n", ret);201201+ dev_err(&hdev->dev, "codec create failed: %d\n", ret);202202 goto device_new_err;203203 }204204205205 ret = snd_hda_codec_set_name(codec, codec->preset->name);206206 if (ret < 0) {207207- dev_err(&hdev->dev, "name failed %s\n", codec->preset->name);207207+ dev_err(&hdev->dev, "set name: %s failed: %d\n", codec->preset->name, ret);208208 goto err;209209 }210210211211 ret = snd_hdac_regmap_init(&codec->core);212212 if (ret < 0) {213213- dev_err(&hdev->dev, "regmap init failed\n");213213+ dev_err(&hdev->dev, "regmap init failed: %d\n", ret);214214 goto err;215215 }216216···223223224224 ret = patch(codec);225225 if (ret < 0) {226226- dev_err(&hdev->dev, "patch failed %d\n", ret);226226+ dev_err(&hdev->dev, "codec init failed: %d\n", ret);227227 goto err;228228 }229229230230 ret = snd_hda_codec_parse_pcms(codec);231231 if (ret < 0) {232232- dev_err(&hdev->dev, "unable to map pcms to dai %d\n", ret);232232+ dev_err(&hdev->dev, "unable to map pcms to dai: %d\n", ret);233233 goto parse_pcms_err;234234 }235235···349349{350350 struct hda_codec *codec = dev_to_hda_codec(&hdev->dev);351351 struct snd_soc_component_driver *comp_drv;352352+353353+ if (hda_codec_is_display(codec) && !hdev->bus->audio_component) {354354+ dev_dbg(&hdev->dev, "no i915, skip registration for 0x%08x\n", hdev->vendor_id);355355+ return -ENODEV;356356+ }352357353358 comp_drv = devm_kzalloc(&hdev->dev, sizeof(*comp_drv), GFP_KERNEL);354359 if (!comp_drv)
+5-4
sound/soc/intel/avs/core.c
···144144 /* configure effectively creates new ASoC component */145145 ret = snd_hda_codec_configure(codec);146146 if (ret < 0) {147147- dev_err(bus->dev, "failed to config codec %d\n", ret);147147+ dev_warn(bus->dev, "failed to config codec #%d: %d\n", addr, ret);148148 return ret;149149 }150150···153153154154static void avs_hdac_bus_probe_codecs(struct hdac_bus *bus)155155{156156- int c;156156+ int ret, c;157157158158 /* First try to probe all given codec slots */159159 for (c = 0; c < HDA_MAX_CODECS; c++) {160160 if (!(bus->codec_mask & BIT(c)))161161 continue;162162163163- if (!probe_codec(bus, c))164164- /* success, continue probing */163163+ ret = probe_codec(bus, c);164164+ /* Ignore codecs with no supporting driver. */165165+ if (!ret || ret == -ENODEV)165166 continue;166167167168 /*
···16521652 return NULL;16531653}1654165416551655+static int feature_unit_mutevol_ctl_name(struct usb_mixer_interface *mixer,16561656+ struct snd_kcontrol *kctl,16571657+ struct usb_audio_term *iterm,16581658+ struct usb_audio_term *oterm)16591659+{16601660+ struct usb_audio_term *aterm, *bterm;16611661+ bool output_first;16621662+ int len = 0;16631663+16641664+ /*16651665+ * If the input terminal is USB Streaming, we try getting the name of16661666+ * the output terminal first in hopes of getting something more16671667+ * descriptive than "PCM".16681668+ */16691669+ output_first = iterm && !(iterm->type >> 16) && (iterm->type & 0xff00) == 0x0100;16701670+16711671+ aterm = output_first ? oterm : iterm;16721672+ bterm = output_first ? iterm : oterm;16731673+16741674+ if (aterm)16751675+ len = get_term_name(mixer->chip, aterm, kctl->id.name,16761676+ sizeof(kctl->id.name), 1);16771677+ if (!len && bterm)16781678+ len = get_term_name(mixer->chip, bterm, kctl->id.name,16791679+ sizeof(kctl->id.name), 1);16801680+ return len;16811681+}16821682+16551683static void __build_feature_ctl(struct usb_mixer_interface *mixer,16561684 const struct usbmix_name_map *imap,16571685 unsigned int ctl_mask, int control,···17611733 case UAC_FU_MUTE:17621734 case UAC_FU_VOLUME:17631735 /*17641764- * determine the control name. the rule is:17651765- * - if a name id is given in descriptor, use it.17661766- * - if the connected input can be determined, then use the name17671767- * of terminal type.17681768- * - if the connected output can be determined, use it.17691769- * - otherwise, anonymous name.17361736+ * Determine the control name:17371737+ * - If a name id is given in descriptor, use it.17381738+ * - If input and output terminals are present, try to derive17391739+ * the name from either of these.17401740+ * - Otherwise, make up a name using the feature unit ID.17701741 */17711742 if (!len) {17721772- if (iterm)17731773- len = get_term_name(mixer->chip, iterm,17741774- kctl->id.name,17751775- sizeof(kctl->id.name), 1);17761776- if (!len && oterm)17771777- len = get_term_name(mixer->chip, oterm,17781778- kctl->id.name,17791779- sizeof(kctl->id.name), 1);17431743+ len = feature_unit_mutevol_ctl_name(mixer, kctl, iterm,17441744+ oterm);17801745 if (!len)17811746 snprintf(kctl->id.name, sizeof(kctl->id.name),17821747 "Feature %d", unitid);