Received: by 10.192.165.148 with SMTP id m20csp2199029imm; Thu, 26 Apr 2018 07:22:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx49niTb+HPKBRmI24d6bQVEZKpshFMNXOZGNI11ZT3c5w/21cv1/TDVOq/IIb1hJCnmYxsUL X-Received: by 2002:a17:902:22cc:: with SMTP id o12-v6mr35161531plg.38.1524752527219; Thu, 26 Apr 2018 07:22:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524752527; cv=none; d=google.com; s=arc-20160816; b=uUdcfADVWWpKQcB3aAb4RLqrSwwN22DdmZVxDSOew78tg7A1ga6wGdTr5Ovzjv2SeG TtbCm4dD7wbHrXa9IV3afnkJXufqtaD05o3FzZ5zXOGl4GVNIyFCxy6XKq5vm8UukSU4 vsoLOzvyscoAv9EIb2zNFxBDBAg/h/jeYMbqT0gCr41qAdXOvNNA7ZjjbXfOGNZL1AQ4 sMmCTnOySe0Bso8czRIJS5l65UqdIvbAQbX8EAM8e5yCV2+iNw2U8mh5uJCKY/NbJs1y oPFxvoitJKdnwT0AGJCOlJ9RqvXaYVq5zIrdR/EQ+1hLrbZwqIi8HkBDdP7VW7lRjbk3 J+1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=hN7i9hvFZ7Gm4LkkPRK4WsBFcGrgR1n+z/fr6yCrw0A=; b=BcHVAG8aeq/43KBGGtoif05uUvT8TpuQ+AOuOHyji90H+oOx60AM3J0jv28KlfV8eT eYqmw2/y6OXNf07JNTR9aNxLFMYFU2MLpp5SMIOKmy/jmRWSIHlzQ8g3OXSWp5+J9tzE pyn3scggohuIPtx0k3rstt9OSM1nhBzwuPhVEhBDfzWYH/kdG3oGkZ44FoZi33c7Nk8r xUHmvALDTJD5VYvIToI1+gWDH3lN+iJfiwr0ia+OYMQJg6h/LiSR3ynasmXDlt9GwJq0 v88I1dDcb+mx14CEBJtArERwH1xP/EKMcjJiAkT2ltQbh/HH/NO3bQtHoqYNQz9P98a9 6VHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=uxuDlQL9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s15-v6si18885769plp.243.2018.04.26.07.21.52; Thu, 26 Apr 2018 07:22:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=uxuDlQL9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932092AbeDZOUX (ORCPT + 99 others); Thu, 26 Apr 2018 10:20:23 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:42498 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756524AbeDZOUU (ORCPT ); Thu, 26 Apr 2018 10:20:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=hN7i9hvFZ7Gm4LkkPRK4WsBFcGrgR1n+z/fr6yCrw0A=; b=uxuDlQL9gQt4 1LkF5I2Oftv0CCopezv1up7rdynJlZf3E/C1hPlsB2TmVmzOmV8EG7T3RlCzzr6HcFRpa/nD+rB/z eEHl4cr1E4MUoS/priTvNeRYpPj0/0f9QVdAoB6d29Qmy2nKvJ8/nZQQgMZNFnENRY/o0n/b94c2z jHnaE=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fBhkv-0005Yc-0Y; Thu, 26 Apr 2018 14:20:17 +0000 Received: from broonie by debutante with local (Exim 4.90_1) (envelope-from ) id 1fBhku-000474-In; Thu, 26 Apr 2018 15:20:16 +0100 From: Mark Brown To: Ryder Lee Cc: Mark Brown , Mark Brown , alsa-devel@alsa-project.org, Garlic Tseng , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, alsa-devel@alsa-project.org Subject: Applied "ASoC: mediatek: Add MTK_STREAM_NUM to mtk-base-afe.h" to the asoc tree In-Reply-To: <3b7d64ba9a84651575f69de5bbcbecf42d157250.1524628914.git.ryder.lee@mediatek.com> Message-Id: Date: Thu, 26 Apr 2018 15:20:16 +0100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch ASoC: mediatek: Add MTK_STREAM_NUM to mtk-base-afe.h has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From ab7b4ee9861a340b470e59f8d19360f7bc81e9dd Mon Sep 17 00:00:00 2001 From: Ryder Lee Date: Wed, 25 Apr 2018 12:19:56 +0800 Subject: [PATCH] ASoC: mediatek: Add MTK_STREAM_NUM to mtk-base-afe.h Add MTK_STREAM_NUM to common header and modify related stuff so that the other SoCs can reuse it. Signed-off-by: Ryder Lee Reviewed-by: Garlic Tseng Signed-off-by: Mark Brown --- sound/soc/mediatek/common/mtk-base-afe.h | 2 + .../mediatek/mt2701/mt2701-afe-clock-ctrl.c | 15 +++-- sound/soc/mediatek/mt2701/mt2701-afe-common.h | 17 ++--- sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | 67 ++++--------------- 4 files changed, 30 insertions(+), 71 deletions(-) diff --git a/sound/soc/mediatek/common/mtk-base-afe.h b/sound/soc/mediatek/common/mtk-base-afe.h index 3a78f6f17195..e50adc9116cf 100644 --- a/sound/soc/mediatek/common/mtk-base-afe.h +++ b/sound/soc/mediatek/common/mtk-base-afe.h @@ -17,6 +17,8 @@ #ifndef _MTK_BASE_AFE_H_ #define _MTK_BASE_AFE_H_ +#define MTK_STREAM_NUM (SNDRV_PCM_STREAM_LAST + 1) + struct mtk_base_memif_data { int id; const char *name; diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c b/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c index 565005f821d0..d4e6a5ea63f4 100644 --- a/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c +++ b/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c @@ -46,6 +46,7 @@ int mt2701_init_clock(struct mtk_base_afe *afe) /* Get I2S related clocks */ for (i = 0; i < MT2701_I2S_NUM; i++) { struct mt2701_i2s_path *i2s_path = &afe_priv->i2s_path[i]; + struct clk *i2s_ck; char name[13]; snprintf(name, sizeof(name), "i2s%d_src_sel", i); @@ -70,18 +71,20 @@ int mt2701_init_clock(struct mtk_base_afe *afe) } snprintf(name, sizeof(name), "i2so%d_hop_ck", i); - i2s_path->hop_ck[I2S_OUT] = devm_clk_get(afe->dev, name); - if (IS_ERR(i2s_path->hop_ck[I2S_OUT])) { + i2s_ck = devm_clk_get(afe->dev, name); + if (IS_ERR(i2s_ck)) { dev_err(afe->dev, "failed to get %s\n", name); - return PTR_ERR(i2s_path->hop_ck[I2S_OUT]); + return PTR_ERR(i2s_ck); } + i2s_path->hop_ck[SNDRV_PCM_STREAM_PLAYBACK] = i2s_ck; snprintf(name, sizeof(name), "i2si%d_hop_ck", i); - i2s_path->hop_ck[I2S_IN] = devm_clk_get(afe->dev, name); - if (IS_ERR(i2s_path->hop_ck[I2S_IN])) { + i2s_ck = devm_clk_get(afe->dev, name); + if (IS_ERR(i2s_ck)) { dev_err(afe->dev, "failed to get %s\n", name); - return PTR_ERR(i2s_path->hop_ck[I2S_IN]); + return PTR_ERR(i2s_ck); } + i2s_path->hop_ck[SNDRV_PCM_STREAM_CAPTURE] = i2s_ck; snprintf(name, sizeof(name), "asrc%d_out_ck", i); i2s_path->asrco_ck = devm_clk_get(afe->dev, name); diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-common.h b/sound/soc/mediatek/mt2701/mt2701-afe-common.h index ae8ddeacfbfe..8dabf1913533 100644 --- a/sound/soc/mediatek/mt2701/mt2701-afe-common.h +++ b/sound/soc/mediatek/mt2701/mt2701-afe-common.h @@ -23,7 +23,6 @@ #include "mt2701-reg.h" #include "../common/mtk-base-afe.h" -#define MT2701_STREAM_DIR_NUM (SNDRV_PCM_STREAM_LAST + 1) #define MT2701_PLL_DOMAIN_0_RATE 98304000 #define MT2701_PLL_DOMAIN_1_RATE 90316800 #define MT2701_I2S_NUM 4 @@ -100,19 +99,13 @@ struct mt2701_i2s_data { int i2s_asrc_fs_mask; }; -enum mt2701_i2s_dir { - I2S_OUT, - I2S_IN, - I2S_DIR_NUM, -}; - struct mt2701_i2s_path { int dai_id; int mclk_rate; - int on[I2S_DIR_NUM]; - int occupied[I2S_DIR_NUM]; - const struct mt2701_i2s_data *i2s_data[I2S_DIR_NUM]; - struct clk *hop_ck[I2S_DIR_NUM]; + int on[MTK_STREAM_NUM]; + int occupied[MTK_STREAM_NUM]; + const struct mt2701_i2s_data *i2s_data[MTK_STREAM_NUM]; + struct clk *hop_ck[MTK_STREAM_NUM]; struct clk *sel_ck; struct clk *div_ck; struct clk *mclk_ck; @@ -123,7 +116,7 @@ struct mt2701_afe_private { struct mt2701_i2s_path i2s_path[MT2701_I2S_NUM]; struct clk *base_ck[MT2701_BASE_CLK_NUM]; struct clk *mrgif_ck; - bool mrg_enable[MT2701_STREAM_DIR_NUM]; + bool mrg_enable[MTK_STREAM_NUM]; }; #endif diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c index 2a161f4d01f6..99094a574213 100644 --- a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c +++ b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c @@ -1256,63 +1256,24 @@ static const struct mtk_base_irq_data irq_data[MT2701_IRQ_ASYS_END] = { } }; -static const struct mt2701_i2s_data mt2701_i2s_data[MT2701_I2S_NUM][2] = { +static const struct mt2701_i2s_data mt2701_i2s_data[][2] = { { - { - .i2s_ctrl_reg = ASYS_I2SO1_CON, - .i2s_asrc_fs_shift = 0, - .i2s_asrc_fs_mask = 0x1f, - - }, - { - .i2s_ctrl_reg = ASYS_I2SIN1_CON, - .i2s_asrc_fs_shift = 0, - .i2s_asrc_fs_mask = 0x1f, - - }, + { ASYS_I2SO1_CON, 0, 0x1f }, + { ASYS_I2SIN1_CON, 0, 0x1f }, }, { - { - .i2s_ctrl_reg = ASYS_I2SO2_CON, - .i2s_asrc_fs_shift = 5, - .i2s_asrc_fs_mask = 0x1f, - - }, - { - .i2s_ctrl_reg = ASYS_I2SIN2_CON, - .i2s_asrc_fs_shift = 5, - .i2s_asrc_fs_mask = 0x1f, - - }, + { ASYS_I2SO2_CON, 5, 0x1f }, + { ASYS_I2SIN2_CON, 5, 0x1f }, }, { - { - .i2s_ctrl_reg = ASYS_I2SO3_CON, - .i2s_asrc_fs_shift = 10, - .i2s_asrc_fs_mask = 0x1f, - - }, - { - .i2s_ctrl_reg = ASYS_I2SIN3_CON, - .i2s_asrc_fs_shift = 10, - .i2s_asrc_fs_mask = 0x1f, - - }, + { ASYS_I2SO3_CON, 10, 0x1f }, + { ASYS_I2SIN3_CON, 10, 0x1f }, }, { - { - .i2s_ctrl_reg = ASYS_I2SO4_CON, - .i2s_asrc_fs_shift = 15, - .i2s_asrc_fs_mask = 0x1f, - - }, - { - .i2s_ctrl_reg = ASYS_I2SIN4_CON, - .i2s_asrc_fs_shift = 15, - .i2s_asrc_fs_mask = 0x1f, - - }, + { ASYS_I2SO4_CON, 15, 0x1f }, + { ASYS_I2SIN4_CON, 15, 0x1f }, }, + /* TODO - extend control registers supported by newer SoCs */ }; static irqreturn_t mt2701_asys_isr(int irq_id, void *dev) @@ -1434,10 +1395,10 @@ static int mt2701_afe_pcm_dev_probe(struct platform_device *pdev) /* I2S initialize */ for (i = 0; i < MT2701_I2S_NUM; i++) { - afe_priv->i2s_path[i].i2s_data[I2S_OUT] - = &mt2701_i2s_data[i][I2S_OUT]; - afe_priv->i2s_path[i].i2s_data[I2S_IN] - = &mt2701_i2s_data[i][I2S_IN]; + afe_priv->i2s_path[i].i2s_data[SNDRV_PCM_STREAM_PLAYBACK] = + &mt2701_i2s_data[i][SNDRV_PCM_STREAM_PLAYBACK]; + afe_priv->i2s_path[i].i2s_data[SNDRV_PCM_STREAM_CAPTURE] = + &mt2701_i2s_data[i][SNDRV_PCM_STREAM_CAPTURE]; } afe->mtk_afe_hardware = &mt2701_afe_hardware; -- 2.17.0