Skip to content

Commit 01e53b4

Browse files
committed
Merge remote-tracking branch 'takashi/for-next' into sound/upstream-20210623-2
2 parents c07adf6 + 3099406 commit 01e53b4

279 files changed

Lines changed: 10247 additions & 6031 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Documentation/sound/hd-audio/controls.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Conexant codecs
102102
---------------
103103

104104
Auto-Mute Mode
105-
See Reatek codecs.
105+
See Realtek codecs.
106106

107107

108108
Analog codecs

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7112,6 +7112,13 @@ L: linux-input@vger.kernel.org
71127112
S: Maintained
71137113
F: drivers/input/joystick/fsia6b.c
71147114

7115+
FOCUSRITE SCARLETT GEN 2/3 MIXER DRIVER
7116+
M: Geoffrey D. Bennett <g@b4.vu>
7117+
L: alsa-devel@alsa-project.org (moderated for non-subscribers)
7118+
S: Maintained
7119+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
7120+
F: sound/usb/mixer_scarlett_gen2.c
7121+
71157122
FORCEDETH GIGABIT ETHERNET DRIVER
71167123
M: Rain River <rain.1986.08.12@gmail.com>
71177124
M: Zhu Yanjun <zyjzyj2000@gmail.com>

include/sound/core.h

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ struct snd_card {
128128

129129
#ifdef CONFIG_PM
130130
unsigned int power_state; /* power state */
131+
atomic_t power_ref;
131132
wait_queue_head_t power_sleep;
133+
wait_queue_head_t power_ref_sleep;
132134
#endif
133135

134136
#if IS_ENABLED(CONFIG_SND_MIXER_OSS)
@@ -142,21 +144,61 @@ struct snd_card {
142144
#ifdef CONFIG_PM
143145
static inline unsigned int snd_power_get_state(struct snd_card *card)
144146
{
145-
return card->power_state;
147+
return READ_ONCE(card->power_state);
146148
}
147149

148150
static inline void snd_power_change_state(struct snd_card *card, unsigned int state)
149151
{
150-
card->power_state = state;
152+
WRITE_ONCE(card->power_state, state);
151153
wake_up(&card->power_sleep);
152154
}
153155

156+
/**
157+
* snd_power_ref - Take the reference count for power control
158+
* @card: sound card object
159+
*
160+
* The power_ref reference of the card is used for managing to block
161+
* the snd_power_sync_ref() operation. This function increments the reference.
162+
* The counterpart snd_power_unref() has to be called appropriately later.
163+
*/
164+
static inline void snd_power_ref(struct snd_card *card)
165+
{
166+
atomic_inc(&card->power_ref);
167+
}
168+
169+
/**
170+
* snd_power_unref - Release the reference count for power control
171+
* @card: sound card object
172+
*/
173+
static inline void snd_power_unref(struct snd_card *card)
174+
{
175+
if (atomic_dec_and_test(&card->power_ref))
176+
wake_up(&card->power_ref_sleep);
177+
}
178+
179+
/**
180+
* snd_power_sync_ref - wait until the card power_ref is freed
181+
* @card: sound card object
182+
*
183+
* This function is used to synchronize with the pending power_ref being
184+
* released.
185+
*/
186+
static inline void snd_power_sync_ref(struct snd_card *card)
187+
{
188+
wait_event(card->power_ref_sleep, !atomic_read(&card->power_ref));
189+
}
190+
154191
/* init.c */
155-
int snd_power_wait(struct snd_card *card, unsigned int power_state);
192+
int snd_power_wait(struct snd_card *card);
193+
int snd_power_ref_and_wait(struct snd_card *card);
156194

157195
#else /* ! CONFIG_PM */
158196

159-
static inline int snd_power_wait(struct snd_card *card, unsigned int state) { return 0; }
197+
static inline int snd_power_wait(struct snd_card *card) { return 0; }
198+
static inline void snd_power_ref(struct snd_card *card) {}
199+
static inline void snd_power_unref(struct snd_card *card) {}
200+
static inline int snd_power_ref_and_wait(struct snd_card *card) { return 0; }
201+
static inline void snd_power_sync_ref(struct snd_card *card) {}
160202
#define snd_power_get_state(card) ({ (void)(card); SNDRV_CTL_POWER_D0; })
161203
#define snd_power_change_state(card, state) do { (void)(card); } while (0)
162204

include/sound/memalloc.h

Lines changed: 8 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <asm/page.h>
1313

1414
struct device;
15+
struct vm_area_struct;
1516

1617
/*
1718
* buffer device info
@@ -64,84 +65,19 @@ static inline unsigned int snd_sgbuf_aligned_pages(size_t size)
6465
return (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
6566
}
6667

67-
#ifdef CONFIG_SND_DMA_SGBUF
68-
/*
69-
* Scatter-Gather generic device pages
70-
*/
71-
void *snd_malloc_sgbuf_pages(struct device *device,
72-
size_t size, struct snd_dma_buffer *dmab,
73-
size_t *res_size);
74-
int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab);
75-
76-
struct snd_sg_page {
77-
void *buf;
78-
dma_addr_t addr;
79-
};
80-
81-
struct snd_sg_buf {
82-
int size; /* allocated byte size */
83-
int pages; /* allocated pages */
84-
int tblsize; /* allocated table size */
85-
struct snd_sg_page *table; /* address table */
86-
struct page **page_table; /* page table (for vmap/vunmap) */
87-
struct device *dev;
88-
};
89-
90-
/*
91-
* return the physical address at the corresponding offset
92-
*/
93-
static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab,
94-
size_t offset)
95-
{
96-
struct snd_sg_buf *sgbuf = dmab->private_data;
97-
dma_addr_t addr;
98-
99-
if (!sgbuf)
100-
return dmab->addr + offset;
101-
addr = sgbuf->table[offset >> PAGE_SHIFT].addr;
102-
addr &= ~((dma_addr_t)PAGE_SIZE - 1);
103-
return addr + offset % PAGE_SIZE;
104-
}
105-
106-
/*
107-
* return the virtual address at the corresponding offset
108-
*/
109-
static inline void *snd_sgbuf_get_ptr(struct snd_dma_buffer *dmab,
110-
size_t offset)
111-
{
112-
struct snd_sg_buf *sgbuf = dmab->private_data;
113-
114-
if (!sgbuf)
115-
return dmab->area + offset;
116-
return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE;
117-
}
118-
119-
unsigned int snd_sgbuf_get_chunk_size(struct snd_dma_buffer *dmab,
120-
unsigned int ofs, unsigned int size);
121-
#else
122-
/* non-SG versions */
123-
static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab,
124-
size_t offset)
125-
{
126-
return dmab->addr + offset;
127-
}
128-
129-
static inline void *snd_sgbuf_get_ptr(struct snd_dma_buffer *dmab,
130-
size_t offset)
131-
{
132-
return dmab->area + offset;
133-
}
134-
135-
#define snd_sgbuf_get_chunk_size(dmab, ofs, size) (size)
136-
137-
#endif /* CONFIG_SND_DMA_SGBUF */
138-
13968
/* allocate/release a buffer */
14069
int snd_dma_alloc_pages(int type, struct device *dev, size_t size,
14170
struct snd_dma_buffer *dmab);
14271
int snd_dma_alloc_pages_fallback(int type, struct device *dev, size_t size,
14372
struct snd_dma_buffer *dmab);
14473
void snd_dma_free_pages(struct snd_dma_buffer *dmab);
74+
int snd_dma_buffer_mmap(struct snd_dma_buffer *dmab,
75+
struct vm_area_struct *area);
76+
77+
dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab, size_t offset);
78+
struct page *snd_sgbuf_get_page(struct snd_dma_buffer *dmab, size_t offset);
79+
unsigned int snd_sgbuf_get_chunk_size(struct snd_dma_buffer *dmab,
80+
unsigned int ofs, unsigned int size);
14581

14682
#endif /* __SOUND_MEMALLOC_H */
14783

include/sound/pcm.h

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,7 @@ void snd_pcm_set_ops(struct snd_pcm * pcm, int direction,
10661066
void snd_pcm_set_sync(struct snd_pcm_substream *substream);
10671067
int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
10681068
unsigned int cmd, void *arg);
1069+
void snd_pcm_period_elapsed_under_stream_lock(struct snd_pcm_substream *substream);
10691070
void snd_pcm_period_elapsed(struct snd_pcm_substream *substream);
10701071
snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
10711072
void *buf, bool interleaved,
@@ -1253,14 +1254,6 @@ static inline int snd_pcm_lib_alloc_vmalloc_32_buffer
12531254

12541255
#define snd_pcm_get_dma_buf(substream) ((substream)->runtime->dma_buffer_p)
12551256

1256-
#ifdef CONFIG_SND_DMA_SGBUF
1257-
/*
1258-
* SG-buffer handling
1259-
*/
1260-
#define snd_pcm_substream_sgbuf(substream) \
1261-
snd_pcm_get_dma_buf(substream)->private_data
1262-
#endif /* SND_DMA_SGBUF */
1263-
12641257
/**
12651258
* snd_pcm_sgbuf_get_addr - Get the DMA address at the corresponding offset
12661259
* @substream: PCM substream
@@ -1272,17 +1265,6 @@ snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs)
12721265
return snd_sgbuf_get_addr(snd_pcm_get_dma_buf(substream), ofs);
12731266
}
12741267

1275-
/**
1276-
* snd_pcm_sgbuf_get_ptr - Get the virtual address at the corresponding offset
1277-
* @substream: PCM substream
1278-
* @ofs: byte offset
1279-
*/
1280-
static inline void *
1281-
snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs)
1282-
{
1283-
return snd_sgbuf_get_ptr(snd_pcm_get_dma_buf(substream), ofs);
1284-
}
1285-
12861268
/**
12871269
* snd_pcm_sgbuf_get_chunk_size - Compute the max size that fits within the
12881270
* contig. page from the given size

include/sound/rawmidi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ struct snd_rawmidi_substream {
8181
bool opened; /* open flag */
8282
bool append; /* append flag (merge more streams) */
8383
bool active_sensing; /* send active sensing when close */
84+
unsigned int framing; /* whether to frame input data */
85+
unsigned int clock_type; /* clock source to use for input framing */
8486
int use_count; /* use counter (for output) */
8587
size_t bytes;
8688
struct snd_rawmidi *rmidi;

include/uapi/sound/asound.h

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ enum {
710710
* Raw MIDI section - /dev/snd/midi??
711711
*/
712712

713-
#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 1)
713+
#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 2)
714714

715715
enum {
716716
SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
@@ -736,12 +736,38 @@ struct snd_rawmidi_info {
736736
unsigned char reserved[64]; /* reserved for future use */
737737
};
738738

739+
#define SNDRV_RAWMIDI_MODE_FRAMING_MASK (7<<0)
740+
#define SNDRV_RAWMIDI_MODE_FRAMING_SHIFT 0
741+
#define SNDRV_RAWMIDI_MODE_FRAMING_NONE (0<<0)
742+
#define SNDRV_RAWMIDI_MODE_FRAMING_TSTAMP (1<<0)
743+
#define SNDRV_RAWMIDI_MODE_CLOCK_MASK (7<<3)
744+
#define SNDRV_RAWMIDI_MODE_CLOCK_SHIFT 3
745+
#define SNDRV_RAWMIDI_MODE_CLOCK_NONE (0<<3)
746+
#define SNDRV_RAWMIDI_MODE_CLOCK_REALTIME (1<<3)
747+
#define SNDRV_RAWMIDI_MODE_CLOCK_MONOTONIC (2<<3)
748+
#define SNDRV_RAWMIDI_MODE_CLOCK_MONOTONIC_RAW (3<<3)
749+
750+
#define SNDRV_RAWMIDI_FRAMING_DATA_LENGTH 16
751+
752+
struct snd_rawmidi_framing_tstamp {
753+
/* For now, frame_type is always 0. Midi 2.0 is expected to add new
754+
* types here. Applications are expected to skip unknown frame types.
755+
*/
756+
__u8 frame_type;
757+
__u8 length; /* number of valid bytes in data field */
758+
__u8 reserved[2];
759+
__u32 tv_nsec; /* nanoseconds */
760+
__u64 tv_sec; /* seconds */
761+
__u8 data[SNDRV_RAWMIDI_FRAMING_DATA_LENGTH];
762+
} __packed;
763+
739764
struct snd_rawmidi_params {
740765
int stream;
741766
size_t buffer_size; /* queue size in bytes */
742767
size_t avail_min; /* minimum avail bytes for wakeup */
743768
unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */
744-
unsigned char reserved[16]; /* reserved for future use */
769+
unsigned int mode; /* For input data only, frame incoming data */
770+
unsigned char reserved[12]; /* reserved for future use */
745771
};
746772

747773
#ifndef __KERNEL__

sound/ac97/bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ static int ac97_bus_remove(struct device *dev)
520520
struct ac97_codec_driver *adrv = to_ac97_driver(dev->driver);
521521
int ret;
522522

523-
ret = pm_runtime_get_sync(dev);
523+
ret = pm_runtime_resume_and_get(dev);
524524
if (ret < 0)
525525
return ret;
526526

sound/aoa/soundbus/i2sbus/pcm.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -918,10 +918,8 @@ i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card,
918918
}
919919

920920
cii = kzalloc(sizeof(struct codec_info_item), GFP_KERNEL);
921-
if (!cii) {
922-
printk(KERN_DEBUG "i2sbus: failed to allocate cii\n");
921+
if (!cii)
923922
return -ENOMEM;
924-
}
925923

926924
/* use the private data to point to the codec info */
927925
cii->sdev = soundbus_dev_get(dev);

sound/arm/pxa2xx-ac97.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ static unsigned short pxa2xx_ac97_legacy_read(struct snd_ac97 *ac97,
4747
static void pxa2xx_ac97_legacy_write(struct snd_ac97 *ac97,
4848
unsigned short reg, unsigned short val)
4949
{
50-
int __always_unused ret;
51-
52-
ret = pxa2xx_ac97_write(ac97->num, reg, val);
50+
pxa2xx_ac97_write(ac97->num, reg, val);
5351
}
5452

5553
static const struct snd_ac97_bus_ops pxa2xx_ac97_ops = {

0 commit comments

Comments
 (0)