Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758855AbcJQIjQ (ORCPT ); Mon, 17 Oct 2016 04:39:16 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:28243 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758774AbcJQIiP (ORCPT ); Mon, 17 Oct 2016 04:38:15 -0400 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="223079076" Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Message-ID: <871szf4bwn.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 19/23] ASoC: simple-card-utils: add asoc_simple_card_try_to_probe_graph_card() User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Rob Herring , Mark Brown CC: Linux-ALSA , Liam Girdwood , Simon , Laurent , Guennadi , Grant Likely , Frank Rowand , Linux-DT , Linux-Kernel In-Reply-To: <87shrv4c8x.wl%kuninori.morimoto.gx@renesas.com> References: <87shrv4c8x.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="US-ASCII" Date: Mon, 17 Oct 2016 08:38:10 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS2PR01CA0023.jpnprd01.prod.outlook.com (10.161.74.161) To PS1PR0601MB1449.apcprd06.prod.outlook.com (10.165.210.153) X-MS-Office365-Filtering-Correlation-Id: 31f868f5-d578-4a72-a079-08d3f668edb8 X-Microsoft-Exchange-Diagnostics: 1;PS1PR0601MB1449;2:+imQ51opAIC2Teq7Ookk3UuH7X/GaAWNcyqel7zfD6+0r/DMy2gJLtLgVNpyZW8fsHDk5Pevo2PSkbGZH9pEIZXzKsiqYZVyS6AVQ+mbvsEmdU7dU6GDAQEIYemGrOy8N+F1S+0IO0PQBxeMOeviOuuEu7Z9XO9Av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rntVrvCUBDPiwem2R0o8oc0mn3J78rj/6ftv8KW47VJuyKzHdTzAWImsvMwy9EZF0kVm8R+FtbP0APv3+s4UewDqT4O308DOk6PfI1Z3NEgsL/ioD33bTFeKBwpzdTsKikheKY8CVNhirPNgSyPVpw10BDyqAAAfPseTDnUndFPSkjF6vrKevD7raJ9OctJTYionPwhXWh4X6pWs7Q7281uvhmyyFf+g7C7utu7DmJVwYI5zDaAR0LC8oUvgxttJ2sMJsrqCMpRL4EX5aMOHDZkl6mWFag7hyRniv/oehZ+Pm/5ZzlV6oKu6Ga76WPWG8DKvSA+aGe6HNibCq4knKBAxVR0agAicGq6x2LuSUSTv6e4J0aHg8+JTu02HXiPkUNACSLea+67gkaOvcw4qfTiVyFPeeayVI7Oik+171+QrJvMF0YuLyNKpY17SImYTc7c8TUfYyMiJG14oAAyIAyFHbCxHJ31+iU4cy2HH3oB8z X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026);SRVR:PS1PR0601MB1449;BCL:0;PCL:0;RULEID:;SRVR:PS1PR0601MB1449; X-Microsoft-Exchange-Diagnostics: 1;PS1PR0601MB1449;4:03YUVMiQPDXQYB2DL1qvlQvnYfXElLnHTGTM0SwcB31AGeY9Y4PG+IcsQ5bfgJK6HOKrPFvWNeFys5tBibQ0eFjwxPx5cHsun8Q2j8pHqG9QQyWACnpdE4vbWTS+EbjCylCjAY11+Hu5eIAqFGds8xwKgCdR/4oaE+Rm4k7lZytV6XK8PvDLH8piz3QCvlNLWDPnToKqGxfLb0cEI0PFqw6O38859YqGmaI8WNSLbvPu4TVoCn7E0mSc2Re97fHAS/FKBEe7HWOKH0NKKmdwwarVtVx3NWPsR+CL4BmH63iUjS/HtPE/ldAgvX9ZFuA8Ng+BcOtQlLOIIuYl4GYWzJUdFshzEduvbY8O+1rsAbXLmBBb7ngUN6R59Y2lISA1toJVKEmDPJnAY1u7KuvRUCfy5WtMIqb2NLctj7IPXr0= X-Forefront-PRVS: 0098BA6C6C X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(42186005)(3846002)(2906002)(53416004)(8676002)(230783001)(81166006)(69596002)(4001350100001)(101416001)(5001770100001)(586003)(305945005)(7736002)(86362001)(106356001)(4326007)(105586002)(8666005)(5660300001)(50466002)(2950100002)(92566002)(47776003)(36756003)(77096005)(76176999)(54356999)(19580405001)(66066001)(83506001)(7416002)(7846002)(46406003)(33646002)(229853001)(189998001)(81156014)(23726003)(97736004)(50986999)(19580395003)(6116002)(68736007)(7059030)(2004002)(21314002)(16060500001);DIR:OUT;SFP:1102;SCL:1;SRVR:PS1PR0601MB1449;H:morimoto-PC.renesas.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;PS1PR0601MB1449;23:G2elbUIJJPqZkFPNxBERQV9+O+c9Y8kF74BMIM/?= =?us-ascii?Q?QcM+HtKpp3DWluYmQxLaI8B5gjIb/7pXdF7SkYicrG602TwVk0wRNUkqBq5T?= =?us-ascii?Q?GNMIaHK4Phcwr7ibFeThlvjKHV/cG8i/5hSVOslNZzfHiKhQrv02Dupavr4v?= =?us-ascii?Q?JF7f0A0kUr81x/0ynCWPvhb+9VsBZG9V4w96MFumWvHI1MaW/T4y854ih2Nf?= =?us-ascii?Q?HNuKV7eyiA+EoEp3pxvUsEZhx612hc1Al0oSYM15ao7nRzgwNTlQX4p73Zld?= =?us-ascii?Q?bMJR6CLqiy2qrZUYxPBE6gbEiXyxisBsw+Sx7t2NmApfBZkNonj01xNsGiWt?= =?us-ascii?Q?H/rKnLL4hwHatpRlFH0n9qx5y76G/zR8Q36CRcj7Cu+0nORahyf3XyOHrhvP?= =?us-ascii?Q?g5wLqMBxozBbfGkA24nIKdV2aOVCH5/KnzOqq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-ascii?Q?LTSqMDhbEGYGqL91L57Ub2PY=3D?= X-Microsoft-Exchange-Diagnostics: 1;PS1PR0601MB1449;6:6P8MJl39pL49WVOGKCYpKXfGECtSx2ANN29ltwc8GfAuLzIWd7F1QuAhdoKig6GOSDb+pWWzSjqoloodRRW/I283pyeIK9jO+DAtK8YxfMmpzSEA2BCK5SK2JC33dMMzYwOvM7IgLD6bo21q0XCm665hRyNbIQr4ee61nA5z3P0AjYEl5bBrM8BAkLrZ0fX4pIUf5LejESCs8RSWkfKLzkr81sD3SYUj/TWc89It+vWEEi0VP5CtSWPE5RDM6vrsi8wL2tbfcUu0+VKnGduY7ZX32okcu7JKitJc3F0xY7Im7fqYdG2Gm0Yo/sVfR5g3ShR5Ef4VAW9n9HKHjhzYa+q6jcPmM7cMGWTQbV4vk10=;5:rhb5gVjmHhrZv83TLEL173EaeTSOfGzYleV3ZKm53F9ipaEwFpgVnRsgRpCyku3yB0ho5DxKwQYejDtyUlYKlksefbll/bSHAPlqhZQ0rbkVvcHBiErbSWsP4p4wk7Y8L/rE62f+c0YDP4/ProXdEsWSOIt9CumhuZnQzxqjdRI=;24:8lBJBoQ2yLjm7MIkbG5KrfuYD1h5VsfnIDkpSAkDpDasCpZfFXoVz7TFoynlU07OjK4KQvO/6p/N76JSdpi99HlAXbenBGUhL0bzS33moig= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;PS1PR0601MB1449;7:4ExYEwDKzuQjEg4MA14dywiiZg2427gqvP09dG+R7+pPuP2qqezwsSfq3r6VXDYAtkmih3M4lfVWMA4QxrcVWLnvbEhJAEBLvgmi0NIMusbEdnRnjuWAT2F7BayVSrgt0U1yInhYu+8ypCe1/iM4eNSXQL4JH9yP43cEucyrGKtKnu2w0KUiPfu65p6huT59yQ4ce/TyXbN556IZHQRdWi4DiEloUwH0Vz0RV9CXcFI6wFDlKAuzYM/Dn8ey7v1pQNXgy1mHcPxr6RD4tgJMtS/nWCVu4bQDUuFSSpp5v6/6HxbmAnmGoi/HQeuZKYIhFkhhIunovsAvudo7zQVw8y2BnRxn8KgrLEkfFuAHmsM=;20:1SagmSpTxS+6nn5lDGkDshRiH2a6k6jRctTFlppPO6z7AKeBwBFBY76N2zoV2tuQUIuz1J1ckfoR56Im4UqmRhAZOTIWXO9ZgmCfZjYgeChlz04bc9TdPTX0KiN7Nf9e5dTfzX/8NjY/Ujn1y4RxwuzjSynWdAewRlNEoKjN4y0= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2016 08:38:10.6175 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR0601MB1449 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2816 Lines: 87 From: Kuninori Morimoto If CPU/Platform side driver probes successfully, and if it is supporting both previous normal sound card style and graph style DT, it can call asoc_simple_card_try_to_probe_graph_card(). It checks graph style DT, and do nothing if it was non graph style DT, or register new simple-graph-card driver if graph style DT. Signed-off-by: Kuninori Morimoto --- include/sound/simple_card_utils.h | 2 ++ sound/soc/generic/simple-card-utils.c | 42 +++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index c79263a..c8f090a 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -80,4 +80,6 @@ void asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link, int asoc_simple_card_clean_reference(struct snd_soc_card *card); +void asoc_simple_card_try_to_probe_graph_card(struct device *dev); + #endif /* __SIMPLE_CARD_CORE_H */ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 47a73ee..521257c 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -8,6 +8,7 @@ * published by the Free Software Foundation. */ #include +#include #include #include #include @@ -293,6 +294,47 @@ int asoc_simple_card_clean_reference(struct snd_soc_card *card) } EXPORT_SYMBOL_GPL(asoc_simple_card_clean_reference); +void asoc_simple_card_try_to_probe_graph_card(struct device *dev) +{ + struct platform_device_info pdevinfo; + struct device_node *node; + const char *compatible; + int ret; + + node = of_graph_get_top_port(dev); + if (!node) + /* + * It doesn't have graph base sound DT. + * Do nothing here, It assumes that system has + * normal sound card. + */ + return; + + ret = of_property_read_string(node, "compatible", &compatible); + if (ret < 0) + goto probe_err; + + /* + * FIXME + * + * It should use of_platform_xxx() instead of + * platform_device_register_full() ? but there is no solution. + * see also + * linux/sound/soc/generic/simple-graph-card.c :: asoc_simple_card_probe + */ + + memset(&pdevinfo, 0, sizeof(pdevinfo)); + pdevinfo.parent = dev; + pdevinfo.id = PLATFORM_DEVID_AUTO; + pdevinfo.name = compatible; + pdevinfo.dma_mask = DMA_BIT_MASK(32); + platform_device_register_full(&pdevinfo); + +probe_err: + of_node_put(node); +} +EXPORT_SYMBOL_GPL(asoc_simple_card_try_to_probe_graph_card); + /* Module information */ MODULE_AUTHOR("Kuninori Morimoto "); MODULE_DESCRIPTION("ALSA SoC Simple Card Utils"); -- 1.9.1