Pull sound updates from Takashi Iwai: "As the diffstat shows we've had again a lot of works done for this cycle: the majority of changes are the continued componentization and code refactoring in ASoC, the tree-wide PCM API updates and cleanups and SOF updates while a few ASoC driver updates are seen, too. Here we go, some highlights: Core: - Finally y2038 support landed to ALSA ABI; some ioctls have been extended and lots of tricks were applied - Applying the new managed PCM buffer API to all drivers; the API itself was already merged in 5.5 - The already deprecated dimension support in ALSA control API is dropped completely now - Verification of ALSA control elements to catch API misuses ASoC: - Further code refactorings and moving things to the component level - Lots of updates and improvements on SOF / Intel drivers; now including common HDMI driver and SoundWire support - New driver support for Ingenic JZ4770, Mediatek MT6660, Qualcomm WCD934x and WSA881x, and Realtek RT700, RT711, RT715, RT1011, RT1015 and RT1308 HD-audio: - Improved ring-buffer communications using waitqueue - Drop the superfluous buffer preallocation on x86 Others: - Many code cleanups, mostly constifications over the whole tree - USB-audio: quirks for MOTU, Corsair Virtuoso, Line6 Helix - FireWire: code refactoring for oxfw and dice drivers" * tag 'sound-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (638 commits) ALSA: usb-audio: add quirks for Line6 Helix devices fw>=2.82 ALSA: hda: Add Clevo W65_67SB the power_save blacklist ASoC: soc-core: remove null_snd_soc_ops ASoC: soc-pcm: add soc_rtd_trigger() ASoC: soc-pcm: add soc_rtd_hw_free() ASoC: soc-pcm: add soc_rtd_hw_params() ASoC: soc-pcm: add soc_rtd_prepare() ASoC: soc-pcm: add soc_rtd_shutdown() ASoC: soc-pcm: add soc_rtd_startup() ASoC: rt1015: add rt1015 amplifier driver ASoC: madera: Correct some kernel doc ASoC: topology: fix soc_tplg_fe_link_create() - link->dobj initialization order ASoC: Intel: skl_hda_dsp_common: Fix global-out-of-bounds bug ASoC: madera: Correct DMIC only input hook ups ALSA: cs46xx: fix spelling mistake "to" -> "too" ALSA: hda - Add docking station support for Lenovo Thinkpad T420s ASoC: Add MediaTek MT6660 Speaker Amp Driver ASoC: dt-bindings: rt5645: add suppliers ASoC: max98090: fix deadlock in max98090_dapm_put_enum_double() ASoC: dapm: add snd_soc_dapm_put_enum_double_locked ...
Showing the changes to include/linux (2 of 617 files). Show all
Unified · Split
| @@ -547,6 +547,20 @@ struct sdw_slave_ops { · 546 unmodified lines | ||
| 547 | 547 | * @node: node for bus list |
| 548 | 548 | * @port_ready: Port ready completion flag for each Slave port |
| 549 | 549 | * @dev_num: Device Number assigned by Bus |
| 550 | + * @probed: boolean tracking driver state | |
| 551 | + * @probe_complete: completion utility to control potential races | |
| 552 | + * on startup between driver probe/initialization and SoundWire | |
| 553 | + * Slave state changes/implementation-defined interrupts | |
| 554 | + * @enumeration_complete: completion utility to control potential races | |
| 555 | + * on startup between device enumeration and read/write access to the | |
| 556 | + * Slave device | |
| 557 | + * @initialization_complete: completion utility to control potential races | |
| 558 | + * on startup between device enumeration and settings being restored | |
| 559 | + * @unattach_request: mask field to keep track why the Slave re-attached and | |
| 560 | + * was re-initialized. This is useful to deal with potential race conditions | |
| 561 | + * between the Master suspending and the codec resuming, and make sure that | |
| 562 | + * when the Master triggered a reset the Slave is properly enumerated and | |
| 563 | + * initialized | |
| 550 | 564 | */ |
| 551 | 565 | struct sdw_slave { |
| 552 | 566 | struct sdw_slave_id id; |
| @@ -561,6 +575,11 @@ struct sdw_slave { · 8 unmodified lines | ||
| 561 | 575 | struct list_head node; |
| 562 | 576 | struct completion *port_ready; |
| 563 | 577 | u16 dev_num; |
| 578 | + bool probed; | |
| 579 | + struct completion probe_complete; | |
| 580 | + struct completion enumeration_complete; | |
| 581 | + struct completion initialization_complete; | |
| 582 | + u32 unattach_request; | |
| 564 | 583 | }; |
| 565 | 584 | |
| 566 | 585 | #define dev_to_sdw_dev(_dev) container_of(_dev, struct sdw_slave, dev) |
| @@ -4,36 +4,174 @@ · 3 unmodified lines | ||
| 4 | 4 | #ifndef __SDW_INTEL_H |
| 5 | 5 | #define __SDW_INTEL_H |
| 6 | 6 | |
| 7 | +#include <linux/irqreturn.h> | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * struct sdw_intel_stream_params_data: configuration passed during | |
| 11 | + * the @params_stream callback, e.g. for interaction with DSP | |
| 12 | + * firmware. | |
| 13 | + */ | |
| 14 | +struct sdw_intel_stream_params_data { | |
| 15 | + struct snd_pcm_substream *substream; | |
| 16 | + struct snd_soc_dai *dai; | |
| 17 | + struct snd_pcm_hw_params *hw_params; | |
| 18 | + int link_id; | |
| 19 | + int alh_stream_id; | |
| 20 | +}; | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * struct sdw_intel_stream_free_data: configuration passed during | |
| 24 | + * the @free_stream callback, e.g. for interaction with DSP | |
| 25 | + * firmware. | |
| 26 | + */ | |
| 27 | +struct sdw_intel_stream_free_data { | |
| 28 | + struct snd_pcm_substream *substream; | |
| 29 | + struct snd_soc_dai *dai; | |
| 30 | + int link_id; | |
| 31 | +}; | |
| 32 | + | |
| 7 | 33 | /** |
| 8 | 34 | * struct sdw_intel_ops: Intel audio driver callback ops |
| 9 | 35 | * |
| 10 | − * @config_stream: configure the stream with the hw_params | |
| 11 | − * the first argument containing the context is mandatory | |
| 12 | 36 | */ |
| 13 | 37 | struct sdw_intel_ops { |
| 14 | − int (*config_stream)(void *arg, void *substream, | |
| 15 | − void *dai, void *hw_params, int stream_num); | |
| 38 | + int (*params_stream)(struct device *dev, | |
| 39 | + struct sdw_intel_stream_params_data *params_data); | |
| 40 | + int (*free_stream)(struct device *dev, | |
| 41 | + struct sdw_intel_stream_free_data *free_data); | |
| 42 | +}; | |
| 43 | + | |
| 44 | +/** | |
| 45 | + * struct sdw_intel_acpi_info - Soundwire Intel information found in ACPI tables | |
| 46 | + * @handle: ACPI controller handle | |
| 47 | + * @count: link count found with "sdw-master-count" property | |
| 48 | + * @link_mask: bit-wise mask listing links enabled by BIOS menu | |
| 49 | + * | |
| 50 | + * this structure could be expanded to e.g. provide all the _ADR | |
| 51 | + * information in case the link_mask is not sufficient to identify | |
| 52 | + * platform capabilities. | |
| 53 | + */ | |
| 54 | +struct sdw_intel_acpi_info { | |
| 55 | + acpi_handle handle; | |
| 56 | + int count; | |
| 57 | + u32 link_mask; | |
| 58 | +}; | |
| 59 | + | |
| 60 | +struct sdw_intel_link_res; | |
| 61 | + | |
| 62 | +/* Intel clock-stop/pm_runtime quirk definitions */ | |
| 63 | + | |
| 64 | +/* | |
| 65 | + * Force the clock to remain on during pm_runtime suspend. This might | |
| 66 | + * be needed if Slave devices do not have an alternate clock source or | |
| 67 | + * if the latency requirements are very strict. | |
| 68 | + */ | |
| 69 | +#define SDW_INTEL_CLK_STOP_NOT_ALLOWED BIT(0) | |
| 70 | + | |
| 71 | +/* | |
| 72 | + * Stop the bus during pm_runtime suspend. If set, a complete bus | |
| 73 | + * reset and re-enumeration will be performed when the bus | |
| 74 | + * restarts. This mode shall not be used if Slave devices can generate | |
| 75 | + * in-band wakes. | |
| 76 | + */ | |
| 77 | +#define SDW_INTEL_CLK_STOP_TEARDOWN BIT(1) | |
| 78 | + | |
| 79 | +/* | |
| 80 | + * Stop the bus during pm_suspend if Slaves are not wake capable | |
| 81 | + * (e.g. speaker amplifiers). The clock-stop mode is typically | |
| 82 | + * slightly higher power than when the IP is completely powered-off. | |
| 83 | + */ | |
| 84 | +#define SDW_INTEL_CLK_STOP_WAKE_CAPABLE_ONLY BIT(2) | |
| 85 | + | |
| 86 | +/* | |
| 87 | + * Require a bus reset (and complete re-enumeration) when exiting | |
| 88 | + * clock stop modes. This may be needed if the controller power was | |
| 89 | + * turned off and all context lost. This quirk shall not be used if a | |
| 90 | + * Slave device needs to remain enumerated and keep its context, | |
| 91 | + * e.g. to provide the reasons for the wake, report acoustic events or | |
| 92 | + * pass a history buffer. | |
| 93 | + */ | |
| 94 | +#define SDW_INTEL_CLK_STOP_BUS_RESET BIT(3) | |
| 95 | + | |
| 96 | +/** | |
| 97 | + * struct sdw_intel_ctx - context allocated by the controller | |
| 98 | + * driver probe | |
| 99 | + * @count: link count | |
| 100 | + * @mmio_base: mmio base of SoundWire registers, only used to check | |
| 101 | + * hardware capabilities after all power dependencies are settled. | |
| 102 | + * @link_mask: bit-wise mask listing SoundWire links reported by the | |
| 103 | + * Controller | |
| 104 | + * @handle: ACPI parent handle | |
| 105 | + * @links: information for each link (controller-specific and kept | |
| 106 | + * opaque here) | |
| 107 | + * @link_list: list to handle interrupts across all links | |
| 108 | + * @shim_lock: mutex to handle concurrent rmw access to shared SHIM registers. | |
| 109 | + */ | |
| 110 | +struct sdw_intel_ctx { | |
| 111 | + int count; | |
| 112 | + void __iomem *mmio_base; | |
| 113 | + u32 link_mask; | |
| 114 | + acpi_handle handle; | |
| 115 | + struct sdw_intel_link_res *links; | |
| 116 | + struct list_head link_list; | |
| 117 | + struct mutex shim_lock; /* lock for access to shared SHIM registers */ | |
| 16 | 118 | }; |
| 17 | 119 | |
| 18 | 120 | /** |
| 19 | − * struct sdw_intel_res - Soundwire Intel resource structure | |
| 121 | + * struct sdw_intel_res - Soundwire Intel global resource structure, | |
| 122 | + * typically populated by the DSP driver | |
| 123 | + * | |
| 124 | + * @count: link count | |
| 20 | 125 | * @mmio_base: mmio base of SoundWire registers |
| 21 | 126 | * @irq: interrupt number |
| 22 | 127 | * @handle: ACPI parent handle |
| 23 | 128 | * @parent: parent device |
| 24 | 129 | * @ops: callback ops |
| 25 | − * @arg: callback arg | |
| 130 | + * @dev: device implementing hwparams and free callbacks | |
| 131 | + * @link_mask: bit-wise mask listing links selected by the DSP driver | |
| 132 | + * This mask may be a subset of the one reported by the controller since | |
| 133 | + * machine-specific quirks are handled in the DSP driver. | |
| 134 | + * @clock_stop_quirks: mask array of possible behaviors requested by the | |
| 135 | + * DSP driver. The quirks are common for all links for now. | |
| 26 | 136 | */ |
| 27 | 137 | struct sdw_intel_res { |
| 138 | + int count; | |
| 28 | 139 | void __iomem *mmio_base; |
| 29 | 140 | int irq; |
| 30 | 141 | acpi_handle handle; |
| 31 | 142 | struct device *parent; |
| 32 | 143 | const struct sdw_intel_ops *ops; |
| 33 | − void *arg; | |
| 144 | + struct device *dev; | |
| 145 | + u32 link_mask; | |
| 146 | + u32 clock_stop_quirks; | |
| 34 | 147 | }; |
| 35 | 148 | |
| 36 | −void *sdw_intel_init(acpi_handle *parent_handle, struct sdw_intel_res *res); | |
| 37 | −void sdw_intel_exit(void *arg); | |
| 149 | +/* | |
| 150 | + * On Intel platforms, the SoundWire IP has dependencies on power | |
| 151 | + * rails shared with the DSP, and the initialization steps are split | |
| 152 | + * in three. First an ACPI scan to check what the firmware describes | |
| 153 | + * in DSDT tables, then an allocation step (with no hardware | |
| 154 | + * configuration but with all the relevant devices created) and last | |
| 155 | + * the actual hardware configuration. The final stage is a global | |
| 156 | + * interrupt enable which is controlled by the DSP driver. Splitting | |
| 157 | + * these phases helps simplify the boot flow and make early decisions | |
| 158 | + * on e.g. which machine driver to select (I2S mode, HDaudio or | |
| 159 | + * SoundWire). | |
| 160 | + */ | |
| 161 | +int sdw_intel_acpi_scan(acpi_handle *parent_handle, | |
| 162 | + struct sdw_intel_acpi_info *info); | |
| 163 | + | |
| 164 | +void sdw_intel_process_wakeen_event(struct sdw_intel_ctx *ctx); | |
| 165 | + | |
| 166 | +struct sdw_intel_ctx * | |
| 167 | +sdw_intel_probe(struct sdw_intel_res *res); | |
| 168 | + | |
| 169 | +int sdw_intel_startup(struct sdw_intel_ctx *ctx); | |
| 170 | + | |
| 171 | +void sdw_intel_exit(struct sdw_intel_ctx *ctx); | |
| 172 | + | |
| 173 | +void sdw_intel_enable_irq(void __iomem *mmio_base, bool enable); | |
| 174 | + | |
| 175 | +irqreturn_t sdw_intel_thread(int irq, void *dev_id); | |
| 38 | 176 | |
| 39 | 177 | #endif |