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, 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 C9BD5C4363C for ; Sun, 4 Oct 2020 23:20:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 790A720665 for ; Sun, 4 Oct 2020 23:20:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725857AbgJDXUD convert rfc822-to-8bit (ORCPT ); Sun, 4 Oct 2020 19:20:03 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:28260 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725836AbgJDXUD (ORCPT ); Sun, 4 Oct 2020 19:20:03 -0400 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 Cc: , , , , , , , , , , , , , , , , , , , , 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: 8BIT Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Hi Sameer > > This is just an idea, > > but can we use hooks here somehow ? > > > > .ops_hook_pre > > .ops_hook_func > > .ops_hook_post > > > > if (priv->ops_hook_pre->func) > > priv->ops_hook_pre->func_pre(...); > > > > if (priv->ops_hook_func->func) > > priv->ops_hook_func->func(...); /* driver's function */ > > else > > graph_func(...); /* audio-graph function */ > > > > if (priv->ops_hook_post->func) > > priv->ops_hook_post->func(...); > > 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 ? > > 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. > > Something like below, > > static int tegra_audio_graph_probe(struct platform_device *pdev) > { >         struct tegra_audio_priv *priv; >         struct device *dev = &pdev->dev; >         struct snd_soc_card *card; > >         priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); >         if (!priv) >                 return -ENOMEM; > >         card = simple_priv_to_card(&priv->simple); > >         card->owner = THIS_MODULE; >         card->dev = dev; >         card->probe = tegra_audio_graph_card_probe; > >         /* graph_parse_of() depends on below */ >         card->component_chaining = 1; >         priv->simple.ops = &tegra_audio_graph_ops; >         priv->simple.force_dpcm = 1; > >         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