From patchwork Mon Aug 17 15:16:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 247834 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp2851957ilo; Mon, 17 Aug 2020 11:11:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymn79bNT2dAJS6rx/wsoF2CGq7pKImallvdPa8T1VzbgzJ9pxexJ56fnnKPWGT3Z1CjQjF X-Received: by 2002:a05:6402:1a46:: with SMTP id bf6mr15807268edb.284.1597687875385; Mon, 17 Aug 2020 11:11:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597687875; cv=none; d=google.com; s=arc-20160816; b=0iSS31FpOR11jUD5CI3oBcwnWywZOjLSbffWuN4WlCdoPbTt/jwvL20kOpZJQepaAH DDhSWUg2J2RkE9R4LWLjXwpxPdf8Yw2ZoBNvICBxRoQzGHyQk2imTmwbbmwJBF/YEnL7 vLYGTHboW0SdTYohviAbMVgZ9YE9yoKjE/5hYFkfDO3TeCDKJGlOyBxqDwUgCxfNr2wY u4nEnIkaM6RSAz9OcMxDoE8CXdxGYkDA8oU8yhgWhH9T3zrLFbl5Qav6AsGZeUadJKoO zQ9ksXHPGTCOJvqqgb/Fx1QbAmWymJO5aEL871qvBdTsSnZkR2ZPQ6HyUXcof9Hjb9lw mq8g== 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=vgxsI3wC9z54ms7irdeT8EPSe1+Z8eSkuXpdRb6PyNEciZUpQCkg/lhgcceb9lQSjj mVes4aZG0Dt0EUvUR7iRo5ujaaSZhdLcRJWqkI9OIbVEznm0Tkl8Ahk28dYWUwQp3OcQ g9W3pWKCF2JqYypMmJ3rGTc3aT1eWAtT8yeFJruJNclkWrN7RRrXzHIEQBN3h9TWzZis QyxODdhQqvuSyna+syEGI1hxGrt5z/zpELgo6WiFzM6pA7Xv60i9sHPrKhbrNEMYuWaC EMqdgmsWPUnaEfGUDCHKnHI9keFVmbkAa9C3P/ruZ+9nxGwnWhG71fgB+deNjG/kNC9h 5/zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uO0vWYof; 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 os22si9736436ejb.693.2020.08.17.11.11.15; Mon, 17 Aug 2020 11:11:15 -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=uO0vWYof; 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 S2390447AbgHQSLN (ORCPT + 15 others); Mon, 17 Aug 2020 14:11:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:55706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388411AbgHQQH2 (ORCPT ); Mon, 17 Aug 2020 12:07:28 -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 1C78720729; Mon, 17 Aug 2020 16:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680447; bh=Fiw50jeqkobRhQDGKeJkItSxQGeO+dfc6ICco/9FPvY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uO0vWYofnUUeqE3zOWKh4CspFIToV/1bipfnd5RbJIZq1QY/1j98BkyJsqjk3d7Si VTB8dp702PckuVfYLZhbbAHLLBdyBJAYMKyIumOtc9QnRJwIuFCte1nD13h6vghOJq 5DhGqCHqr2R3KiY2qQyLUrSZHYst5WK1o9tmd8OQ= 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.4 189/270] ASoC: meson: axg-tdm-formatters: fix sclk inversion Date: Mon, 17 Aug 2020 17:16:30 +0200 Message-Id: <20200817143805.220979553@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143755.807583758@linuxfoundation.org> References: <20200817143755.807583758@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, }, };