Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3002054rdh; Mon, 27 Nov 2023 04:32:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqcBikJux68QxDKvcJi5uzSwq34sCzIbj64kgPpAurHT48n75wZbLFy9a7FF/23WbZJo5k X-Received: by 2002:a17:902:c713:b0:1cf:677b:6c2b with SMTP id p19-20020a170902c71300b001cf677b6c2bmr8888799plp.29.1701088365266; Mon, 27 Nov 2023 04:32:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701088365; cv=none; d=google.com; s=arc-20160816; b=hzeTNdou6Y0gPbvluvn5QZH9oFIU3Na3fDLIAf4inxhzodxQhAGPn6sOokiF+2YPyq OoL9pjwvS4HjRZbaPe0FNs6F4q9itiPn9Qf67I2QTWXWX8rF0R41tb0yUt3BRdmsUFPa xLM5ACEvGrugUbPPM/5EH/xOsZKr5lVyO6iPxvU5bGPGIdBmtYYpW78sqex1jVq8HqB5 eLF3KU+cXrI5YT4xX818QkQ+JzgJFuYcslaHVnbtZ9+Qzzh5MhtoXNRv3gbe0dVLZvx9 7ry7KnhqXKboEZSV8kO0neD0vwpnTeAiXs4CA8x/yrYNLBLKFm7OhQwZWn5hp7Vr9YEq qP9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=F7uhM+SVnWaF6uhhcL4AfuIPVOpbv8Ddh1KKvsHmGM4=; fh=DQfWcJ7a6lABpgAjlslbt+lALChD4jPOSQFW0XC7h54=; b=sJ/fMfFp38IC3RmM8I85sofKIAF2ArqXOVg58IfaUnq19pIhkmkp47G5on4MxBQOh9 xB0wexAIUJy3kHNeBdN9ZAo99h1wunI0E7UETqcdXoNN9QOBEDW4akVOtYO04IgdG53R C/LxZcKzhJ0YiRs0RjNUAZVkptmpZmYlP2S15M6lteI0590BmFq1RGbsiRjAmCjKQt5G KCsal8kNNfUC3bgMvhevJSxPk07RL4BDBC31rlRUl/xIxlzOUI0f20slPdGT2k8vE69e 8XLZDMdj34+Lhr4xpfifDqXvDWh0s4/KPt1B+/XtcDdSHwP1Od6jvAx57DYklkaoeY+i n1pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=guCC8skD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id k12-20020a170902c40c00b001c6182d7d43si8505063plk.21.2023.11.27.04.32.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 04:32:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=guCC8skD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 20880809378B; Mon, 27 Nov 2023 04:32:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233380AbjK0McN (ORCPT + 99 others); Mon, 27 Nov 2023 07:32:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233283AbjK0McH (ORCPT ); Mon, 27 Nov 2023 07:32:07 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F12FA8; Mon, 27 Nov 2023 04:32:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701088334; x=1732624334; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=4AjPIatTPDkq5wBY0ALs6UFh15FS5cCycMP5jH/dnGU=; b=guCC8skDjzbVpbLsh221uAFfVzlzA7hzocUWWrFLdJRurWPho9Klwyrc GibXVCjDs9wdjFo8TzlrOCSsetzmvAWvKbHr+HpTpU4IqKljxqbQuRmT3 MAlZT30EqI/ZY07wjVIYoQZNcIbtOXHlCp7gqzOtam5gKaLsTCAADFQWv SAdr7RRR+9LxXI+xt4XVZJIW8GNl7ICwK/UfxWIimO8jP2I9rBepNnTfh AUU8B+I6q2a3PKexEubr//JLEgFMQD8PXwxQ9gRHgxXpclO9DdiBXExxm DyDn+lj/OpRgJGY2P0m0splejT4Frkt3kTKPypHlBcx5iNNPAXwJ5hTHK Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10906"; a="5881415" X-IronPort-AV: E=Sophos;i="6.04,230,1695711600"; d="scan'208";a="5881415" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2023 04:32:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,230,1695711600"; d="scan'208";a="9607086" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2023 04:32:12 -0800 From: Bard Liao To: linux-sound@vger.kernel.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH] soundwire: generic_bandwidth_allocation use bus->params.max_dr_freq Date: Mon, 27 Nov 2023 20:44:05 +0800 Message-Id: <20231127124405.2080431-1-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 27 Nov 2023 04:32:42 -0800 (PST) bus->params.max_dr_freq is calculated and set in sdw_bus_master_add(). We can use it directly instead of calculating it again. Signed-off-by: Bard Liao Reviewed-by: Pierre-Louis Bossart Reviewed-by: Rander Wang --- drivers/soundwire/generic_bandwidth_allocation.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/soundwire/generic_bandwidth_allocation.c b/drivers/soundwire/generic_bandwidth_allocation.c index 31162f2b5638..c70a63d009ae 100644 --- a/drivers/soundwire/generic_bandwidth_allocation.c +++ b/drivers/soundwire/generic_bandwidth_allocation.c @@ -333,7 +333,7 @@ static int sdw_select_row_col(struct sdw_bus *bus, int clk_freq) */ static int sdw_compute_bus_params(struct sdw_bus *bus) { - unsigned int max_dr_freq, curr_dr_freq = 0; + unsigned int curr_dr_freq = 0; struct sdw_master_prop *mstr_prop = &bus->prop; int i, clk_values, ret; bool is_gear = false; @@ -351,14 +351,12 @@ static int sdw_compute_bus_params(struct sdw_bus *bus) clk_buf = NULL; } - max_dr_freq = mstr_prop->max_clk_freq * SDW_DOUBLE_RATE_FACTOR; - for (i = 0; i < clk_values; i++) { if (!clk_buf) - curr_dr_freq = max_dr_freq; + curr_dr_freq = bus->params.max_dr_freq; else curr_dr_freq = (is_gear) ? - (max_dr_freq >> clk_buf[i]) : + (bus->params.max_dr_freq >> clk_buf[i]) : clk_buf[i] * SDW_DOUBLE_RATE_FACTOR; if (curr_dr_freq <= bus->params.bandwidth) -- 2.25.1