Skip to content

Commit e45cd86

Browse files
RanderWangbroonie
authored andcommitted
ASoC: SOF: IPC4: update gain ipc msg definition to align with fw
Recent firmware changes modified the curve duration from 32 to 64 bits, which breaks volume ramps. A simple solution would be to change the definition, but unfortunately the ASoC topology framework only supports up to 32 bit tokens. This patch suggests breaking the 64 bit value in low and high parts, with only the low-part extracted from topology and high-part only zeroes. Since the curve duration is represented in hundred of nanoseconds, we can still represent a 400s ramp, which is just fine. The defacto ABI change has no effect on existing users since the IPC4 firmware has not been released just yet. Link: thesofproject#4026 Signed-off-by: Rander Wang <[email protected]> Reviewed-by: Ranjani Sridharan <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Bard Liao <[email protected]> Reviewed-by: Péter Ujfalusi <[email protected]> Signed-off-by: Peter Ujfalusi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent c7e328f commit e45cd86

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

sound/soc/sof/ipc4-control.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ sof_ipc4_set_volume_data(struct snd_sof_dev *sdev, struct snd_sof_widget *swidge
9797
}
9898

9999
/* set curve type and duration from topology */
100-
data.curve_duration = gain->data.curve_duration;
100+
data.curve_duration_l = gain->data.curve_duration_l;
101+
data.curve_duration_h = gain->data.curve_duration_h;
101102
data.curve_type = gain->data.curve_type;
102103

103104
msg->data_ptr = &data;

sound/soc/sof/ipc4-topology.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static const struct sof_topology_token gain_tokens[] = {
107107
get_token_u32, offsetof(struct sof_ipc4_gain_data, curve_type)},
108108
{SOF_TKN_GAIN_RAMP_DURATION,
109109
SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
110-
offsetof(struct sof_ipc4_gain_data, curve_duration)},
110+
offsetof(struct sof_ipc4_gain_data, curve_duration_l)},
111111
{SOF_TKN_GAIN_VAL, SND_SOC_TPLG_TUPLE_TYPE_WORD,
112112
get_token_u32, offsetof(struct sof_ipc4_gain_data, init_val)},
113113
};
@@ -692,7 +692,7 @@ static int sof_ipc4_widget_setup_comp_pga(struct snd_sof_widget *swidget)
692692

693693
dev_dbg(scomp->dev,
694694
"pga widget %s: ramp type: %d, ramp duration %d, initial gain value: %#x, cpc %d\n",
695-
swidget->widget->name, gain->data.curve_type, gain->data.curve_duration,
695+
swidget->widget->name, gain->data.curve_type, gain->data.curve_duration_l,
696696
gain->data.init_val, gain->base_config.cpc);
697697

698698
ret = sof_ipc4_widget_setup_msg(swidget, &gain->msg);

sound/soc/sof/ipc4-topology.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,14 +277,16 @@ struct sof_ipc4_control_data {
277277
* @init_val: Initial value
278278
* @curve_type: Curve type
279279
* @reserved: reserved for future use
280-
* @curve_duration: Curve duration
280+
* @curve_duration_l: Curve duration low part
281+
* @curve_duration_h: Curve duration high part
281282
*/
282283
struct sof_ipc4_gain_data {
283284
uint32_t channels;
284285
uint32_t init_val;
285286
uint32_t curve_type;
286287
uint32_t reserved;
287-
uint32_t curve_duration;
288+
uint32_t curve_duration_l;
289+
uint32_t curve_duration_h;
288290
} __aligned(8);
289291

290292
/**

0 commit comments

Comments
 (0)