Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3203573yba; Mon, 6 May 2019 19:31:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXGgg5NVIwrh00g76o+MGs/dJnLZtLk3a1FL/VcPMMOwt87TyGm23l5rw9IR5gNE8nVwKF X-Received: by 2002:a17:902:8a81:: with SMTP id p1mr37052175plo.106.1557196318162; Mon, 06 May 2019 19:31:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557196318; cv=none; d=google.com; s=arc-20160816; b=bTZsS73i2WBIL5t32w9ohfvftFtYUOxSzFQyteTqTHYoQCAjbHRMelknRFXOtUxARN IvnxWkf+K0lrh2pJ9D0jUjJ29FHarsAWH1yvIBNl6tIbhfQuhcWSacNwwlk/vUXn7CSO 2rqyGEqSN0vv7DjYP5QIXgaPCxjJzY3/+Op+jtndEGxvcUw4k5aWNbehn2u2sdhVQ+u5 GaM+Nrw0IuBC/E6x3zwrpNd/oD8fOXoBQdE0L/mZNEm2C7taAthzlVZAxT5qQKTGbq9h MnGgOikKxIQCyYVsSDc5BTRmBjqYOGiRITc+GWPR6CCt88W2e+XjFOPjuXMEUHw7/tOf NK7g== 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; bh=ulGxU59+SHg0LveLVxFzfgXsIwZDWNfvFJ6byVaTrN4=; b=gVEQG4D0sNtHdS0olMfiody/v1fcZ4d0vvnCN2nOT4Uj0wR6LOQd+gHLOjw2lR0bT8 UgwewO/eADzOeHE3TjJTKkL0rtgA0+5Ososag4fEizos7FR7xhvYAKiZ0rKRjgCVXHVz /xC/BIq1Li7TAvMAF8WVZj4VpqJruDcWA3zTUaZleLPjXOuwDHleQe9KIULDCNQdkvx+ LuBIlEWVK5b71j/dXWefLsS2Pz9bosAnfHjcpJV8bUVMpbLNtmZOC60pizG9gQvwUQWN PAAMJRDUN5pwmkzQ6hctWjSoLzxQ5Jv7WXtzYV72FdqlJVOZWyL2Gig+624t5BM2rZc4 iI+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=Jt7pOvhV; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4si17711539plc.424.2019.05.06.19.31.43; Mon, 06 May 2019 19:31:58 -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=Jt7pOvhV; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726438AbfEGC3W (ORCPT + 99 others); Mon, 6 May 2019 22:29:22 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:46812 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725994AbfEGC3W (ORCPT ); Mon, 6 May 2019 22:29:22 -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=ulGxU59+SHg0LveLVxFzfgXsIwZDWNfvFJ6byVaTrN4=; b=Jt7pOvhVkugI Brht+MUZCnK4GVOK/QGz9Lbajwg7fahsWmXWDykb8/bUfU0SQN00IRZYxEDIyCv3O9Tcp6063SAyI AvOPxS4lIC0ETl2usBXDVdHfI9clQME3I7HtqK4xa+6tzqRo0ZOnfkwNEoFaf34aKyUQPZu/K6VSn Y1YKQ=; Received: from kd111239185057.au-net.ne.jp ([111.239.185.57] helo=finisterre.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hNpqq-0003Rc-UP; Tue, 07 May 2019 02:29:05 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id 9D39444000C; Tue, 7 May 2019 03:28:54 +0100 (BST) From: Mark Brown To: Olivier Moysan Cc: alexandre.torgue@st.com, alsa-devel@alsa-project.org, arnaud.pouliquen@st.com, benjamin.gaignard@st.com, broonie@kernel.org, lgirdwood@gmail.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Mark Brown , mcoquelin.stm32@gmail.com, olivier.moysan@st.com, perex@perex.cz, tiwai@suse.com Subject: Applied "ASoC: stm32: spdifrx: manage identification registers" to the asoc tree In-Reply-To: <1557146646-18150-4-git-send-email-olivier.moysan@st.com> X-Patchwork-Hint: ignore Message-Id: <20190507022901.9D39444000C@finisterre.sirena.org.uk> Date: Tue, 7 May 2019 03:28:54 +0100 (BST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch ASoC: stm32: spdifrx: manage identification registers has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3 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 1a5c0b28fc56044737f988960f3bc5fdcdba0827 Mon Sep 17 00:00:00 2001 From: Olivier Moysan Date: Mon, 6 May 2019 14:44:06 +0200 Subject: [PATCH] ASoC: stm32: spdifrx: manage identification registers Add support of identification registers in STM32 SPDIFRX. Signed-off-by: Olivier Moysan Signed-off-by: Mark Brown --- sound/soc/stm/stm32_spdifrx.c | 37 +++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/sound/soc/stm/stm32_spdifrx.c b/sound/soc/stm/stm32_spdifrx.c index b4c3d983e195..62a887ee4a03 100644 --- a/sound/soc/stm/stm32_spdifrx.c +++ b/sound/soc/stm/stm32_spdifrx.c @@ -16,6 +16,7 @@ * details. */ +#include #include #include #include @@ -36,6 +37,9 @@ #define STM32_SPDIFRX_DR 0x10 #define STM32_SPDIFRX_CSR 0x14 #define STM32_SPDIFRX_DIR 0x18 +#define STM32_SPDIFRX_VERR 0x3F4 +#define STM32_SPDIFRX_IDR 0x3F8 +#define STM32_SPDIFRX_SIDR 0x3FC /* Bit definition for SPDIF_CR register */ #define SPDIFRX_CR_SPDIFEN_SHIFT 0 @@ -169,6 +173,18 @@ #define SPDIFRX_SPDIFEN_SYNC 0x1 #define SPDIFRX_SPDIFEN_ENABLE 0x3 +/* Bit definition for SPDIFRX_VERR register */ +#define SPDIFRX_VERR_MIN_MASK GENMASK(3, 0) +#define SPDIFRX_VERR_MAJ_MASK GENMASK(7, 4) + +/* Bit definition for SPDIFRX_IDR register */ +#define SPDIFRX_IDR_ID_MASK GENMASK(31, 0) + +/* Bit definition for SPDIFRX_SIDR register */ +#define SPDIFRX_SIDR_SID_MASK GENMASK(31, 0) + +#define SPDIFRX_IPIDR_NUMBER 0x00130041 + #define SPDIFRX_IN1 0x1 #define SPDIFRX_IN2 0x2 #define SPDIFRX_IN3 0x3 @@ -607,6 +623,9 @@ static bool stm32_spdifrx_readable_reg(struct device *dev, unsigned int reg) case STM32_SPDIFRX_DR: case STM32_SPDIFRX_CSR: case STM32_SPDIFRX_DIR: + case STM32_SPDIFRX_VERR: + case STM32_SPDIFRX_IDR: + case STM32_SPDIFRX_SIDR: return true; default: return false; @@ -642,10 +661,11 @@ static const struct regmap_config stm32_h7_spdifrx_regmap_conf = { .reg_bits = 32, .reg_stride = 4, .val_bits = 32, - .max_register = STM32_SPDIFRX_DIR, + .max_register = STM32_SPDIFRX_SIDR, .readable_reg = stm32_spdifrx_readable_reg, .volatile_reg = stm32_spdifrx_volatile_reg, .writeable_reg = stm32_spdifrx_writeable_reg, + .num_reg_defaults_raw = STM32_SPDIFRX_SIDR / sizeof(u32) + 1, .fast_io = true, .cache_type = REGCACHE_FLAT, }; @@ -911,6 +931,7 @@ static int stm32_spdifrx_probe(struct platform_device *pdev) struct stm32_spdifrx_data *spdifrx; struct reset_control *rst; const struct snd_dmaengine_pcm_config *pcm_config = NULL; + u32 ver, idr; int ret; spdifrx = devm_kzalloc(&pdev->dev, sizeof(*spdifrx), GFP_KERNEL); @@ -967,7 +988,19 @@ static int stm32_spdifrx_probe(struct platform_device *pdev) goto error; } - return 0; + ret = regmap_read(spdifrx->regmap, STM32_SPDIFRX_IDR, &idr); + if (ret) + goto error; + + if (idr == SPDIFRX_IPIDR_NUMBER) { + ret = regmap_read(spdifrx->regmap, STM32_SPDIFRX_VERR, &ver); + + dev_dbg(&pdev->dev, "SPDIFRX version: %lu.%lu registered\n", + FIELD_GET(SPDIFRX_VERR_MAJ_MASK, ver), + FIELD_GET(SPDIFRX_VERR_MIN_MASK, ver)); + } + + return ret; error: if (!IS_ERR(spdifrx->ctrl_chan)) -- 2.20.1