ASoC: Add TI TAC5XX2 SoundWire codec driver support
Subsystems (4)
v14 cover ASoC: Add TI TAC5XX2 SoundWire codec driver support
This patch series adds support for Texas Instruments TAC5XX2 family of SoundWire smart amplifiers, including TAC5572, TAC5672, TAC5682, and TAS2883 devices.
The series includes:
- SDCA power state management helper for PDE verification
- New codec driver for TAC5XX2 family with SmartAmp, SmartMic, UAJ, and HID support
- Machine driver integration for Intel SoundWire platforms
- ACPI match entries for Intel MTL platform
Changes in v14:
- Resending complete series (v13 1/4 was accidentally sent alone)
- rename the first_hw_init to first_hw_init_done for readability.
- Removed dummy tac5xx2_sdw_clk_stop function (Patch 2/4)
- Added pm_runtime calls in .set_jack callback (Patch 2/4)
- Improved error handling for early .set_jack calls (Patch 2/4)
- drop uaj_lock to make it simiar to other drivers (Patch 2/4)
- move the pm_runtime_enable to probe and keep only pm_runtime_set_active for first attach case. (Patch 2/4)
- remove tac5xx2_sdw_clk_stop as currently it is dummy (Patch 2/4)
- Used xmas tree style in .hw_free (Patch 2/4)
Changes in v13:
- no code changes (v13 1/4 was sent alone accidentally)
Changes in v12:
- Used correct namespace while exporting variables (Patch 1/4)
- Fixed missing entity information in logging (Patch 1/4)
- Removed hw_init check in .set_jack (Patch 2/4)
- Added missing pm_runtime_disable in .remove callback (Patch 2/4)
- Improved error logging in .hw_params and .hw_free (Patch 2/4)
- Included part_id in firmware binary name (Patch 2/4)
- Updated firmware header parsing (Patch 2/4)
Niranjan H Y (4):
ASoC: SDCA: Add PDE verification reusable helper
ASoC: tac5xx2-sdw: add soundwire based codec driver
ASoC: sdw_utils: TI amp utility for tac5xx2 family
ASoC: tac5xx2-sdw: ACPI match for intel mtl platform
include/sound/sdca_asoc.h | 6 + include/sound/soc_sdw_utils.h | 4 + sound/soc/codecs/Kconfig | 11 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/tac5xx2-sdw.c | 2057 +++++++++++++++++ sound/soc/codecs/tac5xx2.h | 259 +++ .../intel/common/soc-acpi-intel-mtl-match.c | 132 ++ sound/soc/sdca/sdca_asoc.c | 106 +- sound/soc/sdw_utils/soc_sdw_ti_amp.c | 144 +- sound/soc/sdw_utils/soc_sdw_utils.c | 151 ++ 10 files changed, 2841 insertions(+), 31 deletions(-) create mode 100644 sound/soc/codecs/tac5xx2-sdw.c create mode 100644 sound/soc/codecs/tac5xx2.h
Signature · 1 line
2.34.1
PATCH v14 1/4 ASoC: SDCA: Add PDE verification reusable helper
Implement sdca_asoc_pde_ensure_ps() helper function to poll for PDE
power state transitions. Per SDCA specification, after writing REQUESTED_PS, drivers must poll ACTUAL_PS until the target power state is reached.
Changes include:
- Add sdca_asoc_pde_ensure_ps() to handle ACTUAL_PS polling with support for device-specific delay tables or default intervals
- Export function via sdca_asoc.h for use by SDCA-compliant drivers
- Refactor entity_pde_event() in sdca_asoc.c to use the helper
---
v14:
- Resending complete series (v13 1/4 was accidentally sent alone)
- No code changes from v13
v13:
- no change
v12:
- use correct namespace while exporting the variable
- fix missing entity information while logging
v11:
- revert v10 changes
- API is renamed from sdca_asoc_pde_ensure_ps to
sdca_asoc_pde_poll_actual_ps
v10:
- write REQUESTED_PS before checking the target state.
- change the API name sdca_asoc_pde_ensure_ps to sdca_asoc_set_pde_poll_sync
v9:
- newly added interface
--- include/sound/sdca_asoc.h | 6 +++ sound/soc/sdca/sdca_asoc.c | 106 ++++++++++++++++++++++++++----------- 2 files changed, 82 insertions(+), 30 deletions(-)
include/sound/sdca_asoc.h +6 -0
@@ -13,6 +13,7 @@struct device ;struct regmap ;struct sdca_function_data ; +struct sdca_pde_delay ;struct snd_ctl_elem_value ;struct snd_kcontrol ;struct snd_kcontrol_new ;
@@ -99,4 +100,9 @@ int sdca_asoc_q78_put_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);int sdca_asoc_q78_get_volsw (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol); +int sdca_asoc_pde_poll_actual_ps (struct device *dev,struct regmap *regmap, +int function_id,int entity_id, +int from_ps,int to_ps, +const struct sdca_pde_delay *pde_delays, +int num_delays);#endif // __SDCA_ASOC_H__
sound/soc/sdca/sdca_asoc.c +76 -30
124 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v14 2/4 ASoC: tac5xx2-sdw: add soundwire based codec driver
In reply to Niranjan H YAdd codec driver for tac5xx2 family of devices. This includes the support for
1. tac5572 - DAC, PDM, UAJ and HID
2. tas2883 - Amplifier with DSP
3. tac5672 - Similar to tac5572 with feedback
4. tac5682 - Similar to tac5672 with Amplifier DSP.
---
v14:
- Resending complete series (v13 1/4 was accidentally sent alone)
- rename the first_hw_init to first_hw_init_done for readability.
- drop uaj_lock to make it simiar to other drivers
- move the pm_runtime_enable to probe and keep only pm_runtime_set_active for first attach case.
- call pm_runtime_get_sync and pm_runtime_put_autosuspend in .set_jack
- handle early call to .set_jack when is it called before first "attach"
- remove tac5xx2_sdw_clk_stop as currently it is dummy
- nit-pick in .hw_free to use xmas tree
v13:
- no change (this patch was not sent as part of v13 series)
v12:
- remove check for hw_init in the .set_jack and let regcache handle the device writes correcty.
- add missing pm_rutime_disable in the .remove callback
- improve error logging in .hw_params and .hw_free for pde entities
- improve .hw_free to throw error for unknown dai id
- include part_id in the firmware binary name to avoid potential name collision while using multiple codecs which doesn't have unqiue_id
- updated firmware header parsing to include updated header and log debug information.
v11:
- refactor code for resume to wait for the initialisation to complete and then proceed.
- replace the sdca_asoc_set_pde_pool_sync with sdca_asoc_pde_poll_actual_ps
v10:
- use sdca helper sdca_asoc_set_pde_poll_sync for
changing the power states.
- register .set_jack callback only for if uaj is
available.
v9:
- Update tac5xx2-sdw.c hw_params() and hw_free() to use new SDCA helper sdca_asoc_pde_ensure_ps
- Remove redundant PPU11 initialization as it is there as part of the initialisation table.
- remove unnecessary default value writes for latch clear as the register.
- Improve jack detection and PDE power state transition comments
v8:
- disable interrupts in .set_jack if jack is set to NULL
- hold uaj_lock in .set_jack
- remove unwanted interrupt enable in initialisation
v7:
- refactor remove the cx11, cs18 and cs11 they are not required to be configured for mic
- fix error handling and interrupt cleanup in .set_jack
- fix typo in Kconfig
v6:
- move firmware caching trigger from soundwire bus callback to soundwire probe and make it asynchronous
- validate the firmware fully before starting firmware.
- drop mixer control for cx11 configuration
- check the actual power state in .hw_free after requesting power state transition to power off
- use dev_is_pci() and remove CONFIG_PCI
v5:
- add missing pde_lock while accessing the current power state.
- add uaj_lock to serialize uaj detection update
- return error, if any, returned by sdw_stream_add_slave in hw_parms
- drop snd_soc_unregister_component as we are using devm_snd_soc_register_component
- fix issue in error handling for invalid firmware
- remove unsupported line in/out detection in jack detection
- refactor the jack and button detection logic to be based on their respective interrupt
v4:
- make volume controls as stereo controls for amp gain, playback, dmic and uaj playback.
- better error handling for "CX11 CS Select" mixer control.
- use switch statement for scalability in hw_params and hw_free
- remove unnecessary else in tac_io_init
- change error log for unsupported sample rates to debug logs
- make firmware binary parsing robust by checking the fw size during caching and parsing
v3:
- use macro SDCA_SINGLE_Q78_TLV for the volume mixer controls
- replace magic number with macro for current owner
- fix debug log message about the current owner for hid event
v2:
- Define and use consistent macros for register access to improve code readability and maintainability
- Replace complex event handlers with simpler DAPM widget implementations using direct register control for muting/unmuting and enabling/disabling components
- Replace custom volume controls with standard Q7.8 controls from the SDCA framework
- Fix PDE power state transitions with proper verification of actual power state
- Combine separate locks into a single ops\_lock to protect both firmware operations and power state transitions
- Clean up interrupt handling by removing unnecessary register accesses
- Fix headset microphone control by using the correct mono channel value
- Add comments to clarify firmware handling and critical sections
--- sound/soc/codecs/Kconfig | 11 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/tac5xx2-sdw.c | 2057 ++++++++++++++++++++++++++++++++ sound/soc/codecs/tac5xx2.h | 259 ++++ 4 files changed, 2329 insertions(+) create mode 100644 sound/soc/codecs/tac5xx2-sdw.c create mode 100644 sound/soc/codecs/tac5xx2.h
sound/soc/codecs/Kconfig +11 -0
@@ -264,6 +264,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_STA529 imply SND_SOC_STAC9766 imply SND_SOC_STI_SAS + imply SND_SOC_TAC5XX2_SDW imply SND_SOC_TAS2552 imply SND_SOC_TAS2562 imply SND_SOC_TAS2764
@@ -2140,6 +2141,16 @@ config SND_SOC_STAC9766 config SND_SOC_STI_SAS tristate "codec Audio support for STI SAS codec" +config SND_SOC_TAC5XX2_SDW + tristate "Texas Instruments TAC5XX2 SoundWire Smart Amplifier" + depends on SOUNDWIRE + depends on SND_SOC_SDCA + help + This option enables support for Texas Instruments TAC5XX2 family + of SoundWire Smart Amplifiers. This includes TAC5572, TAC5672, + TAC5682 and TAS2883. To compile this driver as a module, choose + M here: the module will be called snd-soc-tac5xx2. + config SND_SOC_TAS2552 tristate "Texas Instruments TAS2552 Mono Audio amplifier" depends on I2C
sound/soc/codecs/Makefile +2 -0
@@ -313,6 +313,7 @@ snd-soc-sta350-y := sta350.o snd-soc-sta529-y := sta529.o snd-soc-stac9766-y := stac9766.o snd-soc-sti-sas-y := sti-sas.o +snd-soc-tac5xx2-sdw-y := tac5xx2-sdw.o snd-soc-tas5086-y := tas5086.o snd-soc-tas571x-y := tas571x.o snd-soc-tas5720-y := tas5720.o
@@ -747,6 +748,7 @@ obj-$(CONFIG_SND_SOC_STA350) += snd-soc-sta350.o obj-$(CONFIG_SND_SOC_STA529) += snd-soc-sta529.o obj-$(CONFIG_SND_SOC_STAC9766) += snd-soc-stac9766.o obj-$(CONFIG_SND_SOC_STI_SAS) += snd-soc-sti-sas.o +obj-$(CONFIG_SND_SOC_TAC5XX2_SDW) += snd-soc-tac5xx2-sdw.o obj-$(CONFIG_SND_SOC_TAS2552) += snd-soc-tas2552.o obj-$(CONFIG_SND_SOC_TAS2562) += snd-soc-tas2562.o obj-$(CONFIG_SND_SOC_TAS2764) += snd-soc-tas2764.o
sound/soc/codecs/tac5xx2-sdw.c new file +2057 -0
2,057 lines not on this page · raw message
sound/soc/codecs/tac5xx2.h new file +259 -0
259 lines not on this page · raw message
Signature · 1 line
2.34.1
Pierre-Louis Bossart
reviewerRe: [PATCH v14 2/4] ASoC: tac5xx2-sdw: add soundwire based codec driver
Quoted 8 lines · Niranjan H Y
Add codec driver for tac5xx2 family of devices. This includes the support for
1. tac5572 - DAC, PDM, UAJ and HID
2. tas2883 - Amplifier with DSP
3. tac5672 - Similar to tac5572 with feedback
4. tac5682 - Similar to tac5672 with Amplifier DSP.Signed-off-by Niranjan H Y <[email protected]>
Quoted 13 lines
---
v14:
- Resending complete series (v13 1/4 was accidentally sent alone)
- rename thefirst_hw_inittofirst_hw_init_donefor readability.
- dropuaj_lockto make it simiar to other drivers
- move thepm_runtime_enableto probe and keep onlypm_runtime_set_activefor first attach case.
- callpm_runtime_get_syncandpm_runtime_put_autosuspendin .set_jack
- handle early call to .set_jack when is it called before first "attach"
- removetac5xx2_sdw_clk_stopas currently it is dummy
- nit-pick in .hw_free to use xmas tree
starting to look good, see a couple of relatively minor comments below - and one important one on the component probe.
Quoted 5 lines
sound/soc/codecs/tac5xx2-sdw.c new file +5
-0+static int tac_sdw_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params, +struct snd_soc_dai *dai) +{ +struct snd_soc_component *component = dai->component;
sound/soc/codecs/tac5xx2-sdw.c line 683
Quoted 10 lines
sound/soc/codecs/tac5xx2-sdw.c new file +10
-0+struct tac5xx2_prv *tac_dev =snd_soc_component_get_drvdata (component); +struct sdw_stream_config stream_config = {0 }; +struct sdw_port_config port_config = {0 }; +struct sdw_stream_runtime *sdw_stream; +struct sdw_slave *sdw_peripheral = tac_dev->sdw_peripheral; +int ret; +int function_id; +int pde_entity; +int port_num; +u8 sample_rate_idx =0 ;
nit-pick: reverse xmas-tree on the last variables.
sound/soc/codecs/tac5xx2-sdw.c line 1055
Quoted 8 lines
sound/soc/codecs/tac5xx2-sdw.c new file +8
-0+static int tac_interrupt_callback (struct sdw_slave *slave, +struct sdw_slave_intr_status *status) +{ +struct tac5xx2_prv *tac_dev =dev_get_drvdata (&slave->dev); +struct device *dev = &slave->dev; +int ret =0 ; +int btn_type =0 ; +unsigned int sdca_int2, sdca_int3, jack_report_mask =0 ;
nit-pick: reverse xmas-tree.
Quoted 6 lines
sound/soc/codecs/tac5xx2-sdw.c new file +6
-0+static s32 tac_component_probe (struct snd_soc_component *component) +{ +struct tac5xx2_prv *tac_dev = +snd_soc_component_get_drvdata (component); +struct device *dev = tac_dev->dev; +struct sdw_slave *slave = tac_dev->sdw_peripheral;
sound/soc/codecs/tac5xx2-sdw.c line 1321
Quoted 10 lines
sound/soc/codecs/tac5xx2-sdw.c new file +10
-0+unsigned long time; +int ret; + +/* Wait for SoundWire hw initialization to complete */ + time =wait_for_completion_timeout (&slave->initialization_complete, +msecs_to_jiffies (TAC5XX2_PROBE_TIMEOUT_MS )); +if (!time) { +dev_warn (dev,"%s: hw initialization timeout\n" , __func__); +return -ETIMEDOUT ; + }
are you sure this is needed? Or if this even works, if the card creation happens after the bus goes to clock-stop, then you will always timeout here.
If you look at commit 011e397 "ASoC: codecs: soundwire: call pm_runtime_resume() in component probe" it's simpler to force the bus+codec to resume, no?
sound/soc/codecs/tac5xx2-sdw.c line 1324
Quoted 3 lines
sound/soc/codecs/tac5xx2-sdw.c new file +3
-0+ +if (!tac_has_uaj_support (tac_dev)) + goto done_comp_probe;
Is this really the case that you only have controls+routes for the UAJ function?
Quoted 23 lines
sound/soc/codecs/tac5xx2-sdw.c new file +23
-0+ ret =snd_soc_dapm_new_controls (snd_soc_component_to_dapm (component), + tac_uaj_widgets, +ARRAY_SIZE (tac_uaj_widgets)); +if (ret) { +dev_err (component->dev,"Failed to add UAJ widgets: %d\n" , ret); +return ret; + } + + ret =snd_soc_dapm_add_routes (snd_soc_component_to_dapm (component), + tac_uaj_routes,ARRAY_SIZE (tac_uaj_routes)); +if (ret) { +dev_err (component->dev,"Failed to add UAJ routes: %d\n" , ret); +return ret; + } + + ret =snd_soc_add_component_controls (component, tac_uaj_controls, +ARRAY_SIZE (tac_uaj_controls)); +if (ret) { +dev_err (dev,"Failed to add UAJ controls: %d\n" , ret); +return ret; + } + +done_comp_probe:
sound/soc/codecs/tac5xx2-sdw.c line 1378
Quoted 10 lines
sound/soc/codecs/tac5xx2-sdw.c new file +9
-0+ tac_dev->component = component; +return 0 ; +} +static s32 tac_init (struct tac5xx2_prv *tac_dev) +{ +s32 ret; +struct snd_soc_dai_driver *dai_drv; +struct snd_soc_component_driver *component_driver; +int num_dais;
nit-pick: reverse xmas-tree.
sound/soc/codecs/tac5xx2-sdw.c line 1447
Quoted 7 lines
sound/soc/codecs/tac5xx2-sdw.c new file +7
-0+static s32 tac5xx2_sdca_dev_resume (struct device *dev) +{ +struct sdw_slave *slave =dev_to_sdw_dev (dev); +struct tac5xx2_prv *tac_dev =dev_get_drvdata (dev); +unsigned long t; +int ret; +bool had_unattached = false;
nit-pick: reverse xmas-tree.
Quoted 23 lines
sound/soc/codecs/tac5xx2-sdw.c new file +23
-0+ +if (!tac_dev->first_hw_init_done) { +dev_dbg (dev,"Device not initialized yet, skipping resume sync\n" ); +return 0 ; + } + +if (!slave->unattach_request) + goto regmap_sync; + + had_unattached = true; + t =wait_for_completion_timeout (&slave->initialization_complete, +msecs_to_jiffies (TAC5XX2_PROBE_TIMEOUT_MS )); +if (!t) { +dev_err (&slave->dev,"resume: initialization timed out\n" ); +sdw_show_ping_status (slave->bus, true); +return -ETIMEDOUT ; + } + slave->unattach_request =0 ; + +/* Detect and set jack type for UAJ path before playback. +* This is required as jack detection does not trigger interrupt +* when device is in runtime_pm suspend with bus in clock stop mode. +*/
sound/soc/codecs/tac5xx2-sdw.c line 1480
Quoted 10 lines
sound/soc/codecs/tac5xx2-sdw.c new file +10
-0+tac5xx2_sdca_headset_detect (tac_dev); + +regmap_sync: +regcache_cache_only (tac_dev->regmap, false); +if (!had_unattached) { +regcache_mark_dirty (tac_dev->regmap); + ret =regcache_sync (tac_dev->regmap); +if (ret <0 ) +dev_warn (dev,"Failed to sync regcache: %d\n" , ret); + }
can you explain why you have this extra test with had_unattached and if this is really useful? I don't recall having seen this before on any other driver.
sound/soc/codecs/tac5xx2-sdw.c line 1538
Quoted 12 lines
sound/soc/codecs/tac5xx2-sdw.c new file +12
-0+static void tac5xx2_fw_ready (const struct firmware *fmw,void *context) +{ +s32 ret =0 ; +u32 fw_hdr_size; +size_t img_sz; +u32 offset; +u32 num_files =0 ; +struct tm tm_time; +struct tac_fw_hdr hdr; +struct tac_fw_file *files; +u8 *buf; +struct tac5xx2_prv *tac_dev = context;
nit-pick: reverse xmas-tree.
sound/soc/codecs/tac5xx2-sdw.c line 1629
Quoted 6 lines
sound/soc/codecs/tac5xx2-sdw.c new file +6
-0+static int tac_download (struct tac5xx2_prv *tac_dev) +{ +int ret =0 ; +u32 i; +struct tac_fw_file *files = tac_dev->fw_files; +u32 num_files = tac_dev->fw_file_cnt;
nit-pick: reverse xmas-tree.
sound/soc/codecs/tac5xx2-sdw.c line 1699
Quoted 5 lines
sound/soc/codecs/tac5xx2-sdw.c new file +5
-0+static int tac_io_init (struct device *dev,struct sdw_slave *slave,bool first) +{ +int ret; +u64 time; +struct tac5xx2_prv *tac_dev =dev_get_drvdata (dev);
nit-pick: reverse xmas-tree.
sound/soc/codecs/tac5xx2-sdw.c line 1814
Quoted 7 lines
sound/soc/codecs/tac5xx2-sdw.c new file +7
-0+static int tac_update_status (struct sdw_slave *slave, +enum sdw_slave_status status) +{ +int ret; +bool first = false; +struct tac5xx2_prv *tac_dev =dev_get_drvdata (&slave->dev); +struct device *dev = &slave->dev;
nit-pick: reverse xmas-tree.
Re: [PATCH v14 2/4] ASoC: tac5xx2-sdw: add soundwire based codec driver
Quoted 24 lines · Pierre-Louis Bossart
Subject: Re: [PATCH v14 2/4] ASoC: tac5xx2-sdw: add soundwire based codec driver
sound/soc/codecs/tac5xx2-sdw.c line 1322
Quoted 12 lines
sound/soc/codecs/tac5xx2-sdw.c new file +12
-0+static s32 tac_component_probe (struct snd_soc_component *component) +{ +struct tac5xx2_prv *tac_dev = +snd_soc_component_get_drvdata (component); +struct device *dev = tac_dev->dev; +struct sdw_slave *slave = tac_dev->sdw_peripheral; +unsigned long time; +int ret; + +/* Wait for SoundWire hw initialization to complete */ + time = wait_for_completion_timeout(&slave->initialization_complete, +
msecs_to_jiffies(TAC5XX2_PROBE_TIMEOUT_MS));sound/soc/codecs/tac5xx2-sdw.c line 1321
Quoted 4 lines
sound/soc/codecs/tac5xx2-sdw.c new file +4
-0+if (!time) { +dev_warn (dev,"%s: hw initialization timeout\n" , __func__); +return -ETIMEDOUT ; + }are you sure this is needed? Or if this even works, if the card creation happens after the bus goes to clock-stop, then you will always timeout here.
Quoted 3 lines
If you look at commit 011e397 "ASoC: codecs: soundwire: call
pm_runtime_resume()in component probe" it's simpler to force the bus+codec to resume, no?
Thanks. I will adopt this fix which you've added for other drivers.
Quoted 6 lines
sound/soc/codecs/tac5xx2-sdw.c line 1324
Quoted 4 lines
sound/soc/codecs/tac5xx2-sdw.c new file +3
-0+ +if (!tac_has_uaj_support (tac_dev)) + goto done_comp_probe;Is this really the case that you only have controls+routes for the UAJ function?
At this place, I do not see problem. But, interrupt handler needs fix to handle interrupts only when UAJ is supported. Right now it reads uaj interrupts regardless of whether UAJ is supported or not. I will fix it
Quoted 2 lines
sound/soc/codecs/tac5xx2-sdw.c new file +2
-0+static s32 tac5xx2_sdca_dev_resume (struct device *dev) +{
...
Quoted 12 lines
sound/soc/codecs/tac5xx2-sdw.c line 1466
Quoted 4 lines
sound/soc/codecs/tac5xx2-sdw.c new file +4
-0+ + had_unattached = true; + t = wait_for_completion_timeout(&slave->initialization_complete, +msecs_to_jiffies(TAC5XX2_PROBE_TIMEOUT_MS));Quoted 7 lines
sound/soc/codecs/tac5xx2-sdw.c new file +7
-0+if (!t) { +dev_err (&slave->dev,"resume: initialization timed out\n" ); +sdw_show_ping_status (slave->bus, true); +return -ETIMEDOUT ; + } + slave->unattach_request =0 ; +
...
Quoted 5 lines
Quoted 5 lines
sound/soc/codecs/tac5xx2-sdw.c new file +5
-0+ +regmap_sync: +regcache_cache_only (tac_dev->regmap, false); +if (!had_unattached) { +regcache_mark_dirty (tac_dev->regmap);
Quoted 8 lines
sound/soc/codecs/tac5xx2-sdw.c line 1480
Quoted 4 lines
sound/soc/codecs/tac5xx2-sdw.c new file +4
-0+ ret =regcache_sync (tac_dev->regmap); +if (ret <0 ) +dev_warn (dev,"Failed to sync regcache: %d\n" , ret); + }can you explain why you have this extra test with
had_unattachedand if this is really useful?
I don't recall having seen this before on any other driver.
This was supposed to be a small optimization, but I realized that this will lead to bug that regcache not being called if device was not detached for the suspend -> resume scenario. I will drop this check
Regards
Niranjan
PATCH v14 3/4 ASoC: sdw_utils: TI amp utility for tac5xx2 family
In reply to Niranjan H Y Add TI amp utility for supporting the tac5xx2 family
of devices to support tac5572, tac5672, tac5682 and tas2883
---
v14:
- Resending complete series (v13 1/4 was accidentally sent alone)
- no change
v13:
- no change
v12:
- no change
--- include/sound/soc_sdw_utils.h | 4 + sound/soc/sdw_utils/soc_sdw_ti_amp.c | 144 ++++++++++++++++++++++++- sound/soc/sdw_utils/soc_sdw_utils.c | 151 +++++++++++++++++++++++++++ 3 files changed, 298 insertions(+), 1 deletion(-)
include/sound/soc_sdw_utils.h +4 -0
@@ -272,7 +272,11 @@ int asoc_sdw_ti_amp_init(struct snd_soc_card *card,struct asoc_sdw_codec_info *info, bool playback);int asoc_sdw_ti_spk_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai); +int asoc_sdw_ti_tac5xx2_spk_rtd_init (struct snd_soc_pcm_runtime *rtd, +struct snd_soc_dai *dai);int asoc_sdw_ti_amp_initial_settings (struct snd_soc_card *card,const char *name_prefix); +int asoc_sdw_ti_dmic_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai); +int asoc_sdw_ti_sdca_jack_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai);#endif
sound/soc/sdw_utils/soc_sdw_ti_amp.c +143 -1
158 lines not on this page · raw message
sound/soc/sdw_utils/soc_sdw_utils.c +151 -0
157 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v14 4/4 ASoC: tac5xx2-sdw: ACPI match for intel mtl platform
In reply to Niranjan H Y Add acpi match entries to support TI's tac5572,
tas2883, tac5672 and tac5682 on link 0 on MTL machine.
---
14:
- Resending complete series (v13 1/4 was accidentally sent alone)
- no change
v13:
- no change
--- .../intel/common/soc-acpi-intel-mtl-match.c | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+)
sound/soc/intel/common/soc-acpi-intel-mtl-match.c +132 -0
@@ -122,6 +122,42 @@ static const struct snd_soc_acpi_endpoint spk_r_endpoint = { .group_id = 1, }; +static const struct snd_soc_acpi_endpoint tac5xx2_endpoints[] = { + {/* Playback Endpoint */ + .num =0 , + .aggregated =0 , + .group_position =0 , + .group_id =0 , + }, + {/* Mic Capture Endpoint */ + .num =1 , + .aggregated =0 , + .group_position =0 , + .group_id =0 , + }, + {/* UAJ-HP with Mic Endpoint */ + .num =2 , + .aggregated =0 , + .group_position =0 , + .group_id =0 , + }, +}; + +static const struct snd_soc_acpi_endpoint tas2883_endpoints[] = { + {/* Playback Endpoint */ + .num =0 , + .aggregated =0 , + .group_position =0 , + .group_id =0 , + }, + {/* Mic Capture Endpoint */ + .num =1 , + .aggregated =0 , + .group_position =0 , + .group_id =0 , + }, +}; +static const struct snd_soc_acpi_endpoint rt712_endpoints[] = { { .num =0 ,
@@ -1011,6 +1047,33 @@ static const struct snd_soc_acpi_adr_device cs42l42_0_adr[] = { } }; +static const struct snd_soc_acpi_adr_device tac5572_0_adr[] = { + { + .adr =0x0000300102557201ull , + .num_endpoints =ARRAY_SIZE (tac5xx2_endpoints), + .endpoints = tac5xx2_endpoints, + .name_prefix ="tac5572" + } +}; + +static const struct snd_soc_acpi_adr_device tac5672_0_adr[] = { + { + .adr =0x0000300102567201ull , + .num_endpoints =ARRAY_SIZE (tac5xx2_endpoints), + .endpoints = tac5xx2_endpoints, + .name_prefix ="tac5672" + } +}; + +static const struct snd_soc_acpi_adr_device tac5682_0_adr[] = { + { + .adr =0x0000300102568201ull , + .num_endpoints =ARRAY_SIZE (tac5xx2_endpoints), + .endpoints = tac5xx2_endpoints, + .name_prefix ="tac5682" + } +}; +static const struct snd_soc_acpi_adr_device tas2783_0_adr[] = { { .adr =0x00003c0102000001ull ,
@@ -1035,9 +1098,45 @@ static const struct snd_soc_acpi_adr_device tas2783_0_adr[] = { .num_endpoints = 1, .endpoints = &spk_r_endpoint, .name_prefix ="tas2783-4" + }, +}; + +static const struct snd_soc_acpi_adr_device tas2883_0_adr[] = { + { + .adr =0x0000300102288301ull , + .num_endpoints =ARRAY_SIZE (tas2883_endpoints), + .endpoints = tas2883_endpoints, + .name_prefix ="tas2883" } }; +static const struct snd_soc_acpi_link_adr tac5572_l0[] = { + { + .mask =BIT (0 ), + .num_adr =ARRAY_SIZE (tac5572_0_adr), + .adr_d = tac5572_0_adr, + }, + {} +}; + +static const struct snd_soc_acpi_link_adr tac5672_l0[] = { + { + .mask =BIT (0 ), + .num_adr =ARRAY_SIZE (tac5672_0_adr), + .adr_d = tac5672_0_adr, + }, + {} +}; + +static const struct snd_soc_acpi_link_adr tac5682_l0[] = { + { + .mask =BIT (0 ), + .num_adr =ARRAY_SIZE (tac5682_0_adr), + .adr_d = tac5682_0_adr, + }, + {} +}; +static const struct snd_soc_acpi_link_adr tas2783_link0[] = { { .mask =BIT (0 ),
@@ -1047,6 +1146,15 @@ static const struct snd_soc_acpi_link_adr tas2783_link0[] = { {} }; +static const struct snd_soc_acpi_link_adr tas2883_l0[] = { + { + .mask =BIT (0 ), + .num_adr =ARRAY_SIZE (tas2883_0_adr), + .adr_d = tas2883_0_adr, + }, + {} +}; +static const struct snd_soc_acpi_link_adr cs42l42_link0_max98363_link2[] = {/* Expected order: jack -> amp */ {
@@ -1208,12 +1316,36 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = { .drv_name = "sof_sdw", .sof_tplg_filename = "sof-mtl-rt715-rt711-rt1308-mono.tplg", }, + { + .link_mask = BIT(0), + .links = tac5572_l0, + .drv_name = "sof_sdw", + .sof_tplg_filename = "sof-mtl-tac5572.tplg", + }, + { + .link_mask = BIT(0), + .links = tac5672_l0, + .drv_name = "sof_sdw", + .sof_tplg_filename = "sof-mtl-tac5672.tplg", + }, + { + .link_mask = BIT(0), + .links = tac5682_l0, + .drv_name = "sof_sdw", + .sof_tplg_filename = "sof-mtl-tac5682.tplg", + }, { .link_mask = BIT(0), .links = tas2783_link0, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-mtl-tas2783.tplg", }, + { + .link_mask = BIT(0), + .links = tas2883_l0, + .drv_name = "sof_sdw", + .sof_tplg_filename = "sof-mtl-tas2883.tplg", + }, { .link_mask = GENMASK(3, 0), .links = mtl_rt713_l0_rt1316_l12_rt1713_l3,
Signature · 1 line
2.34.1