From patchwork Mon Oct 12 09:00:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 7373391 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 E5D239F1B9 for ; Mon, 12 Oct 2015 09:01:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0BEA020806 for ; Mon, 12 Oct 2015 09:01:31 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id BE797207FE for ; Mon, 12 Oct 2015 09:01:29 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id D6843260661; Mon, 12 Oct 2015 11:01:28 +0200 (CEST) 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,NO_DNS_FOR_FROM, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 350D126044B; Mon, 12 Oct 2015 11:01:15 +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 42E48260506; Mon, 12 Oct 2015 11:01:14 +0200 (CEST) Received: from atrey.karlin.mff.cuni.cz (atrey.karlin.mff.cuni.cz [195.113.26.193]) by alsa0.perex.cz (Postfix) with ESMTP id E0DF426040E for ; Mon, 12 Oct 2015 11:01:07 +0200 (CEST) Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 837EB82187; Mon, 12 Oct 2015 11:00:46 +0200 (CEST) Date: Mon, 12 Oct 2015 11:00:45 +0200 From: Pavel Machek To: Charles Keepax Message-ID: <20151012090045.GA7448@amd> References: <20150914115439.GA29646@amd> <20150914115255.GE11200@ck-lbox> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150914115255.GE11200@ck-lbox> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: alsa-devel@alsa-project.org, tiwai@suse.de, linux-kernel@vger.kernel.org, patches@opensource.wolfsonmicro.com, lgirdwood@gmail.com, broonie@kernel.org Subject: [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! > I guess you would need to be careful with the machine driver as > well, you will need to use a snd_soc_codec_conf structure for at > least one (although I would do both) of the CODECs to give a > prefix for all the widget/control names, otherwise those will > clash and everything will probably behave very strangely. See > sound/soc/samsung/bells.c for an example doing this for wm9081. wm9081 is indeed useful example. Does this look like a step in right direction? Thanks, Pavel diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c index 81d8681..2be9513 100644 --- a/drivers/regulator/arizona-ldo1.c +++ b/drivers/regulator/arizona-ldo1.c @@ -27,13 +27,17 @@ #include struct arizona_ldo1 { + char name[99]; struct regulator_dev *regulator; struct arizona *arizona; + struct regulator_desc desc; struct regulator_consumer_supply supply; struct regulator_init_data init_data; }; + + static int arizona_ldo1_hc_list_voltage(struct regulator_dev *rdev, unsigned int selector) { @@ -121,7 +125,6 @@ static struct regulator_ops arizona_ldo1_hc_ops = { }; static const struct regulator_desc arizona_ldo1_hc = { - .name = "LDO1", .supply_name = "LDOVDD", .type = REGULATOR_VOLTAGE, .ops = &arizona_ldo1_hc_ops, @@ -146,7 +149,6 @@ static struct regulator_ops arizona_ldo1_ops = { }; static const struct regulator_desc arizona_ldo1 = { - .name = "LDO1", .supply_name = "LDOVDD", .type = REGULATOR_VOLTAGE, .ops = &arizona_ldo1_ops, @@ -183,8 +185,8 @@ static const struct regulator_init_data arizona_ldo1_default = { static int arizona_ldo1_probe(struct platform_device *pdev) { struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); - const struct regulator_desc *desc; struct regulator_config config = { }; + int id = 0; struct arizona_ldo1 *ldo1; int ret; @@ -194,8 +196,10 @@ static int arizona_ldo1_probe(struct platform_device *pdev) return -ENOMEM; } + + + printk("Initializing arizona-ldo1 for codec %d\n", id); ldo1->arizona = arizona; - /* * Since the chip usually supplies itself we provide some * default init_data for it. This will be overridden with @@ -203,15 +207,18 @@ static int arizona_ldo1_probe(struct platform_device *pdev) */ switch (arizona->type) { case WM5102: - desc = &arizona_ldo1_hc; ldo1->init_data = arizona_ldo1_dvfs; + ldo1->desc = arizona_ldo1_hc; break; default: - desc = &arizona_ldo1; ldo1->init_data = arizona_ldo1_default; + ldo1->desc = arizona_ldo1; break; } + ldo1->desc.name = ldo1->name; + sprintf(ldo1->name, "LDO1_%d", id); + ldo1->init_data.consumer_supplies = &ldo1->supply; ldo1->supply.supply = "DCVDD"; ldo1->supply.dev_name = dev_name(arizona->dev); @@ -226,7 +233,7 @@ static int arizona_ldo1_probe(struct platform_device *pdev) else config.init_data = &ldo1->init_data; - ldo1->regulator = regulator_register(desc, &config); + ldo1->regulator = regulator_register(&ldo1->desc, &config); if (IS_ERR(ldo1->regulator)) { ret = PTR_ERR(ldo1->regulator); dev_err(arizona->dev, "Failed to register LDO1 supply: %d\n",