From patchwork Tue Mar 24 05:15:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 6077221 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6262D9F350 for ; Tue, 24 Mar 2015 05:15:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 81B9920260 for ; Tue, 24 Mar 2015 05:15:48 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 5CA67201FA for ; Tue, 24 Mar 2015 05:15:47 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id BF7BF264ED5; Tue, 24 Mar 2015 06:15:45 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id B73A8261A06; Tue, 24 Mar 2015 06:15:36 +0100 (CET) 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 C1A73261A1A; Tue, 24 Mar 2015 06:15:34 +0100 (CET) Received: from relmlie2.idc.renesas.com (relmlor3.renesas.com [210.160.252.173]) by alsa0.perex.cz (Postfix) with ESMTP id B02B926059D for ; Tue, 24 Mar 2015 06:15:26 +0100 (CET) Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 24 Mar 2015 14:15:25 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 481DC4DBCD; Tue, 24 Mar 2015 14:15:25 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 2EC5C1806F; Tue, 24 Mar 2015 14:15:25 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 0E2B71800A; Tue, 24 Mar 2015 14:15:25 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac3.idc.renesas.com with ESMTP id QAM01606; Tue, 24 Mar 2015 14:15:25 +0900 X-IronPort-AV: E=Sophos;i="5.11,456,1422889200"; d="scan'208";a="183754986" Received: from mail-hk1lp0118.outbound.protection.outlook.com (HELO APAC01-HK1-obe.outbound.protection.outlook.com) ([207.46.51.118]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 24 Mar 2015 14:15:24 +0900 Received: from morimoto-PC.renesas.com (211.11.155.132) by HKNPR06MB306.apcprd06.prod.outlook.com (10.141.37.22) with Microsoft SMTP Server (TLS) id 15.1.118.21; Tue, 24 Mar 2015 05:15:22 +0000 Message-ID: <87zj732czb.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown In-Reply-To: <87twxheu5v.wl%kuninori.morimoto.gx@renesas.com> References: <48da12db060643659c4a3e0aaecab8ae@SG2PR06MB0444.apcprd06.prod.outlook.com> <87k3322y9t.wl%kuninori.morimoto.gx@renesas.com> <408f9957846943228e7b601c7f0aa762@SG2PR06MB0444.apcprd06.prod.outlook.com> <98c8d06270e54ab6a30ce598d2550046@HK2PR06MB0419.apcprd06.prod.outlook.com> <878ugyatwn.wl%kuninori.morimoto.gx@renesas.com> <54BDF626.9000100@renesas.com> <87sif4n07q.wl%kuninori.morimoto.gx@renesas.com> <54C039A7.2080308@renesas.com> <87sif2fbx8.wl%kuninori.morimoto.gx@renesas.com> <87lhkuf381.wl%kuninori.morimoto.gx@renesas.com> <871tmiawp0.wl%kuninori.morimoto.gx@renesas.com> <87vbj64dsa.wl%kuninori.morimoto.gx@renesas.com> <54DDCF15.1060205@renesas.com> <87d25an1z5.wl%kuninori.morimoto.gx@renesas.com> <54E7314A.7070902@renesas.com> <54EFB1B9.8060004@renesas.com> <87ioenhqa8.wl%kuninori.morimoto.gx@renesas.com> <87ioe9sa2y.wl%kuninori.morimoto.gx@renesas.com> <550A0C63.6030305@renesas.com> <87twxheu5v.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Tue, 24 Mar 2015 05:15:22 +0000 X-Originating-IP: [211.11.155.132] X-ClientProxiedBy: OS2PR01CA0009.jpnprd01.prod.outlook.com (25.161.74.147) To HKNPR06MB306.apcprd06.prod.outlook.com (10.141.37.22) Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HKNPR06MB306; X-Microsoft-Antispam-PRVS: X-Forefront-Antispam-Report: BMV:1; SFV:NSPM; SFS:(10019020)(6009001)(54356999)(23726002)(77156002)(229853001)(62966003)(50466002)(93886004)(33646002)(86362001)(19580405001)(76176999)(87976001)(83506001)(19580395003)(110136001)(53416004)(77096005)(47776003)(92566002)(2950100001)(50986999)(40100003)(42186005)(36756003)(66066001)(46406003)(122386002)(46102003); DIR:OUT; SFP:1102; SCL:1; SRVR:HKNPR06MB306; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(5002010); SRVR:HKNPR06MB306; BCL:0; PCL:0; RULEID:; SRVR:HKNPR06MB306; X-Forefront-PRVS: 0525BB0ADF X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2015 05:15:22.3914 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKNPR06MB306 Cc: tomoharu.fukawa.eb@renesas.com, Linux-ALSA , naoya.shiiba.nx@renesas.com, Liam Girdwood , toshiaki.komatsu.ud@renesas.com, ryo.kataoka.wt@renesas.com, Simon , "takeshi.kihara" , kuninori.morimoto.gx@gmail.com Subject: [alsa-devel] [PATCH] ASoC: ak4642: enable stereo line output power-save mode 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 From: Takeshi Kihara ak4642 has power-save mode for stereo line to reduce pop noise. This patch enables it. Signed-off-by: Takeshi Kihara Signed-off-by: Kuninori Morimoto --- sound/soc/codecs/ak4642.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index 7255f69..24ceb36 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -97,6 +97,9 @@ #define PMMP (1 << 2) /* MPWR pin Power Management */ #define MGAIN0 (1 << 0) /* MIC amp gain*/ +/* SG_SL2 */ +#define LOPS (1 << 6) /* Stero Line-out Power Save Mode */ + /* TIMER */ #define ZTM(param) ((param & 0x3) << 4) /* ALC Zero Crossing TimeOut */ #define WTM(param) (((param & 0x4) << 4) | ((param & 0x3) << 2)) @@ -168,6 +171,29 @@ static const struct snd_kcontrol_new ak4642_lout_mixer_controls[] = { SOC_DAPM_SINGLE("DACL", SG_SL1, 4, 1, 0), }; +/* event handlers */ +static int ak4642_lout_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event) +{ + struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); + + switch (event) { + case SND_SOC_DAPM_PRE_PMD: + case SND_SOC_DAPM_PRE_PMU: + /* Power save mode ON */ + snd_soc_update_bits(codec, SG_SL2, LOPS, LOPS); + break; + case SND_SOC_DAPM_POST_PMU: + case SND_SOC_DAPM_POST_PMD: + /* Power save mode OFF */ + mdelay(300); + snd_soc_update_bits(codec, SG_SL2, LOPS, 0); + break; + } + + return 0; +} + static const struct snd_soc_dapm_widget ak4642_dapm_widgets[] = { /* Outputs */ @@ -182,9 +208,12 @@ static const struct snd_soc_dapm_widget ak4642_dapm_widgets[] = { SND_SOC_DAPM_PGA("DACH", MD_CTL4, 0, 0, NULL, 0), - SND_SOC_DAPM_MIXER("LINEOUT Mixer", PW_MGMT1, 3, 0, + SND_SOC_DAPM_MIXER_E("LINEOUT Mixer", PW_MGMT1, 3, 0, &ak4642_lout_mixer_controls[0], - ARRAY_SIZE(ak4642_lout_mixer_controls)), + ARRAY_SIZE(ak4642_lout_mixer_controls), + ak4642_lout_event, + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | + SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD), /* DAC */ SND_SOC_DAPM_DAC("DAC", NULL, PW_MGMT1, 2, 0),