Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9699381rwl; Wed, 11 Jan 2023 08:52:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXuLCMnBPZeDDbslcsfPGG8Z6AKYE/h/K9aQv/xhgzphV2BAnC2CKaMEYj/91DAVT59gkvZ6 X-Received: by 2002:a05:6a20:ce22:b0:a2:ed21:d820 with SMTP id ic34-20020a056a20ce2200b000a2ed21d820mr2728557pzb.42.1673455960987; Wed, 11 Jan 2023 08:52:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673455960; cv=none; d=google.com; s=arc-20160816; b=oKjNnaR1s8dExorjjtoZOvVxFrlFtvxwf4BceQQk3gqpxpyMp9c3X+bNWaafWiQtHX WJrVCSit+ZRBW2Ih6CXRphTvHvZCKh6ov1GlLyxrgl5r6OXRrjEixdxdF2/TxI/ApVMc I5Nwuo73ATmvYwl7Kr6/0Jq25CpDUA9whK+z9dLwVooZNTKZyAImEda1tP+JfT+QpC1d oh5VNYHULcnScMhvWFCySUFaUKiB7VoNNAuJJnApMNPzN+hAlyCGr/jLEtPyH2k1aPzp BMGcZ5mRC8iMaj3XR1tjxM2eFyfZ3J3rRPrTh1sQ7/t1aQE54xTrrSYkt1oCmcR8ZerE K/uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=abz5dCLfuJK3ZdrAdKNkg2MR7DauONPVOyKuR9T8MPA=; b=cH7hpjuO16J+s904vAawgB7H2BWoHCXwtb8JMUIDquXy2Wx64sfq/Rt6wVnHzLFJai s0auQ9G4YR6bVVKYGcZ3YuGLUxj7IMV6xfJWZzJiyWfpPkF0FspBiZviEp2AtEZUOvHH BUx7QNEmJIyvUKGcd4ksciftu9gQlj+1LDQcSI314nggIN6Lv0+IzEs19rzqqhWB9aDv XcVLsAm4ruHemZ+TJ1/EANm/pe32hCzHXAFVFtXiIBRhwoEsbfvfSkjxMcRmQvE4JqvX DC4DvNQXWPzBPcQUhh5vDPhHU6LMXdruzVn4GYuuj7QTKU9gmdynBQFJfFw7b2SVJmDZ TSSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lJh7vuUR; 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 i4-20020a63b304000000b004af44c74b52si12234078pgf.568.2023.01.11.08.52.34; Wed, 11 Jan 2023 08:52:40 -0800 (PST) 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=lJh7vuUR; 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 S239488AbjAKQgk (ORCPT + 51 others); Wed, 11 Jan 2023 11:36:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238469AbjAKQgH (ORCPT ); Wed, 11 Jan 2023 11:36:07 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE9CE64DF for ; Wed, 11 Jan 2023 08:36:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673454966; x=1704990966; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=+Tf4fOTtVxxPUIU5o6FffNBYvv8T1/1+ZdmCbPKp6+w=; b=lJh7vuURu7RFAZ96n10tZkKbISHDnyYoBdD+HpIpnlq/lT/wpAAcPYq8 9q/NIimpUR0c5+hU5CbILXglU6RmU9DjQuvftU3kRyhv8i+vozRePZtqa FJOyK39J0MRWmWZundby5Z88e7bxrScIpZMhpbmxq6pC/GWhfbzOcR38r VyrDa4wd9pL4WVH0NvADnCvamgIoqbhW2h1vG+4hqdlj0WfTwUTptSfG8 DMttZX+wieoC3VdYh4JojRBt2AzzIvARyR9YnJTh/V1u3oVNgFA3mq54v eesCQDRHY3TfMjtaFspR1f9Pc02mGFBkIzD8PWw9Kkwy/3wFpHLhL1am/ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="324704143" X-IronPort-AV: E=Sophos;i="5.96,317,1665471600"; d="scan'208";a="324704143" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2023 08:32:32 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="607408589" X-IronPort-AV: E=Sophos;i="5.96,317,1665471600"; d="scan'208";a="607408589" Received: from flobatol-mobl1.amr.corp.intel.com (HELO [10.212.110.208]) ([10.212.110.208]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2023 08:32:29 -0800 Message-ID: <0d2ccd69-63e3-b8c5-396b-b698110cad14@linux.intel.com> Date: Wed, 11 Jan 2023 09:38:30 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.4.2 Subject: Re: [PATCH 09/19] ASoC: amd: ps: add support for Soundwire DMA interrupts Content-Language: en-US To: Vijendar Mukunda , broonie@kernel.org, vkoul@kernel.org, alsa-devel@alsa-project.org Cc: Basavaraj.Hiregoudar@amd.com, Sunil-kumar.Dommati@amd.com, Mario.Limonciello@amd.com, Mastan.Katragadda@amd.com, arungopal.kondaveeti@amd.com, Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Syed Saba Kareem , Nathan Chancellor , open list References: <20230111090222.2016499-1-Vijendar.Mukunda@amd.com> <20230111090222.2016499-10-Vijendar.Mukunda@amd.com> From: Pierre-Louis Bossart In-Reply-To: <20230111090222.2016499-10-Vijendar.Mukunda@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 > @@ -167,9 +167,11 @@ struct acp63_dev_data { > struct platform_device *pdev[ACP63_DEVS]; > struct mutex acp_lock; /* protect shared registers */ > struct fwnode_handle *sdw_fw_node; > + struct work_struct acp_sdw_dma_work; > u16 pdev_mask; > u16 pdev_count; > u16 pdm_dev_index; > + u16 dma_intr_stat[ACP63_SDW_MAX_STREAMS]; streams and DMAs are different things in SoundWire. You can have a 1:N mapping. > u8 sdw_master_count; > u16 sdw0_dev_index; > u16 sdw1_dev_index; > diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c > index 0fbe5e27f3fb..5b82ee8e3ad8 100644 > --- a/sound/soc/amd/ps/pci-ps.c > +++ b/sound/soc/amd/ps/pci-ps.c > @@ -113,14 +113,37 @@ static int acp63_deinit(void __iomem *acp_base, struct device *dev) > return 0; > } > > +static void acp63_sdw_dma_workthread(struct work_struct *work) > +{ > + struct acp63_dev_data *adata = container_of(work, struct acp63_dev_data, > + acp_sdw_dma_work); > + struct sdw_dma_dev_data *sdw_dma_data; > + u32 stream_index; > + u16 pdev_index; > + > + pdev_index = adata->sdw_dma_dev_index; > + sdw_dma_data = dev_get_drvdata(&adata->pdev[pdev_index]->dev); > + > + for (stream_index = 0; stream_index < ACP63_SDW_MAX_STREAMS; stream_index++) { > + if (adata->dma_intr_stat[stream_index]) { > + if (sdw_dma_data->sdw_stream[stream_index]) > + snd_pcm_period_elapsed(sdw_dma_data->sdw_stream[stream_index]); is there a reason why you do this in a work thread? IIRC we did this in SOF because of an issue where during an xrun a stop IPC would be sent while we were dealing with an IPC. I don't quite see why it's needed for a DMA? What am I missing? > + adata->dma_intr_stat[stream_index] = 0; > + } > + } > +}