Skip to content

Commit 5fa87a0

Browse files
committed
Merge branch 'for-next' into for-linus
Pull 6.11 devel branch Signed-off-by: Takashi Iwai <[email protected]>
2 parents 8fc1e8b + d2eb433 commit 5fa87a0

40 files changed

+779
-264
lines changed

MAINTAINERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24951,6 +24951,12 @@ F: mm/zpool.c
2495124951
F: mm/zswap.c
2495224952
F: tools/testing/selftests/cgroup/test_zswap.c
2495324953

24954+
SENARYTECH AUDIO CODEC DRIVER
24955+
M: bo liu <[email protected]>
24956+
S: Maintained
24957+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
24958+
F: sound/pci/hda/patch_senarytech.c
24959+
2495424960
THE REST
2495524961
M: Linus Torvalds <[email protected]>
2495624962

include/linux/pci_ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3112,6 +3112,7 @@
31123112
#define PCI_DEVICE_ID_INTEL_HDA_LNL_P 0xa828
31133113
#define PCI_DEVICE_ID_INTEL_S21152BB 0xb152
31143114
#define PCI_DEVICE_ID_INTEL_HDA_BMG 0xe2f7
3115+
#define PCI_DEVICE_ID_INTEL_HDA_PTL 0xe428
31153116
#define PCI_DEVICE_ID_INTEL_HDA_CML_R 0xf0c8
31163117
#define PCI_DEVICE_ID_INTEL_HDA_RKL_S 0xf1c8
31173118

include/sound/pcm.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ struct snd_pcm_ops {
9393
#define SNDRV_PCM_IOCTL1_CHANNEL_INFO 2
9494
/* 3 is absent slot. */
9595
#define SNDRV_PCM_IOCTL1_FIFO_SIZE 4
96+
#define SNDRV_PCM_IOCTL1_SYNC_ID 5
9697

9798
#define SNDRV_PCM_TRIGGER_STOP 0
9899
#define SNDRV_PCM_TRIGGER_START 1
@@ -401,7 +402,7 @@ struct snd_pcm_runtime {
401402
snd_pcm_uframes_t silence_start; /* starting pointer to silence area */
402403
snd_pcm_uframes_t silence_filled; /* already filled part of silence area */
403404

404-
union snd_pcm_sync_id sync; /* hardware synchronization ID */
405+
bool std_sync_id; /* hardware synchronization - standard per card ID */
405406

406407
/* -- mmap -- */
407408
struct snd_pcm_mmap_status *status;
@@ -1155,7 +1156,18 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int
11551156

11561157
void snd_pcm_set_ops(struct snd_pcm * pcm, int direction,
11571158
const struct snd_pcm_ops *ops);
1158-
void snd_pcm_set_sync(struct snd_pcm_substream *substream);
1159+
void snd_pcm_set_sync_per_card(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params,
1160+
const unsigned char *id, unsigned int len);
1161+
/**
1162+
* snd_pcm_set_sync - set the PCM sync id
1163+
* @substream: the pcm substream
1164+
*
1165+
* Use the default PCM sync identifier for the specific card.
1166+
*/
1167+
static inline void snd_pcm_set_sync(struct snd_pcm_substream *substream)
1168+
{
1169+
substream->runtime->std_sync_id = true;
1170+
}
11591171
int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
11601172
unsigned int cmd, void *arg);
11611173
void snd_pcm_period_elapsed_under_stream_lock(struct snd_pcm_substream *substream);

include/uapi/sound/asequencer.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <sound/asound.h>
1111

1212
/** version of the sequencer */
13-
#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 3)
13+
#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 4)
1414

1515
/**
1616
* definition of sequencer event types
@@ -523,11 +523,12 @@ struct snd_seq_queue_status {
523523
/* queue tempo */
524524
struct snd_seq_queue_tempo {
525525
int queue; /* sequencer queue */
526-
unsigned int tempo; /* current tempo, us/tick */
526+
unsigned int tempo; /* current tempo, us/tick (or different time-base below) */
527527
int ppq; /* time resolution, ticks/quarter */
528528
unsigned int skew_value; /* queue skew */
529529
unsigned int skew_base; /* queue skew base */
530-
char reserved[24]; /* for the future */
530+
unsigned short tempo_base; /* tempo base in nsec unit; either 10 or 1000 */
531+
char reserved[22]; /* for the future */
531532
};
532533

533534

include/uapi/sound/asound.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ struct snd_hwdep_dsp_image {
142142
* *
143143
*****************************************************************************/
144144

145-
#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 17)
145+
#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 18)
146146

147147
typedef unsigned long snd_pcm_uframes_t;
148148
typedef signed long snd_pcm_sframes_t;
@@ -334,7 +334,7 @@ union snd_pcm_sync_id {
334334
unsigned char id[16];
335335
unsigned short id16[8];
336336
unsigned int id32[4];
337-
};
337+
} __attribute__((deprecated));
338338

339339
struct snd_pcm_info {
340340
unsigned int device; /* RO/WR (control): device number */
@@ -348,7 +348,7 @@ struct snd_pcm_info {
348348
int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */
349349
unsigned int subdevices_count;
350350
unsigned int subdevices_avail;
351-
union snd_pcm_sync_id sync; /* hardware synchronization ID */
351+
unsigned char pad1[16]; /* was: hardware synchronization ID */
352352
unsigned char reserved[64]; /* reserved for future... */
353353
};
354354

@@ -420,7 +420,8 @@ struct snd_pcm_hw_params {
420420
unsigned int rate_num; /* R: rate numerator */
421421
unsigned int rate_den; /* R: rate denominator */
422422
snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */
423-
unsigned char reserved[64]; /* reserved for future */
423+
unsigned char sync[16]; /* R: synchronization ID (perfect sync - one clock source) */
424+
unsigned char reserved[48]; /* reserved for future */
424425
};
425426

426427
enum {

sound/core/control.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,13 +604,16 @@ static inline int snd_ctl_remove_locked(struct snd_card *card,
604604
*
605605
* Removes the control from the card and then releases the instance.
606606
* You don't need to call snd_ctl_free_one().
607+
* Passing NULL to @kcontrol argument is allowed as noop.
607608
*
608609
* Return: 0 if successful, or a negative error code on failure.
609610
*
610611
* Note that this function takes card->controls_rwsem lock internally.
611612
*/
612613
int snd_ctl_remove(struct snd_card *card, struct snd_kcontrol *kcontrol)
613614
{
615+
if (!kcontrol)
616+
return 0;
614617
guard(rwsem_write)(&card->controls_rwsem);
615618
return snd_ctl_remove_locked(card, kcontrol);
616619
}
@@ -1480,12 +1483,16 @@ static int snd_ctl_elem_user_get(struct snd_kcontrol *kcontrol,
14801483
static int snd_ctl_elem_user_put(struct snd_kcontrol *kcontrol,
14811484
struct snd_ctl_elem_value *ucontrol)
14821485
{
1483-
int change;
1486+
int err, change;
14841487
struct user_element *ue = kcontrol->private_data;
14851488
unsigned int size = ue->elem_data_size;
14861489
char *dst = ue->elem_data +
14871490
snd_ctl_get_ioff(kcontrol, &ucontrol->id) * size;
14881491

1492+
err = sanity_check_input_values(ue->card, ucontrol, &ue->info, false);
1493+
if (err < 0)
1494+
return err;
1495+
14891496
change = memcmp(&ucontrol->value, dst, size) != 0;
14901497
if (change)
14911498
memcpy(dst, &ucontrol->value, size);

sound/core/pcm_dmaengine.c

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,8 @@ int snd_dmaengine_pcm_sync_stop(struct snd_pcm_substream *substream)
359359
}
360360
EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_sync_stop);
361361

362-
/**
363-
* snd_dmaengine_pcm_close - Close a dmaengine based PCM substream
364-
* @substream: PCM substream
365-
*
366-
* Return: 0 on success, a negative error code otherwise
367-
*/
368-
int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream)
362+
static void __snd_dmaengine_pcm_close(struct snd_pcm_substream *substream,
363+
bool release_channel)
369364
{
370365
struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream);
371366
struct dma_tx_state state;
@@ -376,8 +371,20 @@ int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream)
376371
dmaengine_terminate_async(prtd->dma_chan);
377372

378373
dmaengine_synchronize(prtd->dma_chan);
374+
if (release_channel)
375+
dma_release_channel(prtd->dma_chan);
379376
kfree(prtd);
377+
}
380378

379+
/**
380+
* snd_dmaengine_pcm_close - Close a dmaengine based PCM substream
381+
* @substream: PCM substream
382+
*
383+
* Return: 0 on success, a negative error code otherwise
384+
*/
385+
int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream)
386+
{
387+
__snd_dmaengine_pcm_close(substream, false);
381388
return 0;
382389
}
383390
EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close);
@@ -393,18 +400,7 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close);
393400
*/
394401
int snd_dmaengine_pcm_close_release_chan(struct snd_pcm_substream *substream)
395402
{
396-
struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream);
397-
struct dma_tx_state state;
398-
enum dma_status status;
399-
400-
status = dmaengine_tx_status(prtd->dma_chan, prtd->cookie, &state);
401-
if (status == DMA_PAUSED)
402-
dmaengine_terminate_async(prtd->dma_chan);
403-
404-
dmaengine_synchronize(prtd->dma_chan);
405-
dma_release_channel(prtd->dma_chan);
406-
kfree(prtd);
407-
403+
__snd_dmaengine_pcm_close(substream, true);
408404
return 0;
409405
}
410406
EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close_release_chan);

sound/core/pcm_lib.c

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -516,21 +516,38 @@ void snd_pcm_set_ops(struct snd_pcm *pcm, int direction,
516516
EXPORT_SYMBOL(snd_pcm_set_ops);
517517

518518
/**
519-
* snd_pcm_set_sync - set the PCM sync id
519+
* snd_pcm_set_sync_per_card - set the PCM sync id with card number
520520
* @substream: the pcm substream
521+
* @params: modified hardware parameters
522+
* @id: identifier (max 12 bytes)
523+
* @len: identifier length (max 12 bytes)
521524
*
522-
* Sets the PCM sync identifier for the card.
525+
* Sets the PCM sync identifier for the card with zero padding.
526+
*
527+
* User space or any user should use this 16-byte identifier for a comparison only
528+
* to check if two IDs are similar or different. Special case is the identifier
529+
* containing only zeros. Interpretation for this combination is - empty (not set).
530+
* The contents of the identifier should not be interpreted in any other way.
531+
*
532+
* The synchronization ID must be unique per clock source (usually one sound card,
533+
* but multiple soundcard may use one PCM word clock source which means that they
534+
* are fully synchronized).
535+
*
536+
* This routine composes this ID using card number in first four bytes and
537+
* 12-byte additional ID. When other ID composition is used (e.g. for multiple
538+
* sound cards), make sure that the composition does not clash with this
539+
* composition scheme.
523540
*/
524-
void snd_pcm_set_sync(struct snd_pcm_substream *substream)
541+
void snd_pcm_set_sync_per_card(struct snd_pcm_substream *substream,
542+
struct snd_pcm_hw_params *params,
543+
const unsigned char *id, unsigned int len)
525544
{
526-
struct snd_pcm_runtime *runtime = substream->runtime;
527-
528-
runtime->sync.id32[0] = substream->pcm->card->number;
529-
runtime->sync.id32[1] = -1;
530-
runtime->sync.id32[2] = -1;
531-
runtime->sync.id32[3] = -1;
545+
*(__u32 *)params->sync = cpu_to_le32(substream->pcm->card->number);
546+
len = min(12, len);
547+
memcpy(params->sync + 4, id, len);
548+
memset(params->sync + 4 + len, 0, 12 - len);
532549
}
533-
EXPORT_SYMBOL(snd_pcm_set_sync);
550+
EXPORT_SYMBOL_GPL(snd_pcm_set_sync_per_card);
534551

535552
/*
536553
* Standard ioctl routine
@@ -1810,6 +1827,18 @@ static int snd_pcm_lib_ioctl_fifo_size(struct snd_pcm_substream *substream,
18101827
return 0;
18111828
}
18121829

1830+
static int snd_pcm_lib_ioctl_sync_id(struct snd_pcm_substream *substream,
1831+
void *arg)
1832+
{
1833+
static const unsigned char id[12] = { 0xff, 0xff, 0xff, 0xff,
1834+
0xff, 0xff, 0xff, 0xff,
1835+
0xff, 0xff, 0xff, 0xff };
1836+
1837+
if (substream->runtime->std_sync_id)
1838+
snd_pcm_set_sync_per_card(substream, arg, id, sizeof(id));
1839+
return 0;
1840+
}
1841+
18131842
/**
18141843
* snd_pcm_lib_ioctl - a generic PCM ioctl callback
18151844
* @substream: the pcm substream instance
@@ -1831,6 +1860,8 @@ int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
18311860
return snd_pcm_lib_ioctl_channel_info(substream, arg);
18321861
case SNDRV_PCM_IOCTL1_FIFO_SIZE:
18331862
return snd_pcm_lib_ioctl_fifo_size(substream, arg);
1863+
case SNDRV_PCM_IOCTL1_SYNC_ID:
1864+
return snd_pcm_lib_ioctl_sync_id(substream, arg);
18341865
}
18351866
return -ENXIO;
18361867
}
@@ -2556,6 +2587,7 @@ int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream,
25562587
struct snd_kcontrol_new knew = {
25572588
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
25582589
.access = SNDRV_CTL_ELEM_ACCESS_READ |
2590+
SNDRV_CTL_ELEM_ACCESS_VOLATILE |
25592591
SNDRV_CTL_ELEM_ACCESS_TLV_READ |
25602592
SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK,
25612593
.info = pcm_chmap_ctl_info,

sound/core/pcm_native.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,12 @@ static int fixup_unreferenced_params(struct snd_pcm_substream *substream,
533533
SNDRV_PCM_INFO_MMAP_VALID);
534534
}
535535

536+
err = snd_pcm_ops_ioctl(substream,
537+
SNDRV_PCM_IOCTL1_SYNC_ID,
538+
params);
539+
if (err < 0)
540+
return err;
541+
536542
return 0;
537543
}
538544

sound/core/seq/seq_clientmgr.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,6 +1718,8 @@ static int snd_seq_ioctl_get_queue_tempo(struct snd_seq_client *client,
17181718
tempo->ppq = tmr->ppq;
17191719
tempo->skew_value = tmr->skew;
17201720
tempo->skew_base = tmr->skew_base;
1721+
if (client->user_pversion >= SNDRV_PROTOCOL_VERSION(1, 0, 4))
1722+
tempo->tempo_base = tmr->tempo_base;
17211723
queuefree(queue);
17221724

17231725
return 0;
@@ -1739,6 +1741,8 @@ static int snd_seq_ioctl_set_queue_tempo(struct snd_seq_client *client,
17391741
struct snd_seq_queue_tempo *tempo = arg;
17401742
int result;
17411743

1744+
if (client->user_pversion < SNDRV_PROTOCOL_VERSION(1, 0, 4))
1745+
tempo->tempo_base = 0;
17421746
result = snd_seq_set_queue_tempo(client->number, tempo);
17431747
return result < 0 ? result : 0;
17441748
}

0 commit comments

Comments
 (0)