Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11445620ybi; Thu, 25 Jul 2019 16:44:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4FcLw8sOfscJxNB8m290lphMTVFLpPdRIgrCtiG12rlQCqfoYWkzCfgGi2kbbRSNAxlhs X-Received: by 2002:a63:1045:: with SMTP id 5mr88008001pgq.165.1564098292245; Thu, 25 Jul 2019 16:44:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564098292; cv=none; d=google.com; s=arc-20160816; b=NZ7TKlVv9TP8paZphuVX+hKC74mfKXf+ve3GhCD2S3zA6+fENqbmFruPvSsZPj9HrX oZCZD4PAPxoaPGnnVK7p6c7rNvznEEduSv5yX0yZ9rtVhLOv79HxBWG6jkU7XhR7FOrT UassRi1jGCG33RK9RGixi2e2YGufBOicUJy3LKsm9mCx/tX8noAR0F1vJVVyI+bqPyhs qw+Omx1oaEGC5ADQBECCVR1P43FekzSLIIL7q3AaHlRdsbPn5RpvLt/GYTuhKn6H3QFX CxqJc5cZpKhseR/75hW6g5gieA7MD1/5Mn/bBKS4iDSM3ZR2PfhbgJS5KiLLAMstWHTN +OSA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=JCodicXxbnzOWO+ula3xAFdp+axldqZXEBy49ab0HAg=; b=cnVrlvySYvSezr31CVYIZP7k6Ce87i8p+9GpczFMdSJFDkCK5wdequkL6RHQh6cPX0 +ERrBfc8+pXs4ypKzKtUYkjHBre0JsOiD1GBLGbFMXH+mYIifyoG6b1fLlqJ+KYZ+pK9 kxHhTg1Q+bWXA4sg1sgBMyjsYlmyrkGbRhZ7zvFIUibqRQgzL4xpYGLcOiPG70lAe3GJ YQLp/rNwUvnyTEiHGyHJ8z7ZXHWdSCTk1A+//Hg5JhNpYxGIfGiQsHDbfncy0ROfx+q7 +pNgCtjgJZQzVg8Y9xP8qYv7V0+fpMwS4U4pDIZFodWlMyEBAsIeCWbQC8PDh1x5v4x7 AW3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay21si43219798pjb.34.2019.07.25.16.44.37; Thu, 25 Jul 2019 16:44:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727287AbfGYXm4 (ORCPT + 99 others); Thu, 25 Jul 2019 19:42:56 -0400 Received: from mga06.intel.com ([134.134.136.31]:51808 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727433AbfGYXlg (ORCPT ); Thu, 25 Jul 2019 19:41:36 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2019 16:41:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,308,1559545200"; d="scan'208";a="369874775" Received: from amrutaku-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.255.230.75]) by fmsmga006.fm.intel.com with ESMTP; 25 Jul 2019 16:41:35 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, vkoul@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com, srinivas.kandagatla@linaro.org, slawomir.blauciak@intel.com, Pierre-Louis Bossart , Sanyog Kale Subject: [RFC PATCH 24/40] soundwire: cadence_master: use BIOS defaults for frame shape Date: Thu, 25 Jul 2019 18:40:16 -0500 Message-Id: <20190725234032.21152-25-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> References: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove hard-coding and use BIOS values. If they are wrong use default 48x2 frame shape. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/cadence_master.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c index 442f78c00f09..d84344e29f71 100644 --- a/drivers/soundwire/cadence_master.c +++ b/drivers/soundwire/cadence_master.c @@ -175,7 +175,6 @@ /* Driver defaults */ #define CDNS_DEFAULT_CLK_DIVIDER 0 -#define CDNS_DEFAULT_FRAME_SHAPE 0x30 #define CDNS_DEFAULT_SSP_INTERVAL 0x18 #define CDNS_TX_TIMEOUT 2000 @@ -954,6 +953,20 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns, } EXPORT_SYMBOL(sdw_cdns_pdi_init); +static u32 cdns_set_default_frame_shape(int n_rows, int n_cols) +{ + u32 val; + int c; + int r; + + r = sdw_find_row_index(n_rows); + c = sdw_find_col_index(n_cols); + + val = (r << 3) | c; + + return val; +} + /** * sdw_cdns_init() - Cadence initialization * @cdns: Cadence instance @@ -977,7 +990,9 @@ int sdw_cdns_init(struct sdw_cdns *cdns) cdns_writel(cdns, CDNS_MCP_CLK_CTRL0, val); /* Set the default frame shape */ - cdns_writel(cdns, CDNS_MCP_FRAME_SHAPE_INIT, CDNS_DEFAULT_FRAME_SHAPE); + val = cdns_set_default_frame_shape(prop->default_row, + prop->default_col); + cdns_writel(cdns, CDNS_MCP_FRAME_SHAPE_INIT, val); /* Set SSP interval to default value */ cdns_writel(cdns, CDNS_MCP_SSP_CTRL0, CDNS_DEFAULT_SSP_INTERVAL); -- 2.20.1