Showing the changes to include (15 of 272 files). Show all
Unified · Split
| @@ -253,24 +253,6 @@ struct hdac_ext_bus_ops { · 252 unmodified lines | |||
| 253 | int (*hdev_detach)(struct hdac_device *hdev); | 253 | int (*hdev_detach)(struct hdac_device *hdev); |
| 254 | }; | 254 | }; |
| 255 | 255 | ||
| 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 | |||
| 274 | #define HDA_UNSOL_QUEUE_SIZE 64 | 256 | #define HDA_UNSOL_QUEUE_SIZE 64 |
| 275 | #define HDA_MAX_CODECS 8 /* limit by controller side */ | 257 | #define HDA_MAX_CODECS 8 /* limit by controller side */ |
| 276 | 258 | ||
| @@ -304,7 +286,6 @@ struct hdac_rb { · 27 unmodified lines | |||
| 304 | struct hdac_bus { | 286 | struct hdac_bus { |
| 305 | struct device *dev; | 287 | struct device *dev; |
| 306 | const struct hdac_bus_ops *ops; | 288 | const struct hdac_bus_ops *ops; |
| 307 | const struct hdac_io_ops *io_ops; | ||
| 308 | const struct hdac_ext_bus_ops *ext_ops; | 289 | const struct hdac_ext_bus_ops *ext_ops; |
| 309 | 290 | ||
| 310 | /* h/w resources */ | 291 | /* h/w resources */ |
| @@ -344,6 +325,7 @@ struct hdac_bus { · 33 unmodified lines | |||
| 344 | /* CORB/RIRB and position buffers */ | 325 | /* CORB/RIRB and position buffers */ |
| 345 | struct snd_dma_buffer rb; | 326 | struct snd_dma_buffer rb; |
| 346 | struct snd_dma_buffer posbuf; | 327 | struct snd_dma_buffer posbuf; |
| 328 | int dma_type; /* SNDRV_DMA_TYPE_XXX for CORB/RIRB */ | ||
| 347 | 329 | ||
| 348 | /* hdac_stream linked list */ | 330 | /* hdac_stream linked list */ |
| 349 | struct list_head stream_list; | 331 | struct list_head stream_list; |
| @@ -384,8 +366,7 @@ struct hdac_bus { · 34 unmodified lines | |||
| 384 | }; | 366 | }; |
| 385 | 367 | ||
| 386 | int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev, | 368 | int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev, |
| 387 | const struct hdac_bus_ops *ops, | 369 | const struct hdac_bus_ops *ops); |
| 388 | const struct hdac_io_ops *io_ops); | ||
| 389 | void snd_hdac_bus_exit(struct hdac_bus *bus); | 370 | void snd_hdac_bus_exit(struct hdac_bus *bus); |
| 390 | int snd_hdac_bus_exec_verb(struct hdac_bus *bus, unsigned int addr, | 371 | int snd_hdac_bus_exec_verb(struct hdac_bus *bus, unsigned int addr, |
| 391 | unsigned int cmd, unsigned int *res); | 372 | 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 | |||
| 429 | int snd_hdac_bus_alloc_stream_pages(struct hdac_bus *bus); | 410 | int snd_hdac_bus_alloc_stream_pages(struct hdac_bus *bus); |
| 430 | void snd_hdac_bus_free_stream_pages(struct hdac_bus *bus); | 411 | void snd_hdac_bus_free_stream_pages(struct hdac_bus *bus); |
| 431 | 412 | ||
| 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 | |||
| 432 | /* | 430 | /* |
| 433 | * macros for easy use | 431 | * macros for easy use |
| 434 | */ | 432 | */ |
| 435 | #define _snd_hdac_chip_writeb(chip, reg, value) \ | 433 | #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)) |
| 437 | #define _snd_hdac_chip_readb(chip, reg) \ | 435 | #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)) |
| 439 | #define _snd_hdac_chip_writew(chip, reg, value) \ | 437 | #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)) |
| 441 | #define _snd_hdac_chip_readw(chip, reg) \ | 439 | #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)) |
| 443 | #define _snd_hdac_chip_writel(chip, reg, value) \ | 441 | #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)) |
| 445 | #define _snd_hdac_chip_readl(chip, reg) \ | 443 | #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)) |
| 447 | 445 | ||
| 448 | /* read/write a register, pass without AZX_REG_ prefix */ | 446 | /* read/write a register, pass without AZX_REG_ prefix */ |
| 449 | #define snd_hdac_chip_writel(chip, reg, value) \ | 447 | #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 | |||
| 548 | /* | 546 | /* |
| 549 | * macros for easy use | 547 | * macros for easy use |
| 550 | */ | 548 | */ |
| 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 | |||
| 556 | /* read/write a register, pass without AZX_REG_ prefix */ | 549 | /* read/write a register, pass without AZX_REG_ prefix */ |
| 557 | #define snd_hdac_stream_writel(dev, reg, value) \ | 550 | #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) |
| 559 | #define snd_hdac_stream_writew(dev, reg, value) \ | 552 | #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) |
| 561 | #define snd_hdac_stream_writeb(dev, reg, value) \ | 554 | #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) |
| 563 | #define snd_hdac_stream_readl(dev, reg) \ | 556 | #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) |
| 565 | #define snd_hdac_stream_readw(dev, reg) \ | 558 | #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) |
| 567 | #define snd_hdac_stream_readb(dev, reg) \ | 560 | #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) |
| 569 | 562 | ||
| 570 | /* update a register, pass without AZX_REG_ prefix */ | 563 | /* update a register, pass without AZX_REG_ prefix */ |
| 571 | #define snd_hdac_stream_updatel(dev, reg, mask, val) \ | 564 | #define snd_hdac_stream_updatel(dev, reg, mask, val) \ |
| @@ -6,7 +6,6 @@ · 5 unmodified lines | |||
| 6 | 6 | ||
| 7 | int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev, | 7 | int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev, |
| 8 | const struct hdac_bus_ops *ops, | 8 | const struct hdac_bus_ops *ops, |
| 9 | const struct hdac_io_ops *io_ops, | ||
| 10 | const struct hdac_ext_bus_ops *ext_ops); | 9 | const struct hdac_ext_bus_ops *ext_ops); |
| 11 | 10 | ||
| 12 | void snd_hdac_ext_bus_exit(struct hdac_bus *bus); | 11 | void snd_hdac_ext_bus_exit(struct hdac_bus *bus); |
| @@ -47,6 +47,9 @@ struct hdmi_codec_params { · 46 unmodified lines | |||
| 47 | int channels; | 47 | int channels; |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | typedef void (*hdmi_codec_plugged_cb)(struct device *dev, | ||
| 51 | bool plugged); | ||
| 52 | |||
| 50 | struct hdmi_codec_pdata; | 53 | struct hdmi_codec_pdata; |
| 51 | struct hdmi_codec_ops { | 54 | struct hdmi_codec_ops { |
| 52 | /* | 55 | /* |
| @@ -88,6 +91,14 @@ struct hdmi_codec_ops { · 35 unmodified lines | |||
| 88 | */ | 91 | */ |
| 89 | int (*get_dai_id)(struct snd_soc_component *comment, | 92 | int (*get_dai_id)(struct snd_soc_component *comment, |
| 90 | struct device_node *endpoint); | 93 | 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); | ||
| 91 | }; | 102 | }; |
| 92 | 103 | ||
| 93 | /* HDMI codec initalization data */ | 104 | /* HDMI codec initalization data */ |
| @@ -99,6 +110,12 @@ struct hdmi_codec_pdata { · 5 unmodified lines | |||
| 99 | void *data; | 110 | void *data; |
| 100 | }; | 111 | }; |
| 101 | 112 | ||
| 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 | |||
| 102 | #define HDMI_CODEC_DRV_NAME "hdmi-audio-codec" | 119 | #define HDMI_CODEC_DRV_NAME "hdmi-audio-codec" |
| 103 | 120 | ||
| 104 | #endif /* __HDMI_CODEC_H__ */ | 121 | #endif /* __HDMI_CODEC_H__ */ |
| @@ -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 | ||
| @@ -117,6 +117,8 @@ struct snd_pcm_ops { · 116 unmodified lines | |||
| 117 | #define SNDRV_PCM_RATE_96000 (1<<10) /* 96000Hz */ | 117 | #define SNDRV_PCM_RATE_96000 (1<<10) /* 96000Hz */ |
| 118 | #define SNDRV_PCM_RATE_176400 (1<<11) /* 176400Hz */ | 118 | #define SNDRV_PCM_RATE_176400 (1<<11) /* 176400Hz */ |
| 119 | #define SNDRV_PCM_RATE_192000 (1<<12) /* 192000Hz */ | 119 | #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 */ | ||
| 120 | 122 | ||
| 121 | #define SNDRV_PCM_RATE_CONTINUOUS (1<<30) /* continuous range */ | 123 | #define SNDRV_PCM_RATE_CONTINUOUS (1<<30) /* continuous range */ |
| 122 | #define SNDRV_PCM_RATE_KNOT (1<<31) /* supports more non-continuos rates */ | 124 | #define SNDRV_PCM_RATE_KNOT (1<<31) /* supports more non-continuos rates */ |
| @@ -129,6 +131,9 @@ struct snd_pcm_ops { · 6 unmodified lines | |||
| 129 | SNDRV_PCM_RATE_88200|SNDRV_PCM_RATE_96000) | 131 | SNDRV_PCM_RATE_88200|SNDRV_PCM_RATE_96000) |
| 130 | #define SNDRV_PCM_RATE_8000_192000 (SNDRV_PCM_RATE_8000_96000|SNDRV_PCM_RATE_176400|\ | 132 | #define SNDRV_PCM_RATE_8000_192000 (SNDRV_PCM_RATE_8000_96000|SNDRV_PCM_RATE_176400|\ |
| 131 | SNDRV_PCM_RATE_192000) | 133 | 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) | ||
| 132 | #define _SNDRV_PCM_FMTBIT(fmt) (1ULL << (__force int)SNDRV_PCM_FORMAT_##fmt) | 137 | #define _SNDRV_PCM_FMTBIT(fmt) (1ULL << (__force int)SNDRV_PCM_FORMAT_##fmt) |
| 133 | #define SNDRV_PCM_FMTBIT_S8 _SNDRV_PCM_FMTBIT(S8) | 138 | #define SNDRV_PCM_FMTBIT_S8 _SNDRV_PCM_FMTBIT(S8) |
| 134 | #define SNDRV_PCM_FMTBIT_U8 _SNDRV_PCM_FMTBIT(U8) | 139 | #define SNDRV_PCM_FMTBIT_U8 _SNDRV_PCM_FMTBIT(U8) |
| @@ -25,6 +25,8 @@ extern struct snd_soc_acpi_mach snd_soc_acpi_intel_bxt_machines[]; · 24 unmodified lines | |||
| 25 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_glk_machines[]; | 25 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_glk_machines[]; |
| 26 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[]; | 26 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[]; |
| 27 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_icl_machines[]; | 27 | 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[]; | ||
| 28 | 30 | ||
| 29 | /* | 31 | /* |
| 30 | * generic table used for HDA codec-based platforms, possibly with | 32 | * generic table used for HDA codec-based platforms, possibly with |
| @@ -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 */ | ||
| @@ -145,6 +145,31 @@ int snd_soc_dai_get_channel_map(struct snd_soc_dai *dai, · 144 unmodified lines | |||
| 145 | 145 | ||
| 146 | int snd_soc_dai_is_dummy(struct snd_soc_dai *dai); | 146 | int snd_soc_dai_is_dummy(struct snd_soc_dai *dai); |
| 147 | 147 | ||
| 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 | |||
| 148 | struct snd_soc_dai_ops { | 173 | struct snd_soc_dai_ops { |
| 149 | /* | 174 | /* |
| 150 | * DAI clocking configuration, all optional. | 175 | * DAI clocking configuration, all optional. |
| @@ -268,8 +293,6 @@ struct snd_soc_dai_driver { · 117 unmodified lines | |||
| 268 | /* Optional Callback used at pcm creation*/ | 293 | /* Optional Callback used at pcm creation*/ |
| 269 | int (*pcm_new)(struct snd_soc_pcm_runtime *rtd, | 294 | int (*pcm_new)(struct snd_soc_pcm_runtime *rtd, |
| 270 | struct snd_soc_dai *dai); | 295 | struct snd_soc_dai *dai); |
| 271 | /* DAI is also used for the control bus */ | ||
| 272 | bool bus_control; | ||
| 273 | 296 | ||
| 274 | /* ops */ | 297 | /* ops */ |
| 275 | const struct snd_soc_dai_ops *ops; | 298 | const struct snd_soc_dai_ops *ops; |
| @@ -281,6 +304,7 @@ struct snd_soc_dai_driver { · 5 unmodified lines | |||
| 281 | unsigned int symmetric_rates:1; | 304 | unsigned int symmetric_rates:1; |
| 282 | unsigned int symmetric_channels:1; | 305 | unsigned int symmetric_channels:1; |
| 283 | unsigned int symmetric_samplebits:1; | 306 | unsigned int symmetric_samplebits:1; |
| 307 | unsigned int bus_control:1; /* DAI is also used for the control bus */ | ||
| 284 | 308 | ||
| 285 | /* probe ordering - for components with runtime dependencies */ | 309 | /* probe ordering - for components with runtime dependencies */ |
| 286 | int probe_order; | 310 | int probe_order; |
| @@ -353,6 +353,8 @@ struct device; · 352 unmodified lines | |||
| 353 | #define SND_SOC_DAPM_WILL_PMD 0x80 /* called at start of sequence */ | 353 | #define SND_SOC_DAPM_WILL_PMD 0x80 /* called at start of sequence */ |
| 354 | #define SND_SOC_DAPM_PRE_POST_PMD \ | 354 | #define SND_SOC_DAPM_PRE_POST_PMD \ |
| 355 | (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD) | 355 | (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) | ||
| 356 | 358 | ||
| 357 | /* convenience event type detection */ | 359 | /* convenience event type detection */ |
| 358 | #define SND_SOC_DAPM_EVENT_ON(e) \ | 360 | #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 | |||
| 417 | /* dapm path setup */ | 419 | /* dapm path setup */ |
| 418 | int snd_soc_dapm_new_widgets(struct snd_soc_card *card); | 420 | int snd_soc_dapm_new_widgets(struct snd_soc_card *card); |
| 419 | void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm); | 421 | 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); | ||
| 420 | int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm, | 425 | int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm, |
| 421 | const struct snd_soc_dapm_route *route, int num); | 426 | const struct snd_soc_dapm_route *route, int num); |
| 422 | int snd_soc_dapm_del_routes(struct snd_soc_dapm_context *dapm, | 427 | int snd_soc_dapm_del_routes(struct snd_soc_dapm_context *dapm, |
| @@ -662,8 +667,6 @@ struct snd_soc_dapm_context { · 239 unmodified lines | |||
| 662 | unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */ | 667 | unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */ |
| 663 | /* Go to BIAS_OFF in suspend if the DAPM context is idle */ | 668 | /* Go to BIAS_OFF in suspend if the DAPM context is idle */ |
| 664 | unsigned int suspend_bias_off:1; | 669 | unsigned int suspend_bias_off:1; |
| 665 | void (*seq_notifier)(struct snd_soc_dapm_context *, | ||
| 666 | enum snd_soc_dapm_type, int); | ||
| 667 | 670 | ||
| 668 | struct device *dev; /* from parent - for debug */ | 671 | struct device *dev; /* from parent - for debug */ |
| 669 | struct snd_soc_component *component; /* parent component */ | 672 | struct snd_soc_component *component; /* parent component */ |
| @@ -673,10 +676,6 @@ struct snd_soc_dapm_context { · 3 unmodified lines | |||
| 673 | enum snd_soc_bias_level target_bias_level; | 676 | enum snd_soc_bias_level target_bias_level; |
| 674 | struct list_head list; | 677 | struct list_head list; |
| 675 | 678 | ||
| 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 | |||
| 680 | struct snd_soc_dapm_wcache path_sink_cache; | 679 | struct snd_soc_dapm_wcache path_sink_cache; |
| 681 | struct snd_soc_dapm_wcache path_source_cache; | 680 | struct snd_soc_dapm_wcache path_source_cache; |
| 682 | 681 | ||
| @@ -142,9 +142,16 @@ void snd_soc_dpcm_be_set_state(struct snd_soc_pcm_runtime *be, int stream, · 141 unmodified lines | |||
| 142 | 142 | ||
| 143 | /* internal use only */ | 143 | /* internal use only */ |
| 144 | int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute); | 144 | 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); | ||
| 146 | int soc_dpcm_runtime_update(struct snd_soc_card *); | 145 | int soc_dpcm_runtime_update(struct snd_soc_card *); |
| 147 | 146 | ||
| 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 | |||
| 148 | int dpcm_path_get(struct snd_soc_pcm_runtime *fe, | 155 | int dpcm_path_get(struct snd_soc_pcm_runtime *fe, |
| 149 | int stream, struct snd_soc_dapm_widget_list **list_); | 156 | int stream, struct snd_soc_dapm_widget_list **list_); |
| 150 | int dpcm_process_paths(struct snd_soc_pcm_runtime *fe, | 157 | int dpcm_process_paths(struct snd_soc_pcm_runtime *fe, |
| @@ -362,21 +362,6 @@ · 361 unmodified lines | |||
| 362 | #define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \ | 362 | #define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \ |
| 363 | const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts) | 363 | const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts) |
| 364 | 364 | ||
| 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 | |||
| 380 | /* | 365 | /* |
| 381 | * Bias levels | 366 | * Bias levels |
| 382 | * | 367 | * |
| @@ -505,10 +490,6 @@ int snd_soc_params_to_bclk(struct snd_pcm_hw_params *parms); · 122 unmodified lines | |||
| 505 | int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, | 490 | int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, |
| 506 | const struct snd_pcm_hardware *hw); | 491 | const struct snd_pcm_hardware *hw); |
| 507 | 492 | ||
| 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 | |||
| 512 | /* Jack reporting */ | 493 | /* Jack reporting */ |
| 513 | int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type, | 494 | int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type, |
| 514 | struct snd_soc_jack *jack, struct snd_soc_jack_pin *pins, | 495 | struct snd_soc_jack *jack, struct snd_soc_jack_pin *pins, |
| @@ -751,132 +732,6 @@ struct snd_soc_compr_ops { · 236 unmodified lines | |||
| 751 | int (*trigger)(struct snd_compr_stream *); | 732 | int (*trigger)(struct snd_compr_stream *); |
| 752 | }; | 733 | }; |
| 753 | 734 | ||
| 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 | |||
| 880 | struct snd_soc_rtdcom_list { | 735 | struct snd_soc_rtdcom_list { |
| 881 | struct snd_soc_component *component; | 736 | struct snd_soc_component *component; |
| 882 | struct list_head list; /* rtd::component_list */ | 737 | struct list_head list; /* rtd::component_list */ |
| @@ -1086,6 +941,7 @@ struct snd_soc_dai_link { · 203 unmodified lines | |||
| 1086 | #define COMP_CPU(_dai) { .dai_name = _dai, } | 941 | #define COMP_CPU(_dai) { .dai_name = _dai, } |
| 1087 | #define COMP_CODEC(_name, _dai) { .name = _name, .dai_name = _dai, } | 942 | #define COMP_CODEC(_name, _dai) { .name = _name, .dai_name = _dai, } |
| 1088 | #define COMP_PLATFORM(_name) { .name = _name } | 943 | #define COMP_PLATFORM(_name) { .name = _name } |
| 944 | #define COMP_AUX(_name) { .name = _name } | ||
| 1089 | #define COMP_DUMMY() { .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", } | 945 | #define COMP_DUMMY() { .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", } |
| 1090 | 946 | ||
| 1091 | extern struct snd_soc_dai_link_component null_dailink_component[0]; | 947 | extern struct snd_soc_dai_link_component null_dailink_component[0]; |
| @@ -1107,14 +963,11 @@ struct snd_soc_codec_conf { · 15 unmodified lines | |||
| 1107 | }; | 963 | }; |
| 1108 | 964 | ||
| 1109 | struct snd_soc_aux_dev { | 965 | struct snd_soc_aux_dev { |
| 1110 | const char *name; /* Codec name */ | ||
| 1111 | |||
| 1112 | /* | 966 | /* |
| 1113 | * specify multi-codec either by device name, or by | 967 | * specify multi-codec either by device name, or by |
| 1114 | * DT/OF node, but not both. | 968 | * DT/OF node, but not both. |
| 1115 | */ | 969 | */ |
| 1116 | const char *codec_name; | 970 | struct snd_soc_dai_link_component dlc; |
| 1117 | struct device_node *codec_of_node; | ||
| 1118 | 971 | ||
| 1119 | /* codec/machine specific init - e.g. add machine controls */ | 972 | /* codec/machine specific init - e.g. add machine controls */ |
| 1120 | int (*init)(struct snd_soc_component *component); | 973 | int (*init)(struct snd_soc_component *component); |
| @@ -1135,6 +988,10 @@ struct snd_soc_card { · 14 unmodified lines | |||
| 1135 | struct mutex mutex; | 988 | struct mutex mutex; |
| 1136 | struct mutex dapm_mutex; | 989 | struct mutex dapm_mutex; |
| 1137 | 990 | ||
| 991 | /* Mutex for PCM operations */ | ||
| 992 | struct mutex pcm_mutex; | ||
| 993 | enum snd_soc_pcm_subclass pcm_subclass; | ||
| 994 | |||
| 1138 | spinlock_t dpcm_lock; | 995 | spinlock_t dpcm_lock; |
| 1139 | 996 | ||
| 1140 | bool instantiated; | 997 | bool instantiated; |
| @@ -1203,8 +1060,6 @@ struct snd_soc_card { · 62 unmodified lines | |||
| 1203 | int num_of_dapm_routes; | 1060 | int num_of_dapm_routes; |
| 1204 | bool fully_routed; | 1061 | bool fully_routed; |
| 1205 | 1062 | ||
| 1206 | struct work_struct deferred_resume_work; | ||
| 1207 | |||
| 1208 | /* lists of probed devices belonging to this card */ | 1063 | /* lists of probed devices belonging to this card */ |
| 1209 | struct list_head component_dev_list; | 1064 | struct list_head component_dev_list; |
| 1210 | struct list_head list; | 1065 | struct list_head list; |
| @@ -1224,7 +1079,9 @@ struct snd_soc_card { · 13 unmodified lines | |||
| 1224 | 1079 | ||
| 1225 | #ifdef CONFIG_DEBUG_FS | 1080 | #ifdef CONFIG_DEBUG_FS |
| 1226 | struct dentry *debugfs_card_root; | 1081 | 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; | ||
| 1228 | #endif | 1085 | #endif |
| 1229 | u32 pop_time; | 1086 | u32 pop_time; |
| 1230 | 1087 | ||
| @@ -1234,6 +1091,10 @@ struct snd_soc_card { · 3 unmodified lines | |||
| 1234 | for ((i) = 0; \ | 1091 | for ((i) = 0; \ |
| 1235 | ((i) < (card)->num_links) && ((link) = &(card)->dai_link[i]); \ | 1092 | ((i) < (card)->num_links) && ((link) = &(card)->dai_link[i]); \ |
| 1236 | (i)++) | 1093 | (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)++) | ||
| 1237 | 1098 | ||
| 1238 | #define for_each_card_links(card, link) \ | 1099 | #define for_each_card_links(card, link) \ |
| 1239 | list_for_each_entry(link, &(card)->dai_link_list, list) | 1100 | list_for_each_entry(link, &(card)->dai_link_list, list) |
| @@ -1245,6 +1106,12 @@ struct snd_soc_card { · 5 unmodified lines | |||
| 1245 | #define for_each_card_rtds_safe(card, rtd, _rtd) \ | 1106 | #define for_each_card_rtds_safe(card, rtd, _rtd) \ |
| 1246 | list_for_each_entry_safe(rtd, _rtd, &(card)->rtd_list, list) | 1107 | list_for_each_entry_safe(rtd, _rtd, &(card)->rtd_list, list) |
| 1247 | 1108 | ||
| 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 | |||
| 1248 | #define for_each_card_components(card, component) \ | 1115 | #define for_each_card_components(card, component) \ |
| 1249 | list_for_each_entry(component, &(card)->component_dev_list, card_list) | 1116 | list_for_each_entry(component, &(card)->component_dev_list, card_list) |
| 1250 | 1117 | ||
| @@ -1253,8 +1120,6 @@ struct snd_soc_pcm_runtime { · 2 unmodified lines | |||
| 1253 | struct device *dev; | 1120 | struct device *dev; |
| 1254 | struct snd_soc_card *card; | 1121 | struct snd_soc_card *card; |
| 1255 | struct snd_soc_dai_link *dai_link; | 1122 | struct snd_soc_dai_link *dai_link; |
| 1256 | struct mutex pcm_mutex; | ||
| 1257 | enum snd_soc_pcm_subclass pcm_subclass; | ||
| 1258 | struct snd_pcm_ops ops; | 1123 | struct snd_pcm_ops ops; |
| 1259 | 1124 | ||
| 1260 | unsigned int params_select; /* currently selected param for dai link */ | 1125 | unsigned int params_select; /* currently selected param for dai link */ |
| @@ -1342,134 +1207,6 @@ struct soc_enum { · 81 unmodified lines | |||
| 1342 | struct snd_soc_dobj dobj; | 1207 | struct snd_soc_dobj dobj; |
| 1343 | }; | 1208 | }; |
| 1344 | 1209 | ||
| 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 | |||
| 1473 | /* device driver data */ | 1210 | /* device driver data */ |
| 1474 | 1211 | ||
| 1475 | static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card, | 1212 | 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 | |||
| 1483 | return card->drvdata; | 1220 | return card->drvdata; |
| 1484 | } | 1221 | } |
| 1485 | 1222 | ||
| 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 | |||
| 1507 | static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc) | 1223 | static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc) |
| 1508 | { | 1224 | { |
| 1509 | if (mc->reg == mc->rreg && mc->shift == mc->rshift) | 1225 | 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 | |||
| 1540 | return e->values[item]; | 1256 | return e->values[item]; |
| 1541 | } | 1257 | } |
| 1542 | 1258 | ||
| 1543 | static inline bool snd_soc_component_is_active( | ||
| 1544 | struct snd_soc_component *component) | ||
| 1545 | { | ||
| 1546 | return component->active != 0; | ||
| 1547 | } | ||
| 1548 | |||
| 1549 | /** | 1259 | /** |
| 1550 | * snd_soc_kcontrol_component() - Returns the component that registered the | 1260 | * snd_soc_kcontrol_component() - Returns the component that registered the |
| 1551 | * control | 1261 | * control |
| @@ -1681,24 +1391,6 @@ static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm) · 129 unmodified lines | |||
| 1681 | mutex_unlock(&dapm->card->dapm_mutex); | 1391 | mutex_unlock(&dapm->card->dapm_mutex); |
| 1682 | } | 1392 | } |
| 1683 | 1393 | ||
| 1684 | int snd_soc_component_enable_pin(struct snd_soc_component *component, | 1394 | #include <sound/soc-component.h> |
| 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); | ||
| 1703 | 1395 | ||
| 1704 | #endif | 1396 | #endif |
| @@ -76,6 +76,9 @@ struct sof_ipc_dai_ssp_params { · 75 unmodified lines | |||
| 76 | uint16_t tdm_per_slot_padding_flag; | 76 | uint16_t tdm_per_slot_padding_flag; |
| 77 | uint32_t clks_control; | 77 | uint32_t clks_control; |
| 78 | uint32_t quirks; | 78 | uint32_t quirks; |
| 79 | uint32_t bclk_delay; /* guaranteed time (ms) for which BCLK | ||
| 80 | * will be driven, before sending data | ||
| 81 | */ | ||
| 79 | } __packed; | 82 | } __packed; |
| 80 | 83 | ||
| 81 | /* HDA Configuration Request - SOF_IPC_DAI_HDA_CONFIG */ | 84 | /* HDA Configuration Request - SOF_IPC_DAI_HDA_CONFIG */ |
| @@ -176,4 +179,13 @@ struct sof_ipc_dai_dmic_params { · 94 unmodified lines | |||
| 176 | struct sof_ipc_dai_dmic_pdm_ctrl pdm[0]; | 179 | struct sof_ipc_dai_dmic_pdm_ctrl pdm[0]; |
| 177 | } __packed; | 180 | } __packed; |
| 178 | 181 | ||
| 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 | |||
| 179 | #endif | 191 | #endif |
| @@ -49,7 +49,9 @@ enum sof_ipc_dai_type { · 48 unmodified lines | |||
| 49 | SOF_DAI_INTEL_SSP, /**< Intel SSP */ | 49 | SOF_DAI_INTEL_SSP, /**< Intel SSP */ |
| 50 | SOF_DAI_INTEL_DMIC, /**< Intel DMIC */ | 50 | SOF_DAI_INTEL_DMIC, /**< Intel DMIC */ |
| 51 | SOF_DAI_INTEL_HDA, /**< Intel HD/A */ | 51 | 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 */ | ||
| 53 | }; | 55 | }; |
| 54 | 56 | ||
| 55 | /* general purpose DAI configuration */ | 57 | /* general purpose DAI configuration */ |
| @@ -70,6 +72,7 @@ struct sof_ipc_dai_config { · 14 unmodified lines | |||
| 70 | struct sof_ipc_dai_ssp_params ssp; | 72 | struct sof_ipc_dai_ssp_params ssp; |
| 71 | struct sof_ipc_dai_dmic_params dmic; | 73 | struct sof_ipc_dai_dmic_params dmic; |
| 72 | struct sof_ipc_dai_hda_params hda; | 74 | struct sof_ipc_dai_hda_params hda; |
| 75 | struct sof_ipc_dai_alh_params alh; | ||
| 73 | }; | 76 | }; |
| 74 | } __packed; | 77 | } __packed; |
| 75 | 78 | ||
| @@ -26,7 +26,7 @@ · 25 unmodified lines | |||
| 26 | 26 | ||
| 27 | /* SOF ABI version major, minor and patch numbers */ | 27 | /* SOF ABI version major, minor and patch numbers */ |
| 28 | #define SOF_ABI_MAJOR 3 | 28 | #define SOF_ABI_MAJOR 3 |
| 29 | #define SOF_ABI_MINOR 8 | 29 | #define SOF_ABI_MINOR 10 |
| 30 | #define SOF_ABI_PATCH 0 | 30 | #define SOF_ABI_PATCH 0 |
| 31 | 31 | ||
| 32 | /* SOF ABI version number. Format within 32bit word is MMmmmppp */ | 32 | /* SOF ABI version number. Format within 32bit word is MMmmmppp */ |
| @@ -75,6 +75,7 @@ · 74 unmodified lines | |||
| 75 | #define SOF_TKN_INTEL_SSP_FRAME_PULSE_WIDTH 503 | 75 | #define SOF_TKN_INTEL_SSP_FRAME_PULSE_WIDTH 503 |
| 76 | #define SOF_TKN_INTEL_SSP_QUIRKS 504 | 76 | #define SOF_TKN_INTEL_SSP_QUIRKS 504 |
| 77 | #define SOF_TKN_INTEL_SSP_TDM_PADDING_PER_SLOT 505 | 77 | #define SOF_TKN_INTEL_SSP_TDM_PADDING_PER_SLOT 505 |
| 78 | #define SOF_TKN_INTEL_SSP_BCLK_DELAY 506 | ||
| 78 | 79 | ||
| 79 | /* DMIC */ | 80 | /* DMIC */ |
| 80 | #define SOF_TKN_INTEL_DMIC_DRIVER_VERSION 600 | 81 | #define SOF_TKN_INTEL_DMIC_DRIVER_VERSION 600 |
| @@ -105,4 +106,12 @@ · 24 unmodified lines | |||
| 105 | /* for backward compatibility */ | 106 | /* for backward compatibility */ |
| 106 | #define SOF_TKN_EFFECT_TYPE SOF_TKN_PROCESS_TYPE | 107 | #define SOF_TKN_EFFECT_TYPE SOF_TKN_PROCESS_TYPE |
| 107 | 108 | ||
| 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 | |||
| 108 | #endif | 117 | #endif |