Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3967260pxv; Mon, 19 Jul 2021 13:08:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6QUCDp7pVCV5jeiAZW6jeKN6BqxBrfywnoB2a6EGfLNV0+Dq+icRM4aqc7IRTpDRUYLE9 X-Received: by 2002:a17:906:e088:: with SMTP id gh8mr29110478ejb.125.1626725311272; Mon, 19 Jul 2021 13:08:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1626725311; cv=pass; d=google.com; s=arc-20160816; b=wWxuhuLHOcO60UkHauCdTEI2gdg+qg2M+zpMcr61knM71IIpGWr8ahDuwxaYAFAQNq 1VO5p2IJLs1eO9IzKNqQva6Heq0orl5vBKupVGbVTNr1K3stswxfcELm960DBSmDQ8By pP3ggURFfdG81vO/rB+7rlkA2wAEBiThm+phC8Kg7e7scN42g+POoCr7V5hmtZQ3wre0 m25WvoKdEfaDkD+SbzeeTZXcrAlk2vnkscS7XZoFZtJzWo1R9Pg48c1XpLbV7S4LzyRk ynygJINaTYxEEkIrgKW64ojO3OdUiqNJAjWwMMXPE2LVANE3lfGzu+pNXqqJu4tQeLd3 QReg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:from :references:cc:to:subject:dkim-signature; bh=chu8/m1K2XhyAv8J67xfGMOYg1FWRqRVaNsdxrfn4L4=; b=uTT4acRWI7+Ek4rV89+d42YW891x4uzrM0Mddme5aIIGFzQ/ByhLtjEV3kiPFamzOg vBrdN+sIp60cttrCXmLOECxtayFISlM+ApFW3bs2hI+HhCCI2ATsMYIprjSiOASvDURJ eBjJIxvXRSmBDC/MT6MGn8wyRnBHt6+aufNQCLgu1/94KiwpcTBOxh3lEeugLxspwreb 8TKnx8nt3ljbnyJkQON2ciq0d34IUt+LKbeZgetxcq0jzlZmlc4gt/+6KruE+3rNsLre S0j4/J0bYOb+vi0eYNNzdoivMnRWjiQTzdkZYDrtTWObmhGiYpjfq2KlkZQzL2QAfAfA JutQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="tAJ/YZLw"; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a25si22502456edx.485.2021.07.19.13.07.43; Mon, 19 Jul 2021 13:08:31 -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; dkim=pass header.i=@amd.com header.s=selector1 header.b="tAJ/YZLw"; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384749AbhGSSf2 (ORCPT + 99 others); Mon, 19 Jul 2021 14:35:28 -0400 Received: from mail-bn7nam10on2076.outbound.protection.outlook.com ([40.107.92.76]:14048 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1383769AbhGSSKT (ORCPT ); Mon, 19 Jul 2021 14:10:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NwBfDUiK1K1ZW0QaIkSdJxpXdDd6EIt7eUTn4nboLJm2v3v1CPUW4CVbDudiH+UWSMkHNOjytMbLWnHGQ8TCG8XF49bw81iazbPpv6Y4FxI/hvr5ZInJYMMcwz2lxlwL6yIf5h4am3G4Qrd+dyf1M846kVYeHHYGS75yggPTXkjp9ay3ywbEw13TtbIK/jnMhgl/QzHpL4kxa5AJaaL5MbD3BirJZuLpwqisHO5S2/K0YI8Ih0IUKKKgU6/USxhHKcfYs19jV8dbWf1tj0D8Hk/UpeT1S/mEv7taHaMrtTzPb5pVCqnjGK+HlHzq0IaRwwX8jKB6BUHFSqGPVdfqXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=chu8/m1K2XhyAv8J67xfGMOYg1FWRqRVaNsdxrfn4L4=; b=FDzwOd8wXlHLSKaibs8ofobsFtf/JuIxCCU21r6MFbzVJto663o8dvZciR3tmL8o9YdKybfKD2BOHbmERVcG4XqnbhSHs8tp7xjKNrRCxlGKn5Pax3g8JfXPJDpuxYI7oDuLPB9Yh0RF2Wu9iYAhHySHh7bP+dILOuKuIbuidkC4ENNPPRRAZ4v8YLb5Nj7U+sjZMWOJTMIR8ovingJhP7UAXmmrF7Jx6ayua547itkWzqOwnKx57WE5+Yy0JqKyuf3jwHj2723q9n8SSKWoBLbHQueWcjj6qZ0WNH+EP9De8ij33e8PzluPuS0d+uhtpxbmfgpN/7BEOpwwuGSGGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=chu8/m1K2XhyAv8J67xfGMOYg1FWRqRVaNsdxrfn4L4=; b=tAJ/YZLwlk78/+Xy6iuEF7tYN8fMuAbGBExZF9pdfvs97l/rRtIlYpSf3PWUaTkckhqrPmvJrADd/d2BvC01utxM8QnjjT1xQpMt670gxhi9DgD3xKnCEttXWyJO8NgqIvO+m/bcPuTJgsmwwA+9vAPG7wr0vG5Y8qaIkYMpWsg= Authentication-Results: collabora.com; dkim=none (message not signed) header.d=none;collabora.com; dmarc=none action=none header.from=amd.com; Received: from MWHPR1201MB2557.namprd12.prod.outlook.com (2603:10b6:300:e4::23) by MWHPR12MB1261.namprd12.prod.outlook.com (2603:10b6:300:10::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Mon, 19 Jul 2021 18:50:57 +0000 Received: from MWHPR1201MB2557.namprd12.prod.outlook.com ([fe80::d0a9:a5f1:ca5a:b439]) by MWHPR1201MB2557.namprd12.prod.outlook.com ([fe80::d0a9:a5f1:ca5a:b439%11]) with mapi id 15.20.4331.033; Mon, 19 Jul 2021 18:50:56 +0000 Subject: Re: [PATCH V3 06/12] ASoC: amd: irq handler changes for ACP5x PCM dma driver To: Pierre-Louis Bossart , broonie@kernel.org, alsa-devel@alsa-project.org Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Alexander.Deucher@amd.com, krisman@collabora.com References: <20210719165140.16143-1-vijendar.mukunda@amd.com> <20210719165140.16143-7-vijendar.mukunda@amd.com> From: "Mukunda,Vijendar" Message-ID: <0785f67b-e927-6eb4-9ab0-cff284768fe5@amd.com> Date: Tue, 20 Jul 2021 00:38:40 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: MA1PR0101CA0006.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::16) To MWHPR1201MB2557.namprd12.prod.outlook.com (2603:10b6:300:e4::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.0.160] (49.206.46.65) by MA1PR0101CA0006.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 18:50:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cd2d2ebd-5bf3-4d01-e692-08d94ae6249a X-MS-TrafficTypeDiagnostic: MWHPR12MB1261: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:84; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MxYlr0W5pCTvgk6MiFnwYQD4++Vq4T8YeUslXAUvIGqbKUb/1+VpVpTcdJ+sJ+D9JbDrbBOBlC0SxU5LlV0C7ExJ7yU0Ugrhfkknh5w/PtMe/Ju14i5E9AgxKeQdCUMI8ZbG3WOXL5Q6fFoVsPvTXNJRb6zMercaVrwe2Gsx6mbWSdmfIEmGIDBe1mEqjX+0PSTCm1JyA+bynGeBEfbd9n2Q1mKyUlCF/VSnkstiyMqOSsyAZjm5OuOS5h2q7gNqsEELdV05I33gbl3r41eA5NEbPKRgWdZWkqaaXiuJtSIyYf6G3P0ULLiEeJNUWu/CRz9qojJvXrP5HhfiXuWQG1Yc/vu5EnvNEQzD5iPCGY9AqU1+A7dPHVYJ6mj+FasdxgTwLJqLhcPUWKe8bG3kQLcSzI/EJ2HJNdZFpAAnnImVvRmgyhkV6e3r5N2jseyWlY2RUFSUL3DpG4KxE3Ij93UCrj4rR5dz3w2dMYQ2U/gAUI+pQTnfdsM1vsWfHZ3aTQOThLhp/HfO4T6AEh/4oJXH/vchI2rL79vcDF2HJqH2PKrNpnf9urWyhibcUFUQqBqO4BERuqfbuBeGK1L3Woz3TdyzOlKGWqjQDQvpZuE17ziqRCNck7J3vJHetWK6dN96waWZhgpQ4oM44QUiSmi/ynLZIq39iO9dQdVRjgFT5Erg62H77sA4RSRMVmchOoASw+pxKwJmQnJeAa+xR/vrzOOB9dg8++fGl3FUuhInnpC9awyqF5RQK8sjkGpQn/thHg7msA94F5J9nyHQvA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1201MB2557.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(366004)(346002)(376002)(396003)(39860400002)(54906003)(55236004)(53546011)(2906002)(1006002)(6666004)(956004)(26005)(4326008)(2616005)(186003)(16576012)(316002)(38100700002)(86362001)(6486002)(83380400001)(31696002)(5660300002)(478600001)(8936002)(66476007)(66556008)(8676002)(31686004)(36756003)(66946007)(32563001)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NWx4UmNPZmhuMUNEcmpETEtjaVMwTzFYalRPVWpYcGZzZUJ1V0ErWUZoZVhn?= =?utf-8?B?U1UrQzVIclVvRVJlbVpUWm5LNkM1WG84bHVhZTFBMlJYcS9UTE1FQm5FRkcx?= =?utf-8?B?cHhKK2phOFBsQUlmNURrcW1RKytGeHdxdUJET0lvd281b1pkQ2NIN3lOUmtM?= =?utf-8?B?UkFnWWRPdjI4NXFwRVR0aEg4QTZQWFJUM2d1RCtwZkdna1dHQmI4blEzREwz?= =?utf-8?B?UE5UUGdFMXF3WXUzN0hqMVdLS2FseVpzN1MyaHU4czBrSTV2SEE3eVMrYXBE?= =?utf-8?B?V1BDdGlnZ3YyaHhRTC83akdjWUVINWRKdkpxdmZXMWZ2SEQvNWZqNEZwZGEr?= =?utf-8?B?eE5MRUxCcjY3bFVabGVXWUIySXFYTk96aUFlYzB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hqNXZ6VEptbVVPY3RJazZYQk1qQ2px?= =?utf-8?B?UkVrUUR5Nng4Q1lCUU16NXNlclZ0K2hSYzZvQnZXV3BiZ2RzdnFpa1hsWU84?= =?utf-8?B?K0QrMkJzM21HcmJPeDVhZWhGZGZLdzFFRHZUSDNnYllEckZRMGQxZEhzdVZn?= =?utf-8?B?OGtvbHhWVmZhQ2NlVjN1TFRnY0tYajZnRjBwU3RIaUZGVUdwNmorcXRZUVpo?= =?utf-8?B?bTlrSldENWFqV2dvQ0s5Z3JkLy9XWG1ENG5nUGRwaGhDWUh5TWF2VXh6K1NM?= =?utf-8?B?c1hXVnhKV2hicEFKVXphSUF6RVprd21ZbkVvUjBEOW9QRngwNEZMS29EdUEw?= =?utf-8?B?RytuSlo4ZXpueVBmbDVkWXJKcFAyeXpsYlJTQkNCdjJHdGU2NE9SdXNnVmEw?= =?utf-8?B?OEhEd2I4M01sZ0NmZVl1RGJVSUg0ek56eUJYVmVYeEdRYkFTc1NYVzFRTlNM?= =?utf-8?Q?ruiywpVtx5gGcEIKWgVdewZYr2WC0APPl9n0Pd/?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd2d2ebd-5bf3-4d01-e692-08d94ae6249a X-MS-Exchange-CrossTenant-AuthSource: MWHPR1201MB2557.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2021 18:50:56.8250 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: urINVsaGvNf5A8Eew5uaD210M5mknSni1REX2CsFHL4RkKSOMm8mVSGvfY4QV2P181f3vx4ygYdDzWFtf2Nu2A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1261 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/19/21 11:41 PM, Pierre-Louis Bossart wrote: > >> +static irqreturn_t i2s_irq_handler(int irq, void *dev_id) >> +{ >> + struct i2s_dev_data *vg_i2s_data; >> + u16 irq_flag; >> + u32 val; >> + >> + vg_i2s_data = dev_id; >> + if (!vg_i2s_data) >> + return IRQ_NONE; >> + >> + irq_flag = 0; >> + val = acp_readl(vg_i2s_data->acp5x_base + ACP_EXTERNAL_INTR_STAT); >> + if ((val & BIT(HS_TX_THRESHOLD)) && vg_i2s_data->play_stream) { >> + acp_writel(BIT(HS_TX_THRESHOLD), vg_i2s_data->acp5x_base + >> + ACP_EXTERNAL_INTR_STAT); >> + snd_pcm_period_elapsed(vg_i2s_data->play_stream); >> + irq_flag = 1; >> + } >> + if ((val & BIT(I2S_TX_THRESHOLD)) && >> + vg_i2s_data->i2ssp_play_stream) { > > use single line? will fix it. > >> + acp_writel(BIT(I2S_TX_THRESHOLD), >> + vg_i2s_data->acp5x_base + ACP_EXTERNAL_INTR_STAT); >> + snd_pcm_period_elapsed(vg_i2s_data->i2ssp_play_stream); >> + irq_flag = 1; >> + } >> + >> + if ((val & BIT(HS_RX_THRESHOLD)) && vg_i2s_data->capture_stream) { >> + acp_writel(BIT(HS_RX_THRESHOLD), vg_i2s_data->acp5x_base + >> + ACP_EXTERNAL_INTR_STAT); >> + snd_pcm_period_elapsed(vg_i2s_data->capture_stream); >> + irq_flag = 1; >> + } >> + if ((val & BIT(I2S_RX_THRESHOLD)) && >> + vg_i2s_data->i2ssp_capture_stream) { > > use single line? Will fix it. > >> + acp_writel(BIT(I2S_RX_THRESHOLD), >> + vg_i2s_data->acp5x_base + ACP_EXTERNAL_INTR_STAT); >> + snd_pcm_period_elapsed(vg_i2s_data->i2ssp_capture_stream); >> + irq_flag = 1; >> + } >> + >> + if (irq_flag) >> + return IRQ_HANDLED; >> + else >> + return IRQ_NONE; >> +} >> + >> static int acp5x_audio_probe(struct platform_device *pdev) >> { >> struct resource *res; >> struct i2s_dev_data *adata; >> + unsigned int irqflags; >> int status; >> >> if (!pdev->dev.platform_data) { >> @@ -47,6 +94,14 @@ static int acp5x_audio_probe(struct platform_device *pdev) >> resource_size(res)); >> if (!adata->acp5x_base) >> return -ENOMEM; >> + >> + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); >> + if (!res) { >> + dev_err(&pdev->dev, "IORESOURCE_IRQ FAILED\n"); >> + return -ENODEV; >> + } >> + >> + adata->i2s_irq = res->start; >> dev_set_drvdata(&pdev->dev, adata); >> status = devm_snd_soc_register_component(&pdev->dev, >> &acp5x_i2s_component, >> @@ -55,6 +110,12 @@ static int acp5x_audio_probe(struct platform_device *pdev) >> dev_err(&pdev->dev, "Fail to register acp i2s component\n"); >> return -ENODEV; >> } >> + status = devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler, >> + irqflags, "ACP5x_I2S_IRQ", adata); >> + if (status) { >> + dev_err(&pdev->dev, "ACP5x I2S IRQ request failed\n"); >> + return -ENODEV; >> + } > > return status? > Will fix it and post the new version. >> return 0; >> } >> >> diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h >> index d2853738eb17..18df2b5a4283 100644 >> --- a/sound/soc/amd/vangogh/acp5x.h >> +++ b/sound/soc/amd/vangogh/acp5x.h >> @@ -31,9 +31,18 @@ >> #define ACP5x_HS_TDM_REG_END 0x1242824 >> #define I2S_MODE 0x00 >> #define ACP5x_I2S_MODE 0x00 >> +#define I2S_RX_THRESHOLD 27 >> +#define I2S_TX_THRESHOLD 28 >> +#define HS_TX_THRESHOLD 24 >> +#define HS_RX_THRESHOLD 23 >> >> struct i2s_dev_data { >> + unsigned int i2s_irq; >> void __iomem *acp5x_base; >> + struct snd_pcm_substream *play_stream; >> + struct snd_pcm_substream *capture_stream; >> + struct snd_pcm_substream *i2ssp_play_stream; >> + struct snd_pcm_substream *i2ssp_capture_stream; >> }; >> >> /* common header file uses exact offset rather than relative >>