Skip to content

Commit 5030d07

Browse files
committed
Merge remote-tracking branch 'takashi/for-next' into sound/upstream-20260624
2 parents d3185a2 + 435990e commit 5030d07

171 files changed

Lines changed: 3178 additions & 1040 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/alsa-configuration.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,6 +2383,24 @@ quirk_flags
23832383
``V(x) = k * x``; ``dB(x) = 20 * log10(x)``. Overrides bit 24
23842384
* bit 28: ``mixer_capture_linear_vol``
23852385
Similar to bit 27 but for capture streams. Overrides bit 25
2386+
* bit 29: ``ifb_silence_on_empty``
2387+
In implicit feedback mode, when an entire capture URB returns with
2388+
all iso_frame_desc[i].status != 0 (bytes==0), do not silently return
2389+
from snd_usb_handle_sync_urb. Instead fall through and enqueue a
2390+
packet_info containing only size-0 packets, so the OUT ring keeps
2391+
moving (emits silence). Needed by Behringer Flow 8 (1397:050c).
2392+
* bit 30: ``mixer_get_cur_broken``
2393+
Some mixers are sticky, which means that setting their current volume
2394+
is a no-op, and reading the current volume returns a constant value.
2395+
The sticky check disables these mixers to prevent confusing userspace.
2396+
However, some devices do have a tunable volume despite the reported
2397+
current volume being constant. As the sticky check can't distinguish
2398+
between the two categories, setting this flag tells that the device
2399+
should fall into the second category when GET_CUR returns a constant
2400+
value, resulting in the sticky check being non-fatal and only
2401+
disabling GET_CUR instead of the whole mixer. The current volume will
2402+
then be provided by the internal cache that stores the last set
2403+
volume
23862404

23872405
This module supports multiple devices, autoprobe and hotplugging.
23882406

drivers/base/firmware_loader/main.c

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,7 @@ EXPORT_SYMBOL(release_firmware);
11321132
/* Async support */
11331133
struct firmware_work {
11341134
struct work_struct work;
1135+
struct list_head list;
11351136
struct module *module;
11361137
const char *name;
11371138
struct device *device;
@@ -1140,6 +1141,17 @@ struct firmware_work {
11401141
u32 opt_flags;
11411142
};
11421143

1144+
static LIST_HEAD(firmware_work_list);
1145+
static DEFINE_SPINLOCK(firmware_work_lock);
1146+
1147+
static void firmware_work_free(struct firmware_work *fw_work)
1148+
{
1149+
put_device(fw_work->device); /* taken in request_firmware_nowait() */
1150+
module_put(fw_work->module);
1151+
kfree_const(fw_work->name);
1152+
kfree(fw_work);
1153+
}
1154+
11431155
static void request_firmware_work_func(struct work_struct *work)
11441156
{
11451157
struct firmware_work *fw_work;
@@ -1150,11 +1162,15 @@ static void request_firmware_work_func(struct work_struct *work)
11501162
_request_firmware(&fw, fw_work->name, fw_work->device, NULL, 0, 0,
11511163
fw_work->opt_flags);
11521164
fw_work->cont(fw, fw_work->context);
1153-
put_device(fw_work->device); /* taken in request_firmware_nowait() */
11541165

1155-
module_put(fw_work->module);
1156-
kfree_const(fw_work->name);
1157-
kfree(fw_work);
1166+
spin_lock_irq(&firmware_work_lock);
1167+
if (!list_empty(&fw_work->list)) {
1168+
list_del_init(&fw_work->list);
1169+
spin_unlock_irq(&firmware_work_lock);
1170+
firmware_work_free(fw_work);
1171+
return;
1172+
}
1173+
spin_unlock_irq(&firmware_work_lock);
11581174
}
11591175

11601176

@@ -1164,6 +1180,7 @@ static int _request_firmware_nowait(
11641180
void (*cont)(const struct firmware *fw, void *context), bool nowarn)
11651181
{
11661182
struct firmware_work *fw_work;
1183+
unsigned long flags;
11671184

11681185
fw_work = kzalloc_obj(struct firmware_work, gfp);
11691186
if (!fw_work)
@@ -1196,7 +1213,12 @@ static int _request_firmware_nowait(
11961213

11971214
get_device(fw_work->device);
11981215
INIT_WORK(&fw_work->work, request_firmware_work_func);
1216+
1217+
spin_lock_irqsave(&firmware_work_lock, flags);
1218+
list_add_tail(&fw_work->list, &firmware_work_list);
11991219
schedule_work(&fw_work->work);
1220+
spin_unlock_irqrestore(&firmware_work_lock, flags);
1221+
12001222
return 0;
12011223
}
12021224

@@ -1259,6 +1281,44 @@ int firmware_request_nowait_nowarn(
12591281
}
12601282
EXPORT_SYMBOL_GPL(firmware_request_nowait_nowarn);
12611283

1284+
/**
1285+
* request_firmware_nowait_cancel() - cancel an async firmware request
1286+
* @device: device for which the firmware is being loaded
1287+
* @context: context passed to request_firmware_nowait()
1288+
* @cont: callback passed to request_firmware_nowait()
1289+
*
1290+
* Cancel a pending request_firmware_nowait() request for @device, @context
1291+
* and @cont. If the associated work has already started, this function waits
1292+
* until the callback has returned. If the callback has already completed, this
1293+
* function does nothing.
1294+
*
1295+
* This function may sleep.
1296+
*/
1297+
void request_firmware_nowait_cancel(struct device *device, void *context,
1298+
void (*cont)(const struct firmware *fw,
1299+
void *context))
1300+
{
1301+
struct firmware_work *fw_work = NULL;
1302+
struct firmware_work *tmp;
1303+
1304+
spin_lock_irq(&firmware_work_lock);
1305+
list_for_each_entry_reverse(tmp, &firmware_work_list, list) {
1306+
if (tmp->device == device && tmp->context == context &&
1307+
tmp->cont == cont) {
1308+
fw_work = tmp;
1309+
list_del_init(&fw_work->list);
1310+
break;
1311+
}
1312+
}
1313+
spin_unlock_irq(&firmware_work_lock);
1314+
1315+
if (!fw_work)
1316+
return;
1317+
cancel_work_sync(&fw_work->work);
1318+
firmware_work_free(fw_work);
1319+
}
1320+
EXPORT_SYMBOL_GPL(request_firmware_nowait_cancel);
1321+
12621322
#ifdef CONFIG_FW_CACHE
12631323
static ASYNC_DOMAIN_EXCLUSIVE(fw_cache_domain);
12641324

include/linux/firmware.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ int request_firmware_nowait(
110110
struct module *module, bool uevent,
111111
const char *name, struct device *device, gfp_t gfp, void *context,
112112
void (*cont)(const struct firmware *fw, void *context));
113+
void request_firmware_nowait_cancel(struct device *device, void *context,
114+
void (*cont)(const struct firmware *fw,
115+
void *context));
113116
int request_firmware_direct(const struct firmware **fw, const char *name,
114117
struct device *device);
115118
int request_firmware_into_buf(const struct firmware **firmware_p,
@@ -157,6 +160,13 @@ static inline int request_firmware_nowait(
157160
return -EINVAL;
158161
}
159162

163+
static inline void request_firmware_nowait_cancel(struct device *device,
164+
void *context,
165+
void (*cont)(const struct firmware *fw,
166+
void *context))
167+
{
168+
}
169+
160170
static inline void release_firmware(const struct firmware *fw)
161171
{
162172
}

include/sound/core.h

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,27 @@ struct snd_device {
7575

7676
#define snd_device(n) list_entry(n, struct snd_device, list)
7777

78+
/*
79+
* A simple reference counter with a wait queue;
80+
* typically used for usage counts, and you can synchronize at finishing
81+
* via snd_refcount_sync(), which is woken up when the refcount reaches to
82+
* zero again.
83+
*/
84+
struct snd_refcount {
85+
atomic_t count;
86+
wait_queue_head_t waiter;
87+
};
88+
89+
void snd_refcount_init(struct snd_refcount *ref);
90+
91+
static inline void snd_refcount_get(struct snd_refcount *ref)
92+
{
93+
atomic_inc(&ref->count);
94+
}
95+
96+
void snd_refcount_put(struct snd_refcount *ref);
97+
void snd_refcount_sync(struct snd_refcount *ref);
98+
7899
/* main structure for soundcard */
79100

80101
struct snd_card {
@@ -139,15 +160,16 @@ struct snd_card {
139160

140161
#ifdef CONFIG_PM
141162
unsigned int power_state; /* power state */
142-
atomic_t power_ref;
143163
wait_queue_head_t power_sleep;
144-
wait_queue_head_t power_ref_sleep;
164+
struct snd_refcount power_ref;
145165
#endif
146166

147167
#if IS_ENABLED(CONFIG_SND_MIXER_OSS)
148168
struct snd_mixer_oss *mixer_oss;
149169
int mixer_oss_change_count;
150170
#endif
171+
172+
unsigned char private_data_area[] __aligned(__alignof__(unsigned long long));
151173
};
152174

153175
#define dev_to_snd_card(p) container_of(p, struct snd_card, card_dev)
@@ -174,7 +196,7 @@ static inline void snd_power_change_state(struct snd_card *card, unsigned int st
174196
*/
175197
static inline void snd_power_ref(struct snd_card *card)
176198
{
177-
atomic_inc(&card->power_ref);
199+
snd_refcount_get(&card->power_ref);
178200
}
179201

180202
/**
@@ -183,8 +205,7 @@ static inline void snd_power_ref(struct snd_card *card)
183205
*/
184206
static inline void snd_power_unref(struct snd_card *card)
185207
{
186-
if (atomic_dec_and_test(&card->power_ref))
187-
wake_up(&card->power_ref_sleep);
208+
snd_refcount_put(&card->power_ref);
188209
}
189210

190211
/**
@@ -196,7 +217,7 @@ static inline void snd_power_unref(struct snd_card *card)
196217
*/
197218
static inline void snd_power_sync_ref(struct snd_card *card)
198219
{
199-
wait_event(card->power_ref_sleep, !atomic_read(&card->power_ref));
220+
snd_refcount_sync(&card->power_ref);
200221
}
201222

202223
/* init.c */
@@ -317,6 +338,8 @@ static inline void snd_card_unref(struct snd_card *card)
317338
put_device(&card->card_dev);
318339
}
319340

341+
DEFINE_FREE(snd_card_unref, struct snd_card *, if (_T) snd_card_unref(_T))
342+
320343
#define snd_card_set_dev(card, devptr) ((card)->dev = (devptr))
321344

322345
/* device.c */

include/sound/emux_synth.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ struct snd_emux {
125125
*/
126126
struct snd_emux_port {
127127

128-
struct snd_midi_channel_set chset;
129128
struct snd_emux *emu;
130129

131130
char port_mode; /* operation mode */
@@ -138,6 +137,7 @@ struct snd_emux_port {
138137
#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
139138
struct snd_seq_oss_arg *oss_arg;
140139
#endif
140+
struct snd_midi_channel_set chset;
141141
};
142142

143143
/* port_mode */

include/sound/hda_codec.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ struct hda_codec {
188188

189189
/* PCM to create, set by hda_codec_ops.build_pcms callback */
190190
struct list_head pcm_list_head;
191-
refcount_t pcm_ref;
192-
wait_queue_head_t remove_sleep;
191+
struct snd_refcount pcm_ref;
193192

194193
/* codec specific info */
195194
void *spec;
@@ -259,6 +258,7 @@ struct hda_codec {
259258
unsigned int forced_resume:1; /* forced resume for jack */
260259
unsigned int no_stream_clean_at_suspend:1; /* do not clean streams at suspend */
261260
unsigned int ctl_dev_id:1; /* old control element id build behaviour */
261+
unsigned int eld_jack_detect:1; /* Machine jack-detection by ELD */
262262

263263
unsigned long power_on_acct;
264264
unsigned long power_off_acct;
@@ -438,9 +438,12 @@ void snd_hda_codec_cleanup_for_unbind(struct hda_codec *codec);
438438

439439
static inline void snd_hda_codec_pcm_get(struct hda_pcm *pcm)
440440
{
441-
refcount_inc(&pcm->codec->pcm_ref);
441+
snd_refcount_get(&pcm->codec->pcm_ref);
442+
}
443+
static inline void snd_hda_codec_pcm_put(struct hda_pcm *pcm)
444+
{
445+
snd_refcount_put(&pcm->codec->pcm_ref);
442446
}
443-
void snd_hda_codec_pcm_put(struct hda_pcm *pcm);
444447

445448
int snd_hda_codec_prepare(struct hda_codec *codec,
446449
struct hda_pcm_stream *hinfo,

include/sound/seq_device.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ struct snd_seq_device {
2222
void *private_data; /* private data for the caller */
2323
void (*private_free)(struct snd_seq_device *device);
2424
struct device dev;
25+
unsigned char args[]; /* driver-specific argument */
2526
};
2627

2728
#define to_seq_dev(_dev) \
@@ -64,7 +65,7 @@ void snd_seq_device_load_drivers(void);
6465
int snd_seq_device_new(struct snd_card *card, int device, const char *id,
6566
int argsize, struct snd_seq_device **result);
6667

67-
#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device))
68+
#define SNDRV_SEQ_DEVICE_ARGPTR(dev) ((void *)(dev)->args)
6869

6970
int __must_check __snd_seq_driver_register(struct snd_seq_driver *drv,
7071
struct module *mod);

include/sound/seq_midi_emul.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ struct snd_midi_channel_set {
5555
int client; /* Client for this port */
5656
int port; /* The port number */
5757

58-
int max_channels; /* Size of the channels array */
59-
struct snd_midi_channel *channels;
60-
6158
unsigned char midi_mode; /* MIDI operating mode */
6259
unsigned char gs_master_volume; /* SYSEX master volume: 0-127 */
6360
unsigned char gs_chorus_mode;
6461
unsigned char gs_reverb_mode;
6562

63+
int max_channels; /* Size of the channels array */
64+
struct snd_midi_channel channels[] __counted_by(max_channels);
65+
6666
};
6767

6868
struct snd_midi_op {

include/sound/snd_wavefront.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
struct _snd_wavefront_midi;
1313
struct _snd_wavefront_card;
1414
struct _snd_wavefront;
15+
struct snd_wss;
1516

1617
typedef struct _snd_wavefront_midi snd_wavefront_midi_t;
1718
typedef struct _snd_wavefront_card snd_wavefront_card_t;
@@ -46,6 +47,8 @@ extern void snd_wavefront_midi_enable_virtual (snd_wavefront_card_t *);
4647
extern void snd_wavefront_midi_disable_virtual (snd_wavefront_card_t *);
4748
extern void snd_wavefront_midi_interrupt (snd_wavefront_card_t *);
4849
extern int snd_wavefront_midi_start (snd_wavefront_card_t *);
50+
void snd_wavefront_midi_suspend(snd_wavefront_card_t *card);
51+
void snd_wavefront_midi_resume(snd_wavefront_card_t *card);
4952

5053
struct _snd_wavefront {
5154
unsigned long irq; /* "you were one, one of the few ..." */
@@ -93,6 +96,7 @@ struct _snd_wavefront {
9396
int samples_used; /* how many */
9497
char interrupts_are_midi; /* h/w MPU interrupts enabled ? */
9598
char rom_samples_rdonly; /* can we write on ROM samples */
99+
char midi_in_to_synth; /* route external MIDI to synth */
96100
spinlock_t irq_lock;
97101
wait_queue_head_t interrupt_sleeper;
98102
snd_wavefront_midi_t midi; /* ICS2115 MIDI interface */
@@ -101,6 +105,7 @@ struct _snd_wavefront {
101105

102106
struct _snd_wavefront_card {
103107
snd_wavefront_t wavefront;
108+
struct snd_wss *chip;
104109
#ifdef CONFIG_PNP
105110
struct pnp_dev *wss;
106111
struct pnp_dev *ctrl;
@@ -110,8 +115,10 @@ struct _snd_wavefront_card {
110115
};
111116

112117
extern void snd_wavefront_internal_interrupt (snd_wavefront_card_t *card);
118+
void snd_wavefront_cache_firmware(snd_wavefront_t *dev);
113119
extern int snd_wavefront_start (snd_wavefront_t *dev);
114120
extern int snd_wavefront_detect (snd_wavefront_card_t *card);
121+
int snd_wavefront_resume_synth(snd_wavefront_card_t *card);
115122
extern int snd_wavefront_cmd (snd_wavefront_t *, int, unsigned char *,
116123
unsigned char *);
117124

include/sound/timer.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ struct snd_timer {
7575
struct list_head ack_list_head;
7676
struct list_head sack_list_head; /* slow ack list head */
7777
struct work_struct task_work;
78+
struct kref kref;
7879
int max_instances; /* upper limit of timer instances */
7980
int num_instances; /* current number of timer instances */
8081
};
@@ -131,4 +132,9 @@ int snd_timer_pause(struct snd_timer_instance *timeri);
131132

132133
void snd_timer_interrupt(struct snd_timer *timer, unsigned long ticks_left);
133134

135+
struct snd_timer *snd_timeri_timer_get(struct snd_timer_instance *timeri);
136+
void snd_timeri_timer_put(struct snd_timer *timer);
137+
138+
DEFINE_FREE(snd_timeri_timer, struct snd_timer *, if (_T) snd_timeri_timer_put(_T))
139+
134140
#endif /* __SOUND_TIMER_H */

0 commit comments

Comments
 (0)