All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] Yet another line6 cleanups
@ 2015-01-28 16:41 Takashi Iwai
  2015-01-28 16:41 ` [PATCH 1/7] ALSA: line6: Fix volume calculation for big-endian Takashi Iwai
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Takashi Iwai @ 2015-01-28 16:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: Stefan Hajnoczi, Chris Rorvick

OK, I did enough for this month.

The only real fix is the first patch for big-endianess.  The rest are
rather cleanups and beautifying the code.

As usual, the latest code is found in test/line6 branch.


thanks,

Takashi

===

Takashi Iwai (7):
  ALSA: line6: Fix volume calculation for big-endian
  ALSA: line6: Tidy up and typo fixes in comments
  ALSA: line6: Remove revision.h
  ALSA: line6: Move the contents of usbdefs.h into driver.h
  ALSA: line6: Remove struct usb_line6_podhd
  ALSA: line6: Remove invalid capability bits for PODxt Live Variax
  ALSA: line6: Remove snd_line6_ prefix of pcm property fields

 sound/usb/line6/capture.c  |  5 ++-
 sound/usb/line6/driver.c   |  4 +--
 sound/usb/line6/driver.h   | 89 ++++++++++++++++++++--------------------------
 sound/usb/line6/midi.c     |  1 -
 sound/usb/line6/midi.h     | 32 +++++------------
 sound/usb/line6/pcm.h      | 57 +++++++++--------------------
 sound/usb/line6/playback.c | 24 +++++++------
 sound/usb/line6/pod.c      | 39 ++++++--------------
 sound/usb/line6/podhd.c    | 16 +++------
 sound/usb/line6/revision.h |  4 ---
 sound/usb/line6/toneport.c | 31 +++++-----------
 sound/usb/line6/usbdefs.h  | 27 --------------
 sound/usb/line6/variax.c   | 25 ++++---------
 13 files changed, 109 insertions(+), 245 deletions(-)
 delete mode 100644 sound/usb/line6/revision.h
 delete mode 100644 sound/usb/line6/usbdefs.h

-- 
2.2.2

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/7] ALSA: line6: Fix volume calculation for big-endian
  2015-01-28 16:41 [PATCH 0/7] Yet another line6 cleanups Takashi Iwai
@ 2015-01-28 16:41 ` Takashi Iwai
  2015-01-28 16:54   ` [PATCH v2 " Takashi Iwai
  2015-01-28 16:41 ` [PATCH 2/7] ALSA: line6: Tidy up and typo fixes in comments Takashi Iwai
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: Takashi Iwai @ 2015-01-28 16:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: Stefan Hajnoczi, Chris Rorvick

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/line6/playback.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/sound/usb/line6/playback.c b/sound/usb/line6/playback.c
index 1708c05f14db..5858f5f18e11 100644
--- a/sound/usb/line6/playback.c
+++ b/sound/usb/line6/playback.c
@@ -37,8 +37,10 @@ static void change_volume(struct urb *urb_out, int volume[],
 		buf_end = p + urb_out->transfer_buffer_length / sizeof(*p);
 
 		for (; p < buf_end; ++p) {
-			int val = (*p * volume[chn & 1]) >> 8;
-			*p = clamp(val, 0x7fff, -0x8000);
+			short pv = le16_to_cpu(*p);
+			int val = (pv * volume[chn & 1]) >> 8;
+			pv = clamp(val, 0x7fff, -0x8000);
+			*p = cpu_to_le16(pv);
 			++chn;
 		}
 	} else if (bytes_per_frame == 6) {
@@ -121,8 +123,11 @@ static void add_monitor_signal(struct urb *urb_out, unsigned char *signal,
 		buf_end = po + urb_out->transfer_buffer_length / sizeof(*po);
 
 		for (; po < buf_end; ++pi, ++po) {
-			int val = *po + ((*pi * volume) >> 8);
-			*po = clamp(val, 0x7fff, -0x8000);
+			short pov = le16_to_cpu(*po);
+			short piv = le16_to_cpu(*pi);
+			int val = pov + ((piv * volume) >> 8);
+			pov = clamp(val, 0x7fff, -0x8000);
+			*po = cpu_to_le16(pov);
 		}
 	}
 
-- 
2.2.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/7] ALSA: line6: Tidy up and typo fixes in comments
  2015-01-28 16:41 [PATCH 0/7] Yet another line6 cleanups Takashi Iwai
  2015-01-28 16:41 ` [PATCH 1/7] ALSA: line6: Fix volume calculation for big-endian Takashi Iwai
@ 2015-01-28 16:41 ` Takashi Iwai
  2015-01-28 16:41 ` [PATCH 3/7] ALSA: line6: Remove revision.h Takashi Iwai
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2015-01-28 16:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: Stefan Hajnoczi, Chris Rorvick

Just reformatting the comments and typos fixed, no functional
changes.  Particularly,
- avoid the kerneldoc marker "/**",
- reduce multiple comment lines into single lines,
- corrected wrongly referred function names

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/line6/driver.c   |  2 +-
 sound/usb/line6/driver.h   | 73 ++++++++++++++--------------------------------
 sound/usb/line6/midi.h     | 32 +++++---------------
 sound/usb/line6/pcm.h      | 52 +++++++++------------------------
 sound/usb/line6/pod.c      | 32 +++++---------------
 sound/usb/line6/podhd.c    |  4 +--
 sound/usb/line6/toneport.c | 24 ++++-----------
 sound/usb/line6/variax.c   | 20 ++++---------
 8 files changed, 65 insertions(+), 174 deletions(-)

diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
index a0436993a167..f46da99c44b3 100644
--- a/sound/usb/line6/driver.c
+++ b/sound/usb/line6/driver.c
@@ -44,7 +44,7 @@ static const char line6_request_version[] = {
 	0xf0, 0x7e, 0x7f, 0x06, 0x01, 0xf7
 };
 
-/**
+/*
 	 Class for asynchronous messages.
 */
 struct message {
diff --git a/sound/usb/line6/driver.h b/sound/usb/line6/driver.h
index fce10f12f0d3..80d42a0fd889 100644
--- a/sound/usb/line6/driver.h
+++ b/sound/usb/line6/driver.h
@@ -60,26 +60,20 @@ extern const unsigned char line6_midi_id[3];
 static const int SYSEX_DATA_OFS = sizeof(line6_midi_id) + 3;
 static const int SYSEX_EXTRA_SIZE = sizeof(line6_midi_id) + 4;
 
-/**
+/*
 	 Common properties of Line 6 devices.
 */
 struct line6_properties {
-	/**
-		 Card id string (maximum 16 characters).
-		 This can be used to address the device in ALSA programs as
-		 "default:CARD=<id>"
-	*/
+	/* Card id string (maximum 16 characters).
+	 * This can be used to address the device in ALSA programs as
+	 * "default:CARD=<id>"
+	 */
 	const char *id;
 
-	/**
-		 Card short name (maximum 32 characters).
-	*/
+	/* Card short name (maximum 32 characters) */
 	const char *name;
 
-	/**
-		 Bit vector defining this device's capabilities in the
-		 line6usb driver.
-	*/
+	/* Bit vector defining this device's capabilities in line6usb driver */
 	int capabilities;
 
 	int altsetting;
@@ -90,70 +84,47 @@ struct line6_properties {
 	unsigned ep_audio_w;
 };
 
-/**
+/*
 	 Common data shared by all Line 6 devices.
 	 Corresponds to a pair of USB endpoints.
 */
 struct usb_line6 {
-	/**
-		 USB device.
-	*/
+	/* USB device */
 	struct usb_device *usbdev;
 
-	/**
-		 Properties.
-	*/
+	/* Properties */
 	const struct line6_properties *properties;
 
-	/**
-		 Interval (ms).
-	*/
+	/* Interval (ms) */
 	int interval;
 
-	/**
-		 Maximum size of USB packet.
-	*/
+	/* Maximum size of USB packet */
 	int max_packet_size;
 
-	/**
-		 Device representing the USB interface.
-	*/
+	/* Device representing the USB interface */
 	struct device *ifcdev;
 
-	/**
-		 Line 6 sound card data structure.
-		 Each device has at least MIDI or PCM.
-	*/
+	/* Line 6 sound card data structure.
+	 * Each device has at least MIDI or PCM.
+	 */
 	struct snd_card *card;
 
-	/**
-		 Line 6 PCM device data structure.
-	*/
+	/* Line 6 PCM device data structure */
 	struct snd_line6_pcm *line6pcm;
 
-	/**
-		 Line 6 MIDI device data structure.
-	*/
+	/* Line 6 MIDI device data structure */
 	struct snd_line6_midi *line6midi;
 
-	/**
-		 URB for listening to PODxt Pro control endpoint.
-	*/
+	/* URB for listening to PODxt Pro control endpoint */
 	struct urb *urb_listen;
 
-	/**
-		 Buffer for listening to PODxt Pro control endpoint.
-	*/
+	/* Buffer for listening to PODxt Pro control endpoint */
 	unsigned char *buffer_listen;
 
-	/**
-		 Buffer for message to be processed.
-	*/
+	/* Buffer for message to be processed */
 	unsigned char *buffer_message;
 
-	/**
-		 Length of message to be processed.
-	*/
+	/* Length of message to be processed */
 	int message_length;
 
 	void (*process_message)(struct usb_line6 *);
diff --git a/sound/usb/line6/midi.h b/sound/usb/line6/midi.h
index 9d9467b2613c..cf82d69e2747 100644
--- a/sound/usb/line6/midi.h
+++ b/sound/usb/line6/midi.h
@@ -19,44 +19,28 @@
 #define MIDI_BUFFER_SIZE 1024
 
 struct snd_line6_midi {
-	/**
-		 Pointer back to the Line 6 driver data structure.
-	*/
+	/* Pointer back to the Line 6 driver data structure */
 	struct usb_line6 *line6;
 
-	/**
-		 MIDI substream for receiving (or NULL if not active).
-	*/
+	/* MIDI substream for receiving (or NULL if not active) */
 	struct snd_rawmidi_substream *substream_receive;
 
-	/**
-		 MIDI substream for transmitting (or NULL if not active).
-	*/
+	/* MIDI substream for transmitting (or NULL if not active) */
 	struct snd_rawmidi_substream *substream_transmit;
 
-	/**
-		 Number of currently active MIDI send URBs.
-	*/
+	/* Number of currently active MIDI send URBs */
 	int num_active_send_urbs;
 
-	/**
-		 Spin lock to protect MIDI buffer handling.
-	*/
+	/* Spin lock to protect MIDI buffer handling */
 	spinlock_t lock;
 
-	/**
-		 Wait queue for MIDI transmission.
-	*/
+	/* Wait queue for MIDI transmission */
 	wait_queue_head_t send_wait;
 
-	/**
-		 Buffer for incoming MIDI stream.
-	*/
+	/* Buffer for incoming MIDI stream */
 	struct midi_buffer midibuf_in;
 
-	/**
-		 Buffer for outgoing MIDI stream.
-	*/
+	/* Buffer for outgoing MIDI stream */
 	struct midi_buffer midibuf_out;
 };
 
diff --git a/sound/usb/line6/pcm.h b/sound/usb/line6/pcm.h
index 42d3e6fc2c61..19c12f0a9008 100644
--- a/sound/usb/line6/pcm.h
+++ b/sound/usb/line6/pcm.h
@@ -66,8 +66,8 @@
 	the running flag indicates whether the stream is running.
 
 	For monitor or impulse operations, the driver needs to call
-	snd_line6_duplex_acquire() or snd_line6_duplex_release() with the
-	appropriate LINE6_STREAM_* flag.
+	line6_pcm_acquire() or line6_pcm_release() with the appropriate
+	LINE6_STREAM_* flag.
 */
 
 /* stream types */
@@ -139,19 +139,13 @@ struct line6_pcm_stream {
 };
 
 struct snd_line6_pcm {
-	/**
-		 Pointer back to the Line 6 driver data structure.
-	*/
+	/* Pointer back to the Line 6 driver data structure */
 	struct usb_line6 *line6;
 
-	/**
-		 Properties.
-	*/
+	/* Properties. */
 	struct line6_pcm_properties *properties;
 
-	/**
-		 ALSA pcm stream
-	*/
+	/* ALSA pcm stream */
 	struct snd_pcm *pcm;
 
 	/* protection to state changes of in/out streams */
@@ -161,49 +155,31 @@ struct snd_line6_pcm {
 	struct line6_pcm_stream in;
 	struct line6_pcm_stream out;
 
-	/**
-		 Previously captured frame (for software monitoring).
-	*/
+	/* Previously captured frame (for software monitoring) */
 	unsigned char *prev_fbuf;
 
-	/**
-		 Size of previously captured frame (for software monitoring).
-	*/
+	/* Size of previously captured frame (for software monitoring) */
 	int prev_fsize;
 
-	/**
-		 Maximum size of USB packet.
-	*/
+	/* Maximum size of USB packet */
 	int max_packet_size;
 
-	/**
-		 PCM playback volume (left and right).
-	*/
+	/* PCM playback volume (left and right) */
 	int volume_playback[2];
 
-	/**
-		 PCM monitor volume.
-	*/
+	/* PCM monitor volume */
 	int volume_monitor;
 
-	/**
-		 Volume of impulse response test signal (if zero, test is disabled).
-	*/
+	/* Volume of impulse response test signal (if zero, test is disabled) */
 	int impulse_volume;
 
-	/**
-		 Period of impulse response test signal.
-	*/
+	/* Period of impulse response test signal */
 	int impulse_period;
 
-	/**
-		 Counter for impulse response test signal.
-	*/
+	/* Counter for impulse response test signal */
 	int impulse_count;
 
-	/**
-		 Several status bits (see LINE6_FLAG_*).
-	*/
+	/* Several status bits (see LINE6_FLAG_*) */
 	unsigned long flags;
 };
 
diff --git a/sound/usb/line6/pod.c b/sound/usb/line6/pod.c
index 6f7cd585f2d8..bc20cf141719 100644
--- a/sound/usb/line6/pod.c
+++ b/sound/usb/line6/pod.c
@@ -58,44 +58,28 @@ enum {
 };
 
 struct usb_line6_pod {
-	/**
-		Generic Line 6 USB data.
-	*/
+	/* Generic Line 6 USB data */
 	struct usb_line6 line6;
 
-	/**
-		Instrument monitor level.
-	*/
+	/* Instrument monitor level */
 	int monitor_level;
 
-	/**
-		Timer for device initializaton.
-	*/
+	/* Timer for device initialization */
 	struct timer_list startup_timer;
 
-	/**
-		Work handler for device initializaton.
-	*/
+	/* Work handler for device initialization */
 	struct work_struct startup_work;
 
-	/**
-		Current progress in startup procedure.
-	*/
+	/* Current progress in startup procedure */
 	int startup_progress;
 
-	/**
-		Serial number of device.
-	*/
+	/* Serial number of device */
 	int serial_number;
 
-	/**
-		Firmware version (x 100).
-	*/
+	/* Firmware version (x 100) */
 	int firmware_version;
 
-	/**
-		Device ID.
-	*/
+	/* Device ID */
 	int device_id;
 };
 
diff --git a/sound/usb/line6/podhd.c b/sound/usb/line6/podhd.c
index 43c39886597e..c4e83ab33a21 100644
--- a/sound/usb/line6/podhd.c
+++ b/sound/usb/line6/podhd.c
@@ -27,9 +27,7 @@ enum {
 };
 
 struct usb_line6_podhd {
-	/**
-		Generic Line 6 USB data.
-	*/
+	/* Generic Line 6 USB data */
 	struct usb_line6 line6;
 };
 
diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c
index 819e06b3f3db..9024acb2b850 100644
--- a/sound/usb/line6/toneport.c
+++ b/sound/usb/line6/toneport.c
@@ -43,34 +43,22 @@ struct toneport_led {
 };
 
 struct usb_line6_toneport {
-	/**
-		Generic Line 6 USB data.
-	*/
+	/* Generic Line 6 USB data */
 	struct usb_line6 line6;
 
-	/**
-		Source selector.
-	*/
+	/* Source selector */
 	int source;
 
-	/**
-		Serial number of device.
-	*/
+	/* Serial number of device */
 	int serial_number;
 
-	/**
-		Firmware version (x 100).
-	*/
+	/* Firmware version (x 100) */
 	int firmware_version;
 
-	/**
-		 Timer for delayed PCM startup.
-	*/
+	/* Timer for delayed PCM startup */
 	struct timer_list timer;
 
-	/**
-		 Device type.
-	*/
+	/* Device type */
 	enum line6_device_type type;
 
 	/* LED instances */
diff --git a/sound/usb/line6/variax.c b/sound/usb/line6/variax.c
index 9701ffa61365..44042cbdef01 100644
--- a/sound/usb/line6/variax.c
+++ b/sound/usb/line6/variax.c
@@ -42,30 +42,20 @@ enum {
 };
 
 struct usb_line6_variax {
-	/**
-		Generic Line 6 USB data.
-	*/
+	/* Generic Line 6 USB data */
 	struct usb_line6 line6;
 
-	/**
-		Buffer for activation code.
-	*/
+	/* Buffer for activation code */
 	unsigned char *buffer_activate;
 
-	/**
-		Handler for device initializaton.
-	*/
+	/* Handler for device initialization */
 	struct work_struct startup_work;
 
-	/**
-		Timers for device initializaton.
-	*/
+	/* Timers for device initialization */
 	struct timer_list startup_timer1;
 	struct timer_list startup_timer2;
 
-	/**
-		Current progress in startup procedure.
-	*/
+	/* Current progress in startup procedure */
 	int startup_progress;
 };
 
-- 
2.2.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/7] ALSA: line6: Remove revision.h
  2015-01-28 16:41 [PATCH 0/7] Yet another line6 cleanups Takashi Iwai
  2015-01-28 16:41 ` [PATCH 1/7] ALSA: line6: Fix volume calculation for big-endian Takashi Iwai
  2015-01-28 16:41 ` [PATCH 2/7] ALSA: line6: Tidy up and typo fixes in comments Takashi Iwai
@ 2015-01-28 16:41 ` Takashi Iwai
  2015-01-28 16:41 ` [PATCH 4/7] ALSA: line6: Move the contents of usbdefs.h into driver.h Takashi Iwai
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2015-01-28 16:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: Stefan Hajnoczi, Chris Rorvick

The definition is no longer used.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/line6/driver.c   | 1 -
 sound/usb/line6/revision.h | 4 ----
 2 files changed, 5 deletions(-)
 delete mode 100644 sound/usb/line6/revision.h

diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
index f46da99c44b3..786b38159ad6 100644
--- a/sound/usb/line6/driver.c
+++ b/sound/usb/line6/driver.c
@@ -22,7 +22,6 @@
 #include "driver.h"
 #include "midi.h"
 #include "playback.h"
-#include "revision.h"
 #include "usbdefs.h"
 
 #define DRIVER_AUTHOR  "Markus Grabner <grabner@icg.tugraz.at>"
diff --git a/sound/usb/line6/revision.h b/sound/usb/line6/revision.h
deleted file mode 100644
index b4eee2b73831..000000000000
--- a/sound/usb/line6/revision.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef DRIVER_REVISION
-/* current subversion revision */
-#define DRIVER_REVISION " (904)"
-#endif
-- 
2.2.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/7] ALSA: line6: Move the contents of usbdefs.h into driver.h
  2015-01-28 16:41 [PATCH 0/7] Yet another line6 cleanups Takashi Iwai
                   ` (2 preceding siblings ...)
  2015-01-28 16:41 ` [PATCH 3/7] ALSA: line6: Remove revision.h Takashi Iwai
@ 2015-01-28 16:41 ` Takashi Iwai
  2015-01-28 16:41 ` [PATCH 5/7] ALSA: line6: Remove struct usb_line6_podhd Takashi Iwai
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2015-01-28 16:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: Stefan Hajnoczi, Chris Rorvick

Most of them are rather relevant with the definitions in driver.h,
and there are only a few lines, so just rip it off.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/line6/driver.c   |  1 -
 sound/usb/line6/driver.h   | 16 ++++++++++++++++
 sound/usb/line6/midi.c     |  1 -
 sound/usb/line6/pcm.h      |  1 -
 sound/usb/line6/pod.c      |  1 -
 sound/usb/line6/podhd.c    |  1 -
 sound/usb/line6/toneport.c |  1 -
 sound/usb/line6/usbdefs.h  | 27 ---------------------------
 sound/usb/line6/variax.c   |  1 -
 9 files changed, 16 insertions(+), 34 deletions(-)
 delete mode 100644 sound/usb/line6/usbdefs.h

diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
index 786b38159ad6..2328ec9a1ca8 100644
--- a/sound/usb/line6/driver.c
+++ b/sound/usb/line6/driver.c
@@ -22,7 +22,6 @@
 #include "driver.h"
 #include "midi.h"
 #include "playback.h"
-#include "usbdefs.h"
 
 #define DRIVER_AUTHOR  "Markus Grabner <grabner@icg.tugraz.at>"
 #define DRIVER_DESC    "Line 6 USB Driver"
diff --git a/sound/usb/line6/driver.h b/sound/usb/line6/driver.h
index 80d42a0fd889..fa877a345860 100644
--- a/sound/usb/line6/driver.h
+++ b/sound/usb/line6/driver.h
@@ -20,6 +20,12 @@
 
 #define DRIVER_NAME "line6usb"
 
+#define USB_INTERVALS_PER_SECOND 1000
+
+/* Fallback USB interval and max packet size values */
+#define LINE6_FALLBACK_INTERVAL 10
+#define LINE6_FALLBACK_MAXPACKETSIZE 16
+
 #define LINE6_TIMEOUT 1
 #define LINE6_BUFSIZE_LISTEN 32
 #define LINE6_MESSAGE_MAXLEN 256
@@ -84,6 +90,16 @@ struct line6_properties {
 	unsigned ep_audio_w;
 };
 
+/* Capability bits */
+enum {
+	/* device supports settings parameter via USB */
+	LINE6_CAP_CONTROL =	1 << 0,
+	/* device supports PCM input/output via USB */
+	LINE6_CAP_PCM =		1 << 1,
+	/* device support hardware monitoring */
+	LINE6_CAP_HWMON =	1 << 2,
+};
+
 /*
 	 Common data shared by all Line 6 devices.
 	 Corresponds to a pair of USB endpoints.
diff --git a/sound/usb/line6/midi.c b/sound/usb/line6/midi.c
index beeedf9a2cbe..cebea9b7f769 100644
--- a/sound/usb/line6/midi.c
+++ b/sound/usb/line6/midi.c
@@ -17,7 +17,6 @@
 
 #include "driver.h"
 #include "midi.h"
-#include "usbdefs.h"
 
 #define line6_rawmidi_substream_midi(substream) \
 	((struct snd_line6_midi *)((substream)->rmidi->private_data))
diff --git a/sound/usb/line6/pcm.h b/sound/usb/line6/pcm.h
index 19c12f0a9008..3a3cfba40ec7 100644
--- a/sound/usb/line6/pcm.h
+++ b/sound/usb/line6/pcm.h
@@ -19,7 +19,6 @@
 #include <sound/pcm.h>
 
 #include "driver.h"
-#include "usbdefs.h"
 
 /* number of URBs */
 #define LINE6_ISO_BUFFERS	2
diff --git a/sound/usb/line6/pod.c b/sound/usb/line6/pod.c
index bc20cf141719..3f7ff661b3dd 100644
--- a/sound/usb/line6/pod.c
+++ b/sound/usb/line6/pod.c
@@ -21,7 +21,6 @@
 #include "capture.h"
 #include "driver.h"
 #include "playback.h"
-#include "usbdefs.h"
 
 /*
 	Locate name in binary program dump
diff --git a/sound/usb/line6/podhd.c b/sound/usb/line6/podhd.c
index c4e83ab33a21..5e4e02c1f4b5 100644
--- a/sound/usb/line6/podhd.c
+++ b/sound/usb/line6/podhd.c
@@ -17,7 +17,6 @@
 
 #include "driver.h"
 #include "pcm.h"
-#include "usbdefs.h"
 
 enum {
 	LINE6_PODHD300,
diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c
index 9024acb2b850..cffcd7f83bfd 100644
--- a/sound/usb/line6/toneport.c
+++ b/sound/usb/line6/toneport.c
@@ -21,7 +21,6 @@
 #include "capture.h"
 #include "driver.h"
 #include "playback.h"
-#include "usbdefs.h"
 
 enum line6_device_type {
 	LINE6_GUITARPORT,
diff --git a/sound/usb/line6/usbdefs.h b/sound/usb/line6/usbdefs.h
deleted file mode 100644
index 5ef7bcd24e18..000000000000
--- a/sound/usb/line6/usbdefs.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Line 6 Linux USB driver
- *
- * Copyright (C) 2005-2008 Markus Grabner (grabner@icg.tugraz.at)
- *
- *	This program is free software; you can redistribute it and/or
- *	modify it under the terms of the GNU General Public License as
- *	published by the Free Software Foundation, version 2.
- *
- */
-
-#ifndef USBDEFS_H
-#define USBDEFS_H
-
-#define USB_INTERVALS_PER_SECOND 1000
-
-/* device supports settings parameter via USB */
-#define LINE6_CAP_CONTROL (1 << 0)
-/* device supports PCM input/output via USB */
-#define LINE6_CAP_PCM (1 << 1)
-/* device support hardware monitoring */
-#define LINE6_CAP_HWMON (1 << 2)
-
-#define LINE6_FALLBACK_INTERVAL 10
-#define LINE6_FALLBACK_MAXPACKETSIZE 16
-
-#endif
diff --git a/sound/usb/line6/variax.c b/sound/usb/line6/variax.c
index 44042cbdef01..9dfbe7916d99 100644
--- a/sound/usb/line6/variax.c
+++ b/sound/usb/line6/variax.c
@@ -17,7 +17,6 @@
 #include <sound/core.h>
 
 #include "driver.h"
-#include "usbdefs.h"
 
 #define VARIAX_STARTUP_DELAY1 1000
 #define VARIAX_STARTUP_DELAY3 100
-- 
2.2.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/7] ALSA: line6: Remove struct usb_line6_podhd
  2015-01-28 16:41 [PATCH 0/7] Yet another line6 cleanups Takashi Iwai
                   ` (3 preceding siblings ...)
  2015-01-28 16:41 ` [PATCH 4/7] ALSA: line6: Move the contents of usbdefs.h into driver.h Takashi Iwai
@ 2015-01-28 16:41 ` Takashi Iwai
  2015-01-28 16:41 ` [PATCH 6/7] ALSA: line6: Remove invalid capability bits for PODxt Live Variax Takashi Iwai
  2015-01-28 16:41 ` [PATCH 7/7] ALSA: line6: Remove snd_line6_ prefix of pcm property fields Takashi Iwai
  6 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2015-01-28 16:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: Stefan Hajnoczi, Chris Rorvick

It's identical with struct usb_line6.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/line6/podhd.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/sound/usb/line6/podhd.c b/sound/usb/line6/podhd.c
index 5e4e02c1f4b5..4ebe6ef43073 100644
--- a/sound/usb/line6/podhd.c
+++ b/sound/usb/line6/podhd.c
@@ -25,11 +25,6 @@ enum {
 	LINE6_PODHD500_1,
 };
 
-struct usb_line6_podhd {
-	/* Generic Line 6 USB data */
-	struct usb_line6 line6;
-};
-
 #define PODHD_BYTES_PER_FRAME 6	/* 24bit audio (stereo) */
 
 static struct snd_ratden podhd_ratden = {
@@ -176,7 +171,7 @@ static int podhd_probe(struct usb_interface *interface,
 {
 	return line6_probe(interface, id,
 			   &podhd_properties_table[id->driver_info],
-			   podhd_init, sizeof(struct usb_line6_podhd));
+			   podhd_init, sizeof(struct usb_line6));
 }
 
 static struct usb_driver podhd_driver = {
-- 
2.2.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/7] ALSA: line6: Remove invalid capability bits for PODxt Live Variax
  2015-01-28 16:41 [PATCH 0/7] Yet another line6 cleanups Takashi Iwai
                   ` (4 preceding siblings ...)
  2015-01-28 16:41 ` [PATCH 5/7] ALSA: line6: Remove struct usb_line6_podhd Takashi Iwai
@ 2015-01-28 16:41 ` Takashi Iwai
  2015-01-28 16:41 ` [PATCH 7/7] ALSA: line6: Remove snd_line6_ prefix of pcm property fields Takashi Iwai
  6 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2015-01-28 16:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: Stefan Hajnoczi, Chris Rorvick

PODxt Live Variax doesn't have PCM and HWMON but only MIDI.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/line6/variax.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/usb/line6/variax.c b/sound/usb/line6/variax.c
index 9dfbe7916d99..b1c1de65d584 100644
--- a/sound/usb/line6/variax.c
+++ b/sound/usb/line6/variax.c
@@ -259,9 +259,7 @@ static const struct line6_properties variax_properties_table[] = {
 	[LINE6_PODXTLIVE_VARIAX] = {
 		.id = "PODxtLive",
 		.name = "PODxt Live",
-		.capabilities	= LINE6_CAP_CONTROL
-				| LINE6_CAP_PCM
-				| LINE6_CAP_HWMON,
+		.capabilities	= LINE6_CAP_CONTROL,
 		.altsetting = 1,
 		.ep_ctrl_r = 0x86,
 		.ep_ctrl_w = 0x05,
-- 
2.2.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 7/7] ALSA: line6: Remove snd_line6_ prefix of pcm property fields
  2015-01-28 16:41 [PATCH 0/7] Yet another line6 cleanups Takashi Iwai
                   ` (5 preceding siblings ...)
  2015-01-28 16:41 ` [PATCH 6/7] ALSA: line6: Remove invalid capability bits for PODxt Live Variax Takashi Iwai
@ 2015-01-28 16:41 ` Takashi Iwai
  6 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2015-01-28 16:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: Stefan Hajnoczi, Chris Rorvick

It's just superfluous and doesn't give any better readability.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/line6/capture.c  |  5 ++---
 sound/usb/line6/pcm.h      |  4 ++--
 sound/usb/line6/playback.c | 11 +++++------
 sound/usb/line6/pod.c      |  6 +++---
 sound/usb/line6/podhd.c    |  6 +++---
 sound/usb/line6/toneport.c |  6 +++---
 6 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/sound/usb/line6/capture.c b/sound/usb/line6/capture.c
index 4183c5f5edc2..f518fbbe88de 100644
--- a/sound/usb/line6/capture.c
+++ b/sound/usb/line6/capture.c
@@ -216,12 +216,11 @@ static int snd_line6_capture_open(struct snd_pcm_substream *substream)
 
 	err = snd_pcm_hw_constraint_ratdens(runtime, 0,
 					    SNDRV_PCM_HW_PARAM_RATE,
-					    (&line6pcm->
-					     properties->snd_line6_rates));
+					    &line6pcm->properties->rates);
 	if (err < 0)
 		return err;
 
-	runtime->hw = line6pcm->properties->snd_line6_capture_hw;
+	runtime->hw = line6pcm->properties->capture_hw;
 	return 0;
 }
 
diff --git a/sound/usb/line6/pcm.h b/sound/usb/line6/pcm.h
index 3a3cfba40ec7..508410adbd51 100644
--- a/sound/usb/line6/pcm.h
+++ b/sound/usb/line6/pcm.h
@@ -83,8 +83,8 @@ enum {
 };
 
 struct line6_pcm_properties {
-	struct snd_pcm_hardware snd_line6_playback_hw, snd_line6_capture_hw;
-	struct snd_pcm_hw_constraint_ratdens snd_line6_rates;
+	struct snd_pcm_hardware playback_hw, capture_hw;
+	struct snd_pcm_hw_constraint_ratdens rates;
 	int bytes_per_frame;
 };
 
diff --git a/sound/usb/line6/playback.c b/sound/usb/line6/playback.c
index 5858f5f18e11..de3024ab4d32 100644
--- a/sound/usb/line6/playback.c
+++ b/sound/usb/line6/playback.c
@@ -148,10 +148,10 @@ static int submit_audio_out_urb(struct snd_line6_pcm *line6pcm)
 	int ret;
 	const int bytes_per_frame = line6pcm->properties->bytes_per_frame;
 	const int frame_increment =
-	    line6pcm->properties->snd_line6_rates.rats[0].num_min;
+		line6pcm->properties->rates.rats[0].num_min;
 	const int frame_factor =
-	    line6pcm->properties->snd_line6_rates.rats[0].den *
-	    (USB_INTERVALS_PER_SECOND / LINE6_ISO_INTERVAL);
+		line6pcm->properties->rates.rats[0].den *
+		(USB_INTERVALS_PER_SECOND / LINE6_ISO_INTERVAL);
 	struct urb *urb_out;
 
 	index =
@@ -370,12 +370,11 @@ static int snd_line6_playback_open(struct snd_pcm_substream *substream)
 	struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);
 
 	err = snd_pcm_hw_constraint_ratdens(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
-					    (&line6pcm->
-					     properties->snd_line6_rates));
+					    &line6pcm->properties->rates);
 	if (err < 0)
 		return err;
 
-	runtime->hw = line6pcm->properties->snd_line6_playback_hw;
+	runtime->hw = line6pcm->properties->playback_hw;
 	return 0;
 }
 
diff --git a/sound/usb/line6/pod.c b/sound/usb/line6/pod.c
index 3f7ff661b3dd..61aadd7d4b7f 100644
--- a/sound/usb/line6/pod.c
+++ b/sound/usb/line6/pod.c
@@ -129,7 +129,7 @@ static struct snd_ratden pod_ratden = {
 };
 
 static struct line6_pcm_properties pod_pcm_properties = {
-	.snd_line6_playback_hw = {
+	.playback_hw = {
 				  .info = (SNDRV_PCM_INFO_MMAP |
 					   SNDRV_PCM_INFO_INTERLEAVED |
 					   SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -147,7 +147,7 @@ static struct line6_pcm_properties pod_pcm_properties = {
 				  .period_bytes_max = 8192,
 				  .periods_min = 1,
 				  .periods_max = 1024},
-	.snd_line6_capture_hw = {
+	.capture_hw = {
 				 .info = (SNDRV_PCM_INFO_MMAP |
 					  SNDRV_PCM_INFO_INTERLEAVED |
 					  SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -164,7 +164,7 @@ static struct line6_pcm_properties pod_pcm_properties = {
 				 .period_bytes_max = 8192,
 				 .periods_min = 1,
 				 .periods_max = 1024},
-	.snd_line6_rates = {
+	.rates = {
 			    .nrats = 1,
 			    .rats = &pod_ratden},
 	.bytes_per_frame = POD_BYTES_PER_FRAME
diff --git a/sound/usb/line6/podhd.c b/sound/usb/line6/podhd.c
index 4ebe6ef43073..9c3c7441fd11 100644
--- a/sound/usb/line6/podhd.c
+++ b/sound/usb/line6/podhd.c
@@ -35,7 +35,7 @@ static struct snd_ratden podhd_ratden = {
 };
 
 static struct line6_pcm_properties podhd_pcm_properties = {
-	.snd_line6_playback_hw = {
+	.playback_hw = {
 				  .info = (SNDRV_PCM_INFO_MMAP |
 					   SNDRV_PCM_INFO_INTERLEAVED |
 					   SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -53,7 +53,7 @@ static struct line6_pcm_properties podhd_pcm_properties = {
 				  .period_bytes_max = 8192,
 				  .periods_min = 1,
 				  .periods_max = 1024},
-	.snd_line6_capture_hw = {
+	.capture_hw = {
 				 .info = (SNDRV_PCM_INFO_MMAP |
 					  SNDRV_PCM_INFO_INTERLEAVED |
 					  SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -70,7 +70,7 @@ static struct line6_pcm_properties podhd_pcm_properties = {
 				 .period_bytes_max = 8192,
 				 .periods_min = 1,
 				 .periods_max = 1024},
-	.snd_line6_rates = {
+	.rates = {
 			    .nrats = 1,
 			    .rats = &podhd_ratden},
 	.bytes_per_frame = PODHD_BYTES_PER_FRAME
diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c
index cffcd7f83bfd..b107cf481819 100644
--- a/sound/usb/line6/toneport.c
+++ b/sound/usb/line6/toneport.c
@@ -76,7 +76,7 @@ static struct snd_ratden toneport_ratden = {
 };
 
 static struct line6_pcm_properties toneport_pcm_properties = {
-	.snd_line6_playback_hw = {
+	.playback_hw = {
 				  .info = (SNDRV_PCM_INFO_MMAP |
 					   SNDRV_PCM_INFO_INTERLEAVED |
 					   SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -94,7 +94,7 @@ static struct line6_pcm_properties toneport_pcm_properties = {
 				  .period_bytes_max = 8192,
 				  .periods_min = 1,
 				  .periods_max = 1024},
-	.snd_line6_capture_hw = {
+	.capture_hw = {
 				 .info = (SNDRV_PCM_INFO_MMAP |
 					  SNDRV_PCM_INFO_INTERLEAVED |
 					  SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -111,7 +111,7 @@ static struct line6_pcm_properties toneport_pcm_properties = {
 				 .period_bytes_max = 8192,
 				 .periods_min = 1,
 				 .periods_max = 1024},
-	.snd_line6_rates = {
+	.rates = {
 			    .nrats = 1,
 			    .rats = &toneport_ratden},
 	.bytes_per_frame = 4
-- 
2.2.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 1/7] ALSA: line6: Fix volume calculation for big-endian
  2015-01-28 16:41 ` [PATCH 1/7] ALSA: line6: Fix volume calculation for big-endian Takashi Iwai
@ 2015-01-28 16:54   ` Takashi Iwai
  0 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2015-01-28 16:54 UTC (permalink / raw)
  To: alsa-devel; +Cc: Stefan Hajnoczi, Chris Rorvick

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
v1->v2: fix the type to __le16, as sparse warns

 sound/usb/line6/playback.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/sound/usb/line6/playback.c b/sound/usb/line6/playback.c
index 1708c05f14db..3226422d2858 100644
--- a/sound/usb/line6/playback.c
+++ b/sound/usb/line6/playback.c
@@ -31,14 +31,16 @@ static void change_volume(struct urb *urb_out, int volume[],
 		return;		/* maximum volume - no change */
 
 	if (bytes_per_frame == 4) {
-		short *p, *buf_end;
+		__le16 *p, *buf_end;
 
 		p = (short *)urb_out->transfer_buffer;
 		buf_end = p + urb_out->transfer_buffer_length / sizeof(*p);
 
 		for (; p < buf_end; ++p) {
-			int val = (*p * volume[chn & 1]) >> 8;
-			*p = clamp(val, 0x7fff, -0x8000);
+			short pv = le16_to_cpu(*p);
+			int val = (pv * volume[chn & 1]) >> 8;
+			pv = clamp(val, 0x7fff, -0x8000);
+			*p = cpu_to_le16(pv);
 			++chn;
 		}
 	} else if (bytes_per_frame == 6) {
@@ -114,15 +116,18 @@ static void add_monitor_signal(struct urb *urb_out, unsigned char *signal,
 		return;		/* zero volume - no change */
 
 	if (bytes_per_frame == 4) {
-		short *pi, *po, *buf_end;
+		__le16 *pi, *po, *buf_end;
 
 		pi = (short *)signal;
 		po = (short *)urb_out->transfer_buffer;
 		buf_end = po + urb_out->transfer_buffer_length / sizeof(*po);
 
 		for (; po < buf_end; ++pi, ++po) {
-			int val = *po + ((*pi * volume) >> 8);
-			*po = clamp(val, 0x7fff, -0x8000);
+			short pov = le16_to_cpu(*po);
+			short piv = le16_to_cpu(*pi);
+			int val = pov + ((piv * volume) >> 8);
+			pov = clamp(val, 0x7fff, -0x8000);
+			*po = cpu_to_le16(pov);
 		}
 	}
 
-- 
2.2.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-01-28 16:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-28 16:41 [PATCH 0/7] Yet another line6 cleanups Takashi Iwai
2015-01-28 16:41 ` [PATCH 1/7] ALSA: line6: Fix volume calculation for big-endian Takashi Iwai
2015-01-28 16:54   ` [PATCH v2 " Takashi Iwai
2015-01-28 16:41 ` [PATCH 2/7] ALSA: line6: Tidy up and typo fixes in comments Takashi Iwai
2015-01-28 16:41 ` [PATCH 3/7] ALSA: line6: Remove revision.h Takashi Iwai
2015-01-28 16:41 ` [PATCH 4/7] ALSA: line6: Move the contents of usbdefs.h into driver.h Takashi Iwai
2015-01-28 16:41 ` [PATCH 5/7] ALSA: line6: Remove struct usb_line6_podhd Takashi Iwai
2015-01-28 16:41 ` [PATCH 6/7] ALSA: line6: Remove invalid capability bits for PODxt Live Variax Takashi Iwai
2015-01-28 16:41 ` [PATCH 7/7] ALSA: line6: Remove snd_line6_ prefix of pcm property fields Takashi Iwai

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.