From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3FF5B3B8948 for ; Fri, 7 Aug 2026 22:56:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786143420; cv=none; b=LeLVyXIWmHXQSviU0G+utdB99k3t8zRLprrGpVV/SPrlK8ndk779+mxd7gwvw05FDwF7XEGAMCStttAVbiHyWvty8PWOW6MtYM322pdTwww7dO3pJdyk6QxHRuJMMdoonN2PdcVBadj+Ciy+kL+eIyh5IlkkagBO9++aEXLOo7Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786143420; c=relaxed/simple; bh=kWDE/FTDl6sqiYTfUg6YnEwEYtS9ZEf+xZ375s7184Q=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QLVDA0VlSvTcmAGwDA1ZBCOwFi7UH2oydNIyFoS+avTXjbN0B1gY7YV5CcYvxLOp2ieNhYF8YeuScH1qgteqhi3EYI+PGRleJn43ObW/MehHkGlGC8iUB4fFgM8zZnxN8lC7q9t4XrRqH6c8OZO//O/rImgb6SBhV/voBMUFI8A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QJixRRmI; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QJixRRmI" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-496bb7cdf51so723045e9.2 for ; Fri, 07 Aug 2026 15:56:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786143417; x=1786748217; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:subject:cc:to:from:date:message-id:from:to:cc:subject :date:message-id:reply-to:content-type; bh=WWHQrKkplC0WYi76yok/S4SnvzljhW3mlGtup9LzYK0=; b=QJixRRmIndx9ZPIxLfYBO3QB1JSPTFp9Z3Yaq9rivxfiUadYq2HKmsZPW2vE4Gtv0I P7IBx6zhMlAtelVgvCrg2MM8v28AlLRihOWtt84Uzd44ZEMg6koBsAs6YN3x/rRNUKoF u+QeVNhxQkzOGLVtlJBfs+K+H2AfjrO8QLPO5J+WqXBi9mBHAlMJuOvLJxY1NWWpv2yy bdbf7iqXqsSV/JxtNqwp2iOALnxUmmTDqGYDqwDrrGlgdyUNlhHTnJXWiP+kPgrvv6Ie zVZXUfnTfvr5Iiu/P+qJmxtmRhXvYSobSy0sVLpmPH0j5LF9TpWCuhlNv1S3E58QTL33 NlSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786143417; x=1786748217; h=in-reply-to:content-disposition:content-type:mime-version :references:subject:cc:to:from:date:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=WWHQrKkplC0WYi76yok/S4SnvzljhW3mlGtup9LzYK0=; b=gGohyjH0ToKx95eRwyreS0govZmkv26G9hvp2UbrYiYRHjvseiebX1PEoOhTp/PjZu c9MvvWerbSi93NF4HlmcrKdunt/JiaLovjhnv0kmpoCODOTPAprYColpRB6KSQRdMnFt DyawnF2npzV8Jfj3NA2LQUGaQV0EIOWCDAXkuQK60FFcUJsfhDgTHAdUxf2wh6guigKM kYLn7EBrzO1RKm3AZyF2y+IqABHqCpklzvYV+k8a1miTvGbqyPWjU9cZPlkBzxBwQ8bS mVTR7br2mhZ828YC7b2SZYdULFxkPb7RVwVk9AqkdXfaJaZt5e6Aink0sb9eQ/T4l8mB FJww== X-Forwarded-Encrypted: i=1; AHgh+RoK3qouy+zAf+Is5qJ7maKwiIZyDdN6TnUphBWsU84jPwHGB5Wsbc+6BhbcG0f6zdiayLsnXUsoZzBD4QA=@vger.kernel.org X-Gm-Message-State: AOJu0YxWLHaHUJZJVJMNfQGlof7kats15Jj9lu47t8Zh6J2X7/CIz230 MdzSvA9//jHwfvj7j/5aIHv9256k8CCBOBiyMkzS2Efs74Mi6k1oy+X+ X-Gm-Gg: AR+sD10sedFkHd4LDh3xm/aiubLnQfXO0AncUbllUStuUXE7uOHPguLX9D2wUM8lOTh HloyW4aRhPIT0RtVRewKhI6tugoY4LoomRCJTSyn1QMWKaoEYzPreKjPy/WtRR4taIS2NIJLhXH +FwLoT4OL50+AQfmcVBUzb8SMBlYKwNK902zzdsZ6PEqgy/x63E7FPstn1mDBDYAjSX5amlMJJS QVURDR1628hWCT2C4Bsg1KzMZL33zt3VU9WnYFVgk+7/hIieoDJpHSVkwm6INyIp/fJLgUByBTi J4l+MyucdAaC70I+z5lSXXaEdBTilZk2KGpObGc8nHu/5aKYQn0+gQ2TBgcpChEdmGKeRgttyXu ivOYUEsOUIOP36hRKOmlhzqHjKHpZRjIQ2WCsfDz/kK7gfZzSF1KcRKZU+sCOo7yy5RQxtBynJM sB1qLG9JYQMFL5JCI+/CmOE+2O/UC8E8Ju7iRuFFBB8ScvL6716nwcKjDAj2YJQe63IoPJRP0Kh 0ownYGNTrUBK+5lWO5jrkFzTVo/at8IpFGabbHv9vt/QGE= X-Received: by 2002:a05:600c:840f:b0:496:c1f3:e8fb with SMTP id 5b1f17b1804b1-4994e71ffafmr333123705e9.8.1786143417357; Fri, 07 Aug 2026 15:56:57 -0700 (PDT) Received: from Ansuel-XPS. (host-87-19-255-168.retail.telecomitalia.it. [87.19.255.168]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4995427a244sm180639745e9.10.2026.08.07.15.56.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2026 15:56:56 -0700 (PDT) Message-ID: <6a7662b8.6220df5f.3c6b34.4460@mx.google.com> X-Google-Original-Message-ID: Date: Sat, 8 Aug 2026 00:56:53 +0200 From: Christian Marangi To: Mark Brown Cc: Liam Girdwood , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Matthias Brugger , AngeloGioacchino Del Regno , Philipp Zabel , Cyril Chao , Darren Ye , Daniel Golle , Rosen Penev , bui duc phuc , linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH v5 4/4] ASoC: airoha: Add AFE and machine driver for Airoha AN7581 References: <20260807200936.201827-1-ansuelsmth@gmail.com> <20260807200936.201827-5-ansuelsmth@gmail.com> <8146f434-1e16-4ebd-80a4-b9c27bfa45af@sirena.org.uk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8146f434-1e16-4ebd-80a4-b9c27bfa45af@sirena.org.uk> On Fri, Aug 07, 2026 at 11:52:58PM +0100, Mark Brown wrote: > On Fri, Aug 07, 2026 at 10:09:34PM +0200, Christian Marangi wrote: > > Add support for the Sound system present on Airoha AN7581 SoC. This is > > based on the mediatek AFE drivers. > > > Also add the machine driver to create an actual sound card for the AFE. > > This should be more patches, the machine driver should be a separate > patch at a minimum. Possibly PCM and ETDM drivers too. > Sooo you are suggesting 3 patch? one for machine, one for basic pcm and one for etdm? > > +static int an7581_afe_pcm_dev_probe(struct platform_device *pdev) > > +{ > > + struct an7581_afe_private *afe_priv; > > + struct reset_control *reset; > > + struct mtk_base_afe *afe; > > + struct device *dev; > > + int i, irq_id, ret; > > + void *base; > > + > > + afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL); > > + if (!afe) > > + return -ENOMEM; > > We allocate afe here with devm_kzalloc() so everything is zero... > > > + afe->irqs = devm_kcalloc(dev, afe->irqs_size, sizeof(*afe->irqs), > > + GFP_KERNEL); > > + if (!afe->irqs) > > + return -ENOMEM; > > ...then we allocate an array using a size read from the struct which must > therefore have zero elements. We also didn't assign dev, either we > should assign it and use it consistently or we should drop it and use > &pdev->dev like the first allocation. > Nono these were just my mistake with moving code... I already fixed them... sorry for the mistake. > > + /* register component */ > > + ret = devm_snd_soc_register_component(&pdev->dev, > > + &mtk_afe_pcm_platform, > > + NULL, 0); > > + if (ret) > > + return dev_err_probe(dev, ret, "Cannot register AFE component\n"); > > + > > + ret = devm_snd_soc_register_component(afe->dev, > > + &an7581_afe_pcm_dai_component, > > + afe->dai_drivers, > > + afe->num_dai_drivers); > > + if (ret) > > + return dev_err_probe(dev, ret, "Cannot register PCM DAI component\n"); > > + > > + platform_set_drvdata(pdev, afe); > > The component registration might result in a card being instantiated so > we need the driver data initialized before we try to register. Sorry this was asked to be moved in the previous revision by another review. I will revert following the pattern done in other AFE driver... -- Ansuel