From patchwork Mon Aug 17 15:14:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 247864 Delivered-To: patch@linaro.org Received: by 2002:a54:3b12:0:0:0:0:0 with SMTP id j18csp2586062ect; Mon, 17 Aug 2020 12:26:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5rwzMTEHsKGysDSnYwUV1YvbMMQYZ9qOX9J48wqjxl7rzrZKZclQW3mzCej01PkLnn4Ty X-Received: by 2002:a17:906:cb0a:: with SMTP id lk10mr16376231ejb.209.1597692419245; Mon, 17 Aug 2020 12:26:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597692419; cv=none; d=google.com; s=arc-20160816; b=XqQbJ2UAGHm8kyoxtThJa0gkB6w/XZOlV9ifrzr5XMxl2HnPr1p7qalAM948Ek3jvW kfOg0CpxIAYv5bac6YRbQKSFFVK5HuurasGtpTaxoPBbgm879ZC+QrNFIvlawjz02FVH I3umLs5zQWyftYoocI/lgt+/34iyvoev+fGi70XSewJBePlfjm3NwUQ0YOsd6vuAdwIo RlIZ6Hp3oEidYzQ4g7AN0ljVPkXMk5kiHjcUSujUhfzen9+Ey956lnC40VadjNKKr1PK NdgC3ml795cYj/3G5QRvuIuL3xPzKtQ5lvRIxVdkymrKKkmt8exuwYOr6scRqlm/pF75 ptOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UyIqy6U+nsD2PWAtO/B6ChTOGaud+5APbu/SDQVmQXw=; b=X3wQdUH8q2uBFnO8ossU9eYH1950BNFaBOAJ7AzwqLaHku2v1AVWHYDA1GSJwCbaVj JUDXZm2nAQdV+T0KOtF28hRJjL6kZRXLf6Ma3w8WE7HSOPi7RNShe2GrAqlLu6bWWZDS 0cHbQJa3/aBmRjoQFmBB2VrSL6epg3i2Eqg2NDK2XzwCGFaTJb81LhJWAvApFs/6a4Gc ZQ1Ht7pKvzQVUsVAklWGc37Ly696LjOOJ6jMrbGkJH61vvLUkoSDdadMomoZ3rh2wh3w 261TomZ9YEo3Jku3tpiv/gL6gLTjkMA2wHKYUpEjw27KPOKq7dA+CS+nR3qqqGRTz7Lh FPFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=v5L1UvLR; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cm21si11646183edb.111.2020.08.17.12.26.59; Mon, 17 Aug 2020 12:26:59 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=v5L1UvLR; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730666AbgHQT05 (ORCPT + 15 others); Mon, 17 Aug 2020 15:26:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:37182 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730403AbgHQPds (ORCPT ); Mon, 17 Aug 2020 11:33:48 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 26AD923884; Mon, 17 Aug 2020 15:33:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597678427; bh=Fiw50jeqkobRhQDGKeJkItSxQGeO+dfc6ICco/9FPvY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v5L1UvLRhwnX9mA/yrEdZHoXMyDgAScOdZONdjWftd+4jpIRvYK5d2JG8Kk4oXtre wFVXeMpgTDtNiaeDhL4YmSMxwNdwGX/lJY7aSsf+zsDboE4KwCTGOxAWerpELA9Mfo wC9f4RoAp/nl5nF3L4nO+BJKDIJPHHS6IebohNWQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jerome Brunet , Mark Brown , Sasha Levin Subject: [PATCH 5.8 331/464] ASoC: meson: axg-tdm-formatters: fix sclk inversion Date: Mon, 17 Aug 2020 17:14:44 +0200 Message-Id: <20200817143849.643980637@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jerome Brunet [ Upstream commit 0d3f01dcdc234001f979a0af0b6b31cb9f25b6c1 ] After carefully checking, it appears that both tdmout and tdmin require the rising edge of the sclk they get to be synchronized with the frame sync event (which should be a rising edge of lrclk). TDMIN was improperly set before this patch. Remove the sclk_invert quirk which is no longer needed and fix the sclk phase. Fixes: 1a11d88f499c ("ASoC: meson: add tdm formatter base driver") Signed-off-by: Jerome Brunet Link: https://lore.kernel.org/r/20200729154456.1983396-4-jbrunet@baylibre.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/meson/axg-tdm-formatter.c | 11 ++++++----- sound/soc/meson/axg-tdm-formatter.h | 1 - sound/soc/meson/axg-tdmin.c | 2 -- sound/soc/meson/axg-tdmout.c | 3 --- 4 files changed, 6 insertions(+), 11 deletions(-) -- 2.25.1 diff --git a/sound/soc/meson/axg-tdm-formatter.c b/sound/soc/meson/axg-tdm-formatter.c index 358c8c0d861cd..f7e8e9da68a06 100644 --- a/sound/soc/meson/axg-tdm-formatter.c +++ b/sound/soc/meson/axg-tdm-formatter.c @@ -70,7 +70,7 @@ EXPORT_SYMBOL_GPL(axg_tdm_formatter_set_channel_masks); static int axg_tdm_formatter_enable(struct axg_tdm_formatter *formatter) { struct axg_tdm_stream *ts = formatter->stream; - bool invert = formatter->drv->quirks->invert_sclk; + bool invert; int ret; /* Do nothing if the formatter is already enabled */ @@ -96,11 +96,12 @@ static int axg_tdm_formatter_enable(struct axg_tdm_formatter *formatter) return ret; /* - * If sclk is inverted, invert it back and provide the inversion - * required by the formatter + * If sclk is inverted, it means the bit should latched on the + * rising edge which is what our HW expects. If not, we need to + * invert it before the formatter. */ - invert ^= axg_tdm_sclk_invert(ts->iface->fmt); - ret = clk_set_phase(formatter->sclk, invert ? 180 : 0); + invert = axg_tdm_sclk_invert(ts->iface->fmt); + ret = clk_set_phase(formatter->sclk, invert ? 0 : 180); if (ret) return ret; diff --git a/sound/soc/meson/axg-tdm-formatter.h b/sound/soc/meson/axg-tdm-formatter.h index 9ef98e955cb27..a1f0dcc0ff134 100644 --- a/sound/soc/meson/axg-tdm-formatter.h +++ b/sound/soc/meson/axg-tdm-formatter.h @@ -16,7 +16,6 @@ struct snd_kcontrol; struct axg_tdm_formatter_hw { unsigned int skew_offset; - bool invert_sclk; }; struct axg_tdm_formatter_ops { diff --git a/sound/soc/meson/axg-tdmin.c b/sound/soc/meson/axg-tdmin.c index 3d002b4eb939e..88ed95ae886bb 100644 --- a/sound/soc/meson/axg-tdmin.c +++ b/sound/soc/meson/axg-tdmin.c @@ -228,7 +228,6 @@ static const struct axg_tdm_formatter_driver axg_tdmin_drv = { .regmap_cfg = &axg_tdmin_regmap_cfg, .ops = &axg_tdmin_ops, .quirks = &(const struct axg_tdm_formatter_hw) { - .invert_sclk = false, .skew_offset = 2, }, }; @@ -238,7 +237,6 @@ static const struct axg_tdm_formatter_driver g12a_tdmin_drv = { .regmap_cfg = &axg_tdmin_regmap_cfg, .ops = &axg_tdmin_ops, .quirks = &(const struct axg_tdm_formatter_hw) { - .invert_sclk = false, .skew_offset = 3, }, }; diff --git a/sound/soc/meson/axg-tdmout.c b/sound/soc/meson/axg-tdmout.c index 418ec314b37d4..3ceabddae629e 100644 --- a/sound/soc/meson/axg-tdmout.c +++ b/sound/soc/meson/axg-tdmout.c @@ -238,7 +238,6 @@ static const struct axg_tdm_formatter_driver axg_tdmout_drv = { .regmap_cfg = &axg_tdmout_regmap_cfg, .ops = &axg_tdmout_ops, .quirks = &(const struct axg_tdm_formatter_hw) { - .invert_sclk = true, .skew_offset = 1, }, }; @@ -248,7 +247,6 @@ static const struct axg_tdm_formatter_driver g12a_tdmout_drv = { .regmap_cfg = &axg_tdmout_regmap_cfg, .ops = &axg_tdmout_ops, .quirks = &(const struct axg_tdm_formatter_hw) { - .invert_sclk = true, .skew_offset = 2, }, }; @@ -309,7 +307,6 @@ static const struct axg_tdm_formatter_driver sm1_tdmout_drv = { .regmap_cfg = &axg_tdmout_regmap_cfg, .ops = &axg_tdmout_ops, .quirks = &(const struct axg_tdm_formatter_hw) { - .invert_sclk = true, .skew_offset = 2, }, };