Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp856330imu; Tue, 20 Nov 2018 08:00:50 -0800 (PST) X-Google-Smtp-Source: AJdET5du7uYQtdkSdUTATYp76kvn7X3UaR4ufKrxfSQpFRPVnNoV+H+kHenyKu1kY+z48Fq9Mvja X-Received: by 2002:a62:5343:: with SMTP id h64-v6mr2724097pfb.226.1542729650549; Tue, 20 Nov 2018 08:00:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542729650; cv=none; d=google.com; s=arc-20160816; b=uvTynYpuxa+5VI53IsZPbYMRRW77yEoPTK6rHMRq28kEYwTJnF47qrCYaSbDajzRbr bx2EFm+QxGGs2PgOGMp2HkRKgkiV5keixrbqFWS5FrmKevhuaDYLWYLi5Jr4znoOKfyu vrWt9DttPgc/fvNi3cQSXZAyz/fhfcD5xTvf2/nfPsOkN4Wsy/HTDAy9BYFmlLMKtoT2 dhfIBmU22m7rCFAxymN5qt2aMxOFFM2b/UT5Wnryb+SPTi9a4aM4k/6potW9C69OPL7s ANwXlvG0DHj66SoI1XjsZpnQFq//DLeSZmEx9wv+LeRIc52G8npRnsZd4kEw/ZOlrgiU M0GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:cc:to:subject:dkim-signature:dkim-filter; bh=+mfFu0bs0CraK4PPP//RQD6+IHITJ+E9umpNAcCFgPY=; b=KnuPTCMC2HZKLv4A6a2dbhvHRzWzPi9k0OLyJ8LefjZrc/HPqGgREfhAvx8wjh4igK yO2Stpm6qoT1jLkBtjPwUw/QfK2HpXO0yKUIACPlAOlLtf1b7LwFn6vipCjF7vVy9EsP dmlyaz2Q4ilp5WJHwBD8QftT4q+F0gjQDveCzlKLeXTRRIPbyIH76Ezqlc9GE5VeSdHn r5V/+YVXVOH+WYkyM43YqworVdkNvKRXNfaaPpd3mcVGVbjZPuF968mXdYS5OQx0KYsT 71luSPb13hiQoVsBaUCtRF/OsMyXRKbKOQUCGtZwVt5x2skpSdZzhNTZuWe5aixxKRRk Vt6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="Tqgw/ve3"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 26si19361093pgq.402.2018.11.20.08.00.35; Tue, 20 Nov 2018 08:00:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="Tqgw/ve3"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729165AbeKUAMy (ORCPT + 99 others); Tue, 20 Nov 2018 19:12:54 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:39349 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726153AbeKUAMv (ORCPT ); Tue, 20 Nov 2018 19:12:51 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181120134336euoutp0216b51c963cef52e1dea5e54963546c99~o2PRM_fzu0170001700euoutp02_ for ; Tue, 20 Nov 2018 13:43:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181120134336euoutp0216b51c963cef52e1dea5e54963546c99~o2PRM_fzu0170001700euoutp02_ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1542721416; bh=+mfFu0bs0CraK4PPP//RQD6+IHITJ+E9umpNAcCFgPY=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=Tqgw/ve3x9Sv126BVhaAbUrgffabl7s8wEFUGxy3MqS7S1OnoJ+fixTC0QeZvXHCY RwQXSIut+i0Flnc8QlFbprvTyxxXpzA487ukoBPt9+jowD7Ez8MaZPdEcI2Q0RJ3Uf 3BY6EIPqW29LcRBoEzFPHE+/M6iRxw5ScATar7BQ= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181120134335eucas1p24c215e9da768061e4917fa69e795e2c3~o2PQVIEa-1031010310eucas1p2P; Tue, 20 Nov 2018 13:43:35 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 13.7C.04806.68F04FB5; Tue, 20 Nov 2018 13:43:34 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20181120134333eucas1p27a19912dddf4b9b34da505e0973c9137~o2PPAZGzR1898418984eucas1p2V; Tue, 20 Nov 2018 13:43:33 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20181120134333eusmtrp11992d67bae425cf9f61ffe484eea2376~o2POx74os2449524495eusmtrp1s; Tue, 20 Nov 2018 13:43:33 +0000 (GMT) X-AuditID: cbfec7f5-34dff700000012c6-e5-5bf40f86b4a8 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 78.C8.04284.58F04FB5; Tue, 20 Nov 2018 13:43:33 +0000 (GMT) Received: from [106.116.147.30] (unknown [106.116.147.30]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181120134333eusmtip246e4ae01df7f5ec36a09b3c70ccd9e95~o2POVpmJR0771907719eusmtip2E; Tue, 20 Nov 2018 13:43:33 +0000 (GMT) Subject: Re: Applied "regulator: wm8994: Pass descriptor instead of GPIO number" to the regulator tree To: Mark Brown , Linus Walleij Cc: Charles Keepax , Lee Jones , Liam Girdwood , linux-kernel@vger.kernel.org, patches@opensource.cirrus.com From: Marek Szyprowski Message-ID: <66d3b74c-0152-b17b-89d4-a21d33445b25@samsung.com> Date: Tue, 20 Nov 2018 14:43:32 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20180517164120.485F844007E@finisterre.ee.mobilebroadband> Content-Transfer-Encoding: 8bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA02SbUhTYRiGfXfOzjlaJ183zQe1skFRkV8ZNLAso2g/Qksiowm19DA1v9jU Un8kaGqiFmp+rIFBmmGhJSpmqTlxMwTxO7+t8E+JmW1a4bQ8Hi3/3ff13A/3+8DLEJJqsQsT GZvAaWJV0TLKjmw0/u7xyLS3KL0/dHnKH36aoeSDd+uQfHqxE8mXBrNF8iJrlUg+0Kyn5Ob5 NvEpWvFaN0kr6qrvUYqJ4beUokT/BynMdbsviK/aHQ/noiOTOI2X/3W7iO+tq6L46fO3838N 0mlo6mQOsmUAH4XKz+N0DrJjJPgZgsZ0IyEYC4LK0uINY0awlD4s3lx5kv9ULAyqEFi/lVOC mUfQv7JA8ikpjoKhlWGK1444CF5aShAfInAzgrG2ApofUNgHcuZy1kIMw2J/mM9HPCbxPjB3 ZZA8dsKh8GIwiMcsdoD3ZTPr2Bafg+emUB4TeA+kNzwiBO0MYzPlIr4JcCMNWaZpSnj0Gei5 byAELYWvpnpa0G7QXZhLCgvpCLJKdbRgchE06Js2tv2gw9Qn5psJfBBqm70EHADG0Y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CKaPiYNTqoHRb/e62rDdy43jC/8tsvm0l01X+q+DoBp74UqR B3/PJbq1++6dunMv24d/KXfFOB++P3hZeeapK8mLoxRz3Vva1vSGMPw4tX2RzN6junue9Xs+ kE2N/8Xscu5YxXLhO6c5ogzlE49+yi4/8vqf175np1d8yKxL0woKmXHjWZrw+9XHy4M0NeUn K7EUZyQaajEXFScCAEYEWMXOAgAA X-CMS-MailID: 20181120134333eucas1p27a19912dddf4b9b34da505e0973c9137 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20181120134333eucas1p27a19912dddf4b9b34da505e0973c9137 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181120134333eucas1p27a19912dddf4b9b34da505e0973c9137 References: <20180517164120.485F844007E@finisterre.ee.mobilebroadband> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi All, On 2018-05-17 18:41, Mark Brown wrote: > The patch > > regulator: wm8994: Pass descriptor instead of GPIO number > > has been applied to the regulator tree at > > https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git > > All being well this means that it will be integrated into the linux-next > tree (usually sometime in the next 24 hours) and sent to Linus during > the next merge window (or sooner if it is a bug fix), however if > problems are discovered then the patch may be dropped or reverted. > > You may get further e-mails resulting from automated or manual testing > and review of the tree, please engage with people reporting problems and > send followup patches addressing any issues that are reported if needed. > > If any updates are required or you are submitting further changes they > should be sent as incremental updates against current git, existing > patches will not be replaced. > > Please add any relevant lists and maintainers to the CCs when replying > to this mail. > > Thanks, > Mark > > >From 3c6b38d45fa51c7c51c5e2347fc1a6bef6a46525 Mon Sep 17 00:00:00 2001 > From: Linus Walleij > Date: Mon, 14 May 2018 10:06:34 +0200 > Subject: [PATCH] regulator: wm8994: Pass descriptor instead of GPIO number > > Instead of passing a global GPIO number for the enable GPIO, pass > a descriptor looked up from the device tree node or the board file > decriptor table for the regulator. > > There is a single board file passing the GPIOs for LDO1 and LDO2 > through platform data, so augment this to pass descriptors > associated with the i2c device as well. > > The special GPIO enable DT property for the enable GPIO is > nonstandard but this was accomodated in > commit 6a537d48461deacc57c07ed86d9915e5aa4b3539 > "gpio: of: Support regulator nonstandard GPIO properties". > > Signed-off-by: Linus Walleij > Acked-by: Charles Keepax > Acked-by: Lee Jones > Signed-off-by: Mark Brown This patch causes following kernel warning on Samsung Exynos4412 based Trats2 board: wm8994 4-001a: Failed to get supply 'DBVDD1': -517 wm8994 4-001a: Failed to get supplies: -517 ------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at drivers/gpio/gpiolib.c:2421 release_nodes+0x178/0x1fc Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.20.0-rc3-next-20181120-00009-g6917effde9ad #1085 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x98/0xc4) [] (dump_stack) from [] (__warn+0x10c/0x124) [] (__warn) from [] (warn_slowpath_null+0x40/0x48) [] (warn_slowpath_null) from [] (release_nodes+0x178/0x1fc) [] (release_nodes) from [] (really_probe+0xe8/0x400) [] (really_probe) from [] (driver_probe_device+0x78/0x1b8) [] (driver_probe_device) from [] (__driver_attach+0x128/0x144) [] (__driver_attach) from [] (bus_for_each_dev+0x68/0xb4) [] (bus_for_each_dev) from [] (bus_add_driver+0x1a8/0x268) [] (bus_add_driver) from [] (driver_register+0x78/0x10c) [] (driver_register) from [] (i2c_register_driver+0x3c/0xa8) [] (i2c_register_driver) from [] (do_one_initcall+0x8c/0x410) [] (do_one_initcall) from [] (kernel_init_freeable+0x3c8/0x4d0) [] (kernel_init_freeable) from [] (kernel_init+0x8/0x10c) [] (kernel_init) from [] (ret_from_fork+0x14/0x20) Exception stack(0xef0e3fb0 to 0xef0e3ff8) 3fa0:                                     00000000 00000000 00000000 00000000 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000 irq event stamp: 177215 hardirqs last  enabled at (177223): [] console_unlock+0x4ac/0x698 hardirqs last disabled at (177242): [] console_unlock+0xcc/0x698 softirqs last  enabled at (177260): [] __do_softirq+0x4f0/0x5e0 softirqs last disabled at (177251): [] irq_exit+0x160/0x16c ---[ end trace ed3dd4223b822796 ]--- > --- > arch/arm/mach-s3c64xx/mach-crag6410-module.c | 17 +++++++++++++++-- > drivers/mfd/wm8994-core.c | 9 --------- > drivers/regulator/wm8994-regulator.c | 19 +++++++++++-------- > include/linux/mfd/wm8994/pdata.h | 3 --- > 4 files changed, 26 insertions(+), 22 deletions(-) > > diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c > index 5aa472892465..76c4855a03bc 100644 > --- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c > +++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c > @@ -194,8 +194,8 @@ static struct wm8994_pdata wm8994_pdata = { > 0x3, /* IRQ out, active high, CMOS */ > }, > .ldo = { > - { .enable = S3C64XX_GPN(6), .init_data = &wm8994_ldo1, }, > - { .enable = S3C64XX_GPN(4), .init_data = &wm8994_ldo2, }, > + { .init_data = &wm8994_ldo1, }, > + { .init_data = &wm8994_ldo2, }, > }, > }; > > @@ -203,6 +203,18 @@ static const struct i2c_board_info wm1277_devs[] = { > { I2C_BOARD_INFO("wm8958", 0x1a), /* WM8958 is the superset */ > .platform_data = &wm8994_pdata, > .irq = GLENFARCLAS_PMIC_IRQ_BASE + WM831X_IRQ_GPIO_2, > + .dev_name = "wm8958", > + }, > +}; > + > +static struct gpiod_lookup_table wm8994_gpiod_table = { > + .dev_id = "i2c-wm8958", /* I2C device name */ > + .table = { > + GPIO_LOOKUP("GPION", 6, > + "wlf,ldo1ena", GPIO_ACTIVE_HIGH), > + GPIO_LOOKUP("GPION", 4, > + "wlf,ldo2ena", GPIO_ACTIVE_HIGH), > + { }, > }, > }; > > @@ -381,6 +393,7 @@ static int wlf_gf_module_probe(struct i2c_client *i2c, > > gpiod_add_lookup_table(&wm5102_reva_gpiod_table); > gpiod_add_lookup_table(&wm5102_gpiod_table); > + gpiod_add_lookup_table(&wm8994_gpiod_table); > > if (i < ARRAY_SIZE(gf_mods)) { > dev_info(&i2c->dev, "%s revision %d\n", > diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c > index 953d0790ffd5..c409464231f6 100644 > --- a/drivers/mfd/wm8994-core.c > +++ b/drivers/mfd/wm8994-core.c > @@ -21,7 +21,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -302,14 +301,6 @@ static int wm8994_set_pdata_from_of(struct wm8994 *wm8994) > if (of_find_property(np, "wlf,ldoena-always-driven", NULL)) > pdata->lineout2fb = true; > > - pdata->ldo[0].enable = of_get_named_gpio(np, "wlf,ldo1ena", 0); > - if (pdata->ldo[0].enable < 0) > - pdata->ldo[0].enable = 0; > - > - pdata->ldo[1].enable = of_get_named_gpio(np, "wlf,ldo2ena", 0); > - if (pdata->ldo[1].enable < 0) > - pdata->ldo[1].enable = 0; > - > return 0; > } > #else > diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c > index 7a4ce6df4f22..d3a5f48119c2 100644 > --- a/drivers/regulator/wm8994-regulator.c > +++ b/drivers/regulator/wm8994-regulator.c > @@ -19,7 +19,7 @@ > #include > #include > #include > -#include > +#include > #include > > #include > @@ -129,6 +129,7 @@ static int wm8994_ldo_probe(struct platform_device *pdev) > int id = pdev->id % ARRAY_SIZE(pdata->ldo); > struct regulator_config config = { }; > struct wm8994_ldo *ldo; > + struct gpio_desc *gpiod; > int ret; > > dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); > @@ -145,12 +146,14 @@ static int wm8994_ldo_probe(struct platform_device *pdev) > config.driver_data = ldo; > config.regmap = wm8994->regmap; > config.init_data = &ldo->init_data; > - if (pdata) { > - config.ena_gpio = pdata->ldo[id].enable; > - } else if (wm8994->dev->of_node) { > - config.ena_gpio = wm8994->pdata.ldo[id].enable; > - config.ena_gpio_initialized = true; > - } > + > + /* Look up LDO enable GPIO from the parent device node */ > + gpiod = devm_gpiod_get_optional(pdev->dev.parent, > + id ? "wlf,ldo2ena" : "wlf,ldo1ena", > + GPIOD_OUT_LOW); > + if (IS_ERR(gpiod)) > + return PTR_ERR(gpiod); > + config.ena_gpiod = gpiod; > > /* Use default constraints if none set up */ > if (!pdata || !pdata->ldo[id].init_data || wm8994->dev->of_node) { > @@ -159,7 +162,7 @@ static int wm8994_ldo_probe(struct platform_device *pdev) > > ldo->init_data = wm8994_ldo_default[id]; > ldo->init_data.consumer_supplies = &ldo->supply; > - if (!config.ena_gpio) > + if (!gpiod) > ldo->init_data.constraints.valid_ops_mask = 0; > } else { > ldo->init_data = *pdata->ldo[id].init_data; > diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h > index 90c60524a496..fca67bd194e2 100644 > --- a/include/linux/mfd/wm8994/pdata.h > +++ b/include/linux/mfd/wm8994/pdata.h > @@ -20,9 +20,6 @@ > #define WM8994_NUM_AIF 3 > > struct wm8994_ldo_pdata { > - /** GPIOs to enable regulator, 0 or less if not available */ > - int enable; > - > const struct regulator_init_data *init_data; > }; > > Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland