From patchwork Tue Aug 15 17:21:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 714901 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01FFDC04FDF for ; Tue, 15 Aug 2023 17:24:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238674AbjHORXw (ORCPT ); Tue, 15 Aug 2023 13:23:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238865AbjHORXk (ORCPT ); Tue, 15 Aug 2023 13:23:40 -0400 Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [81.169.146.167]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B7881FF3; Tue, 15 Aug 2023 10:23:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692120072; cv=none; d=strato.com; s=strato-dkim-0002; b=LjNBfpMYkJD6E8uZwt1/TWtP94oC1u2Hd52LngNilcnYVbt2GgwSL/ewtd0h4/E59d /J0LFgrV5uiJbUk6acV9JmcpzHDZFoSMVoFMr3qCwkYyebxE0I4e2X7wWO7pSJ+xUp4Y WTt+aFVa2TwtxAVO1BBUGddlF7JoXlQAWWidOtBud8tCuetpuYXApODrrvKgL+O/6vo6 e5czqUYAUN9+9EqFNZnqCxGViRWKlRlWvIr4qp0yOCwFDJd2CKLspd/0uVZ+XVA6Et5v 3gr6LwK/SqIlL/61paj/FZSA6V01fGlwzfnyvFT48cHJqDEY4bCdQuSHMyzNaPNdmA0b 4SuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1692120072; s=strato-dkim-0002; d=strato.com; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=1Tw0Ebkmty7SEImEM7L+xAczx0yUboBxaEEYcuNXidU=; b=odvsy4oDdj7CLks15veq3MOyYeJ9dUnSnR3Pgk544kQU+Q1gO91n8z6bfThOlS6/NI LUEjnfSu+81aat/I3Nxlsb0FGGpD8yWPz+LYoIUQPBmfbIkqWJb810xtNulq5PQ7yTCL OjAMlNUqshYQFFsoDXqlHpbkujOnBgRDFLX1C0KDPWEzIsKLbtuNi/upwLaAMvp7iUOg 6oDT4BdebeOUhqumX6oLCNMpxgKnRbdr0SokhVMgkvhtVMODppQqzvh9z4JlpWCOjiQZ p6ElqAydRWl+F75sfs4axSdXBd+bZEOn2LPy1hKiER/mSJgqchk0+6Rw7te1m5qGFE/2 2eTQ== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1692120072; s=strato-dkim-0002; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=1Tw0Ebkmty7SEImEM7L+xAczx0yUboBxaEEYcuNXidU=; b=pqbqg2TflsxNzlVhxoax2ZZp7RaF7vwTUJl73Mnap2vT9Jqhm+KAl21KpwYepwHz5S DpREBNTVLWMzqq8nJ4IuxAfIB3CS1Krxqh7xImg6juLWbaQUCV+DielF/BZlfbk43jDF TZS23t2UV8wfR5t2iBCdGKehl1GDFr8dstzBrUWTnKzrhkvwYkb19a1JOOv6IGEJFASN bsIHlJpHIUMM37Yo/f5DpfoQAxhy5u/M5UafHAKWIjoSesiacWTUxUyomSC7W7MH5F60 IRxuI2nHIHRUbTiIaaCMcUayjGWDFZvTig6dLLjLF7eU1Q0h0KCG2veWtDilJQ846KHD eOFA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1692120072; s=strato-dkim-0003; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=1Tw0Ebkmty7SEImEM7L+xAczx0yUboBxaEEYcuNXidU=; b=/j3lkMtCnRyTlkshS9q96+7GIS+NVM8QsLsI4SSyYDm/aRg9c5ZXVxEDwuIsrBmCgg 4pGxTGQqGXpBt6d+rTCQ== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVOQjVd4CteZ/7jYgS+mLFY+H0JAn8u4F1mw==" Received: from [192.168.244.3] by smtp.strato.de (RZmta 49.8.0 DYNA|AUTH) with ESMTPSA id v41b8bz7FHLB0YU (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 15 Aug 2023 19:21:11 +0200 (CEST) From: Stephan Gerhold Date: Tue, 15 Aug 2023 19:21:04 +0200 Subject: [PATCH v3 1/3] dt-bindings: leds: aw2013: Document interrupt MIME-Version: 1.0 Message-Id: <20230815-aw2013-vio-v3-1-2505296b0856@gerhold.net> References: <20230815-aw2013-vio-v3-0-2505296b0856@gerhold.net> In-Reply-To: <20230815-aw2013-vio-v3-0-2505296b0856@gerhold.net> To: Pavel Machek , Lee Jones Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nikita Travkin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, "Lin, Meng-Bo" , Stephan Gerhold X-Mailer: b4 0.12.3 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org AW2013 has an optional interrupt pin "INTN" which is used to report completion of started operations (e.g. power up or LED breath effects). The driver does not use it (yet) but it should be described for completeness inside the DT schema. Signed-off-by: Stephan Gerhold --- Documentation/devicetree/bindings/leds/leds-aw2013.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/leds/leds-aw2013.yaml b/Documentation/devicetree/bindings/leds/leds-aw2013.yaml index 08f3e1cfc1b1..a0a0dabcfbf3 100644 --- a/Documentation/devicetree/bindings/leds/leds-aw2013.yaml +++ b/Documentation/devicetree/bindings/leds/leds-aw2013.yaml @@ -20,6 +20,11 @@ properties: reg: maxItems: 1 + interrupts: + maxItems: 1 + description: Open-drain, low active interrupt pin "INTN". + Used to report completion of operations (power up, LED breath effects). + vcc-supply: description: Regulator providing power to the "VCC" pin. @@ -52,6 +57,7 @@ additionalProperties: false examples: - | #include + #include #include i2c { @@ -61,6 +67,7 @@ examples: led-controller@45 { compatible = "awinic,aw2013"; reg = <0x45>; + interrupts = <42 IRQ_TYPE_LEVEL_LOW>; #address-cells = <1>; #size-cells = <0>; From patchwork Tue Aug 15 17:21:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 713940 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4E8CC41513 for ; Tue, 15 Aug 2023 17:40:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238891AbjHORj3 (ORCPT ); Tue, 15 Aug 2023 13:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238910AbjHORjT (ORCPT ); Tue, 15 Aug 2023 13:39:19 -0400 X-Greylist: delayed 696 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 15 Aug 2023 10:39:17 PDT Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [85.215.255.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87E5BD1 for ; Tue, 15 Aug 2023 10:39:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692120072; cv=none; d=strato.com; s=strato-dkim-0002; b=FFWPbbPGCxBPNWSfAzf2SbeMSJkx4v1DZ3NFEGPLJiNNFHidJrMRcrRbewctFJOItV 8iX37sWvKl6t0tCkw22qFM2/dE2ocDjLIlNhpWQCHK3SYs0L+Nc4HZ74MMtG7++lgDqh 30c+wNRTslEPzoCd4yRWcIP/mqBPU95ztgzDe8ko8n+xElyG2FsY1HlbxyRl0Y4kFfdg u9Nlcc+Vngr7/Zw32EVO5fGonF550yob5mJw7gJkwY/CMSx4GMNGK5GgHkMfDgp81Kl3 HMJXaLcCgOQ1RmqzlkSFoZdDy3GqYjF7VI0549RoZD5TEQVTeiFrdBRO8bLDuninwOUY JHbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1692120072; s=strato-dkim-0002; d=strato.com; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=OvXjeQ3KhCC7JaRMJrhSDALEMowi+xqTH2TinBMCtJI=; b=D6+5WEgIDrnhd0VE4Eh6LHCy0vPTkP6IDO66QBU9Ael3Wdq3DV/g2ErMiBBFnnQioo SyYPct1Kza3sNIcsGe7YotTp+VnAOmdjRBpgEsLxJk42Ky8eYL/QwrUe1bV9sjKCU643 Gbm7qqbm0dAM062PAzlZ5jBYnR5LdYi19WCNQyH9nwISgH8TkiuAS0vjI71/Qj9wnGPi NAWh+zKPQUC7chQufXoQs6eSUPyD2Y6oeT9p7SDuGLfRW3E0ranC2Tp/dfn54sS8CFDr EQNC80flCxgBKsoI733g0SM2I/uXWbE1u8xcwskiNT1cfuvXEPFpvH6mgl8fJP+23o4J OiJA== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo02 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1692120072; s=strato-dkim-0002; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=OvXjeQ3KhCC7JaRMJrhSDALEMowi+xqTH2TinBMCtJI=; b=mef6YkzGbqLzk/v9Qs34e3e6mwrDglZdTn7hVEL1WVRX/FAK36MCV29l79oF6e8C5d nbByfm5+J/6HEwyXyDIlahFGDTsEMyv7GxeioyPAhTme47mZ4GA+6f9+vFbTSc0OvEMk BRCahe/xZNNicOjjnPayqseRih6yMYqjzhM9tuvNjAOuwn5H7F4LxipM8hz/nleZij+3 P/vYH56lIW4FY+IKnu/GXCc44v+xK6TFfQV7hMK2fJZWaIvrzAqWRX7S5qAEWOtrzVuf htodEceRxbv02f67gSiTgFUelXWU8/0g3RlAvHI9usbecB1dwpnA0vZnaNAdEwYtFTlo fqOw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1692120072; s=strato-dkim-0003; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=OvXjeQ3KhCC7JaRMJrhSDALEMowi+xqTH2TinBMCtJI=; b=iimXrnM/KNIli5yVYzOeJWkUZwqORTN6GA0GjFxMVLEPm8VH+XwhX11fTPB9NDLsNN U9h7kCDXBhQ2OX+BTsDQ== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVOQjVd4CteZ/7jYgS+mLFY+H0JAn8u4F1mw==" Received: from [192.168.244.3] by smtp.strato.de (RZmta 49.8.0 DYNA|AUTH) with ESMTPSA id v41b8bz7FHLC0YV (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 15 Aug 2023 19:21:12 +0200 (CEST) From: Stephan Gerhold Date: Tue, 15 Aug 2023 19:21:05 +0200 Subject: [PATCH v3 2/3] dt-bindings: leds: Document pull-up supply for interrupt and I2C MIME-Version: 1.0 Message-Id: <20230815-aw2013-vio-v3-2-2505296b0856@gerhold.net> References: <20230815-aw2013-vio-v3-0-2505296b0856@gerhold.net> In-Reply-To: <20230815-aw2013-vio-v3-0-2505296b0856@gerhold.net> To: Pavel Machek , Lee Jones Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nikita Travkin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, "Lin, Meng-Bo" , Stephan Gerhold X-Mailer: b4 0.12.3 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Since the interrupt and I2C lines of AW2013 operate in open drain low active mode a pull-up supply is needed for correct operation. Unfortunately there is no ideal place to describe it in the DT: The pull-up needed for the I2C lines could be described on the I2C bus. However, the pull-up needed for the interrupt line belongs neither directly to the interrupt controller nor to AW2013. Since the AW2013 driver will be typically in control of the power management and interrupt masking it makes more sense to describe it inside the AW2013 device tree node. Add it to the AW2013 DT schema together with a comment that makes it clear what exactly it represents. Signed-off-by: Stephan Gerhold Acked-by: Krzysztof Kozlowski --- Related previous discussion: https://lore.kernel.org/linux-leds/20230321220825.GA1685482-robh@kernel.org/ --- Documentation/devicetree/bindings/leds/leds-aw2013.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/leds/leds-aw2013.yaml b/Documentation/devicetree/bindings/leds/leds-aw2013.yaml index a0a0dabcfbf3..26238446f2bd 100644 --- a/Documentation/devicetree/bindings/leds/leds-aw2013.yaml +++ b/Documentation/devicetree/bindings/leds/leds-aw2013.yaml @@ -28,6 +28,12 @@ properties: vcc-supply: description: Regulator providing power to the "VCC" pin. + vio-supply: + description: Regulator providing power for pull-up of the I/O lines. + "VIO1" in the typical application circuit example of the datasheet. + Note that this regulator does not directly connect to AW2013, but is + needed for the correct operation of the interrupt and I2C lines. + "#address-cells": const: 1 From patchwork Tue Aug 15 17:21:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 713941 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0F04C04A6A for ; Tue, 15 Aug 2023 17:24:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233741AbjHORXw (ORCPT ); Tue, 15 Aug 2023 13:23:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238832AbjHORX1 (ORCPT ); Tue, 15 Aug 2023 13:23:27 -0400 Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [85.215.255.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FABD1FD3; Tue, 15 Aug 2023 10:22:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692120073; cv=none; d=strato.com; s=strato-dkim-0002; b=C012Y9qXc/PB1zJSuKZORoTQ+pQIARb8BSL3IL+khozXE6h/MmuLnKyRwRY81LhBJ7 cCTrygfcJHVvmDavaa0kSV2cHKkroYzS0Re07J2jCFilAErlmwnMgrabq0F8ua3KEmz+ KxJn7iUrmZtDdCVmEbhV244icE2GoLQCl7V6laEo39aaQ+lJvPGo4t57nqjO/I7bouYB /zPpoNqDyye7NAW1L/jhmcpoM3vWKO4V6KPwn1pPuEIiQkOfWdVb7VB4NsjFa5IXYyx4 8Di67VOIU/EF6EsL4Jg4SWGB4bdXl5ty2LK3dtsVj1k9+y6axciIRCPxaBMkfRvuMulh /Vug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1692120073; s=strato-dkim-0002; d=strato.com; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=vg0I1e+3Uavk5AFQsbqxBi73cjCoILcwb93qzM6Ocl8=; b=gUJ1GQgjzlWC1wGJO1eH8b7lgbi8+J8QAKngpc7/IhRYk6AJVDGN0HBsHWBXfwN/hi jqKog1ugCVKAFgmoZXXqhN1k8+BpdaemSjuNCvkRWPyT31MYhbkkVJL/7nMrp2GpcHfA 9VCKjosSjBTzigfUhUUHLwB+VG46MvBQQsyNNKs7MuCzgCtayFS4VAuv0+LKkyFztqha OgcVrstuVbm3EAVGztXrvR96YYB5TwwZp7UJkz/igL+PQqoikE3Ku23E3+dcmHAhIoxh gUKdnZum2eYlhco1+pLTXEyukYi0ueK8VGhPeU0Wu+RNgxhAd3X1nUmooTfrh6RjoUfh hGIQ== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo02 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1692120073; s=strato-dkim-0002; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=vg0I1e+3Uavk5AFQsbqxBi73cjCoILcwb93qzM6Ocl8=; b=rHoTgPtZI2N35HAGaKd54QCHSx3QG+OQFcg29WehMjxL8NK4SMGlvPoL7CzDQIZwkC cxmAasl8sgMA21U2xWgROR76pGciH3E+lUQ/bkruw8UJ68Otld8H1NirOXJ2LnR9MFq2 t/Q2chrWRcNu9zkEqY/f+HC4opX96ETb6uqAGrtMfkyWPhveC+UF0aVEVKkEK7pUhGpe ErfesW756Jsp/WL8RwlPzchosZclDmviBV8bSm9lqUDOKbaR6THOGLS7b2isRLJ+dAaz wGHjSHsb1zIstWfbiGSGjalP9WGM6DaodxMuiFn8BfTX84LjNPssTHqKJnHQAtSSNP0O TXlw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1692120073; s=strato-dkim-0003; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=vg0I1e+3Uavk5AFQsbqxBi73cjCoILcwb93qzM6Ocl8=; b=3vT5zvGpa/8MQOfthdNdZ8u3BRRLcK65sAslSIKXSVdqNQ3/i7kUxRidtucR6uWgkz kw8XHF0Al39Nxmt3POCA== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVOQjVd4CteZ/7jYgS+mLFY+H0JAn8u4F1mw==" Received: from [192.168.244.3] by smtp.strato.de (RZmta 49.8.0 DYNA|AUTH) with ESMTPSA id v41b8bz7FHLC0YW (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 15 Aug 2023 19:21:12 +0200 (CEST) From: Stephan Gerhold Date: Tue, 15 Aug 2023 19:21:06 +0200 Subject: [PATCH v3 3/3] leds: aw2013: Enable pull-up supply for interrupt and I2C MIME-Version: 1.0 Message-Id: <20230815-aw2013-vio-v3-3-2505296b0856@gerhold.net> References: <20230815-aw2013-vio-v3-0-2505296b0856@gerhold.net> In-Reply-To: <20230815-aw2013-vio-v3-0-2505296b0856@gerhold.net> To: Pavel Machek , Lee Jones Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nikita Travkin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, "Lin, Meng-Bo" , Stephan Gerhold X-Mailer: b4 0.12.3 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org From: "Lin, Meng-Bo" Request and enable the "vio" regulator that represents the power supply that is needed for the pull-up resistors of the interrupt and I2C lines of AW2013. While this regulator is not wired directly to the AW2013 chip it is best managed as part of the AW2013 driver since it decides when AW2013 is powered on and when the interrupt is enabled or disabled. This regulator should always be enabled in conjunction with the main VCC power supply, so use the bulk regulator functions to enable both at the same time. Signed-off-by: Lin, Meng-Bo [rewrite commit message based on discussion] Signed-off-by: Stephan Gerhold --- drivers/leds/leds-aw2013.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/drivers/leds/leds-aw2013.c b/drivers/leds/leds-aw2013.c index 59765640b70f..0010c0927434 100644 --- a/drivers/leds/leds-aw2013.c +++ b/drivers/leds/leds-aw2013.c @@ -62,7 +62,7 @@ struct aw2013_led { struct aw2013 { struct mutex mutex; /* held when writing to registers */ - struct regulator *vcc_regulator; + struct regulator_bulk_data regulators[2]; struct i2c_client *client; struct aw2013_led leds[AW2013_MAX_LEDS]; struct regmap *regmap; @@ -106,10 +106,11 @@ static void aw2013_chip_disable(struct aw2013 *chip) regmap_write(chip->regmap, AW2013_GCR, 0); - ret = regulator_disable(chip->vcc_regulator); + ret = regulator_bulk_disable(ARRAY_SIZE(chip->regulators), + chip->regulators); if (ret) { dev_err(&chip->client->dev, - "Failed to disable regulator: %d\n", ret); + "Failed to disable regulators: %d\n", ret); return; } @@ -123,10 +124,11 @@ static int aw2013_chip_enable(struct aw2013 *chip) if (chip->enabled) return 0; - ret = regulator_enable(chip->vcc_regulator); + ret = regulator_bulk_enable(ARRAY_SIZE(chip->regulators), + chip->regulators); if (ret) { dev_err(&chip->client->dev, - "Failed to enable regulator: %d\n", ret); + "Failed to enable regulators: %d\n", ret); return ret; } chip->enabled = true; @@ -348,19 +350,23 @@ static int aw2013_probe(struct i2c_client *client) goto error; } - chip->vcc_regulator = devm_regulator_get(&client->dev, "vcc"); - ret = PTR_ERR_OR_ZERO(chip->vcc_regulator); - if (ret) { + chip->regulators[0].supply = "vcc"; + chip->regulators[1].supply = "vio"; + ret = devm_regulator_bulk_get(&client->dev, + ARRAY_SIZE(chip->regulators), + chip->regulators); + if (ret < 0) { if (ret != -EPROBE_DEFER) dev_err(&client->dev, - "Failed to request regulator: %d\n", ret); + "Failed to request regulators: %d\n", ret); goto error; } - ret = regulator_enable(chip->vcc_regulator); + ret = regulator_bulk_enable(ARRAY_SIZE(chip->regulators), + chip->regulators); if (ret) { dev_err(&client->dev, - "Failed to enable regulator: %d\n", ret); + "Failed to enable regulators: %d\n", ret); goto error; } @@ -382,10 +388,11 @@ static int aw2013_probe(struct i2c_client *client) if (ret < 0) goto error_reg; - ret = regulator_disable(chip->vcc_regulator); + ret = regulator_bulk_disable(ARRAY_SIZE(chip->regulators), + chip->regulators); if (ret) { dev_err(&client->dev, - "Failed to disable regulator: %d\n", ret); + "Failed to disable regulators: %d\n", ret); goto error; } @@ -394,7 +401,8 @@ static int aw2013_probe(struct i2c_client *client) return 0; error_reg: - regulator_disable(chip->vcc_regulator); + regulator_bulk_disable(ARRAY_SIZE(chip->regulators), + chip->regulators); error: mutex_destroy(&chip->mutex);