From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF8F1C43465 for ; Sun, 20 Sep 2020 19:39:34 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 57A1320874 for ; Sun, 20 Sep 2020 19:39:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="YtI6hSns"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lVFox2j6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57A1320874 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 4A2BB1667; Sun, 20 Sep 2020 21:38:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4A2BB1667 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1600630771; bh=vkSO2yAokGc8Uf9gx4+QxKDUZLiBWWMI5U3LZaoRN6o=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YtI6hSnsOZyaEpN0dMU08/PtVJKe9oXvrdL5yE2QZCzQMM6AYS803l7UpJEQs3ibD 4gpjcSqhFZinaq2/AvYeyQ2jy8LwI9xFWI62NWUkfSbxd3o+RE/AV4ku3fHXowXwTp GH70xPBHvckMkFJC5NmK4Z0jAFzIDbn6wAMxN3Lo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A5D76F80229; Sun, 20 Sep 2020 21:38:40 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 64CD8F80232; Sun, 20 Sep 2020 21:38:38 +0200 (CEST) Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BC479F8010F for ; Sun, 20 Sep 2020 21:38:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BC479F8010F Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lVFox2j6" Received: by mail-il1-x141.google.com with SMTP id q4so11677383ils.4 for ; Sun, 20 Sep 2020 12:38:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=7dHmlm15L5muln7P5gMny8ZyKU2l3Q2uBGbFxPZzDB4=; b=lVFox2j6QnZDD7C2ONG3APLQz8HzTN8Hms0gWrPbxfh9V8jGk+2KfupLvFzMkmLgww 5pNoYdtWj4b9mGW4CqbJ1AM4DLYW7tZq3uQC4UNkjlkkKQcyyxkKF2c+Fi7iiibmGA5B ZjW5oAmZAETlVmVsVFZD0dhxwayVpqI6+ut8Tt8QgVVU8emPjhznNwJ8r3lAcZaDyD0v lSPr/01CzAVuZUuoURjsqerBb47YOZ1n3Eup2RZfgvkRf9JJ0C7yucug2VYBaQjUTASX 2pyUNxI8MJu33r5Bdd8JMlvgzIq7S0j7voIYWOftqXT6ztwTLaK+u6iJrwzBlvZ9pj8G pW4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=7dHmlm15L5muln7P5gMny8ZyKU2l3Q2uBGbFxPZzDB4=; b=SLTW0TBSsZYW8bSBWMN08pK7UFjYXDgQw4hCjk4gY01lweuHvijrSfQpNZ4tD7XTmZ MVIL27EwAY3UkFOVgPmxTAd7ai28Aih7jXaRmmlpBoSviGLh8ezwh/7CaqXnTG32C9hR pxYXuuntRWVPoQDaQ0PgiiLK9fpvRDM0LfXOrMRXghreab0TC0kCoOQkLat6AycX0ZpD cj2716YO+D9QvAsp4ijgJ2MNOEOb2OgPPqWyXTaSGbP3bRTIyoLWSwMMm4FPIGhZ1/t2 WnhLVdnSzsErR51fb0B7EXUEQ0aST3XFEGmDLvZ38r8EOgCX0BVqimsPFLVGEKVULuKr 4CQg== X-Gm-Message-State: AOAM532N4/VALSISCaAZ5rQx3OsdbhOZeY2RtJligCUeG1CgukE/WEWH lLzX71ka9/ZzZuZkE8STwcw+bElHuD+cUGC+qbs= X-Google-Smtp-Source: ABdhPJxqQ4WQOR6w77n6t0YKh1ksHhXAMWdDCFuTkiQ8DZOfS9rz6gqURn759P7yp/tqGDFGiQjAeZg4Tk80F04zEbI= X-Received: by 2002:a92:a1c8:: with SMTP id b69mr19779859ill.293.1600630708670; Sun, 20 Sep 2020 12:38:28 -0700 (PDT) MIME-Version: 1.0 References: <20200920180758.592217-1-peron.clem@gmail.com> <20200920180758.592217-2-peron.clem@gmail.com> In-Reply-To: From: =?UTF-8?B?Q2zDqW1lbnQgUMOpcm9u?= Date: Sun, 20 Sep 2020 21:38:17 +0200 Message-ID: Subject: Re: [PATCH v3 01/19] ASoC: sun4i-i2s: Add support for H6 I2S To: Samuel Holland Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Cc: devicetree , Jernej Skrabec , linux-sunxi , Linux-ALSA , linux-kernel , Mark Brown , Takashi Iwai , Liam Girdwood , Maxime Ripard , Marcus Cooper , Chen-Yu Tsai , Rob Herring , linux-arm-kernel X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" Hi Samuel, On Sun, 20 Sep 2020 at 20:39, Samuel Holland wrote: > > On 9/20/20 1:07 PM, Cl=C3=A9ment P=C3=A9ron wrote: > > From: Jernej Skrabec > > > > H6 I2S is very similar to that in H3, except it supports up to 16 > > channels. > > > > Signed-off-by: Jernej Skrabec > > Signed-off-by: Marcus Cooper > > Signed-off-by: Cl=C3=A9ment P=C3=A9ron > > --- > > sound/soc/sunxi/sun4i-i2s.c | 218 ++++++++++++++++++++++++++++++++++++ > > 1 file changed, 218 insertions(+) > > > > diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c > > index f23ff29e7c1d..348057464bed 100644 > > --- a/sound/soc/sunxi/sun4i-i2s.c > > +++ b/sound/soc/sunxi/sun4i-i2s.c > ... > > @@ -699,6 +770,102 @@ static int sun8i_i2s_set_soc_fmt(const struct sun= 4i_i2s *i2s, > > return 0; > > } > > > > +static int sun50i_h6_i2s_set_soc_fmt(const struct sun4i_i2s *i2s, > > + unsigned int fmt) > > +{ > > + u32 mode, val; > > + u8 offset; > > + > > + /* DAI clock polarity */ > > + switch (fmt & SND_SOC_DAIFMT_INV_MASK) { > > + case SND_SOC_DAIFMT_IB_IF: > > + /* Invert both clocks */ > > + val =3D SUN8I_I2S_FMT0_BCLK_POLARITY_INVERTED | > > + SUN8I_I2S_FMT0_LRCLK_POLARITY_INVERTED; > > + break; > > + case SND_SOC_DAIFMT_IB_NF: > > + /* Invert bit clock */ > > + val =3D SUN8I_I2S_FMT0_BCLK_POLARITY_INVERTED; > > + break; > > + case SND_SOC_DAIFMT_NB_IF: > > + /* Invert frame clock */ > > + val =3D SUN8I_I2S_FMT0_LRCLK_POLARITY_INVERTED; > > + break; > > + case SND_SOC_DAIFMT_NB_NF: > > + val =3D 0; > > + break; > > + default: > > + return -EINVAL; > > + } > > Maxime's testing that showed LRCK inversion was necessary was done on the= H6. So > in addition to dropping the patch that removed the LRCK inversion for oth= er > sun8i variants, you need to re-add it to this patch for the H6 variant. Thanks, you're right! Clement > > Cheers, > Samuel > > > + > > + regmap_update_bits(i2s->regmap, SUN4I_I2S_FMT0_REG, > > + SUN8I_I2S_FMT0_LRCLK_POLARITY_MASK | > > + SUN8I_I2S_FMT0_BCLK_POLARITY_MASK, > > + val); > > + > > + /* DAI Mode */ > > + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { > > + case SND_SOC_DAIFMT_DSP_A: > > + mode =3D SUN8I_I2S_CTRL_MODE_PCM; > > + offset =3D 1; > > + break; > > + > > + case SND_SOC_DAIFMT_DSP_B: > > + mode =3D SUN8I_I2S_CTRL_MODE_PCM; > > + offset =3D 0; > > + break; > > + > > + case SND_SOC_DAIFMT_I2S: > > + mode =3D SUN8I_I2S_CTRL_MODE_LEFT; > > + offset =3D 1; > > + break; > > + > > + case SND_SOC_DAIFMT_LEFT_J: > > + mode =3D SUN8I_I2S_CTRL_MODE_LEFT; > > + offset =3D 0; > > + break; > > + > > + case SND_SOC_DAIFMT_RIGHT_J: > > + mode =3D SUN8I_I2S_CTRL_MODE_RIGHT; > > + offset =3D 0; > > + break; > > + > > + default: > > + return -EINVAL; > > + } > > + > > + regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG, > > + SUN8I_I2S_CTRL_MODE_MASK, mode); > > + regmap_update_bits(i2s->regmap, SUN8I_I2S_TX_CHAN_SEL_REG, > > + SUN50I_H6_I2S_TX_CHAN_SEL_OFFSET_MASK, > > + SUN50I_H6_I2S_TX_CHAN_SEL_OFFSET(offset)); > > + regmap_update_bits(i2s->regmap, SUN50I_H6_I2S_RX_CHAN_SEL_REG, > > + SUN50I_H6_I2S_TX_CHAN_SEL_OFFSET_MASK, > > + SUN50I_H6_I2S_TX_CHAN_SEL_OFFSET(offset)); > > + > > + /* DAI clock master masks */ > > + switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { > > + case SND_SOC_DAIFMT_CBS_CFS: > > + /* BCLK and LRCLK master */ > > + val =3D SUN8I_I2S_CTRL_BCLK_OUT | SUN8I_I2S_CTRL_LRCK_OUT= ; > > + break; > > + > > + case SND_SOC_DAIFMT_CBM_CFM: > > + /* BCLK and LRCLK slave */ > > + val =3D 0; > > + break; > > + > > + default: > > + return -EINVAL; > > + } > > + > > + regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG, > > + SUN8I_I2S_CTRL_BCLK_OUT | SUN8I_I2S_CTRL_LRCK_= OUT, > > + val); > > + > > + return 0; > > +} > > + > > static int sun4i_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt= ) > > { > > struct sun4i_i2s *i2s =3D snd_soc_dai_get_drvdata(dai); > ...