From patchwork Mon Nov 16 12:29:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 7624741 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 167699F443 for ; Mon, 16 Nov 2015 12:30:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2D36E205C4 for ; Mon, 16 Nov 2015 12:30:26 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id CED99205DD for ; Mon, 16 Nov 2015 12:30:24 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2EBC8261469; Mon, 16 Nov 2015 13:30:23 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 0D4FE26047B; Mon, 16 Nov 2015 13:30:15 +0100 (CET) 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 AFA9726049A; Mon, 16 Nov 2015 13:30:13 +0100 (CET) Received: from atrey.karlin.mff.cuni.cz (atrey.karlin.mff.cuni.cz [195.113.26.193]) by alsa0.perex.cz (Postfix) with ESMTP id 40C46260455 for ; Mon, 16 Nov 2015 13:30:08 +0100 (CET) Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 22AF68227A; Mon, 16 Nov 2015 13:29:48 +0100 (CET) Date: Mon, 16 Nov 2015 13:29:47 +0100 From: Pavel Machek To: Mark Brown Message-ID: <20151116122947.GA9125@amd> References: <20151113215812.GA19020@amd> <20151113225355.GU12392@sirena.org.uk> <20151114074400.GA7898@amd> <20151114123931.GW12392@sirena.org.uk> <20151114175915.GA20429@amd> <20151114184940.GY12392@sirena.org.uk> <20151114211633.GE20429@amd> <20151115001402.GZ12392@sirena.org.uk> <20151116074534.GA5606@amd> <20151116105035.GA31303@sirena.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20151116105035.GA31303@sirena.org.uk> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: alsa-devel@alsa-project.org, sameo@linux.intel.com, tiwai@suse.de, linux-kernel@vger.kernel.org, patches@opensource.wolfsonmicro.com, lgirdwood@gmail.com, Charles Keepax , lee.jones@linaro.org Subject: Re: [alsa-devel] multi-codec support for arizona-ldo1 was Re: System with multiple arizona (wm5102) codecs 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 Hi! > > > Every single sound driver gets this right, none of them assume the name > > > is global. What makes you say that they assume names are global? > > > Ok, so you are saying that if I fix mfd initialization, sound will > > automagically switch from global regulators to device-specific > > regulators and things will start working? > > Yes. Ok, so something like this should be applied? (I'm not sure how to test it, as audio works before and after the patch.) Thanks, Pavel Signed-off-by: Pavel Machek commit d6005263acb94343645e719ee90b8940cb2545df Author: Pavel Date: Mon Nov 16 13:19:21 2015 +0100 regulator_bulk_register() needs device to be already registered. Reorganize the code to make it so. diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 14fd5cb..e891f10 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -147,12 +147,6 @@ static int mfd_add_device(struct device *parent, int id, pdev->dev.dma_parms = parent->dma_parms; pdev->dev.coherent_dma_mask = parent->coherent_dma_mask; - ret = regulator_bulk_register_supply_alias( - &pdev->dev, cell->parent_supplies, - parent, cell->parent_supplies, - cell->num_parent_supplies); - if (ret < 0) - goto fail_res; if (parent->of_node && cell->of_compatible) { for_each_child_of_node(parent->of_node, np) { @@ -169,12 +176,12 @@ static int mfd_add_device(struct device *parent, int id, ret = platform_device_add_data(pdev, cell->platform_data, cell->pdata_size); if (ret) - goto fail_alias; + goto fail_res; } ret = mfd_platform_add_cell(pdev, cell, usage_count); if (ret) - goto fail_alias; + goto fail_res; for (r = 0; r < cell->num_resources; r++) { res[r].name = cell->resources[r].name; @@ -210,22 +217,29 @@ static int mfd_add_device(struct device *parent, int id, if (has_acpi_companion(&pdev->dev)) { ret = acpi_check_resource_conflict(&res[r]); if (ret) - goto fail_alias; + goto fail_res; } } } ret = platform_device_add_resources(pdev, res, cell->num_resources); if (ret) - goto fail_alias; + goto fail_res; ret = platform_device_add(pdev); if (ret) - goto fail_alias; + goto fail_res; if (cell->pm_runtime_no_callbacks) pm_runtime_no_callbacks(&pdev->dev); + ret = regulator_bulk_register_supply_alias( + &pdev->dev, cell->parent_supplies, + parent, cell->parent_supplies, + cell->num_parent_supplies); + if (ret < 0) + goto fail_alias; + kfree(res); return 0;