From patchwork Wed May 19 03:21:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koba Ko X-Patchwork-Id: 1480649 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FlJ7h1Y7Jz9sXF; Wed, 19 May 2021 13:21:52 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1ljCmK-0004gv-9e; Wed, 19 May 2021 03:21:48 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ljCmG-0004fH-L4 for kernel-team@lists.ubuntu.com; Wed, 19 May 2021 03:21:44 +0000 Received: from mail-pg1-f198.google.com ([209.85.215.198]) by youngberry.canonical.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1ljCmG-00054Y-BW for kernel-team@lists.ubuntu.com; Wed, 19 May 2021 03:21:44 +0000 Received: by mail-pg1-f198.google.com with SMTP id 30-20020a630a1e0000b029021a63d9d4cdso7526668pgk.11 for ; Tue, 18 May 2021 20:21:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pQBQwWtPO1ZSZX1GZf0NurBj3iKiO4FySAptm7c7XWw=; b=EgPpLxYU2HkNTHfRdsUsAvvDM14jaM0n9fIqCmY9k5akBNq1iIKU57Yyc5oGraGktT 8dQQegyYk5+qw13AA5VjDiVrHJKgpM7RaFdZvsM9u9IS+sZ8WehV8zMfat0qrh5is/qh sllRnXQzGwXHOQf7Sh3eWNufOsfHHTumDUXC4CAV3FCZZe+d76q1KVViaofvH2J8I8Rt 1gnJFo+g1amivdBCuJE7/Kqixkcopn+GCfayFm3qHoX3y2ZmlL+NDMQ5pRwPC08Ynivq IcAcZ+rKch/zE1gHeHXPVSsKLAAwmRoPIWpdiemUyKKfbpRfwkaA9DmVnfyNLzxPs0MH THBA== X-Gm-Message-State: AOAM531q5eQryg3b1aIuktpps753UjCRST4bdtNHct72m/4wcC9CVyGF nQgx+LFDejKMaMm3d/LdgYsu15X0wJWdNuv2VddXBZJWudU4ygpzekaSj1ecKrRgT87bs+1gAy6 WPHzAzy37U+YhbRf8vM7Euc4LZw/cAExdAeB+NNJDKw== X-Received: by 2002:a17:902:aa8f:b029:ef:61a:5864 with SMTP id d15-20020a170902aa8fb02900ef061a5864mr8382239plr.2.1621394502762; Tue, 18 May 2021 20:21:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw64+nYk4ZbX1UDXKGSRYA/8tvHXa+nI8iCBMjxpYVr0/vVxvj2O6ranEKaJha8OkpjQ7oG8Q== X-Received: by 2002:a17:902:aa8f:b029:ef:61a:5864 with SMTP id d15-20020a170902aa8fb02900ef061a5864mr8382215plr.2.1621394502429; Tue, 18 May 2021 20:21:42 -0700 (PDT) Received: from canonical.com (61-220-137-34.HINET-IP.hinet.net. [61.220.137.34]) by smtp.gmail.com with ESMTPSA id g1sm13631005pgi.64.2021.05.18.20.21.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 20:21:42 -0700 (PDT) From: Koba Ko To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/7][SRU][OEM-5.10] ASoC: rt715: remove kcontrols which no longer be used Date: Wed, 19 May 2021 11:21:27 +0800 Message-Id: <20210519032135.395668-3-koba.ko@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210519032135.395668-1-koba.ko@canonical.com> References: <20210519032135.395668-1-koba.ko@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Jack Yu BugLink: https://bugs.launchpad.net/bugs/1928750 Using new kcontrols "Capture Switch" and "Capture Volume" instead, remove kcontrols which no longer be used. Signed-off-by: Jack Yu Link: https://lore.kernel.org/r/5c314f5512654aca9fff0195f77264de@realtek.com Signed-off-by: Mark Brown (cherry picked from commit fa2f98378f941786a93f8e63696f59fb4ac7538b) Signed-off-by: Koba Ko --- sound/soc/codecs/rt715.c | 103 +++++++++++++-------------------------- sound/soc/codecs/rt715.h | 1 + 2 files changed, 36 insertions(+), 68 deletions(-) diff --git a/sound/soc/codecs/rt715.c b/sound/soc/codecs/rt715.c index 80ea7d1794add..4b1e9c745ead3 100644 --- a/sound/soc/codecs/rt715.c +++ b/sound/soc/codecs/rt715.c @@ -81,12 +81,20 @@ static int rt715_set_amp_gain_put(struct snd_kcontrol *kcontrol, (struct soc_mixer_control *)kcontrol->private_value; struct rt715_priv *rt715 = snd_soc_component_get_drvdata(component); unsigned int addr_h, addr_l, val_h, val_ll, val_lr; - unsigned int read_ll, read_rl; - int i; + unsigned int read_ll, read_rl, i; + unsigned int k_vol_changed = 0; + + for (i = 0; i < 2; i++) { + if (ucontrol->value.integer.value[i] != rt715->kctl_2ch_vol_ori[i]) { + k_vol_changed = 1; + break; + } + } /* Can't use update bit function, so read the original value first */ addr_h = mc->reg; addr_l = mc->rreg; + if (mc->shift == RT715_DIR_OUT_SFT) /* output */ val_h = 0x80; else /* input */ @@ -94,41 +102,27 @@ static int rt715_set_amp_gain_put(struct snd_kcontrol *kcontrol, rt715_get_gain(rt715, addr_h, addr_l, val_h, &read_rl, &read_ll); + if (dapm->bias_level <= SND_SOC_BIAS_STANDBY) + regmap_write(rt715->regmap, + RT715_SET_AUDIO_POWER_STATE, AC_PWRST_D0); + /* L Channel */ - if (mc->invert) { - /* for mute */ - val_ll = (mc->max - ucontrol->value.integer.value[0]) << 7; - /* keep gain */ - read_ll = read_ll & 0x7f; - val_ll |= read_ll; - } else { - /* for gain */ - val_ll = ((ucontrol->value.integer.value[0]) & 0x7f); - if (val_ll > mc->max) - val_ll = mc->max; - /* keep mute status */ - read_ll = read_ll & 0x80; - val_ll |= read_ll; - } + rt715->kctl_2ch_vol_ori[0] = ucontrol->value.integer.value[0]; + /* for gain */ + val_ll = ((ucontrol->value.integer.value[0]) & 0x7f); + if (val_ll > mc->max) + val_ll = mc->max; + /* keep mute status */ + val_ll |= read_ll & 0x80; /* R Channel */ - if (mc->invert) { - regmap_write(rt715->regmap, - RT715_SET_AUDIO_POWER_STATE, AC_PWRST_D0); - /* for mute */ - val_lr = (mc->max - ucontrol->value.integer.value[1]) << 7; - /* keep gain */ - read_rl = read_rl & 0x7f; - val_lr |= read_rl; - } else { - /* for gain */ - val_lr = ((ucontrol->value.integer.value[1]) & 0x7f); - if (val_lr > mc->max) - val_lr = mc->max; - /* keep mute status */ - read_rl = read_rl & 0x80; - val_lr |= read_rl; - } + rt715->kctl_2ch_vol_ori[1] = ucontrol->value.integer.value[1]; + /* for gain */ + val_lr = ((ucontrol->value.integer.value[1]) & 0x7f); + if (val_lr > mc->max) + val_lr = mc->max; + /* keep mute status */ + val_lr |= read_rl & 0x80; for (i = 0; i < 3; i++) { /* retry 3 times at most */ @@ -136,18 +130,18 @@ static int rt715_set_amp_gain_put(struct snd_kcontrol *kcontrol, /* Set both L/R channels at the same time */ val_h = (1 << mc->shift) | (3 << 4); regmap_write(rt715->regmap, addr_h, - (val_h << 8 | val_ll)); + (val_h << 8) | val_ll); regmap_write(rt715->regmap, addr_l, - (val_h << 8 | val_ll)); + (val_h << 8) | val_ll); } else { /* Lch*/ val_h = (1 << mc->shift) | (1 << 5); regmap_write(rt715->regmap, addr_h, - (val_h << 8 | val_ll)); + (val_h << 8) | val_ll); /* Rch */ val_h = (1 << mc->shift) | (1 << 4); regmap_write(rt715->regmap, addr_l, - (val_h << 8 | val_lr)); + (val_h << 8) | val_lr); } /* check result */ if (mc->shift == RT715_DIR_OUT_SFT) /* output */ @@ -156,15 +150,16 @@ static int rt715_set_amp_gain_put(struct snd_kcontrol *kcontrol, val_h = 0x0; rt715_get_gain(rt715, addr_h, addr_l, val_h, - &read_rl, &read_ll); + &read_rl, &read_ll); if (read_rl == val_lr && read_ll == val_ll) break; } + /* D0:power on state, D3: power saving mode */ if (dapm->bias_level <= SND_SOC_BIAS_STANDBY) regmap_write(rt715->regmap, RT715_SET_AUDIO_POWER_STATE, AC_PWRST_D3); - return 0; + return k_vol_changed; } static int rt715_set_amp_gain_get(struct snd_kcontrol *kcontrol, @@ -466,37 +461,9 @@ static int rt715_vol_info(struct snd_kcontrol *kcontrol, static const struct snd_kcontrol_new rt715_snd_controls[] = { /* Capture switch */ - SOC_DOUBLE_R_EXT("ADC 07 Capture Switch", RT715_SET_GAIN_MIC_ADC_H, - RT715_SET_GAIN_MIC_ADC_L, RT715_DIR_IN_SFT, 1, 1, - rt715_set_amp_gain_get, rt715_set_amp_gain_put), - SOC_DOUBLE_R_EXT("ADC 08 Capture Switch", RT715_SET_GAIN_LINE_ADC_H, - RT715_SET_GAIN_LINE_ADC_L, RT715_DIR_IN_SFT, 1, 1, - rt715_set_amp_gain_get, rt715_set_amp_gain_put), - SOC_DOUBLE_R_EXT("ADC 09 Capture Switch", RT715_SET_GAIN_MIX_ADC_H, - RT715_SET_GAIN_MIX_ADC_L, RT715_DIR_IN_SFT, 1, 1, - rt715_set_amp_gain_get, rt715_set_amp_gain_put), - SOC_DOUBLE_R_EXT("ADC 27 Capture Switch", RT715_SET_GAIN_MIX_ADC2_H, - RT715_SET_GAIN_MIX_ADC2_L, RT715_DIR_IN_SFT, 1, 1, - rt715_set_amp_gain_get, rt715_set_amp_gain_put), RT715_MAIN_SWITCH_EXT("Capture Switch", rt715_set_main_switch_get, rt715_set_main_switch_put), /* Volume Control */ - SOC_DOUBLE_R_EXT_TLV("ADC 07 Capture Volume", RT715_SET_GAIN_MIC_ADC_H, - RT715_SET_GAIN_MIC_ADC_L, RT715_DIR_IN_SFT, 0x3f, 0, - rt715_set_amp_gain_get, rt715_set_amp_gain_put, - in_vol_tlv), - SOC_DOUBLE_R_EXT_TLV("ADC 08 Capture Volume", RT715_SET_GAIN_LINE_ADC_H, - RT715_SET_GAIN_LINE_ADC_L, RT715_DIR_IN_SFT, 0x3f, 0, - rt715_set_amp_gain_get, rt715_set_amp_gain_put, - in_vol_tlv), - SOC_DOUBLE_R_EXT_TLV("ADC 09 Capture Volume", RT715_SET_GAIN_MIX_ADC_H, - RT715_SET_GAIN_MIX_ADC_L, RT715_DIR_IN_SFT, 0x3f, 0, - rt715_set_amp_gain_get, rt715_set_amp_gain_put, - in_vol_tlv), - SOC_DOUBLE_R_EXT_TLV("ADC 27 Capture Volume", RT715_SET_GAIN_MIX_ADC2_H, - RT715_SET_GAIN_MIX_ADC2_L, RT715_DIR_IN_SFT, 0x3f, 0, - rt715_set_amp_gain_get, rt715_set_amp_gain_put, - in_vol_tlv), RT715_MAIN_VOL_EXT_TLV("Capture Volume", rt715_set_main_vol_get, rt715_set_main_vol_put, in_vol_tlv), /* MIC Boost Control */ diff --git a/sound/soc/codecs/rt715.h b/sound/soc/codecs/rt715.h index d07d7a0dfac44..7e8573f89f11c 100644 --- a/sound/soc/codecs/rt715.h +++ b/sound/soc/codecs/rt715.h @@ -22,6 +22,7 @@ struct rt715_priv { struct sdw_bus_params params; bool hw_init; bool first_hw_init; + unsigned int kctl_2ch_vol_ori[2]; unsigned int kctl_8ch_switch_ori[8]; unsigned int kctl_8ch_vol_ori[8]; };