From patchwork Sun Jun 20 16:46:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Geoffrey D. Bennett" X-Patchwork-Id: 464367 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C090C48BDF for ; Sun, 20 Jun 2021 16:48:14 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9079C6101D for ; Sun, 20 Jun 2021 16:48:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9079C6101D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=b4.vu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3043E16CC; Sun, 20 Jun 2021 18:47:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3043E16CC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1624207692; bh=m3Y5Http2zkTNDzXxbS46nNkf+hdngs0wdeEWu/JWIw=; h=Date:From:To:Subject:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=nYBdNAG5OMZ12AdaH/oPjlr/+5QkOjcMatScrj9N/ueAZoAu5+ceT4IFRLgSVBslu xaNcZLUC8kyUA4eaWovrN12BiAH7B0/KrkSeyVujhwvhzg3RH8LygmprA1/VUgXs1b Ujljn5kLSHplibiyp03ZV67RJDUcjq+84Nq/1jM8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A65DAF80166; Sun, 20 Jun 2021 18:46:35 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A1D9CF804D1; Sun, 20 Jun 2021 18:46:32 +0200 (CEST) Received: from m.b4.vu (m.b4.vu [203.16.231.148]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id DCBA1F8016D for ; Sun, 20 Jun 2021 18:46:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DCBA1F8016D Received: by m.b4.vu (Postfix, from userid 1000) id 76C7661E2877; Mon, 21 Jun 2021 02:16:22 +0930 (ACST) Date: Mon, 21 Jun 2021 02:16:22 +0930 From: "Geoffrey D. Bennett" To: alsa-devel@alsa-project.org, Takashi Iwai Subject: [PATCH 01/14] ALSA: usb-audio: scarlett2: Remove incorrect S/PDIF comment Message-ID: <20210620164622.GA9155@m.b4.vu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Hin-Tak Leung , Vladimir Sadovnikov X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The 18i8 Gen 2 S/PDIF outputs are available at 192kHz, unlike the 18i20 Gen 2. Remove the comment that says otherwise. Signed-off-by: Geoffrey D. Bennett --- sound/usb/mixer_scarlett_gen2.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c index a461317dc8c6..962050436a9f 100644 --- a/sound/usb/mixer_scarlett_gen2.c +++ b/sound/usb/mixer_scarlett_gen2.c @@ -338,10 +338,6 @@ static const struct scarlett2_device_info s18i8_gen2_info = { }, [SCARLETT2_PORT_TYPE_SPDIF] = { .id = 0x180, - /* S/PDIF outputs aren't available at 192kHz - * but are included in the USB mux I/O - * assignment message anyway - */ .num = { 2, 2, 2, 2, 2 }, .src_descr = "S/PDIF %d", .src_num_offset = 1, From patchwork Sun Jun 20 16:46:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Geoffrey D. Bennett" X-Patchwork-Id: 464366 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B41E0C48BDF for ; Sun, 20 Jun 2021 16:48:56 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BB1D961057 for ; Sun, 20 Jun 2021 16:48:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB1D961057 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=b4.vu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3917F16C2; Sun, 20 Jun 2021 18:48:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3917F16C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1624207734; bh=6/rRnTB1nb2/M0m8guvB9SU8Ce4dDl7vWaKxh5rveWw=; h=Date:From:To:Subject:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=SnIV6jqcEWoGUi+VS5UQrMaX+Jq/EKcSrjUHR5Ehs0EvL5OBiCm1WbzkTXW7I5V1i GopgGjf5at1yjDdJnezDNo/uO3cLFbzpW334LT3Dfa288KM/QRtkzLDPZo3xsIaOzT rPiLfEeDTcpX0+nK3vjKU4IvNB/jWK+63V8FUrqQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 36AADF804E4; Sun, 20 Jun 2021 18:46:50 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 440B8F804D9; Sun, 20 Jun 2021 18:46:39 +0200 (CEST) Received: from m.b4.vu (m.b4.vu [203.16.231.148]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D29AEF804D2 for ; Sun, 20 Jun 2021 18:46:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D29AEF804D2 Received: by m.b4.vu (Postfix, from userid 1000) id 60CFF61E287C; Mon, 21 Jun 2021 02:16:32 +0930 (ACST) Date: Mon, 21 Jun 2021 02:16:32 +0930 From: "Geoffrey D. Bennett" To: alsa-devel@alsa-project.org, Takashi Iwai Subject: [PATCH 05/14] ALSA: usb-audio: scarlett2: Remove interrupt debug message Message-ID: <20210620164632.GA9186@m.b4.vu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Hin-Tak Leung , Vladimir Sadovnikov X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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 --- sound/usb/mixer_scarlett_gen2.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c index a5f5c537e344..3225ec709d98 100644 --- a/sound/usb/mixer_scarlett_gen2.c +++ b/sound/usb/mixer_scarlett_gen2.c @@ -2018,19 +2018,14 @@ static void scarlett2_mixer_interrupt(struct urb *urb) int ustatus = urb->status; u32 data; - if (ustatus != 0) + if (ustatus != 0 || len != 8) goto requeue; - if (len == 8) { - data = le32_to_cpu(*(__le32 *)urb->transfer_buffer); - if (data & SCARLETT2_USB_INTERRUPT_VOL_CHANGE) - scarlett2_mixer_interrupt_vol_change(mixer); - if (data & SCARLETT2_USB_INTERRUPT_BUTTON_CHANGE) - scarlett2_mixer_interrupt_button_change(mixer); - } else { - usb_audio_err(mixer->chip, - "scarlett mixer interrupt length %d\n", len); - } + data = le32_to_cpu(*(__le32 *)urb->transfer_buffer); + if (data & SCARLETT2_USB_INTERRUPT_VOL_CHANGE) + scarlett2_mixer_interrupt_vol_change(mixer); + if (data & SCARLETT2_USB_INTERRUPT_BUTTON_CHANGE) + scarlett2_mixer_interrupt_button_change(mixer); requeue: if (ustatus != -ENOENT && From patchwork Sun Jun 20 16:46:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Geoffrey D. Bennett" X-Patchwork-Id: 464365 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C459FC48BDF for ; Sun, 20 Jun 2021 16:49:34 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 444776109F for ; Sun, 20 Jun 2021 16:49:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 444776109F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=b4.vu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BDA1816C5; Sun, 20 Jun 2021 18:48:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BDA1816C5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1624207772; bh=+hRmgP2GZB/HvQmOCXmX66vmU3hPah1+HCo8SBg5gA0=; h=Date:From:To:Subject:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=EAwXzoM8+L9jOZTNRArOs3mbtgpuzb9oToeio1irAxphivO3D+VZNiKjXaOTsH0pe EeqqBvijt/niCI+Ux0lGlPUUjdRp//qCRIbKYz7H/mLg7cg4REbwvS5vsJ38ERbivQ MwdKnfvTtZgB1akQDDg06jUD3VTS4u5m2OnA0Jd0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0A0F3F804E3; Sun, 20 Jun 2021 18:46:53 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 73716F804D8; Sun, 20 Jun 2021 18:46:42 +0200 (CEST) Received: from m.b4.vu (m.b4.vu [203.16.231.148]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2DC7EF8026A for ; Sun, 20 Jun 2021 18:46:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2DC7EF8026A Received: by m.b4.vu (Postfix, from userid 1000) id B0DF661E287D; Mon, 21 Jun 2021 02:16:36 +0930 (ACST) Date: Mon, 21 Jun 2021 02:16:36 +0930 From: "Geoffrey D. Bennett" To: alsa-devel@alsa-project.org, Takashi Iwai Subject: [PATCH 07/14] ALSA: usb-audio: scarlett2: Rename buttons/interrupts/vol Message-ID: <20210620164636.GA9199@m.b4.vu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Hin-Tak Leung , Vladimir Sadovnikov X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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 --- sound/usb/mixer_scarlett_gen2.c | 94 ++++++++++++++++----------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c index 043b0929ad9d..4e2ee979b9bd 100644 --- a/sound/usb/mixer_scarlett_gen2.c +++ b/sound/usb/mixer_scarlett_gen2.c @@ -194,10 +194,10 @@ enum { SCARLETT2_PORT_DIRNS = 5, }; -/* Hardware buttons on the 18i20 */ -#define SCARLETT2_BUTTON_MAX 2 +/* Dim/Mute buttons on the 18i20 */ +#define SCARLETT2_DIM_MUTE_COUNT 2 -static const char *const scarlett2_button_names[SCARLETT2_BUTTON_MAX] = { +static const char *const scarlett2_dim_mute_names[SCARLETT2_DIM_MUTE_COUNT] = { "Mute", "Dim" }; @@ -239,10 +239,10 @@ struct scarlett2_mixer_data { u8 vol_sw_hw_switch[SCARLETT2_ANALOGUE_MAX]; u8 level_switch[SCARLETT2_LEVEL_SWITCH_MAX]; u8 pad_switch[SCARLETT2_PAD_SWITCH_MAX]; - u8 buttons[SCARLETT2_BUTTON_MAX]; + u8 dim_mute[SCARLETT2_DIM_MUTE_COUNT]; struct snd_kcontrol *master_vol_ctl; struct snd_kcontrol *vol_ctls[SCARLETT2_ANALOGUE_MAX]; - struct snd_kcontrol *button_ctls[SCARLETT2_BUTTON_MAX]; + struct snd_kcontrol *dim_mute_ctls[SCARLETT2_DIM_MUTE_COUNT]; u8 mux[SCARLETT2_MUX_MAX]; u8 mix[SCARLETT2_INPUT_MIX_MAX * SCARLETT2_OUTPUT_MIX_MAX]; }; @@ -450,9 +450,9 @@ static int scarlett2_get_port_start_num(const struct scarlett2_ports *ports, #define SCARLETT2_USB_INTERRUPT_MAX_DATA 64 #define SCARLETT2_USB_INTERRUPT_INTERVAL 3 -/* Interrupt flags for volume and mute/dim button changes */ -#define SCARLETT2_USB_INTERRUPT_VOL_CHANGE 0x00400000 -#define SCARLETT2_USB_INTERRUPT_BUTTON_CHANGE 0x00200000 +/* Interrupt flags for dim/mute button and monitor changes */ +#define SCARLETT2_USB_NOTIFY_DIM_MUTE 0x00200000 +#define SCARLETT2_USB_NOTIFY_MONITOR 0x00400000 /* Commands for sending/receiving requests/responses */ #define SCARLETT2_USB_VENDOR_SPECIFIC_CMD_REQ 2 @@ -475,8 +475,8 @@ static int scarlett2_get_port_start_num(const struct scarlett2_ports *ports, /* volume status is read together (matches scarlett2_config_items[]) */ struct scarlett2_usb_volume_status { - /* mute & dim buttons */ - u8 buttons[SCARLETT2_BUTTON_MAX]; + /* dim/mute buttons */ + u8 dim_mute[SCARLETT2_DIM_MUTE_COUNT]; u8 pad1; @@ -499,7 +499,7 @@ struct scarlett2_usb_volume_status { /* Configuration parameters that can be read and written */ enum { - SCARLETT2_CONFIG_BUTTONS = 0, + SCARLETT2_CONFIG_DIM_MUTE = 0, SCARLETT2_CONFIG_LINE_OUT_VOLUME = 1, SCARLETT2_CONFIG_SW_HW_SWITCH = 2, SCARLETT2_CONFIG_LEVEL_SWITCH = 3, @@ -518,7 +518,7 @@ struct scarlett2_config { static const struct scarlett2_config scarlett2_config_items[SCARLETT2_CONFIG_COUNT] = { - /* Mute/Dim Buttons */ + /* Dim/Mute Buttons */ { .offset = 0x31, .size = 1, @@ -1127,8 +1127,8 @@ static int scarlett2_update_volumes(struct usb_mixer_interface *mixer) } if (info->line_out_hw_vol) - for (i = 0; i < SCARLETT2_BUTTON_MAX; i++) - private->buttons[i] = !!volume_status.buttons[i]; + for (i = 0; i < SCARLETT2_DIM_MUTE_COUNT; i++) + private->dim_mute[i] = !!volume_status.dim_mute[i]; return 0; } @@ -1430,10 +1430,10 @@ static const struct snd_kcontrol_new scarlett2_pad_ctl = { .put = scarlett2_pad_ctl_put, }; -/*** Mute/Dim Controls ***/ +/*** Dim/Mute Controls ***/ -static int scarlett2_button_ctl_get(struct snd_kcontrol *kctl, - struct snd_ctl_elem_value *ucontrol) +static int scarlett2_dim_mute_ctl_get(struct snd_kcontrol *kctl, + struct snd_ctl_elem_value *ucontrol) { struct usb_mixer_elem_info *elem = kctl->private_data; struct usb_mixer_interface *mixer = elem->head.mixer; @@ -1445,12 +1445,12 @@ static int scarlett2_button_ctl_get(struct snd_kcontrol *kctl, mutex_unlock(&private->data_mutex); } - ucontrol->value.enumerated.item[0] = private->buttons[elem->control]; + ucontrol->value.enumerated.item[0] = private->dim_mute[elem->control]; return 0; } -static int scarlett2_button_ctl_put(struct snd_kcontrol *kctl, - struct snd_ctl_elem_value *ucontrol) +static int scarlett2_dim_mute_ctl_put(struct snd_kcontrol *kctl, + struct snd_ctl_elem_value *ucontrol) { struct usb_mixer_elem_info *elem = kctl->private_data; struct usb_mixer_interface *mixer = elem->head.mixer; @@ -1461,16 +1461,16 @@ static int scarlett2_button_ctl_put(struct snd_kcontrol *kctl, mutex_lock(&private->data_mutex); - oval = private->buttons[index]; + oval = private->dim_mute[index]; val = !!ucontrol->value.integer.value[0]; if (oval == val) goto unlock; - private->buttons[index] = val; + private->dim_mute[index] = val; /* Send switch change to the device */ - err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_BUTTONS, + err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_DIM_MUTE, index, val); unlock: @@ -1478,12 +1478,12 @@ static int scarlett2_button_ctl_put(struct snd_kcontrol *kctl, return err; } -static const struct snd_kcontrol_new scarlett2_button_ctl = { +static const struct snd_kcontrol_new scarlett2_dim_mute_ctl = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "", .info = snd_ctl_boolean_mono_info, - .get = scarlett2_button_ctl_get, - .put = scarlett2_button_ctl_put + .get = scarlett2_dim_mute_ctl_get, + .put = scarlett2_dim_mute_ctl_put }; /*** Create the analogue output controls ***/ @@ -1544,13 +1544,13 @@ static int scarlett2_add_line_out_ctls(struct usb_mixer_interface *mixer) } } - /* Add HW button controls */ + /* Add dim/mute controls */ if (info->line_out_hw_vol) - for (i = 0; i < SCARLETT2_BUTTON_MAX; i++) { + for (i = 0; i < SCARLETT2_DIM_MUTE_COUNT; i++) { err = scarlett2_add_new_ctl( - mixer, &scarlett2_button_ctl, - i, 1, scarlett2_button_names[i], - &private->button_ctls[i]); + mixer, &scarlett2_dim_mute_ctl, + i, 1, scarlett2_dim_mute_names[i], + &private->dim_mute_ctls[i]); if (err < 0) return err; } @@ -1962,8 +1962,8 @@ static int scarlett2_read_configs(struct usb_mixer_interface *mixer) } if (info->line_out_hw_vol) - for (i = 0; i < SCARLETT2_BUTTON_MAX; i++) - private->buttons[i] = !!volume_status.buttons[i]; + for (i = 0; i < SCARLETT2_DIM_MUTE_COUNT; i++) + private->dim_mute[i] = !!volume_status.dim_mute[i]; for (i = 0; i < num_mixer_out; i++) { err = scarlett2_usb_get_mix(mixer, i); @@ -1974,8 +1974,8 @@ static int scarlett2_read_configs(struct usb_mixer_interface *mixer) return scarlett2_usb_get_mux(mixer); } -/* Notify on volume change */ -static void scarlett2_mixer_interrupt_vol_change( +/* Notify on monitor change */ +static void scarlett2_notify_monitor( struct usb_mixer_interface *mixer) { struct scarlett2_mixer_data *private = mixer->private_data; @@ -1997,8 +1997,8 @@ static void scarlett2_mixer_interrupt_vol_change( } } -/* Notify on button change */ -static void scarlett2_mixer_interrupt_button_change( +/* Notify on dim/mute change */ +static void scarlett2_notify_dim_mute( struct usb_mixer_interface *mixer) { struct scarlett2_mixer_data *private = mixer->private_data; @@ -2010,13 +2010,13 @@ static void scarlett2_mixer_interrupt_button_change( if (!info->line_out_hw_vol) return; - for (i = 0; i < SCARLETT2_BUTTON_MAX; i++) + for (i = 0; i < SCARLETT2_DIM_MUTE_COUNT; i++) snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE, - &private->button_ctls[i]->id); + &private->dim_mute_ctls[i]->id); } /* Interrupt callback */ -static void scarlett2_mixer_interrupt(struct urb *urb) +static void scarlett2_notify(struct urb *urb) { struct usb_mixer_interface *mixer = urb->context; int len = urb->actual_length; @@ -2027,10 +2027,10 @@ static void scarlett2_mixer_interrupt(struct urb *urb) goto requeue; data = le32_to_cpu(*(__le32 *)urb->transfer_buffer); - if (data & SCARLETT2_USB_INTERRUPT_VOL_CHANGE) - scarlett2_mixer_interrupt_vol_change(mixer); - if (data & SCARLETT2_USB_INTERRUPT_BUTTON_CHANGE) - scarlett2_mixer_interrupt_button_change(mixer); + if (data & SCARLETT2_USB_NOTIFY_MONITOR) + scarlett2_notify_monitor(mixer); + if (data & SCARLETT2_USB_NOTIFY_DIM_MUTE) + scarlett2_notify_dim_mute(mixer); requeue: if (ustatus != -ENOENT && @@ -2041,7 +2041,7 @@ static void scarlett2_mixer_interrupt(struct urb *urb) } } -static int scarlett2_mixer_status_create(struct usb_mixer_interface *mixer) +static int scarlett2_init_notify(struct usb_mixer_interface *mixer) { struct usb_device *dev = mixer->chip->dev; unsigned int pipe = usb_rcvintpipe(dev, @@ -2067,7 +2067,7 @@ static int scarlett2_mixer_status_create(struct usb_mixer_interface *mixer) usb_fill_int_urb(mixer->urb, dev, pipe, transfer_buffer, SCARLETT2_USB_INTERRUPT_MAX_DATA, - scarlett2_mixer_interrupt, mixer, + scarlett2_notify, mixer, SCARLETT2_USB_INTERRUPT_INTERVAL); return usb_submit_urb(mixer->urb, GFP_KERNEL); @@ -2115,7 +2115,7 @@ static int snd_scarlett_gen2_controls_create(struct usb_mixer_interface *mixer, /* Set up the interrupt polling if there are hardware buttons */ if (info->line_out_hw_vol) { - err = scarlett2_mixer_status_create(mixer); + err = scarlett2_init_notify(mixer); if (err < 0) return err; } From patchwork Sun Jun 20 16:46:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Geoffrey D. Bennett" X-Patchwork-Id: 464364 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8648CC48BDF for ; Sun, 20 Jun 2021 16:50:16 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F0E66108E for ; Sun, 20 Jun 2021 16:50:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F0E66108E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=b4.vu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 942A316D0; Sun, 20 Jun 2021 18:49:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 942A316D0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1624207814; bh=ex09WMPidBI0C7Yjq7ItjztIe8KwibSQFiCslK+rV0I=; h=Date:From:To:Subject:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=BQq2NB6Rd4YamDrrX+EQi9Yfw2WKTnGpzQeOvkWnG1PfRnWHkf+Cy/w3UJwgb1wZF Qrh4w1VxLBKuF3nesnoOwEiVnDklAD7SzapkV0pepTA/qic0g9p4Y3vsQdK57hjqbx uAMRgurvTbgJj9eUUms8XKoIMDk9Y+r9AHMQab+o= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id EEBF9F804FF; Sun, 20 Jun 2021 18:46:54 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 49995F804D8; Sun, 20 Jun 2021 18:46:45 +0200 (CEST) Received: from m.b4.vu (m.b4.vu [203.16.231.148]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id B790CF8016D for ; Sun, 20 Jun 2021 18:46:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B790CF8016D Received: by m.b4.vu (Postfix, from userid 1000) id 457B561E5F01; Mon, 21 Jun 2021 02:16:39 +0930 (ACST) Date: Mon, 21 Jun 2021 02:16:39 +0930 From: "Geoffrey D. Bennett" To: alsa-devel@alsa-project.org, Takashi Iwai Subject: [PATCH 08/14] ALSA: usb-audio: scarlett2: Rename struct scarlett2_mixer_data Message-ID: <20210620164639.GA9206@m.b4.vu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Hin-Tak Leung , Vladimir Sadovnikov X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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 --- sound/usb/mixer_scarlett_gen2.c | 80 ++++++++++++++++----------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c index 4e2ee979b9bd..c1e74918425a 100644 --- a/sound/usb/mixer_scarlett_gen2.c +++ b/sound/usb/mixer_scarlett_gen2.c @@ -224,7 +224,7 @@ struct scarlett2_device_info { struct scarlett2_ports ports[SCARLETT2_PORT_TYPE_COUNT]; }; -struct scarlett2_mixer_data { +struct scarlett2_data { struct usb_mixer_interface *mixer; struct mutex usb_mutex; /* prevent sending concurrent USB requests */ struct mutex data_mutex; /* lock access to this data */ @@ -564,7 +564,7 @@ struct scarlett2_usb_packet { u8 data[]; }; -static void scarlett2_fill_request_header(struct scarlett2_mixer_data *private, +static void scarlett2_fill_request_header(struct scarlett2_data *private, struct scarlett2_usb_packet *req, u32 cmd, u16 req_size) { @@ -583,7 +583,7 @@ static int scarlett2_usb( struct usb_mixer_interface *mixer, u32 cmd, void *req_data, u16 req_size, void *resp_data, u16 resp_size) { - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; u16 req_buf_size = sizeof(struct scarlett2_usb_packet) + req_size; u16 resp_buf_size = sizeof(struct scarlett2_usb_packet) + resp_size; struct scarlett2_usb_packet *req, *resp = NULL; @@ -693,8 +693,8 @@ static void scarlett2_config_save(struct usb_mixer_interface *mixer) /* Delayed work to save config */ static void scarlett2_config_save_work(struct work_struct *work) { - struct scarlett2_mixer_data *private = - container_of(work, struct scarlett2_mixer_data, work.work); + struct scarlett2_data *private = + container_of(work, struct scarlett2_data, work.work); scarlett2_config_save(private->mixer); } @@ -715,7 +715,7 @@ static int scarlett2_usb_set_config( } __packed req; __le32 req2; int err; - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; /* Cancel any pending NVRAM save */ cancel_delayed_work_sync(&private->work); @@ -786,7 +786,7 @@ static int scarlett2_usb_get_volume_status( static int scarlett2_usb_get_mix(struct usb_mixer_interface *mixer, int mix_num) { - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; const struct scarlett2_device_info *info = private->info; int num_mixer_in = @@ -829,7 +829,7 @@ static int scarlett2_usb_get_mix(struct usb_mixer_interface *mixer, static int scarlett2_usb_set_mix(struct usb_mixer_interface *mixer, int mix_num) { - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; const struct scarlett2_device_info *info = private->info; struct { @@ -895,7 +895,7 @@ static u32 scarlett2_mux_id_to_num(const struct scarlett2_ports *ports, } /* Convert one mux entry from the interface and load into private->mux[] */ -static void scarlett2_usb_populate_mux(struct scarlett2_mixer_data *private, +static void scarlett2_usb_populate_mux(struct scarlett2_data *private, u32 mux_entry) { const struct scarlett2_device_info *info = private->info; @@ -933,7 +933,7 @@ static void scarlett2_usb_populate_mux(struct scarlett2_mixer_data *private, /* Send USB message to get mux inputs and then populate private->mux[] */ static int scarlett2_usb_get_mux(struct usb_mixer_interface *mixer) { - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; int count = private->num_mux_dsts; int err, i; @@ -962,7 +962,7 @@ static int scarlett2_usb_get_mux(struct usb_mixer_interface *mixer) /* Send USB messages to set mux inputs */ static int scarlett2_usb_set_mux(struct usb_mixer_interface *mixer) { - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; const struct scarlett2_device_info *info = private->info; const struct scarlett2_ports *ports = info->ports; int rate, port_dir_rate; @@ -1103,7 +1103,7 @@ static int scarlett2_add_new_ctl(struct usb_mixer_interface *mixer, */ static int scarlett2_update_volumes(struct usb_mixer_interface *mixer) { - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; const struct scarlett2_device_info *info = private->info; const struct scarlett2_ports *ports = info->ports; struct scarlett2_usb_volume_status volume_status; @@ -1151,7 +1151,7 @@ static int scarlett2_master_volume_ctl_get(struct snd_kcontrol *kctl, { struct usb_mixer_elem_info *elem = kctl->private_data; struct usb_mixer_interface *mixer = elem->head.mixer; - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; if (private->vol_updated) { mutex_lock(&private->data_mutex); @@ -1168,7 +1168,7 @@ static int scarlett2_volume_ctl_get(struct snd_kcontrol *kctl, { struct usb_mixer_elem_info *elem = kctl->private_data; struct usb_mixer_interface *mixer = elem->head.mixer; - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; int index = elem->control; if (private->vol_updated) { @@ -1186,7 +1186,7 @@ static int scarlett2_volume_ctl_put(struct snd_kcontrol *kctl, { struct usb_mixer_elem_info *elem = kctl->private_data; struct usb_mixer_interface *mixer = elem->head.mixer; - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; int index = elem->control; int oval, val, err = 0; @@ -1252,7 +1252,7 @@ static int scarlett2_sw_hw_enum_ctl_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol) { struct usb_mixer_elem_info *elem = kctl->private_data; - struct scarlett2_mixer_data *private = elem->head.mixer->private_data; + struct scarlett2_data *private = elem->head.mixer->private_data; ucontrol->value.enumerated.item[0] = private->vol_sw_hw_switch[elem->control]; @@ -1264,7 +1264,7 @@ static int scarlett2_sw_hw_enum_ctl_put(struct snd_kcontrol *kctl, { struct usb_mixer_elem_info *elem = kctl->private_data; struct usb_mixer_interface *mixer = elem->head.mixer; - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; int index = elem->control; int oval, val, err = 0; @@ -1336,7 +1336,7 @@ static int scarlett2_level_enum_ctl_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol) { struct usb_mixer_elem_info *elem = kctl->private_data; - struct scarlett2_mixer_data *private = elem->head.mixer->private_data; + struct scarlett2_data *private = elem->head.mixer->private_data; ucontrol->value.enumerated.item[0] = private->level_switch[elem->control]; @@ -1348,7 +1348,7 @@ static int scarlett2_level_enum_ctl_put(struct snd_kcontrol *kctl, { struct usb_mixer_elem_info *elem = kctl->private_data; struct usb_mixer_interface *mixer = elem->head.mixer; - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; int index = elem->control; int oval, val, err = 0; @@ -1386,7 +1386,7 @@ static int scarlett2_pad_ctl_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol) { struct usb_mixer_elem_info *elem = kctl->private_data; - struct scarlett2_mixer_data *private = elem->head.mixer->private_data; + struct scarlett2_data *private = elem->head.mixer->private_data; ucontrol->value.enumerated.item[0] = private->pad_switch[elem->control]; @@ -1398,7 +1398,7 @@ static int scarlett2_pad_ctl_put(struct snd_kcontrol *kctl, { struct usb_mixer_elem_info *elem = kctl->private_data; struct usb_mixer_interface *mixer = elem->head.mixer; - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; int index = elem->control; int oval, val, err = 0; @@ -1437,7 +1437,7 @@ static int scarlett2_dim_mute_ctl_get(struct snd_kcontrol *kctl, { struct usb_mixer_elem_info *elem = kctl->private_data; struct usb_mixer_interface *mixer = elem->head.mixer; - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; if (private->vol_updated) { mutex_lock(&private->data_mutex); @@ -1454,7 +1454,7 @@ static int scarlett2_dim_mute_ctl_put(struct snd_kcontrol *kctl, { struct usb_mixer_elem_info *elem = kctl->private_data; struct usb_mixer_interface *mixer = elem->head.mixer; - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; int index = elem->control; int oval, val, err = 0; @@ -1490,7 +1490,7 @@ static const struct snd_kcontrol_new scarlett2_dim_mute_ctl = { static int scarlett2_add_line_out_ctls(struct usb_mixer_interface *mixer) { - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; const struct scarlett2_device_info *info = private->info; const struct scarlett2_ports *ports = info->ports; int num_line_out = @@ -1562,7 +1562,7 @@ static int scarlett2_add_line_out_ctls(struct usb_mixer_interface *mixer) static int scarlett2_add_line_in_ctls(struct usb_mixer_interface *mixer) { - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; const struct scarlett2_device_info *info = private->info; int err, i; char s[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; @@ -1607,7 +1607,7 @@ static int scarlett2_mixer_ctl_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol) { struct usb_mixer_elem_info *elem = kctl->private_data; - struct scarlett2_mixer_data *private = elem->head.mixer->private_data; + struct scarlett2_data *private = elem->head.mixer->private_data; ucontrol->value.integer.value[0] = private->mix[elem->control]; return 0; @@ -1618,7 +1618,7 @@ static int scarlett2_mixer_ctl_put(struct snd_kcontrol *kctl, { struct usb_mixer_elem_info *elem = kctl->private_data; struct usb_mixer_interface *mixer = elem->head.mixer; - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; const struct scarlett2_device_info *info = private->info; const struct scarlett2_ports *ports = info->ports; int oval, val, num_mixer_in, mix_num, err = 0; @@ -1663,7 +1663,7 @@ static const struct snd_kcontrol_new scarlett2_mixer_ctl = { static int scarlett2_add_mixer_ctls(struct usb_mixer_interface *mixer) { - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; const struct scarlett2_ports *ports = private->info->ports; int err, i, j; int index; @@ -1692,7 +1692,7 @@ static int scarlett2_mux_src_enum_ctl_info(struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo) { struct usb_mixer_elem_info *elem = kctl->private_data; - struct scarlett2_mixer_data *private = elem->head.mixer->private_data; + struct scarlett2_data *private = elem->head.mixer->private_data; const struct scarlett2_ports *ports = private->info->ports; unsigned int item = uinfo->value.enumerated.item; int items = private->num_mux_srcs; @@ -1724,7 +1724,7 @@ static int scarlett2_mux_src_enum_ctl_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ucontrol) { struct usb_mixer_elem_info *elem = kctl->private_data; - struct scarlett2_mixer_data *private = elem->head.mixer->private_data; + struct scarlett2_data *private = elem->head.mixer->private_data; ucontrol->value.enumerated.item[0] = private->mux[elem->control]; return 0; @@ -1735,7 +1735,7 @@ static int scarlett2_mux_src_enum_ctl_put(struct snd_kcontrol *kctl, { struct usb_mixer_elem_info *elem = kctl->private_data; struct usb_mixer_interface *mixer = elem->head.mixer; - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; int index = elem->control; int oval, val, err = 0; @@ -1768,7 +1768,7 @@ static const struct snd_kcontrol_new scarlett2_mux_src_enum_ctl = { static int scarlett2_add_mux_enums(struct usb_mixer_interface *mixer) { - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; const struct scarlett2_ports *ports = private->info->ports; int port_type, channel, i; @@ -1847,7 +1847,7 @@ static int scarlett2_add_meter_ctl(struct usb_mixer_interface *mixer) static void scarlett2_private_free(struct usb_mixer_interface *mixer) { - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; cancel_delayed_work_sync(&private->work); kfree(private); @@ -1856,7 +1856,7 @@ static void scarlett2_private_free(struct usb_mixer_interface *mixer) static void scarlett2_private_suspend(struct usb_mixer_interface *mixer) { - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; if (cancel_delayed_work_sync(&private->work)) scarlett2_config_save(private->mixer); @@ -1864,7 +1864,7 @@ static void scarlett2_private_suspend(struct usb_mixer_interface *mixer) /*** Initialisation ***/ -static void scarlett2_count_mux_io(struct scarlett2_mixer_data *private) +static void scarlett2_count_mux_io(struct scarlett2_data *private) { const struct scarlett2_ports *ports = private->info->ports; int port_type, srcs = 0, dsts = 0; @@ -1884,8 +1884,8 @@ static void scarlett2_count_mux_io(struct scarlett2_mixer_data *private) static int scarlett2_init_private(struct usb_mixer_interface *mixer, const struct scarlett2_device_info *info) { - struct scarlett2_mixer_data *private = - kzalloc(sizeof(struct scarlett2_mixer_data), GFP_KERNEL); + struct scarlett2_data *private = + kzalloc(sizeof(struct scarlett2_data), GFP_KERNEL); if (!private) return -ENOMEM; @@ -1908,7 +1908,7 @@ static int scarlett2_init_private(struct usb_mixer_interface *mixer, /* Read configuration from the interface on start */ static int scarlett2_read_configs(struct usb_mixer_interface *mixer) { - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; const struct scarlett2_device_info *info = private->info; const struct scarlett2_ports *ports = info->ports; int num_line_out = @@ -1978,7 +1978,7 @@ static int scarlett2_read_configs(struct usb_mixer_interface *mixer) static void scarlett2_notify_monitor( struct usb_mixer_interface *mixer) { - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; const struct scarlett2_ports *ports = private->info->ports; int num_line_out = ports[SCARLETT2_PORT_TYPE_ANALOGUE].num[SCARLETT2_PORT_OUT]; @@ -2001,7 +2001,7 @@ static void scarlett2_notify_monitor( static void scarlett2_notify_dim_mute( struct usb_mixer_interface *mixer) { - struct scarlett2_mixer_data *private = mixer->private_data; + struct scarlett2_data *private = mixer->private_data; const struct scarlett2_device_info *info = private->info; int i; From patchwork Sun Jun 20 16:46:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Geoffrey D. Bennett" X-Patchwork-Id: 464363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9843C48BDF for ; Sun, 20 Jun 2021 16:50:57 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 496136108E for ; Sun, 20 Jun 2021 16:50:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 496136108E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=b4.vu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id ADFFE16CD; Sun, 20 Jun 2021 18:50:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz ADFFE16CD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1624207855; bh=ZKR5bEo9lAxIPxR2+dKkAJV+zpdnH93y9LQeQ/LPr8I=; h=Date:From:To:Subject:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=khAm7RaGF9/kKgWIhvEssqiSe5aPXj32VQmXZhp9YacdaAvdAthl6t1m+RBD0uhEu Qusu36xgzu7jPy8Cdi6nBQqx9zJASN8YyLMJ4Eoc+BECz6oM3eHTqdSlYg/c+3UGFe w694NLb7Qm/6gtBItVZiFmhdSMBBRhtUN4NdLHDk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 10092F80515; Sun, 20 Jun 2021 18:46:56 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A5D2FF8026A; Sun, 20 Jun 2021 18:46:46 +0200 (CEST) Received: from m.b4.vu (m.b4.vu [203.16.231.148]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E3164F804C3 for ; Sun, 20 Jun 2021 18:46:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E3164F804C3 Received: by m.b4.vu (Postfix, from userid 1000) id 6F6A261E5F1A; Mon, 21 Jun 2021 02:16:41 +0930 (ACST) Date: Mon, 21 Jun 2021 02:16:41 +0930 From: "Geoffrey D. Bennett" To: alsa-devel@alsa-project.org, Takashi Iwai Subject: [PATCH 09/14] ALSA: usb-audio: scarlett2: Add temp variable for consistency Message-ID: <20210620164641.GA9211@m.b4.vu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Hin-Tak Leung , Vladimir Sadovnikov X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add index temporary variable to scarlett2_mixer_ctl_put() for consistency with the other *_ctl_put() functions. Signed-off-by: Geoffrey D. Bennett --- sound/usb/mixer_scarlett_gen2.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c index c1e74918425a..cb8483d3c58a 100644 --- a/sound/usb/mixer_scarlett_gen2.c +++ b/sound/usb/mixer_scarlett_gen2.c @@ -1622,18 +1622,19 @@ static int scarlett2_mixer_ctl_put(struct snd_kcontrol *kctl, const struct scarlett2_device_info *info = private->info; const struct scarlett2_ports *ports = info->ports; int oval, val, num_mixer_in, mix_num, err = 0; + int index = elem->control; mutex_lock(&private->data_mutex); - oval = private->mix[elem->control]; + oval = private->mix[index]; val = ucontrol->value.integer.value[0]; num_mixer_in = ports[SCARLETT2_PORT_TYPE_MIX].num[SCARLETT2_PORT_OUT]; - mix_num = elem->control / num_mixer_in; + mix_num = index / num_mixer_in; if (oval == val) goto unlock; - private->mix[elem->control] = val; + private->mix[index] = val; err = scarlett2_usb_set_mix(mixer, mix_num); if (err == 0) err = 1; From patchwork Sun Jun 20 16:46:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Geoffrey D. Bennett" X-Patchwork-Id: 464362 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 418A0C48BDF for ; Sun, 20 Jun 2021 16:51:48 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B81FA61042 for ; Sun, 20 Jun 2021 16:51:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B81FA61042 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=b4.vu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 580DB16B8; Sun, 20 Jun 2021 18:50:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 580DB16B8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1624207906; bh=LD7pPiQRaobvTuyJo1rF16uokIsXO0W8WKK58x7XmEA=; h=Date:From:To:Subject:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=b3ANdKrDB0+TWRMSGj62aGfhZ+u/Rkrg7oylWQqZy81zMnoPi1rGVVbMemMde6agA PG042rH8rXUzjzjEl5K5Q18LYkQjSnx2rl+/Yz7v4y5wjhVV0wK8vY/DBwHfxf1uuC +LVOyz3EIYfflcMiqWHeDU5wG07dnBAoM1p9ykmc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id EF8D3F80527; Sun, 20 Jun 2021 18:46:58 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B45DBF804DF; Sun, 20 Jun 2021 18:46:50 +0200 (CEST) Received: from m.b4.vu (m.b4.vu [203.16.231.148]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AC44FF804DF for ; Sun, 20 Jun 2021 18:46:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AC44FF804DF Received: by m.b4.vu (Postfix, from userid 1000) id 3815761E5F1B; Mon, 21 Jun 2021 02:16:45 +0930 (ACST) Date: Mon, 21 Jun 2021 02:16:45 +0930 From: "Geoffrey D. Bennett" To: alsa-devel@alsa-project.org, Takashi Iwai Subject: [PATCH 11/14] ALSA: usb-audio: scarlett2: Fix scarlett2_*_ctl_put() return values Message-ID: <20210620164645.GA9221@m.b4.vu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Hin-Tak Leung , Vladimir Sadovnikov X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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 --- sound/usb/mixer_scarlett_gen2.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c index d6298ab1de56..fe142b7ddb32 100644 --- a/sound/usb/mixer_scarlett_gen2.c +++ b/sound/usb/mixer_scarlett_gen2.c @@ -1304,6 +1304,8 @@ static int scarlett2_sw_hw_enum_ctl_put(struct snd_kcontrol *kctl, /* Send SW/HW switch change to the device */ err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_SW_HW_SWITCH, index, val); + if (err == 0) + err = 1; unlock: mutex_unlock(&private->data_mutex); @@ -1364,6 +1366,8 @@ static int scarlett2_level_enum_ctl_put(struct snd_kcontrol *kctl, /* Send switch change to the device */ err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_LEVEL_SWITCH, index, val); + if (err == 0) + err = 1; unlock: mutex_unlock(&private->data_mutex); @@ -1414,6 +1418,8 @@ static int scarlett2_pad_ctl_put(struct snd_kcontrol *kctl, /* Send switch change to the device */ err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_PAD_SWITCH, index, val); + if (err == 0) + err = 1; unlock: mutex_unlock(&private->data_mutex); @@ -1469,6 +1475,8 @@ static int scarlett2_dim_mute_ctl_put(struct snd_kcontrol *kctl, /* Send switch change to the device */ err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_DIM_MUTE, index, val); + if (err == 0) + err = 1; unlock: mutex_unlock(&private->data_mutex); From patchwork Sun Jun 20 16:46:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Geoffrey D. Bennett" X-Patchwork-Id: 464361 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CF7EC48BDF for ; Sun, 20 Jun 2021 16:52:29 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B917C61042 for ; Sun, 20 Jun 2021 16:52:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B917C61042 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=b4.vu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5759016CD; Sun, 20 Jun 2021 18:51:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5759016CD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1624207947; bh=ZnW2OesNnZ4rVQTKtql34NF/pUSGTDIkusOUm/C+vWw=; h=Date:From:To:Subject:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=uMns0CY6UdN/ZLI4f0CvCwFqHtC4M/WwjnXFgA17Fgd3LVQ6WfIUnUlciSEuSTS+p hsTVjxSzI15c43G4BoFBDn42il513+/qV+BFFeVLS3sib8/0Ho0uVkKwp2/YqFfSxs Q2sOMWWSUFqec2gjHImtQJlZ3VksVREJIG3dGzQk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1F1A6F80536; Sun, 20 Jun 2021 18:47:00 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 46FDAF804EB; Sun, 20 Jun 2021 18:46:54 +0200 (CEST) Received: from m.b4.vu (m.b4.vu [203.16.231.148]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 66EC9F804EB for ; Sun, 20 Jun 2021 18:46:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 66EC9F804EB Received: by m.b4.vu (Postfix, from userid 1000) id E951661E5F1E; Mon, 21 Jun 2021 02:16:48 +0930 (ACST) Date: Mon, 21 Jun 2021 02:16:48 +0930 From: "Geoffrey D. Bennett" To: alsa-devel@alsa-project.org, Takashi Iwai Subject: [PATCH 13/14] ALSA: usb-audio: scarlett2: Don't copy struct scarlett2_config Message-ID: <20210620164648.GA9231@m.b4.vu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Hin-Tak Leung , Vladimir Sadovnikov X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" scarlett2_usb_set_config() and scarlett2_usb_get_config() were copying struct scarlett2_config. Use a pointer instead. Signed-off-by: Geoffrey D. Bennett --- sound/usb/mixer_scarlett_gen2.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c index 49c4662531a3..45fd540920b9 100644 --- a/sound/usb/mixer_scarlett_gen2.c +++ b/sound/usb/mixer_scarlett_gen2.c @@ -706,8 +706,8 @@ static int scarlett2_usb_set_config( struct usb_mixer_interface *mixer, int config_item_num, int index, int value) { - const struct scarlett2_config config_item = - scarlett2_config_items[config_item_num]; + const struct scarlett2_config *config_item = + &scarlett2_config_items[config_item_num]; struct { __le32 offset; __le32 bytes; @@ -721,17 +721,17 @@ static int scarlett2_usb_set_config( cancel_delayed_work_sync(&private->work); /* Send the configuration parameter data */ - req.offset = cpu_to_le32(config_item.offset + index * config_item.size); - req.bytes = cpu_to_le32(config_item.size); + req.offset = cpu_to_le32(config_item->offset + index * config_item->size); + req.bytes = cpu_to_le32(config_item->size); req.value = cpu_to_le32(value); err = scarlett2_usb(mixer, SCARLETT2_USB_SET_DATA, - &req, sizeof(u32) * 2 + config_item.size, + &req, sizeof(u32) * 2 + config_item->size, NULL, 0); if (err < 0) return err; /* Activate the change */ - req2 = cpu_to_le32(config_item.activate); + req2 = cpu_to_le32(config_item->activate); err = scarlett2_usb(mixer, SCARLETT2_USB_DATA_CMD, &req2, sizeof(req2), NULL, 0); if (err < 0) @@ -764,11 +764,11 @@ static int scarlett2_usb_get_config( struct usb_mixer_interface *mixer, int config_item_num, int count, void *buf) { - const struct scarlett2_config config_item = - scarlett2_config_items[config_item_num]; - int size = config_item.size * count; + const struct scarlett2_config *config_item = + &scarlett2_config_items[config_item_num]; + int size = config_item->size * count; - return scarlett2_usb_get(mixer, config_item.offset, buf, size); + return scarlett2_usb_get(mixer, config_item->offset, buf, size); } /* Send a USB message to get volume status; result placed in *buf */