From patchwork Thu Apr 30 17:17:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 6306301 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 BD9049F373 for ; Thu, 30 Apr 2015 17:19:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DC944201BB for ; Thu, 30 Apr 2015 17:19:37 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id CDF342018E for ; Thu, 30 Apr 2015 17:19:35 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C6CA8266176; Thu, 30 Apr 2015 19:19:34 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org 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 D805A2604F8; Thu, 30 Apr 2015 19:17:32 +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 0D678260573; Thu, 30 Apr 2015 19:17:31 +0200 (CEST) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by alsa0.perex.cz (Postfix) with ESMTP id 1491D260426 for ; Thu, 30 Apr 2015 19:17:06 +0200 (CEST) Received: by widdi4 with SMTP id di4so27964668wid.0 for ; Thu, 30 Apr 2015 10:17:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=e25B79bclO8CHIy3Yb4+MDB2OzfkggsxH0WZFEFmRX4=; b=m0tpWg9Tn1vmXxHEpMJjeD2183zC+EV+HiJyG5HWPqekptzUZsupEwOWppovSzcv+n T8kpoeT0YbR6cTWuxY4tKQjwnzl0YEjLNEzX25GjyEoubgQozywpOs6TddtH48COmDtu 21IX+DmZyDwutNXuTpemaTlmN4YQavFb/W80eiXKSjF6UrJimKuwZijkPmO1S7nngx4m 4dh0JHY1AMjFEFIy1NlxGTwOQXMBmOf/qlcw6qmyoG9ht3XO4yEiDP/xWAZ/TOFknXv6 RxnDRgsBTbCu69j7d6WXb8J6AfN/t/DShLm7l6uzT+3GxFZ3rBLMVEPTGiOKrVu2PLVr lnRg== X-Gm-Message-State: ALoCoQnEYLy3ZOglsqnL7dgJvILAS92S4KSBfjpWRzp23UByOLoPjzlywivFpApLHN715ttxLUps X-Received: by 10.194.236.66 with SMTP id us2mr10791018wjc.54.1430414225810; Thu, 30 Apr 2015 10:17:05 -0700 (PDT) Received: from srini-ThinkPad-X1-Carbon-2nd.dlink.com (host-2-98-219-188.as13285.net. [2.98.219.188]) by mx.google.com with ESMTPSA id l3sm3283609wiv.18.2015.04.30.10.17.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Apr 2015 10:17:05 -0700 (PDT) From: Srinivas Kandagatla To: Patrick Lai , Mark Brown Date: Thu, 30 Apr 2015 18:17:02 +0100 Message-Id: <1430414222-11039-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430414148-10869-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1430414148-10869-1-git-send-email-srinivas.kandagatla@linaro.org> Cc: devicetree@vger.kernel.org, Kenneth Westfield , Banajit Goswami , Pawel Moll , Ian Campbell , Takashi Iwai , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Liam Girdwood , Rob Herring , Srinivas Kandagatla , Kumar Gala , alsa-devel@alsa-project.org Subject: [alsa-devel] [RFC PATCH 04/14] ASoC: qcom: remove hardcoded i2s port number 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This patch attempts to remove the hardcoded i2s port number in lpass driver. Now the the port number comes from the dai id field. This will allow other SOCs to use different port numbers on the lpass driver. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/lpass-cpu.c | 17 ++++++----------- sound/soc/qcom/lpass-ipq806x.c | 1 + 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index 74b2245..7aca253 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c @@ -138,8 +138,7 @@ static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream, } ret = regmap_write(drvdata->lpaif_map, - LPAIF_I2SCTL_REG(drvdata->variant, - LPAIF_I2S_PORT_MI2S), + LPAIF_I2SCTL_REG(drvdata->variant, dai->id), regval); if (ret) { dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n", @@ -164,8 +163,7 @@ static int lpass_cpu_daiops_hw_free(struct snd_pcm_substream *substream, int ret; ret = regmap_write(drvdata->lpaif_map, - LPAIF_I2SCTL_REG(drvdata->variant, - LPAIF_I2S_PORT_MI2S), 0); + LPAIF_I2SCTL_REG(drvdata->variant, dai->id), 0); if (ret) dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n", __func__, ret); @@ -180,7 +178,7 @@ static int lpass_cpu_daiops_prepare(struct snd_pcm_substream *substream, int ret; ret = regmap_update_bits(drvdata->lpaif_map, - LPAIF_I2SCTL_REG(drvdata->variant, LPAIF_I2S_PORT_MI2S), + LPAIF_I2SCTL_REG(drvdata->variant, dai->id), LPAIF_I2SCTL_SPKEN_MASK, LPAIF_I2SCTL_SPKEN_ENABLE); if (ret) dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n", @@ -200,8 +198,7 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream, case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: ret = regmap_update_bits(drvdata->lpaif_map, - LPAIF_I2SCTL_REG(drvdata->variant, - LPAIF_I2S_PORT_MI2S), + LPAIF_I2SCTL_REG(drvdata->variant, dai->id), LPAIF_I2SCTL_SPKEN_MASK, LPAIF_I2SCTL_SPKEN_ENABLE); if (ret) @@ -212,8 +209,7 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream, case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: ret = regmap_update_bits(drvdata->lpaif_map, - LPAIF_I2SCTL_REG(drvdata->variant, - LPAIF_I2S_PORT_MI2S), + LPAIF_I2SCTL_REG(drvdata->variant, dai->id), LPAIF_I2SCTL_SPKEN_MASK, LPAIF_I2SCTL_SPKEN_DISABLE); if (ret) @@ -243,8 +239,7 @@ int lpass_cpu_dai_probe(struct snd_soc_dai *dai) /* ensure audio hardware is disabled */ ret = regmap_write(drvdata->lpaif_map, - LPAIF_I2SCTL_REG(drvdata->variant, - LPAIF_I2S_PORT_MI2S), 0); + LPAIF_I2SCTL_REG(drvdata->variant, dai->id), 0); if (ret) dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n", __func__, ret); diff --git a/sound/soc/qcom/lpass-ipq806x.c b/sound/soc/qcom/lpass-ipq806x.c index 8e9a427..0466483 100644 --- a/sound/soc/qcom/lpass-ipq806x.c +++ b/sound/soc/qcom/lpass-ipq806x.c @@ -29,6 +29,7 @@ #include "lpass.h" static struct snd_soc_dai_driver lpass_cpu_dai_driver = { + .id = LPAIF_I2S_PORT_MI2S, .playback = { .stream_name = "lpass-cpu-playback", .formats = SNDRV_PCM_FMTBIT_S16 |