Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3198983lqp; Tue, 26 Mar 2024 02:29:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXC9Cpb1Rdn8Cr3mLhBSH+wdGcbotugHgjklDDSHKwLU5tQOBrRQJTG85mp+6K5jbqc4EGdGAIwG9Gp64LLI6/n9kNBNUnTAmrpVycZIg== X-Google-Smtp-Source: AGHT+IEuymTZU9xgvVbR4wqBqQNGm7vE90BId5idqPnzicSgkc6a4pRzMuK4StNCJQ6IDB2LY/xe X-Received: by 2002:ac8:58c9:0:b0:431:2fa6:f22e with SMTP id u9-20020ac858c9000000b004312fa6f22emr10494502qta.3.1711445346938; Tue, 26 Mar 2024 02:29:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711445346; cv=pass; d=google.com; s=arc-20160816; b=BdaSbvDV7No/3Vh0hwz7jVbag6CkMTwhPEl/IlZ7KwG+Mu7zt3qc/nt2Ce56zjeNVd vMUK3bSByjm0askBuAUudYkG9zptuFomuDsp9/eoVvxJ9ZZfxhowuvT5B8uCNug+IQvW bHL6lDc/Qw0ednoTQXV/5IqndcFaLZgpz3xeSs2VgniZXE8lgmKOYfbt7Zsfl54OO33u 9Mz/EEmmurlAEb+St4chFRt/gfcZyKPZUZzKZLdCJt5XCYBD2f4cC23Ds6Gl44j+mffv fRalkZfRfS8z84O7mqG1IhBIply+RC0zr1EXEMnS6EuWsiC/mgN1mcVux65FCAo6nAxi yifg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=00lJhxXYzylZ99xmfShX+mvpcN2gAYEOL+J1d6FE+nc=; fh=DQfWcJ7a6lABpgAjlslbt+lALChD4jPOSQFW0XC7h54=; b=qYLC9DkW5ogOcErUf0qo9Ra5e9miAnJQIDldVGUBS4akmD1ZZGa2cVfvHZ4ALdEm+I /fNcGOAmZglg/VPUvN5p0jbeAK5cbKcg+/O4UNTUaton67+1vRPwJXrC60ADvfFlIkMG 5SzplsihWWKBuWu7gZEoPhfTsU6q8bUeakQLJbGTOL7N86xZoCruuXENsI5QPyFTdEQk aiZcUUPHJw16dc4akVTD2vB3Ex6mYVZSfcueEFqMXxWkODKbDWTPjPftIVltKmHzN+M6 /IwZbP+uu2nh98NeqqQqbsS1fq+WOFAVUvBFdZPMfXKeRIxcsZYY+ZLilZUZCS7IFv+/ l0SA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VaBQAlI+; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-118664-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118664-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 14-20020ac8574e000000b00430d73a0a04si7182659qtx.22.2024.03.26.02.29.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 02:29:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118664-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VaBQAlI+; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-118664-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118664-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A96E91C39CD8 for ; Tue, 26 Mar 2024 09:29:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 23ADA12BF2D; Tue, 26 Mar 2024 09:20:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VaBQAlI+" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA1355787D; Tue, 26 Mar 2024 09:20:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711444843; cv=none; b=RgAg7I9NmpjoV+96dhx6VnRjMK6nLnadyceB3Ol/1T1gkTXNznmTFoLgooN31w4w0g9ZgXolUDNlXz59y+gB8DeKe1zZMcfPWhSe4UTal6aKCBWCKDjsIXvW39M3fkc9X/6KFUeJvBnTHb7/TyqzaCNpQqsugneUaXHONI+ZDAE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711444843; c=relaxed/simple; bh=UcBRdyJoV3HQmcqcxz4QCVsNvKgyu4qgE3ILvcUwU0k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LhrIMPEKV6BcCb1+Y+Pzy1mpENPEYVDXnGb7xvJM1798q3b0wcxa6zoxYUDlKz76SNZ/+S7ZPRRTCesthOS9PcLe0Bb3oKmdcfXje1IuvinRvG2NBOokXIr4qgsywjv+2FXycDy/nO3z4F8U8QHQfaYeJdHehEs+c+E1fBhtg/8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=VaBQAlI+; arc=none smtp.client-ip=192.198.163.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711444842; x=1742980842; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UcBRdyJoV3HQmcqcxz4QCVsNvKgyu4qgE3ILvcUwU0k=; b=VaBQAlI+UUQymwO3oFKEBzKVwWHueGMhrWcHlAu7zNBODxPy31RNnBH4 uDdD0FM2MXfzX8PjbbsF6+oJEbBF4KjOPJ6ZH3KOhpNYxcqo6zg4FanGN FanPCN9w3obB1DZUi+G/4EaxDl9Z46LvgXAFma5oYbIjuSHS8EgYAQh7x /Wb0mJNS+lssvEDuTrdHN33UWrmgPYp2HX09DRJCYO9eho5c+hx1a1HSF 1zf4OJEjW1tSb4400uWGz2De4Ruyed62xtNreiLdB9Vnu3rS8rqwa8dsx X09HS3gNdT/3dUalfHpqj1CCdzhi8XMDo2nD0C+2sK0ZT6UAYsf8Z61uF w==; X-IronPort-AV: E=McAfee;i="6600,9927,11024"; a="6350349" X-IronPort-AV: E=Sophos;i="6.07,155,1708416000"; d="scan'208";a="6350349" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 02:20:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,155,1708416000"; d="scan'208";a="16293273" Received: from yungchua-ws.ostc.intel.com (HELO yungchua-ws.intel.com) ([10.54.69.90]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2024 02:20:36 -0700 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 5/7] soundwire: intel_ace2x: move and extend clock selection Date: Tue, 26 Mar 2024 09:20:28 +0000 Message-Id: <20240326092030.1062802-6-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240326092030.1062802-1-yung-chuan.liao@linux.intel.com> References: <20240326092030.1062802-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Pierre-Louis Bossart The input clock to the SoundWire IP can be 38.4 MHz (xtal clock source) 24.576 MHz (audio cardinal clock) 96 MHz (internal Audio PLL) This patch moves the clock selection outside the mutex and add the new choices for 24.576 and 96 MHz, but doesn't add any functionality. Follow-up patches will add support for clock selection. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Signed-off-by: Bard Liao --- drivers/soundwire/intel_ace2x.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2x.c index 8280baa3254b..abdd651a185c 100644 --- a/drivers/soundwire/intel_ace2x.c +++ b/drivers/soundwire/intel_ace2x.c @@ -74,20 +74,29 @@ static int intel_link_power_up(struct sdw_intel *sdw) struct sdw_master_prop *prop = &bus->prop; u32 *shim_mask = sdw->link_res->shim_mask; unsigned int link_id = sdw->instance; + u32 clock_source; u32 syncprd; int ret; + if (prop->mclk_freq % 6000000) { + if (prop->mclk_freq % 2400000) { + syncprd = SDW_SHIM_SYNC_SYNCPRD_VAL_24_576; + clock_source = SDW_SHIM2_MLCS_CARDINAL_CLK; + } else { + syncprd = SDW_SHIM_SYNC_SYNCPRD_VAL_38_4; + clock_source = SDW_SHIM2_MLCS_XTAL_CLK; + } + } else { + syncprd = SDW_SHIM_SYNC_SYNCPRD_VAL_96; + clock_source = SDW_SHIM2_MLCS_AUDIO_PLL_CLK; + } + mutex_lock(sdw->link_res->shim_lock); if (!*shim_mask) { /* we first need to program the SyncPRD/CPU registers */ dev_dbg(sdw->cdns.dev, "first link up, programming SYNCPRD\n"); - if (prop->mclk_freq % 6000000) - syncprd = SDW_SHIM_SYNC_SYNCPRD_VAL_38_4; - else - syncprd = SDW_SHIM_SYNC_SYNCPRD_VAL_24; - ret = hdac_bus_eml_sdw_set_syncprd_unlocked(sdw->link_res->hbus, syncprd); if (ret < 0) { dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_set_syncprd failed: %d\n", -- 2.34.1