From patchwork Fri Jan 7 21:47:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 530518 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B611FC433F5 for ; Fri, 7 Jan 2022 21:49:14 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B0DBB1906; Fri, 7 Jan 2022 22:48:22 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B0DBB1906 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1641592152; bh=O8ImQVY3Xk1HCGaCObsTZCa18wOZ30bgjhrYG1jBYAg=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Mc1EhiPwIPSv/U4dbjDZsNFKE4K2aA/fUE3kN288HjrQNQODx7oOypoFh/eia1Ryi QbbdciI+DkCJb5dGRvtByaw2zfxGnPo2Vyzis3QHEml3LgSCy5yj+iQeg9lOLpID2H tsQn/Y0ke4JmEtr0/DmGim9hJq+1sAxKRI49NLg8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5AFA8F804FA; Fri, 7 Jan 2022 22:47:49 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DBAEAF804FB; Fri, 7 Jan 2022 22:47:46 +0100 (CET) Received: from mx0d-0054df01.pphosted.com (mx0d-0054df01.pphosted.com [67.231.150.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id EE6B7F8014B for ; Fri, 7 Jan 2022 22:47:40 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz EE6B7F8014B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=calian.com header.i=@calian.com header.b="OlBHeHZY" Received: from pps.filterd (m0209000.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 207LEDcX023805; Fri, 7 Jan 2022 16:47:38 -0500 Received: from can01-qb1-obe.outbound.protection.outlook.com (mail-qb1can01lp2052.outbound.protection.outlook.com [104.47.60.52]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3de4vqgpy7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Jan 2022 16:47:37 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W+3kAOl0M0c5MH9CfxDq2UZCKbhdp5wZoPjTaUlPRA8LCV3S7oDo/vf+hI9OP2sFqbPCzjvERtGI8kA7ENNI3MPHkQwpH7h1T3EqH/glgJ+EceAnB1inOLUhk7OJrYz+Tj1TEUAmexfav8LuWOh0PNDCP/0QQ/5F0usKXUl8u+NMYo0pcuPmZAPXQY226vML4gQg2I8x4uC+wAjSZ3QnzeVeIPXdWOLyQ6A9ily82rZ0YhYEivCZuxbZ5sdY3UAiEauA2gIW8GbIzMyYTJafT/sZJK0v4ro6fSbZTQ7Watz6WiHXFXLTzoykxm5bcqudtlbZs89GvGuAcTM4HqZY+w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TBxvggnCIz/ACiO/4SrI4xA7d41IurXHWK6Mhd97KFU=; b=kTq0va1Z9ioyYHmptDjjs59jxNyvkwyCdYrtZwtHB7GjxoE3FeVFdz/n9kQNFsBrK/lFdmHR82laTAu6qfjMUqTG8WeIBQHF5uivsesVzArXEjK90M8wjMX/XcEi0q+9ixqowjQALesW85Z15qD9P+DPVoTVskHHtNyfWJwGvYLxOMVSJt2bBoKbsmhmVGFmLateCA/tot1JaPufYdxk14M+1YyphtOB8Mshd9UI+jDKGhrJy0Q3iPxTSTK5dcoGLJ3eq9LkS0fzyLuEKUOGgbkU8Vu8d+pwLkYjuij0HJXR9MEdTtq9vsaHBAn9IJ+VvXUvcopBIeZq2HxFo4u1kg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TBxvggnCIz/ACiO/4SrI4xA7d41IurXHWK6Mhd97KFU=; b=OlBHeHZYZ2v6u9q11bY3p9eiHK1YYzRw06QsvL/y8fV56LKVoP8XOfL3IVVQO7fauXZ0fFhIPYYpEGfU3XF/Mac1NO+Slth0BzjO4iNf7OyIXAfcjs95v9ldXGNUM9VhlMbrBlCbSaIAmsQqn8ysatqOGozqQdJNzXRPJ2M/q2A= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB6275.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.15; Fri, 7 Jan 2022 21:47:36 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76%5]) with mapi id 15.20.4844.016; Fri, 7 Jan 2022 21:47:36 +0000 From: Robert Hancock To: alsa-devel@alsa-project.org Subject: [PATCH v2 1/6] ASoC: xilinx: xlnx_formatter_pcm: Make buffer bytes multiple of period bytes Date: Fri, 7 Jan 2022 15:47:06 -0600 Message-Id: <20220107214711.1100162-2-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220107214711.1100162-1-robert.hancock@calian.com> References: <20220107214711.1100162-1-robert.hancock@calian.com> X-ClientProxiedBy: CO2PR04CA0136.namprd04.prod.outlook.com (2603:10b6:104::14) To YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 074b0300-47ac-4312-8214-08d9d22751d0 X-MS-TrafficTypeDiagnostic: YT3PR01MB6275:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6G4ipNY6s15gSEQPfVFqmgQlgp+dfYHk8WwprfLNFrbuBAeol5KeGUoOfhuXRzT1Lv2Ij1CjNXsyLDFW4IqzqKbBi1uU2rEdyCSxv+q32PkIy/C5GV70xj/ua67yRWq3FTiyh1vAk9MntZp+94t3vZdMTBVOPWyq+Rx89mOgJMldzwEiTOry1kOBX/W2Ji7vyEbgx9nen3HuUY8yI3ILBczc1xKUEgWTPuZXEUeUbN+mTSSLenpbQimKcK1gzxma5/XFBURwyXfBnOexsPpDeJ/JVr0CkJGH5tNojjE8lkJo5CtM+N2BHogNNFOew76RhiKaGBvd3k7ENMtBg/ae0eyNIWLigXf0t6jMjKwRsqAk8+Zc4FQpOp1fTO8YONGcZNhBDAT++OUBBYP6luFQP+jv9AUIdYDmNOswfdm2NbzGwE5iBKr7RtARVdTjwmJlfZlbQlDQigPyb5CGijJKXAlwjgF3h69Yo1oB58L0tHH62HGAPvo7GVL8i8kGazpLtUdDmxjQ8issloMBXcpP5c82ucv8lNfIePQLa3SxxxW3vDiwDz3i6hWWIRrGHnaTS5HxGUYjy1KQlkRmagCKyZWumpjECtj9GvGHYn7JmNzKgFebUI7Y5saOlHYz5rV+Z1oeVjKjpkYGt87VQlqS9UKnTbQMFbkNEt3hyPy9/vvwE+MrjtJq7wJ+qHEbH+1Gypwztl2QZ9Dj/bzWZWuVhg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(366004)(38100700002)(38350700002)(83380400001)(86362001)(26005)(6666004)(316002)(8676002)(4326008)(508600001)(52116002)(8936002)(186003)(36756003)(54906003)(44832011)(6916009)(2616005)(6486002)(6512007)(2906002)(6506007)(66476007)(66556008)(5660300002)(66946007)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BneuYrT/34aUYgET04Uk8oIaVcjFOQnPOqpfbWnK5cWmTRapaZF/XaHvmQu9uJXyBh/XiSe4Qjx7WnXhv/DOKlJsFpR3QeAO6TEth/Ltc3BKwaIS9NE37CmDAX0iZ0hOnwwh6ZKGj/w/BmAtLJFmZRCr6UUf3WHVdppjN09+Cft1gjbr4PCadrgyr1sOpOrVTMmhB1bZAKagxFeQHqRvPRN2OWks7+TG+qCzaAzsJvRqjEYrSTImzjdA5Pxm8w1yzQszUJi3Zc1gUrTX43W3PQU2tlhYrONcy8Zjv93S8y/XTXIGsYm2S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tKncorOamBle39tbOoRh4B6rb1Ow5h0XDhs5VI8lN0+jUhqfzvAOpLjEjDESUMdFVjxMZcL7HVIVSWHX8YAkprP2glEhP+qhpsAq5zpcV+vooTeZBkEOHCE+0vpz1SLEtTvFAYHGGc/M1ZqE5WOdsXIcZ60w4WlQJEmAsxkVmNQYVMwFtaF6xL1kNYKIakj1fkYP7eBvCC3LQjkejRrGspeE1e4bAgFVM/OXIkMmHgOi5opMlq6L/S2iMDkWOyF99Y7kzffi93nvu0N2t//qUi3UtDkJEqE/M7IfhXwIIsM0UQ== X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 074b0300-47ac-4312-8214-08d9d22751d0 X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2022 21:47:36.8896 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BTcB+i13wpaEyscIi0tlkamDa+WL4LaMcZhW6IK80Y6zUFQOrHYGzi9DwVTVXEsSaEhdw5+JvyUCYtHSXtLAOUO9i+fFlzixDTQhQ6+dUUU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB6275 X-Proofpoint-GUID: sh_v1fvbCuH-ZrSIyM3q42VU_j7akuuq X-Proofpoint-ORIG-GUID: sh_v1fvbCuH-ZrSIyM3q42VU_j7akuuq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-07_10,2022-01-07_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 priorityscore=1501 clxscore=1015 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201070129 Cc: kuninori.morimoto.gx@renesas.com, Devarsh Thakkar , michal.simek@xilinx.com, maruthi.srinivas.bayyavarapu@xilinx.com, tiwai@suse.com, Robert Hancock , broonie@kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This patch is based on one in the Xilinx kernel tree, "ASoc: xlnx: Make buffer bytes multiple of period bytes" by Devarsh Thakkar. The same issue exists in the mainline version of the driver. The original patch description is as follows: "The Xilinx Audio Formatter IP has a constraint on period bytes to be multiple of 64. This leads to driver changing the period size to suitable frames such that period bytes are multiple of 64. Now since period bytes and period size are updated but not the buffer bytes, this may make the buffer bytes unaligned and not multiple of period bytes. When this happens we hear popping noise as while DMA is being done the buffer bytes are not enough to complete DMA access for last period of frame within the application buffer boundary. To avoid this, align buffer bytes too as multiple of 64, and set another constraint to always enforce number of periods as integer. Now since, there is already a rule in alsa core to enforce Buffer size = Number of Periods * Period Size this automatically aligns buffer bytes as multiple of period bytes." Fixes: 6f6c3c36f091 ("ASoC: xlnx: add pcm formatter platform driver") Cc: Devarsh Thakkar Signed-off-by: Robert Hancock --- sound/soc/xilinx/xlnx_formatter_pcm.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/sound/soc/xilinx/xlnx_formatter_pcm.c b/sound/soc/xilinx/xlnx_formatter_pcm.c index 91afea9d5de6..ce19a6058b27 100644 --- a/sound/soc/xilinx/xlnx_formatter_pcm.c +++ b/sound/soc/xilinx/xlnx_formatter_pcm.c @@ -37,6 +37,7 @@ #define XLNX_AUD_XFER_COUNT 0x28 #define XLNX_AUD_CH_STS_START 0x2C #define XLNX_BYTES_PER_CH 0x44 +#define XLNX_AUD_ALIGN_BYTES 64 #define AUD_STS_IOC_IRQ_MASK BIT(31) #define AUD_STS_CH_STS_MASK BIT(29) @@ -368,12 +369,32 @@ static int xlnx_formatter_pcm_open(struct snd_soc_component *component, snd_soc_set_runtime_hwparams(substream, &xlnx_pcm_hardware); runtime->private_data = stream_data; - /* Resize the period size divisible by 64 */ + /* Resize the period bytes as divisible by 64 */ err = snd_pcm_hw_constraint_step(runtime, 0, - SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64); + SNDRV_PCM_HW_PARAM_PERIOD_BYTES, + XLNX_AUD_ALIGN_BYTES); if (err) { dev_err(component->dev, - "unable to set constraint on period bytes\n"); + "Unable to set constraint on period bytes\n"); + return err; + } + + /* Resize the buffer bytes as divisible by 64 */ + err = snd_pcm_hw_constraint_step(runtime, 0, + SNDRV_PCM_HW_PARAM_BUFFER_BYTES, + XLNX_AUD_ALIGN_BYTES); + if (err) { + dev_err(component->dev, + "Unable to set constraint on buffer bytes\n"); + return err; + } + + /* Set periods as integer multiple */ + err = snd_pcm_hw_constraint_integer(runtime, + SNDRV_PCM_HW_PARAM_PERIODS); + if (err < 0) { + dev_err(component->dev, + "Unable to set constraint on periods to be integer\n"); return err; } From patchwork Fri Jan 7 21:47:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 530807 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3AB5FC433EF for ; Fri, 7 Jan 2022 21:49:26 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5BA3F19E7; Fri, 7 Jan 2022 22:48:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5BA3F19E7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1641592164; bh=C2EsZVdUkFcCt2Uu/kPlRRiL/Rb8CRMIMSH2iosmfio=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=B1y4mlZqG3uypX38feSE2dTavL3/Nqktooz0Ahs9+HMPRXkcVQ2I+cnPL7JLW9G8m 1aLjnbYLey3aOQu3aNNOo8NWZvEJTEbYUV7h8XobOOAkovZIJRjQ9DfVbqz8uq9WZr A7/+dZGi9ilveINHSrV8GItmRYjidxOeZzwF2Kpw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 72F76F80507; Fri, 7 Jan 2022 22:47:50 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id ED79EF8014B; Fri, 7 Jan 2022 22:47:46 +0100 (CET) Received: from mx0d-0054df01.pphosted.com (mx0d-0054df01.pphosted.com [67.231.150.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id EAFCFF800AE for ; Fri, 7 Jan 2022 22:47:41 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz EAFCFF800AE Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=calian.com header.i=@calian.com header.b="4ICCHkV9" Received: from pps.filterd (m0209000.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 207LPGa1026852; Fri, 7 Jan 2022 16:47:39 -0500 Received: from can01-qb1-obe.outbound.protection.outlook.com (mail-qb1can01lp2058.outbound.protection.outlook.com [104.47.60.58]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3de4vqgpya-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Jan 2022 16:47:39 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fCxxBIjAjecUyRDuRdzY+CKduGeZiyWKK8AudRavvx4qd+wMRc7HfS4Nap+Ik3192eK3nl4nQTIVQKlG1ObxeMjZeaCfvChnJiy4yp8v05uvmeu68eQNTuH7gajrFbAWEJWfG5TrIoFhqkvJvav0CqXm80l9zFQ/bkHRXW904egoZd8lqt8oxzGWZGe5kn3EvZqGHZ3RBe9SsCsafxTMibNnl+pjyPZOEyncSEFop4Qr3rvkhFxqOynxt1mIKKZdHba2BSKnMReX1CboYPpA+03MlQBqQJ4YrdBNkpAfp7N3mL+F3jvU3/nWSaihuPuvZyn/fxe1pBXIUnIKyiqgQw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2pbZDy1KNUdmzwraonTIO5NGbpVvq3kZtFpIJn255pQ=; b=Tfm2EIBG7h5zQ78JaixziWa2scJzfOg8+cqyKqV7AGFiEkyV2+j7ZbwlFP7tk9n+JhcdYdq1aFuDHbR/qeEyooPSAwCnF2u4dP+JmaT+VEM5tzvDexVsI5UyZrzZu3w+bF1331isUbBpnq9VKl91rOhdWzSRpcw5/etOrp5+OwZ9SagqixsBYrEB0HC0A0sPatcVMvj8sTYtK6FAmVlkbGDCLOwkPpu/yofa6tjpZF7Jkww+JclPUIOIgGBoaa27Sw0aB2ILmWmJ7Q8NTUnLpmRnwTOaAT/ZcyL6JDS1n+O0ez5arX24C/7v83yHN4NE2uHEfxO+YLPxx05LFkrlvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2pbZDy1KNUdmzwraonTIO5NGbpVvq3kZtFpIJn255pQ=; b=4ICCHkV9tVEMr8ehHtqd4ymMAOQJEwj9MbepvSYC40vsf61KOii11bm97dnAKJk3Cx8X2qASzUKuEpda1EgdyhiQuExgY5YFFTcMw8DtE87O4aVepNOnSmQSTPNfZ9u6yTx4YXOrN5vg5B1Deo1JL7bGLr/C79AcKSJcK0lbhZk= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB6275.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.15; Fri, 7 Jan 2022 21:47:38 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76%5]) with mapi id 15.20.4844.016; Fri, 7 Jan 2022 21:47:38 +0000 From: Robert Hancock To: alsa-devel@alsa-project.org Subject: [PATCH v2 2/6] ASoC: xilinx: xlnx_formatter_pcm: Handle sysclk setting Date: Fri, 7 Jan 2022 15:47:07 -0600 Message-Id: <20220107214711.1100162-3-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220107214711.1100162-1-robert.hancock@calian.com> References: <20220107214711.1100162-1-robert.hancock@calian.com> X-ClientProxiedBy: CO2PR04CA0136.namprd04.prod.outlook.com (2603:10b6:104::14) To YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a85c037f-f934-438e-9389-08d9d227527e X-MS-TrafficTypeDiagnostic: YT3PR01MB6275:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CtkCulxT9KvlCuF6ARgfuOSxsk/jN5HU129zxjthhr9vmuOiyl/3Np/DzoBeBtWlY07KV6+ROwGk7GlzQyCcvc+sv2dGEhQyM1V+48uvInTfLKQ/WbaBznTVLGwwoBnesSlNOHye1BOMKSV97T1whLBSjX+O8CM49PrKgPqQ8XtleHqXA9wL8X6nbSlEcIkGvg9f3/3sjeRsvaLPc4+nu1Mpt2nn8YH0DPratPILqkZhrhDCk3tMWlmPj+DW1v+ilR4BrhcshFGiByQuvJKt49VeHwdE2zAvqmuQzkvsEgSk0em4lPQaHeig1qB1ThoXWv5bEtdNapwN2GJ86pCH6dGRS4v9DaU1psmwD6VqCmyt9tisl6yyamf0M0Uhz2AWMtCyDNKk85nLowTuwMhn6HeIJ/yV0jJ//jQEkADfTzsPxysYMrbjCJiIBGyZmFYN7fFCpaF73/lyGOwzvRIah1BHIA119mk7w9g/K3XDVIfJmoqDRXerryu2mZX6XsOfz/YQmwer0PCgdkqjzFrGHebbBcV7ZJWyg6l9aGhRtGiYwCfEuhYewj1SfZ6U2/vFCGeHX0/L310u0KoA7DLxEbkWsQm/uS1c8FQXslChrSZMdSeGX/Quxg5DdHANeZ1yyfJs4aq1jdLY8kqL0/rIIh3eogy2669WSkVeiUOsh66V08UF8VEtVYRnBR+sjrRtImQiuS6P6A0i9+eIq0zXFw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(366004)(38100700002)(38350700002)(83380400001)(86362001)(26005)(6666004)(316002)(8676002)(4326008)(508600001)(52116002)(8936002)(186003)(36756003)(44832011)(6916009)(2616005)(6486002)(6512007)(2906002)(107886003)(6506007)(66476007)(66556008)(5660300002)(66946007)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vzFJh38N2Ff3NbfgmbNN79WjOxJmLXrYMGozLVa1MfyNLDsEJr81iDFsxrCA2hpQY16YrmmnQ9S+A/snQnZVRmHfrkLe59tcqemhC5JiQCMjt+pb4pEtef0h9W84Ufyg1NTmKy2d1SgY9wbgO02QOhDjwG9bT+6grxjXr0yk7QdYHXIAcP5UwADBq8cKvqSrRg2RbWJCecBJ43+7uNYVXaErcjZ1Si2Oz1bstxARUBBIZnXub8p52rfUn75QMS1i4Kqj7LCnSVW3vOroSuoYfDIpUdMk3FN+Ttu8I58VV5G2GZio2iLTE/gfDZWKA5mOF09GcEq5UI1JNtOCrGQS/vw6a031ZgJ5muJOWxwuXgmvbNJvQb61oYsR9+aqsZTPYBD8/Z5WeG2kGCtqQsisQrEBm3xhgp0ZqB67aTfC9/NDp/ZcMmr6Q5BDyzg/lRhk1lcI70DvGALUB+8S99KAwRGBc1fC3z7PYfiDf9ptFgTLE9NRj/CKNukeXxY3iNNp8cDUavWS4CaS+gMhsvs9MqWPQKeYlcmnAFIRpalbzqIkgCa9jqhOLdT1hXBUNycyki4J/sR3mtCV0B6ZXmYfUuhNR9y8y0JCKgXfylTWYb5j5Sd2L8oMOTfCatvBg+YzZoRFbnPSOj6+kKQKNK5lCCCgcaLBRoarMGm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-438e-9389-08d9d227527e X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2022 21:47:38.0157 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1fRm8icz7Wxsw2KLF0Pjl1cI0u5ga6+JzxatPAWpLuXXaFz8rQcYPoHjLzropIqtotUTJYEgFjefodRohdeShuLiXkEQEKxrh25hoLauwSQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB6275 X-Proofpoint-GUID: falYwarlNsu9kJfWMILrU8SnJ2FigDON X-Proofpoint-ORIG-GUID: falYwarlNsu9kJfWMILrU8SnJ2FigDON X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-07_10,2022-01-07_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=469 spamscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 priorityscore=1501 clxscore=1015 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201070129 Cc: kuninori.morimoto.gx@renesas.com, michal.simek@xilinx.com, maruthi.srinivas.bayyavarapu@xilinx.com, tiwai@suse.com, Robert Hancock , broonie@kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This driver did not set the MM2S Fs Multiplier Register to the proper value for playback streams. This needs to be set to the sample rate to MCLK multiplier, or random stream underflows can occur on the downstream I2S transmitter. Store the sysclk value provided via the set_sysclk callback and use that in conjunction with the sample rate in the hw_params callback to calculate the proper value to set for this register. Fixes: 6f6c3c36f091 ("ASoC: xlnx: add pcm formatter platform driver") Signed-off-by: Robert Hancock --- sound/soc/xilinx/xlnx_formatter_pcm.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/sound/soc/xilinx/xlnx_formatter_pcm.c b/sound/soc/xilinx/xlnx_formatter_pcm.c index ce19a6058b27..5c4158069a5a 100644 --- a/sound/soc/xilinx/xlnx_formatter_pcm.c +++ b/sound/soc/xilinx/xlnx_formatter_pcm.c @@ -84,6 +84,7 @@ struct xlnx_pcm_drv_data { struct snd_pcm_substream *play_stream; struct snd_pcm_substream *capture_stream; struct clk *axi_clk; + unsigned int sysclk; }; /* @@ -314,6 +315,15 @@ static irqreturn_t xlnx_s2mm_irq_handler(int irq, void *arg) return IRQ_NONE; } +static int xlnx_formatter_set_sysclk(struct snd_soc_component *component, + int clk_id, int source, unsigned int freq, int dir) +{ + struct xlnx_pcm_drv_data *adata = dev_get_drvdata(component->dev); + + adata->sysclk = freq; + return 0; +} + static int xlnx_formatter_pcm_open(struct snd_soc_component *component, struct snd_pcm_substream *substream) { @@ -450,11 +460,25 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component, u64 size; struct snd_pcm_runtime *runtime = substream->runtime; struct xlnx_pcm_stream_param *stream_data = runtime->private_data; + struct xlnx_pcm_drv_data *adata = dev_get_drvdata(component->dev); active_ch = params_channels(params); if (active_ch > stream_data->ch_limit) return -EINVAL; + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && + adata->sysclk) { + unsigned int mclk_fs = adata->sysclk / params_rate(params); + + if (adata->sysclk % params_rate(params) != 0) { + dev_warn(component->dev, "sysclk %u not divisible by rate %u\n", + adata->sysclk, params_rate(params)); + return -EINVAL; + } + + writel(mclk_fs, stream_data->mmio + XLNX_AUD_FS_MULTIPLIER); + } + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE && stream_data->xfer_mode == AES_TO_PCM) { val = readl(stream_data->mmio + XLNX_AUD_STS); @@ -552,6 +576,7 @@ static int xlnx_formatter_pcm_new(struct snd_soc_component *component, static const struct snd_soc_component_driver xlnx_asoc_component = { .name = DRV_NAME, + .set_sysclk = xlnx_formatter_set_sysclk, .open = xlnx_formatter_pcm_open, .close = xlnx_formatter_pcm_close, .hw_params = xlnx_formatter_pcm_hw_params, From patchwork Fri Jan 7 21:47:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 530806 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D118AC433EF for ; Fri, 7 Jan 2022 21:50:04 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E30121A74; Fri, 7 Jan 2022 22:49:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E30121A74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1641592203; bh=iXayETYBe34wswKWR+HFAsICqVIbjBG9AoNkdbyM0t0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=FXbxsFzu9DOu21W+arewYHxrpdPgXoY5JQe74gD6DSjDaHnOv/ejk2rsghabQn+gG CeSBJ6sHisrXaat2lKUrua6tJqoTfDhR1U2tiJSFPSf6zjzSSQFG39gFPpzcOplTVT wJawiQwCHlhS3xNOlvKczQ9qHTlqe9/EZhVy3j7w= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E1313F80515; Fri, 7 Jan 2022 22:47:57 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C4761F80515; Fri, 7 Jan 2022 22:47:51 +0100 (CET) Received: from mx0d-0054df01.pphosted.com (mx0d-0054df01.pphosted.com [67.231.150.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AF611F80425 for ; Fri, 7 Jan 2022 22:47:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AF611F80425 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=calian.com header.i=@calian.com header.b="SM36YUZg" Received: from pps.filterd (m0209000.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 207LPGa2026852; Fri, 7 Jan 2022 16:47:40 -0500 Received: from can01-qb1-obe.outbound.protection.outlook.com (mail-qb1can01lp2057.outbound.protection.outlook.com [104.47.60.57]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3de4vqgpyc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Jan 2022 16:47:40 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VeJ49kSNFO0wsBpMyH+604VnJHk64vUTc1rvMgmR/emG93xwQvdD1bFUHTJ5egxisToCpsKIvg9AY2CYQyO5wjDgYC2heVVsbaVxF1LtO1DEo/FSycMidXJSZip0k5IJC6v87CuNcZb2FQXoWA/RM0m//SCf79s3J0kbPV98kxLJlrDgVqBff4rpR/CWA3dVaWuVtf1f2FfWsx9wja1k5ZQM70wcsp0HdQNkIiyfFNPQ6OiQBMFN4S7PeBrxafq2OrV9iWxJFcqr8ORFuaErguaHwRYwDgQfvDJxcBeTpaIWsY6Lm9+501YY8sdouYF202oXJI2gQsEeCGahnZxciw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WBuGkiztIfrv7X50LeaVLlCCS1E9XCeo2SZegZqpvxM=; b=PZmrTMYk9NRv8uBkzmrW4Ge9RxJtK1sjEFfdQiYtNWiER4RLiyqqujti0qKakbdxYG0BfjeHIynJuok/lOiTiqYMHi8WW2uV2j9tiILZW3vN17ceGYsoy8Wscx6/Aay3XU3wSiojI1/Ac0kVgMz+0akryUF6U13okuvl15ctntaS6/yKNkDqJ5Pnhx2/g6Ky+bgJv6oxVVhfBa48Fj3U3eXq8VTXb6oWG01D2a5xTsIa+jKxLjc/ybFjtYb920hpONYHSpLr9eU8IjnP77/EQ0Vq1KpPgcpaYnj1fUX/L4HDG8jtDDI5jhP2A6n10wM9IfwaQM1S42U3LbASX9qMVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WBuGkiztIfrv7X50LeaVLlCCS1E9XCeo2SZegZqpvxM=; b=SM36YUZgAbF8MwCn8KSCA6q9U0Oh2TqJIqyvT07nXfauKo5ti18L0v2jkfqUp14SEsdy6/iuttQ7elYnlK+xALr/tDiQZip4McZ3FrZaCM2QFS89MVOMfG4P0mMSgyFEz27gqWWcVjip+rNTwiepebRFD/Y9IsiclsNLOeh5XDE= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB6275.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.15; Fri, 7 Jan 2022 21:47:39 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76%5]) with mapi id 15.20.4844.016; Fri, 7 Jan 2022 21:47:39 +0000 From: Robert Hancock To: alsa-devel@alsa-project.org Subject: [PATCH v2 3/6] ASoC: xilinx: xlnx_i2s: create drvdata structure Date: Fri, 7 Jan 2022 15:47:08 -0600 Message-Id: <20220107214711.1100162-4-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220107214711.1100162-1-robert.hancock@calian.com> References: <20220107214711.1100162-1-robert.hancock@calian.com> X-ClientProxiedBy: CO2PR04CA0136.namprd04.prod.outlook.com (2603:10b6:104::14) To YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0072bf79-c1ae-4ede-d6f1-08d9d227532c X-MS-TrafficTypeDiagnostic: YT3PR01MB6275:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:47; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TkDFRMF3w1NJIGvV5XbjPcVEg5KqqmxAvsVsQmbmj3t74l/yHUlOBEzf6443erDoWAqODjfrb4zbY3qbmh3Z2QCp7x3jxQAU7TFXcGJTuX8OT9WHdMTLxxtNY7Y28ylU5B9FLi0rmXoU9x2EXxB5qLWiH14dwkOnbJ1OIungQ0OfhDSHVSesT+hB/XMM8o01+l2O9L8BXhgr1nU66uYL7ck+sfRqGfcVfB7YlMenmG2z5HKp5MKncmAbi4o2EI6biVuB5P879ZWriHTHKXsADYkQaTAGORyuMCI3ELM2ka0jiNzcoTPbZ297oXzEeL6MnddLKfButo0iaqgqVTEX/P2t+Jrks9mWuC2CSMhSzZDAd0SBJqwO7qhfw3uKEWpO9FfZHzFk+YFfyyf5Gm7/F/B+4tDJLw69oxCaWdZXSKzpvQabkrnW8bMRA45TF6M7eRuXStk5tqRGfxfSQYi8Pq0O7XTl62X341Wu1fv1uwodBHgZ/s9XYRnzlhSmwOwhNJTHvbxB1WCOyq1+rVtdurL86i3as26+nQmh+hjTCuPRD2veZtpIzXJ7QQU2TArxAUACrbfuPCS9Vbg5tuQOhaNLb4GCnAa6RtKU5oMtdAg5AvXRoNFPgo9P59PqD6PJro5FzdMkz3JBLEQJEmqaC3KGeRayuZyXA9O2tNnjyhmDMLWAVbGZmeJ5SOlHKCMoNE3BcwhT7eO9hoKeRVK4Uw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(366004)(38100700002)(38350700002)(83380400001)(86362001)(26005)(6666004)(316002)(8676002)(4326008)(508600001)(52116002)(8936002)(186003)(36756003)(44832011)(6916009)(2616005)(6486002)(6512007)(2906002)(107886003)(6506007)(66476007)(66556008)(5660300002)(66946007)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EYr6iLIW2RMcvNIxZj31AgGjQUBnV96qpnBz77SCCWzjzu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eA7a4gKhGR9k0EZWb7VUim+lIlOZsvCwcEDoosaudF0zPEZv3B4ZLZzBNourxXZTJzOAR/vXJQyOZteGeFyOjBt7kcnOD0VC6CyeELth6yjGoJNglGvEhAsClElfDQFYCu/OcCsQIfqNzDvH5fpH3YXSOAiTVnirGCZ7Uyv42X1mlVRM5ZJIm8ajkjokzbzgPUIOHAYhauIaso3a0REe4E+YQzP1j1oe9XR9kIfeLbNr9QODWasWITSojziAnDt5u3mT5hu7m7Vz0kMX1gwzu6VJRDgPaKmO2r7ZSG6qJqAR60GXGx8EzDNoI5M7KV6c+Jz2AI5M6/4PaazF2TXZL6b8LZxpqEOmvpn2sP9Vaxnx28bh4F1LGuHMfJkzmLxzeM6QRn0UHQLpGOMybrYhxpEtcimapCrC2+uwVuTBrCCxUrDUoQQwjNMHl5vcZ9rjhwd0smEFc4U9SUuROnvWVINSrn8J0CQChuyr9/HTobFrp0EUjsYXuT2opQP5olrC5Vab+pdBuBiylSm2VCUwfFK+EqecZ7e5xFdfX89Ncum/ahKh/BeHV1jLZ1bdl6tZq37ZvqAM6j/4ODTDU= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0072bf79-c1ae-4ede-d6f1-08d9d227532c X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2022 21:47:39.1890 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nxqvCWyCLpM+fbIrHnvqgKTEj89g/ejrTKnKh+v7kz/qQ2QWVf3AbtGI/DW1zVIJiwsEAFxNeUmst2XN2INDR96gyIf+8TtydiYkE7X5TL4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB6275 X-Proofpoint-GUID: iDh8HMsnSoNGq4hkKGli3Sn0dSsPk4Z3 X-Proofpoint-ORIG-GUID: iDh8HMsnSoNGq4hkKGli3Sn0dSsPk4Z3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-07_10,2022-01-07_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=620 spamscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 priorityscore=1501 clxscore=1015 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201070129 Cc: kuninori.morimoto.gx@renesas.com, michal.simek@xilinx.com, maruthi.srinivas.bayyavarapu@xilinx.com, tiwai@suse.com, Robert Hancock , broonie@kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" An upcoming change will require storing additional driver data other than the memory base address. Create a drvdata structure and use that rather than storing the raw base address pointer. Signed-off-by: Robert Hancock --- sound/soc/xilinx/xlnx_i2s.c | 66 ++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/sound/soc/xilinx/xlnx_i2s.c b/sound/soc/xilinx/xlnx_i2s.c index cc641e582c82..3bafa34b789a 100644 --- a/sound/soc/xilinx/xlnx_i2s.c +++ b/sound/soc/xilinx/xlnx_i2s.c @@ -22,15 +22,20 @@ #define I2S_CH0_OFFSET 0x30 #define I2S_I2STIM_VALID_MASK GENMASK(7, 0) +struct xlnx_i2s_drv_data { + struct snd_soc_dai_driver dai_drv; + void __iomem *base; +}; + static int xlnx_i2s_set_sclkout_div(struct snd_soc_dai *cpu_dai, int div_id, int div) { - void __iomem *base = snd_soc_dai_get_drvdata(cpu_dai); + struct xlnx_i2s_drv_data *drv_data = snd_soc_dai_get_drvdata(cpu_dai); if (!div || (div & ~I2S_I2STIM_VALID_MASK)) return -EINVAL; - writel(div, base + I2S_I2STIM_OFFSET); + writel(div, drv_data->base + I2S_I2STIM_OFFSET); return 0; } @@ -40,13 +45,13 @@ static int xlnx_i2s_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *i2s_dai) { u32 reg_off, chan_id; - void __iomem *base = snd_soc_dai_get_drvdata(i2s_dai); + struct xlnx_i2s_drv_data *drv_data = snd_soc_dai_get_drvdata(i2s_dai); chan_id = params_channels(params) / 2; while (chan_id > 0) { reg_off = I2S_CH0_OFFSET + ((chan_id - 1) * 4); - writel(chan_id, base + reg_off); + writel(chan_id, drv_data->base + reg_off); chan_id--; } @@ -56,18 +61,18 @@ static int xlnx_i2s_hw_params(struct snd_pcm_substream *substream, static int xlnx_i2s_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *i2s_dai) { - void __iomem *base = snd_soc_dai_get_drvdata(i2s_dai); + struct xlnx_i2s_drv_data *drv_data = snd_soc_dai_get_drvdata(i2s_dai); switch (cmd) { case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - writel(1, base + I2S_CORE_CTRL_OFFSET); + writel(1, drv_data->base + I2S_CORE_CTRL_OFFSET); break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - writel(0, base + I2S_CORE_CTRL_OFFSET); + writel(0, drv_data->base + I2S_CORE_CTRL_OFFSET); break; default: return -EINVAL; @@ -95,20 +100,19 @@ MODULE_DEVICE_TABLE(of, xlnx_i2s_of_match); static int xlnx_i2s_probe(struct platform_device *pdev) { - void __iomem *base; - struct snd_soc_dai_driver *dai_drv; + struct xlnx_i2s_drv_data *drv_data; int ret; u32 ch, format, data_width; struct device *dev = &pdev->dev; struct device_node *node = dev->of_node; - dai_drv = devm_kzalloc(&pdev->dev, sizeof(*dai_drv), GFP_KERNEL); - if (!dai_drv) + drv_data = devm_kzalloc(&pdev->dev, sizeof(*drv_data), GFP_KERNEL); + if (!drv_data) return -ENOMEM; - base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(base)) - return PTR_ERR(base); + drv_data->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(drv_data->base)) + return PTR_ERR(drv_data->base); ret = of_property_read_u32(node, "xlnx,num-channels", &ch); if (ret < 0) { @@ -134,35 +138,35 @@ static int xlnx_i2s_probe(struct platform_device *pdev) } if (of_device_is_compatible(node, "xlnx,i2s-transmitter-1.0")) { - dai_drv->name = "xlnx_i2s_playback"; - dai_drv->playback.stream_name = "Playback"; - dai_drv->playback.formats = format; - dai_drv->playback.channels_min = ch; - dai_drv->playback.channels_max = ch; - dai_drv->playback.rates = SNDRV_PCM_RATE_8000_192000; - dai_drv->ops = &xlnx_i2s_dai_ops; + drv_data->dai_drv.name = "xlnx_i2s_playback"; + drv_data->dai_drv.playback.stream_name = "Playback"; + drv_data->dai_drv.playback.formats = format; + drv_data->dai_drv.playback.channels_min = ch; + drv_data->dai_drv.playback.channels_max = ch; + drv_data->dai_drv.playback.rates = SNDRV_PCM_RATE_8000_192000; + drv_data->dai_drv.ops = &xlnx_i2s_dai_ops; } else if (of_device_is_compatible(node, "xlnx,i2s-receiver-1.0")) { - dai_drv->name = "xlnx_i2s_capture"; - dai_drv->capture.stream_name = "Capture"; - dai_drv->capture.formats = format; - dai_drv->capture.channels_min = ch; - dai_drv->capture.channels_max = ch; - dai_drv->capture.rates = SNDRV_PCM_RATE_8000_192000; - dai_drv->ops = &xlnx_i2s_dai_ops; + drv_data->dai_drv.name = "xlnx_i2s_capture"; + drv_data->dai_drv.capture.stream_name = "Capture"; + drv_data->dai_drv.capture.formats = format; + drv_data->dai_drv.capture.channels_min = ch; + drv_data->dai_drv.capture.channels_max = ch; + drv_data->dai_drv.capture.rates = SNDRV_PCM_RATE_8000_192000; + drv_data->dai_drv.ops = &xlnx_i2s_dai_ops; } else { return -ENODEV; } - dev_set_drvdata(&pdev->dev, base); + dev_set_drvdata(&pdev->dev, drv_data); ret = devm_snd_soc_register_component(&pdev->dev, &xlnx_i2s_component, - dai_drv, 1); + &drv_data->dai_drv, 1); if (ret) { dev_err(&pdev->dev, "i2s component registration failed\n"); return ret; } - dev_info(&pdev->dev, "%s DAI registered\n", dai_drv->name); + dev_info(&pdev->dev, "%s DAI registered\n", drv_data->dai_drv.name); return ret; } From patchwork Fri Jan 7 21:47:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 530805 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B184C433F5 for ; Fri, 7 Jan 2022 21:50:34 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8A4491AC2; Fri, 7 Jan 2022 22:49:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8A4491AC2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1641592232; bh=DeXUnOG3se7RanTt7yDPQOVEbGLNMk6z6yThekqymrc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Fg9DrkSyzzRnT3QSE/RAhkbTE0fQqIUvgv2deMr5zhDr+4UDxOrNSV3VxZEVv6zU7 0tzsE5YP4hY/UcPWYc3QTT+tZLzt4OsVyiimt7f0FBnkKUKjjJHOMC00WikKk+Bg18 NPs1ITcp70Hd3DhlLw9nOE3XN31nEDlDZFubfFuA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4F1A6F80526; Fri, 7 Jan 2022 22:48:00 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1A5C3F8050F; Fri, 7 Jan 2022 22:47:53 +0100 (CET) Received: from mx0d-0054df01.pphosted.com (mx0d-0054df01.pphosted.com [67.231.150.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5D75DF8014B for ; Fri, 7 Jan 2022 22:47:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5D75DF8014B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=calian.com header.i=@calian.com header.b="OaD/7FTi" Received: from pps.filterd (m0209000.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 207LDg39021396; Fri, 7 Jan 2022 16:47:41 -0500 Received: from can01-qb1-obe.outbound.protection.outlook.com (mail-qb1can01lp2053.outbound.protection.outlook.com [104.47.60.53]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3de4vqgpyd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Jan 2022 16:47:41 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ivLuZy7PDbukztpHiNndmLfIfUhrjAuPKovVd/m+AHkhyYJ+NqOLMHrh0XZYHwwWq4dmukjx5NCGT5c/s6IOcahT4WeYqs7abxi3deA1qjy+XV1Fszbt3uFtpY4IX2tIEn/ptY0BImgvaFrQimZBXeumJsf626NWzEZthcLmsoTZ6Ql6NnNm8AVYjn9ylqaF3J/Epc4atUy1eEfwY2I3ejSSmvkW2jnIxH2Xs1Z08+LvC+78QxRXNIJZ1UUWYsNnuQsdRfAgut6nsLzS7nq8/jfxhYRZq+HAhOt128S6qx7EER9QJMctFB5ZorRS4KFd1WuQEBy/I4QOtd3UJ84ntQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Y+VYeQgNfAkaq5cWPQq7rK1TRYIGbNZAzXN4PRP/q2I=; b=dgPeB8nk0IIJU6SSDvl63Zx8UXT6o5eIrDE0HQuQFpdKyORSQO+PHOvP2zQ5CRf4QUh7iyP16V6qh5bssn79w3FYQlRv36S8SW5NhykJgs6Xc7TpRSHiiUwVA/OxeRKASyymJ6ttt0uIWNeiJBRK4fkQ9gVdX2c4KjW/eY1+67cR6FsLZ4PtsJClSLnQO1BG5KukMjJ3Wa22KcYDk7zSWCvFWYKyoRBN26ODnb2AHRbhbe7Hu9Q7V3fhSqp9YI16rqRlOODCBPi1ARPknoH0UlUzyxId6zOyx6rO/1Ek5/vEvw1O93D5FlXCESmwqBML6hXTvFcIRg3Z1BSskqg//g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Y+VYeQgNfAkaq5cWPQq7rK1TRYIGbNZAzXN4PRP/q2I=; b=OaD/7FTilnt/ZX8D1Aedl0n+ual6gFJrWZsD5K6lTHdtfGiNKCXZX8K/piKkr0zJIeZghWPTVb3OD+mrzOgGJUen79+iXlaK1jYUZbFjvfSPoFl8/7SBZBL/vED9jQC/mrme3N5Xya/Dyc5Ad+u66EdcaRdoG4jknZpfOTQZBhg= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB6275.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.15; Fri, 7 Jan 2022 21:47:40 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76%5]) with mapi id 15.20.4844.016; Fri, 7 Jan 2022 21:47:40 +0000 From: Robert Hancock To: alsa-devel@alsa-project.org Subject: [PATCH v2 4/6] ASoC: xilinx: xlnx_i2s: Handle sysclk setting Date: Fri, 7 Jan 2022 15:47:09 -0600 Message-Id: <20220107214711.1100162-5-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220107214711.1100162-1-robert.hancock@calian.com> References: <20220107214711.1100162-1-robert.hancock@calian.com> X-ClientProxiedBy: CO2PR04CA0136.namprd04.prod.outlook.com (2603:10b6:104::14) To YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b2c20826-a940-4a31-9ece-08d9d22753df X-MS-TrafficTypeDiagnostic: YT3PR01MB6275:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 82b24kA4xzw/T8jas8EMjPQx7h+ZIgcy3ax9GciCGveOG4hufxezfX38EHtvPUF8H+U6GeqpwkEjjCRTEbcqEnv+jkTXzhl5luxXZTlH7h5sYXb/zId32oU22DwgrvXWOsNmRycztw1oMQK6Z1tY4x0Nc5I3HAcB+1DpHHfvO8sj/lKHFQ7IZ6nnISA3W2R+M+zFaqfNVr7+4fH4zZe66u7YKoBlqhFOVtWI3EVrl+CbwfN7kTgf/8lI429lRUW+nmlP5jK3E0Ntspz3qdn0mOl22tDSQGGqkeT5J4IHXCjAvNQH/7cQw3M3W1BokWWx9ZvfYivb6HJkFKS04K3x8esXmNaaH9ApLmBtyctCOTcGMGKrYDGdq9tbFfsd4FzeZC2Wok7yTKsLbqSTy4N5k21P4KwoXtEV3hgbvcOGSuHAcnSj0mwR+drWpBEqoVqEJFFSh2ix4wwrQzZiD3jRO/X1xHeZefN5ukNRtndFKVuKo+zmb7QlB0hF16jWLd64R3dNVj0tTJnovZhm0eyO25QJa9cRQXvMasqp7HTJO1eDzv2udAcVjLeDYp5KhMTQkRkNTJVaphQqssBkGi7vchcmCGQVI9l/mIHEFre96o9puElbyMjQnEq9A3q9OVG1/BumZ5tvY6g8jmdREVriJj/C2Zz4HXZrKPXQJINsoi610i9jOsoFPowbKu+K0HxIfHMazsqUHjxaFhVGJBm3ig== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(366004)(38100700002)(38350700002)(83380400001)(86362001)(26005)(6666004)(316002)(8676002)(4326008)(508600001)(52116002)(8936002)(186003)(36756003)(44832011)(6916009)(2616005)(6486002)(6512007)(2906002)(107886003)(6506007)(66476007)(66556008)(5660300002)(66946007)(1076003); DIR:OUT; SFP:1101;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DJys+nvJAr/41m5O69y3PCqUJmCG8dkiMWFPEsIH6JU59RLvuPGiidnF0d49aRc+NdA7PXC9boJEn/7UcbGJryUW5GsE54d4R6MJ8Kyloj6213o9Kle93ijadHr/6zKhz+m9Qt9WtuuGeoDHZ+RpQn3Ffst4V/ykm5/3TERkuDgT8octeTEp7yUJn8DQ7xNaLuKr30AXva+Iwc5cG6VgCUHFYNNUvaGgZij7ZdWyuoFFjA4mk0H7hl3hozExiMRDUsd1k3ycOc83iYCs8NNgJ5MOBZrnL3l+dnaoCMwB4HR4aOvYzgigwvgcur9u6ZiIwUq2e/agMdCn5vLqpzuC0BXEuRnFZbBO1th9aT1Q0mFKIVt9qBy4UVytvz5Vay766jR15BQoEaqixdLrd2jJuXwq2ZrL3qCqMZkWKdF2x1Iu2c+XUTw4rZFSnMAwutFxfpG7U6DA/Av6UHrjLsAEvG4eIXyXtqjF4wJU+p/tAs4pu7ajiYN85EakRQcVQ9cXx5GjIjnoTj+z9mpYdeKrG+SmtiOO1wI6Nh8vF8Q+7dz8gFS1BHhyg8rxCKVSQ59emQg0jS13tNfTI29zmaIKGqtmuXM2c80VYOokHEgfWJy0IC/5Wkwv3t6KhwXuLBj0Xj2t1RDk2zCLtSV03yRHmj7U4fsJ4a+b//GNbVXf8R5fNEUvAQK4SUHgptNGsgaLAA= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: b2c20826-a940-4a31-9ece-08d9d22753df X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2022 21:47:40.3294 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6sXklxRHt53y79WHwP5JgbNToDGi43EABcmtRfxSseU/qw4Nl4ibfviw7OTplGWSvwnz0dvkzQ6njQtoo6dAqejw9/aPm1o3xB3IswG+Dt0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB6275 X-Proofpoint-GUID: CyQoy6dfd2j1NUUQYtTgYSGgx-B6Mswn X-Proofpoint-ORIG-GUID: CyQoy6dfd2j1NUUQYtTgYSGgx-B6Mswn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-07_10,2022-01-07_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=740 spamscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 priorityscore=1501 clxscore=1015 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201070129 Cc: kuninori.morimoto.gx@renesas.com, michal.simek@xilinx.com, maruthi.srinivas.bayyavarapu@xilinx.com, tiwai@suse.com, Robert Hancock , broonie@kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This driver previously only handled the set_clkdiv divider callback when setting the SCLK Out Divider field in the I2S Timing Control register. However, when using the simple-audio-card driver, the set_sysclk function is called but not set_clkdiv. This caused the divider not to be set, leaving it at an invalid value of 0 and resulting in a very low SCLK output rate. Handle set_clkdiv and store the sysclk (MCLK) value for later use in hw_params to set the SCLK Out Divider such that: MCLK/SCLK = divider * 2 Signed-off-by: Robert Hancock --- sound/soc/xilinx/xlnx_i2s.c | 91 +++++++++++++++++++++++++++++++++---- 1 file changed, 81 insertions(+), 10 deletions(-) diff --git a/sound/soc/xilinx/xlnx_i2s.c b/sound/soc/xilinx/xlnx_i2s.c index 3bafa34b789a..4cc6ee7c81a3 100644 --- a/sound/soc/xilinx/xlnx_i2s.c +++ b/sound/soc/xilinx/xlnx_i2s.c @@ -18,6 +18,8 @@ #define DRV_NAME "xlnx_i2s" #define I2S_CORE_CTRL_OFFSET 0x08 +#define I2S_CORE_CTRL_32BIT_LRCLK BIT(3) +#define I2S_CORE_CTRL_ENABLE BIT(0) #define I2S_I2STIM_OFFSET 0x20 #define I2S_CH0_OFFSET 0x30 #define I2S_I2STIM_VALID_MASK GENMASK(7, 0) @@ -25,6 +27,12 @@ struct xlnx_i2s_drv_data { struct snd_soc_dai_driver dai_drv; void __iomem *base; + unsigned int sysclk; + u32 data_width; + u32 channels; + bool is_32bit_lrclk; + struct snd_ratnum ratnum; + struct snd_pcm_hw_constraint_ratnums rate_constraints; }; static int xlnx_i2s_set_sclkout_div(struct snd_soc_dai *cpu_dai, @@ -35,11 +43,50 @@ static int xlnx_i2s_set_sclkout_div(struct snd_soc_dai *cpu_dai, if (!div || (div & ~I2S_I2STIM_VALID_MASK)) return -EINVAL; + drv_data->sysclk = 0; + writel(div, drv_data->base + I2S_I2STIM_OFFSET); return 0; } +static int xlnx_i2s_set_sysclk(struct snd_soc_dai *dai, + int clk_id, unsigned int freq, int dir) +{ + struct xlnx_i2s_drv_data *drv_data = snd_soc_dai_get_drvdata(dai); + + drv_data->sysclk = freq; + if (freq) { + unsigned int bits_per_sample; + + if (drv_data->is_32bit_lrclk) + bits_per_sample = 32; + else + bits_per_sample = drv_data->data_width; + + drv_data->ratnum.num = freq / (bits_per_sample * drv_data->channels) / 2; + drv_data->ratnum.den_step = 1; + drv_data->ratnum.den_min = 1; + drv_data->ratnum.den_max = 255; + drv_data->rate_constraints.rats = &drv_data->ratnum; + drv_data->rate_constraints.nrats = 1; + } + return 0; +} + +static int xlnx_i2s_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct xlnx_i2s_drv_data *drv_data = snd_soc_dai_get_drvdata(dai); + + if (drv_data->sysclk) + return snd_pcm_hw_constraint_ratnums(substream->runtime, 0, + SNDRV_PCM_HW_PARAM_RATE, + &drv_data->rate_constraints); + + return 0; +} + static int xlnx_i2s_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *i2s_dai) @@ -47,6 +94,26 @@ static int xlnx_i2s_hw_params(struct snd_pcm_substream *substream, u32 reg_off, chan_id; struct xlnx_i2s_drv_data *drv_data = snd_soc_dai_get_drvdata(i2s_dai); + if (drv_data->sysclk) { + unsigned int bits_per_sample, sclk, sclk_div; + + if (drv_data->is_32bit_lrclk) + bits_per_sample = 32; + else + bits_per_sample = drv_data->data_width; + + sclk = params_rate(params) * bits_per_sample * params_channels(params); + sclk_div = drv_data->sysclk / sclk / 2; + + if ((drv_data->sysclk % sclk != 0) || + !sclk_div || (sclk_div & ~I2S_I2STIM_VALID_MASK)) { + dev_warn(i2s_dai->dev, "invalid SCLK divisor for sysclk %u and sclk %u\n", + drv_data->sysclk, sclk); + return -EINVAL; + } + writel(sclk_div, drv_data->base + I2S_I2STIM_OFFSET); + } + chan_id = params_channels(params) / 2; while (chan_id > 0) { @@ -67,7 +134,7 @@ static int xlnx_i2s_trigger(struct snd_pcm_substream *substream, int cmd, case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - writel(1, drv_data->base + I2S_CORE_CTRL_OFFSET); + writel(I2S_CORE_CTRL_ENABLE, drv_data->base + I2S_CORE_CTRL_OFFSET); break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: @@ -83,7 +150,9 @@ static int xlnx_i2s_trigger(struct snd_pcm_substream *substream, int cmd, static const struct snd_soc_dai_ops xlnx_i2s_dai_ops = { .trigger = xlnx_i2s_trigger, + .set_sysclk = xlnx_i2s_set_sysclk, .set_clkdiv = xlnx_i2s_set_sclkout_div, + .startup = xlnx_i2s_startup, .hw_params = xlnx_i2s_hw_params }; @@ -102,7 +171,7 @@ static int xlnx_i2s_probe(struct platform_device *pdev) { struct xlnx_i2s_drv_data *drv_data; int ret; - u32 ch, format, data_width; + u32 format; struct device *dev = &pdev->dev; struct device_node *node = dev->of_node; @@ -114,19 +183,19 @@ static int xlnx_i2s_probe(struct platform_device *pdev) if (IS_ERR(drv_data->base)) return PTR_ERR(drv_data->base); - ret = of_property_read_u32(node, "xlnx,num-channels", &ch); + ret = of_property_read_u32(node, "xlnx,num-channels", &drv_data->channels); if (ret < 0) { dev_err(dev, "cannot get supported channels\n"); return ret; } - ch = ch * 2; + drv_data->channels *= 2; - ret = of_property_read_u32(node, "xlnx,dwidth", &data_width); + ret = of_property_read_u32(node, "xlnx,dwidth", &drv_data->data_width); if (ret < 0) { dev_err(dev, "cannot get data width\n"); return ret; } - switch (data_width) { + switch (drv_data->data_width) { case 16: format = SNDRV_PCM_FMTBIT_S16_LE; break; @@ -141,21 +210,23 @@ static int xlnx_i2s_probe(struct platform_device *pdev) drv_data->dai_drv.name = "xlnx_i2s_playback"; drv_data->dai_drv.playback.stream_name = "Playback"; drv_data->dai_drv.playback.formats = format; - drv_data->dai_drv.playback.channels_min = ch; - drv_data->dai_drv.playback.channels_max = ch; + drv_data->dai_drv.playback.channels_min = drv_data->channels; + drv_data->dai_drv.playback.channels_max = drv_data->channels; drv_data->dai_drv.playback.rates = SNDRV_PCM_RATE_8000_192000; drv_data->dai_drv.ops = &xlnx_i2s_dai_ops; } else if (of_device_is_compatible(node, "xlnx,i2s-receiver-1.0")) { drv_data->dai_drv.name = "xlnx_i2s_capture"; drv_data->dai_drv.capture.stream_name = "Capture"; drv_data->dai_drv.capture.formats = format; - drv_data->dai_drv.capture.channels_min = ch; - drv_data->dai_drv.capture.channels_max = ch; + drv_data->dai_drv.capture.channels_min = drv_data->channels; + drv_data->dai_drv.capture.channels_max = drv_data->channels; drv_data->dai_drv.capture.rates = SNDRV_PCM_RATE_8000_192000; drv_data->dai_drv.ops = &xlnx_i2s_dai_ops; } else { return -ENODEV; } + drv_data->is_32bit_lrclk = readl(drv_data->base + I2S_CORE_CTRL_OFFSET) & + I2S_CORE_CTRL_32BIT_LRCLK; dev_set_drvdata(&pdev->dev, drv_data); From patchwork Fri Jan 7 21:47:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 530516 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E77AC433F5 for ; Fri, 7 Jan 2022 21:50:18 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1E93D1AB3; Fri, 7 Jan 2022 22:49:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1E93D1AB3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1641592216; bh=VuysXKQNQwOg2Qd96xuEZ8FMQH8DuBNmmgaldm7Lp7k=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=AR2HBotezi1JwSPajQXXFuC92TPbbQpEIJbi+wOuqSvXqhC/9vae94iLTBmI6FAfm wC3L/aDCiuF1/yMurkL7pPuLQVkEa1W+3Dgvt57ie5sMxgLSA4u/DYSNbFJZdkbNkV tnphwFHFMX/RbVAOtp1QalGwinGFMLUxULDZyVkg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 60CD3F8051D; Fri, 7 Jan 2022 22:47:58 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E24E0F80511; Fri, 7 Jan 2022 22:47:51 +0100 (CET) Received: from mx0d-0054df01.pphosted.com (mx0d-0054df01.pphosted.com [67.231.150.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 46C47F80082 for ; Fri, 7 Jan 2022 22:47:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 46C47F80082 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=calian.com header.i=@calian.com header.b="4IFUN31k" Received: from pps.filterd (m0209000.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 207LEDca023805; Fri, 7 Jan 2022 16:47:42 -0500 Received: from can01-qb1-obe.outbound.protection.outlook.com (mail-qb1can01lp2056.outbound.protection.outlook.com [104.47.60.56]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3de4vqgpye-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Jan 2022 16:47:42 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oSRUY6rJaMrbrmeOs59rALU+nzHl0z+62fe1BI1qQKWjNAugUxXTdvz0u8lFDlLongHmCb107kVe2rJNfdA62OCIzus9q7xYlOtmLtpZXkdH9Df1l7X84E6f/uShbr1O3fLFNENeYDLb+877NnfOPjrU5Hh/ROU2zOxfEzSwpbO8MMcxdedXfc8ZV0agL16eJ/03NNx08uSzCMmZnigNggBQlRMKK0sNGEw4Pq/pL1B3KAXpFCBffEnMwKutK19PApgBRm8TVuA8sJ7opU0hnpexYKGVQjJM0x5KeiUj4OIOSWLSEVs58Nq1nSvCSViPearN3kvTACeT9lAHRktoCA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ssLWqb+N4hYZWFUJSYIdc2q982jDapCqANYNkNsF37g=; b=HF6Stdf0/ZDJJ/YISURHxPQoAQh0lydT7yrl8yL/zWERSAii9OxQmUDtRBSuxk+5OcN7PeqqJfaVl6TMTz/SM3yTWnTn+X/WumigGyjC/n71wwMZ337HV82pEipWTPjgR596tdKsPNWWCZ+iVD5nno5wS++/ypkYCvQF+XAsv6lCL8aCmqYDlyAeqgBeLLGoChuTmIIaKBZ3jfZF3dEbgQnnPDIY+amxpcNsawQ86fxhHM/L1M1VydxZduwru1MnFKS2zvpfOAPp5ZR2ksikaOgFU7TAsuNmzoUexW71xC2AGIx/+z7NYVkKfyIcT9BOYxyhjMSXEwTFa757EqZpeQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ssLWqb+N4hYZWFUJSYIdc2q982jDapCqANYNkNsF37g=; b=4IFUN31kfWej0tmwCqRnhgAWaDWz3MNHaWUfQuagDXayljHIRUXiFE7hKotkIDGydoKAcUAwfX4hhM/gabrrVGbSTOTr6a9ft+RdewUt6xtQnBjy6rCL13RSIjioiaMWeIRcOR3+0/CTAEyB8I5nAhZ3zQ/8lbrQTJQzkr4pEm4= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB6275.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.15; Fri, 7 Jan 2022 21:47:41 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76%5]) with mapi id 15.20.4844.016; Fri, 7 Jan 2022 21:47:41 +0000 From: Robert Hancock To: alsa-devel@alsa-project.org Subject: [PATCH v2 5/6] ASoC: simple-card: fix probe failure on platform component Date: Fri, 7 Jan 2022 15:47:10 -0600 Message-Id: <20220107214711.1100162-6-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220107214711.1100162-1-robert.hancock@calian.com> References: <20220107214711.1100162-1-robert.hancock@calian.com> X-ClientProxiedBy: CO2PR04CA0136.namprd04.prod.outlook.com (2603:10b6:104::14) To YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 70dd0e8e-6d71-4633-1591-08d9d2275489 X-MS-TrafficTypeDiagnostic: YT3PR01MB6275:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fjfXBvu9x7MDTTDOR4EvPgXZwQQ2Fqs4KfT8LOQBfezC6LoOId663b7mKWT6W6776+H/29UhitsXyEPVkK4oZEYLtVCHY68lw4fYRjmtERYA+uEcud+1lBVFol5a5twRpzZYPgS/DcvLMK+taf4L3uX/srklwma69/62LmL+hqoFbPhd3ovrjmwhsLIhR7H/QokGB1P4VMf8HRIy+un1TDpmXiXbittbCzZjqxAXg7mDGs4uqMMsbqJltikXTEh3+UCgTW/3Pw6DNOJBxVJop+vu3wT7RnfOAIOmIWfa+r4C7Gu2e5mE6owLbGYCyJMxQWzQdN0MfgJKfIMGj+mchE51BFGsdnX0ccqorXrMvIh/jaFYSyQAUglowhoFOCsFkdGhXs0hWyw9oTuCxpg0uWdcm9ias4yi2E+Vq3SYMVGmbeu++pN7MtXFUF32AAm1w3/WKSZYzvtUUlzG9jfeyDJiAJsSIsh0R6fh4wrDmUUK71te0QKG17Hb3/99gCf+ZKGMnPpDhATyc6G8BIjllX2In+9B/Mw8YUa57KzeUoqZ2x+lkptz0w8Tluo2cNjTVjp7xw/eqNZppvSB4xSkXDxskHmlFd56Qq1/pIngPMMZ+4YLXZiAFP5L3B52+9Ha3qJ3flSbM3tJejU3+u3MgFuGy0i4ZgKCrtZ90YU0JjnteOYSmJRKi2KjGqd8x8pU3taOuh4UzyAhy/Y9bBeYI6UWPDGoh1ZHbdYZ9IPs2FM= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(366004)(38100700002)(38350700002)(83380400001)(86362001)(26005)(6666004)(316002)(8676002)(4326008)(508600001)(52116002)(8936002)(186003)(36756003)(44832011)(6916009)(2616005)(6486002)(6512007)(2906002)(107886003)(6506007)(66476007)(66556008)(5660300002)(66946007)(1076003)(21314003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: n5085O1l/zizuRO77DMv46hQz72BUbeQ8lsoXNNxRctZXfc0mx45trSZhaOkQii2NYnoe68NakT94I42EKUrbSaMKgSdeSVF0KOzkLQ3YS6oorvyEjO1Hi4oTcei8KufxkEhePKEeTQnFXoEPLMpRqrBWHItyrWrxvw2Eyr04+sC6DKbJqBlizW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vIOEFuO/zKVcLXDsy3xnIGiF5GZM0MkEu4t7JZHMRApcciTWFQcKmkf009cY3rzo+QvhVNWDe2Rthrw6Y8uppvNLPCppaHk7C7aJjiB1pDH64YOnovi8RNzLExkniqil+Wgw3KL5bkFF3QfojAVohuZYPOQ1VdvvP2d4q4ZKDvI+oD2zMu6Qx9PfUR5wtuWSd9PEG0Cp1tOndzSZ0dxaWT//sS/6oQDwpDmaAyUnYxdsKiZMmpVlWUULOzeGUn+da74obup7XiKrCJVKF4aRCwbc6rNAyu0VpYyx1EaipxiGUdlVvom+HvDNENpB+sIjHLCVEAAC+/4CwGRVFcWigKXOtz16rCPLuwr29DMV4rsd3hihP1rbgkZ8kxlQkI6mQoR7dXwEvGqwpN7XeMi/mYsLnFLzDanmMBMGuism6+7lZluTzbAmMYGaqM= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 70dd0e8e-6d71-4633-1591-08d9d2275489 X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2022 21:47:41.4556 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: meKIKZRhn7kcwstqEqd3Zk1cEmgy3SZuvCXP+tIg1SoSfBwu983ZPlzYD1iRNMjsFAVeC85sfYhbt6NEXAsnw7tdugclooLqg1rAO6uDrdU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB6275 X-Proofpoint-GUID: 9GAXaHe1hwcrcTP-j19oScS-EevB3iSm X-Proofpoint-ORIG-GUID: 9GAXaHe1hwcrcTP-j19oScS-EevB3iSm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-07_10,2022-01-07_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 priorityscore=1501 clxscore=1015 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201070129 Cc: kuninori.morimoto.gx@renesas.com, michal.simek@xilinx.com, maruthi.srinivas.bayyavarapu@xilinx.com, tiwai@suse.com, Robert Hancock , broonie@kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" A previous change to simple-card resulted in asoc_simple_parse_dai attempting to retrieve the dai_name for platform components, which are unlikely to have a valid DAI name. This caused simple-card to fail to probe when using the xlnx_formatter_pcm as the platform component, since it does not register any DAI components. Since the dai_name is not used for platform components, just skip trying to retrieve it for those. Fixes: f107294c6422 ("ASoC: simple-card: support snd_soc_dai_link_component style for cpu") Signed-off-by: Robert Hancock --- sound/soc/generic/simple-card.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index a89d1cfdda32..78419e18717d 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -28,6 +28,30 @@ static const struct snd_soc_ops simple_ops = { .hw_params = asoc_simple_hw_params, }; +static int asoc_simple_parse_platform(struct device_node *node, + struct snd_soc_dai_link_component *dlc) +{ + struct of_phandle_args args; + int ret; + + if (!node) + return 0; + + /* + * Get node via "sound-dai = <&phandle port>" + * it will be used as xxx_of_node on soc_bind_dai_link() + */ + ret = of_parse_phandle_with_args(node, DAI, CELL, 0, &args); + if (ret) + return ret; + + /* dai_name is not required and may not exist for plat component */ + + dlc->of_node = args.np; + + return 0; +} + static int asoc_simple_parse_dai(struct device_node *node, struct snd_soc_dai_link_component *dlc, int *is_single_link) @@ -289,7 +313,7 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv, if (ret < 0) goto dai_link_of_err; - ret = asoc_simple_parse_dai(plat, platforms, NULL); + ret = asoc_simple_parse_platform(plat, platforms); if (ret < 0) goto dai_link_of_err; From patchwork Fri Jan 7 21:47:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 530517 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA132C433F5 for ; Fri, 7 Jan 2022 21:49:43 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0A6721A6C; Fri, 7 Jan 2022 22:48:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0A6721A6C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1641592182; bh=KjDCSVtlTNBcdEi69GwiB+0EnHgkFFjlj/KszgRw31Q=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rYFt9IaMcmqaucnN2OreMrrnjjWBxkquFzHPEs72A1TYX8PDNnHxfzN67K3M1UIn6 zfDDWySDClWr+YbdZ6ocM3ax7KCUB0hZATMM1Lr8R0AkXHvyQ40csVdNJMPMKii+ba wZRt/AUrLVePJMoHVj8SrO70MAxH+0RcfZzF/UA0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5DF64F8051A; Fri, 7 Jan 2022 22:47:56 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 89DB8F80507; Fri, 7 Jan 2022 22:47:49 +0100 (CET) Received: from mx0d-0054df01.pphosted.com (mx0d-0054df01.pphosted.com [67.231.150.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 16A0FF800AE for ; Fri, 7 Jan 2022 22:47:45 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 16A0FF800AE Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=calian.com header.i=@calian.com header.b="mNczhrpo" Received: from pps.filterd (m0209000.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 207LPGa3026852; Fri, 7 Jan 2022 16:47:44 -0500 Received: from can01-qb1-obe.outbound.protection.outlook.com (mail-qb1can01lp2053.outbound.protection.outlook.com [104.47.60.53]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3de4vqgpyg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Jan 2022 16:47:43 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jVN8N/ilbSzuh4dLwwi5uVaVheZ9dBFyYcECAljPffr/Q+Su59E+I4sQ783j1EU5ecTzjWoxEr5yJNGPYXrNdKZ8OdnHJZVq00rJn9o8n/98Fp5Te/7URF+Pc80GKbM3lzYksfh0pawpcm76YeRZoCWmVOYOCrcip0UnGFtRJrJ1ZbQnR5uvsuqmAD4hqxYV2FIN0Mtez0ILu92bU2LpevxaeW9nxq6IkTghrYEiSlZUUq/dSwGbEMaZM7p6QO2nTlMJKRxvmgtnXckaLmNmJjSTIypaZKZEZE+v+Uj1Qp2WVa4Nt5jx2QOUD1NTxvAZ2QhImZ2IgORQxpuZ5dXDDQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=i97jDy7mOdm7uwmcVa3etIad5sFBYKEF8w0XoNnqOmg=; b=mmixUfOowHVX1in895ZZLnXjL3Mlu+XXtSU5t5nwEEpepTdxQjXxot3hR+Vv3zsfGKHzc1BYH5svJG4tejFwdyIEekzJZIkCYveHFkQBw+Bs9lgl4otjYd3s7DM3rYX5dVSD8pkDwGpU226peNF7edPzGwT6MzXpkessRNqnRsoyhrv98PN2IUVw6TfxNTTPGfWXFL5gdAaET9zBlD2S1LM+aglQXI5fuwOeBfb4dtlocM50U3J+7qxQ2+fZobtanQI90U0ZWaOG1ipqcfiLHDnnaFMQqn8Qdlcn/TjZ6STZsfDhkxcgvli4L6eIhy/zLItN4PX1cm8wTQ3zmr+kug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i97jDy7mOdm7uwmcVa3etIad5sFBYKEF8w0XoNnqOmg=; b=mNczhrpovitS++CWqGXIHgMTMku3ZkktpBlY6M3dtt5nuN/NxbxRrjLcdxSE4K1dcU9XqjDAJqwDbPmZc0yqrKNPlXKSnnQVt+RlPBZiZ68ffyH74ohS1dXlBJORbEJDopNpbMqo+hK1qQ/EpCm6gYfUL3et8GzHXpZLm9YbEYs= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB6275.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.15; Fri, 7 Jan 2022 21:47:42 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76%5]) with mapi id 15.20.4844.016; Fri, 7 Jan 2022 21:47:42 +0000 From: Robert Hancock To: alsa-devel@alsa-project.org Subject: [PATCH v2 6/6] ASoC: simple-card-utils: Set sysclk on all components Date: Fri, 7 Jan 2022 15:47:11 -0600 Message-Id: <20220107214711.1100162-7-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220107214711.1100162-1-robert.hancock@calian.com> References: <20220107214711.1100162-1-robert.hancock@calian.com> X-ClientProxiedBy: CO2PR04CA0136.namprd04.prod.outlook.com (2603:10b6:104::14) To YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5d9c60ab-fe8a-45db-2467-08d9d227553b X-MS-TrafficTypeDiagnostic: YT3PR01MB6275:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m7TO68r2e/7D0DeG58BmuhA9dPBq8adq94VcXkyGJP9XXoS0qACsdPTilwwRK7m0LCRN1QbsMJpskNdmE7ONxlHpCkSNA2qhWsA35/ofUXUY5fZrkkxoDZVfRxRd0NhObfT1M26WlIlZUjQMS2D3q/hjrQuDbac91BNC7wd7aqHa+BwAEHSuL1WIkL02nKn2RptA0v8UmiqmliyAVFQ/EaDHQv4ppGLcupaHWFAshW6HxXZyceTdvbY4hiCKOn8BqkQcUU6AQ7jCcrg1GAnB0w1dr+AD+xKEpBLBtJiwCBZlAg81w//zjr/EOKj6OLUKrzzv6QUC8Y1uWc0j1zO9vt/P9N/QorjfKq6Fp+ahVLH0K6gJAPeujlPQ6rBWqzFJ+b9Il4aE1w7YQjvLPK0RnOAciRzq8dhvzR9wYfOF1dScMQS0iuN6J0zCtkJWQI2WaMohQ46a27kIl1oUkbM/rM1NZTUmvwvaiuqaKo1owjqy7ms2iI+7vD9iS/NPApHCTJWPBKZ9CEKTSx2MXb3EEoMM1UhBlNAiKUfW8SMjtC/P3klwCEz93GslDu9ZTJD7Ixcps4TI/+rCqW4eA/yZAcyNGlKCCa6Om14HR3lv964zykr4IXh7mjv5pTBgTMt5A4mBV0ZdFSD5YD7lsfWRMcZQLGGZVqnjo3P4tXYAXA0AEkmIPY4hAenvJf871KP3v2fb6wZZxHS+0p1vQEizaA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(366004)(38100700002)(38350700002)(83380400001)(86362001)(26005)(6666004)(316002)(8676002)(4326008)(508600001)(52116002)(8936002)(186003)(36756003)(44832011)(6916009)(2616005)(6486002)(6512007)(2906002)(107886003)(6506007)(66476007)(66556008)(5660300002)(66946007)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: x0zb+mgko2mYPK0zL05XwR4AM3mx7BBuu4Qvn5nCZDjJux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Zd6yqoIOPVnr1SaFBXGtau/yvEaBexls+PhSrjuIoIlY/y2euaBPjpAgDmYFgFCFhyK9E1MRFJY/YtCbAv2o3x5Xz/kQzGcTxZldMZUmdszqKHpvfFmFVfHwtwLvnbdhGcYrV+voZKY2kZdpKkTNWKl4K3OXXqv+ef9vh3vnxkMkU7MiJiEG/cmb6X73dip+Jd/YS0SybqIl2zXkEA6iMOuig5bBGxlmyKOhCnMUkVgC8I7RzoQdM5mU9bJFOzVhPAPj996RJNxokJUYfm8evQvo+gkcEB7CSWFS+sugE5IvPZKzGbQ8KZ2qbY19M5P8bfuKKSP7fLd8TkptEVHOHCFDuqcfIKtqh5N+jLljn6ggVINMPGmvtEnLFZGxbNIwOSo3SHEr4K8gK8H1aQDrMFw7JaPSlWWv8iJjUbKSVCjmtRmNvYf38A8Jsm+39gvc8Os3LUp4CS2OF/5Ok5KlDGy5oj/FP5hCgplD8vFV7H3dJJGTGUpYyPuUy1KZDP/1ocmj6PViKPRF707TgdIPzdwAERSlNIPh/UM6YbvBzRHUUsYLt1p/hwI= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d9c60ab-fe8a-45db-2467-08d9d227553b X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2022 21:47:42.6069 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Vya7eZgG/Xm2JeU0VS9JG8/qu3jLSXfKQ4ruL82/zxp9oQ+jPJxBEdro/pBypMgCEUROh2yIgzNfsVRdYrrpjQHS5tfGxovAJFRXDkyyQyE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB6275 X-Proofpoint-GUID: -5v6lCNlvQ9dQFbuOCBcs2e_lL7DOPlc X-Proofpoint-ORIG-GUID: -5v6lCNlvQ9dQFbuOCBcs2e_lL7DOPlc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-07_10,2022-01-07_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=901 spamscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 priorityscore=1501 clxscore=1015 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201070129 Cc: kuninori.morimoto.gx@renesas.com, michal.simek@xilinx.com, maruthi.srinivas.bayyavarapu@xilinx.com, tiwai@suse.com, Robert Hancock , broonie@kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" If an mclk-fs value was provided in the device tree configuration, the calculated MCLK was fed into the downstream codec DAI and CPU DAI, however set_sysclk was not being called on the platform device. Some platform devices such as the Xilinx Audio Formatter need to know the MCLK as well. Call snd_soc_component_set_sysclk on each component in the stream to set the proper sysclk value in addition to the existing call of snd_soc_dai_set_sysclk on the codec DAI and CPU DAI. This may end up resulting in redundant calls if one of the snd_soc_dai_set_sysclk calls ends up calling snd_soc_component_set_sysclk itself, but that isn't expected to cause any significant harm. Fixes: f48dcbb6d47d ("ASoC: simple-card-utils: share asoc_simple_hw_param()") Signed-off-by: Robert Hancock --- sound/soc/generic/simple-card-utils.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index a81323d1691d..9736102e6808 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -275,6 +275,7 @@ int asoc_simple_hw_params(struct snd_pcm_substream *substream, mclk_fs = props->mclk_fs; if (mclk_fs) { + struct snd_soc_component *component; mclk = params_rate(params) * mclk_fs; for_each_prop_dai_codec(props, i, pdai) { @@ -282,16 +283,30 @@ int asoc_simple_hw_params(struct snd_pcm_substream *substream, if (ret < 0) return ret; } + for_each_prop_dai_cpu(props, i, pdai) { ret = asoc_simple_set_clk_rate(pdai, mclk); if (ret < 0) return ret; } + + /* Ensure sysclk is set on all components in case any + * (such as platform components) are missed by calls to + * snd_soc_dai_set_sysclk. + */ + for_each_rtd_components(rtd, i, component) { + ret = snd_soc_component_set_sysclk(component, 0, 0, + mclk, SND_SOC_CLOCK_IN); + if (ret && ret != -ENOTSUPP) + return ret; + } + for_each_rtd_codec_dais(rtd, i, sdai) { ret = snd_soc_dai_set_sysclk(sdai, 0, mclk, SND_SOC_CLOCK_IN); if (ret && ret != -ENOTSUPP) return ret; } + for_each_rtd_cpu_dais(rtd, i, sdai) { ret = snd_soc_dai_set_sysclk(sdai, 0, mclk, SND_SOC_CLOCK_OUT); if (ret && ret != -ENOTSUPP)