All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Geoffrey D. Bennett" <g@b4.vu>
To: alsa-devel@alsa-project.org, Takashi Iwai <tiwai@suse.de>
Cc: Vladimir Sadovnikov <sadko4u@gmail.com>
Subject: [PATCH 5/8] ALSA: usb-audio: scarlett2: Rename buttons/interrupts
Date: Mon, 7 Jun 2021 03:16:24 +0930	[thread overview]
Message-ID: <b90f501fc41e7cbaffb9470bdf499d043941222d.1622999147.git.g@b4.vu> (raw)
In-Reply-To: <cover.1622999147.git.g@b4.vu>

To match the vendor's terminology, change #defines, function names,
and comments:
- 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>
---
 sound/usb/mixer_scarlett_gen2.c | 36 ++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c
index 3f1148bc0883..d240fa9a4b59 100644
--- a/sound/usb/mixer_scarlett_gen2.c
+++ b/sound/usb/mixer_scarlett_gen2.c
@@ -194,7 +194,7 @@ enum {
 	SCARLETT2_PORT_DIRNS   = 5,
 };
 
-/* Hardware buttons on the 18i20 */
+/* Dim/Mute buttons on the 18i20 */
 #define SCARLETT2_BUTTON_MAX 2
 
 static const char *const scarlett2_button_names[SCARLETT2_BUTTON_MAX] = {
@@ -218,7 +218,7 @@ struct scarlett2_ports {
 
 struct scarlett2_device_info {
 	u8 line_out_hw_vol; /* line out hw volume is sw controlled */
-	u8 button_count; /* number of buttons */
+	u8 button_count; /* number of dim/mute buttons */
 	u8 level_input_count; /* inputs with level selectable */
 	u8 pad_input_count; /* inputs with pad selectable */
 	const char * const line_out_descrs[SCARLETT2_ANALOGUE_MAX];
@@ -454,9 +454,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 mute/dim 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
@@ -1546,7 +1546,7 @@ static int scarlett2_add_line_out_ctls(struct usb_mixer_interface *mixer)
 		}
 	}
 
-	/* Add HW button controls */
+	/* Add dim/mute controls */
 	for (i = 0; i < private->info->button_count; i++) {
 		err = scarlett2_add_new_ctl(mixer, &scarlett2_button_ctl,
 					    i, 1, scarlett2_button_names[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;
@@ -2012,7 +2012,7 @@ static void scarlett2_mixer_interrupt_button_change(
 }
 
 /* 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;
@@ -2023,10 +2023,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 &&
@@ -2037,7 +2037,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,
@@ -2063,7 +2063,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);
@@ -2111,7 +2111,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->button_count) {
-		err = scarlett2_mixer_status_create(mixer);
+		err = scarlett2_init_notify(mixer);
 		if (err < 0)
 			return err;
 	}
-- 
2.31.1


  parent reply	other threads:[~2021-06-06 17:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-06 17:44 [PATCH 0/8] ALSA: usb-audio: scarlett2: cleanup Geoffrey D. Bennett
2021-06-06 17:45 ` [PATCH 1/8] ALSA: usb-audio: scarlett2: Remove incorrect S/PDIF comment Geoffrey D. Bennett
2021-06-06 17:45 ` [PATCH 2/8] ALSA: usb-audio: scarlett2: Coding style improvements Geoffrey D. Bennett
2021-06-06 17:45 ` [PATCH 3/8] ALSA: usb-audio: scarlett2: Remove unused/useless code Geoffrey D. Bennett
2021-06-06 17:46 ` [PATCH 4/8] ALSA: usb-audio: scarlett2: Remove interrupt debug message Geoffrey D. Bennett
2021-06-06 17:46 ` Geoffrey D. Bennett [this message]
2021-06-06 17:46 ` [PATCH 6/8] ALSA: usb-audio: scarlett2: Rename struct scarlett2_mixer_data Geoffrey D. Bennett
2021-06-06 17:46 ` [PATCH 7/8] ALSA: usb-audio: scarlett2: Add temp variable for consistency Geoffrey D. Bennett
2021-06-06 17:47 ` [PATCH 8/8] ALSA: usb-audio: scarlett2: Fix data_mutex lock Geoffrey D. Bennett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b90f501fc41e7cbaffb9470bdf499d043941222d.1622999147.git.g@b4.vu \
    --to=g@b4.vu \
    --cc=alsa-devel@alsa-project.org \
    --cc=sadko4u@gmail.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.