Skip to contentSkip to conversation

ALSA: line6: add hw monitor volume control for POD HD500

PATCH Superseded Vasily Khoruzhick 2 participants 2 messages Jul 13, 2020 Sound

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 ALSA: line6: add hw monitor volume control for POD HD500

Add hw monitor volume control for POD HD500. The same change may work for HD500X but I don't have it to test.

---
v3: - use EXPORT_SYMBOL_GPL instead of EXPORT_SYMBOL
- use GFP_KERNEL instead of GFP_ATOMIC for allocating a message
- use lower case for float lookup table
v2: clamp volume value to [0, ARRAY_SIZE() -1] in
podhd_set_monitor_level()

 sound/usb/line6/driver.c |   3 +-
 sound/usb/line6/driver.h |   4 ++
 sound/usb/line6/podhd.c  | 124 ++++++++++++++++++++++++++++++++++++++-
 3 files changed, 129 insertions(+), 2 deletions(-)
sound/usb/line6/driver.c +2 -1
index 7629116f570e..3e07251b80e3 100644
@@ -97,7 +97,7 @@ static void line6_stop_listen(struct usb_line6 *line6)
 /*
 	Send raw message in pieces of wMaxPacketSize bytes.
 */
-static int line6_send_raw_message(struct usb_line6 *line6, const char *buffer,
+int line6_send_raw_message(struct usb_line6 *line6, const char *buffer,
 				  int size)
 {
 	int i, done = 0;
@@ -132,6 +132,7 @@ static int line6_send_raw_message(struct usb_line6 *line6, const char *buffer,
 
 	return done;
 }
+EXPORT_SYMBOL_GPL(line6_send_raw_message);
 
 /*
 	Notification of completion of asynchronous request transmission.
sound/usb/line6/driver.h +4 -0
index 1a4e3700c80c..62c686bed0ca 100644
@@ -108,6 +108,8 @@ enum {
 	LINE6_CAP_CONTROL_MIDI = 1 << 4,
 	/* device provides low-level information */
 	LINE6_CAP_CONTROL_INFO = 1 << 5,
+	/* device provides hardware monitoring volume control */
+	LINE6_CAP_HWMON_CTL =	1 << 6,
 };
 
 /*
@@ -185,6 +187,8 @@ extern int line6_read_data(struct usb_line6 *line6, unsigned address,
 			   void *data, unsigned datalen);
 extern int line6_read_serial_number(struct usb_line6 *line6,
 				    u32 *serial_number);
+extern int line6_send_raw_message(struct usb_line6 *line6,
+					const char *buffer, int size);
 extern int line6_send_raw_message_async(struct usb_line6 *line6,
 					const char *buffer, int size);
 extern int line6_send_sysex_message(struct usb_line6 *line6,
sound/usb/line6/podhd.c +123 -1

154 lines not on this page · raw message

Signature · 1 line
2.27.0
#1 lore raw
Quoted 11 lines · Vasily Khoruzhick

Add hw monitor volume control for POD HD500. The same change may work for HD500X but I don't have it to test.

---
v3: - use EXPORT_SYMBOL_GPL instead of EXPORT_SYMBOL
- use GFP_KERNEL instead of GFP_ATOMIC for allocating a message
- use lower case for float lookup table
v2: clamp volume value to [0, ARRAY_SIZE() -1] in
podhd_set_monitor_level()

Almost good, but just a minor issue below:

Quoted 2 lines
(quoted diff) +2 -0
+static void podhd_set_monitor_level(struct usb_line6_podhd *podhd, int value)
+{

(snip)

sound/usb/line6/podhd.c static void podhd_disconnect(struct usb_line6 *line6) · line 297

Quoted 2 lines
sound/usb/line6/podhd.c +2 -0
+	buf = kmalloc(sizeof(msg), GFP_KERNEL);
+	memcpy(buf, msg, sizeof(msg));

Missing NULL check of buf.

Could you fix and resubmit?

Thanks!

Takashi