mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aaron Kling via B4 Relay <devnull+webgeek1234.gmail.com@kernel.org>
To: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	 Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	 Weidong Wang <wangweidong.a@awinic.com>
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Val Packett <val@packett.cool>,
	Aaron Kling <webgeek1234@gmail.com>
Subject: [PATCH 4/6] ASoC: codecs: aw88166: remove fade in/out on start/stop
Date: Fri, 25 Sep 2026 02:47:32 -0500	[thread overview]
Message-ID: <20260925-aw88166-cleanup-v1-4-11f74cb5fe28@gmail.com> (raw)
In-Reply-To: <20260925-aw88166-cleanup-v1-0-11f74cb5fe28@gmail.com>

From: Aaron Kling <webgeek1234@gmail.com>

This "feature" was copied from downstream, but it does not belong in
the kernel at all. Remove it to simplify the driver.

Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
---
 sound/soc/codecs/aw88166.c | 157 +--------------------------------------------
 sound/soc/codecs/aw88166.h |   2 -
 2 files changed, 2 insertions(+), 157 deletions(-)

diff --git a/sound/soc/codecs/aw88166.c b/sound/soc/codecs/aw88166.c
index c8b8c70aaf356..ab7af3eaceb28 100644
--- a/sound/soc/codecs/aw88166.c
+++ b/sound/soc/codecs/aw88166.c
@@ -668,59 +668,16 @@ static int aw_dev_set_volume(struct aw_device *aw_dev, unsigned int value)
 	return ret;
 }
 
-static void aw_dev_fade_in(struct aw_device *aw_dev)
-{
-	struct aw_volume_desc *desc = &aw_dev->volume_desc;
-	u16 fade_in_vol = desc->ctl_volume;
-	int fade_step = aw_dev->fade_step;
-	int i;
-
-	if (fade_step == 0 || aw_dev->fade_in_time == 0) {
-		aw_dev_set_volume(aw_dev, fade_in_vol);
-		return;
-	}
-
-	for (i = AW88166_MUTE_VOL; i >= fade_in_vol; i -= fade_step) {
-		aw_dev_set_volume(aw_dev, i);
-		usleep_range(aw_dev->fade_in_time, aw_dev->fade_in_time + 10);
-	}
-
-	if (i != fade_in_vol)
-		aw_dev_set_volume(aw_dev, fade_in_vol);
-}
-
-static void aw_dev_fade_out(struct aw_device *aw_dev)
-{
-	struct aw_volume_desc *desc = &aw_dev->volume_desc;
-	int fade_step = aw_dev->fade_step;
-	int i;
-
-	if (fade_step == 0 || aw_dev->fade_out_time == 0) {
-		aw_dev_set_volume(aw_dev, AW88166_MUTE_VOL);
-		return;
-	}
-
-	for (i = desc->ctl_volume; i <= AW88166_MUTE_VOL; i += fade_step) {
-		aw_dev_set_volume(aw_dev, i);
-		usleep_range(aw_dev->fade_out_time, aw_dev->fade_out_time + 10);
-	}
-
-	if (i != AW88166_MUTE_VOL) {
-		aw_dev_set_volume(aw_dev, AW88166_MUTE_VOL);
-		usleep_range(aw_dev->fade_out_time, aw_dev->fade_out_time + 10);
-	}
-}
-
 static void aw88166_dev_mute(struct aw_device *aw_dev, bool is_mute)
 {
 	if (is_mute) {
-		aw_dev_fade_out(aw_dev);
+		aw_dev_set_volume(aw_dev, AW88166_MUTE_VOL);
 		regmap_update_bits(aw_dev->regmap, AW88166_SYSCTRL_REG,
 				~AW88166_HMUTE_MASK, AW88166_HMUTE_ENABLE_VALUE);
 	} else {
 		regmap_update_bits(aw_dev->regmap, AW88166_SYSCTRL_REG,
 				~AW88166_HMUTE_MASK, AW88166_HMUTE_DISABLE_VALUE);
-		aw_dev_fade_in(aw_dev);
+		aw_dev_set_volume(aw_dev, aw_dev->volume_desc.ctl_volume);
 	}
 }
 
@@ -1515,75 +1472,6 @@ static struct snd_soc_dai_driver aw88166_dai[] = {
 	},
 };
 
-static int aw88166_get_fade_in_time(struct snd_kcontrol *kcontrol,
-	struct snd_ctl_elem_value *ucontrol)
-{
-	struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
-	struct aw88166 *aw88166 = snd_soc_component_get_drvdata(component);
-	struct aw_device *aw_dev = aw88166->aw_pa;
-
-	ucontrol->value.integer.value[0] = aw_dev->fade_in_time;
-
-	return 0;
-}
-
-static int aw88166_set_fade_in_time(struct snd_kcontrol *kcontrol,
-	struct snd_ctl_elem_value *ucontrol)
-{
-	struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
-	struct aw88166 *aw88166 = snd_soc_component_get_drvdata(component);
-	struct soc_mixer_control *mc =
-		(struct soc_mixer_control *)kcontrol->private_value;
-	struct aw_device *aw_dev = aw88166->aw_pa;
-	int time;
-
-	time = ucontrol->value.integer.value[0];
-
-	if (time < mc->min || time > mc->max)
-		return -EINVAL;
-
-	if (time != aw_dev->fade_in_time) {
-		aw_dev->fade_in_time = time;
-		return 1;
-	}
-
-	return 0;
-}
-
-static int aw88166_get_fade_out_time(struct snd_kcontrol *kcontrol,
-	struct snd_ctl_elem_value *ucontrol)
-{
-	struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
-	struct aw88166 *aw88166 = snd_soc_component_get_drvdata(component);
-	struct aw_device *aw_dev = aw88166->aw_pa;
-
-	ucontrol->value.integer.value[0] = aw_dev->fade_out_time;
-
-	return 0;
-}
-
-static int aw88166_set_fade_out_time(struct snd_kcontrol *kcontrol,
-	struct snd_ctl_elem_value *ucontrol)
-{
-	struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
-	struct aw88166 *aw88166 = snd_soc_component_get_drvdata(component);
-	struct soc_mixer_control *mc =
-		(struct soc_mixer_control *)kcontrol->private_value;
-	struct aw_device *aw_dev = aw88166->aw_pa;
-	int time;
-
-	time = ucontrol->value.integer.value[0];
-	if (time < mc->min || time > mc->max)
-		return -EINVAL;
-
-	if (time != aw_dev->fade_out_time) {
-		aw_dev->fade_out_time = time;
-		return 1;
-	}
-
-	return 0;
-}
-
 static int aw88166_dev_set_profile_index(struct aw_device *aw_dev, int index)
 {
 	/* check the index whether is valid */
@@ -1704,38 +1592,6 @@ static int aw88166_volume_set(struct snd_kcontrol *kcontrol,
 	return 0;
 }
 
-static int aw88166_get_fade_step(struct snd_kcontrol *kcontrol,
-				struct snd_ctl_elem_value *ucontrol)
-{
-	struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
-	struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec);
-
-	ucontrol->value.integer.value[0] = aw88166->aw_pa->fade_step;
-
-	return 0;
-}
-
-static int aw88166_set_fade_step(struct snd_kcontrol *kcontrol,
-				struct snd_ctl_elem_value *ucontrol)
-{
-	struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol);
-	struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec);
-	struct soc_mixer_control *mc =
-		(struct soc_mixer_control *)kcontrol->private_value;
-	int value;
-
-	value = ucontrol->value.integer.value[0];
-	if (value < mc->min || value > mc->max)
-		return -EINVAL;
-
-	if (aw88166->aw_pa->fade_step != value) {
-		aw88166->aw_pa->fade_step = value;
-		return 1;
-	}
-
-	return 0;
-}
-
 static int aw88166_re_get(struct snd_kcontrol *kcontrol,
 				struct snd_ctl_elem_value *ucontrol)
 {
@@ -1780,8 +1636,6 @@ static int aw88166_dev_init(struct aw88166 *aw88166, struct aw_container *aw_cfg
 		dev_err(aw_dev->dev, "aw_dev acf parse failed\n");
 		return -EINVAL;
 	}
-	aw_dev->fade_in_time = AW88166_1000_US / 10;
-	aw_dev->fade_out_time = AW88166_1000_US >> 1;
 	aw_dev->prof_cur = aw_dev->prof_info.prof_desc[0].id;
 	aw_dev->prof_index = aw_dev->prof_info.prof_desc[0].id;
 
@@ -1856,12 +1710,6 @@ static const struct snd_kcontrol_new aw88166_controls[] = {
 	SOC_SINGLE_EXT("PCM Playback Volume", AW88166_SYSCTRL2_REG,
 		6, AW88166_MUTE_VOL, 0, aw88166_volume_get,
 		aw88166_volume_set),
-	SOC_SINGLE_EXT("Fade Step", 0, 0, AW88166_MUTE_VOL, 0,
-		aw88166_get_fade_step, aw88166_set_fade_step),
-	SOC_SINGLE_EXT("Volume Ramp Up Step", 0, 0, FADE_TIME_MAX, FADE_TIME_MIN,
-		aw88166_get_fade_in_time, aw88166_set_fade_in_time),
-	SOC_SINGLE_EXT("Volume Ramp Down Step", 0, 0, FADE_TIME_MAX, FADE_TIME_MIN,
-		aw88166_get_fade_out_time, aw88166_set_fade_out_time),
 	SOC_SINGLE_EXT("Calib", 0, 0, AW88166_CALI_RE_MAX, 0,
 		aw88166_re_get, aw88166_re_set),
 	AW88166_PROFILE_EXT("AW88166 Profile Set", aw88166_profile_info,
@@ -1989,7 +1837,6 @@ static int aw88166_init(struct aw88166 *aw88166, struct i2c_client *i2c, struct
 	aw_dev->channel = AW88166_DEV_DEFAULT_CH;
 	aw_dev->fw_status = AW88166_DEV_FW_FAILED;
 
-	aw_dev->fade_step = AW88166_VOLUME_STEP_DB;
 	aw_dev->volume_desc.ctl_volume = AW88166_VOL_DEFAULT_VALUE;
 
 	aw88166_parse_channel_dt(aw88166);
diff --git a/sound/soc/codecs/aw88166.h b/sound/soc/codecs/aw88166.h
index 377a733447e70..1a61e56f607c9 100644
--- a/sound/soc/codecs/aw88166.h
+++ b/sound/soc/codecs/aw88166.h
@@ -607,8 +607,6 @@
 #define AW88166_DEV_SYSST_CHECK_MAX		(10)
 #define AW88166_START_RETRIES			(5)
 #define AW88166_START_WORK_DELAY_MS		(0)
-#define FADE_TIME_MAX				100000
-#define FADE_TIME_MIN				0
 #define AW88166_CHIP_ID			(0x2066)
 #define AW88166_I2C_NAME			"aw88166"
 #define AW88166_ACF_FILE			"aw88166_acf.bin"

-- 
2.54.0



  parent reply	other threads:[~2026-09-25  7:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25  7:47 [PATCH 0/6] ASoC: codecs: aw88166: fixes and cleanup Aaron Kling via B4 Relay
2026-09-25  7:47 ` [PATCH 1/6] ASoC: codecs: aw88166: support changing sample rate and bit width Aaron Kling via B4 Relay
2026-09-25 14:00   ` Mark Brown
2026-09-25 15:56     ` Aaron Kling
2026-09-25  7:47 ` [PATCH 2/6] ASoC: codecs: aw88166: add TDM support Aaron Kling via B4 Relay
2026-09-25  7:47 ` [PATCH 3/6] ASoC: codecs: aw88166: reduce log spam Aaron Kling via B4 Relay
2026-09-25  7:47 ` Aaron Kling via B4 Relay [this message]
2026-09-25 14:11   ` [PATCH 4/6] ASoC: codecs: aw88166: remove fade in/out on start/stop Mark Brown
2026-09-25 15:59     ` Aaron Kling
2026-09-25 16:27       ` Mark Brown
2026-09-25  7:47 ` [PATCH 5/6] ASoC: codecs: aw88166: remove async start Aaron Kling via B4 Relay
2026-09-25 14:12   ` Mark Brown
2026-09-25 15:44     ` Aaron Kling
2026-09-25 16:06       ` Mark Brown
2026-09-25 16:16         ` Aaron Kling
2026-09-25 16:27           ` Mark Brown
2026-09-25 14:35   ` Cezary Rojewski
2026-09-25 15:42     ` Aaron Kling
2026-09-25  7:47 ` [PATCH 6/6] ASoC: codecs: aw88166: make volume control usable Aaron Kling via B4 Relay
2026-09-25 14:18   ` Mark Brown
2026-09-25 16:05     ` Aaron Kling
2026-09-25 16:18       ` Mark Brown
2026-09-25 16:25         ` Aaron Kling
2026-09-25 16:33           ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260925-aw88166-cleanup-v1-4-11f74cb5fe28@gmail.com \
    --to=devnull+webgeek1234.gmail.com@kernel.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=val@packett.cool \
    --cc=wangweidong.a@awinic.com \
    --cc=webgeek1234@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®