From patchwork Wed Oct 22 01:14:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 5129161 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1690CC11AC for ; Wed, 22 Oct 2014 01:19:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 332B8201FE for ; Wed, 22 Oct 2014 01:19:16 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id E864720117 for ; Wed, 22 Oct 2014 01:19:14 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id DF1C4265182; Wed, 22 Oct 2014 03:19:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id B5F0B261ADA; Wed, 22 Oct 2014 03:16:04 +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 056352625E3; Wed, 22 Oct 2014 03:16:03 +0200 (CEST) Received: from mail-pa0-f44.google.com (mail-pa0-f44.google.com [209.85.220.44]) by alsa0.perex.cz (Postfix) with ESMTP id B4ED026262D for ; Wed, 22 Oct 2014 03:14:56 +0200 (CEST) Received: by mail-pa0-f44.google.com with SMTP id et14so2602676pad.3 for ; Tue, 21 Oct 2014 18:14:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:from:subject:user-agent:to:cc:in-reply-to :references:mime-version:content-type; bh=Na/uOxGjYi+mSdcewgvjx+kDoP7q5xsKZ6eQSdGkikE=; b=yZKPcjj49lw3/W4oKddr4FCVppfwYPof39loerzUYteh4oJiDQ49SNTsWRgY707GR9 WpMxslBMK/drMG9NmMVnFgC4a/riGRE+Unqes7A/CA18pMBDamJnH4bjufCXQv/9f51h 22FyWufoKwu/cFb1MLUNd1+VtkGpZNen6xpsdmkTaPSuV/osCssbe+fG6AoooSVMYrQQ bdS/om7fMtuN5zdkIO0gciKT4X58RHvsIT84JMJhoEY4YsxlWfulpqhrwc8eLE/B052q XHOBaI5WgTvKVqev5HdDoor0bd/tsnRXDVcKHbjPWSC6kVRP5cGsCem4sdTIFTtRYp8m hd7A== X-Received: by 10.68.108.36 with SMTP id hh4mr17971005pbb.108.1413940495810; Tue, 21 Oct 2014 18:14:55 -0700 (PDT) Received: from remon.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPSA id wv1sm13113713pab.37.2014.10.21.18.14.53 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 21 Oct 2014 18:14:55 -0700 (PDT) Date: Tue, 21 Oct 2014 18:14:55 -0700 (PDT) Message-ID: <87tx2w6h2r.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 To: Mark Brown In-Reply-To: <8761fc7vpx.wl%kuninori.morimoto.gx@gmail.com> References: <8761fc7vpx.wl%kuninori.morimoto.gx@gmail.com> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: Linux-ALSA , Simon , Liam Girdwood , Kuninori Morimoto Subject: [alsa-devel] [PATCH 8/8] ASoC: rsnd: Add Volume Ramp support 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: Kuninori Morimoto This patch adds Volume Ramp to Renesas sound driver. This sample indicates Mute -> Volume 100% -> Mute amixer set "DVC Out Ramp" 100% // Mute as default amixer set "DVC Out Ramp Period" 80% amixer set "DVC Out Ramp Enable" on aplay xxx.wav & amixer set "DVC Out Ramp" 0% // to Volume 100% amixer set "DVC Out Ramp" 100% // to Mute Signed-off-by: Kuninori Morimoto --- sound/soc/sh/rcar/dvc.c | 34 ++++++++++++++++++++++++++++++++++ sound/soc/sh/rcar/gen.c | 3 +++ sound/soc/sh/rcar/rsnd.h | 6 ++++++ 3 files changed, 43 insertions(+) diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c index 2654ab0..f353f7d 100644 --- a/sound/soc/sh/rcar/dvc.c +++ b/sound/soc/sh/rcar/dvc.c @@ -37,6 +37,9 @@ struct rsnd_dvc { struct clk *clk; struct rsnd_dvc_cfg_m volume; struct rsnd_dvc_cfg_m mute; + struct rsnd_dvc_cfg_s ren; /* Ramp Enable */ + struct rsnd_dvc_cfg_s rperiod; /* Ramp Period */ + struct rsnd_dvc_cfg_s rvol; /* Ramp Volume */ }; #define rsnd_mod_to_dvc(_mod) \ @@ -66,6 +69,15 @@ static void rsnd_dvc_volume_update(struct rsnd_mod *mod) rsnd_mod_write(mod, DVC_VOL0R, dvc->volume.val[0]); rsnd_mod_write(mod, DVC_VOL1R, dvc->volume.val[1]); + /* Enable Ramp */ + if (dvc->ren.val) { + dvucr |= 0x10; + rsnd_mod_write(mod, DVC_VRCTR, 0xff); + rsnd_mod_write(mod, DVC_VRPDR, dvc->rperiod.val << 8 | + dvc->rperiod.val); + rsnd_mod_write(mod, DVC_VRDBR, dvc->rvol.val); + } + /* Enable Mute */ if (mute) { dvucr |= 0x1; @@ -290,6 +302,28 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, if (ret < 0) return ret; + /* Ramp */ + ret = _rsnd_dvc_pcm_new_s(mod, rdai, rtd, + rsnd_dai_is_play(rdai, io) ? + "DVC Out Ramp Enable" : "DVC In Ramp Enable", + &dvc->ren, 1); + if (ret < 0) + return ret; + + ret = _rsnd_dvc_pcm_new_s(mod, rdai, rtd, + rsnd_dai_is_play(rdai, io) ? + "DVC Out Ramp Period" : "DVC In Ramp Period", + &dvc->rperiod, 0x17); /* 10111 */ + if (ret < 0) + return ret; + + ret = _rsnd_dvc_pcm_new_s(mod, rdai, rtd, + rsnd_dai_is_play(rdai, io) ? + "DVC Out Ramp Volume" : "DVC In Ramp Volume", + &dvc->rvol, 0x3ff); + if (ret < 0) + return ret; + return 0; } diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c index 61dee68..4cb3202 100644 --- a/sound/soc/sh/rcar/gen.c +++ b/sound/soc/sh/rcar/gen.c @@ -324,6 +324,9 @@ static int rsnd_gen2_probe(struct platform_device *pdev, RSND_GEN_M_REG(DVC_ADINR, 0xe08, 0x100), RSND_GEN_M_REG(DVC_DVUCR, 0xe10, 0x100), RSND_GEN_M_REG(DVC_ZCMCR, 0xe14, 0x100), + RSND_GEN_M_REG(DVC_VRCTR, 0xe18, 0x100), + RSND_GEN_M_REG(DVC_VRPDR, 0xe1c, 0x100), + RSND_GEN_M_REG(DVC_VRDBR, 0xe20, 0x100), RSND_GEN_M_REG(DVC_VOL0R, 0xe28, 0x100), RSND_GEN_M_REG(DVC_VOL1R, 0xe2c, 0x100), RSND_GEN_M_REG(DVC_DVUER, 0xe48, 0x100), diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index d119adf..ed44ca8 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h @@ -91,6 +91,9 @@ enum rsnd_reg { RSND_REG_SHARE20, RSND_REG_SHARE21, RSND_REG_SHARE22, + RSND_REG_SHARE23, + RSND_REG_SHARE24, + RSND_REG_SHARE25, RSND_REG_MAX, }; @@ -129,6 +132,9 @@ enum rsnd_reg { #define RSND_REG_CMD_CTRL RSND_REG_SHARE20 #define RSND_REG_CMDOUT_TIMSEL RSND_REG_SHARE21 #define RSND_REG_BUSIF_DALIGN RSND_REG_SHARE22 +#define RSND_REG_DVC_VRCTR RSND_REG_SHARE23 +#define RSND_REG_DVC_VRPDR RSND_REG_SHARE24 +#define RSND_REG_DVC_VRDBR RSND_REG_SHARE25 struct rsnd_of_data; struct rsnd_priv;