From patchwork Tue Dec 18 08:05:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Hohnstaedt X-Patchwork-Id: 10735039 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 056D914E5 for ; Tue, 18 Dec 2018 08:07:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB3232A637 for ; Tue, 18 Dec 2018 08:07:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFB412A653; Tue, 18 Dec 2018 08:07:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81F362A643 for ; Tue, 18 Dec 2018 08:07:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726850AbeLRIHC (ORCPT ); Tue, 18 Dec 2018 03:07:02 -0500 Received: from mail1.bemta25.messagelabs.com ([195.245.230.66]:12427 "EHLO mail1.bemta25.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726557AbeLRIGh (ORCPT ); Tue, 18 Dec 2018 03:06:37 -0500 Received: from [46.226.52.194] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-2.bemta.az-b.eu-west-1.aws.symcld.net id 52/EB-12141-98AA81C5; Tue, 18 Dec 2018 08:06:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOKsWRWlGSWpSXmKPExsVy8+3OTbodqyR iDL4v5LeY+vAJm8X8I+dYLe5/Pcpo8e1KB5PF5V1z2CxmL+lnsVh6/SKTReveI+wW+694OXB6 rJm3htHj29dJLB47Z91l99i0qpPN4861PWwenzfJBbBFsWbmJeVXJLBmTDn9l61gE1fF9IuLG RsYuzm7GLk4hARWM0o0PzzDAuE8ZZT48vokYxcjJ5BTITFhyi0mEJtNwEpi95rFQEUcHCICKh Ln3piD1DMLTGGS2Dh7GgtIjbCAq8TeuyeYQGpYBFQl7p5OBAnzCvhIXP54ihXElhCQk7h5rpM ZxOYU8JU4Ov0gM8QqH4n7MyazQdQLSpyc+QRsJLOAhMTBFy+garQkrv47yA4yXkJAQeLlmziI kXESc2ceZYIIa0p0PsiCCNtLTH9/lRnCNpT4PusbC4RtLnH842WouI3Eob+tbBC2qcSmr9Ph7 OPts5gnMErMQnLQLCQHLWBkWsVokVSUmZ5RkpuYmaNraGCga2hopGtoaaZraGKsl1ilm6SXWq pbnlpcomuol1herFdcmZuck6KXl1qyiREY4SkFR/p3MD5bnn6IUZKDSUmU9/RyiRghvqT8lMq MxOKM+KLSnNTiQ4wyHBxKErwzVgLlBItS01Mr0jJzgKkGJi3BwaMkwlsPkuYtLkjMLc5Mh0id YlSUEufdBpIQAElklObBtcHS2yVGWSlhXkYGBgYhnoLUotzMElT5V4ziHIxKwrwbQabwZOaVw E1/BbSYCWhxzhYmkMUliQgpqQbGVt3SBJt7LXfuvuhZd2l34PGrsZ8MxFtmhiZrTlMQcmH4mv 5r+ooPHf1vPL/FvGcPcapf9mam3aW2I3YbeqR/Wqa4xyTHpewSbCzmN30xvf2Gxs+Q6/1Zf+4 nl2atNZnuHuixvz84Wqn4ereGa41eel3mjKpp9xSC9cXFN80IXj1necrWmpdKLMUZiYZazEXF iQCF5ACdagMAAA== X-Env-Sender: Christian.Hohnstaedt@wago.com X-Msg-Ref: server-20.tower-282.messagelabs.com!1545120391!3961610!1 X-Originating-IP: [217.237.185.178] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.14.24; banners=-,-,- X-VirusChecked: Checked Received: (qmail 11595 invoked from network); 18 Dec 2018 08:06:32 -0000 Received: from unknown (HELO SVEX01006.wago.local) (217.237.185.178) by server-20.tower-282.messagelabs.com with AES128-SHA encrypted SMTP; 18 Dec 2018 08:06:32 -0000 Received: from SVEX01011.wago.local (10.1.103.229) by SVEX01006.wago.local (10.1.101.122) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 18 Dec 2018 09:06:31 +0100 Received: from lc010965.wago.local (10.1.101.133) by SVEX01011.wago.local (10.1.103.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1531.3; Tue, 18 Dec 2018 09:06:30 +0100 Received: by lc010965.wago.local (Postfix, from userid 11100404) id B8019170069F; Tue, 18 Dec 2018 09:06:30 +0100 (CET) From: Christian Hohnstaedt To: Lee Jones CC: Liam Girdwood , Mark Brown , "Mark Rutland" , Rob Herring , "Tony Lindgren" , , , Subject: [PATCH 1/2] dt-bindings: regulator: extend tps65218 bindings Date: Tue, 18 Dec 2018 09:05:55 +0100 Message-ID: <1545120356-7749-2-git-send-email-Christian.Hohnstaedt@wago.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545120356-7749-1-git-send-email-Christian.Hohnstaedt@wago.com> References: <1545120356-7749-1-git-send-email-Christian.Hohnstaedt@wago.com> MIME-Version: 1.0 X-Originating-IP: [10.1.101.133] X-ClientProxiedBy: SVEX01011.wago.local (10.1.103.229) To SVEX01011.wago.local (10.1.103.229) X-KSE-ServerInfo: SVEX01011.wago.local, 9 X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 18.12.2018 03:56:00 X-KSE-BulkMessagesFiltering-Scan-Result: protection disabled X-PP-Proceessed: 7aa37ed7-add0-4ed7-8916-66d632c2b0a3 X-PP-Proceessed: 76874689-fff8-43e0-8f1a-01f8fc6dac97 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add input voltage configuration options Signed-off-by: Christian Hohnstaedt --- Documentation/devicetree/bindings/regulator/tps65218.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/regulator/tps65218.txt b/Documentation/devicetree/bindings/regulator/tps65218.txt index 02f0e9b..a9ee377 100644 --- a/Documentation/devicetree/bindings/regulator/tps65218.txt +++ b/Documentation/devicetree/bindings/regulator/tps65218.txt @@ -16,12 +16,22 @@ Required properties: regulator-dcdc5, regulator-dcdc6, regulator-ldo1, regulator-ls3. Each regulator is defined using the standard binding for regulators. +Optional properties: + If any of these properties is absent, the setting will not be touched. +- strict-supply-voltage: <1|0> Set/Reset STRICT flag in CONFIG1 +- under-voltage-limit: Select 2.75, 2.95, 3.25 or 3.35V as UVLO in CONFIG1 +- under-voltage-hysteresis: Select 200mV or 400mV UVLOHYS in CONFIG2 + Example: tps65218: tps65218@24 { reg = <0x24>; compatible = "ti,tps65218"; interrupts = ; /* NMIn */ interrupt-controller; + strict-supply-voltage = <1>; + under-voltage-hysteresis = <400000>; + under-voltage-limit = <3350000>; + #interrupt-cells = <2>; dcdc1: regulator-dcdc1 { From patchwork Tue Dec 18 08:05:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Hohnstaedt X-Patchwork-Id: 10735037 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0904014E5 for ; Tue, 18 Dec 2018 08:07:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F03FC2A643 for ; Tue, 18 Dec 2018 08:07:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E457D2A654; Tue, 18 Dec 2018 08:07:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 301EE2A643 for ; Tue, 18 Dec 2018 08:07:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726575AbeLRIGh (ORCPT ); Tue, 18 Dec 2018 03:06:37 -0500 Received: from mail1.bemta26.messagelabs.com ([85.158.142.6]:37581 "EHLO mail1.bemta26.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726397AbeLRIGg (ORCPT ); Tue, 18 Dec 2018 03:06:36 -0500 Received: from [85.158.142.98] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-6.bemta.az-a.eu-central-1.aws.symcld.net id B3/C6-08814-98AA81C5; Tue, 18 Dec 2018 08:06:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFKsWRWlGSWpSXmKPExsVy8+3OTbqdqyR iDA61ClhMffiEzWL+kXOsFve/HmW0+Halg8ni8q45bBazl/SzWCy9fpHJonXvEXaL/Ve8HDg9 1sxbw+jx7eskFo+ds+6ye2xa1cnmcefaHjaPz5vkAtiiWDPzkvIrElgz+lZPZyl4IFzRtbuft YHxgkAXIxeHkMBqRonHX3azQDhPGSVuzJ3D2sXICeRUSCxfPQ3MZhOwkti9ZjFQEQeHiICKxL k35iD1zAJTmCQ2zp7GAlIjLGAvsfviWmYQm0VAVWLtoy6wOK+Aj8TkGd/A5kgIyEncPNcJVsM p4CtxdPpBZohdPhL3Z0xmg6gXlDg58wlYL7OAhMTBFy+garQkrv47yA4xR0Fi6vuVUHacxNpD J9kgbE2JhmXbmCBse4np768yQ9iGEt9nfWOBsM0ljn+8DBW3kTj0txWq11Ti1Y/JTDD2hPnNL BMYJWYhOWkWkpMWMDKtYrRIKspMzyjJTczM0TU0MNA1NDTWNdI1MdFLrNJN1Est1U1OzSspSg RK6iWWF+sVV+Ym56To5aWWbGIExnlKIZPODsZPC9MPMUpyMCmJ8p5eLhEjxJeUn1KZkVicEV9 UmpNafIhRhoNDSYJ3xkqgnGBRanpqRVpmDjDhwKQlOHiURHiVVwCleYsLEnOLM9MhUqcYFaXE ebeB9AmAJDJK8+DaYEnuEqOslDAvIwMDgxBPQWpRbmYJqvwrRnEORiVh3gCQ8TyZeSVw018BL WYCWpyzhQlkcUkiQkqqgdF28n3Vj5XTz75Yn2SXYnD/tr6omxbrr+u7jp0+d/V/cT/zh2c9fX ymLa9emHWV599vKhDUFjjj838jn+bVHVsVZTnrGFIW62x//cvjpy3vz9Kabzmcm+uu9p5bsUn +7+sC9irHhE8rvu1LMMh7dZ69RjtEJz1ISp3vJ6OXP6M+1+lFs7lPlSmxFGckGmoxFxUnAgCZ vwqybQMAAA== X-Env-Sender: Christian.Hohnstaedt@wago.com X-Msg-Ref: server-24.tower-223.messagelabs.com!1545120392!2439111!3 X-Originating-IP: [217.237.185.178] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.14.24; banners=-,-,- X-VirusChecked: Checked Received: (qmail 21190 invoked from network); 18 Dec 2018 08:06:33 -0000 Received: from unknown (HELO SVEX01005.wago.local) (217.237.185.178) by server-24.tower-223.messagelabs.com with AES128-SHA encrypted SMTP; 18 Dec 2018 08:06:33 -0000 Received: from SVEX01009.wago.local (10.1.103.227) by SVEX01005.wago.local (10.1.101.121) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 18 Dec 2018 09:06:32 +0100 Received: from lc010965.wago.local (10.1.101.132) by SVEX01009.wago.local (10.1.103.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1531.3; Tue, 18 Dec 2018 09:06:31 +0100 Received: by lc010965.wago.local (Postfix, from userid 11100404) id 9AA6F170069F; Tue, 18 Dec 2018 09:06:31 +0100 (CET) From: Christian Hohnstaedt To: Lee Jones CC: Liam Girdwood , Mark Brown , "Mark Rutland" , Rob Herring , "Tony Lindgren" , , , Subject: [PATCH 2/2] mfd: tps65218.c: Add input voltage options Date: Tue, 18 Dec 2018 09:05:56 +0100 Message-ID: <1545120356-7749-3-git-send-email-Christian.Hohnstaedt@wago.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545120356-7749-1-git-send-email-Christian.Hohnstaedt@wago.com> References: <1545120356-7749-1-git-send-email-Christian.Hohnstaedt@wago.com> MIME-Version: 1.0 X-Originating-IP: [10.1.101.132] X-ClientProxiedBy: SVEX01014.wago.local (10.1.103.232) To SVEX01009.wago.local (10.1.103.227) X-KSE-ServerInfo: SVEX01009.wago.local, 9 X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 18.12.2018 03:56:00 X-KSE-BulkMessagesFiltering-Scan-Result: protection disabled X-PP-Proceessed: 81a9f692-418a-4f33-bb70-032f75efc73b X-PP-Proceessed: 8707ce24-8c4e-4a04-80f2-2a31f9152b06 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP These options apply to all regulators in this chip. strict-supply-voltage: Set STRICT flag in CONFIG1 under-voltage-limit: Select 2.75, 2.95, 3.25 or 3.35 V UVLO in CONFIG1 under-voltage-hysteresis: Select 200mV or 400mV UVLOHYS in CONFIG2 Signed-off-by: Christian Hohnstaedt --- drivers/mfd/tps65218.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/drivers/mfd/tps65218.c b/drivers/mfd/tps65218.c index 8bcdecf..f5e559b 100644 --- a/drivers/mfd/tps65218.c +++ b/drivers/mfd/tps65218.c @@ -211,6 +211,50 @@ static const struct of_device_id of_tps65218_match_table[] = { }; MODULE_DEVICE_TABLE(of, of_tps65218_match_table); +static void tps65218_options(struct tps65218 *tps) +{ + struct device *dev = tps->dev; + struct device_node *np = dev->of_node; + u32 pval; + + if (!of_property_read_u32(np, "strict-supply-voltage", &pval)) { + tps65218_update_bits(tps, TPS65218_REG_CONFIG1, + TPS65218_CONFIG1_STRICT, + pval ? TPS65218_CONFIG1_STRICT : 0, + TPS65218_PROTECT_L1); + dev_dbg(dev, "tps65218 strict-supply-voltage: %d\n", pval); + } + if (!of_property_read_u32(np, "under-voltage-hysteresis", &pval)) { + if (pval != 400000 && pval != 200000) { + dev_err(dev, + "under-voltage-hysteresis must be %d or %d\n", + 200000, 400000); + } else { + tps65218_update_bits(tps, TPS65218_REG_CONFIG2, + TPS65218_CONFIG2_UVLOHYS, + pval == 400000 ? TPS65218_CONFIG2_UVLOHYS : 0, + TPS65218_PROTECT_L1); + } + dev_dbg(dev, "tps65218 under-voltage-hysteresis: %d\n", pval); + } + if (!of_property_read_u32(np, "under-voltage-limit", &pval)) { + int i, vals[] = { 275, 295, 325, 335 }; + + for (i = 0; i < ARRAY_SIZE(vals); i++) { + if (pval == vals[i] * 10000) + break; + } + if (i < ARRAY_SIZE(vals)) { + tps65218_update_bits(tps, TPS65218_REG_CONFIG1, + TPS65218_CONFIG1_UVLO_MASK, i, + TPS65218_PROTECT_L1); + } else { + dev_err(dev, "Invalid under-voltage-limit: %d\n", pval); + } + dev_dbg(dev, "tps65218 under-voltage-limit: %d=%d\n", pval, i); + } +} + static int tps65218_probe(struct i2c_client *client, const struct i2c_device_id *ids) { @@ -249,6 +293,8 @@ static int tps65218_probe(struct i2c_client *client, tps->rev = chipid & TPS65218_CHIPID_REV_MASK; + tps65218_options(tps); + ret = mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, tps65218_cells, ARRAY_SIZE(tps65218_cells), NULL, 0, regmap_irq_get_domain(tps->irq_data));