Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2662013pxa; Mon, 17 Aug 2020 15:52:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqyUB7U2mQTYQ8/4JxWBsAIG3gkvGfJK+KmmVVFMPN1jHkBW3jmAcLuJIFSPp7WoYjPFy6 X-Received: by 2002:a17:906:4c46:: with SMTP id d6mr18105554ejw.14.1597704750556; Mon, 17 Aug 2020 15:52:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597704750; cv=none; d=google.com; s=arc-20160816; b=vmNx3wv1JytTmaaIPSWIpHgH15YA3yJRain6Dscd34vgXnzvAwpanJXOSC3QhZmmsv DLxhfupFYFmXJ/bEcd8/jVsdzt7mgRabxNFFLz9NaRhg7J/Huvhl6H1S5X1BLZUu+RU7 R1p7x5LOHtGjFo2WjaaYXnGyaVNMRD6fcIPfLu5EYWRks3MmMmxOAY7OG8lf6yoaGOej cHBeI2wEo7w0kQCDow4RhLe1+TJ934XamdtKFYx8MsK6fhv8XwCvYG08+DCFvq3iudTZ lHyA8B/74ofpV7GVpIow+r0CFajS3iRwOgHWUM9tW6gshkzYRaurRtDODtnUuOJj5tIo 2qMQ== 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=NxUtWT99HHe1YhHIautKGImpJpRAWeD3VdvIXqt4t0/j6OoVENLWdJcRavLVin7HmT KadO5fFkSCvFavUju/MKXewKP7GZzwE+WOWRF5nZtAfayUhI8JuvJnb2LpCelAu9wFXV nf0/mRlvt9u6krDU6wP8aPmf6kVv0FdEmH0OzId+iALa20bz+A1OlBjmrwdHBUNnu2jr E0pt8E8IXeSg4bscW90rvVBYgplrDh6f8KUaDG4BF3/8EqIx4GPNQKkxoy2bCy6fOno9 2JNUGvHc4SVjUk2k1J3CNq8u7/nood+QRGVmhrLZoqoB5NgLLlu/kQxcE0c4lXB1EMSc hlpg== 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 linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 y21si12116603ejj.370.2020.08.17.15.52.04; Mon, 17 Aug 2020 15:52:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S1730400AbgHQT06 (ORCPT + 99 others); Mon, 17 Aug 2020 15:26:58 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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, }, }; -- 2.25.1