summaryrefslogtreecommitdiff
path: root/sound/usb/mixer_scarlett_gen2.c
AgeCommit message (Collapse)Author
2021-09-30ALSA: usb-audio: Fix a missing error check in scarlett gen2 mixerTakashi Iwai
The check of the returned error code is missing in scarlett2_update_monitor_other(). Let's fix it. Fixes: d5bda7e03982 ("ALSA: usb-audio: scarlett2: Add support for the talkback feature") Reported-by: kernel test robot <lkp@intel.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/202109131831.9IodEzRx-lkp@intel.com Link: https://lore.kernel.org/r/20210929073540.9611-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-07-24ALSA: scarlett2: Fix line out/speaker switching notificationsGeoffrey D. Bennett
The values of the line output controls can change when the SW/HW switches are set to HW, and also when speaker switching is enabled. These notifications were sent with a mask of only SNDRV_CTL_EVENT_MASK_INFO. Change the notifications to set the SNDRV_CTL_EVENT_MASK_VALUE mask bit as well. When the mute control is updated, the notification was sent with a mask of SNDRV_CTL_EVENT_MASK_INFO. Change the mask to the correct value of SNDRV_CTL_EVENT_MASK_VALUE. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/8192e15ba62fa4bc90425c005f265c0de530be20.1626959758.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-07-24ALSA: scarlett2: Correct channel mute status after mute button pressedGeoffrey D. Bennett
After the hardware mute button is pressed, private->vol_updated is set so that the mute status is invalidated. As the channel mute values may be affected by the global mute value, update scarlett2_mute_ctl_get() to call scarlett2_update_volumes() if private->vol_updated is set. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/aa18ddbf8d8bd7f31832ab1b6b6057c00b931202.1626959758.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-07-24ALSA: scarlett2: Fix Direct Monitor control name for 2i2Geoffrey D. Bennett
The Direct Monitor control for the 2i2 is an enumerated value, not a boolean. Fix the control name to say "Playback Enum" instead of "Playback Switch" in this case. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/faf5de1d2100038e7d07520d770fda4a1adc276a.1626959758.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-07-24ALSA: scarlett2: Fix Mute/Dim/MSD Mode control namesGeoffrey D. Bennett
Append "Playback Switch" to the names of "Mute" and "Dim" controls, and append "Switch" to the "MSD Mode" control as per Documentation/sound/designs/control-names.rst. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/77f1000652c37e3217fb8dad8e156bc6392abc0b.1626959758.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-07-01ALSA: usb-audio: scarlett2: Fix for loop increment in scarlett2_usb_get_configNathan Chancellor
Clang warns: sound/usb/mixer_scarlett_gen2.c:1189:32: warning: expression result unused [-Wunused-value] for (i = 0; i < count; i++, (u16 *)buf++) ^ ~~~~~ 1 warning generated. It appears the intention was to cast the void pointer to a u16 pointer so that the data could be iterated through like an array of u16 values. However, the cast happens after the increment because a cast is an rvalue, whereas the post-increment operator only works on lvalues, so the loop does not iterate as expected. This is not a bug in practice because count is not greater than one at the moment but this could change in the future so this should be fixed. Replace the cast with a temporary variable of the proper type, which is less error prone and fixes the iteration. Do the same thing for the 'u8 *' below this if block. Fixes: ac34df733d2d ("ALSA: usb-audio: scarlett2: Update get_config to do endian conversion") Link: https://github.com/ClangBuiltLinux/linux/issues/1408 Acked-by: Geoffrey D. Bennett <g@b4.vu> Signed-off-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20210627051202.1888250-1-nathan@kernel.org Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-07-01ALSA: scarlett2: Fix scarlett2_*_ctl_put() return values againGeoffrey D. Bennett
Mixer control put callbacks should return 1 if the value is changed. Fix the mute, air, phantom, direct monitor, speaker switch, talkback, and MSD controls accordingly. Fix scarlett2_speaker_switch_enable() to not ignore the return value of scarlett2_sw_hw_change(). Reported-by: Aaron Wolf <aaron@wolftune.com> Tested-by: Aaron Wolf <aaron@wolftune.com> Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/76643f7ac81aef93351122d07881e30d51dcb1b9.1624798436.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-07-01ALSA: scarlett2: Fix pad count for 18i8 Gen 3Geoffrey D. Bennett
The 18i8 Gen 3 has 4 inputs with a pad control, not 2. Update s18i8_gen3_info.pad_input_count. Reported-by: Aaron Wolf <aaron@wolftune.com> Tested-by: Aaron Wolf <aaron@wolftune.com> Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/29a6ce412a42373daab7c96c395560461fcf08c6.1624798436.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Add support for the talkback featureGeoffrey D. Bennett
Add support for the talkback feature of the 18i20 Gen 3. Co-developed-by: Vladimir Sadovnikov <sadko4u@gmail.com> Signed-off-by: Vladimir Sadovnikov <sadko4u@gmail.com> Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/e39599893a7479c290e1aaec6c79dcee87681b47.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Update get_config to do endian conversionGeoffrey D. Bennett
For configuration items with a size of 16, scarlett2_usb_get_config() was filling *buf with little-endian data. Update it to convert to CPU endian. This function is not currently used so affects nothing yet; will be used by the upcoming talkback feature. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/cbc8b6eedd859dd27086ab4126d724a86dd50bcb.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Add speaker switching supportGeoffrey D. Bennett
The 18i8 and 18i20 Gen 3 support "speaker switching". Add a Speaker Switch control which can be set to Off/Main/Alt. When speaker switching is enabled or disabled, the interface may change the state of the Analog Outputs 3 and 4 routing and the global mute button, so use a flag private->speaker_switching_switched to note that those should be checked when the next "monitor other" notification is received. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/874193a534cd0aeb6f2e108ae761cadd2dc25ad2.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Update mux controls to allow updatesGeoffrey D. Bennett
Enabling/disabling speaker switching will update the mux configuration. To prepare for this, add a private->mux_updated flag and update the scarlett2_mux_src_enum_ctl_get() callback to check it. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/5ce3bb9fe4006b550d18c783c5ff640fe0bfbfcb.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Add sw_hw_ctls and mux_ctlsGeoffrey D. Bennett
Save the struct snd_kcontrol pointers for the sw_hw and mux controls. This is in preparation for speaker switching support which needs to be able to update those controls. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/269d89181bf29dbea80ba6f8cfff84fb23b77f86.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Split up sw_hw_enum_ctl_put()Geoffrey D. Bennett
Split part of scarlett2_sw_hw_enum_ctl_put() out into scarlett2_sw_hw_change() so that the code which actually makes the change is available in its own function. This will be used by the speaker switching support which needs to set the SW/HW switch to HW when speaker switching is enabled. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/f2cf91841ba067b490e7709bc4b14f4532b4ddd5.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Label 18i8 Gen 3 line outputs correctlyGeoffrey D. Bennett
The 18i8 Gen 3 analogue 7/8 outputs are identified as line 3/4 on the rear of the unit. Add support for remapping the channel numbers to match the labelling. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/461acb911509e60e9ab48109ece3bbadae7440c8.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Add direct monitor supportGeoffrey D. Bennett
The Solo and 2i2 devices don't have a mixer but they do have a "direct monitor" switch. Add support for getting and setting the state of this switch. Co-developed-by: Vladimir Sadovnikov <sadko4u@gmail.com> Signed-off-by: Vladimir Sadovnikov <sadko4u@gmail.com> Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/61d23dc4feb3b046d870ad7203e66ff2bd1d278c.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Add phantom power switch supportGeoffrey D. Bennett
Some inputs on Gen 3 models support software-selectable phantom power. Add support for getting and setting the state of those switches and the "Phantom Power Persistence" switch. Co-developed-by: Vladimir Sadovnikov <sadko4u@gmail.com> Signed-off-by: Vladimir Sadovnikov <sadko4u@gmail.com> Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/5837ce8a8c686560fc8f40b4204dd2a10721869b.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Add "air" switch supportGeoffrey D. Bennett
Some inputs on Gen 3 models have an "air" feature which can be enabled from the driver or (model-dependent) from the front panel. Add support for getting and setting the state of those switches. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/44d448a4150b9c068754759c9fdd2bfe21484487.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Add support for Solo and 2i2 Gen 3Geoffrey D. Bennett
Add initial support for the Focusrite Scarlett Solo and 2i2 devices: - They have no mixer - They don't support reporting sync status or levels - The configuration space is laid out differently to the other models - There is no level (line/inst) switch on input 1 of the Solo Co-developed-by: Vladimir Sadovnikov <sadko4u@gmail.com> Signed-off-by: Vladimir Sadovnikov <sadko4u@gmail.com> Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/190b90f6f1f8f8d4dfb5f0a7761ff8ae5c40fdde.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Allow bit-level access to configGeoffrey D. Bennett
Add support for accessing configuration values when multiple values are stored in one byte. Needed by the upcoming Solo and 2i2 Gen 3 support. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/4e54e9e106ec7029c1a668c51b4fc769a7eb4ed0.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Move get config above set configGeoffrey D. Bennett
Move scarlett2_usb_get() and scarlett2_usb_get_config() above the functions relating to updating the configuration so that scarlett2_usb_set_config() can call scarlett2_usb_get() in a subsequent patch. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/1549f8e44548be679119f0b1462f888f4a03812d.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Add Gen 3 MSD mode switchGeoffrey D. Bennett
Add a control to disable the Gen 3 MSD mode so that the full functionality of the device is available. Don't create the other controls until MSD mode is disabled. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/1cb93bbe585f6b0a74f5dc27450bc87e1f3776dc.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Add support for "input-other" notifyGeoffrey D. Bennett
Some models allow the level and pad settings to be controlled from the front-panel of the device. For these, the device will send an "input-other" notification to prompt the driver to re-read the status of those settings. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/06289a7697455e96b7dbdfd2d384d4b20f8df6e0.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Add Gen 3 mixer supportGeoffrey D. Bennett
Add mixer support for the Focusrite Scarlett 4i4, 8i6, 18i8, and 18i20 Gen 3 devices. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/22d0dc877dec026eb19630edec217ab72ebcd50a.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Fix wrong resume callTakashi Iwai
The current way of the scarlett2 mixer code managing the usb_mixer_elem_info object is wrong in two ways: it passes its internal index to the head.id field, and the val_type field is uninitialized. This ended up with the wrong execution at the resume because a bogus unit id is passed wrongly. Also, in the later code extensions, we'll have more mixer elements, and passing the index will overflow the unit id size (of 256). This patch corrects those issues. It introduces a new value type, USB_MIXER_BESPOKEN, which indicates a non-standard mixer element, and use this type for all scarlett2 mixer elements, as well as initializing the fixed unit id 0 for avoiding the overflow. Tested-by: Geoffrey D. Bennett <g@b4.vu> Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/49721219f45b7e175e729b0d9d9c142fd8f4342a.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Fix Level Meter controlGeoffrey D. Bennett
The Level Meter control had a fixed number of channels and therefore only worked with the 18i20 Gen 2. Fix the control to contain the correct number of channels. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/5e9a2d5c136270db2d048db53a3b4b6e6d4a63de.1624294591.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Split struct scarlett2_portsGeoffrey D. Bennett
The scarlett2_ports struct contains both generic (hardware IDs and descriptions) and model-specific (port count) data. Remove the generic data from the scarlett2_device_info struct so it is not repeated for every model. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/7a9e57e4e55a482390c692a9e60731d72b664a15.1624294591.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Allow arbitrary ordering of mux entriesGeoffrey D. Bennett
Some Gen 3 devices do not put all of the mux entries for the same port types together in order in the "set mux" message data. To prepare for this, replace the struct scarlett2_ports num[] array and the assignment_order[] array with mux_assignment[], a list of port types and ranges that is defined in the struct scarlett2_device_info. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/08e8d784d78262cb57496d28ef1ad7b6213a90ab.1624294591.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Add mute supportGeoffrey D. Bennett
For each analogue output, in addition to the output volume (gain) control, the hardware also has a mute control. Add ALSA mute controls for each analogue output. If the device has the line_out_hw_vol feature, then the mute control is disabled along with the output volume control when the switch is set to HW. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/6fad82174b44633e46cfd96332a038de74d544f2.1624294591.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Add scarlett2_vol_ctl_write() helperGeoffrey D. Bennett
Add helper function for setting the read/write status of a volume control. This will simplify the upcoming mute control support. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/00dd57e1abb3fa379fb51d4ac8537dbddc09f0ea.1624294591.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Remove repeated device info commentsGeoffrey D. Bennett
Document the fields of struct scarlett2_device_info in the definition of the struct, not in each instantiation. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/3486e4d38973333d4ec38f32578c16a9f97bf6c8.1624294591.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Move info lookup out of init functionGeoffrey D. Bennett
The info variable is not used by snd_scarlett_gen2_init() except to pass it to snd_scarlett_gen2_controls_create(), so move the lookup into that function. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/c4b6d17708e104503d9a2b88f9b3320bb9904cfa.1624294591.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Improve device info lookupGeoffrey D. Bennett
Add the USB device ID to the scarlett2_device_info struct so that the switch statement which finds the appropriate struct can be replaced with a loop that looks through an array of pointers to those structs. Suggested-by: Vladimir Sadovnikov <sadko4u@gmail.com> Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/474c408c29fb280a611e47e49e59ca2fb9810d27.1624294591.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Reformat scarlett2_config_items[]Geoffrey D. Bennett
Use designated initializers and merge lines in preparation for more configuration items coming soon. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/512d14eeb3571a266810c954d0f83140a3af7afc.1624294591.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Merge common line in capture stringsGeoffrey D. Bennett
Use a common sprintf() format for the mixer element names generated in scarlett2_add_line_in_ctls() in preparation for more of them. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/d91dce45ac75a541c21f47540ecbda24bd83f68c.1624294591.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Add "Sync Status" controlGeoffrey D. Bennett
Add "Sync Status" control to display the sync locked/unlocked status. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/d6967d7a34b2ea7e0672ba819e4ed8b99e8dcd35.1624294591.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Always enable interrupt pollingGeoffrey D. Bennett
Always enable interrupt polling as every model has some sort of status to report. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/8f49a6b9a9805ee0db221706193b7bb43b7fff75.1624294591.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Fix 6i6 Gen 2 line out descriptionsGeoffrey D. Bennett
There are two headphone outputs, and they map to the four analogue outputs. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/205e5e5348f08ded0cc4da5446f604d4b91db5bf.1624294591.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Update initialisation sequenceGeoffrey D. Bennett
The old initialisation code only works with Gen 2 devices. Replace it with an initialisation sequence that works on both Gen 2 and Gen 3 devices. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/6e5c4fedb74b813872f6a4b7fba30b6c471fa63a.1624294591.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Add usb_tx/rx functionsGeoffrey D. Bennett
Pull out snd_usb_ctl_msg() calls from scarlett2_usb() and put into scarlett2_usb_tx() and scarlett2_usb_rx() functions. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/720d1d6f227fc8f5d7d6191a8de62db796940235.1624294591.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21ALSA: usb-audio: scarlett2: Remove hard-coded USB #definesGeoffrey D. Bennett
Remove the hard-coded interface number and related constants for the vendor-specific interface and look them up from the USB endpoint descriptor. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/20210620164652.GA9237@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21ALSA: usb-audio: scarlett2: Don't copy struct scarlett2_configGeoffrey D. Bennett
scarlett2_usb_set_config() and scarlett2_usb_get_config() were copying struct scarlett2_config. Use a pointer instead. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/20210620164648.GA9231@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21ALSA: usb-audio: scarlett2: Fix union usage in mixer control callbacksGeoffrey D. Bennett
Fix mixer control callbacks to use the correct members of the struct snd_ctl_elem_value. The use of value.integer and value.enumerated were swapped in a few places. Update scarlett2_mux_src_enum_ctl_put() to use min() instead of clamp() as value.enumerated.item is unsigned. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/20210620164647.GA9226@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21ALSA: usb-audio: scarlett2: Fix scarlett2_*_ctl_put() return valuesGeoffrey D. Bennett
Mixer control put callbacks should return 1 if the value is changed. Fix the sw_hw, level, pad, and button controls accordingly. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/20210620164645.GA9221@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21ALSA: usb-audio: scarlett2: Fix data_mutex lockGeoffrey D. Bennett
The private->vol_updated flag was being checked outside of the mutex_lock/unlock() of private->data_mutex leading to the volume data being fetched twice from the device unnecessarily or old volume data being returned. Update scarlett2_*_ctl_get() and include the private->vol_updated flag check inside the critical region. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/20210620164643.GA9216@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21ALSA: usb-audio: scarlett2: Add temp variable for consistencyGeoffrey D. Bennett
Add index temporary variable to scarlett2_mixer_ctl_put() for consistency with the other *_ctl_put() functions. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/20210620164641.GA9211@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21ALSA: usb-audio: scarlett2: Rename struct scarlett2_mixer_dataGeoffrey D. Bennett
Rename struct scarlett2_mixer_data to struct scarlett2_data. A less-wordy name is better because it is used everywhere, and although this is a mixer driver, it also controls other vendor-specific features. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/20210620164639.GA9206@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21ALSA: usb-audio: scarlett2: Rename buttons/interrupts/volGeoffrey D. Bennett
To match the vendor's terminology, change #defines, identifiers, and comments: - mute/dim/hardware buttons are now called dim/mute - mixer status/interrupt is now notify - vol is now monitor Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/20210620164636.GA9199@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21ALSA: usb-audio: scarlett2: Remove redundant info->button_countGeoffrey D. Bennett
The per-model button_count value was used to determine whether dim/mute controls should be added, but these are present iff line_out_hw_vol is true. Remove button_count and replace with SCARLETT2_BUTTON_MAX and a check for line_out_hw_vol true. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/20210620164634.GA9193@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21ALSA: usb-audio: scarlett2: Remove interrupt debug messageGeoffrey D. Bennett
Just ignore instead of printing an error if the interrupt data is not the expected length. This check was for development and the condition has not been observed. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/20210620164632.GA9186@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>