From patchwork Mon Nov 30 11:37:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 7723321 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 7C7819F387 for ; Mon, 30 Nov 2015 11:37:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A7D58204E0 for ; Mon, 30 Nov 2015 11:37:32 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 6891620534 for ; Mon, 30 Nov 2015 11:37:31 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 68DCA265015; Mon, 30 Nov 2015 12:37:28 +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 E45382619E3; Mon, 30 Nov 2015 12:37:24 +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 ABD48261AB0; Mon, 30 Nov 2015 12:37:23 +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 3B451261560 for ; Mon, 30 Nov 2015 12:37:18 +0100 (CET) Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 2561482294; Mon, 30 Nov 2015 12:37:18 +0100 (CET) Date: Mon, 30 Nov 2015 12:37:17 +0100 From: Pavel Machek To: Charles Keepax Message-ID: <20151130113717.GB32172@amd> References: <20150914115439.GA29646@amd> <20150914115255.GE11200@ck-lbox> <20151012090045.GA7448@amd> <20151012113702.GC8805@ck-lbox> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20151012113702.GC8805@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-card support for arizona-core 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! Add support for than one arizona. We introduce codec_num and fill it based on device tree. If there's better way, let me know. (For v4.2, but I believe nothing changed there. And yes, I'd need to document the dt binding. Will do if the rest of patch is ok.) Signed-off-by: Pavel Machek diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index a72ddb2..4f9dbd8 100644 --- a/drivers/mfd/arizona-core.c +++ b/drivers/mfd/arizona-core.c @@ -755,7 +755,15 @@ static int arizona_of_get_core_pdata(struct arizona *arizona) int ret, i; int count = 0; + ret = of_property_read_u32(arizona->dev->of_node, + "wlf,codec-number", &arizona->pdata.codec_num); + if (ret < 0) { + dev_info(arizona->dev, "No codec-number property in DT => single-codec mode\n"); + arizona->pdata.codec_num = -1; + } else { + dev_info(arizona->dev, "codec-number from DT: %d\n", arizona->pdata.codec_num); + } ret = of_property_read_u32_array(arizona->dev->of_node, "wlf,gpio-defaults", arizona->pdata.gpio_defaults, @@ -925,7 +952,7 @@ int arizona_dev_init(struct arizona *arizona) /* Mark DCVDD as external, LDO1 driver will clear if internal */ arizona->external_dcvdd = true; - ret = mfd_add_devices(arizona->dev, -1, early_devs, + ret = mfd_add_devices(arizona->dev, arizona->pdata.codec_num, early_devs, ARRAY_SIZE(early_devs), NULL, 0, NULL); if (ret != 0) { dev_err(dev, "Failed to add early children: %d\n", ret); @@ -1259,9 +1286,12 @@ int arizona_dev_init(struct arizona *arizona) arizona_request_irq(arizona, ARIZONA_IRQ_UNDERCLOCKED, "Underclocked", arizona_underclocked, arizona); + // FIXME: multiple codec handling only added for WM5102 switch (arizona->type) { case WM5102: - ret = mfd_add_devices(arizona->dev, -1, wm5102_devs, + printk("arizona: wm5102, working with device %d\n", arizona->pdata.codec_num); + + ret = mfd_add_devices(arizona->dev, arizona->pdata.codec_num, wm5102_devs, ARRAY_SIZE(wm5102_devs), NULL, 0, NULL); break; case WM5110: diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h index 43db4fa..b36a750 100644 --- a/include/linux/mfd/arizona/pdata.h +++ b/include/linux/mfd/arizona/pdata.h @@ -75,6 +75,8 @@ struct arizona_micd_range { }; struct arizona_pdata { + int codec_num; // -1: n/a (=> single codec only) ; 1 or 2: codec #1 or #2 (=> two codecs) + int reset; /** GPIO controlling /RESET, if any */ int ldoena; /** GPIO controlling LODENA, if any */