From patchwork Fri Feb 15 11:50:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Mavrodiev X-Patchwork-Id: 10814849 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C591514E1 for ; Fri, 15 Feb 2019 11:51:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD19D2EABF for ; Fri, 15 Feb 2019 11:51:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A14042E9D7; Fri, 15 Feb 2019 11:51:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AC1BE2EE0E for ; Fri, 15 Feb 2019 11:51:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=yBFYJNePZJGVnXpbgXr3VABbEZ/ADrwm9ybeko56AVs=; b=pKkylXpc1v7n4UrX7+L2C6RpC3 GecWip3bcNFakXQmCPA8nawPjmIsxXrnEymGz1MyU/UKJx1EOoWvNMAYSgOBRjqsMrAoNAY9xbhc1 LLLbXjwEh1P+DzTkgGOq1dAQQctbhonUNf8YLc3kDtAbZuYPI06Z6N3linKGVp4IlwoMj5uBhSPvn QXoZK7nvb8uGYaycGWYu1Oho9leFlbczSGJ30yGHSGrAQhYrc4s4ZRkK+CYXGrBhn45K7X0dP/TyZ PC21+lTWxlPHjf9sN9rwtqUCXPEy0ZYbdt5hcK7iRk4EtjW+jRb5F4qDA/1CCpc+rVr6jmnAP7azR S4gNnYdA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1guc17-0007I3-A5; Fri, 15 Feb 2019 11:50:53 +0000 Received: from olimex.com ([184.105.72.32]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guc0w-00074p-0W for linux-arm-kernel@lists.infradead.org; Fri, 15 Feb 2019 11:50:44 +0000 Received: from localhost.localdomain ([195.238.85.143]) by olimex.com with ESMTPSA (ECDHE-RSA-AES128-GCM-SHA256:TLSv1.2:Kx=ECDH:Au=RSA:Enc=AESGCM(128):Mac=AEAD) (SMTP-AUTH username stefan@olimex.com, mechanism PLAIN) for ; Fri, 15 Feb 2019 03:50:39 -0800 From: Stefan Mavrodiev To: Jacek Anaszewski , Pavel Machek , Rob Herring , Mark Rutland , Chen-Yu Tsai , Maxime Ripard , Lee Jones , linux-leds@vger.kernel.org (open list:LED SUBSYSTEM), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-kernel@vger.kernel.org (open list:X-POWERS MULTIFUNCTION PMIC DEVICE DRIVERS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support) Subject: [PATCH v2 1/8] leds: Add support for AXP20X CHGLED Date: Fri, 15 Feb 2019 13:50:06 +0200 Message-Id: <20190215115013.11098-2-stefan@olimex.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190215115013.11098-1-stefan@olimex.com> References: <20190215115013.11098-1-stefan@olimex.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190215_035042_050720_28198608 X-CRM114-Status: GOOD ( 21.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Mavrodiev MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Most of AXP20x PMIC chips have built-in battery charger with LED indicator. The LED can be controlled ether by the charger or manually by a register. The default is (except for AXP209) manual control, which makes this LED useless, since there is no device driver. The driver rely on AXP20X MFD driver. Signed-off-by: Stefan Mavrodiev --- drivers/leds/Kconfig | 10 ++ drivers/leds/Makefile | 1 + drivers/leds/leds-axp20x.c | 291 +++++++++++++++++++++++++++++++++++++ 3 files changed, 302 insertions(+) create mode 100644 drivers/leds/leds-axp20x.c diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index a72f97fca57b..82dce9063d41 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -766,6 +766,16 @@ config LEDS_NIC78BX To compile this driver as a module, choose M here: the module will be called leds-nic78bx. +config LEDS_AXP20X + tristate "LED support for X-Powers PMICs" + depends on MFD_AXP20X + help + This option enables support for CHGLED found on most of X-Powers + PMICs. + + To compile this driver as a module, choose M here: the module + will be called leds-axp20x. + comment "LED Triggers" source "drivers/leds/trigger/Kconfig" diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 4c1b0054f379..d3fb76e119d8 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -79,6 +79,7 @@ obj-$(CONFIG_LEDS_MT6323) += leds-mt6323.o obj-$(CONFIG_LEDS_LM3692X) += leds-lm3692x.o obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o obj-$(CONFIG_LEDS_LM3601X) += leds-lm3601x.o +obj-$(CONFIG_LEDS_AXP20X) += leds-axp20x.o # LED SPI Drivers obj-$(CONFIG_LEDS_CR0014114) += leds-cr0014114.o diff --git a/drivers/leds/leds-axp20x.c b/drivers/leds/leds-axp20x.c new file mode 100644 index 000000000000..2d5ae1c085f0 --- /dev/null +++ b/drivers/leds/leds-axp20x.c @@ -0,0 +1,291 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Copyright 2019 Stefan Mavrodiev + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define AXP20X_CHGLED_CTRL_REG AXP20X_OFF_CTRL +#define AXP20X_CHGLED_FUNC_MASK GENMASK(5, 4) +#define AXP20X_CHGLED_FUNC_OFF (0 << 4) +#define AXP20X_CHGLED_FUNC_1HZ (1 << 4) +#define AXP20X_CHGLED_FUNC_4HZ (2 << 4) +#define AXP20X_CHGLED_FUNC_FULL (3 << 4) +#define AXP20X_CHGLED_CTRL_MASK BIT(3) +#define AXP20X_CHGLED_CTRL_MANUAL 0 +#define AXP20X_CHGLED_CTRL_CHARGER 1 +#define AXP20X_CHGLED_CTRL(_ctrl) (_ctrl << 3) + +#define AXP20X_CHGLED_MODE_REG AXP20X_CHRG_CTRL2 +#define AXP20X_CHGLED_MODE_MASK BIT(4) +#define AXP20X_CHGLED_MODE_A 0 +#define AXP20X_CHGLED_MODE_B 1 +#define AXP20X_CHGLED_MODE(_mode) (_mode << 4) + +struct axp20x_led { + char name[LED_MAX_NAME_SIZE]; + struct led_classdev cdev; + struct mutex lock; + u8 mode : 1; + u8 ctrl : 1; + u8 ctrl_inverted : 1; + struct axp20x_dev *axp20x; +}; + +static inline struct axp20x_led *to_axp20x_led(struct led_classdev *cdev) +{ + return container_of(cdev, struct axp20x_led, cdev); +} + +static int axp20x_led_setup(struct axp20x_led *priv) +{ + int ret; + u8 val; + + /* Invert the logic, if necessary */ + val = priv->ctrl ^ priv->ctrl_inverted; + + mutex_lock(&priv->lock); + ret = regmap_update_bits(priv->axp20x->regmap, AXP20X_CHGLED_CTRL_REG, + AXP20X_CHGLED_CTRL_MASK, + AXP20X_CHGLED_CTRL(val)); + if (ret < 0) + goto out; + + ret = regmap_update_bits(priv->axp20x->regmap, AXP20X_CHGLED_MODE_REG, + AXP20X_CHGLED_MODE_MASK, + AXP20X_CHGLED_MODE(priv->mode)); +out: + mutex_unlock(&priv->lock); + return ret; +} + +static ssize_t control_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct led_classdev *cdev = dev_get_drvdata(dev); + struct axp20x_led *priv = to_axp20x_led(cdev); + + return sprintf(buf, "%u\n", priv->ctrl); +} + +static ssize_t control_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t size) +{ + struct led_classdev *cdev = dev_get_drvdata(dev); + struct axp20x_led *priv = to_axp20x_led(cdev); + unsigned long val; + int ret; + + ret = kstrtoul(buf, 0, &val); + if (ret) + return ret; + + /** + * Supported values are: + * - 0 : Manual control + * - 1 : Charger control + */ + if (val > 1) + return -EINVAL; + + priv->ctrl = val; + + return axp20x_led_setup(priv) ? : size; +} +static DEVICE_ATTR_RW(control); + +static ssize_t mode_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct led_classdev *cdev = dev_get_drvdata(dev); + struct axp20x_led *priv = to_axp20x_led(cdev); + + return sprintf(buf, "%u\n", priv->mode); +} + +static ssize_t mode_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t size) +{ + struct led_classdev *cdev = dev_get_drvdata(dev); + struct axp20x_led *priv = to_axp20x_led(cdev); + unsigned long val; + int ret; + + ret = kstrtoul(buf, 0, &val); + if (ret) + return ret; + /** + * Supported values are: + * - 0 : Mode A + * - 1 : Mode B + */ + if (val > 1) + return -EINVAL; + + priv->mode = val; + + return axp20x_led_setup(priv) ? : size; +} +static DEVICE_ATTR_RW(mode); + +static struct attribute *axp20x_led_attrs[] = { + &dev_attr_control.attr, + &dev_attr_mode.attr, + NULL, +}; +ATTRIBUTE_GROUPS(axp20x_led); + +enum led_brightness axp20x_led_brightness_get(struct led_classdev *cdev) +{ + struct axp20x_led *priv = to_axp20x_led(cdev); + u32 val; + int ret; + + mutex_lock(&priv->lock); + ret = regmap_read(priv->axp20x->regmap, AXP20X_CHGLED_CTRL_REG, &val); + mutex_unlock(&priv->lock); + if (ret < 0) + return LED_OFF; + + return (val & AXP20X_CHGLED_FUNC_FULL) ? LED_FULL : LED_OFF; +} + +static int axp20x_led_brightness_set_blocking(struct led_classdev *cdev, + enum led_brightness brightness) +{ + struct axp20x_led *priv = to_axp20x_led(cdev); + int ret = 0; + + mutex_lock(&priv->lock); + ret = regmap_update_bits(priv->axp20x->regmap, + AXP20X_CHGLED_CTRL_REG, + AXP20X_CHGLED_FUNC_MASK, + (brightness) ? + AXP20X_CHGLED_FUNC_FULL : + AXP20X_CHGLED_FUNC_OFF); + mutex_unlock(&priv->lock); + + return ret; +} + +static int axp20x_led_parse_dt(struct axp20x_led *priv, struct device_node *np) +{ + const char *str; + u8 value; + int ret = 0; + + str = of_get_property(np, "label", NULL); + if (!str) + snprintf(priv->name, sizeof(priv->name), "axp20x::"); + else + snprintf(priv->name, sizeof(priv->name), "axp20x:%s", str); + priv->cdev.name = priv->name; + + priv->cdev.default_trigger = of_get_property(np, + "linux,default-trigger", + NULL); + + if (!of_property_read_u8(np, "x-powers,charger-mode", &value)) { + priv->ctrl = AXP20X_CHGLED_CTRL_CHARGER; + priv->mode = (value < 2) ? value : 0; + } else { + priv->ctrl = AXP20X_CHGLED_CTRL_MANUAL; + } + + str = of_get_property(np, "default-state", NULL); + if (str) { + if (!strcmp(str, "keep")) { + ret = axp20x_led_brightness_get(&priv->cdev); + if (ret < 0) + return ret; + priv->cdev.brightness = ret; + } else if (!strcmp(str, "on")) { + ret = axp20x_led_brightness_set_blocking(&priv->cdev, + LED_FULL); + } else { + ret = axp20x_led_brightness_set_blocking(&priv->cdev, + LED_OFF); + } + } + + return ret; +} + +static const struct of_device_id axp20x_led_of_match[] = { + { .compatible = "x-powers,axp20x-led" }, + {} +}; +MODULE_DEVICE_TABLE(of, axp20x_led_of_match); + +static int axp20x_led_probe(struct platform_device *pdev) +{ + struct axp20x_led *priv; + int ret; + + if (!of_device_is_available(pdev->dev.of_node)) + return -ENODEV; + + priv = devm_kzalloc(&pdev->dev, sizeof(struct axp20x_led), + GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->axp20x = dev_get_drvdata(pdev->dev.parent); + if (!priv->axp20x) { + dev_err(&pdev->dev, "Failed to get parent data\n"); + return -ENXIO; + } + + mutex_init(&priv->lock); + + priv->cdev.brightness_set_blocking = axp20x_led_brightness_set_blocking; + priv->cdev.brightness_get = axp20x_led_brightness_get; + priv->cdev.groups = axp20x_led_groups; + + ret = axp20x_led_parse_dt(priv, pdev->dev.of_node); + if (ret < 0) { + dev_err(&pdev->dev, "Failed to set parameters\n"); + return ret; + } + + /** + * For some reason in AXP209 the bit that controls CHGLED is with + * inverted logic compared to all other PMICs. + * If the PMIC is actually AXP209, set inverted flag and later use it + * when configuring the LED. + */ + if (priv->axp20x->variant == AXP209_ID) + priv->ctrl_inverted = 1; + + ret = axp20x_led_setup(priv); + if (ret < 0) { + dev_err(&pdev->dev, "Failed to configure led"); + return ret; + } + + return devm_led_classdev_register(&pdev->dev, &priv->cdev); +} + +static struct platform_driver axp20x_led_driver = { + .driver = { + .name = "axp20x-led", + .of_match_table = of_match_ptr(axp20x_led_of_match), + }, + .probe = axp20x_led_probe, +}; + +module_platform_driver(axp20x_led_driver); + +MODULE_AUTHOR("Stefan Mavrodiev X-Patchwork-Id: 10814853 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F366514E1 for ; Fri, 15 Feb 2019 11:51:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1DD62EA84 for ; Fri, 15 Feb 2019 11:51:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D68152EE60; Fri, 15 Feb 2019 11:51:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 767912EE55 for ; Fri, 15 Feb 2019 11:51:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=hiATYBr55eOUAzMkXesSsl7c7oj7oBeazdqifxvLlXw=; b=nt15v09lBBkJQJ2VbRZTTADA8X Y81eeGWU5P8NQxYG4Fq6I2x841m5oH3vmd51X1QBePV0qGanGt5+ro32D5N3pZK+OqvpMZ02NY5lI 63GAHkFs64KtCMvd/EmkSZAwoOhB1YEurB6iKC2xHizsbY6B+V/r4bxV3fDnx8yvoVY1Z0Q1eEpoG IXQ7g3o6Ns2jpyraiP0rH2agh45Xl9odSg5PvsZ85bODsrPg2O5c6XF8zQW6SO21oXs7hVX5AhY+9 idrsEr4iU0900NMlnPdmRjiDNX5CBt3wPwVc2RSMQde+b/iL8sf21PsMkQPyo1STuWTPOad0NJx0H GfwuKhFw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1guc1c-0007xG-5X; Fri, 15 Feb 2019 11:51:24 +0000 Received: from olimex.com ([2001:470:0:1f2::b869:4820]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guc1B-0007OV-Mw for linux-arm-kernel@lists.infradead.org; Fri, 15 Feb 2019 11:51:07 +0000 Received: from localhost.localdomain ([195.238.85.143]) by olimex.com with ESMTPSA (ECDHE-RSA-AES128-GCM-SHA256:TLSv1.2:Kx=ECDH:Au=RSA:Enc=AESGCM(128):Mac=AEAD) (SMTP-AUTH username stefan@olimex.com, mechanism PLAIN) for ; Fri, 15 Feb 2019 03:50:42 -0800 From: Stefan Mavrodiev To: Jacek Anaszewski , Pavel Machek , Rob Herring , Mark Rutland , Chen-Yu Tsai , Maxime Ripard , Lee Jones , linux-leds@vger.kernel.org (open list:LED SUBSYSTEM), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-kernel@vger.kernel.org (open list:X-POWERS MULTIFUNCTION PMIC DEVICE DRIVERS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support) Subject: [PATCH v2 2/8] mfd: axp20x: Add axp20x-led cell Date: Fri, 15 Feb 2019 13:50:07 +0200 Message-Id: <20190215115013.11098-3-stefan@olimex.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190215115013.11098-1-stefan@olimex.com> References: <20190215115013.11098-1-stefan@olimex.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190215_035058_168195_28301527 X-CRM114-Status: GOOD ( 10.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Mavrodiev MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add axp20x-led cell for AXP20x, AXP221, AXP223, AXP228, AXP803, AXP809 and AXP813. Signed-off-by: Stefan Mavrodiev --- drivers/mfd/axp20x.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index 3c97f2c0fdfe..e6ab078f0462 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c @@ -610,6 +610,9 @@ static const struct mfd_cell axp20x_cells[] = { .of_compatible = "x-powers,axp202-usb-power-supply", .num_resources = ARRAY_SIZE(axp20x_usb_power_supply_resources), .resources = axp20x_usb_power_supply_resources, + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; @@ -636,6 +639,9 @@ static const struct mfd_cell axp221_cells[] = { .of_compatible = "x-powers,axp221-usb-power-supply", .num_resources = ARRAY_SIZE(axp22x_usb_power_supply_resources), .resources = axp22x_usb_power_supply_resources, + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; @@ -662,6 +668,9 @@ static const struct mfd_cell axp223_cells[] = { .of_compatible = "x-powers,axp223-usb-power-supply", .num_resources = ARRAY_SIZE(axp22x_usb_power_supply_resources), .resources = axp22x_usb_power_supply_resources, + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; @@ -719,6 +728,9 @@ static const struct mfd_cell axp288_cells[] = { .resources = axp288_power_button_resources, }, { .name = "axp288_pmic_acpi", + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; @@ -741,8 +753,12 @@ static const struct mfd_cell axp803_cells[] = { .of_compatible = "x-powers,axp813-ac-power-supply", .num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources), .resources = axp20x_ac_power_supply_resources, + }, { + .name = "axp20x-regulator" + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, - { .name = "axp20x-regulator" }, }; static const struct mfd_cell axp806_self_working_cells[] = { @@ -769,6 +785,9 @@ static const struct mfd_cell axp809_cells[] = { }, { .id = 1, .name = "axp20x-regulator", + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; @@ -793,6 +812,9 @@ static const struct mfd_cell axp813_cells[] = { .of_compatible = "x-powers,axp813-ac-power-supply", .num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources), .resources = axp20x_ac_power_supply_resources, + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; From patchwork Fri Feb 15 11:50:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Mavrodiev X-Patchwork-Id: 10814855 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 10AFC14E1 for ; Fri, 15 Feb 2019 11:51:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB13C2EE58 for ; Fri, 15 Feb 2019 11:51:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D72D52EE80; Fri, 15 Feb 2019 11:51:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5C3FB2EE7D for ; Fri, 15 Feb 2019 11:51:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=4ErN4RxL++SmtUQ32rFmF435wCPdUe6VubWnKqCmS7Y=; b=kzgrdYJeqvpPObSkhLDLB+miWl XqJmsvJHkcJ3e+KZm6G1Bd62tAvbiSZp/tAba0xKZBipGzhiWJXm8pzCDA4telDUjnh9rBSc1C3yQ H9Z2tmD+MWivk2ThVbGCoiIVl4xjZlKa7r4VmckVS43XZAGUj2PhA0pG4eTmr7DSkv46KJetWQuDt CNFHV3R1EHBK/bpuBxwTrBM+9hPwy4mhOBeN1RjgvcL9rVmd64xE8jN+MpINiul6+PDBjFR3XADU0 1o7wz3r9dvNBTk33bS2IwVX3yVR7w1nOk41ke5oHg3pLuAJ322kug8uwbVsedxE8lWzt81YHg34lO 1xZNbQjQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1guc1z-0008I0-5P; Fri, 15 Feb 2019 11:51:47 +0000 Received: from olimex.com ([184.105.72.32]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guc1G-0007XA-MK for linux-arm-kernel@lists.infradead.org; Fri, 15 Feb 2019 11:51:14 +0000 Received: from localhost.localdomain ([195.238.85.143]) by olimex.com with ESMTPSA (ECDHE-RSA-AES128-GCM-SHA256:TLSv1.2:Kx=ECDH:Au=RSA:Enc=AESGCM(128):Mac=AEAD) (SMTP-AUTH username stefan@olimex.com, mechanism PLAIN) for ; Fri, 15 Feb 2019 03:50:45 -0800 From: Stefan Mavrodiev To: Jacek Anaszewski , Pavel Machek , Rob Herring , Mark Rutland , Chen-Yu Tsai , Maxime Ripard , Lee Jones , linux-leds@vger.kernel.org (open list:LED SUBSYSTEM), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-kernel@vger.kernel.org (open list:X-POWERS MULTIFUNCTION PMIC DEVICE DRIVERS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support) Subject: [PATCH v2 3/8] dt-bindings: leds: Add binding for axp20x-led device driver Date: Fri, 15 Feb 2019 13:50:08 +0200 Message-Id: <20190215115013.11098-4-stefan@olimex.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190215115013.11098-1-stefan@olimex.com> References: <20190215115013.11098-1-stefan@olimex.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190215_035103_289267_6183C07F X-CRM114-Status: GOOD ( 10.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Mavrodiev MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds the devicetree bindings for charge led indicator found on most of X-Powers AXP20X PMICs. Signed-off-by: Stefan Mavrodiev --- .../devicetree/bindings/leds/leds-axp20x.txt | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-axp20x.txt diff --git a/Documentation/devicetree/bindings/leds/leds-axp20x.txt b/Documentation/devicetree/bindings/leds/leds-axp20x.txt new file mode 100644 index 000000000000..5a83ad06796d --- /dev/null +++ b/Documentation/devicetree/bindings/leds/leds-axp20x.txt @@ -0,0 +1,74 @@ +Device Tree Bindings for LED support on X-Powers PMIC + +Most of the X-Powers PMICs have integrated battery charger with LED indicator. +The output is open-drain, so the state is either high-Z or output-low. The +driver is a subnode of AXP20X MFD driver, since it uses shared bus with all +other cells. +The LED can be controlled either manually or automatically. Then in automatic +(controlled by the charger) there are two indication modes: + +Mode-A +====== +- output-low: Charging +- high-Z Not charging +- 1Hz flashing: Abnormal alarm +- 4Hz flashing Overvoltage alarm + +Mode-B +====== +- output-low: Battery full +- high-Z Not charging +- 1Hz flashing: Charging +- 4Hz flashing Overvoltage or abnormal alarm + +The control and the mode can be changed from sysfs. + +For AXP20X MFD bindings see: +Documentation/devicetree/bindings/mfd/axp20x.txt + +Required properties: +- compatible : Must be "x-powers,axp20x-led" + +Supported common LED properties, see ./common.txt for more informationn +- label : See Documentation/devicetree/bindings/leds/common.txt +- linux,default-trigger : See Documentation/devicetree/bindings/leds/common.txt +- default-state: See Documentation/devicetree/bindings/leds/common.txt + +Optional properties: +- x-powers,charger-mode: 0 for Mode-A, 1 for Mode-B + If omitted, then the control is set to manual mode. + On invalid value, Mode-A is used. + + +Example: + + axp803: pmic@3a3 { + compatible = "x-powers,axp803"; + + ... + + led@0 { + compatible = "x-powers,axp20x-led"; + status = "okay"; + + label = "axp20x:yellow:chgled"; + linux,default-trigger = "timer"; + default-state = "on"; + }; + }; + +or + + axp803: pmic@3a3 { + compatible = "x-powers,axp803"; + + ... + + led@0 { + compatible = "x-powers,axp20x-led"; + status = "okay"; + + label = "axp20x:yellow:chgled"; + x-powers,charger-mode = <1>; + }; + }; From patchwork Fri Feb 15 11:50:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Mavrodiev X-Patchwork-Id: 10814851 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3889313B5 for ; Fri, 15 Feb 2019 11:51:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25ABE2E9D6 for ; Fri, 15 Feb 2019 11:51:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 198782ED76; Fri, 15 Feb 2019 11:51:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BE55F2E9D6 for ; Fri, 15 Feb 2019 11:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=u/Grtv8bb4h0F7wJN22Djsey9WCOLWBTiLUAWPLnwIA=; b=rJyBTj6dmwJ/n9RYRosm2zoopP jez8e3zPHY3Hi4mbpz2TbVzuiqiaMkxjSk6fQMRFJSBHbDTecNW25Lx1xbS44y3p8eZiBzPEyKoWF eZL6tNy0h0liXwCA+wFN7VasWTKtOPem+wiqol7GnOTzHqXPDFVF+NEx6iqf03WPq4OkOs0T+XlFH tx2Tkdu4BxQkKx2+4pINw2YFFIm7q0iBS8UQHd5JpAFoVZvGfkhwyf3ECHrcFGhM8HukoJbTuamZ/ CsklgCy9yqKT7hPHqY7XcMWQPEjy2vtBLtdB9SalTOEuejwll2DK6H1WDUFZ9g6Tr67RmUrBE6C6i PkEsxPVw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1guc1R-0007jT-PE; Fri, 15 Feb 2019 11:51:13 +0000 Received: from olimex.com ([184.105.72.32]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guc1B-0007OT-LB for linux-arm-kernel@lists.infradead.org; Fri, 15 Feb 2019 11:51:03 +0000 Received: from localhost.localdomain ([195.238.85.143]) by olimex.com with ESMTPSA (ECDHE-RSA-AES128-GCM-SHA256:TLSv1.2:Kx=ECDH:Au=RSA:Enc=AESGCM(128):Mac=AEAD) (SMTP-AUTH username stefan@olimex.com, mechanism PLAIN) for ; Fri, 15 Feb 2019 03:50:48 -0800 From: Stefan Mavrodiev To: Jacek Anaszewski , Pavel Machek , Rob Herring , Mark Rutland , Chen-Yu Tsai , Maxime Ripard , Lee Jones , linux-leds@vger.kernel.org (open list:LED SUBSYSTEM), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-kernel@vger.kernel.org (open list:X-POWERS MULTIFUNCTION PMIC DEVICE DRIVERS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support) Subject: [PATCH v2 4/8] arm64: dts: allwinner: axp803: add charge led node Date: Fri, 15 Feb 2019 13:50:09 +0200 Message-Id: <20190215115013.11098-5-stefan@olimex.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190215115013.11098-1-stefan@olimex.com> References: <20190215115013.11098-1-stefan@olimex.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190215_035058_068899_6E3D1EE6 X-CRM114-Status: UNSURE ( 9.70 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Mavrodiev MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add dt node for axp20x-led driver controlling CHGLED. Default status is disabled, since it may be not used. Signed-off-by: Stefan Mavrodiev --- arch/arm64/boot/dts/allwinner/axp803.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/axp803.dtsi b/arch/arm64/boot/dts/allwinner/axp803.dtsi index c3a618e1279a..af4898602b34 100644 --- a/arch/arm64/boot/dts/allwinner/axp803.dtsi +++ b/arch/arm64/boot/dts/allwinner/axp803.dtsi @@ -76,6 +76,11 @@ }; }; + axp_led: led { + compatible = "x-powers,axp20x-led"; + status = "disabled"; + }; + battery_power_supply: battery-power-supply { compatible = "x-powers,axp803-battery-power-supply", "x-powers,axp813-battery-power-supply"; From patchwork Fri Feb 15 11:50:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Mavrodiev X-Patchwork-Id: 10814863 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4DDCE13B5 for ; Fri, 15 Feb 2019 11:52:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A98C2EE70 for ; Fri, 15 Feb 2019 11:52:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F0982EE88; Fri, 15 Feb 2019 11:52:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C8C0A2EE70 for ; Fri, 15 Feb 2019 11:52:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=VrFjYKnp6785DCn3duNXXqSaTxyAPOrkj8sTuJEH5lQ=; b=Ee3Q2+KTGGELwoT9G67hFNFva5 wKeOAHN8Z7ZJx++zxdqFjKMSlG/PcGcUcEQGudIm3x1GAvXrmDzgdCCQiD0b8Imxj5Bg2rcJST1U+ CLuL2HuouyD7LcBf1leGdpIL3YTtUWFmVrI5VvcImFe8tiCp6omEb6uDjmKm75J5f1G4CprfHKdlw dzdwLCCHiI+ve+AA7lnRcKve6/A8aEYR4/EAJA2wyYqQl/VWUMuwloLnTLqPN7SHTRnhybpE/ScNb 58Zhw4I1XBSzt5bX1VZ2L1kP7SuiHu8JByXsMfl9XuH0iMs1epk1mMNACfTNpnFRR45E1DDtQVtcW 3EMtaoqg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1guc2e-0000e8-4l; Fri, 15 Feb 2019 11:52:28 +0000 Received: from olimex.com ([184.105.72.32]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guc1B-0007OU-LE for linux-arm-kernel@lists.infradead.org; Fri, 15 Feb 2019 11:51:03 +0000 Received: from localhost.localdomain ([195.238.85.143]) by olimex.com with ESMTPSA (ECDHE-RSA-AES128-GCM-SHA256:TLSv1.2:Kx=ECDH:Au=RSA:Enc=AESGCM(128):Mac=AEAD) (SMTP-AUTH username stefan@olimex.com, mechanism PLAIN) for ; Fri, 15 Feb 2019 03:50:51 -0800 From: Stefan Mavrodiev To: Jacek Anaszewski , Pavel Machek , Rob Herring , Mark Rutland , Chen-Yu Tsai , Maxime Ripard , Lee Jones , linux-leds@vger.kernel.org (open list:LED SUBSYSTEM), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-kernel@vger.kernel.org (open list:X-POWERS MULTIFUNCTION PMIC DEVICE DRIVERS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support) Subject: [PATCH v2 5/8] arm64: dts: allwinner: Enable AXP803 CHGLED for Olimex boards Date: Fri, 15 Feb 2019 13:50:10 +0200 Message-Id: <20190215115013.11098-6-stefan@olimex.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190215115013.11098-1-stefan@olimex.com> References: <20190215115013.11098-1-stefan@olimex.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190215_035058_049937_2CE7287A X-CRM114-Status: UNSURE ( 8.49 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Mavrodiev MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Teres-I and A64-OLinuXino commes with populated LED connected to AXP803. So to be used as battery indication, pass the LED control to the charger itself in mode 0 ( FULL while charging, OFF no battery or completed). Signed-off-by: Stefan Mavrodiev --- arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts | 6 ++++++ arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts index f7a4bccaa5d4..7d6930319fba 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts @@ -177,6 +177,12 @@ #include "axp803.dtsi" +&axp_led { + label = "a64-olinuxino:yellow:chgled"; + status = "okay"; + x-powers,charger-mode = <0>; +}; + ®_aldo1 { regulator-always-on; regulator-min-microvolt = <2800000>; diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts index c455b24dd079..cdffdd4e4561 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts @@ -145,6 +145,12 @@ #include "axp803.dtsi" +&axp_led { + label = "teres-i:yellow:chgled"; + status = "okay"; + x-powers,charger-mode = <0>; +}; + ®_aldo1 { regulator-always-on; regulator-min-microvolt = <2800000>; From patchwork Fri Feb 15 11:50:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Mavrodiev X-Patchwork-Id: 10814871 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D874B13B5 for ; Fri, 15 Feb 2019 12:01:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C367F2EF02 for ; Fri, 15 Feb 2019 12:01:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0BF02EFB6; Fri, 15 Feb 2019 12:01:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6F3B92EF02 for ; Fri, 15 Feb 2019 12:01:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=HeiYReVjj9N5c1aTTUK9TgHUgOTJqCuKScuwyikmPjg=; b=CINyrxT4pb1vVuxFmiVSMAdJTR aDa2fqxmV5aZZDsCej/VL1fHdQ4LNpxKMSfqRzLLaaIMquOHABxRsIbqGeJ1WQz/uRXprbNIhIcrm ir95geCwdHRGvr3o8i1I+lGOqWF3StpjGXhhbETBCDpI9aZHBmF6cchHpp/ijV2Yz9byhr1jQAfdR zP7NAzdHQsK54fxuiFbaVmqyesoZp6PelPnaN3XD1eft0ZiMwWu6DEvtqrkk775lFipdcBTSmlOKs uAcaIHWs2vTflG0Fc6dxTg2a1s0NtSAr5rmwFz1hfRBFmpyV5my1rpgkoNp1+hkuQGy0SIH9qd/54 EXN54dNQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gucB5-0004Bh-T7; Fri, 15 Feb 2019 12:01:11 +0000 Received: from olimex.com ([2001:470:0:1f2::b869:4820]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gucB3-0004BQ-EJ for linux-arm-kernel@lists.infradead.org; Fri, 15 Feb 2019 12:01:10 +0000 Received: from localhost.localdomain ([195.238.85.143]) by olimex.com with ESMTPSA (ECDHE-RSA-AES128-GCM-SHA256:TLSv1.2:Kx=ECDH:Au=RSA:Enc=AESGCM(128):Mac=AEAD) (SMTP-AUTH username stefan@olimex.com, mechanism PLAIN) for ; Fri, 15 Feb 2019 03:50:54 -0800 From: Stefan Mavrodiev To: Jacek Anaszewski , Pavel Machek , Rob Herring , Mark Rutland , Chen-Yu Tsai , Maxime Ripard , Lee Jones , linux-leds@vger.kernel.org (open list:LED SUBSYSTEM), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-kernel@vger.kernel.org (open list:X-POWERS MULTIFUNCTION PMIC DEVICE DRIVERS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support) Subject: [PATCH v2 6/8] arm: dts: axpxx: add charge led node Date: Fri, 15 Feb 2019 13:50:11 +0200 Message-Id: <20190215115013.11098-7-stefan@olimex.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190215115013.11098-1-stefan@olimex.com> References: <20190215115013.11098-1-stefan@olimex.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190215_040109_483489_6852D672 X-CRM114-Status: UNSURE ( 9.65 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Mavrodiev MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add dt node for axp20x-led driver controlling CHGLED. Default status is disabled, since it may be not used. Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/axp209.dtsi | 5 +++++ arch/arm/boot/dts/axp22x.dtsi | 5 +++++ arch/arm/boot/dts/axp81x.dtsi | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi index 0d9ff12bdf28..f972b6f3ecd0 100644 --- a/arch/arm/boot/dts/axp209.dtsi +++ b/arch/arm/boot/dts/axp209.dtsi @@ -69,6 +69,11 @@ #gpio-cells = <2>; }; + axp_led: led { + compatible = "x-powers,axp20x-led"; + status = "disabled"; + }; + battery_power_supply: battery-power-supply { compatible = "x-powers,axp209-battery-power-supply"; status = "disabled"; diff --git a/arch/arm/boot/dts/axp22x.dtsi b/arch/arm/boot/dts/axp22x.dtsi index 65a07a67aca9..92a0b64252b1 100644 --- a/arch/arm/boot/dts/axp22x.dtsi +++ b/arch/arm/boot/dts/axp22x.dtsi @@ -62,6 +62,11 @@ #io-channel-cells = <1>; }; + axp_led: led { + compatible = "x-powers,axp20x-led"; + status = "disabled"; + }; + battery_power_supply: battery-power-supply { compatible = "x-powers,axp221-battery-power-supply"; status = "disabled"; diff --git a/arch/arm/boot/dts/axp81x.dtsi b/arch/arm/boot/dts/axp81x.dtsi index bd83962d3627..22e243cc40d5 100644 --- a/arch/arm/boot/dts/axp81x.dtsi +++ b/arch/arm/boot/dts/axp81x.dtsi @@ -74,6 +74,11 @@ }; }; + axp_led: led { + compatible = "x-powers,axp20x-led"; + status = "disabled"; + }; + battery_power_supply: battery-power-supply { compatible = "x-powers,axp813-battery-power-supply"; status = "disabled"; From patchwork Fri Feb 15 11:50:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Mavrodiev X-Patchwork-Id: 10814859 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 70D6213B5 for ; Fri, 15 Feb 2019 11:52:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E5872EE8B for ; Fri, 15 Feb 2019 11:52:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52BB72EE7A; Fri, 15 Feb 2019 11:52:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BF0E12EE87 for ; Fri, 15 Feb 2019 11:52:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=JFugdJIFsf3lfEbtxviefiERkDulxxZh0nVOvRULRug=; b=VgqBoYgNA1U+vjftVqrbIe6icp Ts25UZrutT0L4T5uZ4aFIbYBzO1JJ6BB8/K97+JLUVgNuIn6omnpzDCNlxVGk7XLJeKBQiDbm3bhE WGmrd1iQjHNaFVn3nKm96nB/tdUke7w9stiOa5T2GPunAjf+YFozvUdYTsv4kDTwnTKZEyq63RL8+ a3s//dszRQ+PaEzjw8nGeeNFhi/6fN0AlyDKGJCU61kDZftz5+1qI28EiP7Zm4+rmX6JToyF0MUvR kYICPmuXpMx9NU23oEJN7XJ7jgrYvnoxK8lLCqnKsZGpaxt6f1vvNEI0Q2XP9DLV9CJksY+VUt71V RXYokghw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1guc2H-0000Dm-Iw; Fri, 15 Feb 2019 11:52:05 +0000 Received: from olimex.com ([184.105.72.32]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guc1M-0007ev-Aq for linux-arm-kernel@lists.infradead.org; Fri, 15 Feb 2019 11:51:24 +0000 Received: from localhost.localdomain ([195.238.85.143]) by olimex.com with ESMTPSA (ECDHE-RSA-AES128-GCM-SHA256:TLSv1.2:Kx=ECDH:Au=RSA:Enc=AESGCM(128):Mac=AEAD) (SMTP-AUTH username stefan@olimex.com, mechanism PLAIN) for ; Fri, 15 Feb 2019 03:50:57 -0800 From: Stefan Mavrodiev To: Jacek Anaszewski , Pavel Machek , Rob Herring , Mark Rutland , Chen-Yu Tsai , Maxime Ripard , Lee Jones , linux-leds@vger.kernel.org (open list:LED SUBSYSTEM), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-kernel@vger.kernel.org (open list:X-POWERS MULTIFUNCTION PMIC DEVICE DRIVERS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support) Subject: [PATCH v2 7/8] ARM: dts: sun7i: Enable AXP209 CHGLED for Olimex boards Date: Fri, 15 Feb 2019 13:50:12 +0200 Message-Id: <20190215115013.11098-8-stefan@olimex.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190215115013.11098-1-stefan@olimex.com> References: <20190215115013.11098-1-stefan@olimex.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190215_035108_596060_012E0F03 X-CRM114-Status: GOOD ( 10.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Mavrodiev MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Olimex A20-OLinuXino based boards (MICRO, SOM, SOM204, LIME2) commes with populated LED connected to AXP209. By default the LED is controlled by AXP209, so this binding actually doesn't modify any registers. However this can can be used as general purpose LED, if the control mode is overridden. Also this binding is enabled only for OLIMEX boards, since I have no knowlegde if the other manifactures are populating this LED. Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 6 ++++++ arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts | 6 ++++++ arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts | 6 ++++++ arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts index f0e6a96e5785..677ee1c2795a 100644 --- a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts +++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts @@ -243,6 +243,12 @@ #include "axp209.dtsi" +&axp_led { + label = "a20-olimex-som-evb:yellow:chgled"; + status = "okay"; + x-powers,charger-mode = <0>; +}; + ®_dcdc2 { regulator-always-on; regulator-min-microvolt = <1000000>; diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts b/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts index 823aabce0462..31a3ab5ad4e3 100644 --- a/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts +++ b/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts @@ -205,6 +205,12 @@ status = "okay"; }; +&axp_led { + label = "a20-som204-evb:yellow:chgled"; + status = "okay"; + x-powers,charger-mode = <0>; +}; + &battery_power_supply { status = "okay"; }; diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts index 4e1c590eb098..66dd80ced1fa 100644 --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts @@ -200,6 +200,12 @@ #include "axp209.dtsi" +&axp_led { + label = "a20-olinuxino-lime2:yellow:chgled"; + status = "okay"; + x-powers,charger-mode = <0>; +}; + ®_dcdc2 { regulator-always-on; regulator-min-microvolt = <1000000>; diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts index 840ae1194a66..700de909eb49 100644 --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts @@ -272,6 +272,12 @@ status = "okay"; }; +&axp_led { + label = "a20-olinuxino-micro:yellow:chgled"; + status = "okay"; + x-powers,charger-mode = <0>; +}; + &battery_power_supply { status = "okay"; }; From patchwork Fri Feb 15 11:50:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Mavrodiev X-Patchwork-Id: 10814857 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C5D4F13B5 for ; Fri, 15 Feb 2019 11:51:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3C8A2EE7D for ; Fri, 15 Feb 2019 11:51:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A85F02EE71; Fri, 15 Feb 2019 11:51:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6300B2EE60 for ; Fri, 15 Feb 2019 11:51:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=A4tlrBnVW3Ib/ctqflPt025DmwF39tLa+/5Vtay0yLI=; b=qfwVaAtAI4Nhog1VuAZyAwl09d ILEaJky0hl8e6TwBnn0XLeqCcvfd5OKlHW9jToS6f/3uRwbH4/FE13fWKlfboz4lijh+TI3PYsICI dNdwvB5NHn16bIA563CiePgEiEdhSg0OLSbwbpGFGlsrIceF+MSzRb0ZSBqKEFyWH8EE4X2FiWsBk 22TiPEsSoh6sE+hlFPPWIaIzsE9vuX1WkrosOg4AMi9lT3Ant3hGx+kWkjCs/XC+Fo3ufQgjtjfS7 49cSumI9NFq5uJXmECY52P4aYy/oe1Kv7RJW9eZzN2zeIGRBGUONyXvmlR3Pas4uNlFojMAdKt9V2 deP877ww==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1guc27-0008Qp-Bj; Fri, 15 Feb 2019 11:51:55 +0000 Received: from olimex.com ([184.105.72.32]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guc1M-0007ew-An for linux-arm-kernel@lists.infradead.org; Fri, 15 Feb 2019 11:51:23 +0000 Received: from localhost.localdomain ([195.238.85.143]) by olimex.com with ESMTPSA (ECDHE-RSA-AES128-GCM-SHA256:TLSv1.2:Kx=ECDH:Au=RSA:Enc=AESGCM(128):Mac=AEAD) (SMTP-AUTH username stefan@olimex.com, mechanism PLAIN) for ; Fri, 15 Feb 2019 03:50:59 -0800 From: Stefan Mavrodiev To: Jacek Anaszewski , Pavel Machek , Rob Herring , Mark Rutland , Chen-Yu Tsai , Maxime Ripard , Lee Jones , linux-leds@vger.kernel.org (open list:LED SUBSYSTEM), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-kernel@vger.kernel.org (open list:X-POWERS MULTIFUNCTION PMIC DEVICE DRIVERS), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support) Subject: [PATCH v2 8/8] ARM: dts: sun8i: a33: Enable AXP223 CHGLED for A33-OLinuXino Date: Fri, 15 Feb 2019 13:50:13 +0200 Message-Id: <20190215115013.11098-9-stefan@olimex.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190215115013.11098-1-stefan@olimex.com> References: <20190215115013.11098-1-stefan@olimex.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190215_035108_508131_EBC0D9CF X-CRM114-Status: GOOD ( 10.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Mavrodiev MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP A33-OLinuXino comes with populated CHGLED LED indicating battery charging status. By default the control is set to manual mode, which doesn't indicate battery status. So it makes sense to set the control to automatic mode 0 ( FULL - charging, OFF - no battery or battery full). Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/sun8i-a33-olinuxino.dts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-a33-olinuxino.dts b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts index 3d78169cdeed..a1e36ee51bbb 100644 --- a/arch/arm/boot/dts/sun8i-a33-olinuxino.dts +++ b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts @@ -111,6 +111,12 @@ status = "okay"; }; +&axp_led { + label = "a33-olinuxino:yellow:chgled"; + status = "okay"; + x-powers,charger-mode = <0>; +}; + &battery_power_supply { status = "okay"; };