From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EC6DC4363C for ; Sun, 4 Oct 2020 23:21:08 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 60E1820735 for ; Sun, 4 Oct 2020 23:21:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="RTixGB6U" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 60E1820735 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org 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 D8A9517EE; Mon, 5 Oct 2020 01:20:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D8A9517EE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1601853664; bh=uFVMJMOWhEO4CIPDN1RAHixPV0nBVFRI8T1LlL2wu+E=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=RTixGB6U3gw8uEFYzJ6AA+LOwGI30mrvwmawavJ0bTWmE+5OfFqdnjGI5fK8bbSQE CvFhwj4wROKp7N5DAgMdpH+1WR+cntNgMpmo635Qs2pynYuV4Cw6WT8e189SUf73a+ FuuWQJrlqJ++nHgks533Dj6v50dWGOMA4MU8TVDM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6CBF9F80218; Mon, 5 Oct 2020 01:20:14 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A0868F80246; Mon, 5 Oct 2020 01:20:12 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 96BE0F801D8 for ; Mon, 5 Oct 2020 01:20:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 96BE0F801D8 Date: 05 Oct 2020 08:20:02 +0900 X-IronPort-AV: E=Sophos;i="5.77,336,1596466800"; d="scan'208";a="58884013" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 05 Oct 2020 08:20:02 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id E798041272A2; Mon, 5 Oct 2020 08:20:01 +0900 (JST) Message-ID: <87eemdr38y.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Sameer Pujar Subject: Re: [PATCH v3 10/13] ASoC: tegra: Add audio graph based card driver In-Reply-To: <25771697-fc85-b377-ae99-a5e0957ba02d@nvidia.com> References: <1601573587-15288-1-git-send-email-spujar@nvidia.com> <1601573587-15288-11-git-send-email-spujar@nvidia.com> <87362xkxdv.wl-kuninori.morimoto.gx@renesas.com> <25771697-fc85-b377-ae99-a5e0957ba02d@nvidia.com> User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, atalambedu@nvidia.com, swarren@nvidia.com, lgirdwood@gmail.com, nicoleotsuka@gmail.com, linux-kernel@vger.kernel.org, nwartikar@nvidia.com, tiwai@suse.com, robh+dt@kernel.org, viswanathl@nvidia.com, sharadg@nvidia.com, devicetree@vger.kernel.org, broonie@kernel.org, thierry.reding@gmail.com, linux-tegra@vger.kernel.org, jonathanh@nvidia.com, rlokhande@nvidia.com, mkumard@nvidia.com, dramesh@nvidia.com 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" Hi Sameer > > This is just an idea, > > but can we use hooks here somehow ? > >=20 > > .ops_hook_pre > > .ops_hook_func > > .ops_hook_post > >=20 > > if (priv->ops_hook_pre->func) > > priv->ops_hook_pre->func_pre(...); > >=20 > > if (priv->ops_hook_func->func) > > priv->ops_hook_func->func(...); /* driver's function */ > > else > > graph_func(...); /* audio-graph function */ > >=20 > > if (priv->ops_hook_post->func) > > priv->ops_hook_post->func(...); >=20 > Right now I just required to populate some flags or structures and do > not have any specific pre()/post() functions to be called. Can this be > reserved for later? Yeah, of course :) > > These are almost same as graph_probe(). > > Maybe we can separate graph_probe() and export function ? >=20 > Yes possible, I can move more stuff into graph_parse_of() which is > already an exported function in the current series. This can be > utilized by both generic audio graph and Tegra audio graph. >=20 > Something like below, >=20 > static int tegra_audio_graph_probe(struct platform_device *pdev) > { > =A0=A0=A0=A0=A0=A0=A0 struct tegra_audio_priv *priv; > =A0=A0=A0=A0=A0=A0=A0 struct device *dev =3D &pdev->dev; > =A0=A0=A0=A0=A0=A0=A0 struct snd_soc_card *card; >=20 > =A0=A0=A0=A0=A0=A0=A0 priv =3D devm_kzalloc(dev, sizeof(*priv), GFP_KERNE= L); > =A0=A0=A0=A0=A0=A0=A0 if (!priv) > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return -ENOMEM; >=20 > =A0=A0=A0=A0=A0=A0=A0 card =3D simple_priv_to_card(&priv->simple); >=20 > =A0=A0=A0=A0=A0=A0=A0 card->owner =3D THIS_MODULE; > =A0=A0=A0=A0=A0=A0=A0 card->dev =3D dev; > =A0=A0=A0=A0=A0=A0=A0 card->probe =3D tegra_audio_graph_card_probe; >=20 > =A0=A0=A0=A0=A0=A0=A0 /* graph_parse_of() depends on below */ > =A0=A0=A0=A0=A0=A0=A0 card->component_chaining =3D 1; > =A0=A0=A0=A0=A0=A0=A0 priv->simple.ops =3D &tegra_audio_graph_ops; > =A0=A0=A0=A0=A0=A0=A0 priv->simple.force_dpcm =3D 1; >=20 > =A0=A0=A0=A0=A0=A0=A0 return graph_parse_of(&priv->simple); > } I think graph side can handle card->owner / card->dev, but, it looks good to me Thank you for your help !! Best regards --- Kuninori Morimoto