Received: by 10.213.65.68 with SMTP id h4csp212868imn; Fri, 16 Mar 2018 00:09:32 -0700 (PDT) X-Google-Smtp-Source: AG47ELuRsVjckSBs4yHMD24ty7hRHv8CVZkVa9FZ+ijSRAJe9i96rQy944mwN6EP2QnXSarO2uiI X-Received: by 10.98.90.196 with SMTP id o187mr688377pfb.170.1521184172623; Fri, 16 Mar 2018 00:09:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521184172; cv=none; d=google.com; s=arc-20160816; b=v5CITedfx/YCasFlxQZ8XJP4KWdtaxita1Z8yUf4tD9JMEUA+8p0QrKNH7xOlmjB70 JmEXImxrZfvviTEJ91afigXNLMuKSZlN1+g/WcU7tIiTLpuoE2vw7fa4fVonswYMjiIu py3ioCUkf64jauIKKNB1PRAaPN3FxV8KUwKVovoI6oulnotGL8ZpcucIadRvDhVcBIEE dnLoC/ojfJtvPaTTkYI4b7fZk1WFrgM0Z5rSpMA0c2Bbask1GDxhsL5rdCoJs2iHlI5E dC1Y+fvlbg6ZI951Cjz3yejpF3JQ/D03uXVhXuQi4Dtz/MFtTbPqm6TCwrOQmGAYmttZ Qc8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=vSaoWotYCGsYEC5HddLEYnU5jyyUa4A4sBBj/cODa+A=; b=pqgdLKcULNSH0jOjbsDZH5O0PRMn6bp6uTnYZ3k1KBA08zW6jV2CIsQY3AE6vualaH /Wr3rw16I1pUP0GywRo01Qo4TFs3AEYKfA59fo4LUPhU3uvlBdwlZmZ3Np8gq03vrzX3 iMHGcOneoeP8fFjR1U9/5s8shQGrOCumn1nHrvJC65gvPQTu37E5nAP9YDZqrSLmVfhO Ne6PysUOhOUsjVS1izcG4yn1WbTUOLGgvIFWHgQcLkSPO9ZIPtLTlTIswDmTrabJ398H r7C9estFjUjMT/L23A8we09kikbEZCFKFwVwUsHwJQRhVEOOOgIl41GYV1NiTajj1Dje LQYQ== ARC-Authentication-Results: i=1; mx.google.com; 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 t61-v6si5714656plb.195.2018.03.16.00.09.17; Fri, 16 Mar 2018 00:09:32 -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; 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 S1753060AbeCPHIW (ORCPT + 99 others); Fri, 16 Mar 2018 03:08:22 -0400 Received: from mx.socionext.com ([202.248.49.38]:27537 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750826AbeCPHIS (ORCPT ); Fri, 16 Mar 2018 03:08:18 -0400 Received: from unknown (HELO kinkan-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 16 Mar 2018 16:08:16 +0900 Received: from mail.mfilter.local (m-filter-2 [10.213.24.62]) by kinkan-ex.css.socionext.com (Postfix) with ESMTP id BAA4B180B38; Fri, 16 Mar 2018 16:08:16 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Fri, 16 Mar 2018 16:08:16 +0900 Received: from yuzu.css.socionext.com (yuzu [172.31.8.45]) by kinkan.css.socionext.com (Postfix) with ESMTP id 66FAC1A0DEC; Fri, 16 Mar 2018 16:08:16 +0900 (JST) Received: from aegis.e01.socionext.com (unknown [10.213.134.210]) by yuzu.css.socionext.com (Postfix) with ESMTP id 3D5831217AC; Fri, 16 Mar 2018 16:08:16 +0900 (JST) From: Katsuhiro Suzuki To: Mark Brown , alsa-devel@alsa-project.org, Rob Herring Cc: Masami Hiramatsu , Jassi Brar , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Katsuhiro Suzuki Subject: [PATCH 2/2] ASoC: uniphier: add syscon property for UniPhier sound system Date: Fri, 16 Mar 2018 16:08:13 +0900 Message-Id: <20180316070813.17969-3-suzuki.katsuhiro@socionext.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316070813.17969-1-suzuki.katsuhiro@socionext.com> References: <20180316070813.17969-1-suzuki.katsuhiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds syscon property for specifying soc-glue core. Currently, soc-glue core is used for changing the state of S/PDIF signal output pin to signal output state or Hi-Z state. After resetting of SoC Hi-Z state is selected. This driver set to signal output state when syscon property is available. Signed-off-by: Katsuhiro Suzuki --- sound/soc/uniphier/aio-core.c | 21 +++++++++++++++++++++ sound/soc/uniphier/aio-cpu.c | 11 +++++++++++ sound/soc/uniphier/aio-reg.h | 3 +++ sound/soc/uniphier/aio.h | 2 ++ 4 files changed, 37 insertions(+) diff --git a/sound/soc/uniphier/aio-core.c b/sound/soc/uniphier/aio-core.c index 1711361fc0c2..6d50042a4571 100644 --- a/sound/soc/uniphier/aio-core.c +++ b/sound/soc/uniphier/aio-core.c @@ -83,6 +83,27 @@ u64 aio_rb_space_to_end(struct uniphier_aio_sub *sub) return rb_space_to_end(sub->wr_offs, sub->rd_offs, sub->compr_bytes); } +/** + * aio_iecout_set_enable - setup IEC output via SoC glue + * @chip: the AIO chip pointer + * @enable: false to stop the output, true to start + * + * Set enabled or disabled S/PDIF signal output to out of SoC via AOnIEC pins. + * This function need to call at driver startup. + * + * The regmap of SoC glue is specified by 'socionext,syscon' optional property + * of DT. This function has no effect if no property. + */ +void aio_iecout_set_enable(struct uniphier_aio_chip *chip, bool enable) +{ + struct regmap *r = chip->regmap_sg; + + if (!r) + return; + + regmap_write(r, SG_AOUTEN, (enable) ? ~0 : 0); +} + /** * aio_chip_set_pll - set frequency to audio PLL * @chip : the AIO chip pointer diff --git a/sound/soc/uniphier/aio-cpu.c b/sound/soc/uniphier/aio-cpu.c index 7cf2316c69a2..1e5eb8e6f8c7 100644 --- a/sound/soc/uniphier/aio-cpu.c +++ b/sound/soc/uniphier/aio-cpu.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -387,6 +388,7 @@ int uniphier_aio_dai_probe(struct snd_soc_dai *dai) sub->spec = spec; } + aio_iecout_set_enable(aio->chip, true); aio_chip_init(aio->chip); aio->chip->active = 1; @@ -431,6 +433,7 @@ int uniphier_aio_dai_resume(struct snd_soc_dai *dai) if (ret) goto err_out_clock; + aio_iecout_set_enable(aio->chip, true); aio_chip_init(aio->chip); for (i = 0; i < ARRAY_SIZE(aio->sub); i++) { @@ -477,6 +480,14 @@ int uniphier_aio_probe(struct platform_device *pdev) if (!chip->chip_spec) return -EINVAL; + chip->regmap_sg = syscon_regmap_lookup_by_phandle(dev->of_node, + "socionext,syscon"); + if (IS_ERR(chip->regmap_sg)) { + if (PTR_ERR(chip->regmap_sg) == -EPROBE_DEFER) + return -EPROBE_DEFER; + chip->regmap_sg = NULL; + } + chip->clk = devm_clk_get(dev, "aio"); if (IS_ERR(chip->clk)) return PTR_ERR(chip->clk); diff --git a/sound/soc/uniphier/aio-reg.h b/sound/soc/uniphier/aio-reg.h index eaf2c65acf14..136d3563cf44 100644 --- a/sound/soc/uniphier/aio-reg.h +++ b/sound/soc/uniphier/aio-reg.h @@ -23,6 +23,9 @@ #include +/* soc-glue */ +#define SG_AOUTEN 0x1c04 + /* SW view */ #define A2CHNMAPCTR0(n) (0x00000 + 0x40 * (n)) #define A2RBNMAPCTR0(n) (0x01000 + 0x40 * (n)) diff --git a/sound/soc/uniphier/aio.h b/sound/soc/uniphier/aio.h index 793334675cb3..8cab4a553a97 100644 --- a/sound/soc/uniphier/aio.h +++ b/sound/soc/uniphier/aio.h @@ -296,6 +296,7 @@ struct uniphier_aio_chip { struct clk *clk; struct reset_control *rst; struct regmap *regmap; + struct regmap *regmap_sg; int active; }; @@ -323,6 +324,7 @@ u64 aio_rbt_cnt_to_end(struct uniphier_aio_sub *sub); u64 aio_rb_space(struct uniphier_aio_sub *sub); u64 aio_rb_space_to_end(struct uniphier_aio_sub *sub); +void aio_iecout_set_enable(struct uniphier_aio_chip *chip, bool enable); int aio_chip_set_pll(struct uniphier_aio_chip *chip, int pll_id, unsigned int freq); void aio_chip_init(struct uniphier_aio_chip *chip); -- 2.16.2