Skip to content

Commit dc42c6c

Browse files
committed
Merge remote-tracking branches 'asoc/topic/tlv320aic31xx', 'asoc/topic/topology', 'asoc/topic/uda1380', 'asoc/topic/wm2200' and 'asoc/topic/wm8523' into asoc-next
6 parents da644e2 + 4e2cc81 + dd5abb7 + 222e728 + 4090d63 + f196e9a commit dc42c6c

File tree

14 files changed

+774
-244
lines changed

14 files changed

+774
-244
lines changed

Documentation/devicetree/bindings/sound/tlv320aic31xx.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Required properties:
1212
"ti,tlv320aic3120" - TLV320AIC3120 (mono speaker amp, MiniDSP)
1313
"ti,tlv320aic3111" - TLV320AIC3111 (stereo speaker amp, MiniDSP)
1414
"ti,tlv320dac3100" - TLV320DAC3100 (no ADC, mono speaker amp, no MiniDSP)
15+
"ti,tlv320dac3101" - TLV320DAC3101 (no ADC, stereo speaker amp, no MiniDSP)
1516

1617
- reg - <int> - I2C slave address
1718
- HPVDD-supply, SPRVDD-supply, SPLVDD-supply, AVDD-supply, IOVDD-supply,

include/sound/soc-dai.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616

1717
#include <linux/list.h>
18+
#include <sound/asoc.h>
1819

1920
struct snd_pcm_substream;
2021
struct snd_soc_dapm_widget;
@@ -26,13 +27,13 @@ struct snd_compr_stream;
2627
* Describes the physical PCM data formating and clocking. Add new formats
2728
* to the end.
2829
*/
29-
#define SND_SOC_DAIFMT_I2S 1 /* I2S mode */
30-
#define SND_SOC_DAIFMT_RIGHT_J 2 /* Right Justified mode */
31-
#define SND_SOC_DAIFMT_LEFT_J 3 /* Left Justified mode */
32-
#define SND_SOC_DAIFMT_DSP_A 4 /* L data MSB after FRM LRC */
33-
#define SND_SOC_DAIFMT_DSP_B 5 /* L data MSB during FRM LRC */
34-
#define SND_SOC_DAIFMT_AC97 6 /* AC97 */
35-
#define SND_SOC_DAIFMT_PDM 7 /* Pulse density modulation */
30+
#define SND_SOC_DAIFMT_I2S SND_SOC_DAI_FORMAT_I2S
31+
#define SND_SOC_DAIFMT_RIGHT_J SND_SOC_DAI_FORMAT_RIGHT_J
32+
#define SND_SOC_DAIFMT_LEFT_J SND_SOC_DAI_FORMAT_LEFT_J
33+
#define SND_SOC_DAIFMT_DSP_A SND_SOC_DAI_FORMAT_DSP_A
34+
#define SND_SOC_DAIFMT_DSP_B SND_SOC_DAI_FORMAT_DSP_B
35+
#define SND_SOC_DAIFMT_AC97 SND_SOC_DAI_FORMAT_AC97
36+
#define SND_SOC_DAIFMT_PDM SND_SOC_DAI_FORMAT_PDM
3637

3738
/* left and right justified also known as MSB and LSB respectively */
3839
#define SND_SOC_DAIFMT_MSB SND_SOC_DAIFMT_LEFT_J

include/sound/soc-topology.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct snd_soc_dobj_control {
5353

5454
/* dynamic widget object */
5555
struct snd_soc_dobj_widget {
56-
unsigned int kcontrol_enum:1; /* this widget is an enum kcontrol */
56+
unsigned int kcontrol_type; /* kcontrol type: mixer, enum, bytes */
5757
};
5858

5959
/* generic dynamic object - all dynamic objects belong to this struct */

include/sound/soc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,6 +1691,9 @@ int snd_soc_add_dai_link(struct snd_soc_card *card,
16911691
struct snd_soc_dai_link *dai_link);
16921692
void snd_soc_remove_dai_link(struct snd_soc_card *card,
16931693
struct snd_soc_dai_link *dai_link);
1694+
struct snd_soc_dai_link *snd_soc_find_dai_link(struct snd_soc_card *card,
1695+
int id, const char *name,
1696+
const char *stream_name);
16941697

16951698
int snd_soc_register_dai(struct snd_soc_component *component,
16961699
struct snd_soc_dai_driver *dai_drv);

include/uapi/sound/asoc.h

Lines changed: 79 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
*/
3434
#define SND_SOC_TPLG_STREAM_CONFIG_MAX 8
3535

36+
/*
37+
* Maximum number of physical link's hardware configs
38+
*/
39+
#define SND_SOC_TPLG_HW_CONFIG_MAX 8
40+
3641
/* individual kcontrol info types - can be mixed with other types */
3742
#define SND_SOC_TPLG_CTL_VOLSW 1
3843
#define SND_SOC_TPLG_CTL_VOLSW_SX 2
@@ -77,7 +82,8 @@
7782
#define SND_SOC_TPLG_NUM_TEXTS 16
7883

7984
/* ABI version */
80-
#define SND_SOC_TPLG_ABI_VERSION 0x5
85+
#define SND_SOC_TPLG_ABI_VERSION 0x5 /* current version */
86+
#define SND_SOC_TPLG_ABI_VERSION_MIN 0x4 /* oldest version supported */
8187

8288
/* Max size of TLV data */
8389
#define SND_SOC_TPLG_TLV_SIZE 32
@@ -99,8 +105,8 @@
99105
#define SND_SOC_TPLG_TYPE_CODEC_LINK 9
100106
#define SND_SOC_TPLG_TYPE_BACKEND_LINK 10
101107
#define SND_SOC_TPLG_TYPE_PDATA 11
102-
#define SND_SOC_TPLG_TYPE_BE_DAI 12
103-
#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_BE_DAI
108+
#define SND_SOC_TPLG_TYPE_DAI 12
109+
#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI
104110

105111
/* vendor block IDs - please add new vendor types to end */
106112
#define SND_SOC_TPLG_TYPE_VENDOR_FW 1000
@@ -119,11 +125,32 @@
119125
#define SND_SOC_TPLG_TUPLE_TYPE_WORD 4
120126
#define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5
121127

122-
/* BE DAI flags */
128+
/* DAI flags */
123129
#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES (1 << 0)
124130
#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
125131
#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
126132

133+
/* DAI physical PCM data formats.
134+
* Add new formats to the end of the list.
135+
*/
136+
#define SND_SOC_DAI_FORMAT_I2S 1 /* I2S mode */
137+
#define SND_SOC_DAI_FORMAT_RIGHT_J 2 /* Right Justified mode */
138+
#define SND_SOC_DAI_FORMAT_LEFT_J 3 /* Left Justified mode */
139+
#define SND_SOC_DAI_FORMAT_DSP_A 4 /* L data MSB after FRM LRC */
140+
#define SND_SOC_DAI_FORMAT_DSP_B 5 /* L data MSB during FRM LRC */
141+
#define SND_SOC_DAI_FORMAT_AC97 6 /* AC97 */
142+
#define SND_SOC_DAI_FORMAT_PDM 7 /* Pulse density modulation */
143+
144+
/* left and right justified also known as MSB and LSB respectively */
145+
#define SND_SOC_DAI_FORMAT_MSB SND_SOC_DAI_FORMAT_LEFT_J
146+
#define SND_SOC_DAI_FORMAT_LSB SND_SOC_DAI_FORMAT_RIGHT_J
147+
148+
/* DAI link flags */
149+
#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0)
150+
#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
151+
#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
152+
#define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3)
153+
127154
/*
128155
* Block Header.
129156
* This header precedes all object and object arrays below.
@@ -267,6 +294,35 @@ struct snd_soc_tplg_stream {
267294
__le32 channels; /* channels */
268295
} __attribute__((packed));
269296

297+
298+
/*
299+
* Describes a physical link's runtime supported hardware config,
300+
* i.e. hardware audio formats.
301+
*/
302+
struct snd_soc_tplg_hw_config {
303+
__le32 size; /* in bytes of this structure */
304+
__le32 id; /* unique ID - - used to match */
305+
__le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */
306+
__u8 clock_gated; /* 1 if clock can be gated to save power */
307+
__u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */
308+
__u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */
309+
__u8 bclk_master; /* 1 for master of BCLK, 0 for slave */
310+
__u8 fsync_master; /* 1 for master of FSYNC, 0 for slave */
311+
__u8 mclk_direction; /* 0 for input, 1 for output */
312+
__le16 reserved; /* for 32bit alignment */
313+
__le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */
314+
__le32 bclk_rate; /* BCLK freqency in Hz */
315+
__le32 fsync_rate; /* frame clock in Hz */
316+
__le32 tdm_slots; /* number of TDM slots in use */
317+
__le32 tdm_slot_width; /* width in bits for each slot */
318+
__le32 tx_slots; /* bit mask for active Tx slots */
319+
__le32 rx_slots; /* bit mask for active Rx slots */
320+
__le32 tx_channels; /* number of Tx channels */
321+
__le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
322+
__le32 rx_channels; /* number of Rx channels */
323+
__le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
324+
} __attribute__((packed));
325+
270326
/*
271327
* Manifest. List totals for each payload type. Not used in parsing, but will
272328
* be passed to the component driver before any other objects in order for any
@@ -286,7 +342,7 @@ struct snd_soc_tplg_manifest {
286342
__le32 graph_elems; /* number of graph elements */
287343
__le32 pcm_elems; /* number of PCM elements */
288344
__le32 dai_link_elems; /* number of DAI link elements */
289-
__le32 be_dai_elems; /* number of BE DAI elements */
345+
__le32 dai_elems; /* number of physical DAI elements */
290346
__le32 reserved[20]; /* reserved for new ABI element types */
291347
struct snd_soc_tplg_private priv;
292348
} __attribute__((packed));
@@ -434,13 +490,16 @@ struct snd_soc_tplg_pcm {
434490
struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */
435491
__le32 num_streams; /* number of streams */
436492
struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
493+
__le32 flag_mask; /* bitmask of flags to configure */
494+
__le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
495+
struct snd_soc_tplg_private priv;
437496
} __attribute__((packed));
438497

439498

440499
/*
441-
* Describes the BE or CC link runtime supported configs or params
500+
* Describes the physical link runtime supported configs or params
442501
*
443-
* File block representation for BE/CC link config :-
502+
* File block representation for physical link config :-
444503
* +-----------------------------------+-----+
445504
* | struct snd_soc_tplg_hdr | 1 |
446505
* +-----------------------------------+-----+
@@ -450,21 +509,30 @@ struct snd_soc_tplg_pcm {
450509
struct snd_soc_tplg_link_config {
451510
__le32 size; /* in bytes of this structure */
452511
__le32 id; /* unique ID - used to match */
512+
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
513+
char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */
453514
struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */
454515
__le32 num_streams; /* number of streams */
516+
struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */
517+
__le32 num_hw_configs; /* number of hw configs */
518+
__le32 default_hw_config_id; /* default hw config ID for init */
519+
__le32 flag_mask; /* bitmask of flags to configure */
520+
__le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
521+
struct snd_soc_tplg_private priv;
455522
} __attribute__((packed));
456523

457524
/*
458-
* Describes SW/FW specific features of BE DAI.
525+
* Describes SW/FW specific features of physical DAI.
526+
* It can be used to configure backend DAIs for DPCM.
459527
*
460-
* File block representation for BE DAI :-
528+
* File block representation for physical DAI :-
461529
* +-----------------------------------+-----+
462530
* | struct snd_soc_tplg_hdr | 1 |
463531
* +-----------------------------------+-----+
464-
* | struct snd_soc_tplg_be_dai | N |
532+
* | struct snd_soc_tplg_dai | N |
465533
* +-----------------------------------+-----+
466534
*/
467-
struct snd_soc_tplg_be_dai {
535+
struct snd_soc_tplg_dai {
468536
__le32 size; /* in bytes of this structure */
469537
char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
470538
__le32 dai_id; /* unique ID - used to match */

sound/soc/codecs/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,7 @@ config SND_SOC_UDA134X
897897

898898
config SND_SOC_UDA1380
899899
tristate
900+
depends on I2C
900901

901902
config SND_SOC_WL1273
902903
tristate

sound/soc/codecs/tlv320aic31xx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,6 +1253,8 @@ static const struct of_device_id tlv320aic31xx_of_match[] = {
12531253
{ .compatible = "ti,tlv320aic3110" },
12541254
{ .compatible = "ti,tlv320aic3120" },
12551255
{ .compatible = "ti,tlv320aic3111" },
1256+
{ .compatible = "ti,tlv320dac3100" },
1257+
{ .compatible = "ti,tlv320dac3101" },
12561258
{},
12571259
};
12581260
MODULE_DEVICE_TABLE(of, tlv320aic31xx_of_match);
@@ -1379,6 +1381,7 @@ static const struct i2c_device_id aic31xx_i2c_id[] = {
13791381
{ "tlv320aic3120", AIC3120 },
13801382
{ "tlv320aic3111", AIC3111 },
13811383
{ "tlv320dac3100", DAC3100 },
1384+
{ "tlv320dac3101", DAC3101 },
13821385
{ }
13831386
};
13841387
MODULE_DEVICE_TABLE(i2c, aic31xx_i2c_id);

sound/soc/codecs/tlv320aic31xx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ enum aic31xx_type {
3232
AIC3120 = AIC31XX_MINIDSP_BIT,
3333
AIC3111 = (AIC31XX_STEREO_CLASS_D_BIT | AIC31XX_MINIDSP_BIT),
3434
DAC3100 = DAC31XX_BIT,
35+
DAC3101 = DAC31XX_BIT | AIC31XX_STEREO_CLASS_D_BIT,
3536
};
3637

3738
struct aic31xx_pdata {

sound/soc/codecs/uda1380.c

Lines changed: 21 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -698,25 +698,10 @@ static int uda1380_probe(struct snd_soc_codec *codec)
698698
codec->hw_write = (hw_write_t)i2c_master_send;
699699
codec->control_data = uda1380->control_data;
700700

701-
if (!pdata)
702-
return -EINVAL;
703-
704-
if (gpio_is_valid(pdata->gpio_reset)) {
705-
ret = gpio_request_one(pdata->gpio_reset, GPIOF_OUT_INIT_LOW,
706-
"uda1380 reset");
707-
if (ret)
708-
goto err_out;
709-
}
710-
711-
if (gpio_is_valid(pdata->gpio_power)) {
712-
ret = gpio_request_one(pdata->gpio_power, GPIOF_OUT_INIT_LOW,
713-
"uda1380 power");
714-
if (ret)
715-
goto err_free_gpio;
716-
} else {
701+
if (!gpio_is_valid(pdata->gpio_power)) {
717702
ret = uda1380_reset(codec);
718703
if (ret)
719-
goto err_free_gpio;
704+
return ret;
720705
}
721706

722707
INIT_WORK(&uda1380->work, uda1380_flush_work);
@@ -732,29 +717,11 @@ static int uda1380_probe(struct snd_soc_codec *codec)
732717
break;
733718
}
734719

735-
return 0;
736-
737-
err_free_gpio:
738-
if (gpio_is_valid(pdata->gpio_reset))
739-
gpio_free(pdata->gpio_reset);
740-
err_out:
741-
return ret;
742-
}
743-
744-
/* power down chip */
745-
static int uda1380_remove(struct snd_soc_codec *codec)
746-
{
747-
struct uda1380_platform_data *pdata =codec->dev->platform_data;
748-
749-
gpio_free(pdata->gpio_reset);
750-
gpio_free(pdata->gpio_power);
751-
752720
return 0;
753721
}
754722

755723
static struct snd_soc_codec_driver soc_codec_dev_uda1380 = {
756724
.probe = uda1380_probe,
757-
.remove = uda1380_remove,
758725
.read = uda1380_read_reg_cache,
759726
.write = uda1380_write,
760727
.set_bias_level = uda1380_set_bias_level,
@@ -775,18 +742,35 @@ static struct snd_soc_codec_driver soc_codec_dev_uda1380 = {
775742
},
776743
};
777744

778-
#if IS_ENABLED(CONFIG_I2C)
779745
static int uda1380_i2c_probe(struct i2c_client *i2c,
780746
const struct i2c_device_id *id)
781747
{
748+
struct uda1380_platform_data *pdata = i2c->dev.platform_data;
782749
struct uda1380_priv *uda1380;
783750
int ret;
784751

752+
if (!pdata)
753+
return -EINVAL;
754+
785755
uda1380 = devm_kzalloc(&i2c->dev, sizeof(struct uda1380_priv),
786756
GFP_KERNEL);
787757
if (uda1380 == NULL)
788758
return -ENOMEM;
789759

760+
if (gpio_is_valid(pdata->gpio_reset)) {
761+
ret = devm_gpio_request_one(&i2c->dev, pdata->gpio_reset,
762+
GPIOF_OUT_INIT_LOW, "uda1380 reset");
763+
if (ret)
764+
return ret;
765+
}
766+
767+
if (gpio_is_valid(pdata->gpio_power)) {
768+
ret = devm_gpio_request_one(&i2c->dev, pdata->gpio_power,
769+
GPIOF_OUT_INIT_LOW, "uda1380 power");
770+
if (ret)
771+
return ret;
772+
}
773+
790774
i2c_set_clientdata(i2c, uda1380);
791775
uda1380->control_data = i2c;
792776

@@ -815,27 +799,8 @@ static struct i2c_driver uda1380_i2c_driver = {
815799
.remove = uda1380_i2c_remove,
816800
.id_table = uda1380_i2c_id,
817801
};
818-
#endif
819802

820-
static int __init uda1380_modinit(void)
821-
{
822-
int ret = 0;
823-
#if IS_ENABLED(CONFIG_I2C)
824-
ret = i2c_add_driver(&uda1380_i2c_driver);
825-
if (ret != 0)
826-
pr_err("Failed to register UDA1380 I2C driver: %d\n", ret);
827-
#endif
828-
return ret;
829-
}
830-
module_init(uda1380_modinit);
831-
832-
static void __exit uda1380_exit(void)
833-
{
834-
#if IS_ENABLED(CONFIG_I2C)
835-
i2c_del_driver(&uda1380_i2c_driver);
836-
#endif
837-
}
838-
module_exit(uda1380_exit);
803+
module_i2c_driver(uda1380_i2c_driver);
839804

840805
MODULE_AUTHOR("Giorgio Padrin");
841806
MODULE_DESCRIPTION("Audio support for codec Philips UDA1380");

sound/soc/codecs/uda1380.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,4 @@
7272
#define R22_SKIP_DCFIL 0x0002
7373
#define R23_AGC_EN 0x0001
7474

75-
#define UDA1380_DAI_DUPLEX 0 /* playback and capture on single DAI */
76-
#define UDA1380_DAI_PLAYBACK 1 /* playback DAI */
77-
#define UDA1380_DAI_CAPTURE 2 /* capture DAI */
78-
7975
#endif /* _UDA1380_H */

0 commit comments

Comments
 (0)