From patchwork Mon Apr 9 02:15:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10329737 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2C059604D4 for ; Mon, 9 Apr 2018 02:15:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 155A228821 for ; Mon, 9 Apr 2018 02:15:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 066402886D; Mon, 9 Apr 2018 02:15:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E164728821 for ; Mon, 9 Apr 2018 02:15:54 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id AC2602673FE; Mon, 9 Apr 2018 04:15:53 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E815A2673FE; Mon, 9 Apr 2018 04:15:51 +0200 (CEST) Received: from relmlie3.idc.renesas.com (relmlor4.renesas.com [210.160.252.174]) by alsa0.perex.cz (Postfix) with ESMTP id B091D2673C7 for ; Mon, 9 Apr 2018 04:15:45 +0200 (CEST) Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie3.idc.renesas.com with ESMTP; 09 Apr 2018 11:15:42 +0900 Received: from relmlii2.idc.renesas.com (relmlii2.idc.renesas.com [10.200.68.66]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id DA2D867F6C; Mon, 9 Apr 2018 11:15:42 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.48,426,1517842800"; d="scan'208";a="277601484" Received: from mail-sg2apc01lp0244.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.244]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-GCM-SHA384; 09 Apr 2018 11:15:41 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=LVN4Acz/833zhzTjhwcZxwS+TL1oGPDuIXyyVCVmU/0=; b=jnWIZ9wZDnfMUl1mKIHgNi+/NmXFCG+Jgs9SGhinXnHiIdF8Admdn8o/qlXnX6PPslIpIJib3qzt5g5nA/OecXjgI+6PC5UFf0zDI9rCDmLm3+qNpjZIYXRsWGpnESaxlxBRz7McgA3ehWmHX+HjqfoOqCi9Fr/UItKj6fwPGtk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.138) by TY2PR01MB2073.jpnprd01.prod.outlook.com (2603:1096:404:e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.653.12; Mon, 9 Apr 2018 02:15:38 +0000 Message-ID: <87h8olf7qd.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Mark Brown In-Reply-To: <87muydf7t2.wl%kuninori.morimoto.gx@renesas.com> References: <87muydf7t2.wl%kuninori.morimoto.gx@renesas.com> Date: Mon, 9 Apr 2018 02:15:38 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: HK2PR02CA0191.apcprd02.prod.outlook.com (2603:1096:201:21::27) To TY2PR01MB2073.jpnprd01.prod.outlook.com (2603:1096:404:e::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6ec4a3dc-6fe1-4362-333b-08d59dbfc97f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:TY2PR01MB2073; X-Microsoft-Exchange-Diagnostics: 1; TY2PR01MB2073; 3:hFI6Zo3GrsEVZycGgCM7xllvh4J8/TeslmAE6/g7cHOE0epTUyhSA76QVVcg3OpeAbL0cWv47W61KtFS7LVW5aR50XwRFiISHdBKZQOBv51s/zQdVUONqTBMpsMqbkbjk0Ys05hEzec0kqRBmu8ke3Y750DCYwMiNcbARPm+lCcLg5+k1uzFlui9/3k7hIK7hXGbw5a4rhpdZCr0wcRIFRKwZ54Rv4ddySL6r38MG4dgC5KjQ7kH5Xa7gTsOJhoZ; 25:J2VvlxdTSWRQF94pINmDOTxnaBBnj2j+/Dtd1jQbk1G+pfUfWalb6BAtrdZFDiQ7cVBVyBCzweNDc3oPaZ9ydpbAxJ7uln65a3WETnNE8RRkPEZN2MPDP8OEt241WgG0BNrvGHtqAycUNKoH/LRwSrAXwp1lxmnTfBJBlMqnmeot91HOe5sxdC4g+cd5uYORncblQReH0n5bamZnieUdKJiwVtbmSf4C3f0AWLvfBziAXzSIowVdq7KHV1XJx/n3fWihv3/mZt42GMWXyACj88lKXcbmcXhsYfWrsLHDjdZbhjj5SWQvGAfx5f7Fl2Ax5bztzaXBQa9yBkZzdiNjZQ==; 31:v5bmle2PxpOWX5imKcHvxlIZK/jKtAOSgyIByAkLT6vKHFH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1LCms0ntLf2IBd X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(131327999870524); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231221)(944501327)(52105095)(3002001)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:TY2PR01MB2073; BCL:0; PCL:0; RULEID:; SRVR:TY2PR01MB2073; X-Forefront-PRVS: 0637FCE711 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(366004)(376002)(346002)(396003)(39380400002)(39860400002)(199004)(189003)(6916009)(5660300001)(53416004)(106356001)(45080400002)(478600001)(7736002)(6116002)(16586007)(316002)(59450400001)(16526019)(386003)(186003)(7696005)(58126008)(76176011)(3846002)(476003)(2616005)(956004)(11346002)(446003)(68736007)(50466002)(26005)(52116002)(23726003)(305945005)(486006)(8676002)(81166006)(81156014)(2906002)(97736004)(86362001)(8936002)(69596002)(6486002)(36756003)(105586002)(25786009)(53946003)(47776003)(4326008)(66066001)(53936002)(16060500001)(559001)(579004); DIR:OUT; SFP:1102; SCL:1; SRVR:TY2PR01MB2073; H:morimoto-PC.renesas.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; TY2PR01MB2073; 23:gUDy6IfUHh4574cElkYDgD1ji8kBm6lcFpRZXRwcB?= =?us-ascii?Q?n3fBEN0Tvt6RqCsk3D6WyTbIsHQwHDXYl+PK3OvRDVpRQir1tnN4ASU8CGy/?= =?us-ascii?Q?3BDTnWN9kZc6myN540Dq8xrk7a4wSAAVJTgsOe6pB7JzEpIvkQw0d5kirz+S?= =?us-ascii?Q?H1S+nhhGo/32ZCyzsy8Im/fZ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SBirCttxZrQqNEN9vez7ECTq0G/Ef4MUmPTaV0At1z0d/MEJ/QC3S4a1aaAawuIhuexvQJCTndgCznR2t7ZG3KR7SSGmxTmZvg61rs/CPZRtuknAJ8J5heZpSaDugQx29/68BfNDo=; 24:a8HQTSmyIVyqWRulASBpUwNQEkKhpCKjapCacnWxHuhnRdp5uj7p2y4+L632lAArz3C2CrW36gq5JsBeLtRPOcKR0KVOHdQ0Ockmx5zMjhY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; TY2PR01MB2073; 7:7HtMBWP/Ik2YBwPl0047dAEzBMnzw3mnqgZbuTr6dDJnId77hL/Vv4HkDl0z4eH3X0nd1c6v5wxogt7oiyTm06028PHZEoTFsbW4OnvOhqiaJK2d+kG7+8bYnm/MWfDzGb98YrE85iTq1t65R4ZnVYWzVEyHbYwFviGigf5PmJdnCSNzJi5pvLRvAkLEUnhh6fc2jDiC1V1Lq09jS1ERVi6x9MTyvl7Tlta9daoc7UY1jQdYOL0oF6AL/+T9YIse; 20:gzTbPFkXXFxs7fa8yIkhm/zBye0XXRY5jO7EybvwtvOzH7lx6I+7IRf6BCqFf7jVP4WLZV7TxFRcSiAuHMX77JyY/3FFlIriPsbSJWKx5ApNRertZnoobqv8tKlKttTxunaxzZUHIX0TmGZfqQ81Cenoj5+1A8Cmo2JppJ5w/mU= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2018 02:15:38.2664 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6ec4a3dc-6fe1-4362-333b-08d59dbfc97f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY2PR01MB2073 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH 4/5][RFC] ASoC: remove platform related things X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Now, all platform are replaced to component. This patch removes all platform code. One note is that, "platform_list_show()" is replaced to "component_list_show()" by this patch Signed-off-by: Kuninori Morimoto --- Documentation/sound/soc/platform.rst | 30 ++--- include/sound/soc.h | 101 +--------------- sound/soc/soc-compress.c | 214 --------------------------------- sound/soc/soc-core.c | 227 ++--------------------------------- sound/soc/soc-devres.c | 35 ------ sound/soc/soc-io.c | 21 ---- sound/soc/soc-pcm.c | 121 +------------------ 7 files changed, 25 insertions(+), 724 deletions(-) diff --git a/Documentation/sound/soc/platform.rst b/Documentation/sound/soc/platform.rst index d557490..cc81707 100644 --- a/Documentation/sound/soc/platform.rst +++ b/Documentation/sound/soc/platform.rst @@ -23,30 +23,26 @@ The platform DMA driver optionally supports the following ALSA operations:- }; The platform driver exports its DMA functionality via struct -snd_soc_platform_driver:- +snd_soc_component_driver:- :: - struct snd_soc_platform_driver { - char *name; + struct snd_soc_component_driver { + const char *name; - int (*probe)(struct platform_device *pdev); - int (*remove)(struct platform_device *pdev); - int (*suspend)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai); - int (*resume)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai); + ... + int (*probe)(struct snd_soc_component *); + void (*remove)(struct snd_soc_component *); + int (*suspend)(struct snd_soc_component *); + int (*resume)(struct snd_soc_component *); /* pcm creation and destruction */ - int (*pcm_new)(struct snd_card *, struct snd_soc_codec_dai *, struct snd_pcm *); + int (*pcm_new)(struct snd_soc_pcm_runtime *); void (*pcm_free)(struct snd_pcm *); - /* - * For platform caused delay reporting. - * Optional. - */ - snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *, - struct snd_soc_dai *); - - /* platform stream ops */ - struct snd_pcm_ops *pcm_ops; + ... + const struct snd_pcm_ops *ops; + const struct snd_compr_ops *compr_ops; + ... }; Please refer to the ALSA driver documentation for details of audio DMA. diff --git a/include/sound/soc.h b/include/sound/soc.h index 9cb8ca2..e20eed3 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -401,9 +401,7 @@ enum snd_soc_bias_level { struct snd_soc_pcm_runtime; struct snd_soc_dai; struct snd_soc_dai_driver; -struct snd_soc_platform; struct snd_soc_dai_link; -struct snd_soc_platform_driver; struct snd_soc_codec; struct snd_soc_codec_driver; struct snd_soc_component; @@ -455,15 +453,6 @@ static inline int snd_soc_resume(struct device *dev) } #endif int snd_soc_poweroff(struct device *dev); -int snd_soc_register_platform(struct device *dev, - const struct snd_soc_platform_driver *platform_drv); -int devm_snd_soc_register_platform(struct device *dev, - const struct snd_soc_platform_driver *platform_drv); -void snd_soc_unregister_platform(struct device *dev); -int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform, - const struct snd_soc_platform_driver *platform_drv); -void snd_soc_remove_platform(struct snd_soc_platform *platform); -struct snd_soc_platform *snd_soc_lookup_platform(struct device *dev); int snd_soc_register_codec(struct device *dev, const struct snd_soc_codec_driver *codec_drv, struct snd_soc_dai_driver *dai_drv, int num_dai); @@ -483,10 +472,6 @@ int devm_snd_soc_register_component(struct device *dev, struct snd_soc_component *snd_soc_lookup_component(struct device *dev, const char *driver_name); -int snd_soc_platform_read(struct snd_soc_platform *platform, - unsigned int reg); -int snd_soc_platform_write(struct snd_soc_platform *platform, - unsigned int reg, unsigned int val); int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num); #ifdef CONFIG_SND_SOC_COMPRESS int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num); @@ -626,8 +611,6 @@ int snd_soc_add_component_controls(struct snd_soc_component *component, const struct snd_kcontrol_new *controls, unsigned int num_controls); int snd_soc_add_codec_controls(struct snd_soc_codec *codec, const struct snd_kcontrol_new *controls, unsigned int num_controls); -int snd_soc_add_platform_controls(struct snd_soc_platform *platform, - const struct snd_kcontrol_new *controls, unsigned int num_controls); int snd_soc_add_card_controls(struct snd_soc_card *soc_card, const struct snd_kcontrol_new *controls, int num_controls); int snd_soc_add_dai_controls(struct snd_soc_dai *dai, @@ -903,8 +886,6 @@ struct snd_soc_component { void (*remove)(struct snd_soc_component *); int (*suspend)(struct snd_soc_component *); int (*resume)(struct snd_soc_component *); - int (*pcm_new)(struct snd_soc_component *, struct snd_soc_pcm_runtime *); - void (*pcm_free)(struct snd_soc_component *, struct snd_pcm *); int (*set_sysclk)(struct snd_soc_component *component, int clk_id, int source, unsigned int freq, int dir); @@ -979,39 +960,12 @@ struct snd_soc_codec_driver { bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */ }; -/* SoC platform interface */ -struct snd_soc_platform_driver { - - int (*probe)(struct snd_soc_platform *); - int (*remove)(struct snd_soc_platform *); - struct snd_soc_component_driver component_driver; - - /* pcm creation and destruction */ - int (*pcm_new)(struct snd_soc_pcm_runtime *); - void (*pcm_free)(struct snd_pcm *); - - /* platform stream pcm ops */ - const struct snd_pcm_ops *ops; - - /* platform stream compress ops */ - const struct snd_compr_ops *compr_ops; -}; - struct snd_soc_dai_link_component { const char *name; struct device_node *of_node; const char *dai_name; }; -struct snd_soc_platform { - struct device *dev; - const struct snd_soc_platform_driver *driver; - - struct list_head list; - - struct snd_soc_component component; -}; - struct snd_soc_dai_link { /* config - must be set by machine driver */ const char *name; /* Codec name */ @@ -1260,7 +1214,6 @@ struct snd_soc_pcm_runtime { struct snd_pcm *pcm; struct snd_compr *compr; struct snd_soc_codec *codec; - struct snd_soc_platform *platform; /* will be removed */ struct snd_soc_dai *codec_dai; struct snd_soc_dai *cpu_dai; @@ -1342,19 +1295,6 @@ static inline struct snd_soc_codec *snd_soc_component_to_codec( } /** - * snd_soc_component_to_platform() - Casts a component to the platform it is embedded in - * @component: The component to cast to a platform - * - * This function must only be used on components that are known to be platforms. - * Otherwise the behavior is undefined. - */ -static inline struct snd_soc_platform *snd_soc_component_to_platform( - struct snd_soc_component *component) -{ - return container_of(component, struct snd_soc_platform, component); -} - -/** * snd_soc_dapm_to_component() - Casts a DAPM context to the component it is * embedded in * @dapm: The DAPM context to cast to the component @@ -1383,20 +1323,6 @@ static inline struct snd_soc_codec *snd_soc_dapm_to_codec( } /** - * snd_soc_dapm_to_platform() - Casts a DAPM context to the platform it is - * embedded in - * @dapm: The DAPM context to cast to the platform. - * - * This function must only be used on DAPM contexts that are known to be part of - * a platform (e.g. in a platform driver). Otherwise the behavior is undefined. - */ -static inline struct snd_soc_platform *snd_soc_dapm_to_platform( - struct snd_soc_dapm_context *dapm) -{ - return snd_soc_component_to_platform(snd_soc_dapm_to_component(dapm)); -} - -/** * snd_soc_component_get_dapm() - Returns the DAPM context associated with a * component * @component: The component for which to get the DAPM context @@ -1656,17 +1582,6 @@ static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec) return snd_soc_component_get_drvdata(&codec->component); } -static inline void snd_soc_platform_set_drvdata(struct snd_soc_platform *platform, - void *data) -{ - snd_soc_component_set_drvdata(&platform->component, data); -} - -static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platform) -{ - return snd_soc_component_get_drvdata(&platform->component); -} - static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) { INIT_LIST_HEAD(&card->widgets); @@ -1730,7 +1645,7 @@ static inline bool snd_soc_codec_is_active(struct snd_soc_codec *codec) * * Note: This function will work correctly if the control has been registered * for a component. Either with snd_soc_add_codec_controls() or - * snd_soc_add_platform_controls() or via table based setup for either a + * via table based setup for either a * CODEC, a platform or component driver. Otherwise the behavior is undefined. */ static inline struct snd_soc_component *snd_soc_kcontrol_component( @@ -1753,20 +1668,6 @@ static inline struct snd_soc_codec *snd_soc_kcontrol_codec( return snd_soc_component_to_codec(snd_soc_kcontrol_component(kcontrol)); } -/** - * snd_soc_kcontrol_platform() - Returns the platform that registered the control - * @kcontrol: The control for which to get the platform - * - * Note: This function will only work correctly if the control has been - * registered with snd_soc_add_platform_controls() or via table based setup of - * a snd_soc_platform_driver. Otherwise the behavior is undefined. - */ -static inline struct snd_soc_platform *snd_soc_kcontrol_platform( - struct snd_kcontrol *kcontrol) -{ - return snd_soc_component_to_platform(snd_soc_kcontrol_component(kcontrol)); -} - int snd_soc_util_init(void); void snd_soc_util_exit(void); diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 8240268..d4c33ce 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -29,7 +29,6 @@ static int soc_compr_open(struct snd_compr_stream *cstream) { struct snd_soc_pcm_runtime *rtd = cstream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; @@ -47,23 +46,9 @@ static int soc_compr_open(struct snd_compr_stream *cstream) } } - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->open) { - ret = platform->driver->compr_ops->open(cstream); - if (ret < 0) { - dev_err(platform->dev, - "Compress ASoC: can't open platform %s: %d\n", - platform->component.name, ret); - goto plat_err; - } - } - for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->open) continue; @@ -99,10 +84,6 @@ static int soc_compr_open(struct snd_compr_stream *cstream) for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->free) continue; @@ -110,9 +91,6 @@ static int soc_compr_open(struct snd_compr_stream *cstream) component->driver->compr_ops->free(cstream); } - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->free) - platform->driver->compr_ops->free(cstream); -plat_err: if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown) cpu_dai->driver->cops->shutdown(cstream, cpu_dai); out: @@ -125,7 +103,6 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) struct snd_soc_pcm_runtime *fe = cstream->private_data; struct snd_pcm_substream *fe_substream = fe->pcm->streams[cstream->direction].substream; - struct snd_soc_platform *platform = fe->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = fe->cpu_dai; @@ -151,23 +128,9 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) } } - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->open) { - ret = platform->driver->compr_ops->open(cstream); - if (ret < 0) { - dev_err(platform->dev, - "Compress ASoC: can't open platform %s: %d\n", - platform->component.name, ret); - goto plat_err; - } - } - for_each_rtdcom(fe, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->open) continue; @@ -238,10 +201,6 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) for_each_rtdcom(fe, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->free) continue; @@ -249,9 +208,6 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) component->driver->compr_ops->free(cstream); } - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->free) - platform->driver->compr_ops->free(cstream); -plat_err: if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown) cpu_dai->driver->cops->shutdown(cstream, cpu_dai); out: @@ -292,7 +248,6 @@ static void close_delayed_work(struct work_struct *work) static int soc_compr_free(struct snd_compr_stream *cstream) { struct snd_soc_pcm_runtime *rtd = cstream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; @@ -322,10 +277,6 @@ static int soc_compr_free(struct snd_compr_stream *cstream) for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->free) continue; @@ -333,9 +284,6 @@ static int soc_compr_free(struct snd_compr_stream *cstream) component->driver->compr_ops->free(cstream); } - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->free) - platform->driver->compr_ops->free(cstream); - if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown) cpu_dai->driver->cops->shutdown(cstream, cpu_dai); @@ -364,7 +312,6 @@ static int soc_compr_free(struct snd_compr_stream *cstream) static int soc_compr_free_fe(struct snd_compr_stream *cstream) { struct snd_soc_pcm_runtime *fe = cstream->private_data; - struct snd_soc_platform *platform = fe->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = fe->cpu_dai; @@ -404,16 +351,9 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream) if (fe->dai_link->compr_ops && fe->dai_link->compr_ops->shutdown) fe->dai_link->compr_ops->shutdown(cstream); - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->free) - platform->driver->compr_ops->free(cstream); - for_each_rtdcom(fe, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->free) continue; @@ -432,7 +372,6 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd) { struct snd_soc_pcm_runtime *rtd = cstream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *codec_dai = rtd->codec_dai; @@ -441,19 +380,9 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd) mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->trigger) { - ret = platform->driver->compr_ops->trigger(cstream, cmd); - if (ret < 0) - goto out; - } - for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->trigger) continue; @@ -485,7 +414,6 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd) static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd) { struct snd_soc_pcm_runtime *fe = cstream->private_data; - struct snd_soc_platform *platform = fe->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = fe->cpu_dai; @@ -494,19 +422,9 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd) if (cmd == SND_COMPR_TRIGGER_PARTIAL_DRAIN || cmd == SND_COMPR_TRIGGER_DRAIN) { - if (platform && - platform->driver->compr_ops && - platform->driver->compr_ops->trigger) - return platform->driver->compr_ops->trigger(cstream, - cmd); - for_each_rtdcom(fe, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->trigger) continue; @@ -532,19 +450,9 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd) goto out; } - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->trigger) { - ret = platform->driver->compr_ops->trigger(cstream, cmd); - if (ret < 0) - goto out; - } - for_each_rtdcom(fe, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->trigger) continue; @@ -585,7 +493,6 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream, struct snd_compr_params *params) { struct snd_soc_pcm_runtime *rtd = cstream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; @@ -605,19 +512,9 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream, goto err; } - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->set_params) { - ret = platform->driver->compr_ops->set_params(cstream, params); - if (ret < 0) - goto err; - } - for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->set_params) continue; @@ -661,7 +558,6 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream, struct snd_soc_pcm_runtime *fe = cstream->private_data; struct snd_pcm_substream *fe_substream = fe->pcm->streams[cstream->direction].substream; - struct snd_soc_platform *platform = fe->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = fe->cpu_dai; @@ -680,19 +576,9 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream, goto out; } - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->set_params) { - ret = platform->driver->compr_ops->set_params(cstream, params); - if (ret < 0) - goto out; - } - for_each_rtdcom(fe, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->set_params) continue; @@ -741,7 +627,6 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream, struct snd_codec *params) { struct snd_soc_pcm_runtime *rtd = cstream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; @@ -755,19 +640,9 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream, goto err; } - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->get_params) { - ret = platform->driver->compr_ops->get_params(cstream, params); - if (ret < 0) - goto err; - } - for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->get_params) continue; @@ -786,26 +661,15 @@ static int soc_compr_get_caps(struct snd_compr_stream *cstream, struct snd_compr_caps *caps) { struct snd_soc_pcm_runtime *rtd = cstream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; int ret = 0, __ret; mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->get_caps) { - ret = platform->driver->compr_ops->get_caps(cstream, caps); - if (ret < 0) - goto err; - } - for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->get_caps) continue; @@ -815,7 +679,6 @@ static int soc_compr_get_caps(struct snd_compr_stream *cstream, ret = __ret; } -err: mutex_unlock(&rtd->pcm_mutex); return ret; } @@ -824,26 +687,15 @@ static int soc_compr_get_codec_caps(struct snd_compr_stream *cstream, struct snd_compr_codec_caps *codec) { struct snd_soc_pcm_runtime *rtd = cstream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; int ret = 0, __ret; mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->get_codec_caps) { - ret = platform->driver->compr_ops->get_codec_caps(cstream, codec); - if (ret < 0) - goto err; - } - for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->get_codec_caps) continue; @@ -853,7 +705,6 @@ static int soc_compr_get_codec_caps(struct snd_compr_stream *cstream, ret = __ret; } -err: mutex_unlock(&rtd->pcm_mutex); return ret; } @@ -861,7 +712,6 @@ static int soc_compr_get_codec_caps(struct snd_compr_stream *cstream, static int soc_compr_ack(struct snd_compr_stream *cstream, size_t bytes) { struct snd_soc_pcm_runtime *rtd = cstream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; @@ -875,19 +725,9 @@ static int soc_compr_ack(struct snd_compr_stream *cstream, size_t bytes) goto err; } - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->ack) { - ret = platform->driver->compr_ops->ack(cstream, bytes); - if (ret < 0) - goto err; - } - for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->ack) continue; @@ -906,7 +746,6 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream, struct snd_compr_tstamp *tstamp) { struct snd_soc_pcm_runtime *rtd = cstream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; int ret = 0, __ret; @@ -917,19 +756,9 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream, if (cpu_dai->driver->cops && cpu_dai->driver->cops->pointer) cpu_dai->driver->cops->pointer(cstream, tstamp, cpu_dai); - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->pointer) { - ret = platform->driver->compr_ops->pointer(cstream, tstamp); - if (ret < 0) - goto err; - } - for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->pointer) continue; @@ -939,7 +768,6 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream, ret = __ret; } -err: mutex_unlock(&rtd->pcm_mutex); return ret; } @@ -948,26 +776,15 @@ static int soc_compr_copy(struct snd_compr_stream *cstream, char __user *buf, size_t count) { struct snd_soc_pcm_runtime *rtd = cstream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; int ret = 0; mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->copy) { - ret = platform->driver->compr_ops->copy(cstream, buf, count); - if (ret < 0) - goto err; - } - for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->copy) continue; @@ -976,7 +793,6 @@ static int soc_compr_copy(struct snd_compr_stream *cstream, break; } -err: mutex_unlock(&rtd->pcm_mutex); return ret; } @@ -985,7 +801,6 @@ static int soc_compr_set_metadata(struct snd_compr_stream *cstream, struct snd_compr_metadata *metadata) { struct snd_soc_pcm_runtime *rtd = cstream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; @@ -997,19 +812,9 @@ static int soc_compr_set_metadata(struct snd_compr_stream *cstream, return ret; } - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->set_metadata) { - ret = platform->driver->compr_ops->set_metadata(cstream, metadata); - if (ret < 0) - return ret; - } - for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->set_metadata) continue; @@ -1026,7 +831,6 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream, struct snd_compr_metadata *metadata) { struct snd_soc_pcm_runtime *rtd = cstream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; @@ -1038,19 +842,9 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream, return ret; } - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->get_metadata) { - ret = platform->driver->compr_ops->get_metadata(cstream, metadata); - if (ret < 0) - return ret; - } - for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->get_metadata) continue; @@ -1103,7 +897,6 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream, */ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) { - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *codec_dai = rtd->codec_dai; @@ -1186,16 +979,9 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) /* Add copy callback for not memory mapped DSPs */ - if (platform && platform->driver->compr_ops && platform->driver->compr_ops->copy) - compr->ops->copy = soc_compr_copy; - for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->compr_ops || !component->driver->compr_ops->copy) continue; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 2f5958f..f238a2c 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -56,7 +56,6 @@ #endif static DEFINE_MUTEX(client_mutex); -static LIST_HEAD(platform_list); static LIST_HEAD(codec_list); static LIST_HEAD(component_list); @@ -207,20 +206,20 @@ static int dai_list_show(struct seq_file *m, void *v) } DEFINE_SHOW_ATTRIBUTE(dai_list); -static int platform_list_show(struct seq_file *m, void *v) +static int component_list_show(struct seq_file *m, void *v) { - struct snd_soc_platform *platform; + struct snd_soc_component *component; mutex_lock(&client_mutex); - list_for_each_entry(platform, &platform_list, list) - seq_printf(m, "%s\n", platform->component.name); + list_for_each_entry(component, &component_list, list) + seq_printf(m, "%s\n", component->name); mutex_unlock(&client_mutex); return 0; } -DEFINE_SHOW_ATTRIBUTE(platform_list); +DEFINE_SHOW_ATTRIBUTE(component_list); static void soc_init_card_debugfs(struct snd_soc_card *card) { @@ -265,8 +264,8 @@ static void snd_soc_debugfs_init(void) &dai_list_fops)) pr_warn("ASoC: Failed to create DAI list debugfs file\n"); - if (!debugfs_create_file("platforms", 0444, snd_soc_debugfs_root, NULL, - &platform_list_fops)) + if (!debugfs_create_file("components", 0444, snd_soc_debugfs_root, NULL, + &component_list_fops)) pr_warn("ASoC: Failed to create platform list debugfs file\n"); } @@ -869,7 +868,6 @@ static int soc_bind_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link_component cpu_dai_component; struct snd_soc_component *component; struct snd_soc_dai **codec_dais; - struct snd_soc_platform *platform; struct device_node *platform_of_node; const char *platform_name; int i; @@ -937,23 +935,6 @@ static int soc_bind_dai_link(struct snd_soc_card *card, snd_soc_rtdcom_add(rtd, component); } - /* find one from the set of registered platforms */ - list_for_each_entry(platform, &platform_list, list) { - platform_of_node = platform->dev->of_node; - if (!platform_of_node && platform->dev->parent->of_node) - platform_of_node = platform->dev->parent->of_node; - - if (dai_link->platform_of_node) { - if (platform_of_node != dai_link->platform_of_node) - continue; - } else { - if (strcmp(platform->component.name, platform_name)) - continue; - } - - rtd->platform = platform; - } - soc_add_pcm_runtime(card, rtd); return 0; @@ -2309,24 +2290,6 @@ int snd_soc_add_codec_controls(struct snd_soc_codec *codec, EXPORT_SYMBOL_GPL(snd_soc_add_codec_controls); /** - * snd_soc_add_platform_controls - add an array of controls to a platform. - * Convenience function to add a list of controls. - * - * @platform: platform to add controls to - * @controls: array of controls to add - * @num_controls: number of elements in the array - * - * Return 0 for success, else error. - */ -int snd_soc_add_platform_controls(struct snd_soc_platform *platform, - const struct snd_kcontrol_new *controls, unsigned int num_controls) -{ - return snd_soc_add_component_controls(&platform->component, controls, - num_controls); -} -EXPORT_SYMBOL_GPL(snd_soc_add_platform_controls); - -/** * snd_soc_add_card_controls - add an array of controls to a SoC card. * Convenience function to add a list of controls. * @@ -2994,22 +2957,6 @@ static int snd_soc_component_stream_event(struct snd_soc_dapm_context *dapm, return component->driver->stream_event(component, event); } -static int snd_soc_component_drv_pcm_new(struct snd_soc_component *component, - struct snd_soc_pcm_runtime *rtd) -{ - if (component->driver->pcm_new) - return component->driver->pcm_new(rtd); - - return 0; -} - -static void snd_soc_component_drv_pcm_free(struct snd_soc_component *component, - struct snd_pcm *pcm) -{ - if (component->driver->pcm_free) - component->driver->pcm_free(pcm); -} - static int snd_soc_component_set_bias_level(struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) { @@ -3038,8 +2985,6 @@ static int snd_soc_component_initialize(struct snd_soc_component *component, component->set_sysclk = component->driver->set_sysclk; component->set_pll = component->driver->set_pll; component->set_jack = component->driver->set_jack; - component->pcm_new = snd_soc_component_drv_pcm_new; - component->pcm_free = snd_soc_component_drv_pcm_free; dapm = snd_soc_component_get_dapm(component); dapm->dev = dev; @@ -3299,164 +3244,6 @@ struct snd_soc_component *snd_soc_lookup_component(struct device *dev, } EXPORT_SYMBOL_GPL(snd_soc_lookup_component); -static int snd_soc_platform_drv_probe(struct snd_soc_component *component) -{ - struct snd_soc_platform *platform = snd_soc_component_to_platform(component); - - return platform->driver->probe(platform); -} - -static void snd_soc_platform_drv_remove(struct snd_soc_component *component) -{ - struct snd_soc_platform *platform = snd_soc_component_to_platform(component); - - platform->driver->remove(platform); -} - -static int snd_soc_platform_drv_pcm_new(struct snd_soc_component *component, - struct snd_soc_pcm_runtime *rtd) -{ - struct snd_soc_platform *platform = snd_soc_component_to_platform(component); - - if (platform->driver->pcm_new) - return platform->driver->pcm_new(rtd); - - return 0; -} - -static void snd_soc_platform_drv_pcm_free(struct snd_soc_component *component, - struct snd_pcm *pcm) -{ - struct snd_soc_platform *platform = snd_soc_component_to_platform(component); - - if (platform->driver->pcm_free) - platform->driver->pcm_free(pcm); -} - -/** - * snd_soc_add_platform - Add a platform to the ASoC core - * @dev: The parent device for the platform - * @platform: The platform to add - * @platform_drv: The driver for the platform - */ -int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform, - const struct snd_soc_platform_driver *platform_drv) -{ - int ret; - - ret = snd_soc_component_initialize(&platform->component, - &platform_drv->component_driver, dev); - if (ret) - return ret; - - platform->dev = dev; - platform->driver = platform_drv; - - if (platform_drv->probe) - platform->component.probe = snd_soc_platform_drv_probe; - if (platform_drv->remove) - platform->component.remove = snd_soc_platform_drv_remove; - if (platform_drv->pcm_new) - platform->component.pcm_new = snd_soc_platform_drv_pcm_new; - if (platform_drv->pcm_free) - platform->component.pcm_free = snd_soc_platform_drv_pcm_free; - -#ifdef CONFIG_DEBUG_FS - platform->component.debugfs_prefix = "platform"; -#endif - - mutex_lock(&client_mutex); - snd_soc_component_add_unlocked(&platform->component); - list_add(&platform->list, &platform_list); - mutex_unlock(&client_mutex); - - dev_dbg(dev, "ASoC: Registered platform '%s'\n", - platform->component.name); - - return 0; -} -EXPORT_SYMBOL_GPL(snd_soc_add_platform); - -/** - * snd_soc_register_platform - Register a platform with the ASoC core - * - * @dev: The device for the platform - * @platform_drv: The driver for the platform - */ -int snd_soc_register_platform(struct device *dev, - const struct snd_soc_platform_driver *platform_drv) -{ - struct snd_soc_platform *platform; - int ret; - - dev_dbg(dev, "ASoC: platform register %s\n", dev_name(dev)); - - platform = kzalloc(sizeof(struct snd_soc_platform), GFP_KERNEL); - if (platform == NULL) - return -ENOMEM; - - ret = snd_soc_add_platform(dev, platform, platform_drv); - if (ret) - kfree(platform); - - return ret; -} -EXPORT_SYMBOL_GPL(snd_soc_register_platform); - -/** - * snd_soc_remove_platform - Remove a platform from the ASoC core - * @platform: the platform to remove - */ -void snd_soc_remove_platform(struct snd_soc_platform *platform) -{ - - mutex_lock(&client_mutex); - list_del(&platform->list); - snd_soc_component_del_unlocked(&platform->component); - mutex_unlock(&client_mutex); - - dev_dbg(platform->dev, "ASoC: Unregistered platform '%s'\n", - platform->component.name); - - snd_soc_component_cleanup(&platform->component); -} -EXPORT_SYMBOL_GPL(snd_soc_remove_platform); - -struct snd_soc_platform *snd_soc_lookup_platform(struct device *dev) -{ - struct snd_soc_platform *platform; - - mutex_lock(&client_mutex); - list_for_each_entry(platform, &platform_list, list) { - if (dev == platform->dev) { - mutex_unlock(&client_mutex); - return platform; - } - } - mutex_unlock(&client_mutex); - - return NULL; -} -EXPORT_SYMBOL_GPL(snd_soc_lookup_platform); - -/** - * snd_soc_unregister_platform - Unregister a platform from the ASoC core - * - * @dev: platform to unregister - */ -void snd_soc_unregister_platform(struct device *dev) -{ - struct snd_soc_platform *platform; - - platform = snd_soc_lookup_platform(dev); - if (!platform) - return; - - snd_soc_remove_platform(platform); - kfree(platform); -} -EXPORT_SYMBOL_GPL(snd_soc_unregister_platform); - static int snd_soc_codec_drv_probe(struct snd_soc_component *component) { struct snd_soc_codec *codec = snd_soc_component_to_codec(component); diff --git a/sound/soc/soc-devres.c b/sound/soc/soc-devres.c index a57921e..7ac745d 100644 --- a/sound/soc/soc-devres.c +++ b/sound/soc/soc-devres.c @@ -52,41 +52,6 @@ int devm_snd_soc_register_component(struct device *dev, } EXPORT_SYMBOL_GPL(devm_snd_soc_register_component); -static void devm_platform_release(struct device *dev, void *res) -{ - snd_soc_unregister_platform(*(struct device **)res); -} - -/** - * devm_snd_soc_register_platform - resource managed platform registration - * @dev: Device used to manage platform - * @platform_drv: platform to register - * - * Register a platform driver with automatic unregistration when the device is - * unregistered. - */ -int devm_snd_soc_register_platform(struct device *dev, - const struct snd_soc_platform_driver *platform_drv) -{ - struct device **ptr; - int ret; - - ptr = devres_alloc(devm_platform_release, sizeof(*ptr), GFP_KERNEL); - if (!ptr) - return -ENOMEM; - - ret = snd_soc_register_platform(dev, platform_drv); - if (ret == 0) { - *ptr = dev; - devres_add(dev, ptr); - } else { - devres_free(ptr); - } - - return ret; -} -EXPORT_SYMBOL_GPL(devm_snd_soc_register_platform); - static void devm_card_release(struct device *dev, void *res) { snd_soc_unregister_card(*(struct snd_soc_card **)res); diff --git a/sound/soc/soc-io.c b/sound/soc/soc-io.c index d36a192..c92a04b 100644 --- a/sound/soc/soc-io.c +++ b/sound/soc/soc-io.c @@ -267,24 +267,3 @@ int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned int reg, return snd_soc_component_test_bits(&codec->component, reg, mask, value); } EXPORT_SYMBOL_GPL(snd_soc_test_bits); - -int snd_soc_platform_read(struct snd_soc_platform *platform, - unsigned int reg) -{ - unsigned int val; - int ret; - - ret = snd_soc_component_read(&platform->component, reg, &val); - if (ret < 0) - return -1; - - return val; -} -EXPORT_SYMBOL_GPL(snd_soc_platform_read); - -int snd_soc_platform_write(struct snd_soc_platform *platform, - unsigned int reg, unsigned int val) -{ - return snd_soc_component_write(&platform->component, reg, val); -} -EXPORT_SYMBOL_GPL(snd_soc_platform_write); diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 68d9dc9..6e6efa8 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -462,7 +462,6 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_pcm_runtime *runtime = substream->runtime; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; @@ -492,23 +491,10 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) } } - if (platform && platform->driver->ops && platform->driver->ops->open) { - ret = platform->driver->ops->open(substream); - if (ret < 0) { - dev_err(platform->dev, "ASoC: can't open platform" - " %s: %d\n", platform->component.name, ret); - goto platform_err; - } - } - ret = 0; for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->ops || !component->driver->ops->open) continue; @@ -634,10 +620,6 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->ops || !component->driver->ops->close) continue; @@ -645,10 +627,6 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) component->driver->ops->close(substream); } - if (platform && platform->driver->ops && platform->driver->ops->close) - platform->driver->ops->close(substream); - -platform_err: if (cpu_dai->driver->ops->shutdown) cpu_dai->driver->ops->shutdown(substream, cpu_dai); out: @@ -707,7 +685,6 @@ static void close_delayed_work(struct work_struct *work) static int soc_pcm_close(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; @@ -742,16 +719,9 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) if (rtd->dai_link->ops->shutdown) rtd->dai_link->ops->shutdown(substream); - if (platform && platform->driver->ops && platform->driver->ops->close) - platform->driver->ops->close(substream); - for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->ops || !component->driver->ops->close) continue; @@ -805,7 +775,6 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) static int soc_pcm_prepare(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; @@ -823,22 +792,9 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) } } - if (platform && platform->driver->ops && platform->driver->ops->prepare) { - ret = platform->driver->ops->prepare(substream); - if (ret < 0) { - dev_err(platform->dev, "ASoC: platform prepare error:" - " %d\n", ret); - goto out; - } - } - for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->ops || !component->driver->ops->prepare) continue; @@ -932,7 +888,6 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; @@ -994,23 +949,10 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, if (ret < 0) goto interface_err; - if (platform && platform->driver->ops && platform->driver->ops->hw_params) { - ret = platform->driver->ops->hw_params(substream, params); - if (ret < 0) { - dev_err(platform->dev, "ASoC: %s hw params failed: %d\n", - platform->component.name, ret); - goto platform_err; - } - } - ret = 0; for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->ops || !component->driver->ops->hw_params) continue; @@ -1043,10 +985,6 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->ops || !component->driver->ops->hw_free) continue; @@ -1054,10 +992,6 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, component->driver->ops->hw_free(substream); } - if (platform && platform->driver->ops && platform->driver->ops->hw_free) - platform->driver->ops->hw_free(substream); - -platform_err: if (cpu_dai->driver->ops->hw_free) cpu_dai->driver->ops->hw_free(substream, cpu_dai); @@ -1085,7 +1019,6 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, static int soc_pcm_hw_free(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; @@ -1123,18 +1056,10 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream) if (rtd->dai_link->ops->hw_free) rtd->dai_link->ops->hw_free(substream); - /* free any DMA resources */ - if (platform && platform->driver->ops && platform->driver->ops->hw_free) - platform->driver->ops->hw_free(substream); - /* free any component resources */ for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->ops || !component->driver->ops->hw_free) continue; @@ -1159,7 +1084,6 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream) static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; @@ -1176,19 +1100,9 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) } } - if (platform && platform->driver->ops && platform->driver->ops->trigger) { - ret = platform->driver->ops->trigger(substream, cmd); - if (ret < 0) - return ret; - } - for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->ops || !component->driver->ops->trigger) continue; @@ -1246,7 +1160,6 @@ static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream, static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; @@ -1257,16 +1170,9 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream) snd_pcm_sframes_t codec_delay = 0; int i; - if (platform && platform->driver->ops && platform->driver->ops->pointer) - offset = platform->driver->ops->pointer(substream); - for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->ops || !component->driver->ops->pointer) continue; @@ -2470,20 +2376,12 @@ static int soc_pcm_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_component *component; struct snd_soc_rtdcom_list *rtdcom; - if (platform && platform->driver->ops && platform->driver->ops->ioctl) - return platform->driver->ops->ioctl(substream, cmd, arg); - for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - /* ignore duplication for now */ - if (platform && (component == &platform->component)) - continue; - if (!component->driver->ops || !component->driver->ops->ioctl) continue; @@ -2847,8 +2745,8 @@ static void soc_pcm_private_free(struct snd_pcm *pcm) for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - if (component->pcm_free) - component->pcm_free(component, pcm); + if (component->driver->pcm_free) + component->driver->pcm_free(pcm); } } @@ -2987,7 +2885,6 @@ static int soc_rtdcom_mmap(struct snd_pcm_substream *substream, /* create a new pcm */ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) { - struct snd_soc_platform *platform = rtd->platform; struct snd_soc_dai *codec_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_component *component; @@ -3106,16 +3003,6 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) rtd->ops.mmap = soc_rtdcom_mmap; } - /* overwrite */ - if (platform && platform->driver->ops) { - rtd->ops.ack = platform->driver->ops->ack; - rtd->ops.copy_user = platform->driver->ops->copy_user; - rtd->ops.copy_kernel = platform->driver->ops->copy_kernel; - rtd->ops.fill_silence = platform->driver->ops->fill_silence; - rtd->ops.page = platform->driver->ops->page; - rtd->ops.mmap = platform->driver->ops->mmap; - } - if (playback) snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &rtd->ops); @@ -3125,10 +3012,10 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) for_each_rtdcom(rtd, rtdcom) { component = rtdcom->component; - if (!component->pcm_new) + if (!component->driver->pcm_new) continue; - ret = component->pcm_new(component, rtd); + ret = component->driver->pcm_new(rtd); if (ret < 0) { dev_err(component->dev, "ASoC: pcm constructor failed: %d\n",