Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2864932rwb; Mon, 19 Sep 2022 11:07:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5RU0iDZjVJHNhGuFm3sHlbILmHfdyNL2jvThJvYI0PQn0lxTznvhg1Fp7bn+Q+AaENht9t X-Received: by 2002:a17:90a:d14a:b0:203:7b4b:6010 with SMTP id t10-20020a17090ad14a00b002037b4b6010mr11502193pjw.237.1663610821162; Mon, 19 Sep 2022 11:07:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663610821; cv=none; d=google.com; s=arc-20160816; b=H9kNh9KeC2L+dxpw7T7BuJWIh7YUFRu2AgBXT7Mbt8SEKC8vyaG/SU5H8+ZjC/9dRT 1vx04+6qxlioaVK24o+ZQMpNgU7h8uxKCPpJnJHdesXZhyphAolFJx/ZcVY79Om5cRVW rVKnwMFb+dC/i2qNVhhNBT79sxag8r2vyADGhZglnxWEQMsisx+M5n79V+MpLMwLt5f6 v/ZE2MD6hQnVeXIryW8PhG/Mtuz89SVsSWfGuJBCENEoDGeoPJdPyloFAC514Mhn/c/+ HpXrwwS6wXEaGhtwDSq6HLIY+Ct6x/IU87epItzOUTXRINerOEUiCxib0nUB2UFbDUKb kqng== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=180spoWG1qeBT70n+qi0e1/Zm3z+UE5UxxNpmLmH/Fw=; b=pRHnI1NoOUpeaB86vkru+N7MgtXuujh515Z+lsOeMeC7KlrGltV71u1/GLvVSqvhWX lzgz+wqZBSEpISigzcT9ysYTtu4NGA3oygQS/iwUFwTMvOT5V9Nb7U2A4NEOEK3nMvZd Hot+5jt5G373pngxP0J7iTIqSs8tpmYlYM5QWbB3Wzdx6+h2NNZm2eFRQYvJSrDAyRoA m2uKXxyjgwxAVlH9VSYjJe1MTzzce7JEpWBTCXLhn/qXasmt/s+YFaz9hiPuF6W3nBpp lEt/oguhoApciGGA4vMiJSXFRhxXDvpLbtIOs1nA5O9+eSWCXkLpez52L3yGj/xFB7uA 0PWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FHKPe7YX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r16-20020a63fc50000000b0042b95537587si360075pgk.359.2022.09.19.11.06.48; Mon, 19 Sep 2022 11:07:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FHKPe7YX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231374AbiISRu7 (ORCPT + 99 others); Mon, 19 Sep 2022 13:50:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230477AbiISRuu (ORCPT ); Mon, 19 Sep 2022 13:50:50 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADE5B402F8 for ; Mon, 19 Sep 2022 10:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663609849; x=1695145849; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QdddNi3xNXTqW9R7OXfPq7qq+hZkkcHfGOJFzY4TwbA=; b=FHKPe7YXGMQ3pNihe9Wtr6m0CF288rwfMN9jxR19bLvysuv9QLun4tnb oKf2pJIEKxYgIb1J1eBBiPzjPceK6Zt7iAgwMv3U/VaKGifmUVda4uF7x R+g5qUkvRELZ16VNCs+5TVzdxRVJVQMuHNC4IqEGZPDGZOHl51r+uewlN vlbQm5c7NdNWGMIRnvDSuNgYpyZIU+QicQOaFaSuvNqkBzyhqtYEDbqOR Yk6yKlE24X8BxVS+XlEWV/Lp6J2L/hDq76XpoyGFTdKvZ/NcX3DJcUqST rjTue6tsOvGitZjTvaWdkzdE0ExsbDJQJgrahi/xnVNt7104LFed14M/H A==; X-IronPort-AV: E=McAfee;i="6500,9779,10475"; a="363429205" X-IronPort-AV: E=Sophos;i="5.93,328,1654585200"; d="scan'208";a="363429205" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2022 10:50:48 -0700 X-IronPort-AV: E=Sophos;i="5.93,328,1654585200"; d="scan'208";a="863658402" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2022 10:50:46 -0700 From: Bard Liao To: alsa-devel@alsa-project.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 04/11] soundwire: intel: move all PDI initialization under intel_register_dai() Date: Tue, 20 Sep 2022 01:57:14 +0800 Message-Id: <20220919175721.354679-5-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220919175721.354679-1-yung-chuan.liao@linux.intel.com> References: <20220919175721.354679-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart Start regrouping functionality in high-level functions. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index d7852cc7dd96..676de04c5070 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -1171,11 +1171,20 @@ static int intel_create_dai(struct sdw_cdns *cdns, static int intel_register_dai(struct sdw_intel *sdw) { + struct sdw_cdns_stream_config config; struct sdw_cdns *cdns = &sdw->cdns; struct sdw_cdns_streams *stream; struct snd_soc_dai_driver *dais; int num_dai, ret, off = 0; + /* Read the PDI config and initialize cadence PDI */ + intel_pdi_init(sdw, &config); + ret = sdw_cdns_pdi_init(cdns, config); + if (ret) + return ret; + + intel_pdi_ch_update(sdw); + /* DAIs are created based on total number of PDIs supported */ num_dai = cdns->pcm.num_pdi; @@ -1347,7 +1356,6 @@ static int intel_link_probe(struct auxiliary_device *auxdev, int intel_link_startup(struct auxiliary_device *auxdev) { - struct sdw_cdns_stream_config config; struct device *dev = &auxdev->dev; struct sdw_cdns *cdns = auxiliary_get_drvdata(auxdev); struct sdw_intel *sdw = cdns_to_intel(cdns); @@ -1385,14 +1393,6 @@ int intel_link_startup(struct auxiliary_device *auxdev) if (ret) goto err_init; - /* Read the PDI config and initialize cadence PDI */ - intel_pdi_init(sdw, &config); - ret = sdw_cdns_pdi_init(cdns, config); - if (ret) - goto err_init; - - intel_pdi_ch_update(sdw); - /* Register DAIs */ ret = intel_register_dai(sdw); if (ret) { -- 2.25.1