Commit Graph

44 Commits

Author SHA1 Message Date
Ganapathiraju Sarath Varma
c143a07c13 asoc: codec: update index to read bat cfg.
Update index to read bat cfg from dtsi.

Change-Id: I48ca32d149e14d8ce917be1ffa0822233f69239c
Signed-off-by: Ganapathiraju Sarath Varma <quic_ganavarm@quicinc.com>
2022-06-29 10:19:02 -07:00
qctecmdr
0cbf88ed1d Merge "asoc: codecs: Set WSA884X Compander ON by default" 2022-05-03 13:28:07 -07:00
qctecmdr
a6c0e859aa Merge "asoc: codecs: Change WSA SPKRRECV control to bool" 2022-05-03 13:03:17 -07:00
qctecmdr
372908eb84 Merge "asoc: codecs: Add bat cfg check" 2022-05-03 12:37:52 -07:00
qctecmdr
995cee83f6 Merge "asoc: codec: Fix WSA SWRS Reg Dump" 2022-05-02 21:08:21 -07:00
qctecmdr
f6b4d8a856 Merge "asoc: codecs: Revamp dev_index uses" 2022-05-02 20:41:28 -07:00
Matthew Rice
4a43e97d76 asoc: codecs: Set WSA884X Compander ON by default
Due to certain write-once registers needing to be set during
bootup, assume that compander on will be the default usecase, unless
haptics SKU is used.

Change-Id: I7903f3a4bf1eae82b4b9302ddc4f1e4c59d2cad3
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-04-27 14:36:54 -07:00
Matthew Rice
c117389d88 asoc: codecs: Change WSA SPKRRECV control to bool
Update from SOC_ENUM to SOC_SINGLE to match rest of driver
implementation. Also remove remaining dev_mode enum references
in wsa884x driver.

Change-Id: I2a477c4fa8c29373ffa1e8e2eb599a0f1c61653d
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-04-27 10:52:03 -07:00
Shazmaan Ali
16a78f8cb3 asoc: codecs: Add bat cfg check
Add check to validate bat cfg,
bat cfg register read compared to dts read

Change-Id: Ib62ae3b3535a75dbc7c71b2b2ac3752fb2e61156
Signed-off-by: Shazmaan Ali <quic_shazmaan@quicinc.com>
2022-04-21 19:08:30 -07:00
Matthew Rice
f07906e34d asoc: codec: Fix WSA SWRS Reg Dump
Add missing 0x60, 0x70, 0xC0, 0xC1, 0xC8
to reg dump for better debugging.

Change-Id: I6e7174e432d562c44eba2282ff3c03f513ebc960
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-04-20 10:03:13 -07:00
Matthew Rice
22d45f2149 asoc: codecs: Revamp dev_index uses
Add mod % 2 to allow dev_index to work with WSA2 Macro.
Also fix issues associated with incorrect parameter
checking of dev_index leading to potential array index
out-of-bounds issues.
Change WSA MODE mixer control to be SOC_SINGLE_EXT for
extra parameter validation.

Change-Id: I030ee64d87fa60c6b44feebf5ccb1265f4291cc1
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-04-18 14:03:07 -07:00
Phani Kumar Uppalapati
dbc14a1d20 ASoC: kalama: Add support for WSA883X speaker amp
Add support for WSA883X speaker amp on kalama platform.

Change-Id: I922b5aeaf264ae9b430f20e83ec99e3ced509dcc
2022-04-16 09:03:18 -07:00
qctecmdr
be2f9dada8 Merge "asoc: codecs: Replace dev_err/info with ratelimit prints" 2022-04-14 16:25:40 -07:00
qctecmdr
abd86fc157 Merge "asoc: codecs: Fix WSA PBR equation" 2022-04-14 13:55:27 -07:00
Shazmaan Ali
a20e11e0c3 asoc: codecs: Replace dev_err/info with ratelimit prints
replace all dev(pr)_err/info logs
that could potentially flood kernel logs with
ratelimit functions dev_err_ratelimited and
dev_info_ratelimited

Change-Id: I32dc6002dead1a07622978c4de63d541c01982fd
Signed-off-by: Shazmaan Ali <quic_shazmaan@quicinc.com>
2022-04-13 12:43:20 -07:00
Shazmaan Ali
7f29f390e1 asoc: codecs: error fix for soc_component_read_no_lock
the offset between LPASS_CDC_WSA_RX_INP_MUX_RX_INT0_CFG1 and
LPASS_CDC_WSA_RX_INP_MUX_RX_INT1_CFG1 is 8 so updating
0x104 + 8* interp
update ng block register write for NG2 mode in Kundu

Change-Id: I44da894feebb5d25bd467ffd4d54adde111778e6
Signed-off-by: Shazmaan Ali <quic_shazmaan@quicinc.com>
2022-04-12 01:26:35 -07:00
Matthew Rice
2e8c4069b5 asoc: codecs: Fix WSA PBR equation
Update equation that converts from the PBR table to
the correct register value.
Improve accuracy of truncation by moving the division
into one operation at the end of the formula and adding 1.
Update a few table values that were copied incorrectly.

Change-Id: I685c02778468e910820a90e2de216e0daf2491ac
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-04-11 07:05:27 -07:00
Matthew Rice
448e5c5a77 asoc: codecs: Implement WSA IRQ retry/shutdown scheme
Whenever there is an interrupt,
mute the PA, then wait 1ms and unmute the pa and
check for another interrupt. Then if there are still interrupts,
retry muting and unmuting the pa with delay.
If interrupts persist, the PA will remain muted until there is a
usecase teardown or reset.

Change-Id: Ic59fc33d4606c1c630a61796d513a9ec99a4979c
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-03-31 12:34:31 -07:00
Matthew Rice
5403d47a9a asoc: codecs: Add WSA init reg writes
Update to latest sequence from WSA hardware systems team.
Add writes for VADC, BG, Boost

Change-Id: Ic61e1c36154ff673fce05546332e89fe683a3075
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-03-24 22:30:07 -07:00
Shazmaan Ali
b62c934b61 asoc: codecs: Resolve checkpatch errors
Change-Id: I33dca97f388b524c7476e0da0ea8b1cbca4b849c
Signed-off-by: Shazmaan Ali <quic_shazmaan@quicinc.com>
2022-03-15 02:39:22 -07:00
Matthew Rice
2e70df2efe asoc: codecs: Add checking of WSA SWR dt params
Add to avoid crashing related to device tree parsing
of SWR port params.

Change-Id: Id839cc908fb5f7843e5fd6260b3205c8844349ba
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-03-10 10:18:23 -08:00
Matthew Rice
9d7405ec04 asoc: codecs: Fix Bolero and WSA out-of-range variables
Found potential issues relating to uninitialized or out-of-bounds variables
present in codec drivers. Place checks to ensure proper ranges are used.

Change-Id: Ib68cba2413788a57237f1f18fc5ce5fb5c6bfb0a
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-03-02 22:02:03 -08:00
Matthew Rice
3a6ef472dd asoc: codecs: Enable custom WSA SWRS port settings
For PBR and CPS ports, need the ability to customized slave
SWR frame OFFSET1 settings. Add similar method to WCD TX where
offset1 and lane_ctrl parameters are parsed from WSA device tree
and configured in SWRM.

Change-Id: Ib973ed93d9daa5ba02461a156e5b0a8c816d371e
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-03-02 22:01:34 -08:00
Matthew Rice
f3d67be087 asoc: codecs: Fix WSA dapm_ignore_suspend pin names
Update to 5.15 kernel dapm api.
Pin name no longer needs prefix as it is added in API.

Change-Id: I5c1378839f4c4d2aa70fb11706c5bb65d4eb0952
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-02-17 17:51:57 -08:00
Matthew Rice
09ddecf85c asoc: codecs: Remove unused asoc kcontrols in WSA884x
Removed PA Mute, COMP Offset, Ext_vdd as they will not be used
in WSA884x.

Change-Id: I58ffd490c9929fa3388678d9ab7114207779191d
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-01-21 12:55:20 -08:00
Shazmaan Ali
da66f4540f asoc: codecs: Add WSA884X set config func
Add set config function to validate and
set battery stack mode, rload and system gain

Change-Id: I075bf3cde6a9671a8d93f32aec43b941ea86f2ea
Signed-off-by: Shazmaan Ali <quic_shazmaan@quicinc.com>
2022-01-20 21:30:19 -08:00
Shazmaan Ali
152f664978 asoc: codecs: Add noise gating register writes
Read noise gate mode from device tree,
set NG2 based on the register read or
set to idle detect mode

Change-Id: Id1e478ad230125d1e35229493cb0fbd6867c6a3b
Signed-off-by: Shazmaan Ali <quic_shazmaan@quicinc.com>
2022-01-20 21:30:16 -08:00
Matthew Rice
823dd9bab9 asoc: codecs: Add current_limit updates to WSA884x
Boost current limit is now dependent on PBR and bat_cfg.
Add BOP2 VTH/HST initial settings.
Add OCP LOW VBAT ITH sel settings dependent on bat_cfg.

Change-Id: I235f4b75ee12e5f24d46fa0ebca67547997934e2
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-01-20 21:30:13 -08:00
Matthew Rice
233a0dcb1b asoc: codecs: Updated swr slave debug w/ new ports
Add PBR/CPS ports to debugging by adding logic to
is_swr_slave_reg_readable.

Change-Id: I9ef09ed90ccce2c696eaec7b1eed9c47a7e73f58
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-01-20 21:30:04 -08:00
Matthew Rice
d8711a3a66 asoc: codecs: Implement PBR feature for WSA884X
Change PBR enable to be acquired from device tree.
Using system_gain, bat_cfg, rload, set pbr thresholds based on tables.
Table values are x100 to avoid kernel float issues,
truncate when converting to reg val.
Set pbr registers during initialization.
Rename WSA_8OHMS -> WSA_8_OHMS to match system gain naming.

Change-Id: I28985496e1da37ceeb8c9db6e17f4c48d37d11c7
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-01-20 21:29:51 -08:00
Matthew Rice
2db06d4b50 asoc: codecs: wsa884x: Enable all irqs by default
Previously we disabled all irqs by default and toggled them pre/post
playback. Update to leave them enabled by default and remove the toggling.
Also, leave the default values for edge/level triggering.

Change-Id: Iac96649fc0f33cbdf5a25f136cf577f7242db74e
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-01-20 21:29:48 -08:00
Matthew Rice
e41373e842 asoc: codecs: Add Comp Off Pa Gain usecase
If not using compander, allow for user to set pa gain
using DRE_CTL_1 register.

Change-Id: I45af5a64a5630ff1cd8410a66ed55914efb5a529
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-01-20 21:29:45 -08:00
Matthew Rice
311264875e asoc: codecs: Change WSA config params acquisition
Update WSA rload, system gain, bat_cfg to get from wsa_macro device tree.
WSA Bat_cfg change to read from VPHX_SYS_EN_STATUS reg.
Add device tree parsing for these params in WSA macro
and WSA driver.
Remove machine driver method of sending the parameters.
Add default_dev_mode (spkr vs rcv) from device tree for WSA.
Move code from spkr event to userspace controls or probe.
Change system_gain and affected params when switching between
dev_modes.
These changes simplify configuration data and code and allow
more registers to be written during bootup or before playback.

Change-Id: I79966c704adfac1bf2d85aa6519ea574764c7a8b
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2022-01-20 21:29:37 -08:00
Prasad Kumpatla
c78f788fac ASoC: wsa884x: Handle PA_ERR interrupt on WSA speaker
PA_ERR can happen during speaker path setup. Log the
error status in the interrupt handler and clear the error
status for next audio playback to resume properly on
the speaker.

Change-Id: I5800d9505a3036127097745aaa880b73b3e87f30
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: Meng Wang <quic_mengw@quicinc.com>
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
2022-01-10 10:25:06 -08:00
Matthew Rice
f21b04af12 asoc: codecs: Fix WSA884X init and playback reg writes
Fix isense/vsense gain tables to correct values.
Mark ana_wo_ctl registers as volatile.
Move VBAT_THRM_FLT_CTL to init reg sequence.

Change-Id: Ie04f302719f08b35f1ef9807dff7993c31e3aa43
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2021-12-09 09:09:12 -08:00
Prasad Kumpatla
2dacb122a3 asoc: wsa884x: update irq_drv_data per wsa device
regmap_irq_chip->irq_drv_data is shared by all attached wsa
devices and point to last probbed wsa device. This will cause
interrupt handle issue. Update irq_drv_data per wsa deviece to
resolve this issue.

Change-Id: I013f546d7f1ca6077f0b14e875b135a27325f851
Signed-off-by: Meng Wang <quic_mengw@quicinc.com>
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
2021-12-07 10:29:05 -08:00
Junkai Cai
97e37eeee3 asoc: use ASoC API to set driver component name prefix
during devm_snd_soc_register_card(), the name_prefix can be set
if "sound-name-prefix" is provided in the DT nodes.

The original approach to set prefix would possibly cause ASoC
component probe failed if prefix has not set before probe is called

Change-Id: Ie78d042cda24b7d1d926223d476786e13d965ac7
Signed-off-by: Junkai Cai <quic_junkai@quicinc.com>
2021-12-07 09:53:13 -08:00
Prasad Kumpatla
4ed625474c asoc: wsa884x: add slave_irq for wsa884x
Interrupt from wsa884x are not handle as slave_irq is not set.
Add slave_irq for wsa884x to address this issue.

Change-Id: I82edb35b55f6a46d79bd96b7f0f4bfac58583860
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
2021-12-07 09:16:44 -08:00
Matthew Rice
b70a4759b3 asoc: codecs: Add WSA884X DRE Settings
Conforms to latest hardware DRE documentation

Change-Id: Ia08b03f519697723e9e260451c5bc68b4b45724c
Signed-off-by: Matthew Rice <quic_mrice@quicinc.com>
2021-11-24 11:19:42 -08:00
Matthew Rice
1b69ddf3c3 asoc: Replace wsa883x with wsa884x in machine driver
Add bat_cfg, system_gain, and rload parameters to properly configure wsa884x

Change-Id: Ibb4de17a9935f178293bc17314784ff87a978815
Signed-off-by: Matthew Rice <mrice@quicinc.com>
2021-11-09 15:33:09 -08:00
Matthew Rice
da73d84e5a asoc: codecs: Update SWR Ports with CPS & PBR
Reflecting latest hardware SWR updates.

Change-Id: I8a4c647e3a0a4e4b958dd102efa04a66fbce4618
Signed-off-by: Matthew Rice <mrice@codeaurora.org>
2021-11-09 15:24:38 -08:00
Matthew Rice
e9193b07c0 asoc: codecs: Update wsa884x dev_index to match uniq id
WSA884X has different uniq id than WSA883X

Change-Id: Ibb785f3edcc0ae4e8a79849bd8f01a891f5b46ae
Signed-off-by: Matthew Rice <mrice@quicinc.com>
2021-11-09 13:33:56 -08:00
Matthew Rice
cdcdcac0df asoc: codecs: Update register initialization sequence
Add latest register sequence.
Remove version 1_2.
Update header files with latest registers.

Change-Id: I92f56e5ec2be4e695d42cec8610b9b9300410b02
Signed-off-by: Matthew Rice <mrice@codeaurora.org>
2021-10-28 16:52:38 -07:00
Junkai Cai
179ce4f13f asoc: codecs: Implement codec driver for WSA884X
Driver implementation for WSA884X.
Use new script to generate register files.
Modify register naming convention.
Add wsa884x-reg-masks.h and wsa884x-reg-shifts.h
Reverting copyrights to 2019 for wsa884x.h file

Change-Id: Ic3652d6138a2f62ba59a36d4307c732ab6e8db89
Signed-off-by: Shazmaan Ali <shazmaan@codeaurora.org>
2021-10-28 16:52:18 -07:00