From patchwork Thu Oct 8 16:12:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 7353971 Return-Path: X-Original-To: patchwork-dri-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 5C8659F1B9 for ; Thu, 8 Oct 2015 16:13:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 75D12207E1 for ; Thu, 8 Oct 2015 16:12:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8B97A207E4 for ; Thu, 8 Oct 2015 16:12:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C16CD6E5F6; Thu, 8 Oct 2015 09:12:57 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qg0-f45.google.com (mail-qg0-f45.google.com [209.85.192.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id 56EFA6E610 for ; Thu, 8 Oct 2015 09:12:55 -0700 (PDT) Received: by qgx61 with SMTP id 61so46061270qgx.3 for ; Thu, 08 Oct 2015 09:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=r/UlSpuBnU/QffHipdYd+Xzxj9htYzJaMEP1lLs51RA=; b=HbesnkcbUeJcoBlgPumT6e1gQI/mgZwLUp6S2z5zgorlIX3LWOn8ZNzvQBvseAZikN kdf/WJ0Uwe38zA3HTKWnpLrTMo+ZELYKoXaqhJXBcjdD2asowgUd9oSWWSdB2cMDUjrQ hdi4qMqAidOI1oS+qoFygShZcghfjquiSWmSjFA5cRERjK2SZ8Ynvk2iseh/HWVlgw6P mRbUAA807BD4Pu64bYHRnucyVXToJpdOUEHIGnVcSycv+AOk3GZL8KS3StMc/hxl+rcf 1LDrs9+7JYPcJDj+fcD5c+9/tnnHtml1zk1u6KrkPkbcuDJphS6ndTtthKX3csrFBlOf cO6Q== X-Received: by 10.140.148.204 with SMTP id 195mr9789162qhu.6.1444320774467; Thu, 08 Oct 2015 09:12:54 -0700 (PDT) Received: from localhost.localdomain (static-74-96-105-49.washdc.fios.verizon.net. [74.96.105.49]) by smtp.gmail.com with ESMTPSA id s52sm18960467qge.19.2015.10.08.09.12.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Oct 2015 09:12:54 -0700 (PDT) From: Alex Deucher X-Google-Original-From: Alex Deucher To: broonie@kernel.org, airlied@gmail.com, dri-devel@lists.freedesktop.org, alsa-devel@alsa-project.org, maruthi.bayyavarapu@amd.com, rajeevkumar.linux@gmail.com Subject: [PATCH 3/8] ASoC : dwc : add quirk for dwc controller instances Date: Thu, 8 Oct 2015 12:12:36 -0400 Message-Id: <1444320760-21936-4-git-send-email-alexander.deucher@amd.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1444320760-21936-1-git-send-email-alexander.deucher@amd.com> References: <1444320760-21936-1-git-send-email-alexander.deucher@amd.com> Cc: Maruthi Srinivas Bayyavarapu , lgirdwood@gmail.com, perex@perex.cz X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Maruthi Srinivas Bayyavarapu Added a qurik to assign different base addresses for different dwc controllers present on platform for playback and capture. Signed-off-by: Maruthi Bayyavarapu --- include/sound/designware_i2s.h | 3 +++ sound/soc/dwc/designware_i2s.c | 26 +++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/include/sound/designware_i2s.h b/include/sound/designware_i2s.h index 8966ba7..48c8210 100644 --- a/include/sound/designware_i2s.h +++ b/include/sound/designware_i2s.h @@ -45,6 +45,9 @@ struct i2s_platform_data { u32 snd_fmts; u32 snd_rates; + #define DW_I2S_QUIRK_MULTI_DWC (1 << 0) + unsigned int quirks; + void *play_dma_data; void *capture_dma_data; bool (*filter)(struct dma_chan *chan, void *slave); diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c index 374a83e..fd18a0e 100644 --- a/sound/soc/dwc/designware_i2s.c +++ b/sound/soc/dwc/designware_i2s.c @@ -94,6 +94,7 @@ struct dw_i2s_dev { struct clk *clk; int active; unsigned int capability; + unsigned int quirks; struct device *dev; /* data related to DMA transfers b/w i2s and DMAC */ @@ -176,9 +177,20 @@ static void i2s_stop(struct dw_i2s_dev *dev, } } - if (!dev->active) { - i2s_write_reg(dev->i2s_pbase, CER, 0); - i2s_write_reg(dev->i2s_pbase, IER, 0); + if (dev->quirks & DW_I2S_QUIRK_MULTI_DWC) { + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + i2s_write_reg(dev->i2s_pbase, CER, 0); + i2s_write_reg(dev->i2s_pbase, IER, 0); + } else { + i2s_write_reg(dev->i2s_cbase, CER, 0); + i2s_write_reg(dev->i2s_cbase, IER, 0); + } + + } else { + if (!dev->active) { + i2s_write_reg(dev->i2s_pbase, CER, 0); + i2s_write_reg(dev->i2s_pbase, IER, 0); + } } } @@ -599,6 +611,7 @@ static int dw_i2s_probe(struct platform_device *pdev) if (pdata) { dev->capability = pdata->cap; + dev->quirks = pdata->quirks; clk_id = NULL; ret = dw_configure_dai_by_pd(dev, dw_i2s_dai, res, pdata); } else { @@ -608,6 +621,13 @@ static int dw_i2s_probe(struct platform_device *pdev) if (ret < 0) return ret; + if (dev->quirks & DW_I2S_QUIRK_MULTI_DWC) { + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); + dev->i2s_cbase = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(dev->i2s_cbase)) + return PTR_ERR(dev->i2s_cbase); + } + if (dev->capability & DW_I2S_MASTER) { if (pdata) { dev->i2s_clk_cfg = pdata->i2s_clk_cfg;