Skip to content

Commit bf93bd4

Browse files
committed
ASoC: codecs: tas675x: misc bugfixes and minor changes
Sen Wang <sen@ti.com> says: Few miscellaneous bug fixes after the initial merge of TAS675x driver, of which includes: - Adding READ_ONCE for all concurrent read params - Corrected kcontrol bits for temperature range - Corrected conversion notes in the driver documentation Link: https://patch.msgid.link/20260630183126.2588322-1-sen@ti.com
2 parents ed0abc8 + c34a4be commit bf93bd4

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

Documentation/sound/codecs/tas675x.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,18 +281,19 @@ Global Temperature
281281
:Description: Global die temperature sense register.
282282
:Type: Integer (read-only)
283283
:Range: 0 to 255
284-
:Conversion: (value × 0.5 °C) − 50 °C
284+
:Conversion: value × 2.19 K; subtract 273.15 for °C
285285
:Register: 0x75
286286

287287
CHx Temperature Range
288288
---------------------
289289

290290
:Description: Per-channel coarse temperature range indicator (x = 1, 2, 3, 4).
291291
:Type: Integer (read-only)
292-
:Range: 0 to 3
293-
:Mapping: 0 = <80 °C, 1 = 80–100 °C, 2 = 100–120 °C, 3 = >120 °C
294-
:Register: 0xBB bits [7:6] (CH1), bits [5:4] (CH2),
295-
0xBC bits [3:2] (CH3), bits [1:0] (CH4)
292+
:Range: 0 to 7
293+
:Mapping: 0 = <95 °C, 1 = 95–110 °C, 2 = 110–125 °C, 3 = 125–135 °C,
294+
4 = 135–145 °C, 5 = 145–155 °C, 6 = 155–165 °C, 7 = >165 °C
295+
:Register: 0xBB bits [2:0] (CH1), bits [5:3] (CH2),
296+
0xBC bits [2:0] (CH3), bits [5:3] (CH4)
296297

297298
Load Diagnostics
298299
================

sound/soc/codecs/tas675x.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -954,10 +954,10 @@ static const struct snd_kcontrol_new tas675x_snd_controls[] = {
954954
/* Temperature and Voltage Monitoring */
955955
SOC_SINGLE_RO("PVDD Sense", TAS675X_PVDD_SENSE_REG, 0, 0xFF),
956956
SOC_SINGLE_RO("Global Temperature", TAS675X_TEMP_GLOBAL_REG, 0, 0xFF),
957-
SOC_SINGLE_RO("CH1 Temperature Range", TAS675X_TEMP_CH1_CH2_REG, 6, 3),
958-
SOC_SINGLE_RO("CH2 Temperature Range", TAS675X_TEMP_CH1_CH2_REG, 4, 3),
959-
SOC_SINGLE_RO("CH3 Temperature Range", TAS675X_TEMP_CH3_CH4_REG, 2, 3),
960-
SOC_SINGLE_RO("CH4 Temperature Range", TAS675X_TEMP_CH3_CH4_REG, 0, 3),
957+
SOC_SINGLE_RO("CH1 Temperature Range", TAS675X_TEMP_CH1_CH2_REG, 0, 7),
958+
SOC_SINGLE_RO("CH2 Temperature Range", TAS675X_TEMP_CH1_CH2_REG, 3, 7),
959+
SOC_SINGLE_RO("CH3 Temperature Range", TAS675X_TEMP_CH3_CH4_REG, 0, 7),
960+
SOC_SINGLE_RO("CH4 Temperature Range", TAS675X_TEMP_CH3_CH4_REG, 3, 7),
961961

962962
/* Speaker Protection & Detection */
963963
SOC_SINGLE("Tweeter Detection Switch", TAS675X_TWEETER_DETECT_CTRL_REG, 0, 1, 1),
@@ -1133,7 +1133,7 @@ static int tas675x_hw_params(struct snd_pcm_substream *substream,
11331133
* Single clock domain: SDIN and SDOUT share one SCLK/FSYNC pair,
11341134
* so all active DAIs must use the same sample rate.
11351135
*/
1136-
if ((tas->active_playback_dais || tas->active_capture_dais) &&
1136+
if ((READ_ONCE(tas->active_playback_dais) || READ_ONCE(tas->active_capture_dais)) &&
11371137
tas->rate && tas->rate != rate) {
11381138
dev_err(component->dev,
11391139
"Rate %u conflicts with active rate %u\n",
@@ -1397,14 +1397,14 @@ static int tas675x_mute_stream(struct snd_soc_dai *dai, int mute, int direction)
13971397
set_bit(dai->id, &tas->active_playback_dais);
13981398

13991399
/* Last playback stream */
1400-
if (mute && !tas->active_playback_dais) {
1400+
if (mute && !READ_ONCE(tas->active_playback_dais)) {
14011401
ret = tas675x_set_state_all(tas, TAS675X_STATE_SLEEP_BOTH);
14021402
regmap_read(tas->regmap, TAS675X_CLK_FAULT_LATCHED_REG, &discard);
14031403
return ret;
14041404
}
14051405

14061406
return tas675x_set_state_all(tas,
1407-
tas->active_playback_dais ?
1407+
READ_ONCE(tas->active_playback_dais) ?
14081408
TAS675X_STATE_PLAY_BOTH :
14091409
TAS675X_STATE_SLEEP_BOTH);
14101410
}

0 commit comments

Comments
 (0)