From patchwork Wed Jun 28 12:53:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Keepax X-Patchwork-Id: 9814407 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E8BC160383 for ; Wed, 28 Jun 2017 14:32:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 800C827FAD for ; Wed, 28 Jun 2017 14:32:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7468B28517; Wed, 28 Jun 2017 14:32:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UPPERCASE_50_75 autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9980727FAD for ; Wed, 28 Jun 2017 14:32:15 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 01BDE267196; Wed, 28 Jun 2017 16:31:15 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 368EB2670C0; Wed, 28 Jun 2017 14:53:23 +0200 (CEST) Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by alsa0.perex.cz (Postfix) with ESMTP id 91E4A266AF8 for ; Wed, 28 Jun 2017 14:53:20 +0200 (CEST) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v5SCoFu4024325; Wed, 28 Jun 2017 07:53:19 -0500 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from mail1.cirrus.com (mail1.cirrus.com [141.131.3.20]) by mx0b-001ae601.pphosted.com with ESMTP id 2b9mgm624d-1; Wed, 28 Jun 2017 07:53:19 -0500 Received: from EX17.ad.cirrus.com (unknown [172.20.9.81]) by mail1.cirrus.com (Postfix) with ESMTP id 714EB6121AC6; Wed, 28 Jun 2017 07:53:18 -0500 (CDT) Received: from imbe.wolfsonmicro.main (198.61.95.81) by EX17.ad.cirrus.com (172.20.9.81) with Microsoft SMTP Server id 14.3.301.0; Wed, 28 Jun 2017 13:53:17 +0100 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.223.36]) by imbe.wolfsonmicro.main (8.14.4/8.14.4) with ESMTP id v5SCrHgG003542; Wed, 28 Jun 2017 13:53:17 +0100 From: Charles Keepax To: Date: Wed, 28 Jun 2017 13:53:17 +0100 Message-ID: <20170628125317.30561-1-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706280208 X-Mailman-Approved-At: Wed, 28 Jun 2017 16:31:09 +0200 Cc: patches@opensource.cirrus.com, alsa-devel@alsa-project.org, lgirdwood@gmail.com Subject: [alsa-devel] [PATCH] ASoC: arizona: Add DAC Volume Limit controls X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Add controls that allow the limiting of the volume coming from the DACs on the Arizona class devices, note that wm8998 does not have this feature. Signed-off-by: Charles Keepax --- sound/soc/codecs/cs47l24.c | 8 ++++++++ sound/soc/codecs/wm5102.c | 17 +++++++++++++++++ sound/soc/codecs/wm5110.c | 20 ++++++++++++++++++++ sound/soc/codecs/wm8997.c | 14 ++++++++++++++ 4 files changed, 59 insertions(+) diff --git a/sound/soc/codecs/cs47l24.c b/sound/soc/codecs/cs47l24.c index 47e6fddef92b..a972e63bdda5 100644 --- a/sound/soc/codecs/cs47l24.c +++ b/sound/soc/codecs/cs47l24.c @@ -78,6 +78,7 @@ static int cs47l24_adsp_power_ev(struct snd_soc_dapm_widget *w, static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); +static DECLARE_TLV_DB_SCALE(vol_limit_tlv, -600, 50, 0); static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0); static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0); @@ -203,6 +204,13 @@ SOC_SINGLE_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L, ARIZONA_OUT4L_VOL_SHIFT, 0xbf, 0, digital_tlv), +SOC_DOUBLE_R_RANGE_TLV("HPOUT1 Volume Limit", ARIZONA_DAC_VOLUME_LIMIT_1L, + ARIZONA_DAC_VOLUME_LIMIT_1R, ARIZONA_OUT1L_VOL_LIM_SHIFT, + 0x74, 0x8C, 0, vol_limit_tlv), +SOC_DOUBLE_R_RANGE_TLV("Speaker Volume Limit", ARIZONA_OUT_VOLUME_4L, + ARIZONA_OUT_VOLUME_4R, ARIZONA_OUT4L_VOL_LIM_SHIFT, + 0x74, 0x8C, 0, vol_limit_tlv), + SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp), SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp), diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c index 1fe358e6be61..7a295146524b 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c @@ -42,6 +42,7 @@ struct wm5102_priv { static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); +static DECLARE_TLV_DB_SCALE(vol_limit_tlv, -600, 50, 0); static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0); static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0); @@ -915,6 +916,22 @@ SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_5L, ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_VOL_SHIFT, 0xbf, 0, digital_tlv), +SOC_DOUBLE_R_RANGE_TLV("HPOUT1 Volume Limit", ARIZONA_DAC_VOLUME_LIMIT_1L, + ARIZONA_DAC_VOLUME_LIMIT_1R, ARIZONA_OUT1L_VOL_LIM_SHIFT, + 0x74, 0x8C, 0, vol_limit_tlv), +SOC_DOUBLE_R_RANGE_TLV("HPOUT2 Volume Limit", ARIZONA_DAC_VOLUME_LIMIT_2L, + ARIZONA_DAC_VOLUME_LIMIT_2R, ARIZONA_OUT2L_VOL_LIM_SHIFT, + 0x74, 0x8C, 0, vol_limit_tlv), +SOC_DOUBLE_R_RANGE_TLV("EPOUT Volume Limit", ARIZONA_DAC_VOLUME_LIMIT_3L, + ARIZONA_DAC_VOLUME_LIMIT_3R, ARIZONA_OUT3L_VOL_LIM_SHIFT, + 0x74, 0x8C, 0, vol_limit_tlv), +SOC_DOUBLE_R_RANGE_TLV("Speaker Volume Limit", ARIZONA_OUT_VOLUME_4L, + ARIZONA_OUT_VOLUME_4R, ARIZONA_OUT4L_VOL_LIM_SHIFT, + 0x74, 0x8C, 0, vol_limit_tlv), +SOC_DOUBLE_R_RANGE_TLV("SPKDAT1 Volume Limit", ARIZONA_DAC_VOLUME_LIMIT_5L, + ARIZONA_DAC_VOLUME_LIMIT_5R, ARIZONA_OUT5L_VOL_LIM_SHIFT, + 0x74, 0x8C, 0, vol_limit_tlv), + SOC_ENUM("HPOUT1 OSR", wm5102_hpout_osr[0]), SOC_ENUM("HPOUT2 OSR", wm5102_hpout_osr[1]), SOC_ENUM("EPOUT OSR", wm5102_hpout_osr[2]), diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index 1bc942152eff..f7cf9f7dffa6 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c @@ -575,6 +575,7 @@ static int wm5110_in_ev(struct snd_soc_dapm_widget *w, static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); +static DECLARE_TLV_DB_SCALE(vol_limit_tlv, -600, 50, 0); static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0); static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0); @@ -855,6 +856,25 @@ SOC_DOUBLE_R_TLV("SPKDAT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_6L, ARIZONA_DAC_DIGITAL_VOLUME_6R, ARIZONA_OUT6L_VOL_SHIFT, 0xbf, 0, digital_tlv), +SOC_DOUBLE_R_RANGE_TLV("HPOUT1 Volume Limit", ARIZONA_DAC_VOLUME_LIMIT_1L, + ARIZONA_DAC_VOLUME_LIMIT_1R, ARIZONA_OUT1L_VOL_LIM_SHIFT, + 0x74, 0x8C, 0, vol_limit_tlv), +SOC_DOUBLE_R_RANGE_TLV("HPOUT2 Volume Limit", ARIZONA_DAC_VOLUME_LIMIT_2L, + ARIZONA_DAC_VOLUME_LIMIT_2R, ARIZONA_OUT2L_VOL_LIM_SHIFT, + 0x74, 0x8C, 0, vol_limit_tlv), +SOC_DOUBLE_R_RANGE_TLV("HPOUT3 Volume Limit", ARIZONA_DAC_VOLUME_LIMIT_3L, + ARIZONA_DAC_VOLUME_LIMIT_3R, ARIZONA_OUT3L_VOL_LIM_SHIFT, + 0x74, 0x8C, 0, vol_limit_tlv), +SOC_DOUBLE_R_RANGE_TLV("Speaker Volume Limit", ARIZONA_OUT_VOLUME_4L, + ARIZONA_OUT_VOLUME_4R, ARIZONA_OUT4L_VOL_LIM_SHIFT, + 0x74, 0x8C, 0, vol_limit_tlv), +SOC_DOUBLE_R_RANGE_TLV("SPKDAT1 Volume Limit", ARIZONA_DAC_VOLUME_LIMIT_5L, + ARIZONA_DAC_VOLUME_LIMIT_5R, ARIZONA_OUT5L_VOL_LIM_SHIFT, + 0x74, 0x8C, 0, vol_limit_tlv), +SOC_DOUBLE_R_RANGE_TLV("SPKDAT2 Volume Limit", ARIZONA_DAC_VOLUME_LIMIT_6L, + ARIZONA_DAC_VOLUME_LIMIT_6R, ARIZONA_OUT6L_VOL_LIM_SHIFT, + 0x74, 0x8C, 0, vol_limit_tlv), + SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT, ARIZONA_SPK1R_MUTE_SHIFT, 1, 1), SOC_DOUBLE("SPKDAT2 Switch", ARIZONA_PDM_SPK2_CTRL_1, ARIZONA_SPK2L_MUTE_SHIFT, diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c index 49401a8aae64..753a1c6a1484 100644 --- a/sound/soc/codecs/wm8997.c +++ b/sound/soc/codecs/wm8997.c @@ -40,6 +40,7 @@ struct wm8997_priv { static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); +static DECLARE_TLV_DB_SCALE(vol_limit_tlv, -600, 50, 0); static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0); static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0); @@ -287,6 +288,19 @@ SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_5L, ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_VOL_SHIFT, 0xbf, 0, digital_tlv), +SOC_DOUBLE_R_RANGE_TLV("HPOUT1 Volume Limit", ARIZONA_DAC_VOLUME_LIMIT_1L, + ARIZONA_DAC_VOLUME_LIMIT_1R, ARIZONA_OUT1L_VOL_LIM_SHIFT, + 0x74, 0x8C, 0, vol_limit_tlv), +SOC_DOUBLE_R_RANGE_TLV("EPOUT Volume Limit", ARIZONA_DAC_VOLUME_LIMIT_3L, + ARIZONA_DAC_VOLUME_LIMIT_3R, ARIZONA_OUT3L_VOL_LIM_SHIFT, + 0x74, 0x8C, 0, vol_limit_tlv), +SOC_DOUBLE_R_RANGE_TLV("Speaker Volume Limit", ARIZONA_OUT_VOLUME_4L, + ARIZONA_OUT_VOLUME_4R, ARIZONA_OUT4L_VOL_LIM_SHIFT, + 0x74, 0x8C, 0, vol_limit_tlv), +SOC_DOUBLE_R_RANGE_TLV("SPKDAT1 Volume Limit", ARIZONA_DAC_VOLUME_LIMIT_5L, + ARIZONA_DAC_VOLUME_LIMIT_5R, ARIZONA_OUT5L_VOL_LIM_SHIFT, + 0x74, 0x8C, 0, vol_limit_tlv), + SOC_ENUM("HPOUT1 OSR", wm8997_hpout_osr[0]), SOC_ENUM("EPOUT OSR", wm8997_hpout_osr[1]),