From patchwork Tue Jan 9 09:33:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 123844 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3810484qgn; Tue, 9 Jan 2018 01:44:49 -0800 (PST) X-Google-Smtp-Source: ACJfBotWjGy0Z7qAB/RqxXbZzotMWiDfrOtqA1UtExKxGqPDGpYYIYfM8/WG4gKJZD+lc8HDOeo3 X-Received: by 10.99.67.197 with SMTP id q188mr3356720pga.255.1515491089674; Tue, 09 Jan 2018 01:44:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515491089; cv=none; d=google.com; s=arc-20160816; b=EKAP27+sIolAXYDkp/sa0KNaXmibh5Or04nQJ28RSY4LTbgaIF8uqKNhBTMpuiJHPJ pRRzsm6OGesLV+gHogIN/6N2N1vPDprj5l+43luLFMOBcQtL5plog6sadcOb7DXdXuU+ gRjBnDeYXf0HMp5MiMKkdR3l3T2Naetg1cn6WUFzalWyBIMGQAP5vtSB0i/Fv873bKzC XblTtMYxGz/+VWRCsyNxZRxz3ihCode5M/ciBD6atdJLQSOBaWfPewtjpJO/GslxO8DO wR4Um0uGwkBM0aHJ6NdvUzLlwhVx4NnOrmZ/HFpI/7a8sHnCvZzUS+EM3YiTB9jmb5K9 Wjig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9RVkHaB+OL4B50IDl2vBqvtznB0wToFklvRnAKgf05I=; b=v75t/XifIDwS8IqiLt4/4fRh5/57D6fV9V+1xU+NtotTRJv/W6bKCh4IkXfifnBfRD 278GlgXG24cFPad+sgfKCtkgCjkhuwbIvFLvTt+piVNwLB0x8LBhQ9YBqhOdvZoJzJcZ /rqQOraCDS6FXG3wiql5bdmuaY6eDoMHrk7UL5p4VtZ021ZFyjfTIfB9FgZMQ0LLABwv DgoyN6p4oiRriQQFWAhavy/+fUuMMddYTfn/leWk4fZVqOYNnClF7mV6LmIBRbkoUReb ij75yMDZjRP8XuzNP9hz6T0L7E+cH2/zNGWL5IrNbUJp41sVyHzysDEDd8uTEPP+fQUP 7yfw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f66si9858095pff.48.2018.01.09.01.44.49; Tue, 09 Jan 2018 01:44:49 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752683AbeAIJfF (ORCPT + 28 others); Tue, 9 Jan 2018 04:35:05 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:45683 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752533AbeAIJfB (ORCPT ); Tue, 9 Jan 2018 04:35:01 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 3426B20993; Tue, 9 Jan 2018 10:34:59 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id BDCB12064F; Tue, 9 Jan 2018 10:34:48 +0100 (CET) From: Quentin Schulz To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, sre@kernel.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org Cc: linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, Quentin Schulz Subject: [PATCH v2 01/16] iio: adc: axp20x_adc: put ADC rate setting in a per-variant function Date: Tue, 9 Jan 2018 10:33:32 +0100 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To prepare for a new comer that set a different register with different values, move rate setting in a function that is specific to each AXP variant. Signed-off-by: Quentin Schulz --- drivers/iio/adc/axp20x_adc.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) -- git-series 0.9.1 diff --git a/drivers/iio/adc/axp20x_adc.c b/drivers/iio/adc/axp20x_adc.c index a30a972..3fc1b06 100644 --- a/drivers/iio/adc/axp20x_adc.c +++ b/drivers/iio/adc/axp20x_adc.c @@ -470,14 +470,18 @@ static const struct iio_info axp22x_adc_iio_info = { .read_raw = axp22x_read_raw, }; -static int axp20x_adc_rate(int rate) +static int axp20x_adc_rate(struct axp20x_adc_iio *info, int rate) { - return AXP20X_ADC_RATE_HZ(rate); + return regmap_update_bits(info->regmap, AXP20X_ADC_RATE, + AXP20X_ADC_RATE_MASK, + AXP20X_ADC_RATE_HZ(rate)); } -static int axp22x_adc_rate(int rate) +static int axp22x_adc_rate(struct axp20x_adc_iio *info, int rate) { - return AXP22X_ADC_RATE_HZ(rate); + return regmap_update_bits(info->regmap, AXP20X_ADC_RATE, + AXP20X_ADC_RATE_MASK, + AXP22X_ADC_RATE_HZ(rate)); } struct axp_data { @@ -485,7 +489,8 @@ struct axp_data { int num_channels; struct iio_chan_spec const *channels; unsigned long adc_en1_mask; - int (*adc_rate)(int rate); + int (*adc_rate)(struct axp20x_adc_iio *info, + int rate); bool adc_en2; struct iio_map *maps; }; @@ -554,8 +559,7 @@ static int axp20x_probe(struct platform_device *pdev) AXP20X_ADC_EN2_MASK, AXP20X_ADC_EN2_MASK); /* Configure ADCs rate */ - regmap_update_bits(info->regmap, AXP20X_ADC_RATE, AXP20X_ADC_RATE_MASK, - info->data->adc_rate(100)); + info->data->adc_rate(info, 100); ret = iio_map_array_register(indio_dev, info->data->maps); if (ret < 0) { From patchwork Tue Jan 9 09:33:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 123843 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3809745qgn; Tue, 9 Jan 2018 01:44:05 -0800 (PST) X-Google-Smtp-Source: ACJfBot/55d8vlU6LbGRB7V9PisX1HwbBxLO19YP/b1eoOQ6wExY9X0HneKVdELPpmRTK3libCUp X-Received: by 10.101.81.135 with SMTP id h7mr11560108pgq.181.1515491045189; Tue, 09 Jan 2018 01:44:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515491045; cv=none; d=google.com; s=arc-20160816; b=QKGymYi0YWLtczRpKbxK4Zpt8xUias0TdsHhRsE7TRDqok5vrEIbWIUEsNqKBXzehK 8FtohjeYKfygkpDsfAJjlQatdF0mEFcSIeRSDH8cQq+8czhWFqXN3GYwIIbSgj3TpQsF TApXbljbgLvM5U8RBX67wPOm9brzOiihT/WGzgy6QH8nluXh8pQACmOJYhEgukUhKkas tbXRLUczqRoxPAcXxdJyn1AhCNKoIEgC0clu8Nbwrz251RwXiKg7zDo+uuRSPqrxjke7 tjj6llQCboGx12zjaw3ILwUdd59LOPbLjWv322VVWdGU9jVG2+7rx+oKbMabxxhHZM+Z E3uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=YbjNi89GcjFM0G+BPqQgnafJp6Wi6Lzyjr3WznvWSs8=; b=cVFM3kfVZFdAJEn4oKVjeHKeinqd5KsW8Vb/71/1WKYJoBhyDgOEFGFuAhfz3V+oxP 9tebAfgYc8Wwcim66vcaMGZwLszRl96OfU+/2lTwBS4hb/QpS4RSUNA21E+Lzish4Qis F5NLU1kdeLR5tX/rlOA6Ayjn8+N3Ad4ENP+0MQYTrUz8oO0RqqS4kRh40oPUZ0HYAQ86 fzB+brj4kl/tlB7JyTnmsiPxhPzWRJ5mxfGCWYxrPgRd4ZmY3DDVVPhmyd0CVd5idkSr edu4mz+y2Wd18ZZPVHMJHX/zOJzyM+WoOcc1N8gXeHs7vKf0KmA1EeT9f6kwz6d474rG /NBg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x76si2993607pgx.46.2018.01.09.01.44.04; Tue, 09 Jan 2018 01:44:05 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752711AbeAIJfH (ORCPT + 28 others); Tue, 9 Jan 2018 04:35:07 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:45694 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752641AbeAIJfC (ORCPT ); Tue, 9 Jan 2018 04:35:02 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 9610B2064F; Tue, 9 Jan 2018 10:34:59 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 2B15F20727; Tue, 9 Jan 2018 10:34:49 +0100 (CET) From: Quentin Schulz To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, sre@kernel.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org Cc: linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, Quentin Schulz Subject: [PATCH v2 02/16] dt-bindings: iio: adc: add binding for X-Powers AXP PMICs ADC Date: Tue, 9 Jan 2018 10:33:33 +0100 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Powers PMICs have several ADC channels that can be used for different purposes, e.g. PMIC internal temperature, battery voltage or AC current. This is the documentation for AXP209, AXP221/223 ADC bindings. Signed-off-by: Quentin Schulz --- Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt | 39 +++++++++- 1 file changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt -- git-series 0.9.1 diff --git a/Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt b/Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt new file mode 100644 index 0000000..ed6d04e --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt @@ -0,0 +1,39 @@ +* X-Powers AXP ADC bindings + +Required properties: + - compatible: should be one of: + - "x-powers,axp20x-adc", + - "x-powers,axp22x-adc", + - #io-channel-cells: should be 1, + +Example: + +&axp22x { + axp_adc: axp-adc { + compatible = "x-powers,axp22x-adc"; + #io-channel-cells = <1>; + }; +}; + +ADC channels and their indexes per variant: + +AXP209 +------ + 0 | acin_v + 1 | acin_i + 2 | vbus_v + 3 | vbus_i + 4 | pmic_temp + 5 | gpio0_v + 6 | gpio1_v + 7 | ipsout_v + 8 | batt_v + 9 | batt_chrg_i +10 | batt_dischrg_i + +AXP22x +------ + 0 | pmic_temp + 1 | batt_v + 2 | batt_chrg_i + 3 | batt_dischrg_i From patchwork Tue Jan 9 09:33:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 123842 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3809487qgn; Tue, 9 Jan 2018 01:43:47 -0800 (PST) X-Google-Smtp-Source: ACJfBovKxrP906ukux+nH3mi82C7BM0VJaPG7qFGb+kUmhnIaANf53ax0D6fNTitUNptj9UD03AI X-Received: by 10.101.81.7 with SMTP id f7mr11792418pgq.449.1515491027793; Tue, 09 Jan 2018 01:43:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515491027; cv=none; d=google.com; s=arc-20160816; b=GtUwmKOnhirlXwfTBzsc/6SmtMMqwDK4vFNpmsZ2HCSjKeDK1uKEa/dWhdU4J6Ojr0 vgrtM55MrQTy6hv3kSxdk9GMn2nSql9DkQmFj4Banpq1IwJn8DFbLQXmJeuAVq1E3gaG V/2fpZIEeFoM+q+pXR4H8lkH5mG1XX9l8XX8izDDuVP2yxo8X3kW5S6PNtXgkL2C7+TZ E/H1ELVS5vs1tBapI8ITsZSQ5Fmzla4X9tVS/qD+n97v0JTODAAqQKzVGDwpCISR3+im 0Sb32smBQ3MWq1DJfHZeYRAifix5immMdEXSpT29hGODf62cyTCWkPGeAGECl7SITBeO Um/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=OLB1BLyT0nAbxqdl3kasNYfdciTU1uwgyue/HpQrslw=; b=GWrLkMajmbW2vMj+FIqUi6l4cN77aaCJ93ugN2xB8Bg/aCxd6Q2TwBW8Q3ZCLwPwvA ZTiB5td4Ue/Jwfz1nweWsjnXqlJqNt21kvAM50VSUU3mx93i56jvtzCsXE7e1Kpw61IQ dAfsRMgLOMuqLJ01IRxS5JXO0HnsFqoK4hksRUI4gDNHvQ6h/3f1QUetn3hLEnW4BI8L BfoCGiVehISY4Ta2ASCYXKv6K3n6VF8vRDoumPN9i6RID3fkDSw+8jUc74zSK3svrh9X o9qePS4RwwgZNh9nuC+owwRGAX51tpSSZA280l92H2XRDgRBdXs8hh7T1XM2u1vmqgqV rrXA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j5si9799476pfh.162.2018.01.09.01.43.47; Tue, 09 Jan 2018 01:43:47 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752580AbeAIJfJ (ORCPT + 28 others); Tue, 9 Jan 2018 04:35:09 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:45713 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752642AbeAIJfC (ORCPT ); Tue, 9 Jan 2018 04:35:02 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 0302E20727; Tue, 9 Jan 2018 10:35:00 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 8CB862072D; Tue, 9 Jan 2018 10:34:49 +0100 (CET) From: Quentin Schulz To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, sre@kernel.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org Cc: linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, Quentin Schulz Subject: [PATCH v2 03/16] iio: adc: axp20x_adc: make it possible to probe from DT Date: Tue, 9 Jan 2018 10:33:34 +0100 Message-Id: <5cf35ebd799555aca6201b86d635656266eda40c.1515486346.git-series.quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To prepare for a future patch that will add a DT node for the ADC, make axp20x_adc able to probe from DT and get the per-variant data from of_device_id.data since platform_device_id.driver_data won't be set when probing by DT. Leave the ability to probe via platform for driver compatibility with old DTs. Signed-off-by: Quentin Schulz --- drivers/iio/adc/axp20x_adc.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) -- git-series 0.9.1 diff --git a/drivers/iio/adc/axp20x_adc.c b/drivers/iio/adc/axp20x_adc.c index 3fc1b06..f8c4c62 100644 --- a/drivers/iio/adc/axp20x_adc.c +++ b/drivers/iio/adc/axp20x_adc.c @@ -515,6 +515,13 @@ static const struct axp_data axp22x_data = { .maps = axp22x_maps, }; +static const struct of_device_id axp20x_adc_of_match[] = { + { .compatible = "x-powers,axp20x-adc", .data = (void *)&axp20x_data, }, + { .compatible = "x-powers,axp22x-adc", .data = (void *)&axp22x_data, }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, axp20x_adc_of_match); + static const struct platform_device_id axp20x_adc_id_match[] = { { .name = "axp20x-adc", .driver_data = (kernel_ulong_t)&axp20x_data, }, { .name = "axp22x-adc", .driver_data = (kernel_ulong_t)&axp22x_data, }, @@ -543,7 +550,16 @@ static int axp20x_probe(struct platform_device *pdev) indio_dev->dev.of_node = pdev->dev.of_node; indio_dev->modes = INDIO_DIRECT_MODE; - info->data = (struct axp_data *)platform_get_device_id(pdev)->driver_data; + if (!pdev->dev.of_node) { + const struct platform_device_id *tmp; + + tmp = platform_get_device_id(pdev); + info->data = (struct axp_data *)tmp->driver_data; + } else { + struct device *dev = &pdev->dev; + + info->data = (struct axp_data *)of_device_get_match_data(dev); + } indio_dev->name = platform_get_device_id(pdev)->name; indio_dev->info = info->data->iio_info; @@ -606,6 +622,7 @@ static int axp20x_remove(struct platform_device *pdev) static struct platform_driver axp20x_adc_driver = { .driver = { .name = "axp20x-adc", + .of_match_table = of_match_ptr(axp20x_adc_of_match), }, .id_table = axp20x_adc_id_match, .probe = axp20x_probe, From patchwork Tue Jan 9 09:33:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 123846 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3811271qgn; Tue, 9 Jan 2018 01:45:41 -0800 (PST) X-Google-Smtp-Source: ACJfBovIfaBLQgIJk84f2kKEvSdO0aLOGR6YBoe2sTX8ZTSh/9TuL0RC6iqfzhB12FVZgEq4WgW9 X-Received: by 10.159.246.16 with SMTP id b16mr14930732pls.165.1515491141583; Tue, 09 Jan 2018 01:45:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515491141; cv=none; d=google.com; s=arc-20160816; b=eMq9M3wUMwR+ZQ3sglkcQoRZO4c+i2iubSTHE76ok9D+81oEqsL8GfyD/kRX2kv24v kMiOZzsKr4wmIyO8wFe2bRuRSGSGUMyPFZw28Qm0Q3LkLbnlfuAY/VVqTDG+Byc7NSbc uVr2JOGI2pfsauC9k1vpjFEgsz7mBMMaPGI4ydasDbUmRxovy8OOucSPT7oZQyCJtRmk kP1sgD+yzYeSdXiT5JVF6j+BPIzdjny8kRp2C8VzssGlWzH7gGHq4LAk6WZPIw8nAoGx z191uMJZ4+fMqfY4BtPlN1phU/9bm+ENJKRNmAiAnak7PBFiIsNO10GwyzsA+O5jTNtu Pi0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=QLVApbzZb8VMzDFZO30UkXjzhErn9+VErsOLMgYzDF0=; b=IuVmZcIzBvyL9TL8waGwsET8OHFLdAGi/VBeuQBVKeBqNPXWvYYA684ZJs5hqAviSf DjEPdJ8sMx0PSiXw+TdUUMX3YWzTe+uQhbPvQ3BUNcaWidQk1HWmzaXt9k1n4ZwQihlP 3VnjyKvSW8ZYiF2xY3/zEPNTFPzHnObiGzxoDana46yt4GII5KPTWVRvyMa/WKo22mUM 1cAzG4rbwZkdOeYTF/saqnQKVtEGWQ6Un7uu7ppByI9yp/VvlLSPPNrgBvIlZLEUCm7e EoEopOy32AtfOBvYea1ORh8cfNnmxGB6Gwjm971j1LRtU873wvL8tKz74qqMXcA3edRn dzlw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b69si2405634pfl.359.2018.01.09.01.45.41; Tue, 09 Jan 2018 01:45:41 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753307AbeAIJpj (ORCPT + 28 others); Tue, 9 Jan 2018 04:45:39 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:45726 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752631AbeAIJfC (ORCPT ); Tue, 9 Jan 2018 04:35:02 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 671742099A; Tue, 9 Jan 2018 10:35:00 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id ED5E920124; Tue, 9 Jan 2018 10:34:49 +0100 (CET) From: Quentin Schulz To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, sre@kernel.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org Cc: linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, Quentin Schulz Subject: [PATCH v2 04/16] ARM: dtsi: axp209: add node for ADC Date: Tue, 9 Jan 2018 10:33:35 +0100 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds a DT node for the ADC of the PMIC so that there can be consumers of its IIO channels declaring their consumptions via DT. Signed-off-by: Quentin Schulz --- arch/arm/boot/dts/axp209.dtsi | 5 +++++ 1 file changed, 5 insertions(+) -- git-series 0.9.1 diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi index 897103e..a2e0052 100644 --- a/arch/arm/boot/dts/axp209.dtsi +++ b/arch/arm/boot/dts/axp209.dtsi @@ -58,6 +58,11 @@ status = "disabled"; }; + axp_adc: axp-adc { + compatible = "x-powers,axp20x-adc"; + #io-channel-cells = <1>; + }; + axp_gpio: gpio { compatible = "x-powers,axp209-gpio"; gpio-controller; From patchwork Tue Jan 9 09:33:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 123845 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3810734qgn; Tue, 9 Jan 2018 01:45:07 -0800 (PST) X-Google-Smtp-Source: ACJfBot15sXZsT5ArGJewE7q/AHLf3fH1RgRUKjXlbxQ0WQGvJkSbMM5u0inxmyVjxCXEr9eZAIl X-Received: by 10.84.140.107 with SMTP id 98mr14524102pls.91.1515491107831; Tue, 09 Jan 2018 01:45:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515491107; cv=none; d=google.com; s=arc-20160816; b=FQqsvtkPqyC2lyOEp094HL1ZleJ92WGQwtLZZbCzX1mJ+Aii07oCaAPqrGKH435ZU/ t2E8f3bY4T5X8JOa94ApizmmSVOz2dq0FB8U2+nkO+vmCYjU8j1Wo/932dzEzdFu/Lhg q6fVLNWZXPUJnUJVvhc90naC6sBGCJxNgehW4HdIj0wC7KEbTZrKZtPQSt+LCpMU2jqY ljgwF3+o9K7Fc+GqCAel3NsOViikvoQSS2Z2+ry4hsrcxjeCXY5vmgdJuOnP3yyiFoIC LjQ9jCtw3+5X/87acpDsuI6Az5A56bVc5/qiBcfP72uhMzDBrEeRPqVKc2cn1CITf0fG fzUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=yhc0KCU6Vbag/2/qYNFole8kMFE9/TJ5URzi6jmEqiw=; b=GipAaoRkB9UxASyjvLco21tfGrUtMG4oRpOfUZ+V0jMURYWdB5SlnYN4RmhsHPKPoD KfFYa5K2vLEG8by1XIOzYnstVZ0Sy0ajtZuk44vHHopl7Upe5LZIgG3wwl1SWKQcVdSr 3pNeafta7hdvK+jkxauswFZFutzSpioqZDXo78aevMwta6glkPEvZREvBqGlllWeO6YO d8tbaIp/iZzoX2sTrcOAmB+IeOnRSuhtXdr8ccG+2NZWGB+RQHuMiBQjN7sMl1fCbB// kTVAq4zVtoVTRPQZ2wwfcxpcROvnwONRNmedASZSti9fepWTWJFNqlq8kdpRtv3GnfbO Pb3Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f66si9858095pff.48.2018.01.09.01.45.07; Tue, 09 Jan 2018 01:45:07 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753252AbeAIJpF (ORCPT + 28 others); Tue, 9 Jan 2018 04:45:05 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:45735 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752643AbeAIJfE (ORCPT ); Tue, 9 Jan 2018 04:35:04 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id C943E209D3; Tue, 9 Jan 2018 10:35:00 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 5BA3E207B4; Tue, 9 Jan 2018 10:34:50 +0100 (CET) From: Quentin Schulz To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, sre@kernel.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org Cc: linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, Quentin Schulz Subject: [PATCH v2 05/16] ARM: dtsi: axp22x: add node for ADC Date: Tue, 9 Jan 2018 10:33:36 +0100 Message-Id: <11a72fb582c129bbcbe53dccfadd4fa7b0505af8.1515486346.git-series.quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds a DT node for the ADC of the PMIC so that there can be consumers of its IIO channels declaring their consumptions via DT. Signed-off-by: Quentin Schulz --- arch/arm/boot/dts/axp22x.dtsi | 5 +++++ 1 file changed, 5 insertions(+) -- git-series 0.9.1 diff --git a/arch/arm/boot/dts/axp22x.dtsi b/arch/arm/boot/dts/axp22x.dtsi index 87fb08e..fbb7f6e 100644 --- a/arch/arm/boot/dts/axp22x.dtsi +++ b/arch/arm/boot/dts/axp22x.dtsi @@ -57,6 +57,11 @@ status = "disabled"; }; + axp_adc: axp-adc { + compatible = "x-powers,axp22x-adc"; + #io-channel-cells = <1>; + }; + battery_power_supply: battery-power-supply { compatible = "x-powers,axp221-battery-power-supply"; status = "disabled"; From patchwork Tue Jan 9 09:33:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 123840 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3808558qgn; Tue, 9 Jan 2018 01:42:42 -0800 (PST) X-Google-Smtp-Source: ACJfBotu+BWM/G2HgE2C7e6qGW2nlNBUre9qxYulnjpMwEUxQItsQPzKOjOtQoh3evzAbAJZ4URW X-Received: by 10.84.193.129 with SMTP id f1mr15229868pld.359.1515490962404; Tue, 09 Jan 2018 01:42:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515490962; cv=none; d=google.com; s=arc-20160816; b=TVSCHVVLfmH+7HLyGNpETgtQpNfjlJ3p/4bmjvbFQi/cCCNgTXEiVkNnn4E9x6db3Y gLhAAXrOqxALWZ1+yFL8GQ8np8pHJvt2x/7TzwuT+Dnwi8Yn86kp9qwpK3z1exf9vjBy XPTedU2j6Yug7e7qMbzg6EcRFStZg+LqRyloHhp2np2Pw+xpVpeWpLUuzjVhj2Imt3h/ +/SDNKcXDJChO+hF0WvIbqTtFEiYGXUvZ+ej7NLdsleHHEsdh3cJKfWQDtgHY8CWfgYj v1Kxw/KMTkFFVetMmjlojrre9cxn4mSUYNL17HiRNzBfLHM2Q4b4nQ5s0HUlo1ltKSsM Sd3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=qjKUZsugEKgFqvbntE5Dm64wI5iGeKDOMD7aOiIhbnk=; b=dUvnFlwtiuJYfB/ofZhI0G+TtoMZ1ZCTbLb3I7sAf8eBxRNnP6HlpkdoRzPib6heGT a3Sf/fRNkVJXGoTtsvAclLmOnlzJyjo9HSexbNlqj37UFo3htoXSA/o+t1tntfQu0WEx 9TRP5kg2MJ7SLlLNLYKzjqbMhg5bZUHXucZxhXvyznm8+2gum5u+BMsQB5eCW0/d0XG7 H56zs8xOiSzvQ/zA2W1bQsgmhghrVR+Smq0cGLo9KrSQmOtYGkmvGcPz/r0AkJ50QUTq 5XHxQG7RZs70UDaWK9ER9DkXbeiEJ1NmhC1XI1q+82+sjAT13KXAIh0Ol5fa3nD3f9ZY aPdg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m4si8676067pgc.800.2018.01.09.01.42.42; Tue, 09 Jan 2018 01:42:42 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753194AbeAIJlM (ORCPT + 28 others); Tue, 9 Jan 2018 04:41:12 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:45744 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752734AbeAIJfL (ORCPT ); Tue, 9 Jan 2018 04:35:11 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id DD105209F9; Tue, 9 Jan 2018 10:35:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id B9D7E207C8; Tue, 9 Jan 2018 10:34:50 +0100 (CET) From: Quentin Schulz To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, sre@kernel.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org Cc: linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, Quentin Schulz Subject: [PATCH v2 06/16] mfd: axp20x: make AXP209/22x cells probe their ADC via DT Date: Tue, 9 Jan 2018 10:33:37 +0100 Message-Id: <3b801d1dada3d9604311f65033343a14260cc7ae.1515486346.git-series.quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This makes AXP209 and AXP22x ADCs probe first via DT and then by fallback via platform. Signed-off-by: Quentin Schulz --- drivers/mfd/axp20x.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- git-series 0.9.1 diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index d8c92fb..e0cbaea 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c @@ -659,6 +659,7 @@ static struct mfd_cell axp20x_cells[] = { .name = "axp20x-regulator", }, { .name = "axp20x-adc", + .of_compatible = "x-powers,axp20x-adc", }, { .name = "axp20x-battery-power-supply", .of_compatible = "x-powers,axp209-battery-power-supply", @@ -683,7 +684,8 @@ static struct mfd_cell axp221_cells[] = { }, { .name = "axp20x-regulator", }, { - .name = "axp22x-adc" + .name = "axp22x-adc", + .of_compatible = "x-powers,axp22x-adc", }, { .name = "axp20x-ac-power-supply", .of_compatible = "x-powers,axp221-ac-power-supply", @@ -707,6 +709,7 @@ static struct mfd_cell axp223_cells[] = { .resources = axp22x_pek_resources, }, { .name = "axp22x-adc", + .of_compatible = "x-powers,axp22x-adc", }, { .name = "axp20x-battery-power-supply", .of_compatible = "x-powers,axp221-battery-power-supply", From patchwork Tue Jan 9 09:33:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 123838 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3807424qgn; Tue, 9 Jan 2018 01:41:19 -0800 (PST) X-Google-Smtp-Source: ACJfBouvQecPFp6JNtxYruFvBpxNAwPVhM4BXsh1N2Odc3V8lbpaxdIQOHO0GhN+DY1abNzCIPf5 X-Received: by 10.84.244.1 with SMTP id g1mr9227161pll.267.1515490879247; Tue, 09 Jan 2018 01:41:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515490879; cv=none; d=google.com; s=arc-20160816; b=Xa1YIb/hguvk8TTa6ksjBsrfGJOtcacJI3lbOqIbDnaLSuEp6yp8stBpCnmSMRaUmt avEMMk1d0vNG5s+jVFNf82aRHltQ5RnI6LPcA2RPpNgek15RpUMpcUUNdnQuYrmVYpln oS/zzYEyrYGEjcPUDHjYskaGiXmXKHSKPyRze1zuYRewuqil56J43l6yvvIvGRg30tDl kRG5Jw9Hm2dbngdJgyH07QyFFBRvSq5Jz2ZR8JA6/Xiy0DsjAmRbxps0Ba0ouctd9pfF eQ2UHw886WpzbENLvwAPQqyy9qgPm1Jy3Jn/QbAKXNW9SRiQotvBLqyCBfO7CXQaSXoF lnYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=XJtGloSLcVEuKFJEJChxG/Hi07ncp80YFJILQ2iWro4=; b=VaBDhxsV3eJuLyA22YzmNSiS4/bCKi5N6uhY+I7zy+iOHI5IqLEkA67CcGFRARmEV9 7WbwgvHQRrWxgxcFQEojjm0y8CggiYMN9Fyw5V1TWN1oxafjyeXGSi22sWo2EEfiIzQ6 Va/eaxjBxH39mQIvjctO9PX3KDwaMeh1XOBHTIEH5kB4DOIIUPtDVlch3tJzyTQ7Mn9o /AK5zV8R1z3q/PMJn9knAMumTttIxnQtI02L+yCILuDoJinfb20KMZM/wIw2EfkORd/T 0l+90XUCOz8+NNyWpmGKbD9qW7lz1f8bFwi3yB1BiJ3jXxAVVacNmvn63CsKLzK3UDAG m+iQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1si10058464pld.226.2018.01.09.01.41.18; Tue, 09 Jan 2018 01:41:19 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753291AbeAIJlQ (ORCPT + 28 others); Tue, 9 Jan 2018 04:41:16 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:45746 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752733AbeAIJfL (ORCPT ); Tue, 9 Jan 2018 04:35:11 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id DE23A207C8; Tue, 9 Jan 2018 10:35:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 27E6A207CA; Tue, 9 Jan 2018 10:34:51 +0100 (CET) From: Quentin Schulz To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, sre@kernel.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org Cc: linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, Quentin Schulz Subject: [PATCH v2 07/16] dt-bindings: iio: adc: axp20x_adc: add AXP813 variant Date: Tue, 9 Jan 2018 10:33:38 +0100 Message-Id: <64b538aadf075ba07e567d9a9db865b64c97fbfc.1515486346.git-series.quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org AXP813 is now supported so add documentation for this compatible. Signed-off-by: Quentin Schulz --- Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt | 9 +++++++++- 1 file changed, 9 insertions(+) -- git-series 0.9.1 diff --git a/Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt b/Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt index ed6d04e..3465f80 100644 --- a/Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt +++ b/Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt @@ -4,6 +4,7 @@ Required properties: - compatible: should be one of: - "x-powers,axp20x-adc", - "x-powers,axp22x-adc", + - "x-powers,axp813-adc", - #io-channel-cells: should be 1, Example: @@ -37,3 +38,11 @@ AXP22x 1 | batt_v 2 | batt_chrg_i 3 | batt_dischrg_i + +AXP813 +------ + 0 | pmic_temp + 1 | gpio0_v + 2 | batt_v + 3 | batt_chrg_i + 4 | batt_dischrg_i From patchwork Tue Jan 9 09:33:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 123830 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3804586qgn; Tue, 9 Jan 2018 01:38:04 -0800 (PST) X-Google-Smtp-Source: ACJfBotU2QfnKOVXm8IdDZBumvo47YuAh8R515iGfwR7cl86Tr9wMjTyxruBFF6nseHFUfSYkm5a X-Received: by 10.84.138.1 with SMTP id 1mr4839787plo.141.1515490684692; Tue, 09 Jan 2018 01:38:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515490684; cv=none; d=google.com; s=arc-20160816; b=IU4ydBfxKyjn+f0qkQ7gLXaGao3uaEsd6TIJKptamiTkkfcZf0kiDZZtklfbkvrryZ ZuiUjQHzSPviw0/SPyMpDIjYaGAjfWOcBzxaRD/NWLQYFiAXvFT6UN+Et9B/3OtribVf 4MPkIwYVyBm35jJN+Q+maHMx5ilOMl53zh7KaMkrS9ZyHgrn0PTO+Qf7FXRB5wkwrsJ0 MoBtePbVHitulkIN/hiLjQY/08lF52l4qrh3NXNENOvLgwRyPCLF6jSaNClnUxCYTBLe Ucn0MLDwsNay1Lu9lhC9xqHkgtlIEsgIbux5Ntt2PpozKMWd4YSAjHzQP+ji3sW6RZYF lCsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=KWVx8/mXAEOoL02qB1nB1HH135FlN+J+EHBz7gI9wII=; b=WyqRNFTNYCg1YsynoZurRZIQeQMBwSLzwzKl4MnAnGWtLR/zhR7Jrrw7hXGRUVo8FA Lm/B7/yw/6EuklHjq7mm46e3XAFNu12UxV0h2QkvBsPvXty3aaoz8HnwmyMWSqyQgq0t mDzcooG29E5BAIDaLeqPNyoGTkISd34Bk/Z+lJ1j6GHKmZkfXENTaLLejyT/or36lSOn D1zpZD4eHfg+nfJ96QXO+GWMajSe5dUhhth3EsRiM5dFicX+GImXh12ZXDUSew99oDFy eROBEskuzUAo9sc7G1BiBCmEDsWnr0fyUav+nswvUIQshTu3h1GrHvwg+vnlbdclve+8 oUQA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o3si10005783pld.358.2018.01.09.01.38.04; Tue, 09 Jan 2018 01:38:04 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752891AbeAIJfW (ORCPT + 28 others); Tue, 9 Jan 2018 04:35:22 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:45782 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752749AbeAIJfL (ORCPT ); Tue, 9 Jan 2018 04:35:11 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 525122081A; Tue, 9 Jan 2018 10:35:09 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 8BF13207F3; Tue, 9 Jan 2018 10:34:51 +0100 (CET) From: Quentin Schulz To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, sre@kernel.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org Cc: linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, Quentin Schulz Subject: [PATCH v2 08/16] iio: adc: axp20x_adc: add support for AXP813 ADC Date: Tue, 9 Jan 2018 10:33:39 +0100 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The X-Powers AXP813 PMIC is really close to what is already done for AXP20X/AXP22X. There are two pairs of bits to set the rate (one for Voltage and Current measurements and one for TS/GPIO0 voltage measurements) instead of one. The register to set the ADC rates is different from the one for AXP20X/AXP22X. GPIO0 can be used as an ADC (measuring Volts) unlike for AXP22X. The scales to apply to the different inputs are unlike the ones from AXP20X and AXP22X. Signed-off-by: Quentin Schulz --- drivers/iio/adc/axp20x_adc.c | 123 ++++++++++++++++++++++++++++++++++++- include/linux/mfd/axp20x.h | 2 +- 2 files changed, 125 insertions(+) -- git-series 0.9.1 diff --git a/drivers/iio/adc/axp20x_adc.c b/drivers/iio/adc/axp20x_adc.c index f8c4c62..df50a1d 100644 --- a/drivers/iio/adc/axp20x_adc.c +++ b/drivers/iio/adc/axp20x_adc.c @@ -35,8 +35,13 @@ #define AXP20X_GPIO10_IN_RANGE_GPIO1_VAL(x) (((x) & BIT(0)) << 1) #define AXP20X_ADC_RATE_MASK GENMASK(7, 6) +#define AXP813_V_I_ADC_RATE_MASK GENMASK(5, 4) +#define AXP813_ADC_RATE_MASK (AXP20X_ADC_RATE_MASK | AXP813_V_I_ADC_RATE_MASK) #define AXP20X_ADC_RATE_HZ(x) ((ilog2((x) / 25) << 6) & AXP20X_ADC_RATE_MASK) #define AXP22X_ADC_RATE_HZ(x) ((ilog2((x) / 100) << 6) & AXP20X_ADC_RATE_MASK) +#define AXP813_TS_GPIO0_ADC_RATE_HZ(x) AXP20X_ADC_RATE_HZ(x) +#define AXP813_V_I_ADC_RATE_HZ(x) ((ilog2((x) / 100) << 4) & AXP813_V_I_ADC_RATE_MASK) +#define AXP813_ADC_RATE_HZ(x) (AXP20X_ADC_RATE_HZ(x) | AXP813_V_I_ADC_RATE_HZ(x)) #define AXP20X_ADC_CHANNEL(_channel, _name, _type, _reg) \ { \ @@ -95,6 +100,12 @@ enum axp22x_adc_channel_i { AXP22X_BATT_DISCHRG_I, }; +enum axp813_adc_channel_v { + AXP813_TS_IN = 0, + AXP813_GPIO0_V, + AXP813_BATT_V, +}; + static struct iio_map axp20x_maps[] = { { .consumer_dev_name = "axp20x-usb-power-supply", @@ -197,6 +208,25 @@ static const struct iio_chan_spec axp22x_adc_channels[] = { AXP20X_BATT_DISCHRG_I_H), }; +static const struct iio_chan_spec axp813_adc_channels[] = { + { + .type = IIO_TEMP, + .address = AXP22X_PMIC_TEMP_H, + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | + BIT(IIO_CHAN_INFO_SCALE) | + BIT(IIO_CHAN_INFO_OFFSET), + .datasheet_name = "pmic_temp", + }, + AXP20X_ADC_CHANNEL(AXP813_GPIO0_V, "gpio0_v", IIO_VOLTAGE, + AXP288_GP_ADC_H), + AXP20X_ADC_CHANNEL(AXP813_BATT_V, "batt_v", IIO_VOLTAGE, + AXP20X_BATT_V_H), + AXP20X_ADC_CHANNEL(AXP22X_BATT_CHRG_I, "batt_chrg_i", IIO_CURRENT, + AXP20X_BATT_CHRG_I_H), + AXP20X_ADC_CHANNEL(AXP22X_BATT_DISCHRG_I, "batt_dischrg_i", IIO_CURRENT, + AXP20X_BATT_DISCHRG_I_H), +}; + static int axp20x_adc_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val) { @@ -243,6 +273,18 @@ static int axp22x_adc_raw(struct iio_dev *indio_dev, return IIO_VAL_INT; } +static int axp813_adc_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int *val) +{ + struct axp20x_adc_iio *info = iio_priv(indio_dev); + + *val = axp20x_read_variable_width(info->regmap, chan->address, 12); + if (*val < 0) + return *val; + + return IIO_VAL_INT; +} + static int axp20x_adc_scale_voltage(int channel, int *val, int *val2) { switch (channel) { @@ -273,6 +315,24 @@ static int axp20x_adc_scale_voltage(int channel, int *val, int *val2) } } +static int axp813_adc_scale_voltage(int channel, int *val, int *val2) +{ + switch (channel) { + case AXP813_GPIO0_V: + *val = 0; + *val2 = 800000; + return IIO_VAL_INT_PLUS_MICRO; + + case AXP813_BATT_V: + *val = 1; + *val2 = 100000; + return IIO_VAL_INT_PLUS_MICRO; + + default: + return -EINVAL; + } +} + static int axp20x_adc_scale_current(int channel, int *val, int *val2) { switch (channel) { @@ -342,6 +402,26 @@ static int axp22x_adc_scale(struct iio_chan_spec const *chan, int *val, } } +static int axp813_adc_scale(struct iio_chan_spec const *chan, int *val, + int *val2) +{ + switch (chan->type) { + case IIO_VOLTAGE: + return axp813_adc_scale_voltage(chan->channel, val, val2); + + case IIO_CURRENT: + *val = 1; + return IIO_VAL_INT; + + case IIO_TEMP: + *val = 100; + return IIO_VAL_INT; + + default: + return -EINVAL; + } +} + static int axp20x_adc_offset_voltage(struct iio_dev *indio_dev, int channel, int *val) { @@ -425,6 +505,26 @@ static int axp22x_read_raw(struct iio_dev *indio_dev, } } +static int axp813_read_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, int *val, + int *val2, long mask) +{ + switch (mask) { + case IIO_CHAN_INFO_OFFSET: + *val = -2667; + return IIO_VAL_INT; + + case IIO_CHAN_INFO_SCALE: + return axp813_adc_scale(chan, val, val2); + + case IIO_CHAN_INFO_RAW: + return axp813_adc_raw(indio_dev, chan, val); + + default: + return -EINVAL; + } +} + static int axp20x_write_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int val, int val2, long mask) @@ -470,6 +570,10 @@ static const struct iio_info axp22x_adc_iio_info = { .read_raw = axp22x_read_raw, }; +static const struct iio_info axp813_adc_iio_info = { + .read_raw = axp813_read_raw, +}; + static int axp20x_adc_rate(struct axp20x_adc_iio *info, int rate) { return regmap_update_bits(info->regmap, AXP20X_ADC_RATE, @@ -484,6 +588,13 @@ static int axp22x_adc_rate(struct axp20x_adc_iio *info, int rate) AXP22X_ADC_RATE_HZ(rate)); } +static int axp813_adc_rate(struct axp20x_adc_iio *info, int rate) +{ + return regmap_update_bits(info->regmap, AXP813_ADC_RATE, + AXP813_ADC_RATE_MASK, + AXP813_ADC_RATE_HZ(rate)); +} + struct axp_data { const struct iio_info *iio_info; int num_channels; @@ -515,9 +626,20 @@ static const struct axp_data axp22x_data = { .maps = axp22x_maps, }; +static const struct axp_data axp813_data = { + .iio_info = &axp813_adc_iio_info, + .num_channels = ARRAY_SIZE(axp813_adc_channels), + .channels = axp813_adc_channels, + .adc_en1_mask = AXP22X_ADC_EN1_MASK, + .adc_rate = axp813_adc_rate, + .adc_en2 = false, + .maps = axp22x_maps, +}; + static const struct of_device_id axp20x_adc_of_match[] = { { .compatible = "x-powers,axp20x-adc", .data = (void *)&axp20x_data, }, { .compatible = "x-powers,axp22x-adc", .data = (void *)&axp22x_data, }, + { .compatible = "x-powers,axp813-adc", .data = (void *)&axp813_data, }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, axp20x_adc_of_match); @@ -525,6 +647,7 @@ MODULE_DEVICE_TABLE(of, axp20x_adc_of_match); static const struct platform_device_id axp20x_adc_id_match[] = { { .name = "axp20x-adc", .driver_data = (kernel_ulong_t)&axp20x_data, }, { .name = "axp22x-adc", .driver_data = (kernel_ulong_t)&axp22x_data, }, + { .name = "axp813-adc", .driver_data = (kernel_ulong_t)&axp813_data, }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(platform, axp20x_adc_id_match); diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h index 080798f..82bf774 100644 --- a/include/linux/mfd/axp20x.h +++ b/include/linux/mfd/axp20x.h @@ -266,6 +266,8 @@ enum axp20x_variants { #define AXP288_RT_BATT_V_H 0xa0 #define AXP288_RT_BATT_V_L 0xa1 +#define AXP813_ADC_RATE 0x85 + /* Fuel Gauge */ #define AXP288_FG_RDC1_REG 0xba #define AXP288_FG_RDC0_REG 0xbb From patchwork Tue Jan 9 09:33:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 123834 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3806546qgn; Tue, 9 Jan 2018 01:40:20 -0800 (PST) X-Google-Smtp-Source: ACJfBovt1z94qiG6gBZHt2UHjHI8Q4BIIvnd3aHGduNlQnkMEhWHVGBOPHkWjKMKEaKRDSHK6c9c X-Received: by 10.98.93.157 with SMTP id n29mr4050951pfj.195.1515490820716; Tue, 09 Jan 2018 01:40:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515490820; cv=none; d=google.com; s=arc-20160816; b=PTlBT05Ea4hXMy5a9TN16sVmvupEuHSAoiPKt/sDALgm9Zosz+HZFsLKIt44J46wYC 1UTaFFDKNmtLCrb3GxE7PMLxz+M3JEzHPUY1tRhBZd9kATcDWkd0Kwv83Zd7FH/qS87D znU5XZS55vXA0GpqHeGU9vDkwApqtSFnNljCYPjmFCNTn0FljdAF60etqgcNg9NE2sYN QyrMgxlvjB7GnF6s6gEoCu5BNgZfYjoYzSQqDymXC034INnY1CBYmj/2ZcTlf7k+44gG Mq7zTspGP+cEwWwcciHOaNauJbc5m/hCbi7KnFt/kX+0zNrmjTEKlkIcbrAmINCC/M6r 2gyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=UNrtc2OkNLrixUGuYEI1XNUbpK1E1CDeJ+1dQ2gF00s=; b=ITtvNhsEqohZ8YYWgVzG+pZ5jZ/1AZ7vDOqePUAY9/9FeM3Z9V3P2y+dwvUVao4z/Z pp9wUn+FSC5AnRTxQeAT9qdjAIlIgs9Gq2jxJ4j9FccVVrHHHg9aPKVeWmW4vxl3neCy 0J/kNZN3lu2pxX3f4GhM9hIgFe0QetuPRiyltl+uY59AhuVUkYOt7E5CjAFoF3wlEaeO Gy7SuSrJvlgF3FwZ1+8KXFLZp2L/640WFY+nAD6UOQ4Us14oUcAmZB79Zc/26tsEpsg3 QpDyIaKKDcNp3qI2kxMFbMnR2+HIPz7hiQt5s7f8P+Bg/vakJvST36QL+djK5O677dK7 4rkQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3si787700pgc.323.2018.01.09.01.40.20; Tue, 09 Jan 2018 01:40:20 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752861AbeAIJfU (ORCPT + 28 others); Tue, 9 Jan 2018 04:35:20 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:45767 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752743AbeAIJfL (ORCPT ); Tue, 9 Jan 2018 04:35:11 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 4CD88209F7; Tue, 9 Jan 2018 10:35:09 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id F37D32081A; Tue, 9 Jan 2018 10:34:51 +0100 (CET) From: Quentin Schulz To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, sre@kernel.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org Cc: linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, Quentin Schulz Subject: [PATCH v2 09/16] ARM: dtsi: axp81x: add node for ADC Date: Tue, 9 Jan 2018 10:33:40 +0100 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds a DT node for the ADC of the PMIC so that there can be consumers of its IIO channels declaring their consumptions via DT. Signed-off-by: Quentin Schulz --- arch/arm/boot/dts/axp81x.dtsi | 5 +++++ 1 file changed, 5 insertions(+) -- git-series 0.9.1 diff --git a/arch/arm/boot/dts/axp81x.dtsi b/arch/arm/boot/dts/axp81x.dtsi index fd55b89..dd25bfe 100644 --- a/arch/arm/boot/dts/axp81x.dtsi +++ b/arch/arm/boot/dts/axp81x.dtsi @@ -48,6 +48,11 @@ interrupt-controller; #interrupt-cells = <1>; + axp_adc: axp-adc { + compatible = "x-powers,axp813-adc"; + #io-channel-cells = <1>; + }; + axp_gpio: axp-gpio { compatible = "x-powers,axp813-gpio"; gpio-controller; From patchwork Tue Jan 9 09:33:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 123835 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3807004qgn; Tue, 9 Jan 2018 01:40:47 -0800 (PST) X-Google-Smtp-Source: ACJfBotGTr9NiVpB1HfYoYqP1YCdgQTFV534h/pxmLMxkxtRN2C2qMnJNTCXqv9fdTKfuiqUIcEb X-Received: by 10.84.215.15 with SMTP id k15mr1998135pli.197.1515490847456; Tue, 09 Jan 2018 01:40:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515490847; cv=none; d=google.com; s=arc-20160816; b=06C5CtS0qr/Y8lN4Vn5WJW7xo7PGF9MwW/cpNO+kG+Cat+ZHHSEY0PtnMJzPgaDcY+ P3yHsBpfkOo6lPUUC5zBMe+4k77UQPcQ15HggS6HIVM7veoXYWtPRfDh4bEtlV2UWu+Z rzoYSldDV0FCnf6yzzat28MmewxWpAm1tv2q/ny8JeuA9PToW+uXiVYiO0O7oCNmv2UV +TaMbq7c8EjuBzl9vV21lfFilbmQdcSE82W94PvHQWmUot7yCorHCdB5awXCicOyMxcK MhAaWCqk1FfNSEnH3mwPLDp2TSMYKPJrf1sF04bFvkFMa9xjzg3C5Kmglo63zrt7i9oi 8udw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Lpw/Q0nL8qED91saLpHDbkQhg1RIxPG/ht76sWug8OQ=; b=cMqsxpoUWk9Flr78+N8lfaGqCiOMu5RidwGXpwVNFXexBqUnHs41CPGmTlEH8GghHn P/PCqIxOT6pQJPDKeNeHyle1TByeVmc3U0OuDvKVaho4QtpXh2sXoFiTbSSw6t7c3al7 Oi6LPaM7/DHmGPEBTyZ7mrKiVgm+2h2B3pNhSnaHifhIoSYhiBtPz0op8GOR/IvWQu5x uHO9ZSauZolbgitonbXO9sXvOPN7iWoqi/CHptxEpPhzzK4TbnFu3jXpdJKCYldZxNLM gXtF2LqmetfcRpEbtsQTwD6DACvYjen171Bd2VQo5iYo7FgiEtEoksJB6l718wmbyBHF JiVw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u15si3338098pgc.781.2018.01.09.01.40.47; Tue, 09 Jan 2018 01:40:47 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752813AbeAIJfR (ORCPT + 28 others); Tue, 9 Jan 2018 04:35:17 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:45796 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752761AbeAIJfM (ORCPT ); Tue, 9 Jan 2018 04:35:12 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id AC033209FA; Tue, 9 Jan 2018 10:35:09 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 623742082B; Tue, 9 Jan 2018 10:34:52 +0100 (CET) From: Quentin Schulz To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, sre@kernel.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org Cc: linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, Quentin Schulz Subject: [PATCH v2 10/16] mfd: axp20x: probe axp20x_adc driver for AXP813 Date: Tue, 9 Jan 2018 10:33:41 +0100 Message-Id: <6d52ef3dd2c7630517cb573f247b419d31c71e3a.1515486346.git-series.quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This makes the axp20x_adc driver probe with platform device id "axp813-adc". Signed-off-by: Quentin Schulz --- drivers/mfd/axp20x.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- git-series 0.9.1 diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index e0cbaea..d112414 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c @@ -884,7 +884,10 @@ static struct mfd_cell axp813_cells[] = { }, { .name = "axp20x-gpio", .of_compatible = "x-powers,axp813-gpio", - } + }, { + .name = "axp813-adc", + .of_compatible = "x-powers,axp813-adc", + }, }; static struct axp20x_dev *axp20x_pm_power_off; From patchwork Tue Jan 9 09:33:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 123824 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3802168qgn; Tue, 9 Jan 2018 01:35:26 -0800 (PST) X-Google-Smtp-Source: ACJfBotlXIuERq9d7amibTX6oFsXp48kUWQBAuG0/W9brhVTLYiYvY+rRBA9igxDtZmcOXAdos6x X-Received: by 10.98.147.195 with SMTP id r64mr6825088pfk.83.1515490526794; Tue, 09 Jan 2018 01:35:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515490526; cv=none; d=google.com; s=arc-20160816; b=V0qi78j1ahRrkHiBeVUtMegefhjfZAJtJD2tW1FvTXhHsDm5e15nR0F5xhLvhfkSbv cyIiUjP9O6SNgFE59Pi9hiCK4CHD2mynAyqdeucM2GZgvEGYcMCehGfyh0FtcI1Emzn7 vt4CnkCxShFALMzdtN6eII9uYosurSBvo2S8dcZ0fRhTiCz0o+CHP3hI+jR5SVRAepxp TqzkMLOBj8m2S1bL/bniThQSusXJAC4ZPuNQhQkQlR7SalORPVKcxu23/5Sjfk0jbDjH 2WbtQj263Ovm3Q9OoGMOYdfDYAw0rShXQE3pgA3kXUZv3tvYsfb/kf+w0le0DoDFKP3Q g1ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=QlEqDCr++M3GEVZnuUm730kDTz++/m22zQtVn6glbWc=; b=KNhfWidF+wX8YTPNX9QjqvY632I6qSn5kqBKCP0alX8JwXohLt1aqIiLXJ6+GbPtEi IPWJcXDbqqwKVOdvw6VPjLv0krlvf+OzvxAD/5F25NLaxDMdrgTTqsN/IWc5QguO0PuM KR1GjiSAXrbcqpo0J+CZVmu9fa8GumUp+r2CcrCjt50aIYdDrrAbodMZiutWG5StU5bm XS59Wr5kEJaqnpYjR66v6knxkCdgqDIgkSPkzDZJQHo567nd+FHhKzRZMXY6oYYFGqyE UE0AUx3fODng55Rwe6nsuXe33EgZu1KOrzaHoibXF4TVMtUvanDZQi8l/mSDISKYLRC+ hCrw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r74si945985pfg.270.2018.01.09.01.35.26; Tue, 09 Jan 2018 01:35:26 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752916AbeAIJfY (ORCPT + 28 others); Tue, 9 Jan 2018 04:35:24 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:45816 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752770AbeAIJfN (ORCPT ); Tue, 9 Jan 2018 04:35:13 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 2EB49209FD; Tue, 9 Jan 2018 10:35:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id C9C2520849; Tue, 9 Jan 2018 10:34:52 +0100 (CET) From: Quentin Schulz To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, sre@kernel.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org Cc: linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, Quentin Schulz Subject: [PATCH v2 11/16] power: supply: axp20x_battery: use data structure instead of ID for Date: Tue, 9 Jan 2018 10:33:42 +0100 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org variant specific code We used to use IDs to select a function or a feature depending on the variant. It's easier to maintain the code by adding data structure storing the few differences between variants so that we don't add a pile of if conditions. Let's use this data structure and update the code to use it. Signed-off-by: Quentin Schulz --- drivers/power/supply/axp20x_battery.c | 100 +++++++++++++++++---------- 1 file changed, 66 insertions(+), 34 deletions(-) -- git-series 0.9.1 diff --git a/drivers/power/supply/axp20x_battery.c b/drivers/power/supply/axp20x_battery.c index 7494f0f..d73c78f 100644 --- a/drivers/power/supply/axp20x_battery.c +++ b/drivers/power/supply/axp20x_battery.c @@ -53,6 +53,16 @@ #define AXP20X_V_OFF_MASK GENMASK(2, 0) +struct axp20x_batt_ps; + +struct axp_data { + int ccc_scale; + int ccc_offset; + bool has_fg_valid; + int (*get_max_voltage)(struct axp20x_batt_ps *batt, int *val); + int (*set_max_voltage)(struct axp20x_batt_ps *batt, int val); +}; + struct axp20x_batt_ps { struct regmap *regmap; struct power_supply *batt; @@ -62,7 +72,7 @@ struct axp20x_batt_ps { struct iio_channel *batt_v; /* Maximum constant charge current */ unsigned int max_ccc; - u8 axp_id; + struct axp_data *data; }; static int axp20x_battery_get_max_voltage(struct axp20x_batt_ps *axp20x_batt, @@ -123,22 +133,6 @@ static int axp22x_battery_get_max_voltage(struct axp20x_batt_ps *axp20x_batt, return 0; } -static void raw_to_constant_charge_current(struct axp20x_batt_ps *axp, int *val) -{ - if (axp->axp_id == AXP209_ID) - *val = *val * 100000 + 300000; - else - *val = *val * 150000 + 300000; -} - -static void constant_charge_current_to_raw(struct axp20x_batt_ps *axp, int *val) -{ - if (axp->axp_id == AXP209_ID) - *val = (*val - 300000) / 100000; - else - *val = (*val - 300000) / 150000; -} - static int axp20x_get_constant_charge_current(struct axp20x_batt_ps *axp, int *val) { @@ -150,7 +144,7 @@ static int axp20x_get_constant_charge_current(struct axp20x_batt_ps *axp, *val &= AXP20X_CHRG_CTRL1_TGT_CURR; - raw_to_constant_charge_current(axp, val); + *val = *val * axp->data->ccc_scale + axp->data->ccc_offset; return 0; } @@ -269,8 +263,7 @@ static int axp20x_battery_get_prop(struct power_supply *psy, if (ret) return ret; - if (axp20x_batt->axp_id == AXP221_ID && - !(reg & AXP22X_FG_VALID)) + if (axp20x_batt->data->has_fg_valid && !(reg & AXP22X_FG_VALID)) return -EINVAL; /* @@ -281,11 +274,8 @@ static int axp20x_battery_get_prop(struct power_supply *psy, break; case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN: - if (axp20x_batt->axp_id == AXP209_ID) - return axp20x_battery_get_max_voltage(axp20x_batt, - &val->intval); - return axp22x_battery_get_max_voltage(axp20x_batt, - &val->intval); + return axp20x_batt->data->get_max_voltage(axp20x_batt, + &val->intval); case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: ret = regmap_read(axp20x_batt->regmap, AXP20X_V_OFF, ®); @@ -312,6 +302,32 @@ static int axp20x_battery_get_prop(struct power_supply *psy, return 0; } +static int axp22x_battery_set_max_voltage(struct axp20x_batt_ps *axp20x_batt, + int val) +{ + switch (val) { + case 4100000: + val = AXP20X_CHRG_CTRL1_TGT_4_1V; + break; + + case 4200000: + val = AXP20X_CHRG_CTRL1_TGT_4_2V; + break; + + default: + /* + * AXP20x max voltage can be set to 4.36V and AXP22X max voltage + * can be set to 4.22V and 4.24V, but these voltages are too + * high for Lithium based batteries (AXP PMICs are supposed to + * be used with these kinds of battery). + */ + return -EINVAL; + } + + return regmap_update_bits(axp20x_batt->regmap, AXP20X_CHRG_CTRL1, + AXP20X_CHRG_CTRL1_TGT_VOLT, val); +} + static int axp20x_battery_set_max_voltage(struct axp20x_batt_ps *axp20x_batt, int val) { @@ -321,9 +337,6 @@ static int axp20x_battery_set_max_voltage(struct axp20x_batt_ps *axp20x_batt, break; case 4150000: - if (axp20x_batt->axp_id == AXP221_ID) - return -EINVAL; - val = AXP20X_CHRG_CTRL1_TGT_4_15V; break; @@ -351,7 +364,8 @@ static int axp20x_set_constant_charge_current(struct axp20x_batt_ps *axp_batt, if (charge_current > axp_batt->max_ccc) return -EINVAL; - constant_charge_current_to_raw(axp_batt, &charge_current); + charge_current = (charge_current - axp_batt->data->ccc_offset) / + axp_batt->data->ccc_scale; if (charge_current > AXP20X_CHRG_CTRL1_TGT_CURR || charge_current < 0) return -EINVAL; @@ -365,12 +379,14 @@ static int axp20x_set_max_constant_charge_current(struct axp20x_batt_ps *axp, { bool lower_max = false; - constant_charge_current_to_raw(axp, &charge_current); + charge_current = (charge_current - axp->data->ccc_offset) / + axp->data->ccc_scale; if (charge_current > AXP20X_CHRG_CTRL1_TGT_CURR || charge_current < 0) return -EINVAL; - raw_to_constant_charge_current(axp, &charge_current); + charge_current = charge_current * axp->data->ccc_scale + + axp->data->ccc_offset; if (charge_current > axp->max_ccc) dev_warn(axp->dev, @@ -460,13 +476,28 @@ static const struct power_supply_desc axp20x_batt_ps_desc = { .set_property = axp20x_battery_set_prop, }; +struct axp_data axp209_data = { + .ccc_scale = 100000, + .ccc_offset = 300000, + .get_max_voltage = axp20x_battery_get_max_voltage, + .set_max_voltage = axp20x_battery_set_max_voltage, +}; + +struct axp_data axp221_data = { + .ccc_scale = 150000, + .ccc_offset = 300000, + .has_fg_valid = true, + .get_max_voltage = axp22x_battery_get_max_voltage, + .set_max_voltage = axp22x_battery_set_max_voltage, +}; + static const struct of_device_id axp20x_battery_ps_id[] = { { .compatible = "x-powers,axp209-battery-power-supply", - .data = (void *)AXP209_ID, + .data = (void *)&axp209_data, }, { .compatible = "x-powers,axp221-battery-power-supply", - .data = (void *)AXP221_ID, + .data = (void *)&axp221_data, }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, axp20x_battery_ps_id); @@ -476,6 +507,7 @@ static int axp20x_power_probe(struct platform_device *pdev) struct axp20x_batt_ps *axp20x_batt; struct power_supply_config psy_cfg = {}; struct power_supply_battery_info info; + struct device *dev = &pdev->dev; if (!of_device_is_available(pdev->dev.of_node)) return -ENODEV; @@ -516,7 +548,7 @@ static int axp20x_power_probe(struct platform_device *pdev) psy_cfg.drv_data = axp20x_batt; psy_cfg.of_node = pdev->dev.of_node; - axp20x_batt->axp_id = (uintptr_t)of_device_get_match_data(&pdev->dev); + axp20x_batt->data = (struct axp_data *)of_device_get_match_data(dev); axp20x_batt->batt = devm_power_supply_register(&pdev->dev, &axp20x_batt_ps_desc, From patchwork Tue Jan 9 09:33:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 123825 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3802226qgn; Tue, 9 Jan 2018 01:35:31 -0800 (PST) X-Google-Smtp-Source: ACJfBoumkoT6lCb1/I23X6E1u4/z0MCCMJF4LweAbbIqr7zzgBks4POxbtF1/iIkct8CaRXTMIOU X-Received: by 10.98.110.199 with SMTP id j190mr4247917pfc.147.1515490530910; Tue, 09 Jan 2018 01:35:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515490530; cv=none; d=google.com; s=arc-20160816; b=ocRW7kZwo31OXoIjBEb91jmTGtXpMpsx5DLxxomCTByTfsRWrrEgUw8oHP8Rb4LnR/ v9T7YdKGoP2UI40Y8a373STWIEC7vfGGX47gWIxN5D5lFaTXedyM2it4YnUeQftCNaS3 dJJLS9aBjGRaRjDYr0xkPvLIZ/nKqUNO7urGkEMQk68Qn6Y/yrEKYNDhvEXlj1qoRczo sLo88PTdL0MOsDwMONyrrON95HPEs15s3nUn8ApABhKh6hNSh0eI2fdphKcdXUvI4PpK HLAp5aT2yIqR9a0CTr1KmAD5fyqGWvGXxb5Gl2tF1G75BviIIHAFxcQv9dRPy1TG4d+v D7Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Gpz2DPT+phbB12RePjs9P/Huq+oVD9CldavofuPof1U=; b=D68E8UyuUNaJjXgMVwL4WnJ0sYkPv+L6PcsSZAQLeIeA16GXzcq19SiNzk0Msu4rtJ mmXRKuKqPYHbVM+bNdik6M21nnFJbexBQoWg58xHCav9Dd69UCQu9deMIXIbU/Otiq5h bpWMEWWY8m9VoMf++iWhkLl3UP2jmeoxtt9meGmx9hAmlKNs1gawgoNBwdRJAjxJ1TN+ E2NAKgkAW7+ROqLbJeS6YI+ZItDtr/gnWRMpw5lXSqROz4IORiAh/XCOxF0E3eiW8rqO 6zwxHLIR9k+u7NlhqJjfenk2D0O1Dg0NqWSdMugtSj2Ln5/8nzUmJGhP3RKNxydnZgdW 1WCQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r74si945985pfg.270.2018.01.09.01.35.30; Tue, 09 Jan 2018 01:35:30 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752978AbeAIJf2 (ORCPT + 28 others); Tue, 9 Jan 2018 04:35:28 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:45815 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752636AbeAIJfM (ORCPT ); Tue, 9 Jan 2018 04:35:12 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 7C7B720A05; Tue, 9 Jan 2018 10:35:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 3DE0F2091C; Tue, 9 Jan 2018 10:34:53 +0100 (CET) From: Quentin Schulz To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, sre@kernel.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org Cc: linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, Quentin Schulz Subject: [PATCH v2 12/16] dt-bindings: power: supply: axp20x: add AXP813 battery DT binding Date: Tue, 9 Jan 2018 10:33:43 +0100 Message-Id: <538e93d723d7755928ad118564a571371cb337b6.1515486346.git-series.quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The AXP813 can have a battery as power supply, so let's add it to the list of compatibles. Signed-off-by: Quentin Schulz --- Documentation/devicetree/bindings/power/supply/axp20x_battery.txt | 8 +++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- git-series 0.9.1 diff --git a/Documentation/devicetree/bindings/power/supply/axp20x_battery.txt b/Documentation/devicetree/bindings/power/supply/axp20x_battery.txt index c248866..4614c8e 100644 --- a/Documentation/devicetree/bindings/power/supply/axp20x_battery.txt +++ b/Documentation/devicetree/bindings/power/supply/axp20x_battery.txt @@ -4,12 +4,12 @@ Required Properties: - compatible, one of: "x-powers,axp209-battery-power-supply" "x-powers,axp221-battery-power-supply" + "x-powers,axp813-battery-power-supply" -This node is a subnode of the axp20x/axp22x PMIC. +This node is a subnode of the axp20x/axp22x/axp81x PMIC. -The AXP20X and AXP22X can read the battery voltage, charge and discharge -currents of the battery by reading ADC channels from the AXP20X/AXP22X -ADC. +The AXP20X, AXP22X and AXP81X can read the battery voltage, charge and +discharge currents of the battery by reading ADC channels from the ADC. Example: From patchwork Tue Jan 9 09:33:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 123829 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3803966qgn; Tue, 9 Jan 2018 01:37:25 -0800 (PST) X-Google-Smtp-Source: ACJfBotyxOklmFoaP9f6G12QtEZeKKkgJQGnlrRUK6SwfcDJi1IEidDp7cM6zWpauVjLAJbLvZHF X-Received: by 10.101.93.71 with SMTP id e7mr11931870pgt.342.1515490645061; Tue, 09 Jan 2018 01:37:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515490645; cv=none; d=google.com; s=arc-20160816; b=kW88Yj+JR4QlBglmNrIQUz+lSuFR3WVy9zdy09kUnuMlK/MQl10d8QGQI+5U761Kme lO/2m9ji6AI3lgNBGIoBTo8SlyMZCj+cDhSGXAIsgS2BpdddHHEWob6BOaC39tCW6Xq8 6Gl3FLwEDOqFBcDiq16OE6b8HQ1j8HmPIQybaq7NzRhV4Gi++tCITqZ5Bksa2Min5RXa TS49EGt6G752xvExgvj469ok+T9PrchZ2sHZCmwDx/vxnaHLDREZSTIjC5IN2UUBjhoB 6xUqP4t99XQJscdJvr88jxIOzOIJ8c9C1o5rzIYlMNoCG+Y6N6/FdnQJvFQKHQqOAKCZ xYCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=n6RGrh130yVCgtGXOLSBlb/8Nk1rs6kdlNB3hp5EUZg=; b=DVmElsIcr3GcEvqLJ/2O/clyTJr/LmWSZfeqFCuaGvqT49ICvyN2kpPALMmUU/SuoJ Tnc0pWrMKdcfE07yp5bhmYaXwK252BkZQXWhxRPHcPL7tjHBCkJiP6Q1cy5PNhyRn7bW To74AuaW2lBLXl4xOD5cxILW/bytUnMsUAZZOa/JeSpS5oJE78c+tpUg9HwY7pDkX7ie fzv95PbR3D2+wSx/AvQEmy8q16ChtAKxStiGfYtS2qTud/4c6xQva+poeoypg5PrIb/w NP9H8U8uZ7LRmANENXiI8bEAC68yRFisEXn52pEsLlXpP6pBzx2mfFyLVjRRM4OPKYGS 0yrg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 20si2792849pgd.240.2018.01.09.01.37.24; Tue, 09 Jan 2018 01:37:25 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752953AbeAIJf0 (ORCPT + 28 others); Tue, 9 Jan 2018 04:35:26 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:45828 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752771AbeAIJfN (ORCPT ); Tue, 9 Jan 2018 04:35:13 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 8846F20A07; Tue, 9 Jan 2018 10:35:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id A0BA82092C; Tue, 9 Jan 2018 10:34:53 +0100 (CET) From: Quentin Schulz To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, sre@kernel.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org Cc: linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, Quentin Schulz Subject: [PATCH v2 13/16] power: supply: axp20x_battery: add support for AXP813 Date: Tue, 9 Jan 2018 10:33:44 +0100 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The X-Powers AXP813 PMIC has got some slight differences from AXP20X/AXP22X PMICs: - the maximum voltage supplied by the PMIC is 4.35 instead of 4.36/4.24 for AXP20X/AXP22X, - the constant charge current formula is different, It also has a bit to tell whether the battery percentage returned by the PMIC is valid. Signed-off-by: Quentin Schulz --- drivers/power/supply/axp20x_battery.c | 42 ++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+) -- git-series 0.9.1 diff --git a/drivers/power/supply/axp20x_battery.c b/drivers/power/supply/axp20x_battery.c index d73c78f..dad72a5 100644 --- a/drivers/power/supply/axp20x_battery.c +++ b/drivers/power/supply/axp20x_battery.c @@ -46,6 +46,8 @@ #define AXP20X_CHRG_CTRL1_TGT_4_2V (2 << 5) #define AXP20X_CHRG_CTRL1_TGT_4_36V (3 << 5) +#define AXP813_CHRG_CTRL1_TGT_4_35V (3 << 5) + #define AXP22X_CHRG_CTRL1_TGT_4_22V (1 << 5) #define AXP22X_CHRG_CTRL1_TGT_4_24V (3 << 5) @@ -133,6 +135,35 @@ static int axp22x_battery_get_max_voltage(struct axp20x_batt_ps *axp20x_batt, return 0; } +static int axp813_battery_get_max_voltage(struct axp20x_batt_ps *axp20x_batt, + int *val) +{ + int ret, reg; + + ret = regmap_read(axp20x_batt->regmap, AXP20X_CHRG_CTRL1, ®); + if (ret) + return ret; + + switch (reg & AXP20X_CHRG_CTRL1_TGT_VOLT) { + case AXP20X_CHRG_CTRL1_TGT_4_1V: + *val = 4100000; + break; + case AXP20X_CHRG_CTRL1_TGT_4_15V: + *val = 4150000; + break; + case AXP20X_CHRG_CTRL1_TGT_4_2V: + *val = 4200000; + break; + case AXP813_CHRG_CTRL1_TGT_4_35V: + *val = 4350000; + break; + default: + return -EINVAL; + } + + return 0; +} + static int axp20x_get_constant_charge_current(struct axp20x_batt_ps *axp, int *val) { @@ -491,6 +522,14 @@ struct axp_data axp221_data = { .set_max_voltage = axp22x_battery_set_max_voltage, }; +struct axp_data axp813_data = { + .ccc_scale = 200000, + .ccc_offset = 200000, + .has_fg_valid = true, + .get_max_voltage = axp813_battery_get_max_voltage, + .set_max_voltage = axp20x_battery_set_max_voltage, +}; + static const struct of_device_id axp20x_battery_ps_id[] = { { .compatible = "x-powers,axp209-battery-power-supply", @@ -498,6 +537,9 @@ static const struct of_device_id axp20x_battery_ps_id[] = { }, { .compatible = "x-powers,axp221-battery-power-supply", .data = (void *)&axp221_data, + }, { + .compatible = "x-powers,axp813-battery-power-supply", + .data = (void *)&axp813_data, }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, axp20x_battery_ps_id); From patchwork Tue Jan 9 09:33:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 123841 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3808934qgn; Tue, 9 Jan 2018 01:43:07 -0800 (PST) X-Google-Smtp-Source: ACJfBothpplN3sHdyk2m1PlDLFySHtbAK9JMjb36YuyUGyU+rKt5p2bbLzktXRsTIkGKVBl0J0ya X-Received: by 10.98.7.85 with SMTP id b82mr13111080pfd.226.1515490987106; Tue, 09 Jan 2018 01:43:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515490987; cv=none; d=google.com; s=arc-20160816; b=DEumzJhQT2Lpl72arKEwP+OS3gy3glfwknkyrP2u951fr0nVqVDTCgen8ij9eKGBjU Y18hx8tPf5NlzFEdI16wqb2slV1erIb6dJBBz8GDpVGWen4W9L6pm4rWpqATYgOVFqOa NlVZa0JHr4Uk7R7mJeig/PZWzaOSZHFZsKkgHmkEXeZKAi3c+862SCq7P8z6JfXjlXEB qZ5l6QrVYGFg5/KP9MEexNTQ2LRC9WXznny7jNSzMJyjqvFfLBrLrQVBcXwBnHdMBPjB FpYKMYqYqbsWMgSpdBXjvfCTLlN/Pfs4VUX4nGG9m+gCWRC4b2S3PoB1cSSgs9RlW7mC +KWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=sAvqcTXlS+QvUmG/d7fTZiLo9NJ0qrBx6Gow3FJvtH4=; b=1FtgQoBQUD1Ks+vARWs+IWIBKoaXyLMBl5/gkrUcrHvtjoFiW92yuepHrz/9ojQBzQ bULlDec+3bbZaqGg89UCL7r29sjMLi2hc0ZrD4heg8w+Xk0rG1+Fc4cNNtT6q1LEC0mi /qfLabKNgUnnDNi5BfNBjA+5+l4/qxygqVEVwBoGk3C+7bXtDxTtreRzzto77G9pM70N kIcCaL8YRCyD4LCnDrey5EiL4ksie14LekF4wj9/xv7/abIO2xbZiObv27tvTwbsCo5/ 5nkveOJ3FCqldNQ2UpgxRNzrlDQL9GvsVjf6JD248OH4t5lFdhKaKaRupB54PzogdAwZ uDcA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w25si486708pgc.287.2018.01.09.01.43.06; Tue, 09 Jan 2018 01:43:07 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752983AbeAIJlK (ORCPT + 28 others); Tue, 9 Jan 2018 04:41:10 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:45838 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752772AbeAIJfN (ORCPT ); Tue, 9 Jan 2018 04:35:13 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id DD20120931; Tue, 9 Jan 2018 10:35:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 10FE320931; Tue, 9 Jan 2018 10:34:54 +0100 (CET) From: Quentin Schulz To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, sre@kernel.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org Cc: linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, Quentin Schulz Subject: [PATCH v2 14/16] mfd: axp20x: add battery power supply cell for AXP813 Date: Tue, 9 Jan 2018 10:33:45 +0100 Message-Id: <9f360d2724893421f5a8838639bbd9370361f61a.1515486346.git-series.quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As axp20x-battery-power-supply now supports AXP813, add a cell for it. Signed-off-by: Quentin Schulz --- drivers/mfd/axp20x.c | 3 +++ 1 file changed, 3 insertions(+) -- git-series 0.9.1 diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index d112414..1175091 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c @@ -887,6 +887,9 @@ static struct mfd_cell axp813_cells[] = { }, { .name = "axp813-adc", .of_compatible = "x-powers,axp813-adc", + }, { + .name = "axp20x-battery-power-supply", + .of_compatible = "x-powers,axp813-battery-power-supply", }, }; From patchwork Tue Jan 9 09:33:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 123839 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3807731qgn; Tue, 9 Jan 2018 01:41:40 -0800 (PST) X-Google-Smtp-Source: ACJfBouxuah7godq61X654NtIRRk4SJwqEqw2d0K3DfyFVBB8Ppq4PYmn4yA/or4cbvDMseE4JCt X-Received: by 10.99.175.76 with SMTP id s12mr11778559pgo.328.1515490900766; Tue, 09 Jan 2018 01:41:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515490900; cv=none; d=google.com; s=arc-20160816; b=RLjMc+jckeHB9cU2WkhwAlVb52BRoYtKvShknSKLfXsQ9VI19tc8/vM2j1LgpFJo6f +vctouOhLlZzexs1f3MOBU7qRM5/fd8QnPYWUyL+MgVpF8qsJ15jZ3Snf/z51H6AG3R0 gAJcc8o7A1nuEPokhTAg6Eo2eAIl4PoQ9aqznpBQ1HsXRCWCgUAKs24UeXvAw4Nhr9eH xyRaXTAHNvdBpKh4aUleDDsJSwUXVMsC0thmGB9KDpJzDGNLt7klWtBC1HFb2vVwlBbD 58G9HGEAuiLvHZ9WHcxHob28XOw1rYDB6HPOScQ7cDdOB//69ci8vppNa2/TlzhUmFY8 YUdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=GNCG3GW0EUeP/Yo9sHxkGMx4NcKx9ouvO1760zqxIzo=; b=TWRSsO3sHWkIkjr4l3t1juR1ecHJR3Qzg+kxLMx0TVrs4xZwzzVtoaG+C8fCxdbSJl MStMK+NTJCjmIkla+gbPS/p8adWwDRbT64JDzkN2qwY4G5P74IYwkTGGpP44EDgudN+D QEOy6kv3FokZhI28xVaLho/41CIQsItMTE5wjIRpNY40I6PnLeEQE1deW+JXtzFgai9d Xth6iKhjpXzZ7j6q/6oiKKCLldMJYTKGGxYYc3queQQgy7K03XVnZmDpMCBI8Tp72Z85 AIAM1g7cvdcWJDcbTE+V9v2POUUfyw+uN1FF77btY0+zAMYVnDbc3NazMbMNikjUwN8T WPXQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1si10058464pld.226.2018.01.09.01.41.40; Tue, 09 Jan 2018 01:41:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753275AbeAIJlP (ORCPT + 28 others); Tue, 9 Jan 2018 04:41:15 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:45846 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752773AbeAIJfN (ORCPT ); Tue, 9 Jan 2018 04:35:13 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id E573420A12; Tue, 9 Jan 2018 10:35:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 7BE5120938; Tue, 9 Jan 2018 10:34:54 +0100 (CET) From: Quentin Schulz To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, sre@kernel.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org Cc: linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, Quentin Schulz Subject: [PATCH v2 15/16] ARM: dtsi: axp81x: add battery power supply subnode Date: Tue, 9 Jan 2018 10:33:46 +0100 Message-Id: <24730136f603c9825729cc2a3822a40dd84e129e.1515486346.git-series.quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The X-Powers AXP81X PMIC exposes battery supply various data such as the battery status (charging, discharging, full, dead), current max limit, current current, battery capacity (in percentage), voltage max and min limits, current voltage, and battery capacity (in Ah). This adds the battery power supply subnode for AXP81X PMIC. Signed-off-by: Quentin Schulz --- arch/arm/boot/dts/axp81x.dtsi | 5 +++++ 1 file changed, 5 insertions(+) -- git-series 0.9.1 diff --git a/arch/arm/boot/dts/axp81x.dtsi b/arch/arm/boot/dts/axp81x.dtsi index dd25bfe..5fb396e 100644 --- a/arch/arm/boot/dts/axp81x.dtsi +++ b/arch/arm/boot/dts/axp81x.dtsi @@ -69,6 +69,11 @@ }; }; + battery_power_supply: battery-power-supply { + compatible = "x-powers,axp813-battery-power-supply"; + status = "disabled"; + }; + regulators { /* Default work frequency for buck regulators */ x-powers,dcdc-freq = <3000>; From patchwork Tue Jan 9 09:33:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 123833 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3806184qgn; Tue, 9 Jan 2018 01:39:56 -0800 (PST) X-Google-Smtp-Source: ACJfBovP4QEcMOvwxHHkGZCLTjd6V1Dv0M255C0VxMYS7r2Iil9EoDG8kjY5E3UXy3qDS/FQv4ya X-Received: by 10.159.204.131 with SMTP id t3mr15185098plo.381.1515490795915; Tue, 09 Jan 2018 01:39:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515490795; cv=none; d=google.com; s=arc-20160816; b=fJwzDQBTDfzWBce1y2c7ugY1uwEGzYuVfy7jbiXCv3suKpOJnaHpwGNK8XLGoVAvQv tiIE0FSFJyCAvfPh9Jxcbn7xVcmwZ5ukBeSt6yblh1nVF0l3MNzN8zYLfvR6xjRyNrz1 jYOezssvU5WRed6ix6ZUR302iSgx/2b9lLZutgBzcY05Xii7fDltzDL0L2ccFFPGwXko vcOA67Ppem9/N5Xn/bh9GB4YWcW8sw+osHEIB4iDTe/P9lITUnTuCRrmtY6CAS+RwF8w wzazKgU4mMGl7VfRm/dDbTPV7tqs/4urg9H4HE2/pMhdlA3JMXJ044UklBxqzHl4kbp4 LvDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=a+ZYdTFGpQocYJoAKilYr+cBEU5ue2U8/inxJoOjB+0=; b=ZqO0oyIcuNCPfnv3TM/GA0ntzFA1DRcCvTJZKs//dIy6F7AUZjdT1WBi0tw7oI4DpC AQF6DOBuQLLqDL9iWLVpxol8V4KxziMdu3Slmveq8Mat3MYsWrWr+JLoeFlrHWkkVrHr bnid3SOWw8kCgy9I2TcnD88mS1dDY9P3RbcrDhHIGrsD4Go6AHDXCR9GVQmkPR5bUfRQ 55QNNsvq6PH8Ldmgq+CikqRdeWVwRTMC1eUquJ9iJB6eNr4OfSplWCd6+HGJaY61f/AI khXCroRevVvZvvbfGhr3DiByCJl6rBuMlFcow/E1NEbTBeiU+nySCRGc4dpz+hVgS59b l1qA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si10140439plg.347.2018.01.09.01.39.55; Tue, 09 Jan 2018 01:39:55 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752939AbeAIJjx (ORCPT + 28 others); Tue, 9 Jan 2018 04:39:53 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:45871 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752846AbeAIJfV (ORCPT ); Tue, 9 Jan 2018 04:35:21 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 054F020999; Tue, 9 Jan 2018 10:35:19 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id E12D020949; Tue, 9 Jan 2018 10:34:54 +0100 (CET) From: Quentin Schulz To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, sre@kernel.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org Cc: linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, Quentin Schulz Subject: [PATCH v2 16/16] ARM: dtsi: sun8i: a711: enable battery power supply subnode Date: Tue, 9 Jan 2018 10:33:47 +0100 Message-Id: <2bcfc20abd661c172a30056547c7cd0397f67c4a.1515486346.git-series.quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The TBS A711 has an AXP813 PMIC and a soldered battery, thus, we enable the battery power supply subnode in its Device Tree. Signed-off-by: Quentin Schulz --- arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 4 ++++ 1 file changed, 4 insertions(+) -- git-series 0.9.1 diff --git a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts index 511fca4..1de362f 100644 --- a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts +++ b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts @@ -231,6 +231,10 @@ #include "axp81x.dtsi" +&battery_power_supply { + status = "okay"; +}; + ®_aldo1 { regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>;