History

Merge branch 'asoc-5.4' into asoc-next

Mark Brown committed 7 years ago

Commit bb831782 parents 6652ddb 6fa5963272 files · +12110 −6853Browse files

Showing the changes to include (15 of 272 files). Show all

Unified · Split

15 files
  1. include/sound/hdaudio.h +31 −38
  2. include/sound/hdaudio_ext.h +0 −1
  3. include/sound/hdmi-codec.h +17 −0
  4. include/sound/intel-nhlt.h +150 −0
  5. include/sound/pcm.h +5 −0
  6. include/sound/soc-acpi-intel-match.h +2 −0
  7. include/sound/soc-component.h +387 −0
  8. include/sound/soc-dai.h +26 −2
  9. include/sound/soc-dapm.h +5 −6
  10. include/sound/soc-dpcm.h +8 −1
  11. include/sound/soc.h +20 −328
  12. include/sound/sof/dai-intel.h +12 −0
  13. include/sound/sof/dai.h +4 −1
  14. include/uapi/sound/sof/abi.h +1 −1
  15. include/uapi/sound/sof/tokens.h +9 −0
include/sound/hdaudio.h+31−38
@@ -253,24 +253,6 @@ struct hdac_ext_bus_ops { · 252 unmodified lines
253253 int (*hdev_detach)(struct hdac_device *hdev);
254254 };
255255
256−/*
257− * Lowlevel I/O operators
258− */
259−struct hdac_io_ops {
260− /* mapped register accesses */
261− void (*reg_writel)(u32 value, u32 __iomem *addr);
262− u32 (*reg_readl)(u32 __iomem *addr);
263− void (*reg_writew)(u16 value, u16 __iomem *addr);
264− u16 (*reg_readw)(u16 __iomem *addr);
265− void (*reg_writeb)(u8 value, u8 __iomem *addr);
266− u8 (*reg_readb)(u8 __iomem *addr);
267− /* Allocation ops */
268− int (*dma_alloc_pages)(struct hdac_bus *bus, int type, size_t size,
269− struct snd_dma_buffer *buf);
270− void (*dma_free_pages)(struct hdac_bus *bus,
271− struct snd_dma_buffer *buf);
272−};
273−
274256 #define HDA_UNSOL_QUEUE_SIZE 64
275257 #define HDA_MAX_CODECS 8 /* limit by controller side */
276258
@@ -304,7 +286,6 @@ struct hdac_rb { · 27 unmodified lines
304286 struct hdac_bus {
305287 struct device *dev;
306288 const struct hdac_bus_ops *ops;
307− const struct hdac_io_ops *io_ops;
308289 const struct hdac_ext_bus_ops *ext_ops;
309290
310291 /* h/w resources */
@@ -344,6 +325,7 @@ struct hdac_bus { · 33 unmodified lines
344325 /* CORB/RIRB and position buffers */
345326 struct snd_dma_buffer rb;
346327 struct snd_dma_buffer posbuf;
328+ int dma_type; /* SNDRV_DMA_TYPE_XXX for CORB/RIRB */
347329
348330 /* hdac_stream linked list */
349331 struct list_head stream_list;
@@ -384,8 +366,7 @@ struct hdac_bus { · 34 unmodified lines
384366 };
385367
386368 int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,
387− const struct hdac_bus_ops *ops,
388− const struct hdac_io_ops *io_ops);
369+ const struct hdac_bus_ops *ops);
389370 void snd_hdac_bus_exit(struct hdac_bus *bus);
390371 int snd_hdac_bus_exec_verb(struct hdac_bus *bus, unsigned int addr,
391372 unsigned int cmd, unsigned int *res);
@@ -429,21 +410,38 @@ int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status, · 37 unmodified lines
429410 int snd_hdac_bus_alloc_stream_pages(struct hdac_bus *bus);
430411 void snd_hdac_bus_free_stream_pages(struct hdac_bus *bus);
431412
413+#ifdef CONFIG_SND_HDA_ALIGNED_MMIO
414+unsigned int snd_hdac_aligned_read(void __iomem *addr, unsigned int mask);
415+void snd_hdac_aligned_write(unsigned int val, void __iomem *addr,
416+ unsigned int mask);
417+#define snd_hdac_reg_writeb(v, addr) snd_hdac_aligned_write(v, addr, 0xff)
418+#define snd_hdac_reg_writew(v, addr) snd_hdac_aligned_write(v, addr, 0xffff)
419+#define snd_hdac_reg_readb(addr) snd_hdac_aligned_read(addr, 0xff)
420+#define snd_hdac_reg_readw(addr) snd_hdac_aligned_read(addr, 0xffff)
421+#else /* CONFIG_SND_HDA_ALIGNED_MMIO */
422+#define snd_hdac_reg_writeb(val, addr) writeb(val, addr)
423+#define snd_hdac_reg_writew(val, addr) writew(val, addr)
424+#define snd_hdac_reg_readb(addr) readb(addr)
425+#define snd_hdac_reg_readw(addr) readw(addr)
426+#endif /* CONFIG_SND_HDA_ALIGNED_MMIO */
427+#define snd_hdac_reg_writel(val, addr) writel(val, addr)
428+#define snd_hdac_reg_readl(addr) readl(addr)
429+
432430 /*
433431 * macros for easy use
434432 */
435433 #define _snd_hdac_chip_writeb(chip, reg, value) \
436− ((chip)->io_ops->reg_writeb(value, (chip)->remap_addr + (reg)))
434+ snd_hdac_reg_writeb(value, (chip)->remap_addr + (reg))
437435 #define _snd_hdac_chip_readb(chip, reg) \
438− ((chip)->io_ops->reg_readb((chip)->remap_addr + (reg)))
436+ snd_hdac_reg_readb((chip)->remap_addr + (reg))
439437 #define _snd_hdac_chip_writew(chip, reg, value) \
440− ((chip)->io_ops->reg_writew(value, (chip)->remap_addr + (reg)))
438+ snd_hdac_reg_writew(value, (chip)->remap_addr + (reg))
441439 #define _snd_hdac_chip_readw(chip, reg) \
442− ((chip)->io_ops->reg_readw((chip)->remap_addr + (reg)))
440+ snd_hdac_reg_readw((chip)->remap_addr + (reg))
443441 #define _snd_hdac_chip_writel(chip, reg, value) \
444− ((chip)->io_ops->reg_writel(value, (chip)->remap_addr + (reg)))
442+ snd_hdac_reg_writel(value, (chip)->remap_addr + (reg))
445443 #define _snd_hdac_chip_readl(chip, reg) \
446− ((chip)->io_ops->reg_readl((chip)->remap_addr + (reg)))
444+ snd_hdac_reg_readl((chip)->remap_addr + (reg))
447445
448446 /* read/write a register, pass without AZX_REG_ prefix */
449447 #define snd_hdac_chip_writel(chip, reg, value) \
@@ -548,24 +546,19 @@ int snd_hdac_get_stream_stripe_ctl(struct hdac_bus *bus, · 98 unmodified lines
548546 /*
549547 * macros for easy use
550548 */
551−#define _snd_hdac_stream_write(type, dev, reg, value) \
552− ((dev)->bus->io_ops->reg_write ## type(value, (dev)->sd_addr + (reg)))
553−#define _snd_hdac_stream_read(type, dev, reg) \
554− ((dev)->bus->io_ops->reg_read ## type((dev)->sd_addr + (reg)))
555−
556549 /* read/write a register, pass without AZX_REG_ prefix */
557550 #define snd_hdac_stream_writel(dev, reg, value) \
558− _snd_hdac_stream_write(l, dev, AZX_REG_ ## reg, value)
551+ snd_hdac_reg_writel(value, (dev)->sd_addr + AZX_REG_ ## reg)
559552 #define snd_hdac_stream_writew(dev, reg, value) \
560− _snd_hdac_stream_write(w, dev, AZX_REG_ ## reg, value)
553+ snd_hdac_reg_writew(value, (dev)->sd_addr + AZX_REG_ ## reg)
561554 #define snd_hdac_stream_writeb(dev, reg, value) \
562− _snd_hdac_stream_write(b, dev, AZX_REG_ ## reg, value)
555+ snd_hdac_reg_writeb(value, (dev)->sd_addr + AZX_REG_ ## reg)
563556 #define snd_hdac_stream_readl(dev, reg) \
564− _snd_hdac_stream_read(l, dev, AZX_REG_ ## reg)
557+ snd_hdac_reg_readl((dev)->sd_addr + AZX_REG_ ## reg)
565558 #define snd_hdac_stream_readw(dev, reg) \
566− _snd_hdac_stream_read(w, dev, AZX_REG_ ## reg)
559+ snd_hdac_reg_readw((dev)->sd_addr + AZX_REG_ ## reg)
567560 #define snd_hdac_stream_readb(dev, reg) \
568− _snd_hdac_stream_read(b, dev, AZX_REG_ ## reg)
561+ snd_hdac_reg_readb((dev)->sd_addr + AZX_REG_ ## reg)
569562
570563 /* update a register, pass without AZX_REG_ prefix */
571564 #define snd_hdac_stream_updatel(dev, reg, mask, val) \
include/sound/hdaudio_ext.h+0−1
@@ -6,7 +6,6 @@ · 5 unmodified lines
66
77 int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
88 const struct hdac_bus_ops *ops,
9− const struct hdac_io_ops *io_ops,
109 const struct hdac_ext_bus_ops *ext_ops);
1110
1211 void snd_hdac_ext_bus_exit(struct hdac_bus *bus);
include/sound/hdmi-codec.h+17−0
@@ -47,6 +47,9 @@ struct hdmi_codec_params { · 46 unmodified lines
4747 int channels;
4848 };
4949
50+typedef void (*hdmi_codec_plugged_cb)(struct device *dev,
51+ bool plugged);
52+
5053 struct hdmi_codec_pdata;
5154 struct hdmi_codec_ops {
5255 /*
@@ -88,6 +91,14 @@ struct hdmi_codec_ops { · 35 unmodified lines
8891 */
8992 int (*get_dai_id)(struct snd_soc_component *comment,
9093 struct device_node *endpoint);
94+
95+ /*
96+ * Hook callback function to handle connector plug event.
97+ * Optional
98+ */
99+ int (*hook_plugged_cb)(struct device *dev, void *data,
100+ hdmi_codec_plugged_cb fn,
101+ struct device *codec_dev);
91102 };
92103
93104 /* HDMI codec initalization data */
@@ -99,6 +110,12 @@ struct hdmi_codec_pdata { · 5 unmodified lines
99110 void *data;
100111 };
101112
113+struct snd_soc_component;
114+struct snd_soc_jack;
115+
116+int hdmi_codec_set_jack_detect(struct snd_soc_component *component,
117+ struct snd_soc_jack *jack);
118+
102119 #define HDMI_CODEC_DRV_NAME "hdmi-audio-codec"
103120
104121 #endif /* __HDMI_CODEC_H__ */
include/sound/intel-nhlt.h+150−0
@@ -0,0 +1,150 @@
1+/* SPDX-License-Identifier: GPL-2.0-only */
2+/*
3+ * intel-nhlt.h - Intel HDA Platform NHLT header
4+ *
5+ * Copyright (c) 2015-2019 Intel Corporation
6+ */
7+
8+#ifndef __INTEL_NHLT_H__
9+#define __INTEL_NHLT_H__
10+
11+#include <linux/acpi.h>
12+
13+#if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_INTEL_NHLT)
14+
15+struct wav_fmt {
16+ u16 fmt_tag;
17+ u16 channels;
18+ u32 samples_per_sec;
19+ u32 avg_bytes_per_sec;
20+ u16 block_align;
21+ u16 bits_per_sample;
22+ u16 cb_size;
23+} __packed;
24+
25+struct wav_fmt_ext {
26+ struct wav_fmt fmt;
27+ union samples {
28+ u16 valid_bits_per_sample;
29+ u16 samples_per_block;
30+ u16 reserved;
31+ } sample;
32+ u32 channel_mask;
33+ u8 sub_fmt[16];
34+} __packed;
35+
36+enum nhlt_link_type {
37+ NHLT_LINK_HDA = 0,
38+ NHLT_LINK_DSP = 1,
39+ NHLT_LINK_DMIC = 2,
40+ NHLT_LINK_SSP = 3,
41+ NHLT_LINK_INVALID
42+};
43+
44+enum nhlt_device_type {
45+ NHLT_DEVICE_BT = 0,
46+ NHLT_DEVICE_DMIC = 1,
47+ NHLT_DEVICE_I2S = 4,
48+ NHLT_DEVICE_INVALID
49+};
50+
51+struct nhlt_specific_cfg {
52+ u32 size;
53+ u8 caps[0];
54+} __packed;
55+
56+struct nhlt_fmt_cfg {
57+ struct wav_fmt_ext fmt_ext;
58+ struct nhlt_specific_cfg config;
59+} __packed;
60+
61+struct nhlt_fmt {
62+ u8 fmt_count;
63+ struct nhlt_fmt_cfg fmt_config[0];
64+} __packed;
65+
66+struct nhlt_endpoint {
67+ u32 length;
68+ u8 linktype;
69+ u8 instance_id;
70+ u16 vendor_id;
71+ u16 device_id;
72+ u16 revision_id;
73+ u32 subsystem_id;
74+ u8 device_type;
75+ u8 direction;
76+ u8 virtual_bus_id;
77+ struct nhlt_specific_cfg config;
78+} __packed;
79+
80+struct nhlt_acpi_table {
81+ struct acpi_table_header header;
82+ u8 endpoint_count;
83+ struct nhlt_endpoint desc[0];
84+} __packed;
85+
86+struct nhlt_resource_desc {
87+ u32 extra;
88+ u16 flags;
89+ u64 addr_spc_gra;
90+ u64 min_addr;
91+ u64 max_addr;
92+ u64 addr_trans_offset;
93+ u64 length;
94+} __packed;
95+
96+#define MIC_ARRAY_2CH 2
97+#define MIC_ARRAY_4CH 4
98+
99+struct nhlt_device_specific_config {
100+ u8 virtual_slot;
101+ u8 config_type;
102+} __packed;
103+
104+struct nhlt_dmic_array_config {
105+ struct nhlt_device_specific_config device_config;
106+ u8 array_type;
107+} __packed;
108+
109+struct nhlt_vendor_dmic_array_config {
110+ struct nhlt_dmic_array_config dmic_config;
111+ u8 nb_mics;
112+ /* TODO add vendor mic config */
113+} __packed;
114+
115+enum {
116+ NHLT_MIC_ARRAY_2CH_SMALL = 0xa,
117+ NHLT_MIC_ARRAY_2CH_BIG = 0xb,
118+ NHLT_MIC_ARRAY_4CH_1ST_GEOM = 0xc,
119+ NHLT_MIC_ARRAY_4CH_L_SHAPED = 0xd,
120+ NHLT_MIC_ARRAY_4CH_2ND_GEOM = 0xe,
121+ NHLT_MIC_ARRAY_VENDOR_DEFINED = 0xf,
122+};
123+
124+struct nhlt_acpi_table *intel_nhlt_init(struct device *dev);
125+
126+void intel_nhlt_free(struct nhlt_acpi_table *addr);
127+
128+int intel_nhlt_get_dmic_geo(struct device *dev, struct nhlt_acpi_table *nhlt);
129+
130+#else
131+
132+struct nhlt_acpi_table;
133+
134+static inline struct nhlt_acpi_table *intel_nhlt_init(struct device *dev)
135+{
136+ return NULL;
137+}
138+
139+static inline void intel_nhlt_free(struct nhlt_acpi_table *addr)
140+{
141+}
142+
143+static inline int intel_nhlt_get_dmic_geo(struct device *dev,
144+ struct nhlt_acpi_table *nhlt)
145+{
146+ return 0;
147+}
148+#endif
149+
150+#endif
include/sound/pcm.h+5−0
@@ -117,6 +117,8 @@ struct snd_pcm_ops { · 116 unmodified lines
117117 #define SNDRV_PCM_RATE_96000 (1<<10) /* 96000Hz */
118118 #define SNDRV_PCM_RATE_176400 (1<<11) /* 176400Hz */
119119 #define SNDRV_PCM_RATE_192000 (1<<12) /* 192000Hz */
120+#define SNDRV_PCM_RATE_352800 (1<<13) /* 352800Hz */
121+#define SNDRV_PCM_RATE_384000 (1<<14) /* 384000Hz */
120122
121123 #define SNDRV_PCM_RATE_CONTINUOUS (1<<30) /* continuous range */
122124 #define SNDRV_PCM_RATE_KNOT (1<<31) /* supports more non-continuos rates */
@@ -129,6 +131,9 @@ struct snd_pcm_ops { · 6 unmodified lines
129131 SNDRV_PCM_RATE_88200|SNDRV_PCM_RATE_96000)
130132 #define SNDRV_PCM_RATE_8000_192000 (SNDRV_PCM_RATE_8000_96000|SNDRV_PCM_RATE_176400|\
131133 SNDRV_PCM_RATE_192000)
134+#define SNDRV_PCM_RATE_8000_384000 (SNDRV_PCM_RATE_8000_192000|\
135+ SNDRV_PCM_RATE_352800|\
136+ SNDRV_PCM_RATE_384000)
132137 #define _SNDRV_PCM_FMTBIT(fmt) (1ULL << (__force int)SNDRV_PCM_FORMAT_##fmt)
133138 #define SNDRV_PCM_FMTBIT_S8 _SNDRV_PCM_FMTBIT(S8)
134139 #define SNDRV_PCM_FMTBIT_U8 _SNDRV_PCM_FMTBIT(U8)
include/sound/soc-acpi-intel-match.h+2−0
@@ -25,6 +25,8 @@ extern struct snd_soc_acpi_mach snd_soc_acpi_intel_bxt_machines[]; · 24 unmodified lines
2525 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_glk_machines[];
2626 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[];
2727 extern struct snd_soc_acpi_mach snd_soc_acpi_intel_icl_machines[];
28+extern struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_machines[];
29+extern struct snd_soc_acpi_mach snd_soc_acpi_intel_ehl_machines[];
2830
2931 /*
3032 * generic table used for HDA codec-based platforms, possibly with
include/sound/soc-component.h+387−0
@@ -0,0 +1,387 @@
1+/* SPDX-License-Identifier: GPL-2.0
2+ *
3+ * soc-component.h
4+ *
5+ * Copyright (c) 2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6+ *
7+ * This program is free software; you can redistribute it and/or modify
8+ * it under the terms of the GNU General Public License version 2 as
9+ * published by the Free Software Foundation.
10+ */
11+#ifndef __SOC_COMPONENT_H
12+#define __SOC_COMPONENT_H
13+
14+#include <sound/soc.h>
15+
16+/*
17+ * Component probe and remove ordering levels for components with runtime
18+ * dependencies.
19+ */
20+#define SND_SOC_COMP_ORDER_FIRST -2
21+#define SND_SOC_COMP_ORDER_EARLY -1
22+#define SND_SOC_COMP_ORDER_NORMAL 0
23+#define SND_SOC_COMP_ORDER_LATE 1
24+#define SND_SOC_COMP_ORDER_LAST 2
25+
26+#define for_each_comp_order(order) \
27+ for (order = SND_SOC_COMP_ORDER_FIRST; \
28+ order <= SND_SOC_COMP_ORDER_LAST; \
29+ order++)
30+
31+/* component interface */
32+struct snd_soc_component_driver {
33+ const char *name;
34+
35+ /* Default control and setup, added after probe() is run */
36+ const struct snd_kcontrol_new *controls;
37+ unsigned int num_controls;
38+ const struct snd_soc_dapm_widget *dapm_widgets;
39+ unsigned int num_dapm_widgets;
40+ const struct snd_soc_dapm_route *dapm_routes;
41+ unsigned int num_dapm_routes;
42+
43+ int (*probe)(struct snd_soc_component *component);
44+ void (*remove)(struct snd_soc_component *component);
45+ int (*suspend)(struct snd_soc_component *component);
46+ int (*resume)(struct snd_soc_component *component);
47+
48+ unsigned int (*read)(struct snd_soc_component *component,
49+ unsigned int reg);
50+ int (*write)(struct snd_soc_component *component,
51+ unsigned int reg, unsigned int val);
52+
53+ /* pcm creation and destruction */
54+ int (*pcm_new)(struct snd_soc_pcm_runtime *rtd);
55+ void (*pcm_free)(struct snd_pcm *pcm);
56+
57+ /* component wide operations */
58+ int (*set_sysclk)(struct snd_soc_component *component,
59+ int clk_id, int source, unsigned int freq, int dir);
60+ int (*set_pll)(struct snd_soc_component *component, int pll_id,
61+ int source, unsigned int freq_in, unsigned int freq_out);
62+ int (*set_jack)(struct snd_soc_component *component,
63+ struct snd_soc_jack *jack, void *data);
64+
65+ /* DT */
66+ int (*of_xlate_dai_name)(struct snd_soc_component *component,
67+ struct of_phandle_args *args,
68+ const char **dai_name);
69+ int (*of_xlate_dai_id)(struct snd_soc_component *comment,
70+ struct device_node *endpoint);
71+ void (*seq_notifier)(struct snd_soc_component *component,
72+ enum snd_soc_dapm_type type, int subseq);
73+ int (*stream_event)(struct snd_soc_component *component, int event);
74+ int (*set_bias_level)(struct snd_soc_component *component,
75+ enum snd_soc_bias_level level);
76+
77+ const struct snd_pcm_ops *ops;
78+ const struct snd_compr_ops *compr_ops;
79+
80+ /* probe ordering - for components with runtime dependencies */
81+ int probe_order;
82+ int remove_order;
83+
84+ /*
85+ * signal if the module handling the component should not be removed
86+ * if a pcm is open. Setting this would prevent the module
87+ * refcount being incremented in probe() but allow it be incremented
88+ * when a pcm is opened and decremented when it is closed.
89+ */
90+ unsigned int module_get_upon_open:1;
91+
92+ /* bits */
93+ unsigned int idle_bias_on:1;
94+ unsigned int suspend_bias_off:1;
95+ unsigned int use_pmdown_time:1; /* care pmdown_time at stop */
96+ unsigned int endianness:1;
97+ unsigned int non_legacy_dai_naming:1;
98+
99+ /* this component uses topology and ignore machine driver FEs */
100+ const char *ignore_machine;
101+ const char *topology_name_prefix;
102+ int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd,
103+ struct snd_pcm_hw_params *params);
104+ bool use_dai_pcm_id; /* use DAI link PCM ID as PCM device number */
105+ int be_pcm_base; /* base device ID for all BE PCMs */
106+};
107+
108+struct snd_soc_component {
109+ const char *name;
110+ int id;
111+ const char *name_prefix;
112+ struct device *dev;
113+ struct snd_soc_card *card;
114+
115+ unsigned int active;
116+
117+ unsigned int suspended:1; /* is in suspend PM state */
118+
119+ struct list_head list;
120+ struct list_head card_aux_list; /* for auxiliary bound components */
121+ struct list_head card_list;
122+
123+ const struct snd_soc_component_driver *driver;
124+
125+ struct list_head dai_list;
126+ int num_dai;
127+
128+ struct regmap *regmap;
129+ int val_bytes;
130+
131+ struct mutex io_mutex;
132+
133+ /* attached dynamic objects */
134+ struct list_head dobj_list;
135+
136+ /*
137+ * DO NOT use any of the fields below in drivers, they are temporary and
138+ * are going to be removed again soon. If you use them in driver code
139+ * the driver will be marked as BROKEN when these fields are removed.
140+ */
141+
142+ /* Don't use these, use snd_soc_component_get_dapm() */
143+ struct snd_soc_dapm_context dapm;
144+
145+ /* machine specific init */
146+ int (*init)(struct snd_soc_component *component);
147+
148+#ifdef CONFIG_DEBUG_FS
149+ struct dentry *debugfs_root;
150+ const char *debugfs_prefix;
151+#endif
152+};
153+
154+#define for_each_component_dais(component, dai)\
155+ list_for_each_entry(dai, &(component)->dai_list, list)
156+#define for_each_component_dais_safe(component, dai, _dai)\
157+ list_for_each_entry_safe(dai, _dai, &(component)->dai_list, list)
158+
159+/**
160+ * snd_soc_dapm_to_component() - Casts a DAPM context to the component it is
161+ * embedded in
162+ * @dapm: The DAPM context to cast to the component
163+ *
164+ * This function must only be used on DAPM contexts that are known to be part of
165+ * a component (e.g. in a component driver). Otherwise the behavior is
166+ * undefined.
167+ */
168+static inline struct snd_soc_component *snd_soc_dapm_to_component(
169+ struct snd_soc_dapm_context *dapm)
170+{
171+ return container_of(dapm, struct snd_soc_component, dapm);
172+}
173+
174+/**
175+ * snd_soc_component_get_dapm() - Returns the DAPM context associated with a
176+ * component
177+ * @component: The component for which to get the DAPM context
178+ */
179+static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
180+ struct snd_soc_component *component)
181+{
182+ return &component->dapm;
183+}
184+
185+/**
186+ * snd_soc_component_init_bias_level() - Initialize COMPONENT DAPM bias level
187+ * @component: The COMPONENT for which to initialize the DAPM bias level
188+ * @level: The DAPM level to initialize to
189+ *
190+ * Initializes the COMPONENT DAPM bias level. See snd_soc_dapm_init_bias_level()
191+ */
192+static inline void
193+snd_soc_component_init_bias_level(struct snd_soc_component *component,
194+ enum snd_soc_bias_level level)
195+{
196+ snd_soc_dapm_init_bias_level(
197+ snd_soc_component_get_dapm(component), level);
198+}
199+
200+/**
201+ * snd_soc_component_get_bias_level() - Get current COMPONENT DAPM bias level
202+ * @component: The COMPONENT for which to get the DAPM bias level
203+ *
204+ * Returns: The current DAPM bias level of the COMPONENT.
205+ */
206+static inline enum snd_soc_bias_level
207+snd_soc_component_get_bias_level(struct snd_soc_component *component)
208+{
209+ return snd_soc_dapm_get_bias_level(
210+ snd_soc_component_get_dapm(component));
211+}
212+
213+/**
214+ * snd_soc_component_force_bias_level() - Set the COMPONENT DAPM bias level
215+ * @component: The COMPONENT for which to set the level
216+ * @level: The level to set to
217+ *
218+ * Forces the COMPONENT bias level to a specific state. See
219+ * snd_soc_dapm_force_bias_level().
220+ */
221+static inline int
222+snd_soc_component_force_bias_level(struct snd_soc_component *component,
223+ enum snd_soc_bias_level level)
224+{
225+ return snd_soc_dapm_force_bias_level(
226+ snd_soc_component_get_dapm(component),
227+ level);
228+}
229+
230+/**
231+ * snd_soc_dapm_kcontrol_component() - Returns the component associated to a
232+ * kcontrol
233+ * @kcontrol: The kcontrol
234+ *
235+ * This function must only be used on DAPM contexts that are known to be part of
236+ * a COMPONENT (e.g. in a COMPONENT driver). Otherwise the behavior is undefined
237+ */
238+static inline struct snd_soc_component *snd_soc_dapm_kcontrol_component(
239+ struct snd_kcontrol *kcontrol)
240+{
241+ return snd_soc_dapm_to_component(snd_soc_dapm_kcontrol_dapm(kcontrol));
242+}
243+
244+/**
245+ * snd_soc_component_cache_sync() - Sync the register cache with the hardware
246+ * @component: COMPONENT to sync
247+ *
248+ * Note: This function will call regcache_sync()
249+ */
250+static inline int snd_soc_component_cache_sync(
251+ struct snd_soc_component *component)
252+{
253+ return regcache_sync(component->regmap);
254+}
255+
256+/* component IO */
257+int snd_soc_component_read(struct snd_soc_component *component,
258+ unsigned int reg, unsigned int *val);
259+unsigned int snd_soc_component_read32(struct snd_soc_component *component,
260+ unsigned int reg);
261+int snd_soc_component_write(struct snd_soc_component *component,
262+ unsigned int reg, unsigned int val);
263+int snd_soc_component_update_bits(struct snd_soc_component *component,
264+ unsigned int reg, unsigned int mask,
265+ unsigned int val);
266+int snd_soc_component_update_bits_async(struct snd_soc_component *component,
267+ unsigned int reg, unsigned int mask,
268+ unsigned int val);
269+void snd_soc_component_async_complete(struct snd_soc_component *component);
270+int snd_soc_component_test_bits(struct snd_soc_component *component,
271+ unsigned int reg, unsigned int mask,
272+ unsigned int value);
273+
274+/* component wide operations */
275+int snd_soc_component_set_sysclk(struct snd_soc_component *component,
276+ int clk_id, int source,
277+ unsigned int freq, int dir);
278+int snd_soc_component_set_pll(struct snd_soc_component *component, int pll_id,
279+ int source, unsigned int freq_in,
280+ unsigned int freq_out);
281+int snd_soc_component_set_jack(struct snd_soc_component *component,
282+ struct snd_soc_jack *jack, void *data);
283+
284+void snd_soc_component_seq_notifier(struct snd_soc_component *component,
285+ enum snd_soc_dapm_type type, int subseq);
286+int snd_soc_component_stream_event(struct snd_soc_component *component,
287+ int event);
288+int snd_soc_component_set_bias_level(struct snd_soc_component *component,
289+ enum snd_soc_bias_level level);
290+
291+#ifdef CONFIG_REGMAP
292+void snd_soc_component_init_regmap(struct snd_soc_component *component,
293+ struct regmap *regmap);
294+void snd_soc_component_exit_regmap(struct snd_soc_component *component);
295+#endif
296+
297+#define snd_soc_component_module_get_when_probe(component)\
298+ snd_soc_component_module_get(component, 0)
299+#define snd_soc_component_module_get_when_open(component) \
300+ snd_soc_component_module_get(component, 1)
301+int snd_soc_component_module_get(struct snd_soc_component *component,
302+ int upon_open);
303+#define snd_soc_component_module_put_when_remove(component) \
304+ snd_soc_component_module_put(component, 0)
305+#define snd_soc_component_module_put_when_close(component) \
306+ snd_soc_component_module_put(component, 1)
307+void snd_soc_component_module_put(struct snd_soc_component *component,
308+ int upon_open);
309+
310+static inline void snd_soc_component_set_drvdata(struct snd_soc_component *c,
311+ void *data)
312+{
313+ dev_set_drvdata(c->dev, data);
314+}
315+
316+static inline void *snd_soc_component_get_drvdata(struct snd_soc_component *c)
317+{
318+ return dev_get_drvdata(c->dev);
319+}
320+
321+static inline bool snd_soc_component_is_active(
322+ struct snd_soc_component *component)
323+{
324+ return component->active != 0;
325+}
326+
327+/* component pin */
328+int snd_soc_component_enable_pin(struct snd_soc_component *component,
329+ const char *pin);
330+int snd_soc_component_enable_pin_unlocked(struct snd_soc_component *component,
331+ const char *pin);
332+int snd_soc_component_disable_pin(struct snd_soc_component *component,
333+ const char *pin);
334+int snd_soc_component_disable_pin_unlocked(struct snd_soc_component *component,
335+ const char *pin);
336+int snd_soc_component_nc_pin(struct snd_soc_component *component,
337+ const char *pin);
338+int snd_soc_component_nc_pin_unlocked(struct snd_soc_component *component,
339+ const char *pin);
340+int snd_soc_component_get_pin_status(struct snd_soc_component *component,
341+ const char *pin);
342+int snd_soc_component_force_enable_pin(struct snd_soc_component *component,
343+ const char *pin);
344+int snd_soc_component_force_enable_pin_unlocked(
345+ struct snd_soc_component *component,
346+ const char *pin);
347+
348+/* component driver ops */
349+int snd_soc_component_open(struct snd_soc_component *component,
350+ struct snd_pcm_substream *substream);
351+int snd_soc_component_close(struct snd_soc_component *component,
352+ struct snd_pcm_substream *substream);
353+int snd_soc_component_prepare(struct snd_soc_component *component,
354+ struct snd_pcm_substream *substream);
355+int snd_soc_component_hw_params(struct snd_soc_component *component,
356+ struct snd_pcm_substream *substream,
357+ struct snd_pcm_hw_params *params);
358+int snd_soc_component_hw_free(struct snd_soc_component *component,
359+ struct snd_pcm_substream *substream);
360+int snd_soc_component_trigger(struct snd_soc_component *component,
361+ struct snd_pcm_substream *substream,
362+ int cmd);
363+void snd_soc_component_suspend(struct snd_soc_component *component);
364+void snd_soc_component_resume(struct snd_soc_component *component);
365+int snd_soc_component_is_suspended(struct snd_soc_component *component);
366+int snd_soc_component_probe(struct snd_soc_component *component);
367+void snd_soc_component_remove(struct snd_soc_component *component);
368+int snd_soc_component_of_xlate_dai_id(struct snd_soc_component *component,
369+ struct device_node *ep);
370+int snd_soc_component_of_xlate_dai_name(struct snd_soc_component *component,
371+ struct of_phandle_args *args,
372+ const char **dai_name);
373+
374+int snd_soc_pcm_component_pointer(struct snd_pcm_substream *substream);
375+int snd_soc_pcm_component_ioctl(struct snd_pcm_substream *substream,
376+ unsigned int cmd, void *arg);
377+int snd_soc_pcm_component_copy_user(struct snd_pcm_substream *substream,
378+ int channel, unsigned long pos,
379+ void __user *buf, unsigned long bytes);
380+struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream,
381+ unsigned long offset);
382+int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream,
383+ struct vm_area_struct *vma);
384+int snd_soc_pcm_component_new(struct snd_pcm *pcm);
385+void snd_soc_pcm_component_free(struct snd_pcm *pcm);
386+
387+#endif /* __SOC_COMPONENT_H */
include/sound/soc-dai.h+26−2
@@ -145,6 +145,31 @@ int snd_soc_dai_get_channel_map(struct snd_soc_dai *dai, · 144 unmodified lines
145145
146146 int snd_soc_dai_is_dummy(struct snd_soc_dai *dai);
147147
148+int snd_soc_dai_hw_params(struct snd_soc_dai *dai,
149+ struct snd_pcm_substream *substream,
150+ struct snd_pcm_hw_params *params);
151+void snd_soc_dai_hw_free(struct snd_soc_dai *dai,
152+ struct snd_pcm_substream *substream);
153+int snd_soc_dai_startup(struct snd_soc_dai *dai,
154+ struct snd_pcm_substream *substream);
155+void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
156+ struct snd_pcm_substream *substream);
157+int snd_soc_dai_prepare(struct snd_soc_dai *dai,
158+ struct snd_pcm_substream *substream);
159+int snd_soc_dai_trigger(struct snd_soc_dai *dai,
160+ struct snd_pcm_substream *substream, int cmd);
161+int snd_soc_dai_bespoke_trigger(struct snd_soc_dai *dai,
162+ struct snd_pcm_substream *substream, int cmd);
163+snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai,
164+ struct snd_pcm_substream *substream);
165+void snd_soc_dai_suspend(struct snd_soc_dai *dai);
166+void snd_soc_dai_resume(struct snd_soc_dai *dai);
167+int snd_soc_dai_probe(struct snd_soc_dai *dai);
168+int snd_soc_dai_remove(struct snd_soc_dai *dai);
169+int snd_soc_dai_compress_new(struct snd_soc_dai *dai,
170+ struct snd_soc_pcm_runtime *rtd, int num);
171+bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream);
172+
148173 struct snd_soc_dai_ops {
149174 /*
150175 * DAI clocking configuration, all optional.
@@ -268,8 +293,6 @@ struct snd_soc_dai_driver { · 117 unmodified lines
268293 /* Optional Callback used at pcm creation*/
269294 int (*pcm_new)(struct snd_soc_pcm_runtime *rtd,
270295 struct snd_soc_dai *dai);
271− /* DAI is also used for the control bus */
272− bool bus_control;
273296
274297 /* ops */
275298 const struct snd_soc_dai_ops *ops;
@@ -281,6 +304,7 @@ struct snd_soc_dai_driver { · 5 unmodified lines
281304 unsigned int symmetric_rates:1;
282305 unsigned int symmetric_channels:1;
283306 unsigned int symmetric_samplebits:1;
307+ unsigned int bus_control:1; /* DAI is also used for the control bus */
284308
285309 /* probe ordering - for components with runtime dependencies */
286310 int probe_order;
include/sound/soc-dapm.h+5−6
@@ -353,6 +353,8 @@ struct device; · 352 unmodified lines
353353 #define SND_SOC_DAPM_WILL_PMD 0x80 /* called at start of sequence */
354354 #define SND_SOC_DAPM_PRE_POST_PMD \
355355 (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD)
356+#define SND_SOC_DAPM_PRE_POST_PMU \
357+ (SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU)
356358
357359 /* convenience event type detection */
358360 #define SND_SOC_DAPM_EVENT_ON(e) \
@@ -417,6 +419,9 @@ int snd_soc_dapm_update_dai(struct snd_pcm_substream *substream, · 58 unmodified lines
417419 /* dapm path setup */
418420 int snd_soc_dapm_new_widgets(struct snd_soc_card *card);
419421 void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm);
422+void snd_soc_dapm_init(struct snd_soc_dapm_context *dapm,
423+ struct snd_soc_card *card,
424+ struct snd_soc_component *component);
420425 int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
421426 const struct snd_soc_dapm_route *route, int num);
422427 int snd_soc_dapm_del_routes(struct snd_soc_dapm_context *dapm,
@@ -662,8 +667,6 @@ struct snd_soc_dapm_context { · 239 unmodified lines
662667 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
663668 /* Go to BIAS_OFF in suspend if the DAPM context is idle */
664669 unsigned int suspend_bias_off:1;
665− void (*seq_notifier)(struct snd_soc_dapm_context *,
666− enum snd_soc_dapm_type, int);
667670
668671 struct device *dev; /* from parent - for debug */
669672 struct snd_soc_component *component; /* parent component */
@@ -673,10 +676,6 @@ struct snd_soc_dapm_context { · 3 unmodified lines
673676 enum snd_soc_bias_level target_bias_level;
674677 struct list_head list;
675678
676− int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
677− int (*set_bias_level)(struct snd_soc_dapm_context *dapm,
678− enum snd_soc_bias_level level);
679−
680679 struct snd_soc_dapm_wcache path_sink_cache;
681680 struct snd_soc_dapm_wcache path_source_cache;
682681
include/sound/soc-dpcm.h+8−1
@@ -142,9 +142,16 @@ void snd_soc_dpcm_be_set_state(struct snd_soc_pcm_runtime *be, int stream, · 141 unmodified lines
142142
143143 /* internal use only */
144144 int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute);
145−void soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd);
146145 int soc_dpcm_runtime_update(struct snd_soc_card *);
147146
147+#ifdef CONFIG_DEBUG_FS
148+void soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd);
149+#else
150+static inline void soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd)
151+{
152+}
153+#endif
154+
148155 int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
149156 int stream, struct snd_soc_dapm_widget_list **list_);
150157 int dpcm_process_paths(struct snd_soc_pcm_runtime *fe,
include/sound/soc.h+20−328
@@ -362,21 +362,6 @@ · 361 unmodified lines
362362 #define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \
363363 const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts)
364364
365−/*
366− * Component probe and remove ordering levels for components with runtime
367− * dependencies.
368− */
369−#define SND_SOC_COMP_ORDER_FIRST -2
370−#define SND_SOC_COMP_ORDER_EARLY -1
371−#define SND_SOC_COMP_ORDER_NORMAL 0
372−#define SND_SOC_COMP_ORDER_LATE 1
373−#define SND_SOC_COMP_ORDER_LAST 2
374−
375−#define for_each_comp_order(order) \
376− for (order = SND_SOC_COMP_ORDER_FIRST; \
377− order <= SND_SOC_COMP_ORDER_LAST; \
378− order++)
379−
380365 /*
381366 * Bias levels
382367 *
@@ -505,10 +490,6 @@ int snd_soc_params_to_bclk(struct snd_pcm_hw_params *parms); · 122 unmodified lines
505490 int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
506491 const struct snd_pcm_hardware *hw);
507492
508−int soc_dai_hw_params(struct snd_pcm_substream *substream,
509− struct snd_pcm_hw_params *params,
510− struct snd_soc_dai *dai);
511−
512493 /* Jack reporting */
513494 int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type,
514495 struct snd_soc_jack *jack, struct snd_soc_jack_pin *pins,
@@ -751,132 +732,6 @@ struct snd_soc_compr_ops { · 236 unmodified lines
751732 int (*trigger)(struct snd_compr_stream *);
752733 };
753734
754−/* component interface */
755−struct snd_soc_component_driver {
756− const char *name;
757−
758− /* Default control and setup, added after probe() is run */
759− const struct snd_kcontrol_new *controls;
760− unsigned int num_controls;
761− const struct snd_soc_dapm_widget *dapm_widgets;
762− unsigned int num_dapm_widgets;
763− const struct snd_soc_dapm_route *dapm_routes;
764− unsigned int num_dapm_routes;
765−
766− int (*probe)(struct snd_soc_component *);
767− void (*remove)(struct snd_soc_component *);
768− int (*suspend)(struct snd_soc_component *);
769− int (*resume)(struct snd_soc_component *);
770−
771− unsigned int (*read)(struct snd_soc_component *, unsigned int);
772− int (*write)(struct snd_soc_component *, unsigned int, unsigned int);
773−
774− /* pcm creation and destruction */
775− int (*pcm_new)(struct snd_soc_pcm_runtime *);
776− void (*pcm_free)(struct snd_pcm *);
777−
778− /* component wide operations */
779− int (*set_sysclk)(struct snd_soc_component *component,
780− int clk_id, int source, unsigned int freq, int dir);
781− int (*set_pll)(struct snd_soc_component *component, int pll_id,
782− int source, unsigned int freq_in, unsigned int freq_out);
783− int (*set_jack)(struct snd_soc_component *component,
784− struct snd_soc_jack *jack, void *data);
785−
786− /* DT */
787− int (*of_xlate_dai_name)(struct snd_soc_component *component,
788− struct of_phandle_args *args,
789− const char **dai_name);
790− int (*of_xlate_dai_id)(struct snd_soc_component *comment,
791− struct device_node *endpoint);
792− void (*seq_notifier)(struct snd_soc_component *, enum snd_soc_dapm_type,
793− int subseq);
794− int (*stream_event)(struct snd_soc_component *, int event);
795− int (*set_bias_level)(struct snd_soc_component *component,
796− enum snd_soc_bias_level level);
797−
798− const struct snd_pcm_ops *ops;
799− const struct snd_compr_ops *compr_ops;
800−
801− /* probe ordering - for components with runtime dependencies */
802− int probe_order;
803− int remove_order;
804−
805− /*
806− * signal if the module handling the component should not be removed
807− * if a pcm is open. Setting this would prevent the module
808− * refcount being incremented in probe() but allow it be incremented
809− * when a pcm is opened and decremented when it is closed.
810− */
811− unsigned int module_get_upon_open:1;
812−
813− /* bits */
814− unsigned int idle_bias_on:1;
815− unsigned int suspend_bias_off:1;
816− unsigned int use_pmdown_time:1; /* care pmdown_time at stop */
817− unsigned int endianness:1;
818− unsigned int non_legacy_dai_naming:1;
819−
820− /* this component uses topology and ignore machine driver FEs */
821− const char *ignore_machine;
822− const char *topology_name_prefix;
823− int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd,
824− struct snd_pcm_hw_params *params);
825− bool use_dai_pcm_id; /* use the DAI link PCM ID as PCM device number */
826− int be_pcm_base; /* base device ID for all BE PCMs */
827−};
828−
829−struct snd_soc_component {
830− const char *name;
831− int id;
832− const char *name_prefix;
833− struct device *dev;
834− struct snd_soc_card *card;
835−
836− unsigned int active;
837−
838− unsigned int suspended:1; /* is in suspend PM state */
839−
840− struct list_head list;
841− struct list_head card_aux_list; /* for auxiliary bound components */
842− struct list_head card_list;
843−
844− const struct snd_soc_component_driver *driver;
845−
846− struct list_head dai_list;
847− int num_dai;
848−
849− struct regmap *regmap;
850− int val_bytes;
851−
852− struct mutex io_mutex;
853−
854− /* attached dynamic objects */
855− struct list_head dobj_list;
856−
857− /*
858− * DO NOT use any of the fields below in drivers, they are temporary and
859− * are going to be removed again soon. If you use them in driver code the
860− * driver will be marked as BROKEN when these fields are removed.
861− */
862−
863− /* Don't use these, use snd_soc_component_get_dapm() */
864− struct snd_soc_dapm_context dapm;
865−
866− /* machine specific init */
867− int (*init)(struct snd_soc_component *component);
868−
869−#ifdef CONFIG_DEBUG_FS
870− struct dentry *debugfs_root;
871− const char *debugfs_prefix;
872−#endif
873−};
874−
875−#define for_each_component_dais(component, dai)\
876− list_for_each_entry(dai, &(component)->dai_list, list)
877−#define for_each_component_dais_safe(component, dai, _dai)\
878− list_for_each_entry_safe(dai, _dai, &(component)->dai_list, list)
879−
880735 struct snd_soc_rtdcom_list {
881736 struct snd_soc_component *component;
882737 struct list_head list; /* rtd::component_list */
@@ -1086,6 +941,7 @@ struct snd_soc_dai_link { · 203 unmodified lines
1086941 #define COMP_CPU(_dai) { .dai_name = _dai, }
1087942 #define COMP_CODEC(_name, _dai) { .name = _name, .dai_name = _dai, }
1088943 #define COMP_PLATFORM(_name) { .name = _name }
944+#define COMP_AUX(_name) { .name = _name }
1089945 #define COMP_DUMMY() { .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", }
1090946
1091947 extern struct snd_soc_dai_link_component null_dailink_component[0];
@@ -1107,14 +963,11 @@ struct snd_soc_codec_conf { · 15 unmodified lines
1107963 };
1108964
1109965 struct snd_soc_aux_dev {
1110− const char *name; /* Codec name */
1111−
1112966 /*
1113967 * specify multi-codec either by device name, or by
1114968 * DT/OF node, but not both.
1115969 */
1116− const char *codec_name;
1117− struct device_node *codec_of_node;
970+ struct snd_soc_dai_link_component dlc;
1118971
1119972 /* codec/machine specific init - e.g. add machine controls */
1120973 int (*init)(struct snd_soc_component *component);
@@ -1135,6 +988,10 @@ struct snd_soc_card { · 14 unmodified lines
1135988 struct mutex mutex;
1136989 struct mutex dapm_mutex;
1137990
991+ /* Mutex for PCM operations */
992+ struct mutex pcm_mutex;
993+ enum snd_soc_pcm_subclass pcm_subclass;
994+
1138995 spinlock_t dpcm_lock;
1139996
1140997 bool instantiated;
@@ -1203,8 +1060,6 @@ struct snd_soc_card { · 62 unmodified lines
12031060 int num_of_dapm_routes;
12041061 bool fully_routed;
12051062
1206− struct work_struct deferred_resume_work;
1207−
12081063 /* lists of probed devices belonging to this card */
12091064 struct list_head component_dev_list;
12101065 struct list_head list;
@@ -1224,7 +1079,9 @@ struct snd_soc_card { · 13 unmodified lines
12241079
12251080 #ifdef CONFIG_DEBUG_FS
12261081 struct dentry *debugfs_card_root;
1227− struct dentry *debugfs_pop_time;
1082+#endif
1083+#ifdef CONFIG_PM_SLEEP
1084+ struct work_struct deferred_resume_work;
12281085 #endif
12291086 u32 pop_time;
12301087
@@ -1234,6 +1091,10 @@ struct snd_soc_card { · 3 unmodified lines
12341091 for ((i) = 0; \
12351092 ((i) < (card)->num_links) && ((link) = &(card)->dai_link[i]); \
12361093 (i)++)
1094+#define for_each_card_pre_auxs(card, i, aux) \
1095+ for ((i) = 0; \
1096+ ((i) < (card)->num_aux_devs) && ((aux) = &(card)->aux_dev[i]); \
1097+ (i)++)
12371098
12381099 #define for_each_card_links(card, link) \
12391100 list_for_each_entry(link, &(card)->dai_link_list, list)
@@ -1245,6 +1106,12 @@ struct snd_soc_card { · 5 unmodified lines
12451106 #define for_each_card_rtds_safe(card, rtd, _rtd) \
12461107 list_for_each_entry_safe(rtd, _rtd, &(card)->rtd_list, list)
12471108
1109+#define for_each_card_auxs(card, component) \
1110+ list_for_each_entry(component, &card->aux_comp_list, card_aux_list)
1111+#define for_each_card_auxs_safe(card, component, _comp) \
1112+ list_for_each_entry_safe(component, _comp, \
1113+ &card->aux_comp_list, card_aux_list)
1114+
12481115 #define for_each_card_components(card, component) \
12491116 list_for_each_entry(component, &(card)->component_dev_list, card_list)
12501117
@@ -1253,8 +1120,6 @@ struct snd_soc_pcm_runtime { · 2 unmodified lines
12531120 struct device *dev;
12541121 struct snd_soc_card *card;
12551122 struct snd_soc_dai_link *dai_link;
1256− struct mutex pcm_mutex;
1257− enum snd_soc_pcm_subclass pcm_subclass;
12581123 struct snd_pcm_ops ops;
12591124
12601125 unsigned int params_select; /* currently selected param for dai link */
@@ -1342,134 +1207,6 @@ struct soc_enum { · 81 unmodified lines
13421207 struct snd_soc_dobj dobj;
13431208 };
13441209
1345−/**
1346− * snd_soc_dapm_to_component() - Casts a DAPM context to the component it is
1347− * embedded in
1348− * @dapm: The DAPM context to cast to the component
1349− *
1350− * This function must only be used on DAPM contexts that are known to be part of
1351− * a component (e.g. in a component driver). Otherwise the behavior is
1352− * undefined.
1353− */
1354−static inline struct snd_soc_component *snd_soc_dapm_to_component(
1355− struct snd_soc_dapm_context *dapm)
1356−{
1357− return container_of(dapm, struct snd_soc_component, dapm);
1358−}
1359−
1360−/**
1361− * snd_soc_component_get_dapm() - Returns the DAPM context associated with a
1362− * component
1363− * @component: The component for which to get the DAPM context
1364− */
1365−static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
1366− struct snd_soc_component *component)
1367−{
1368− return &component->dapm;
1369−}
1370−
1371−/**
1372− * snd_soc_component_init_bias_level() - Initialize COMPONENT DAPM bias level
1373− * @component: The COMPONENT for which to initialize the DAPM bias level
1374− * @level: The DAPM level to initialize to
1375− *
1376− * Initializes the COMPONENT DAPM bias level. See snd_soc_dapm_init_bias_level().
1377− */
1378−static inline void
1379−snd_soc_component_init_bias_level(struct snd_soc_component *component,
1380− enum snd_soc_bias_level level)
1381−{
1382− snd_soc_dapm_init_bias_level(
1383− snd_soc_component_get_dapm(component), level);
1384−}
1385−
1386−/**
1387− * snd_soc_component_get_bias_level() - Get current COMPONENT DAPM bias level
1388− * @component: The COMPONENT for which to get the DAPM bias level
1389− *
1390− * Returns: The current DAPM bias level of the COMPONENT.
1391− */
1392−static inline enum snd_soc_bias_level
1393−snd_soc_component_get_bias_level(struct snd_soc_component *component)
1394−{
1395− return snd_soc_dapm_get_bias_level(
1396− snd_soc_component_get_dapm(component));
1397−}
1398−
1399−/**
1400− * snd_soc_component_force_bias_level() - Set the COMPONENT DAPM bias level
1401− * @component: The COMPONENT for which to set the level
1402− * @level: The level to set to
1403− *
1404− * Forces the COMPONENT bias level to a specific state. See
1405− * snd_soc_dapm_force_bias_level().
1406− */
1407−static inline int
1408−snd_soc_component_force_bias_level(struct snd_soc_component *component,
1409− enum snd_soc_bias_level level)
1410−{
1411− return snd_soc_dapm_force_bias_level(
1412− snd_soc_component_get_dapm(component),
1413− level);
1414−}
1415−
1416−/**
1417− * snd_soc_dapm_kcontrol_component() - Returns the component associated to a kcontrol
1418− * @kcontrol: The kcontrol
1419− *
1420− * This function must only be used on DAPM contexts that are known to be part of
1421− * a COMPONENT (e.g. in a COMPONENT driver). Otherwise the behavior is undefined.
1422− */
1423−static inline struct snd_soc_component *snd_soc_dapm_kcontrol_component(
1424− struct snd_kcontrol *kcontrol)
1425−{
1426− return snd_soc_dapm_to_component(snd_soc_dapm_kcontrol_dapm(kcontrol));
1427−}
1428−
1429−/**
1430− * snd_soc_component_cache_sync() - Sync the register cache with the hardware
1431− * @component: COMPONENT to sync
1432− *
1433− * Note: This function will call regcache_sync()
1434− */
1435−static inline int snd_soc_component_cache_sync(
1436− struct snd_soc_component *component)
1437−{
1438− return regcache_sync(component->regmap);
1439−}
1440−
1441−/* component IO */
1442−int snd_soc_component_read(struct snd_soc_component *component,
1443− unsigned int reg, unsigned int *val);
1444−unsigned int snd_soc_component_read32(struct snd_soc_component *component,
1445− unsigned int reg);
1446−int snd_soc_component_write(struct snd_soc_component *component,
1447− unsigned int reg, unsigned int val);
1448−int snd_soc_component_update_bits(struct snd_soc_component *component,
1449− unsigned int reg, unsigned int mask, unsigned int val);
1450−int snd_soc_component_update_bits_async(struct snd_soc_component *component,
1451− unsigned int reg, unsigned int mask, unsigned int val);
1452−void snd_soc_component_async_complete(struct snd_soc_component *component);
1453−int snd_soc_component_test_bits(struct snd_soc_component *component,
1454− unsigned int reg, unsigned int mask, unsigned int value);
1455−
1456−/* component wide operations */
1457−int snd_soc_component_set_sysclk(struct snd_soc_component *component,
1458− int clk_id, int source, unsigned int freq, int dir);
1459−int snd_soc_component_set_pll(struct snd_soc_component *component, int pll_id,
1460− int source, unsigned int freq_in,
1461− unsigned int freq_out);
1462−int snd_soc_component_set_jack(struct snd_soc_component *component,
1463− struct snd_soc_jack *jack, void *data);
1464−
1465−#ifdef CONFIG_REGMAP
1466−
1467−void snd_soc_component_init_regmap(struct snd_soc_component *component,
1468− struct regmap *regmap);
1469−void snd_soc_component_exit_regmap(struct snd_soc_component *component);
1470−
1471−#endif
1472−
14731210 /* device driver data */
14741211
14751212 static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
@@ -1483,27 +1220,6 @@ static inline void *snd_soc_card_get_drvdata(struct snd_soc_card *card) · 7 unmodified lines
14831220 return card->drvdata;
14841221 }
14851222
1486−static inline void snd_soc_component_set_drvdata(struct snd_soc_component *c,
1487− void *data)
1488−{
1489− dev_set_drvdata(c->dev, data);
1490−}
1491−
1492−static inline void *snd_soc_component_get_drvdata(struct snd_soc_component *c)
1493−{
1494− return dev_get_drvdata(c->dev);
1495−}
1496−
1497−static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
1498−{
1499− INIT_LIST_HEAD(&card->widgets);
1500− INIT_LIST_HEAD(&card->paths);
1501− INIT_LIST_HEAD(&card->dapm_list);
1502− INIT_LIST_HEAD(&card->aux_comp_list);
1503− INIT_LIST_HEAD(&card->component_dev_list);
1504− INIT_LIST_HEAD(&card->list);
1505−}
1506−
15071223 static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc)
15081224 {
15091225 if (mc->reg == mc->rreg && mc->shift == mc->rshift)
@@ -1540,12 +1256,6 @@ static inline unsigned int snd_soc_enum_item_to_val(struct soc_enum *e, · 30 unmodified lines
15401256 return e->values[item];
15411257 }
15421258
1543−static inline bool snd_soc_component_is_active(
1544− struct snd_soc_component *component)
1545−{
1546− return component->active != 0;
1547−}
1548−
15491259 /**
15501260 * snd_soc_kcontrol_component() - Returns the component that registered the
15511261 * control
@@ -1681,24 +1391,6 @@ static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm) · 129 unmodified lines
16811391 mutex_unlock(&dapm->card->dapm_mutex);
16821392 }
16831393
1684−int snd_soc_component_enable_pin(struct snd_soc_component *component,
1685− const char *pin);
1686−int snd_soc_component_enable_pin_unlocked(struct snd_soc_component *component,
1687− const char *pin);
1688−int snd_soc_component_disable_pin(struct snd_soc_component *component,
1689− const char *pin);
1690−int snd_soc_component_disable_pin_unlocked(struct snd_soc_component *component,
1691− const char *pin);
1692−int snd_soc_component_nc_pin(struct snd_soc_component *component,
1693− const char *pin);
1694−int snd_soc_component_nc_pin_unlocked(struct snd_soc_component *component,
1695− const char *pin);
1696−int snd_soc_component_get_pin_status(struct snd_soc_component *component,
1697− const char *pin);
1698−int snd_soc_component_force_enable_pin(struct snd_soc_component *component,
1699− const char *pin);
1700−int snd_soc_component_force_enable_pin_unlocked(
1701− struct snd_soc_component *component,
1702− const char *pin);
1394+#include <sound/soc-component.h>
17031395
17041396 #endif
include/sound/sof/dai-intel.h+12−0
@@ -76,6 +76,9 @@ struct sof_ipc_dai_ssp_params { · 75 unmodified lines
7676 uint16_t tdm_per_slot_padding_flag;
7777 uint32_t clks_control;
7878 uint32_t quirks;
79+ uint32_t bclk_delay; /* guaranteed time (ms) for which BCLK
80+ * will be driven, before sending data
81+ */
7982 } __packed;
8083
8184 /* HDA Configuration Request - SOF_IPC_DAI_HDA_CONFIG */
@@ -176,4 +179,13 @@ struct sof_ipc_dai_dmic_params { · 94 unmodified lines
176179 struct sof_ipc_dai_dmic_pdm_ctrl pdm[0];
177180 } __packed;
178181
182+/* ALH Configuration Request - SOF_IPC_DAI_ALH_CONFIG */
183+struct sof_ipc_dai_alh_params {
184+ struct sof_ipc_hdr hdr;
185+ uint32_t stream_id;
186+
187+ /* reserved for future use */
188+ uint32_t reserved[15];
189+} __packed;
190+
179191 #endif
include/sound/sof/dai.h+4−1
@@ -49,7 +49,9 @@ enum sof_ipc_dai_type { · 48 unmodified lines
4949 SOF_DAI_INTEL_SSP, /**< Intel SSP */
5050 SOF_DAI_INTEL_DMIC, /**< Intel DMIC */
5151 SOF_DAI_INTEL_HDA, /**< Intel HD/A */
52− SOF_DAI_INTEL_SOUNDWIRE, /**< Intel SoundWire */
52+ SOF_DAI_INTEL_ALH, /**< Intel ALH */
53+ SOF_DAI_IMX_SAI, /**< i.MX SAI */
54+ SOF_DAI_IMX_ESAI, /**< i.MX ESAI */
5355 };
5456
5557 /* general purpose DAI configuration */
@@ -70,6 +72,7 @@ struct sof_ipc_dai_config { · 14 unmodified lines
7072 struct sof_ipc_dai_ssp_params ssp;
7173 struct sof_ipc_dai_dmic_params dmic;
7274 struct sof_ipc_dai_hda_params hda;
75+ struct sof_ipc_dai_alh_params alh;
7376 };
7477 } __packed;
7578
include/uapi/sound/sof/abi.h+1−1
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626
2727 /* SOF ABI version major, minor and patch numbers */
2828 #define SOF_ABI_MAJOR 3
29−#define SOF_ABI_MINOR 8
29+#define SOF_ABI_MINOR 10
3030 #define SOF_ABI_PATCH 0
3131
3232 /* SOF ABI version number. Format within 32bit word is MMmmmppp */
include/uapi/sound/sof/tokens.h+9−0
@@ -75,6 +75,7 @@ · 74 unmodified lines
7575 #define SOF_TKN_INTEL_SSP_FRAME_PULSE_WIDTH 503
7676 #define SOF_TKN_INTEL_SSP_QUIRKS 504
7777 #define SOF_TKN_INTEL_SSP_TDM_PADDING_PER_SLOT 505
78+#define SOF_TKN_INTEL_SSP_BCLK_DELAY 506
7879
7980 /* DMIC */
8081 #define SOF_TKN_INTEL_DMIC_DRIVER_VERSION 600
@@ -105,4 +106,12 @@ · 24 unmodified lines
105106 /* for backward compatibility */
106107 #define SOF_TKN_EFFECT_TYPE SOF_TKN_PROCESS_TYPE
107108
109+/* SAI */
110+#define SOF_TKN_IMX_SAI_FIRST_TOKEN 1000
111+/* TODO: Add SAI tokens */
112+
113+/* ESAI */
114+#define SOF_TKN_IMX_ESAI_FIRST_TOKEN 1100
115+/* TODO: Add ESAI tokens */
116+
108117 #endif