From patchwork Sat Oct 13 03:32:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10639849 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B6F07925 for ; Sat, 13 Oct 2018 03:33:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E8962B94E for ; Sat, 13 Oct 2018 03:33:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92A082B958; Sat, 13 Oct 2018 03:33:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB7882B94E for ; Sat, 13 Oct 2018 03:33:09 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 1E4D52679BB; Sat, 13 Oct 2018 05:32:55 +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 8FD912679A6; Sat, 13 Oct 2018 05:32:50 +0200 (CEST) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by alsa0.perex.cz (Postfix) with ESMTP id 050FB2678F3 for ; Sat, 13 Oct 2018 05:32:46 +0200 (CEST) Received: by mail-pg1-f195.google.com with SMTP id 23-v6so6682071pgc.8 for ; Fri, 12 Oct 2018 20:32:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=7+z1b6zsQ3LAl9a8AE2UXWL1W3JeMoFLQb3iIALE3Fw=; b=KdtW2mQpl4OhaCABQj6yuE/W50yIb+TI7mg1GrUq3+JxwPF5QExEI8fUZvRp1JU38R 1bG1nU5lnXJJbB/Wl1odlaXezIfcE5gzVXV/fKBb1tewnmaurK2YPaAccrRe+16jWWSe f9jOwb3vNCQEgkJiynJliSLWgZSVPjvYVzA3NFUsKqA/l7OIBWaEz2kL/ukZlwumVmfh CBFlfMeh2ENkAwMZF9qgoteOV1R+dMcM+ROdX5JUpzZY6o3dhQa3OXuEc8OmpPaRNSnj pIxgYRfSt7jcXgjrCpn1MqYiABOb27zYKmVNJZ18Ou994B8fo7rudCzk4B1AGLkarzGO kcrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7+z1b6zsQ3LAl9a8AE2UXWL1W3JeMoFLQb3iIALE3Fw=; b=alAxMIu0RLb/xU31Rfeg7oLutWLGrwjLE9ZvxE1zgeEMMf5hq7CkmuLGRoksjygtPB 6DFqvfFkenkliWWiSRSU/16f5xERpOjWr6DNC7Sv8+v6rWy8HapNCvvKJS01Oqq8QPEG DLBGEU2toDGxPEgX3zKpXbO5A5t62DWW8THIN9YfX41TnCCxIoagAGHh7053D4RyDd3Z 4dwxACvY+tcejG9ZCChFDsHdIbs7IvIsP49U/4zo4uNRzk6rz8tJsltVL/uJsS883xJF bB5HA4CpJ0r3HLF2sZXh0tqKfkUn+n3sVjIhdMqq4niF3+H5krowdNPkNSyLdKe8Jss9 /b/Q== X-Gm-Message-State: ABuFfohx0o73a6EUQifiEW1RkS+h3feyNCix/IUzPEEHmD1Cd9Gc2XBa kGDlQUN5oOoIIn06kxsvolA= X-Google-Smtp-Source: ACcGV60gcJT1iLXWgcgaMLC4K8b85mOXwB3fJA6hJMHZfHDvMgiNWa5IJ3Atvw2Ct/XELUlxOWHKbg== X-Received: by 2002:a63:565d:: with SMTP id g29-v6mr7829689pgm.227.1539401565789; Fri, 12 Oct 2018 20:32:45 -0700 (PDT) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id u79-v6sm5565039pfi.104.2018.10.12.20.32.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 20:32:44 -0700 (PDT) From: Vasily Khoruzhick To: Liam Girdwood , Mark Brown , Rob Herring , Mark Rutland , Maxime Ripard , Jaroslav Kysela , Takashi Iwai , Marcus Cooper , Mylene JOSSERAND , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Date: Fri, 12 Oct 2018 20:32:21 -0700 Message-Id: <20181013033230.6506-2-anarsoul@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181013033230.6506-1-anarsoul@gmail.com> References: <20181013033230.6506-1-anarsoul@gmail.com> MIME-Version: 1.0 Subject: [alsa-devel] [PATCH 01/10] ASoC: sun4i-i2s: Add compatibility with A64 codec I2S 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marcus Cooper The I2S block used for the audio codec in the A64 differs from other 3 I2S modules in A64 and isn't compatible with H3. But it is very similar to what is found in A10(sun4i). However, its TX FIFO is located at a different address. Signed-off-by: Marcus Cooper Reviewed-by: Chen-Yu Tsai --- .../devicetree/bindings/sound/sun4i-i2s.txt | 2 ++ sound/soc/sunxi/sun4i-i2s.c | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/sun4i-i2s.txt b/Documentation/devicetree/bindings/sound/sun4i-i2s.txt index b9d50d6cdef3..9d81f965f666 100644 --- a/Documentation/devicetree/bindings/sound/sun4i-i2s.txt +++ b/Documentation/devicetree/bindings/sound/sun4i-i2s.txt @@ -10,6 +10,7 @@ Required properties: - "allwinner,sun6i-a31-i2s" - "allwinner,sun8i-a83t-i2s" - "allwinner,sun8i-h3-i2s" + - "allwinner,sun50i-a64-i2s" - reg: physical base address of the controller and length of memory mapped region. - interrupts: should contain the I2S interrupt. @@ -26,6 +27,7 @@ Required properties for the following compatibles: - "allwinner,sun6i-a31-i2s" - "allwinner,sun8i-a83t-i2s" - "allwinner,sun8i-h3-i2s" + - "allwinner,sun50i-a64-i2s" - resets: phandle to the reset line for this codec Example: diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index ed30d30ac720..787b67c4f845 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -967,6 +967,23 @@ static const struct sun4i_i2s_quirks sun8i_h3_i2s_quirks = { .field_rxchansel = REG_FIELD(SUN8I_I2S_RX_CHAN_SEL_REG, 0, 2), }; +static const struct sun4i_i2s_quirks sun50i_a64_i2s_quirks = { + .has_reset = true, + .reg_offset_txdata = SUN8I_I2S_FIFO_TX_REG, + .sun4i_i2s_regmap = &sun4i_i2s_regmap_config, + .has_slave_select_bit = true, + .field_clkdiv_mclk_en = REG_FIELD(SUN4I_I2S_CLK_DIV_REG, 7, 7), + .field_fmt_wss = REG_FIELD(SUN4I_I2S_FMT0_REG, 2, 3), + .field_fmt_sr = REG_FIELD(SUN4I_I2S_FMT0_REG, 4, 5), + .field_fmt_bclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 6, 6), + .field_fmt_lrclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 7, 7), + .field_fmt_mode = REG_FIELD(SUN4I_I2S_FMT0_REG, 0, 1), + .field_txchanmap = REG_FIELD(SUN4I_I2S_TX_CHAN_MAP_REG, 0, 31), + .field_rxchanmap = REG_FIELD(SUN4I_I2S_RX_CHAN_MAP_REG, 0, 31), + .field_txchansel = REG_FIELD(SUN4I_I2S_TX_CHAN_SEL_REG, 0, 2), + .field_rxchansel = REG_FIELD(SUN4I_I2S_RX_CHAN_SEL_REG, 0, 2), +}; + static int sun4i_i2s_init_regmap_fields(struct device *dev, struct sun4i_i2s *i2s) { @@ -1175,6 +1192,10 @@ static const struct of_device_id sun4i_i2s_match[] = { .compatible = "allwinner,sun8i-h3-i2s", .data = &sun8i_h3_i2s_quirks, }, + { + .compatible = "allwinner,sun50i-a64-i2s", + .data = &sun50i_a64_i2s_quirks, + }, {} }; MODULE_DEVICE_TABLE(of, sun4i_i2s_match); From patchwork Sat Oct 13 03:32:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10639847 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CED79925 for ; Sat, 13 Oct 2018 03:33:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B43892B94E for ; Sat, 13 Oct 2018 03:33:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A54CE2B958; Sat, 13 Oct 2018 03:33:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00AC72B94E for ; Sat, 13 Oct 2018 03:33:01 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5B3692679B3; Sat, 13 Oct 2018 05:32:53 +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 382322679A8; Sat, 13 Oct 2018 05:32:50 +0200 (CEST) Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by alsa0.perex.cz (Postfix) with ESMTP id 01B222678CA for ; Sat, 13 Oct 2018 05:32:47 +0200 (CEST) Received: by mail-pf1-f195.google.com with SMTP id g21-v6so96691pfi.7 for ; Fri, 12 Oct 2018 20:32:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CSEHWxR5P0L2NKnexMzXdSKjP+Tcjjj7GTTsKPd2nLY=; b=pGuG7XN4fk6fEpydsWChqASs0TjyknxIt8XvXMtkRjaCczRJQgMoKm1FVJ2ICUVMxF bLAfl9gNGzS+IcwoMKoD4e8Eti+6HqcyUEhfji/abJMTglbnk7LCWmX+EzHPem4LFp8M Zxj6yawt+ujrwDz6nYVU+hZ7pyJauZjq0iaNA5vCkyScTkL9oDKTv2IYBp+s6C34g8S1 L7LwEby4EAMKoWeTUTKzX6FSb8AgBamM/sCYBD813R1rUIBbWcnjSHqPwIUkJepIIse9 CljEtt5fRIPvRjR3v12Hv0KmLJjeigyHWjv06ZE/OL74FIHZSApKI8IIWPB59dSK12W3 X+4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CSEHWxR5P0L2NKnexMzXdSKjP+Tcjjj7GTTsKPd2nLY=; b=C5ZK69EMVLCq9t2MwwKU0gvUMsHVOKc9rsrooEYF1ED88lnn4IztQuE1OdYLNq72s5 fQ4lgpYcv00BDhPXGWTsEy1h7z50MUTdcsUh4fJYpydsKDeT90UQDu6gufWUygVL6lVh FqzwYtGsEXga7aTlR3GQG5fBxnrE0k+FqR4MQYO0dUQPh2Mz5ALYKmZzdHeR71vUMWF/ SDp36uZs6TMiBwHPzEJZGHNokorjO/ArvtXTpe4KjQ+WlwX9r7gr5S8GmYWp1kprBUgz sOmQqVUygEKRFmP5z2F0ndJDAiYNV5tLx4RDdQuNDzfYYT/ShWs9RJF0OVB5Kr3W440N SUQA== X-Gm-Message-State: ABuFfohVLokztctcqd9FaXHU/XIHzk9KJKdzK+qhJI55V9TQVy0JOWiE Jcfb2W/ZJwiA7cOTIqyJEok= X-Google-Smtp-Source: ACcGV61ONS+crrOjCdznF3EhHA3oJjIqfxOPpRP1FlE9VGCZbwy6TqXMHipzz4WFknAxnoHTpczcXA== X-Received: by 2002:a63:145f:: with SMTP id 31-v6mr7785199pgu.35.1539401566789; Fri, 12 Oct 2018 20:32:46 -0700 (PDT) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id u79-v6sm5565039pfi.104.2018.10.12.20.32.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 20:32:46 -0700 (PDT) From: Vasily Khoruzhick To: Liam Girdwood , Mark Brown , Rob Herring , Mark Rutland , Maxime Ripard , Jaroslav Kysela , Takashi Iwai , Marcus Cooper , Mylene JOSSERAND , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Date: Fri, 12 Oct 2018 20:32:22 -0700 Message-Id: <20181013033230.6506-3-anarsoul@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181013033230.6506-1-anarsoul@gmail.com> References: <20181013033230.6506-1-anarsoul@gmail.com> MIME-Version: 1.0 Cc: Vasily Khoruzhick Subject: [alsa-devel] [PATCH 02/10] ASoC: sun8i-codec: Don't hardcode BCLK / LRCK ratio 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP BCLK / LRCK ratio should be sample size * channels, but it was hardcoded to 32 (0x1 is 32 as per A33 and A64 datasheets). Calculate it basing on sample size and number of channels. Signed-off-by: Vasily Khoruzhick --- sound/soc/sunxi/sun8i-codec.c | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c index fb37dd927e33..e681e194ad4c 100644 --- a/sound/soc/sunxi/sun8i-codec.c +++ b/sound/soc/sunxi/sun8i-codec.c @@ -52,7 +52,6 @@ #define SUN8I_AIF1CLK_CTRL_AIF1_LRCK_INV 13 #define SUN8I_AIF1CLK_CTRL_AIF1_BCLK_DIV 9 #define SUN8I_AIF1CLK_CTRL_AIF1_LRCK_DIV 6 -#define SUN8I_AIF1CLK_CTRL_AIF1_LRCK_DIV_16 (1 << 6) #define SUN8I_AIF1CLK_CTRL_AIF1_WORD_SIZ 4 #define SUN8I_AIF1CLK_CTRL_AIF1_WORD_SIZ_16 (1 << 4) #define SUN8I_AIF1CLK_CTRL_AIF1_DATA_FMT 2 @@ -257,8 +256,8 @@ static int sun8i_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) } struct sun8i_codec_clk_div { - u8 div; - u8 val; + unsigned int div; + u8 val; }; static const struct sun8i_codec_clk_div sun8i_codec_bclk_div[] = { @@ -300,12 +299,33 @@ static u8 sun8i_codec_get_bclk_div(struct sun8i_codec *scodec, return best_val; } +static const struct sun8i_codec_clk_div sun8i_codec_lrck_div[] = { + { .div = 16, .val = 0 }, + { .div = 32, .val = 1 }, + { .div = 64, .val = 2 }, + { .div = 128, .val = 3 }, + { .div = 256, .val = 4 }, +}; + +static int sun8i_codec_get_lrck_div(unsigned int channels, + unsigned int word_size) +{ + unsigned int div = word_size * channels; + int i; + + for (i = 0; i < ARRAY_SIZE(sun8i_codec_lrck_div); i++) + if (sun8i_codec_lrck_div[i].div == div) + return sun8i_codec_lrck_div[i].val; + + return -EINVAL; +} + static int sun8i_codec_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { struct sun8i_codec *scodec = snd_soc_component_get_drvdata(dai->component); - int sample_rate; + int sample_rate, lrck_div; u8 bclk_div; /* @@ -321,9 +341,14 @@ static int sun8i_codec_hw_params(struct snd_pcm_substream *substream, SUN8I_AIF1CLK_CTRL_AIF1_BCLK_DIV_MASK, bclk_div << SUN8I_AIF1CLK_CTRL_AIF1_BCLK_DIV); + lrck_div = sun8i_codec_get_lrck_div(params_channels(params), + params_physical_width(params)); + if (lrck_div < 0) + return lrck_div; + regmap_update_bits(scodec->regmap, SUN8I_AIF1CLK_CTRL, SUN8I_AIF1CLK_CTRL_AIF1_LRCK_DIV_MASK, - SUN8I_AIF1CLK_CTRL_AIF1_LRCK_DIV_16); + lrck_div << SUN8I_AIF1CLK_CTRL_AIF1_LRCK_DIV); sample_rate = sun8i_codec_get_hw_rate(params); if (sample_rate < 0) From patchwork Sat Oct 13 03:32:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10639853 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A0FA0157A for ; Sat, 13 Oct 2018 03:33:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8978828684 for ; Sat, 13 Oct 2018 03:33:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D85E286C1; Sat, 13 Oct 2018 03:33:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B59CE28684 for ; Sat, 13 Oct 2018 03:33:20 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 107F62679C7; Sat, 13 Oct 2018 05:33:01 +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 B5F362679B0; Sat, 13 Oct 2018 05:32:51 +0200 (CEST) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by alsa0.perex.cz (Postfix) with ESMTP id F1E1F26794F for ; Sat, 13 Oct 2018 05:32:48 +0200 (CEST) Received: by mail-pf1-f194.google.com with SMTP id r64-v6so7086880pfb.13 for ; Fri, 12 Oct 2018 20:32:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n3iaN3Xu/mE4N7hU0RKzQv44MnZsu06IF0GDrF621RM=; b=c8fqOjA6VF48WajsJDmTlV0pCkxYPrgleQ1KaqlmGJVPJng4o92X5xih8fr0uZL4sJ adQnBgwBHg0XqoVJe/JE7dJLctyVo8rHq5OAbmWeGA/GSKZkJi6Hf0MX1YWudXM2FoUT I78b4kQ26NtmM1IaHAkdpA1105xkyvsILSaiOuZfGhfX04iD12chZ9UqP6wuuMN+9v2N VFcGgO84oE0DOn6og4PZGhXhlGhPutGyxEkHWbT7mp44QRWLvppou5+NVeAJTBZPdWof vNEAQOToSSVUGPo95fkJN964oZXAt61DRkdjwrOpNpDKufcqannVCGNEUag20BbSAXZ/ vY7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n3iaN3Xu/mE4N7hU0RKzQv44MnZsu06IF0GDrF621RM=; b=sulpUydFg9iVbeDxeSUSO7OE69UnthcER4rYqS3eMR//GIc4TD0pUk8D0jvFM/9yY4 PAcOTF6mHgEeuM/AyNOv5BFyf9/uFNTnCibRqDGkuxm++j3NRZmP2M1FEzIMlP+MWkZP dwFV3GEwiffgaTAKLdVXYa8TvVwC2oAmGGpkL8oVz59JCa1iR8GDxbLG4tH1ZoZAoJR/ 8YSGdYQE8rBLMVzOGvm0/hO+tA4XaiMUffm0r5E4N6vaUGWZAw8X6wbce2F3V8ZVB+tP imjUeWeVHHqvloGpgmh14TKcYOAYG8RTam8k0UX0N8GYPdcy6TT9OU8bF4RK2rutEG5r TQ8w== X-Gm-Message-State: ABuFfoi3GLE1ppcwXnmbbrO3wnVqi51wgH8kBP+JHCFGoQode2lyFYrH 1m6sVYbcHnX0MOvbrD+5GGY= X-Google-Smtp-Source: ACcGV605mmi9SCo7GFQ8QIBIh3lZ22FY0xHV3pBDAmBbBdV2SE/UTeOJ6OAjhOeyjrFUvf6qtIEqMg== X-Received: by 2002:a63:3cc:: with SMTP id 195-v6mr7992313pgd.262.1539401567818; Fri, 12 Oct 2018 20:32:47 -0700 (PDT) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id u79-v6sm5565039pfi.104.2018.10.12.20.32.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 20:32:47 -0700 (PDT) From: Vasily Khoruzhick To: Liam Girdwood , Mark Brown , Rob Herring , Mark Rutland , Maxime Ripard , Jaroslav Kysela , Takashi Iwai , Marcus Cooper , Mylene JOSSERAND , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Date: Fri, 12 Oct 2018 20:32:23 -0700 Message-Id: <20181013033230.6506-4-anarsoul@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181013033230.6506-1-anarsoul@gmail.com> References: <20181013033230.6506-1-anarsoul@gmail.com> MIME-Version: 1.0 Cc: Vasily Khoruzhick Subject: [alsa-devel] [PATCH 03/10] ASoC: sun8i-codec: add support for speaker amp GPIO 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Some boards may have external amplifier for speaker that is controlled via GPIO, add support for it in similar way as it's done in sun4i-codec Signed-off-by: Vasily Khoruzhick --- .../bindings/sound/sun8i-a33-codec.txt | 3 +++ sound/soc/sunxi/sun8i-codec.c | 27 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/sun8i-a33-codec.txt b/Documentation/devicetree/bindings/sound/sun8i-a33-codec.txt index 2ca3d138528e..21ab72b29ee4 100644 --- a/Documentation/devicetree/bindings/sound/sun8i-a33-codec.txt +++ b/Documentation/devicetree/bindings/sound/sun8i-a33-codec.txt @@ -25,6 +25,9 @@ Required properties: - "bus": the parent APB clock for this controller - "mod": the parent module clock +Optional properties: +- allwinner,pa-gpios: gpio to enable external amplifier + Here is an example to add a sound card and the codec binding on sun8i SoCs that are similar to A33 using simple-card: diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c index e681e194ad4c..96879dad3425 100644 --- a/sound/soc/sunxi/sun8i-codec.c +++ b/sound/soc/sunxi/sun8i-codec.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -97,8 +98,22 @@ struct sun8i_codec { struct regmap *regmap; struct clk *clk_module; struct clk *clk_bus; + struct gpio_desc *gpio_pa; }; +static int sun8i_codec_spk_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *k, int event) +{ + struct snd_soc_component *component = + snd_soc_dapm_to_component(w->dapm); + struct sun8i_codec *scodec = snd_soc_component_get_drvdata(component); + + gpiod_set_value_cansleep(scodec->gpio_pa, + !!SND_SOC_DAPM_EVENT_ON(event)); + + return 0; +} + static int sun8i_codec_runtime_resume(struct device *dev) { struct sun8i_codec *scodec = dev_get_drvdata(dev); @@ -432,6 +447,9 @@ static const struct snd_soc_dapm_widget sun8i_codec_dapm_widgets[] = { SOC_MIXER_ARRAY("Right Digital ADC Mixer", SND_SOC_NOPM, 0, 0, sun8i_input_mixer_controls), + /* Speaker */ + SND_SOC_DAPM_SPK("Speaker", sun8i_codec_spk_event), + /* Clocks */ SND_SOC_DAPM_SUPPLY("MODCLK AFI1", SUN8I_MOD_CLK_ENA, SUN8I_MOD_CLK_ENA_AIF1, 0, NULL, 0), @@ -570,6 +588,15 @@ static int sun8i_codec_probe(struct platform_device *pdev) return PTR_ERR(scodec->clk_bus); } + scodec->gpio_pa = devm_gpiod_get_optional(&pdev->dev, "allwinner,pa", + GPIOD_OUT_LOW); + if (IS_ERR(scodec->gpio_pa)) { + ret = PTR_ERR(scodec->gpio_pa); + if (ret != -EPROBE_DEFER) + dev_err(&pdev->dev, "Failed to get pa gpio: %d\n", ret); + return ret; + } + res_base = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(&pdev->dev, res_base); if (IS_ERR(base)) { From patchwork Sat Oct 13 03:32:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10639855 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 964C5925 for ; Sat, 13 Oct 2018 03:33:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D06B28684 for ; Sat, 13 Oct 2018 03:33:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70F85286C1; Sat, 13 Oct 2018 03:33:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D60128684 for ; Sat, 13 Oct 2018 03:33:28 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 838402679CD; Sat, 13 Oct 2018 05:33:02 +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 51F062679B2; Sat, 13 Oct 2018 05:32:53 +0200 (CEST) Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by alsa0.perex.cz (Postfix) with ESMTP id A80322678CA for ; Sat, 13 Oct 2018 05:32:49 +0200 (CEST) Received: by mail-pf1-f195.google.com with SMTP id r9-v6so7087832pff.11 for ; Fri, 12 Oct 2018 20:32:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K55LUZVQxx7r/NBI6iYgJiaLs0sqwmqSwNkYHuinnVA=; b=GAyjTA+e0g4t+kQXRHhk01BQyzT5ODf9HvUFhgS0oIoxnFdTRiEz0PnT/fJ8AYKmpe M8wCpFTyQZq/bHP+Aiuv25Km3ZmLZxXW37yhc0/1zDNwLz39svHJDJdh7LsohAXZ7Fgn ulImvUH6aYzL+kjvi5vGaeIZnD0Y8ApcZ53ycIBQwG+xvh4WmryTx/JIxfNJ2Popw5Fl LZTlH9AWmNfIl00/0IvnQVLc4XCzA4Elat9gm6B0If0Lo6o9rm5LztKNKwsL7eSCWxYa fsoIYiN9FKE6GZRQc2/9QMFJKANhCyMkdG9d4X72EcmqQ9dtjePSXyxqC4e5iEK8QlHC NjJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K55LUZVQxx7r/NBI6iYgJiaLs0sqwmqSwNkYHuinnVA=; b=BgRHqNTFc+JaGqu8pIh0m33WKx2wXPi0AxssMEt6jv+/dR1+jGU6CJckinuPXxoyHR v+F2E8mIFon+lj0YOOXwFrkNaagr9h9utkhzt/6FFlDkOuKynMQMmnjtPrmYm/FhnF8i PQsD7E7vLBCGOxih8xUhWphemtpPVs9lEGC9Y3268wA+RsmDGlbA0nx1TUDFzT9zGqpK TK3uIC9H9wy+5awPjWLnM7RYpdB+wH0yGQqtCWr0ea1Lvs83OTP/wwModzcoGFeDV6st gsHfgJC7WisqfgmmDbaKaqvrHRrAuqMPSjmeOmeU49s+boWPMKtnCca9Jc+8WkFFKQzY XBjw== X-Gm-Message-State: ABuFfojC4I6DKtPME5y+IMwwrga2k9rMHN1USZWeAlE0tim/TSrToSRn AsTGgQxt73UFr2vN9z8cx/U= X-Google-Smtp-Source: ACcGV63pMZQ31u8ARzto+d9JuiB/gtydHqxdoLGlzr7n8cLIyebESdyAPyD5/blMHAr6J2EDLzzIeg== X-Received: by 2002:a62:e057:: with SMTP id f84-v6mr8686626pfh.208.1539401568649; Fri, 12 Oct 2018 20:32:48 -0700 (PDT) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id u79-v6sm5565039pfi.104.2018.10.12.20.32.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 20:32:48 -0700 (PDT) From: Vasily Khoruzhick To: Liam Girdwood , Mark Brown , Rob Herring , Mark Rutland , Maxime Ripard , Jaroslav Kysela , Takashi Iwai , Marcus Cooper , Mylene JOSSERAND , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Date: Fri, 12 Oct 2018 20:32:24 -0700 Message-Id: <20181013033230.6506-5-anarsoul@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181013033230.6506-1-anarsoul@gmail.com> References: <20181013033230.6506-1-anarsoul@gmail.com> MIME-Version: 1.0 Cc: Vasily Khoruzhick Subject: [alsa-devel] [PATCH 04/10] ASoC: sun8i-codec-analog: split regmap code into separate driver 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP It will be reused by sun50i-codec-analog later. Signed-off-by: Vasily Khoruzhick --- sound/soc/sunxi/Kconfig | 7 +- sound/soc/sunxi/Makefile | 1 + sound/soc/sunxi/sun8i-codec-analog.c | 79 +------------------ sound/soc/sunxi/sunxi-adda-pr-regmap.c | 102 +++++++++++++++++++++++++ sound/soc/sunxi/sunxi-adda-pr-regmap.h | 7 ++ 5 files changed, 119 insertions(+), 77 deletions(-) create mode 100644 sound/soc/sunxi/sunxi-adda-pr-regmap.c create mode 100644 sound/soc/sunxi/sunxi-adda-pr-regmap.h diff --git a/sound/soc/sunxi/Kconfig b/sound/soc/sunxi/Kconfig index 22408bc2d6ec..3932f0238add 100644 --- a/sound/soc/sunxi/Kconfig +++ b/sound/soc/sunxi/Kconfig @@ -23,7 +23,7 @@ config SND_SUN8I_CODEC config SND_SUN8I_CODEC_ANALOG tristate "Allwinner sun8i Codec Analog Controls Support" depends on MACH_SUN8I || (ARM64 && ARCH_SUNXI) || COMPILE_TEST - select REGMAP + select SND_SUNXI_ADDA_PR_REGMAP help Say Y or M if you want to add support for the analog controls for the codec embedded in newer Allwinner SoCs. @@ -45,4 +45,9 @@ config SND_SUN4I_SPDIF help Say Y or M to add support for the S/PDIF audio block in the Allwinner A10 and affiliated SoCs. + +config SND_SUNXI_ADDA_PR_REGMAP + tristate + select REGMAP + endmenu diff --git a/sound/soc/sunxi/Makefile b/sound/soc/sunxi/Makefile index 4a9ef67386ca..6406455e03a4 100644 --- a/sound/soc/sunxi/Makefile +++ b/sound/soc/sunxi/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_SND_SUN4I_I2S) += sun4i-i2s.o obj-$(CONFIG_SND_SUN4I_SPDIF) += sun4i-spdif.o obj-$(CONFIG_SND_SUN8I_CODEC_ANALOG) += sun8i-codec-analog.o obj-$(CONFIG_SND_SUN8I_CODEC) += sun8i-codec.o +obj-$(CONFIG_SND_SUNXI_ADDA_PR_REGMAP) += sunxi-adda-pr-regmap.o diff --git a/sound/soc/sunxi/sun8i-codec-analog.c b/sound/soc/sunxi/sun8i-codec-analog.c index 485e79f292c4..a9fa6ed28e04 100644 --- a/sound/soc/sunxi/sun8i-codec-analog.c +++ b/sound/soc/sunxi/sun8i-codec-analog.c @@ -27,6 +27,8 @@ #include #include +#include "sunxi-adda-pr-regmap.h" + /* Codec analog control register offsets and bit fields */ #define SUN8I_ADDA_HP_VOLC 0x00 #define SUN8I_ADDA_HP_VOLC_PA_CLK_GATE 7 @@ -120,81 +122,6 @@ #define SUN8I_ADDA_ADC_AP_EN_ADCLEN 6 #define SUN8I_ADDA_ADC_AP_EN_ADCG 0 -/* Analog control register access bits */ -#define ADDA_PR 0x0 /* PRCM base + 0x1c0 */ -#define ADDA_PR_RESET BIT(28) -#define ADDA_PR_WRITE BIT(24) -#define ADDA_PR_ADDR_SHIFT 16 -#define ADDA_PR_ADDR_MASK GENMASK(4, 0) -#define ADDA_PR_DATA_IN_SHIFT 8 -#define ADDA_PR_DATA_IN_MASK GENMASK(7, 0) -#define ADDA_PR_DATA_OUT_SHIFT 0 -#define ADDA_PR_DATA_OUT_MASK GENMASK(7, 0) - -/* regmap access bits */ -static int adda_reg_read(void *context, unsigned int reg, unsigned int *val) -{ - void __iomem *base = (void __iomem *)context; - u32 tmp; - - /* De-assert reset */ - writel(readl(base) | ADDA_PR_RESET, base); - - /* Clear write bit */ - writel(readl(base) & ~ADDA_PR_WRITE, base); - - /* Set register address */ - tmp = readl(base); - tmp &= ~(ADDA_PR_ADDR_MASK << ADDA_PR_ADDR_SHIFT); - tmp |= (reg & ADDA_PR_ADDR_MASK) << ADDA_PR_ADDR_SHIFT; - writel(tmp, base); - - /* Read back value */ - *val = readl(base) & ADDA_PR_DATA_OUT_MASK; - - return 0; -} - -static int adda_reg_write(void *context, unsigned int reg, unsigned int val) -{ - void __iomem *base = (void __iomem *)context; - u32 tmp; - - /* De-assert reset */ - writel(readl(base) | ADDA_PR_RESET, base); - - /* Set register address */ - tmp = readl(base); - tmp &= ~(ADDA_PR_ADDR_MASK << ADDA_PR_ADDR_SHIFT); - tmp |= (reg & ADDA_PR_ADDR_MASK) << ADDA_PR_ADDR_SHIFT; - writel(tmp, base); - - /* Set data to write */ - tmp = readl(base); - tmp &= ~(ADDA_PR_DATA_IN_MASK << ADDA_PR_DATA_IN_SHIFT); - tmp |= (val & ADDA_PR_DATA_IN_MASK) << ADDA_PR_DATA_IN_SHIFT; - writel(tmp, base); - - /* Set write bit to signal a write */ - writel(readl(base) | ADDA_PR_WRITE, base); - - /* Clear write bit */ - writel(readl(base) & ~ADDA_PR_WRITE, base); - - return 0; -} - -static const struct regmap_config adda_pr_regmap_cfg = { - .name = "adda-pr", - .reg_bits = 5, - .reg_stride = 1, - .val_bits = 8, - .reg_read = adda_reg_read, - .reg_write = adda_reg_write, - .fast_io = true, - .max_register = 24, -}; - /* mixer controls */ static const struct snd_kcontrol_new sun8i_codec_mixer_controls[] = { SOC_DAPM_DOUBLE_R("DAC Playback Switch", @@ -912,7 +839,7 @@ static int sun8i_codec_analog_probe(struct platform_device *pdev) return PTR_ERR(base); } - regmap = devm_regmap_init(&pdev->dev, NULL, base, &adda_pr_regmap_cfg); + regmap = sunxi_adda_pr_regmap_init(&pdev->dev, base); if (IS_ERR(regmap)) { dev_err(&pdev->dev, "Failed to create regmap\n"); return PTR_ERR(regmap); diff --git a/sound/soc/sunxi/sunxi-adda-pr-regmap.c b/sound/soc/sunxi/sunxi-adda-pr-regmap.c new file mode 100644 index 000000000000..47441e4361e9 --- /dev/null +++ b/sound/soc/sunxi/sunxi-adda-pr-regmap.c @@ -0,0 +1,102 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * This driver provides regmap to access to analog part of audio codec + * found on Allwinner A23, A31s, A33, H3 and A64 Socs + * + * Copyright 2016 Chen-Yu Tsai + * Copyright (C) 2018 Vasily Khoruzhick + */ + +#include +#include +#include +#include + +#include "sunxi-adda-pr-regmap.h" + +/* Analog control register access bits */ +#define ADDA_PR 0x0 /* PRCM base + 0x1c0 */ +#define ADDA_PR_RESET BIT(28) +#define ADDA_PR_WRITE BIT(24) +#define ADDA_PR_ADDR_SHIFT 16 +#define ADDA_PR_ADDR_MASK GENMASK(4, 0) +#define ADDA_PR_DATA_IN_SHIFT 8 +#define ADDA_PR_DATA_IN_MASK GENMASK(7, 0) +#define ADDA_PR_DATA_OUT_SHIFT 0 +#define ADDA_PR_DATA_OUT_MASK GENMASK(7, 0) + +/* regmap access bits */ +static int adda_reg_read(void *context, unsigned int reg, unsigned int *val) +{ + void __iomem *base = (void __iomem *)context; + u32 tmp; + + /* De-assert reset */ + writel(readl(base) | ADDA_PR_RESET, base); + + /* Clear write bit */ + writel(readl(base) & ~ADDA_PR_WRITE, base); + + /* Set register address */ + tmp = readl(base); + tmp &= ~(ADDA_PR_ADDR_MASK << ADDA_PR_ADDR_SHIFT); + tmp |= (reg & ADDA_PR_ADDR_MASK) << ADDA_PR_ADDR_SHIFT; + writel(tmp, base); + + /* Read back value */ + *val = readl(base) & ADDA_PR_DATA_OUT_MASK; + + return 0; +} + +static int adda_reg_write(void *context, unsigned int reg, unsigned int val) +{ + void __iomem *base = (void __iomem *)context; + u32 tmp; + + /* De-assert reset */ + writel(readl(base) | ADDA_PR_RESET, base); + + /* Set register address */ + tmp = readl(base); + tmp &= ~(ADDA_PR_ADDR_MASK << ADDA_PR_ADDR_SHIFT); + tmp |= (reg & ADDA_PR_ADDR_MASK) << ADDA_PR_ADDR_SHIFT; + writel(tmp, base); + + /* Set data to write */ + tmp = readl(base); + tmp &= ~(ADDA_PR_DATA_IN_MASK << ADDA_PR_DATA_IN_SHIFT); + tmp |= (val & ADDA_PR_DATA_IN_MASK) << ADDA_PR_DATA_IN_SHIFT; + writel(tmp, base); + + /* Set write bit to signal a write */ + writel(readl(base) | ADDA_PR_WRITE, base); + + /* Clear write bit */ + writel(readl(base) & ~ADDA_PR_WRITE, base); + + return 0; +} + +static const struct regmap_config adda_pr_regmap_cfg = { + .name = "adda-pr", + .reg_bits = 5, + .reg_stride = 1, + .val_bits = 8, + .reg_read = adda_reg_read, + .reg_write = adda_reg_write, + .fast_io = true, + .max_register = 31, +}; + +struct regmap *sunxi_adda_pr_regmap_init(struct device *dev, + void __iomem *base) +{ + return devm_regmap_init(dev, NULL, base, &adda_pr_regmap_cfg); +} +EXPORT_SYMBOL_GPL(sunxi_adda_pr_regmap_init); + +MODULE_DESCRIPTION("Allwinner analog audio codec regmap driver"); +MODULE_AUTHOR("Vasily Khoruzhick "); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:sunxi-adda-pr"); diff --git a/sound/soc/sunxi/sunxi-adda-pr-regmap.h b/sound/soc/sunxi/sunxi-adda-pr-regmap.h new file mode 100644 index 000000000000..6074c0c4864d --- /dev/null +++ b/sound/soc/sunxi/sunxi-adda-pr-regmap.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2018 Vasily Khoruzhick + */ + +struct regmap *sunxi_adda_pr_regmap_init(struct device *dev, + void __iomem *base); From patchwork Sat Oct 13 03:32:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10639857 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4DDE5925 for ; Sat, 13 Oct 2018 03:33:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35F8128684 for ; Sat, 13 Oct 2018 03:33:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29D31286C1; Sat, 13 Oct 2018 03:33:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B34A286A9 for ; Sat, 13 Oct 2018 03:33:35 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E3CA12679A8; Sat, 13 Oct 2018 05:33:03 +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 D53F82679BB; Sat, 13 Oct 2018 05:32:53 +0200 (CEST) Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by alsa0.perex.cz (Postfix) with ESMTP id C047926794F for ; Sat, 13 Oct 2018 05:32:50 +0200 (CEST) Received: by mail-pf1-f193.google.com with SMTP id c25-v6so7098944pfe.6 for ; Fri, 12 Oct 2018 20:32:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+zU3F+3HUNskC02tr5l8egTduscDKoYaVaz1eaU76RY=; b=Xgi3OVtc2KZ3UMvr9JourEZUJVzOl+iYumg46dimgn1KR9l+TzgEVyJj5E0Vkx2lOV hAIVeD1DdSrTzYKBbuSEMuCE9z86iIEw+thSRA5RIuYGDtPs9gZJIE6iZ+6zJVaDlFB5 4NODB6Oju+hj4EV1Rf55P0WfOS188k1hAS+lIpeDDpvm9iFL0zYYRDkOj9qVY0fvynk8 kebxgnuJfi/rDB1ETH2X/QNBWtJUH6PNVAOXW6Ajpgaq1/o3vVR+iW07JMPrilrHDsOO B6ZqdqILY4H67nWBqDTiwVSsmbbV6DldHdbK17SsmQx1qVdmVZhnwgMYGteOyzJoCSod 69ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+zU3F+3HUNskC02tr5l8egTduscDKoYaVaz1eaU76RY=; b=c1P+NyJYhnDH0i3eqotmz7TrE/22tIk1ISM9dg3uXVUcv9VhOL/2aK2lD9GmAYnH9a psziXfzNcHx6Fw8llnDGRudN6TOyCR3aF+tpwOIwPNBi25eW9ut4F/oXWD8rqEa4io6t bnDneiU960kqkxDHrOKAJptMSv9MHENnFo34C0cE/bEIGO0TpHNxwjTCXQh5qw5tLbgp UBjCt4Ime78UnPHm0UFv3ZPnx8uGnF6xX+75bZvGRiSt6Jw/kdpJW93LwpzKZhk9N3ly ahUrGkmPct8HKBiAHlwa4z+ZUaAEiyjzeoM4XkibLCMX2Dvrm01P+eEWr0jAkgLjaJkG Bh9Q== X-Gm-Message-State: ABuFfohSi+CG1WSYez1RN64AnxfjrCAymLLnmfQFqB3dmNPfU/68vL+q MUXAbmAjP/M7amS//6pe//o= X-Google-Smtp-Source: ACcGV62tzPsN9/hw8gSr1dwpO/O5Vmgrxhm8RCXTwS5XHMwwOU0G2TgLqBYlzQE9LMl9rK30kOsprQ== X-Received: by 2002:a63:e347:: with SMTP id o7-v6mr8094376pgj.251.1539401569631; Fri, 12 Oct 2018 20:32:49 -0700 (PDT) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id u79-v6sm5565039pfi.104.2018.10.12.20.32.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 20:32:48 -0700 (PDT) From: Vasily Khoruzhick To: Liam Girdwood , Mark Brown , Rob Herring , Mark Rutland , Maxime Ripard , Jaroslav Kysela , Takashi Iwai , Marcus Cooper , Mylene JOSSERAND , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Date: Fri, 12 Oct 2018 20:32:25 -0700 Message-Id: <20181013033230.6506-6-anarsoul@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181013033230.6506-1-anarsoul@gmail.com> References: <20181013033230.6506-1-anarsoul@gmail.com> MIME-Version: 1.0 Cc: Vasily Khoruzhick Subject: [alsa-devel] [PATCH 05/10] ASoC: dt-binding: Add bindings for Allwinner A64 codec's analog path controls 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The internal codec on Allwinner A64 is split into 2 parts. The analog path controls are routed through an embedded custom register bus accessed through the PRCM block just as on A23/A33/H3. Add a binding for this hardware. Signed-off-by: Vasily Khoruzhick --- .../bindings/sound/sun50i-codec-analog.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/sun50i-codec-analog.txt diff --git a/Documentation/devicetree/bindings/sound/sun50i-codec-analog.txt b/Documentation/devicetree/bindings/sound/sun50i-codec-analog.txt new file mode 100644 index 000000000000..4f8ad0e04d20 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/sun50i-codec-analog.txt @@ -0,0 +1,12 @@ +* Allwinner A64 Codec Analog Controls + +Required properties: +- compatible: must be one of the following compatibles: + - "allwinner,sun50i-a64-codec-analog" +- reg: must contain the registers location and length + +Example: + codec_analog: codec-analog@1f015c0 { + compatible = "allwinner,sun50i-a64-codec-analog"; + reg = <0x01f015c0 0x4>; + }; From patchwork Sat Oct 13 03:32:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10639863 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A999925 for ; Sat, 13 Oct 2018 03:33:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6F8D2B94E for ; Sat, 13 Oct 2018 03:33:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9A552B958; Sat, 13 Oct 2018 03:33:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D8E92B94E for ; Sat, 13 Oct 2018 03:33:49 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 0A2992679D4; Sat, 13 Oct 2018 05:33:09 +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 128882679BC; Sat, 13 Oct 2018 05:32:55 +0200 (CEST) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by alsa0.perex.cz (Postfix) with ESMTP id 58C942678CA for ; Sat, 13 Oct 2018 05:32:51 +0200 (CEST) Received: by mail-pg1-f194.google.com with SMTP id a5-v6so6673504pgv.13 for ; Fri, 12 Oct 2018 20:32:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CiKEN0A4HxpfEgwvPSqQNtKugsJ2REiXqE3ijq/ustM=; b=rad3VCDHrDhim2GA8l3n3MADH+LCHqTL0r48SxoczaLzh5bhda4k9DbNkzWv7Z53nt Qhug7dHHIyoZf3Yq5YLtccXdhhxq70+J0/Fya6z9vvv4RL7ENM1fGzdRsUikPNlN1qEf c4zQmPVNf+6eNXGV6H5N+me5V7eKzV1iQ2Poy8TD5QEVn5xK6XWl8KSjTYNtQc0QAuqQ qbXwBHag0k+6oxbtEXlSTHg6t8bUF3Er+EWxxuAiAJ/rWlrdeJrb7Q1ZjPq2RUZfj3QW H0l2ttqFN7EVqVNA2lhvvnQ1b1y4xVyKGdVjNy2nFcecUPk/9GnAfN88UNKKVgMUvFbL /9Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CiKEN0A4HxpfEgwvPSqQNtKugsJ2REiXqE3ijq/ustM=; b=qVLc/hx3e5GBFy6whOguFZcq8LRBQzi/M86JSH+71ooZ5uGnHlOtphYwbIdb2zT/b7 ff3L3Jtehc5Po90tf4KWnm1A9ohFWffWrMswr8JrAAo7NA6tGFAfUiohQ2mTrzFVJuOa Dj+5Tx8duWlV3IpBf7dLYW9rrnfiKHw2v9bnicY2CRUgQO+MgA4aTotaLk3R9Kp382I+ c7j2lE0/7WKBSzHuOKNPK+JW0cj4UAx0ZMbOQpG4aOCxEc2dleoDdB8O3t8uMr0EpYna SZDYCudGMEOPakI6lsB7nLBU+1cqKcHKcE4to94jBS/HiHagijrkg9T3JhAyQFlRZ2dO lw1g== X-Gm-Message-State: ABuFfohJdtLkjl1zhvP601MmMm8rD42piSw8kWaq8nHzgjo4jO+7WVhf kz3qxu96wHSozFuJU9kTuyc= X-Google-Smtp-Source: ACcGV601quWF+exvjcM1DJUdGRioPhIlLWdS5xW24EGrCxC6mz44s4ib2l97anWnLVJtdrvOQJY44A== X-Received: by 2002:a62:8910:: with SMTP id v16-v6mr8712962pfd.106.1539401570648; Fri, 12 Oct 2018 20:32:50 -0700 (PDT) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id u79-v6sm5565039pfi.104.2018.10.12.20.32.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 20:32:50 -0700 (PDT) From: Vasily Khoruzhick To: Liam Girdwood , Mark Brown , Rob Herring , Mark Rutland , Maxime Ripard , Jaroslav Kysela , Takashi Iwai , Marcus Cooper , Mylene JOSSERAND , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Date: Fri, 12 Oct 2018 20:32:26 -0700 Message-Id: <20181013033230.6506-7-anarsoul@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181013033230.6506-1-anarsoul@gmail.com> References: <20181013033230.6506-1-anarsoul@gmail.com> MIME-Version: 1.0 Cc: Vasily Khoruzhick Subject: [alsa-devel] [PATCH 06/10] ASoC: sunxi: Add new driver for Allwinner A64 codec's analog path controls 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The internal codec on A64 is split into 2 parts. The analog path controls are routed through an embedded custom register bus accessed through the PRCM block. Add an ASoC component driver for it. This should be tied to the codec audio card as an auxiliary device. Signed-off-by: Vasily Khoruzhick --- sound/soc/sunxi/Kconfig | 8 + sound/soc/sunxi/Makefile | 1 + sound/soc/sunxi/sun50i-codec-analog.c | 444 ++++++++++++++++++++++++++ 3 files changed, 453 insertions(+) create mode 100644 sound/soc/sunxi/sun50i-codec-analog.c diff --git a/sound/soc/sunxi/Kconfig b/sound/soc/sunxi/Kconfig index 3932f0238add..da1aac68ab03 100644 --- a/sound/soc/sunxi/Kconfig +++ b/sound/soc/sunxi/Kconfig @@ -28,6 +28,14 @@ config SND_SUN8I_CODEC_ANALOG Say Y or M if you want to add support for the analog controls for the codec embedded in newer Allwinner SoCs. +config SND_SUN50I_CODEC_ANALOG + tristate "Allwinner sun50i Codec Analog Controls Support" + depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST + select SND_SUNXI_ADDA_PR_REGMAP + help + Say Y or M if you want to add support for the analog controls for + the codec embedded in Allwinner A64 SoC. + config SND_SUN4I_I2S tristate "Allwinner A10 I2S Support" select SND_SOC_GENERIC_DMAENGINE_PCM diff --git a/sound/soc/sunxi/Makefile b/sound/soc/sunxi/Makefile index 6406455e03a4..ee5bdad63dd6 100644 --- a/sound/soc/sunxi/Makefile +++ b/sound/soc/sunxi/Makefile @@ -3,5 +3,6 @@ obj-$(CONFIG_SND_SUN4I_CODEC) += sun4i-codec.o obj-$(CONFIG_SND_SUN4I_I2S) += sun4i-i2s.o obj-$(CONFIG_SND_SUN4I_SPDIF) += sun4i-spdif.o obj-$(CONFIG_SND_SUN8I_CODEC_ANALOG) += sun8i-codec-analog.o +obj-$(CONFIG_SND_SUN50I_CODEC_ANALOG) += sun50i-codec-analog.o obj-$(CONFIG_SND_SUN8I_CODEC) += sun8i-codec.o obj-$(CONFIG_SND_SUNXI_ADDA_PR_REGMAP) += sunxi-adda-pr-regmap.o diff --git a/sound/soc/sunxi/sun50i-codec-analog.c b/sound/soc/sunxi/sun50i-codec-analog.c new file mode 100644 index 000000000000..bbeab36bd428 --- /dev/null +++ b/sound/soc/sunxi/sun50i-codec-analog.c @@ -0,0 +1,444 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * This driver supports the analog controls for the internal codec + * found in Allwinner's A64 SoC. + * + * Copyright (C) 2016 Chen-Yu Tsai + * Copyright (C) 2017 Marcus Cooper + * Copyright (C) 2018 Vasily Khoruzhick + * + * Based on sun8i-codec-analog.c + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "sunxi-adda-pr-regmap.h" + +/* Codec analog control register offsets and bit fields */ +#define SUN50I_ADDA_HP_CTRL 0x00 +#define SUN50I_ADDA_HP_CTRL_PA_CLK_GATE 7 +#define SUN50I_ADDA_HP_CTRL_HPPA_EN 6 +#define SUN50I_ADDA_HP_CTRL_HPVOL 0 + +#define SUN50I_ADDA_OL_MIX_CTRL 0x01 +#define SUN50I_ADDA_OL_MIX_CTRL_MIC1 6 +#define SUN50I_ADDA_OL_MIX_CTRL_MIC2 5 +#define SUN50I_ADDA_OL_MIX_CTRL_PHONE 4 +#define SUN50I_ADDA_OL_MIX_CTRL_PHONEN 3 +#define SUN50I_ADDA_OL_MIX_CTRL_LINEINL 2 +#define SUN50I_ADDA_OL_MIX_CTRL_DACL 1 +#define SUN50I_ADDA_OL_MIX_CTRL_DACR 0 + +#define SUN50I_ADDA_OR_MIX_CTRL 0x02 +#define SUN50I_ADDA_OR_MIX_CTRL_MIC1 6 +#define SUN50I_ADDA_OR_MIX_CTRL_MIC2 5 +#define SUN50I_ADDA_OR_MIX_CTRL_PHONE 4 +#define SUN50I_ADDA_OR_MIX_CTRL_PHONEP 3 +#define SUN50I_ADDA_OR_MIX_CTRL_LINEINR 2 +#define SUN50I_ADDA_OR_MIX_CTRL_DACR 1 +#define SUN50I_ADDA_OR_MIX_CTRL_DACL 0 + +#define SUN50I_ADDA_LINEOUT_CTRL0 0x05 +#define SUN50I_ADDA_LINEOUT_CTRL0_LEN 7 +#define SUN50I_ADDA_LINEOUT_CTRL0_REN 6 +#define SUN50I_ADDA_LINEOUT_CTRL0_LSRC_SEL 5 +#define SUN50I_ADDA_LINEOUT_CTRL0_RSRC_SEL 4 + +#define SUN50I_ADDA_LINEOUT_CTRL1 0x06 +#define SUN50I_ADDA_LINEOUT_CTRL1_VOL 0 + +#define SUN50I_ADDA_MIC1_CTRL 0x07 +#define SUN50I_ADDA_MIC1_CTRL_MIC1G 4 +#define SUN50I_ADDA_MIC1_CTRL_MIC1AMPEN 3 +#define SUN50I_ADDA_MIC1_CTRL_MIC1BOOST 0 + +#define SUN50I_ADDA_MIC2_CTRL 0x08 +#define SUN50I_ADDA_MIC2_CTRL_MIC2G 4 +#define SUN50I_ADDA_MIC2_CTRL_MIC2AMPEN 3 +#define SUN50I_ADDA_MIC2_CTRL_MIC2BOOST 0 + +#define SUN50I_ADDA_LINEIN_CTRL 0x09 +#define SUN50I_ADDA_LINEIN_CTRL_LINEING 0 + +#define SUN50I_ADDA_MIX_DAC_CTRL 0x0a +#define SUN50I_ADDA_MIX_DAC_CTRL_DACAREN 7 +#define SUN50I_ADDA_MIX_DAC_CTRL_DACALEN 6 +#define SUN50I_ADDA_MIX_DAC_CTRL_RMIXEN 5 +#define SUN50I_ADDA_MIX_DAC_CTRL_LMIXEN 4 +#define SUN50I_ADDA_MIX_DAC_CTRL_RHPPAMUTE 3 +#define SUN50I_ADDA_MIX_DAC_CTRL_LHPPAMUTE 2 +#define SUN50I_ADDA_MIX_DAC_CTRL_RHPIS 1 +#define SUN50I_ADDA_MIX_DAC_CTRL_LHPIS 0 + +#define SUN50I_ADDA_L_ADCMIX_SRC 0x0b +#define SUN50I_ADDA_L_ADCMIX_SRC_MIC1 6 +#define SUN50I_ADDA_L_ADCMIX_SRC_MIC2 5 +#define SUN50I_ADDA_L_ADCMIX_SRC_PHONE 4 +#define SUN50I_ADDA_L_ADCMIX_SRC_PHONEN 3 +#define SUN50I_ADDA_L_ADCMIX_SRC_LINEINL 2 +#define SUN50I_ADDA_L_ADCMIX_SRC_OMIXRL 1 +#define SUN50I_ADDA_L_ADCMIX_SRC_OMIXRR 0 + +#define SUN50I_ADDA_R_ADCMIX_SRC 0x0c +#define SUN50I_ADDA_R_ADCMIX_SRC_MIC1 6 +#define SUN50I_ADDA_R_ADCMIX_SRC_MIC2 5 +#define SUN50I_ADDA_R_ADCMIX_SRC_PHONE 4 +#define SUN50I_ADDA_R_ADCMIX_SRC_PHONEP 3 +#define SUN50I_ADDA_R_ADCMIX_SRC_LINEINR 2 +#define SUN50I_ADDA_R_ADCMIX_SRC_OMIXR 1 +#define SUN50I_ADDA_R_ADCMIX_SRC_OMIXL 0 + +#define SUN50I_ADDA_ADC_CTRL 0x0d +#define SUN50I_ADDA_ADC_CTRL_ADCREN 7 +#define SUN50I_ADDA_ADC_CTRL_ADCLEN 6 +#define SUN50I_ADDA_ADC_CTRL_ADCG 0 + +#define SUN50I_ADDA_HS_MBIAS_CTRL 0x0e +#define SUN50I_ADDA_HS_MBIAS_CTRL_MMICBIASEN 7 + +#define SUN50I_ADDA_JACK_MIC_CTRL 0x1d +#define SUN50I_ADDA_JACK_MIC_CTRL_HMICBIASEN 5 + +/* mixer controls */ +static const struct snd_kcontrol_new sun50i_a64_codec_mixer_controls[] = { + SOC_DAPM_DOUBLE_R("DAC Playback Switch", + SUN50I_ADDA_OL_MIX_CTRL, + SUN50I_ADDA_OR_MIX_CTRL, + SUN50I_ADDA_OL_MIX_CTRL_DACL, 1, 0), + SOC_DAPM_DOUBLE_R("DAC Reversed Playback Switch", + SUN50I_ADDA_OL_MIX_CTRL, + SUN50I_ADDA_OR_MIX_CTRL, + SUN50I_ADDA_OL_MIX_CTRL_DACR, 1, 0), + SOC_DAPM_DOUBLE_R("Line In Playback Switch", + SUN50I_ADDA_OL_MIX_CTRL, + SUN50I_ADDA_OR_MIX_CTRL, + SUN50I_ADDA_OL_MIX_CTRL_LINEINL, 1, 0), + SOC_DAPM_DOUBLE_R("Mic1 Playback Switch", + SUN50I_ADDA_OL_MIX_CTRL, + SUN50I_ADDA_OR_MIX_CTRL, + SUN50I_ADDA_OL_MIX_CTRL_MIC1, 1, 0), + SOC_DAPM_DOUBLE_R("Mic2 Playback Switch", + SUN50I_ADDA_OL_MIX_CTRL, + SUN50I_ADDA_OR_MIX_CTRL, + SUN50I_ADDA_OL_MIX_CTRL_MIC2, 1, 0), +}; + +/* ADC mixer controls */ +static const struct snd_kcontrol_new sun50i_codec_adc_mixer_controls[] = { + SOC_DAPM_DOUBLE_R("Mixer Capture Switch", + SUN50I_ADDA_L_ADCMIX_SRC, + SUN50I_ADDA_R_ADCMIX_SRC, + SUN50I_ADDA_L_ADCMIX_SRC_OMIXRL, 1, 0), + SOC_DAPM_DOUBLE_R("Mixer Reversed Capture Switch", + SUN50I_ADDA_L_ADCMIX_SRC, + SUN50I_ADDA_R_ADCMIX_SRC, + SUN50I_ADDA_L_ADCMIX_SRC_OMIXRR, 1, 0), + SOC_DAPM_DOUBLE_R("Line In Capture Switch", + SUN50I_ADDA_L_ADCMIX_SRC, + SUN50I_ADDA_R_ADCMIX_SRC, + SUN50I_ADDA_L_ADCMIX_SRC_LINEINL, 1, 0), + SOC_DAPM_DOUBLE_R("Mic1 Capture Switch", + SUN50I_ADDA_L_ADCMIX_SRC, + SUN50I_ADDA_R_ADCMIX_SRC, + SUN50I_ADDA_L_ADCMIX_SRC_MIC1, 1, 0), + SOC_DAPM_DOUBLE_R("Mic2 Capture Switch", + SUN50I_ADDA_L_ADCMIX_SRC, + SUN50I_ADDA_R_ADCMIX_SRC, + SUN50I_ADDA_L_ADCMIX_SRC_MIC2, 1, 0), +}; + +static const DECLARE_TLV_DB_SCALE(sun50i_codec_out_mixer_pregain_scale, + -450, 150, 0); +static const DECLARE_TLV_DB_RANGE(sun50i_codec_mic_gain_scale, + 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), + 1, 7, TLV_DB_SCALE_ITEM(2400, 300, 0), +); + +static const DECLARE_TLV_DB_SCALE(sun50i_codec_hp_vol_scale, -6300, 100, 1); + +static const DECLARE_TLV_DB_RANGE(sun50i_codec_lineout_vol_scale, + 0, 1, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1), + 2, 31, TLV_DB_SCALE_ITEM(-4350, 150, 0), +); + + +/* volume / mute controls */ +static const struct snd_kcontrol_new sun50i_a64_codec_controls[] = { + SOC_SINGLE_TLV("Headphone Playback Volume", + SUN50I_ADDA_HP_CTRL, + SUN50I_ADDA_HP_CTRL_HPVOL, 0x3f, 0, + sun50i_codec_hp_vol_scale), + + SOC_DOUBLE("Headphone Playback Switch", + SUN50I_ADDA_MIX_DAC_CTRL, + SUN50I_ADDA_MIX_DAC_CTRL_LHPPAMUTE, + SUN50I_ADDA_MIX_DAC_CTRL_RHPPAMUTE, 1, 0), + + /* Mixer pre-gain */ + SOC_SINGLE_TLV("Mic1 Playback Volume", SUN50I_ADDA_MIC1_CTRL, + SUN50I_ADDA_MIC1_CTRL_MIC1G, + 0x7, 0, sun50i_codec_out_mixer_pregain_scale), + + /* Microphone Amp boost gain */ + SOC_SINGLE_TLV("Mic1 Boost Volume", SUN50I_ADDA_MIC1_CTRL, + SUN50I_ADDA_MIC1_CTRL_MIC1BOOST, 0x7, 0, + sun50i_codec_mic_gain_scale), + + /* Mixer pre-gain */ + SOC_SINGLE_TLV("Mic2 Playback Volume", + SUN50I_ADDA_MIC2_CTRL, SUN50I_ADDA_MIC2_CTRL_MIC2G, + 0x7, 0, sun50i_codec_out_mixer_pregain_scale), + + /* Microphone Amp boost gain */ + SOC_SINGLE_TLV("Mic2 Boost Volume", SUN50I_ADDA_MIC2_CTRL, + SUN50I_ADDA_MIC2_CTRL_MIC2BOOST, 0x7, 0, + sun50i_codec_mic_gain_scale), + + /* ADC */ + SOC_SINGLE_TLV("ADC Gain Capture Volume", SUN50I_ADDA_ADC_CTRL, + SUN50I_ADDA_ADC_CTRL_ADCG, 0x7, 0, + sun50i_codec_out_mixer_pregain_scale), + + /* Mixer pre-gain */ + SOC_SINGLE_TLV("Line In Playback Volume", SUN50I_ADDA_LINEIN_CTRL, + SUN50I_ADDA_LINEIN_CTRL_LINEING, + 0x7, 0, sun50i_codec_out_mixer_pregain_scale), + + SOC_SINGLE_TLV("Line Out Playback Volume", + SUN50I_ADDA_LINEOUT_CTRL1, + SUN50I_ADDA_LINEOUT_CTRL1_VOL, 0x1f, 0, + sun50i_codec_lineout_vol_scale), + + SOC_DOUBLE("Line Out Playback Switch", + SUN50I_ADDA_LINEOUT_CTRL0, + SUN50I_ADDA_LINEOUT_CTRL0_LEN, + SUN50I_ADDA_LINEOUT_CTRL0_REN, 1, 0), + +}; + +static const char * const sun50i_codec_hp_src_enum_text[] = { + "DAC", "Mixer", +}; + +static SOC_ENUM_DOUBLE_DECL(sun50i_codec_hp_src_enum, + SUN50I_ADDA_MIX_DAC_CTRL, + SUN50I_ADDA_MIX_DAC_CTRL_LHPIS, + SUN50I_ADDA_MIX_DAC_CTRL_RHPIS, + sun50i_codec_hp_src_enum_text); + +static const struct snd_kcontrol_new sun50i_codec_hp_src[] = { + SOC_DAPM_ENUM("Headphone Source Playback Route", + sun50i_codec_hp_src_enum), +}; + +static const char * const sun50i_codec_lineout_src_enum_text[] = { + "Stereo", "Mono Differential", +}; + +static SOC_ENUM_DOUBLE_DECL(sun50i_codec_lineout_src_enum, + SUN50I_ADDA_LINEOUT_CTRL0, + SUN50I_ADDA_LINEOUT_CTRL0_LSRC_SEL, + SUN50I_ADDA_LINEOUT_CTRL0_RSRC_SEL, + sun50i_codec_lineout_src_enum_text); + +static const struct snd_kcontrol_new sun50i_codec_lineout_src[] = { + SOC_DAPM_ENUM("Line Out Source Playback Route", + sun50i_codec_lineout_src_enum), +}; + +static const struct snd_soc_dapm_widget sun50i_a64_codec_widgets[] = { + /* DAC */ + SND_SOC_DAPM_DAC("Left DAC", NULL, SUN50I_ADDA_MIX_DAC_CTRL, + SUN50I_ADDA_MIX_DAC_CTRL_DACALEN, 0), + SND_SOC_DAPM_DAC("Right DAC", NULL, SUN50I_ADDA_MIX_DAC_CTRL, + SUN50I_ADDA_MIX_DAC_CTRL_DACAREN, 0), + /* ADC */ + SND_SOC_DAPM_ADC("Left ADC", NULL, SUN50I_ADDA_ADC_CTRL, + SUN50I_ADDA_ADC_CTRL_ADCLEN, 0), + SND_SOC_DAPM_ADC("Right ADC", NULL, SUN50I_ADDA_ADC_CTRL, + SUN50I_ADDA_ADC_CTRL_ADCREN, 0), + /* + * Due to this component and the codec belonging to separate DAPM + * contexts, we need to manually link the above widgets to their + * stream widgets at the card level. + */ + + SND_SOC_DAPM_MUX("Headphone Source Playback Route", + SND_SOC_NOPM, 0, 0, sun50i_codec_hp_src), + SND_SOC_DAPM_OUT_DRV("Headphone Amp", SUN50I_ADDA_HP_CTRL, + SUN50I_ADDA_HP_CTRL_HPPA_EN, 0, NULL, 0), + SND_SOC_DAPM_OUTPUT("HP"), + + SND_SOC_DAPM_MUX("Line Out Source Playback Route", + SND_SOC_NOPM, 0, 0, sun50i_codec_lineout_src), + SND_SOC_DAPM_OUTPUT("LINEOUT"), + + /* Microphone inputs */ + SND_SOC_DAPM_INPUT("MIC1"), + + /* Microphone Bias */ + SND_SOC_DAPM_SUPPLY("MBIAS", SUN50I_ADDA_HS_MBIAS_CTRL, + SUN50I_ADDA_HS_MBIAS_CTRL_MMICBIASEN, + 0, NULL, 0), + + /* Mic input path */ + SND_SOC_DAPM_PGA("Mic1 Amplifier", SUN50I_ADDA_MIC1_CTRL, + SUN50I_ADDA_MIC1_CTRL_MIC1AMPEN, 0, NULL, 0), + + /* Microphone input */ + SND_SOC_DAPM_INPUT("MIC2"), + + /* Microphone Bias */ + SND_SOC_DAPM_SUPPLY("HBIAS", SUN50I_ADDA_JACK_MIC_CTRL, + SUN50I_ADDA_JACK_MIC_CTRL_HMICBIASEN, + 0, NULL, 0), + + /* Mic input path */ + SND_SOC_DAPM_PGA("Mic2 Amplifier", SUN50I_ADDA_MIC2_CTRL, + SUN50I_ADDA_MIC2_CTRL_MIC2AMPEN, 0, NULL, 0), + + /* Line input */ + SND_SOC_DAPM_INPUT("LINEIN"), + + /* Mixers */ + SND_SOC_DAPM_MIXER("Left Mixer", SUN50I_ADDA_MIX_DAC_CTRL, + SUN50I_ADDA_MIX_DAC_CTRL_LMIXEN, 0, + sun50i_a64_codec_mixer_controls, + ARRAY_SIZE(sun50i_a64_codec_mixer_controls)), + SND_SOC_DAPM_MIXER("Right Mixer", SUN50I_ADDA_MIX_DAC_CTRL, + SUN50I_ADDA_MIX_DAC_CTRL_RMIXEN, 0, + sun50i_a64_codec_mixer_controls, + ARRAY_SIZE(sun50i_a64_codec_mixer_controls)), + SND_SOC_DAPM_MIXER("Left ADC Mixer", SUN50I_ADDA_ADC_CTRL, + SUN50I_ADDA_ADC_CTRL_ADCLEN, 0, + sun50i_codec_adc_mixer_controls, + ARRAY_SIZE(sun50i_codec_adc_mixer_controls)), + SND_SOC_DAPM_MIXER("Right ADC Mixer", SUN50I_ADDA_ADC_CTRL, + SUN50I_ADDA_ADC_CTRL_ADCREN, 0, + sun50i_codec_adc_mixer_controls, + ARRAY_SIZE(sun50i_codec_adc_mixer_controls)), +}; + +static const struct snd_soc_dapm_route sun50i_a64_codec_routes[] = { + /* Left Mixer Routes */ + { "Left Mixer", "DAC Playback Switch", "Left DAC" }, + { "Left Mixer", "DAC Reversed Playback Switch", "Right DAC" }, + { "Left Mixer", "Mic1 Playback Switch", "Mic1 Amplifier" }, + + /* Right Mixer Routes */ + { "Right Mixer", "DAC Playback Switch", "Right DAC" }, + { "Right Mixer", "DAC Reversed Playback Switch", "Left DAC" }, + { "Right Mixer", "Mic1 Playback Switch", "Mic1 Amplifier" }, + + /* Left ADC Mixer Routes */ + { "Left ADC Mixer", "Mixer Capture Switch", "Left Mixer" }, + { "Left ADC Mixer", "Mixer Reversed Capture Switch", "Right Mixer" }, + { "Left ADC Mixer", "Mic1 Capture Switch", "Mic1 Amplifier" }, + + /* Right ADC Mixer Routes */ + { "Right ADC Mixer", "Mixer Capture Switch", "Right Mixer" }, + { "Right ADC Mixer", "Mixer Reversed Capture Switch", "Left Mixer" }, + { "Right ADC Mixer", "Mic1 Capture Switch", "Mic1 Amplifier" }, + + /* ADC Routes */ + { "Left ADC", NULL, "Left ADC Mixer" }, + { "Right ADC", NULL, "Right ADC Mixer" }, + + /* Headphone Routes */ + { "Headphone Source Playback Route", "DAC", "Left DAC" }, + { "Headphone Source Playback Route", "DAC", "Right DAC" }, + { "Headphone Source Playback Route", "Mixer", "Left Mixer" }, + { "Headphone Source Playback Route", "Mixer", "Right Mixer" }, + { "Headphone Amp", NULL, "Headphone Source Playback Route" }, + { "HP", NULL, "Headphone Amp" }, + + /* Microphone Routes */ + { "Mic1 Amplifier", NULL, "MIC1"}, + + /* Microphone Routes */ + { "Mic2 Amplifier", NULL, "MIC2"}, + { "Left Mixer", "Mic2 Playback Switch", "Mic2 Amplifier" }, + { "Right Mixer", "Mic2 Playback Switch", "Mic2 Amplifier" }, + { "Left ADC Mixer", "Mic2 Capture Switch", "Mic2 Amplifier" }, + { "Right ADC Mixer", "Mic2 Capture Switch", "Mic2 Amplifier" }, + + /* Line-in Routes */ + { "Left Mixer", "Line In Playback Switch", "LINEIN" }, + { "Right Mixer", "Line In Playback Switch", "LINEIN" }, + { "Left ADC Mixer", "Line In Capture Switch", "LINEIN" }, + { "Right ADC Mixer", "Line In Capture Switch", "LINEIN" }, + + /* Line-out Routes */ + { "Line Out Source Playback Route", "Stereo", "Left Mixer" }, + { "Line Out Source Playback Route", "Stereo", "Right Mixer" }, + { "Line Out Source Playback Route", "Mono Differential", "Left Mixer" }, + { "Line Out Source Playback Route", "Mono Differential", + "Right Mixer" }, + { "LINEOUT", NULL, "Line Out Source Playback Route" }, +}; + +static const struct snd_soc_component_driver sun50i_codec_analog_cmpnt_drv = { + .controls = sun50i_a64_codec_controls, + .num_controls = ARRAY_SIZE(sun50i_a64_codec_controls), + .dapm_widgets = sun50i_a64_codec_widgets, + .num_dapm_widgets = ARRAY_SIZE(sun50i_a64_codec_widgets), + .dapm_routes = sun50i_a64_codec_routes, + .num_dapm_routes = ARRAY_SIZE(sun50i_a64_codec_routes), +}; + +static const struct of_device_id sun50i_codec_analog_of_match[] = { + { + .compatible = "allwinner,sun50i-a64-codec-analog", + }, + {} +}; +MODULE_DEVICE_TABLE(of, sun50i_codec_analog_of_match); + +static int sun50i_codec_analog_probe(struct platform_device *pdev) +{ + struct resource *res; + struct regmap *regmap; + void __iomem *base; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(base)) { + dev_err(&pdev->dev, "Failed to map the registers\n"); + return PTR_ERR(base); + } + + regmap = sunxi_adda_pr_regmap_init(&pdev->dev, base); + if (IS_ERR(regmap)) { + dev_err(&pdev->dev, "Failed to create regmap\n"); + return PTR_ERR(regmap); + } + + return devm_snd_soc_register_component(&pdev->dev, + &sun50i_codec_analog_cmpnt_drv, + NULL, 0); +} + +static struct platform_driver sun50i_codec_analog_driver = { + .driver = { + .name = "sun50i-codec-analog", + .of_match_table = sun50i_codec_analog_of_match, + }, + .probe = sun50i_codec_analog_probe, +}; +module_platform_driver(sun50i_codec_analog_driver); + +MODULE_DESCRIPTION("Allwinner internal codec analog controls driver for A64"); +MODULE_AUTHOR("Vasily Khoruzhick "); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:sun50i-codec-analog"); From patchwork Sat Oct 13 03:32:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10639859 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 04367157A for ; Sat, 13 Oct 2018 03:33:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E06472B94E for ; Sat, 13 Oct 2018 03:33:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D374A2B958; Sat, 13 Oct 2018 03:33:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E8CE2B94E for ; Sat, 13 Oct 2018 03:33:43 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 876512678F3; Sat, 13 Oct 2018 05:33:07 +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 310B02679C1; Sat, 13 Oct 2018 05:32:55 +0200 (CEST) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by alsa0.perex.cz (Postfix) with ESMTP id 002F62679B8 for ; Sat, 13 Oct 2018 05:32:52 +0200 (CEST) Received: by mail-pg1-f193.google.com with SMTP id f18-v6so6700107pgv.3 for ; Fri, 12 Oct 2018 20:32:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SJxIHqh+D7Dz/D+0FdcbaNnqeg+kibrpMmZobU2n67o=; b=AU5mSJWNK1lFlOCXYMf7qWBiiO0mF6RI9k6kfyherF+ijMYPJJdCyUYhbfim8p0l1g pCsmJyhWvFmHGqpum7HYWbCUoJl3o4bEkmpDpxCU5H/Ls8QDpAO+qnih8NqeBTcIdJRR TG5vk+i9smJLa9Jkkv05HTCFyo88YnXc9rCkQ7rS/tDOCFi8nJZskqpCyb1705bpl91h A4bSztSp3n2o/cL/z/RSbnqDzFcx6QBF99yfbiWEp2NZM2dF6dx7anZZTb/vez5Vx6uS 9WX3clGHCi3i3v9gr6L6qwWWWOzvE95xhKQ9yBoR3+T45Tc/RJ/DSsYCR08WkaYXmTZy mnKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SJxIHqh+D7Dz/D+0FdcbaNnqeg+kibrpMmZobU2n67o=; b=LlLnKmPC6fRQi9Zxq9rIfXLbFhzzlkurs08wDdZR9X0fAy83LKGDvN4rCKa7lHN7f2 tNzi7HBM/D3V/p2RIhxjZCGjkESpRqNRfUYFcn6GqK/3xg5I23xwet8a8SHIWWr/y4KM vemhToX5e+Y6ABN+Zf14cNfo9KEf3O2BYITh2A9MkWFHQLlouEwZoBjaQCNNcedakSLN FYEsWmYXJTGMJQwz9h7EJ9yll36K87cLhLFhpYC55uWjnyn/Le8XgWIIvYhohQgJ332n 3zlD/lZpDVBLiKfI3c8IN4DX5QEudmVHf7PqFT+HkdanyjIY6pefpx2V/jVf1vACsOkj jmig== X-Gm-Message-State: ABuFfoh2lBXbnt3mRRm+M75OD54MC+dn8vvd2qzR1p+bD6bvk88UunvU FWQ6iUH86l6yzhPxD7RQcu2C8/+13WV80A== X-Google-Smtp-Source: ACcGV63c0fWir3nPAtMcXSXGccGTdTvtDMLU7Z/VPUDRTuEfux1A2gYinpHNzm2dM6mC7+vL6TsIcQ== X-Received: by 2002:a63:b08:: with SMTP id 8-v6mr7882348pgl.130.1539401571897; Fri, 12 Oct 2018 20:32:51 -0700 (PDT) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id u79-v6sm5565039pfi.104.2018.10.12.20.32.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 20:32:51 -0700 (PDT) From: Vasily Khoruzhick To: Liam Girdwood , Mark Brown , Rob Herring , Mark Rutland , Maxime Ripard , Jaroslav Kysela , Takashi Iwai , Marcus Cooper , Mylene JOSSERAND , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Date: Fri, 12 Oct 2018 20:32:27 -0700 Message-Id: <20181013033230.6506-8-anarsoul@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181013033230.6506-1-anarsoul@gmail.com> References: <20181013033230.6506-1-anarsoul@gmail.com> MIME-Version: 1.0 Cc: Vasily Khoruzhick Subject: [alsa-devel] [PATCH 07/10] ASoC: sunxi: allow the sun8i-codec driver to be built on ARM64 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Allwinner A64 uses the same digital codec part as in A33, so we need to build this driver on ARM64 as well. Signed-off-by: Vasily Khoruzhick --- sound/soc/sunxi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/sunxi/Kconfig b/sound/soc/sunxi/Kconfig index da1aac68ab03..0f992bdf1a10 100644 --- a/sound/soc/sunxi/Kconfig +++ b/sound/soc/sunxi/Kconfig @@ -12,7 +12,7 @@ config SND_SUN4I_CODEC config SND_SUN8I_CODEC tristate "Allwinner SUN8I audio codec" depends on OF - depends on MACH_SUN8I || COMPILE_TEST + depends on MACH_SUN8I || (ARM64 && ARCH_SUNXI) || COMPILE_TEST select REGMAP_MMIO help This option enables the digital part of the internal audio codec for From patchwork Sat Oct 13 03:32:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10639865 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5006B157A for ; Sat, 13 Oct 2018 03:33:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 372FD2B94E for ; Sat, 13 Oct 2018 03:33:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2BBB42B955; Sat, 13 Oct 2018 03:33:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7903A2B959 for ; Sat, 13 Oct 2018 03:33:55 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5C78D2679D1; Sat, 13 Oct 2018 05:33:10 +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 B0BC02679C0; Sat, 13 Oct 2018 05:32:56 +0200 (CEST) Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by alsa0.perex.cz (Postfix) with ESMTP id AADBF2679B2 for ; Sat, 13 Oct 2018 05:32:53 +0200 (CEST) Received: by mail-pf1-f193.google.com with SMTP id r64-v6so7086949pfb.13 for ; Fri, 12 Oct 2018 20:32:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ue7h0WexPADxPS/Q3/+xQq/Ia+GdmFwlcBm2CvO7JC0=; b=kl2p0dKAE3AzkD4ORROCSkB8+y9N4Ek4KcyVpFmIAgqBXbW82tHMZUWTzthGNpbtOS H2Zkl0/7SPWkiDYo0Rfijpzem/dnyq4yGEdsz/Sn24jTR+UGC+u5/LRRusGe2Z1Y83Ol PUa4jnRG6iY5StkrPAFhnt6JIXRSfRjBt0Jhj1kgvTxavcrJiNM2vM8y79n08zZk60y6 pZvqi6UnwA35NMDZ5E0KrxHEElPGc13U+wIyKd2ZfrGkMwAUNzCDW4upWsw+qiHlZ9T7 ZHF4trPXnTTARpXjZ8/A9KmvAWzjZmqHv2mIE71+mKmny1MnNq8JTu7F2qHLjUT6wGIl cvIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ue7h0WexPADxPS/Q3/+xQq/Ia+GdmFwlcBm2CvO7JC0=; b=jqSbMlDv3/ObQVRbfr12kfP3GG9BWMf7o3mK1XqYDBlXSKCjb8Wnugyf6eb8bMBpy0 vtDcV1Bsn8aRbT/HTZ/4nvZBHc7KAy1FbkGBY2u9s+QuW7UbqZ4O0N9EhcH3OqnmkkOz bZbRXZB10F/qP0V7OhYJ/Ey+BPRvSJAoeQRUhYkLixRJgC6ON0ZhhIIKC+cuwEPNWoYq z+nLu2yHyfHYj4SEqatyBkUpORWIA12wPIMQfZomjhSahXVAglxIKyIt55QG/vLbt1Y5 vQBC2zD0JIJUKhrkEpYfPDTcNL+rbrbH8Eu2qLPSToPm5lXSvklIs6QKXX/XazGsJKS5 13mg== X-Gm-Message-State: ABuFfoi482R+pDN4tqxF6mgLABD7nNXax2g2tTOYlMsqjo31bvXrNxfx HDdr9XN0z4JIknTUDo2tfhg= X-Google-Smtp-Source: ACcGV615gwfd2WxOdiZ7+e+tlhLFRXeXla+1WvFX+xL+OpEEogz3I6YnOsXQlE35G1jTNuBfCY+Tyw== X-Received: by 2002:a65:53c9:: with SMTP id z9-v6mr7997799pgr.203.1539401572768; Fri, 12 Oct 2018 20:32:52 -0700 (PDT) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id u79-v6sm5565039pfi.104.2018.10.12.20.32.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 20:32:52 -0700 (PDT) From: Vasily Khoruzhick To: Liam Girdwood , Mark Brown , Rob Herring , Mark Rutland , Maxime Ripard , Jaroslav Kysela , Takashi Iwai , Marcus Cooper , Mylene JOSSERAND , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Date: Fri, 12 Oct 2018 20:32:28 -0700 Message-Id: <20181013033230.6506-9-anarsoul@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181013033230.6506-1-anarsoul@gmail.com> References: <20181013033230.6506-1-anarsoul@gmail.com> MIME-Version: 1.0 Cc: Vasily Khoruzhick Subject: [alsa-devel] [PATCH 08/10] arm64: dts: allwinner: a64: add nodes necessary for analog sound support 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Add nodes for i2s, digital and analog parts of audiocodec on A64 Signed-off-by: Vasily Khoruzhick --- arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi index d3daf90a8715..ad59384203ad 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi @@ -157,6 +157,34 @@ compatible = "linux,spdif-dit"; }; + sound: sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "sun50i-a64-audio"; + simple-audio-card,format = "i2s"; + simple-audio-card,frame-master = <&cpudai>; + simple-audio-card,bitclock-master = <&cpudai>; + simple-audio-card,mclk-fs = <512>; + simple-audio-card,aux-devs = <&codec_analog>; + simple-audio-card,routing = + "Left DAC", "AIF1 Slot 0 Left", + "Right DAC", "AIF1 Slot 0 Right", + "AIF1 Slot 0 Left ADC", "Left ADC", + "AIF1 Slot 0 Right ADC", "Right ADC", + "Left ADC", "ADC", + "Right ADC", "ADC", + "MIC1", "Mic", + "MIC2", "Headset Mic"; + status = "disabled"; + + cpudai: simple-audio-card,cpu { + sound-dai = <&dai>; + }; + + link_codec: simple-audio-card,codec { + sound-dai = <&codec>; + }; + }; + timer { compatible = "arm,armv8-timer"; interrupts = ; + compatible = "allwinner,sun50i-a64-i2s"; + reg = <0x01c22c00 0x200>; + interrupts = ; + clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_AC_DIG>; + clock-names = "apb", "mod"; + resets = <&ccu RST_BUS_CODEC>; + reset-names = "rst"; + dmas = <&dma 15>, <&dma 15>; + dma-names = "rx", "tx"; + status = "disabled"; + }; + + codec: codec@1c22e00 { + #sound-dai-cells = <0>; + compatible = "allwinner,sun8i-a33-codec"; + reg = <0x01c22e00 0x600>; + interrupts = ; + clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_AC_DIG>; + clock-names = "bus", "mod"; + status = "disabled"; + }; + uart0: serial@1c28000 { compatible = "snps,dw-apb-uart"; reg = <0x01c28000 0x400>; @@ -715,6 +767,12 @@ #reset-cells = <1>; }; + codec_analog: codec-analog@1f015c0 { + compatible = "allwinner,sun50i-a64-codec-analog"; + reg = <0x01f015c0 0x4>; + status = "disabled"; + }; + r_i2c: i2c@1f02400 { compatible = "allwinner,sun50i-a64-i2c", "allwinner,sun6i-a31-i2c"; From patchwork Sat Oct 13 03:32:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10639867 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA72C157A for ; Sat, 13 Oct 2018 03:34:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3E592B955 for ; Sat, 13 Oct 2018 03:34:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6AB62B95B; Sat, 13 Oct 2018 03:34:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F19552B955 for ; Sat, 13 Oct 2018 03:34:02 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id ECC632679E6; Sat, 13 Oct 2018 05:33:13 +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 4C54C2679C2; Sat, 13 Oct 2018 05:32:59 +0200 (CEST) Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by alsa0.perex.cz (Postfix) with ESMTP id 52E0B2679B2 for ; Sat, 13 Oct 2018 05:32:56 +0200 (CEST) Received: by mail-pl1-f195.google.com with SMTP id w14-v6so6760020plp.6 for ; Fri, 12 Oct 2018 20:32:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+c1MrxhMsKvOGYwypcM7ImH5M1dvjFc60bhRPfFyzc0=; b=At4Q1tc1UGrGZlMhEdYKj5kFjdQuQ77OfwJzapEOg4TLnVpUpSnHABoI4qtmo71eXi Ivb8GnUXxTyu2eiwB7/B+rD83/e5oQLjkaZZYHdW1l0Rxwrit6c6DKw4BGkt0+0TV0YG zRT8UbFsP9l9mZ00rExRT+rG7uMc0yTSdL/ik1LWqHkPkAlRlA5ZdJP0ZRvRF0KeVMqu qOFoRM00fgPFLHmJY6yceOU9sNuVUaIrMaHnwGCMKXoEgVUFEiOcBsGNZHhsBjqJnu+B R2X/uIlOhNMoKzSq1ejbJfRUj4vZSPChiJ255rF3bQC9EWO6Wmnzdf1I5NGxvFdErDg4 aB5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+c1MrxhMsKvOGYwypcM7ImH5M1dvjFc60bhRPfFyzc0=; b=EOrUI6RRzRdCey4hAO/Mmn4AZplayMRUhiHp3epWqO631d4ZUZfgRmfuuN/smXUam3 IqK0ZCptYgyh//+fosU+teVAgzet76gg6GJvs9Pgsm3yjSIVgdbL2bH4gsB9lTIhWsiF eoT9OYlMs1uf6l+F8LbD7hrhHd3WjPkiKgkuUtRHkvx+w3em7mSdaSakS5CGaxi5Pq8n CyyVhDrJs/FgQZvEyrU5jSwrubewSF21bpTzgW5CdFa7D+xi39chHeDbmT0IEK/AOyQ1 +M4MldFSi81cznEs7gLLh8ZOE8XJXgdkeDXlvO6zVamzvPnpoBF0gEttVq6QGllb8nIR 1kZg== X-Gm-Message-State: ABuFfoh5LivHfBbqsu7BqAjZzZ5Oykr7bOvQAi/hnVX1nDBbnnC1owdi xPDYda/YX92BaGlxH9J3VYQ= X-Google-Smtp-Source: ACcGV622rkntDv+sG7RaPlQzUyaOjLNwlS1p7SUw6pbipF8yRTElytOcU3OgGzHmi+z/trnD3o1hKw== X-Received: by 2002:a17:902:5c4:: with SMTP id f62-v6mr8494986plf.18.1539401573956; Fri, 12 Oct 2018 20:32:53 -0700 (PDT) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id u79-v6sm5565039pfi.104.2018.10.12.20.32.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 20:32:53 -0700 (PDT) From: Vasily Khoruzhick To: Liam Girdwood , Mark Brown , Rob Herring , Mark Rutland , Maxime Ripard , Jaroslav Kysela , Takashi Iwai , Marcus Cooper , Mylene JOSSERAND , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Date: Fri, 12 Oct 2018 20:32:29 -0700 Message-Id: <20181013033230.6506-10-anarsoul@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181013033230.6506-1-anarsoul@gmail.com> References: <20181013033230.6506-1-anarsoul@gmail.com> MIME-Version: 1.0 Cc: Vasily Khoruzhick Subject: [alsa-devel] [PATCH 09/10] arm64: dts: allwinner: a64: enable sound on Pine64 and SoPine 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This commit enables I2S, digital and analog parts of audiocodec on Pine64 and SoPine boards. Signed-off-by: Vasily Khoruzhick --- .../boot/dts/allwinner/sun50i-a64-pine64.dts | 30 +++++++++++++++++++ .../allwinner/sun50i-a64-sopine-baseboard.dts | 30 +++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts index 1b9b92e541d2..902f988d0a9e 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts @@ -64,6 +64,18 @@ }; }; +&codec { + status = "okay"; +}; + +&codec_analog { + status = "okay"; +}; + +&dai { + status = "okay"; +}; + &ehci0 { status = "okay"; }; @@ -238,6 +250,24 @@ status = "disabled"; }; +&sound { + status = "okay"; + simple-audio-card,widgets = "Microphone", "Microphone Jack", + "Headphone", "Headphone Jack"; + simple-audio-card,routing = + "Left DAC", "AIF1 Slot 0 Left", + "Right DAC", "AIF1 Slot 0 Right", + "Speaker", "LINEOUT", + "Headphone Jack", "HP", + "AIF1 Slot 0 Left ADC", "Left ADC", + "AIF1 Slot 0 Right ADC", "Right ADC", + "Left ADC", "ADC", + "Right ADC", "ADC", + "Headset Mic", "Microphone Jack", + "Microphone Jack", "HBIAS", + "MIC2", "Headset Mic"; +}; + /* On Exp and Euler connectors */ &uart0 { pinctrl-names = "default"; diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts index c21f2331add6..b131b7aec24e 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts @@ -69,6 +69,18 @@ }; }; +&codec { + status = "okay"; +}; + +&codec_analog { + status = "okay"; +}; + +&dai { + status = "okay"; +}; + &ehci0 { status = "okay"; }; @@ -138,6 +150,24 @@ vcc-hdmi-supply = <®_dldo1>; }; +&sound { + status = "okay"; + simple-audio-card,widgets = "Microphone", "Microphone Jack", + "Headphone", "Headphone Jack"; + simple-audio-card,routing = + "Left DAC", "AIF1 Slot 0 Left", + "Right DAC", "AIF1 Slot 0 Right", + "Speaker", "LINEOUT", + "Headphone Jack", "HP", + "AIF1 Slot 0 Left ADC", "Left ADC", + "AIF1 Slot 0 Right ADC", "Right ADC", + "Left ADC", "ADC", + "Right ADC", "ADC", + "Headset Mic", "Microphone Jack", + "Microphone Jack", "HBIAS", + "MIC2", "Headset Mic"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins_a>; From patchwork Sat Oct 13 03:32:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Khoruzhick X-Patchwork-Id: 10639869 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 87BBA925 for ; Sat, 13 Oct 2018 03:34:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71EE02B955 for ; Sat, 13 Oct 2018 03:34:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 669522B969; Sat, 13 Oct 2018 03:34:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFFA52B95B for ; Sat, 13 Oct 2018 03:34:08 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 422412679E8; Sat, 13 Oct 2018 05:33:15 +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 75ED72679C0; Sat, 13 Oct 2018 05:33:00 +0200 (CEST) Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by alsa0.perex.cz (Postfix) with ESMTP id E659E2679C0 for ; Sat, 13 Oct 2018 05:32:55 +0200 (CEST) Received: by mail-pl1-f196.google.com with SMTP id f18-v6so6774075plr.1 for ; Fri, 12 Oct 2018 20:32:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hNLSQRmgm6g2pla+BjOde1kPx1OTuOOBalgjP3UUYr0=; b=n4QI6GYziGj/7srmMYCT4pAJSrwwA1+EgbDFJ10Gq2LaJI0m880TTd4OsdwV7shXd4 ZR7xdYFbYlC16PX/+Xq1x2ks8y9jk59CZ2Rs6RpYTy1lXYPczmx5am4yE0fwEiEFwWqN NQGhQbmLihCZVAtg9YsjyUFHD0Wdc024ZEaQ8rbsN2x71iznmG+rtLgwqPLraExTB9OF c/ypvQkUvMJUPr/jNh6xKBGepF6cL5qXBvrUx9W5Rcu50GhUaU/mSZKONHehtSgUrKWv 8akj5AdYljTptXgeAy/Nyaw0IjsJ2xgJJ9yZ7gFG/hCIt38VPs6WDMIaSm6gryYGSh8l Jjeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hNLSQRmgm6g2pla+BjOde1kPx1OTuOOBalgjP3UUYr0=; b=HV9tRur7m+EG2FsByWIY2rt6VDrINiiou8wFpKzECiH8CoZ1O/uF5TG8qU0TxMLKns g63dBuZD2z3GY6FaHnuE50xmJ0rYappaeHWULBXj9DC2gYWWK2ag0xEmXQrOGO/7Oqss OqAGxivchO4tzFN3ri7k4K9kUmxSdOhBtR58NBQBeiOM1SYODMQnCdfj1IQdAJuKBLXP o8f4JgJV1huhcN1u75XFudq9l2Neet0OmWyyCYUwg+CjpWhU+TfVy47J5ICPEM1P1RKs 2V6xN4j4A0PvhYYBWCnErdYnfX0Ah34k1qa8qDLhE2UjS580wY/3gJ77EXhTDXBZsLxE 8ASg== X-Gm-Message-State: ABuFfogKBKegoqDOhY0oJTuvsYcyjeuRJ0/kVFGGEzeo+UKB33//9bkp xVsOHMkVX5EnJuJLbZx4gdY= X-Google-Smtp-Source: ACcGV630XDsVkfD6t8P58auNrSS0C0OllVnVsIJ5mllFfPxv3+pQl1PW8f0q3X4W3sdUR1p5dcouAA== X-Received: by 2002:a17:902:9a0c:: with SMTP id v12-v6mr8350073plp.159.1539401574873; Fri, 12 Oct 2018 20:32:54 -0700 (PDT) Received: from anarsoul-thinkpad.lan (216-71-193-140.dyn.novuscom.net. [216.71.193.140]) by smtp.gmail.com with ESMTPSA id u79-v6sm5565039pfi.104.2018.10.12.20.32.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Oct 2018 20:32:54 -0700 (PDT) From: Vasily Khoruzhick To: Liam Girdwood , Mark Brown , Rob Herring , Mark Rutland , Maxime Ripard , Jaroslav Kysela , Takashi Iwai , Marcus Cooper , Mylene JOSSERAND , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Date: Fri, 12 Oct 2018 20:32:30 -0700 Message-Id: <20181013033230.6506-11-anarsoul@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181013033230.6506-1-anarsoul@gmail.com> References: <20181013033230.6506-1-anarsoul@gmail.com> MIME-Version: 1.0 Cc: Vasily Khoruzhick Subject: [alsa-devel] [PATCH 10/10] arm64: dts: allwinner: a64: enable sound on Pinebook 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This commit enables I2S, digital and analog parts of audiocodec on Pinebook Signed-off-by: Vasily Khoruzhick --- .../dts/allwinner/sun50i-a64-pinebook.dts | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts index e2e426334cfe..3145459722c7 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts @@ -76,6 +76,19 @@ }; }; +&codec { + allwinner,pa-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + +&codec_analog { + status = "okay"; +}; + +&dai { + status = "okay"; +}; + &ehci0 { phys = <&usbphy 0>; phy-names = "usb"; @@ -278,6 +291,26 @@ vcc-hdmi-supply = <®_dldo1>; }; +&sound { + status = "okay"; + simple-audio-card,widgets = "Microphone", "Microphone Jack", + "Headphone", "Headphone Jack"; + simple-audio-card,routing = + "Left DAC", "AIF1 Slot 0 Left", + "Right DAC", "AIF1 Slot 0 Right", + "Speaker", "LINEOUT", + "Headphone Jack", "HP", + "AIF1 Slot 0 Left ADC", "Left ADC", + "AIF1 Slot 0 Right ADC", "Right ADC", + "Left ADC", "ADC", + "Right ADC", "ADC", + "Mic", "MBIAS", + "MIC1", "Mic", + "Headset Mic", "Microphone Jack", + "Microphone Jack", "HBIAS", + "MIC2", "Headset Mic"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins_a>;