Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp290340ybt; Tue, 23 Jun 2020 22:32:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycMUEzxHJU22ecbWg10sKywOBUcRa4OjQc7+W2P/RMRUQgsctkJJg1OmY1gl97lxLwU0Dd X-Received: by 2002:a17:906:3653:: with SMTP id r19mr22219973ejb.246.1592976768502; Tue, 23 Jun 2020 22:32:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592976768; cv=none; d=google.com; s=arc-20160816; b=KLmW67gXN51arzOWUBn1n+fJTQfhsGG6JksnzOY9+NJ3TjtratjjPmqCgkggjVfmmA q2AaygKdQoHnZnH5OTyW7pu+/73Z2Op/h49lKOoeDEylPqVjFOdaGa470v7c8smOMSwK Zj8W+S/h7sALobRAF2h6tupBMSQ59JCOhpTglwUzsC0VOJoNRBY/HxH7nos3UNlnogeJ CwqLgvZ6z7vPcDauQebdc/OMbWY75gAtT9WKoxLmpoAH24B+3SaxOLn/FsjuW2tYPXql i+FnShCnesbeRP/APRitRKOqna+MdPhxNeqKGnIufbWAbgzAd9SDt/kLDz0JtcYA6D/I VJ/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=rxY2sI+5M5ScbYWb3qEtl3G1F/1tjWTep7j6Lg1ZBLE=; b=lJM6+c43KPH9hukGkO3XmHFlWifhF0wmmop7ij3C38bkrgOvayBLWwQKvMp4KopMR4 ftxzFggLa/UMYvp0fb+PlhN8nMkkj3NmbULGL3cRF+DI6IlSZNDS8l6x8ycr6NtvAbnL Iv5t/IsasRhkmBXx8i48TlFP2Kz6xQsTZ+u69rI2WKcbGraN/7JaP4DOy4rPGmCGkcvd 0t34T8M+VyBdyAW3FrdfUW9V16/akTVsWZapm4aZBaAIVA5JRlAtrbR6IQ7loRHBbn3N MHQc+q+QH1IoqqTyRVxRy+wbXO/FUt1BRN2LzsgFIi7I994olFi901tWSAMqmey9BYos 6RPw== ARC-Authentication-Results: i=1; mx.google.com; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r3si13163962edq.265.2020.06.23.22.32.25; Tue, 23 Jun 2020 22:32:48 -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; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388946AbgFXFaL (ORCPT + 99 others); Wed, 24 Jun 2020 01:30:11 -0400 Received: from mga17.intel.com ([192.55.52.151]:59056 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727957AbgFXFaL (ORCPT ); Wed, 24 Jun 2020 01:30:11 -0400 IronPort-SDR: hd+ZJQLitlBqHdTsAp6GMxmFDDoDr1VkORToY2wObB6aaZRZMDGty5Mqwq6glprvAf4I+wbvmf ubUlIWQs3/HQ== X-IronPort-AV: E=McAfee;i="6000,8403,9661"; a="124597202" X-IronPort-AV: E=Sophos;i="5.75,274,1589266800"; d="scan'208";a="124597202" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2020 22:30:11 -0700 IronPort-SDR: 6qCjaBh756XqDD1clRqa/Sk30co5NJU1FxK+EtZTZG0fuOjWw3u9OXaRJ1EeSpKMRh/1iux4nc DkmZlTqqFcrw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,274,1589266800"; d="scan'208";a="452513392" Received: from bard-ubuntu.sh.intel.com ([10.239.13.33]) by orsmga005.jf.intel.com with ESMTP; 23 Jun 2020 22:30:06 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com, srinivas.kandagatla@linaro.org, rander.wang@linux.intel.com, ranjani.sridharan@linux.intel.com, hui.wang@canonical.com, pierre-louis.bossart@linux.intel.com, sanyog.r.kale@intel.com, slawomir.blauciak@intel.com, mengdong.lin@intel.com, bard.liao@intel.com Subject: [PATCH 3/9] soundwire: intel: introduce a helper to arm link synchronization Date: Wed, 24 Jun 2020 01:35:40 +0800 Message-Id: <20200623173546.21870-4-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200623173546.21870-1-yung-chuan.liao@linux.intel.com> References: <20200623173546.21870-1-yung-chuan.liao@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart Move code from pre_bank_switch to dedicated helper, will be used in follow-up patches as recommended by programming flows. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 4792613e8e5a..6a745602c9cc 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -497,6 +497,21 @@ static int __maybe_unused intel_link_power_down(struct sdw_intel *sdw) return 0; } +static void intel_shim_sync_arm(struct sdw_intel *sdw) +{ + void __iomem *shim = sdw->link_res->shim; + u32 sync_reg; + + mutex_lock(sdw->link_res->shim_lock); + + /* update SYNC register */ + sync_reg = intel_readl(shim, SDW_SHIM_SYNC); + sync_reg |= (SDW_SHIM_SYNC_CMDSYNC << sdw->instance); + intel_writel(shim, SDW_SHIM_SYNC, sync_reg); + + mutex_unlock(sdw->link_res->shim_lock); +} + /* * PDI routines */ @@ -710,21 +725,12 @@ static int intel_pre_bank_switch(struct sdw_bus *bus) { struct sdw_cdns *cdns = bus_to_cdns(bus); struct sdw_intel *sdw = cdns_to_intel(cdns); - void __iomem *shim = sdw->link_res->shim; - int sync_reg; /* Write to register only for multi-link */ if (!bus->multi_link) return 0; - mutex_lock(sdw->link_res->shim_lock); - - /* Read SYNC register */ - sync_reg = intel_readl(shim, SDW_SHIM_SYNC); - sync_reg |= SDW_SHIM_SYNC_CMDSYNC << sdw->instance; - intel_writel(shim, SDW_SHIM_SYNC, sync_reg); - - mutex_unlock(sdw->link_res->shim_lock); + intel_shim_sync_arm(sdw); return 0; } -- 2.17.1