From patchwork Mon Apr 13 16:44:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iskren Chernev X-Patchwork-Id: 11485941 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 107A31392 for ; Mon, 13 Apr 2020 16:45:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE93E20732 for ; Mon, 13 Apr 2020 16:45:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="h4RILQvU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731728AbgDMQpN (ORCPT ); Mon, 13 Apr 2020 12:45:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1731652AbgDMQpH (ORCPT ); Mon, 13 Apr 2020 12:45:07 -0400 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E7B6C0A3BDC; Mon, 13 Apr 2020 09:45:07 -0700 (PDT) Received: by mail-lf1-x144.google.com with SMTP id m19so7009401lfq.13; Mon, 13 Apr 2020 09:45:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=j0/ojehsgN6WFhJxo84PGsofi9PZNXG9f0uE47ESYDI=; b=h4RILQvUAFVhV4HDVTfiv0vSB76SQh0DSCmqFYw0RvcD/w3sTZwX2WeduV0O83KZL6 6dJYWz0uUZ5i3iuea6nH0WNSTJVu4LdYXir4fuVVfxEAYqbXtZVNDKeetAvbAhNU+8Cn /PzVMZ28u83he+KWzokUjIBgZajeF+f6hCSx7I/rBNUCfHECAPAARMFN2oMXMeMOpFCW eqTrQMI5vJ8kEEjyexZxxiVKJTN9YLAHUukyiPPeQdo1/B4gm+C7vt5abOWrv0n415rZ 2g2/Jc+gkJojHhgZfs9AIRjKWgkcaXp2n8KGiXm7rJoN9KOjkQHSiYfxnvxTiO4Ar+JE HIfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=j0/ojehsgN6WFhJxo84PGsofi9PZNXG9f0uE47ESYDI=; b=Ju+jiNJL1m0wIHuQYbq4i7y4MnyqvAwCwBqRB+HfM+DopbYfNbplgc/N+ChJ0MWiR6 tP+XGBfkefoRFa2FsPsAu+HDCv7OeS6ojiHXU4FsRIKGlObdP0tzokoG68qlEsrnl2P1 eRaM5ZnoHnystiH8ZrQWtGXy/OhTVixPyJSWJPYnobJEN3iAYEuHVE1R30YyHdXHh5nD A6VHbXkNaF4npPWjkbBtUFxp87kfuPQWDCUjxCfWftbpZ2xnbzG1QvciHhH+3YE9/0jy XzSX6CC8gFp7Egid867CCmguhlduPqAbaI9qOCI9nPj9cYZJJt8X2Q06ScppIB4xdj/j YDAw== X-Gm-Message-State: AGi0Puakem0xnfhvgavHfVUKXac9DwDF1bizmYbeN5NPn6jys4iUI5Fc ID7U8EIOkXEzn1hmtig0zX8gDLRZk6/2uQ== X-Google-Smtp-Source: APiQypLQmhMYfdNx/hNdyQrep4gGHZ5hGSStSBvfd4sRTE6o+Jye6QlF1xlooQQVU5HQizmuDZRSDw== X-Received: by 2002:ac2:5042:: with SMTP id a2mr10967815lfm.13.1586796304920; Mon, 13 Apr 2020 09:45:04 -0700 (PDT) Received: from localhost ([213.191.183.145]) by smtp.gmail.com with ESMTPSA id n26sm7440740ljg.93.2020.04.13.09.45.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Apr 2020 09:45:04 -0700 (PDT) From: Iskren Chernev To: linux-arm-msm@vger.kernel.org Cc: Andy Gross , Bjorn Andersson , devicetree@vger.kernel.org, Liam Girdwood , linux-kernel@vger.kernel.org, Mark Brown , Rob Herring , ~postmarketos/upstreaming@lists.sr.ht, Iskren Chernev Subject: [PATCH 1/3] regulator: max77826: Add max77826 regulator driver Date: Mon, 13 Apr 2020 19:44:38 +0300 Message-Id: <20200413164440.1138178-2-iskren.chernev@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200413164440.1138178-1-iskren.chernev@gmail.com> References: <20200413164440.1138178-1-iskren.chernev@gmail.com> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Adding regulator driver for the Maxim max77826 device. The max77826 PMIC contains a high-efficiency BUCK regulator, a BUCK BOOST regulator and 15 LDOs. It is designed for smartphone and tablet applications and is accessed over I2C. Signed-off-by: Iskren Chernev --- drivers/regulator/Kconfig | 10 + drivers/regulator/Makefile | 1 + drivers/regulator/max77826-regulator.c | 301 +++++++++++++++++++++++++ 3 files changed, 312 insertions(+) create mode 100644 drivers/regulator/max77826-regulator.c diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index f4b72cb098ef..e8f7a0965ae9 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -585,6 +585,16 @@ config REGULATOR_MAX77802 Exynos5420/Exynos5800 SoCs to control various voltages. It includes support for control of voltage and ramp speed. +config REGULATOR_MAX77826 + tristate "Maxim 77826 regulator" + depends on I2C + select REGMAP_I2C + help + This driver controls a Maxim 77826 regulator via I2C bus. + The regulator include 15 LDOs, BUCK and BUCK BOOST regulator. + It includes support for control of output voltage. This + regulator is found on the Samsung Galaxy S5 (klte) smartphone. + config REGULATOR_MC13XXX_CORE tristate diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 6610ee001d9a..e8f163371071 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -74,6 +74,7 @@ obj-$(CONFIG_REGULATOR_MAX8998) += max8998.o obj-$(CONFIG_REGULATOR_MAX77686) += max77686-regulator.o obj-$(CONFIG_REGULATOR_MAX77693) += max77693-regulator.o obj-$(CONFIG_REGULATOR_MAX77802) += max77802-regulator.o +obj-$(CONFIG_REGULATOR_MAX77826) += max77826-regulator.o obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o diff --git a/drivers/regulator/max77826-regulator.c b/drivers/regulator/max77826-regulator.c new file mode 100644 index 000000000000..070fbc2e1e43 --- /dev/null +++ b/drivers/regulator/max77826-regulator.c @@ -0,0 +1,301 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// +// max77826-regulator.c - regulator driver for Maxim MAX77826 +// +// Author: Iskren Chernev + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +enum max77826_registers { + MAX77826_REG_INT_SRC = 0x00, + MAX77826_REG_SYS_INT, + MAX77826_REG_INT1, + MAX77826_REG_INT2, + MAX77826_REG_BB_INT, + MAX77826_REG_INT_SRC_M, + MAX77826_REG_TOPSYS_INT_M, + MAX77826_REG_INT1_M, + MAX77826_REG_INT2_M, + MAX77826_REG_BB_INT_M, + MAX77826_REG_TOPSYS_STAT, + MAX77826_REG_STAT1, + MAX77826_REG_STAT2, + MAX77826_REG_BB_STAT, + /* 0x0E - 0x0F: Reserved */ + MAX77826_REG_LDO_OPMD1 = 0x10, + MAX77826_REG_LDO_OPMD2, + MAX77826_REG_LDO_OPMD3, + MAX77826_REG_LDO_OPMD4, + MAX77826_REG_B_BB_OPMD, + /* 0x15 - 0x1F: Reserved */ + MAX77826_REG_LDO1_CFG = 0x20, + MAX77826_REG_LDO2_CFG, + MAX77826_REG_LDO3_CFG, + MAX77826_REG_LDO4_CFG, + MAX77826_REG_LDO5_CFG, + MAX77826_REG_LDO6_CFG, + MAX77826_REG_LDO7_CFG, + MAX77826_REG_LDO8_CFG, + MAX77826_REG_LDO9_CFG, + MAX77826_REG_LDO10_CFG, + MAX77826_REG_LDO11_CFG, + MAX77826_REG_LDO12_CFG, + MAX77826_REG_LDO13_CFG, + MAX77826_REG_LDO14_CFG, + MAX77826_REG_LDO15_CFG, + /* 0x2F: Reserved */ + MAX77826_REG_BUCK_CFG = 0x30, + MAX77826_REG_BUCK_VOUT, + MAX77826_REG_BB_CFG, + MAX77826_REG_BB_VOUT, + /* 0x34 - 0x3F: Reserved */ + MAX77826_REG_BUCK_SS_FREQ = 0x40, + MAX77826_REG_UVLO_FALL, + /* 0x42 - 0xCE: Reserved */ + MAX77826_REG_DEVICE_ID = 0xCF, +}; + +enum max77826_regulators { + MAX77826_LDO1 = 0, + MAX77826_LDO2, + MAX77826_LDO3, + MAX77826_LDO4, + MAX77826_LDO5, + MAX77826_LDO6, + MAX77826_LDO7, + MAX77826_LDO8, + MAX77826_LDO9, + MAX77826_LDO10, + MAX77826_LDO11, + MAX77826_LDO12, + MAX77826_LDO13, + MAX77826_LDO14, + MAX77826_LDO15, + MAX77826_BUCK, + MAX77826_BUCKBOOST, + MAX77826_MAX_REGULATORS, +}; + +#define MAX77826_MASK_LDO 0x7f +#define MAX77826_MASK_BUCK 0xff +#define MAX77826_MASK_BUCKBOOST 0x7f +#define MAX77826_BUCK_RAMP_DELAY 12500 + +/* values in mV */ +/* for LDO1-3 */ +#define MAX77826_NMOS_LDO_VOLT_MIN 600000 +#define MAX77826_NMOS_LDO_VOLT_MAX 2187500 +#define MAX77826_NMOS_LDO_VOLT_STEP 12500 + +/* for LDO4-15 */ +#define MAX77826_PMOS_LDO_VOLT_MIN 800000 +#define MAX77826_PMOS_LDO_VOLT_MAX 3975000 +#define MAX77826_PMOS_LDO_VOLT_STEP 25000 + +/* for BUCK */ +#define MAX77826_BUCK_VOLT_MIN 500000 +#define MAX77826_BUCK_VOLT_MAX 1800000 +#define MAX77826_BUCK_VOLT_STEP 6250 + +/* for BUCKBOOST */ +#define MAX77826_BUCKBOOST_VOLT_MIN 2600000 +#define MAX77826_BUCKBOOST_VOLT_MAX 4187500 +#define MAX77826_BUCKBOOST_VOLT_STEP 12500 +#define MAX77826_VOLT_RANGE(_type) \ + ((MAX77826_ ## _type ## _VOLT_MAX - \ + MAX77826_ ## _type ## _VOLT_MIN) / \ + MAX77826_ ## _type ## _VOLT_STEP + 1) + +#define MAX77826_LDO(_id, _type) \ + [MAX77826_LDO ## _id] = { \ + .id = MAX77826_LDO ## _id, \ + .name = "LDO"#_id, \ + .of_match = of_match_ptr("LDO"#_id), \ + .regulators_node = "regulators", \ + .ops = &max77826_most_ops, \ + .min_uV = MAX77826_ ## _type ## _LDO_VOLT_MIN, \ + .uV_step = MAX77826_ ## _type ## _LDO_VOLT_STEP, \ + .n_voltages = MAX77826_VOLT_RANGE(_type ## _LDO), \ + .enable_reg = MAX77826_REG_LDO_OPMD1 + (_id - 1) / 4, \ + .enable_mask = BIT(((_id - 1) % 4) * 2 + 1), \ + .vsel_reg = MAX77826_REG_LDO1_CFG + (_id - 1), \ + .vsel_mask = MAX77826_MASK_LDO, \ + .owner = THIS_MODULE, \ + } + +#define MAX77826_BUCK(_idx, _id, _ops) \ + [MAX77826_ ## _id] = { \ + .id = MAX77826_ ## _id, \ + .name = #_id, \ + .of_match = of_match_ptr(#_id), \ + .regulators_node = "regulators", \ + .ops = &_ops, \ + .min_uV = MAX77826_ ## _id ## _VOLT_MIN, \ + .uV_step = MAX77826_ ## _id ## _VOLT_STEP, \ + .n_voltages = MAX77826_VOLT_RANGE(_id), \ + .enable_reg = MAX77826_REG_B_BB_OPMD, \ + .enable_mask = BIT(_idx * 2 + 1), \ + .vsel_reg = MAX77826_REG_BUCK_VOUT + _idx * 2, \ + .vsel_mask = MAX77826_MASK_ ## _id, \ + .owner = THIS_MODULE, \ + } + + + +struct max77826_regulator_info { + struct regmap *regmap; + struct regulator_desc *rdesc; +}; + +static const struct regmap_config max77826_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .max_register = MAX77826_REG_DEVICE_ID, +}; + +static int max77826_set_voltage_time_sel(struct regulator_dev *, + unsigned int old_selector, + unsigned int new_selector); + +static const struct regulator_ops max77826_most_ops = { + .enable = regulator_enable_regmap, + .disable = regulator_disable_regmap, + .is_enabled = regulator_is_enabled_regmap, + .list_voltage = regulator_list_voltage_linear, + .map_voltage = regulator_map_voltage_linear, + .get_voltage_sel = regulator_get_voltage_sel_regmap, + .set_voltage_sel = regulator_set_voltage_sel_regmap, +}; + +static const struct regulator_ops max77826_buck_ops = { + .enable = regulator_enable_regmap, + .disable = regulator_disable_regmap, + .is_enabled = regulator_is_enabled_regmap, + .list_voltage = regulator_list_voltage_linear, + .map_voltage = regulator_map_voltage_linear, + .get_voltage_sel = regulator_get_voltage_sel_regmap, + .set_voltage_sel = regulator_set_voltage_sel_regmap, + .set_voltage_time_sel = max77826_set_voltage_time_sel, +}; + +static struct regulator_desc max77826_regulators_desc[] = { + MAX77826_LDO(1, NMOS), + MAX77826_LDO(2, NMOS), + MAX77826_LDO(3, NMOS), + MAX77826_LDO(4, PMOS), + MAX77826_LDO(5, PMOS), + MAX77826_LDO(6, PMOS), + MAX77826_LDO(7, PMOS), + MAX77826_LDO(8, PMOS), + MAX77826_LDO(9, PMOS), + MAX77826_LDO(10, PMOS), + MAX77826_LDO(11, PMOS), + MAX77826_LDO(12, PMOS), + MAX77826_LDO(13, PMOS), + MAX77826_LDO(14, PMOS), + MAX77826_LDO(15, PMOS), + MAX77826_BUCK(0, BUCK, max77826_buck_ops), + MAX77826_BUCK(1, BUCKBOOST, max77826_most_ops), +}; + +static int max77826_set_voltage_time_sel(struct regulator_dev *rdev, + unsigned int old_selector, + unsigned int new_selector) +{ + if (new_selector > old_selector) { + return DIV_ROUND_UP(MAX77826_BUCK_VOLT_STEP * + (new_selector - old_selector), + MAX77826_BUCK_RAMP_DELAY); + } + + return 0; +} + +static int max77826_read_device_id(struct regmap *regmap, struct device *dev) +{ + unsigned int device_id; + int res; + + res = regmap_read(regmap, MAX77826_REG_DEVICE_ID, &device_id); + if (!res) + dev_dbg(dev, "DEVICE_ID: 0x%x\n", device_id); + + return res; +} + +static int max77826_i2c_probe(struct i2c_client *client) +{ + struct device *dev = &client->dev; + struct max77826_regulator_info *info; + struct regulator_config config = {}; + struct regulator_dev *rdev; + struct regmap *regmap; + int i; + + info = devm_kzalloc(dev, sizeof(struct max77826_regulator_info), + GFP_KERNEL); + if (!info) + return -ENOMEM; + + info->rdesc = max77826_regulators_desc; + regmap = devm_regmap_init_i2c(client, &max77826_regmap_config); + if (IS_ERR(regmap)) { + dev_err(dev, "Failed to allocate regmap!\n"); + return PTR_ERR(regmap); + } + + info->regmap = regmap; + i2c_set_clientdata(client, info); + + config.dev = dev; + config.regmap = regmap; + config.driver_data = info; + + for (i = 0; i < MAX77826_MAX_REGULATORS; i++) { + rdev = devm_regulator_register(dev, + &max77826_regulators_desc[i], + &config); + if (IS_ERR(rdev)) { + dev_err(dev, "Failed to register regulator!\n"); + return PTR_ERR(rdev); + } + } + + return max77826_read_device_id(regmap, dev); +} + +static const struct of_device_id max77826_of_match[] = { + { .compatible = "maxim,max77826-regulator" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, max77826_of_match); + +static const struct i2c_device_id max77826_id[] = { + { "max77826-regulator" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(i2c, max77826_id); + +static struct i2c_driver max77826_regulator_driver = { + .driver = { + .name = "max77826", + .of_match_table = of_match_ptr(max77826_of_match), + }, + .probe_new = max77826_i2c_probe, + .id_table = max77826_id, +}; +module_i2c_driver(max77826_regulator_driver); + +MODULE_AUTHOR("Iskren Chernev "); +MODULE_DESCRIPTION("MAX77826 PMIC regulator driver"); +MODULE_LICENSE("GPL"); From patchwork Mon Apr 13 16:44:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iskren Chernev X-Patchwork-Id: 11485945 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 048541392 for ; Mon, 13 Apr 2020 16:45:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DFD372063A for ; Mon, 13 Apr 2020 16:45:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kIjWXjU5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731734AbgDMQpN (ORCPT ); Mon, 13 Apr 2020 12:45:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1731726AbgDMQpL (ORCPT ); Mon, 13 Apr 2020 12:45:11 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6CF6C0A3BE2; Mon, 13 Apr 2020 09:45:10 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id l14so2406510ljj.5; Mon, 13 Apr 2020 09:45:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/7kUYnLw48Z85PQ8uY6UIk7TGH6ILbMun5ml8gDdgVg=; b=kIjWXjU5WmXkfLQkcf93yNgZ+kcchnSqyn+58IKkj0RLiXP+NVG51m9sJOKUiesGOy A1H2ikJrojbkLQHDkmY2lsQgrWlvVrrqchW3wFEv/SSWL6uBrIMaxstKKDG/k1MtzeEN ZF3Xc35vqiJHxUoQfgohOp7vJySod80mEwvCaOikV8nH6r3BF6PObJZhl3K3xCqynw5W wiL1P2dOL+bcE9e8q0sr5Nb0s905vuWQE1Bpq63BF66W12yRBBrN6YCVnnuSOiucENzq 615WwuSt7/JrASy0Mj1Rg1hHzGECQWbeN6w0f9SDtIPpk9W+jDbpg7sRybGkiTluyMeO M2eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/7kUYnLw48Z85PQ8uY6UIk7TGH6ILbMun5ml8gDdgVg=; b=TJcQrucsgfKTgB5u1Gm6GssJku2HhmkdGTdeDqw6QOkEtzZnC1sin1kJvpcreoI0kL EH6jpeif7GqbwG4kbuH7tcvhfFyOc/qHlzdjGOyV7QYdudB9nDOziqcEPlkqUjGcT8Xl QTi5D9hHiPsqxcVANvrenDnbXbCFvUh18fa2/beICYMDWZL7iKKPFk32RwHWsAGaFxug KsxwWikuzfBkpwIYJq2GdEMzV/ueuzBwWlsAt7YmbPONZgt40qcHhT5f0H++NzVHYWN/ p083F6DBBlr+Do/i4G8at2+0ikPBvTw5VSU/ogRdFBzRjFx0c9jhBKQVr+tfUGIFmJ1U qs1w== X-Gm-Message-State: AGi0PuZliYocTcOqBzNOzz1mOE9+cxB/STBw1xEUt9pFlaa2OdqDATb1 7cOVPesb71F8MLEHjoMov/OLEWdOvIyhbQ== X-Google-Smtp-Source: APiQypKdI1BIVT95Od4qBuWLIg3nszfcdvMkVM/Gq5JCv7Oq+2gD9SFq7K7jeOLERuYNzXT5c6/UQA== X-Received: by 2002:a2e:7c1a:: with SMTP id x26mr10452532ljc.209.1586796308729; Mon, 13 Apr 2020 09:45:08 -0700 (PDT) Received: from localhost ([213.191.183.145]) by smtp.gmail.com with ESMTPSA id o17sm8389756lff.70.2020.04.13.09.45.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Apr 2020 09:45:08 -0700 (PDT) From: Iskren Chernev To: linux-arm-msm@vger.kernel.org Cc: Andy Gross , Bjorn Andersson , devicetree@vger.kernel.org, Liam Girdwood , linux-kernel@vger.kernel.org, Mark Brown , Rob Herring , ~postmarketos/upstreaming@lists.sr.ht, Iskren Chernev Subject: [PATCH 2/3] dt-bindings: regulator: Add document bindings for max77826 Date: Mon, 13 Apr 2020 19:44:39 +0300 Message-Id: <20200413164440.1138178-3-iskren.chernev@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200413164440.1138178-1-iskren.chernev@gmail.com> References: <20200413164440.1138178-1-iskren.chernev@gmail.com> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add device tree binding information for max77826 regulator driver. Example bindings for max77826 are added. Signed-off-by: Iskren Chernev --- .../bindings/regulator/maxim,max77826.yaml | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/maxim,max77826.yaml diff --git a/Documentation/devicetree/bindings/regulator/maxim,max77826.yaml b/Documentation/devicetree/bindings/regulator/maxim,max77826.yaml new file mode 100644 index 000000000000..3cd449a746b0 --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/maxim,max77826.yaml @@ -0,0 +1,70 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/maxim,max77826.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Maxim Integrated MAX77826 PMIC + +maintainers: + - Iskren Chernev + +properties: + $nodename: + pattern: "pmic@[0-9a-f]{1,2}" + compatible: + enum: + - maxim,max77826-regulator + + reg: + maxItems: 1 + + regulators: + type: object + allOf: + - $ref: regulator.yaml# + description: | + list of regulators provided by this controller, must be named + after their hardware counterparts LDO[1-15], BUCK and BUCKBOOST + + patternProperties: + "^LDO([1-9]|1[0-5])$": + type: object + allOf: + - $ref: regulator.yaml# + + "^BUCK|BUCKBOOST$": + type: object + allOf: + - $ref: regulator.yaml# + + additionalProperties: false + additionalProperties: false + +required: + - compatible + - reg + - regulators + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + pmic@69 { + compatible = "maxim,max77826-regulator"; + reg = <0x69>; + + regulators { + LDO2 { + regulator-name = "ldo2"; + regulator-min-microvolt = <650000>; + regulator-max-microvolt = <3587500>; + }; + }; + }; + }; +... From patchwork Mon Apr 13 16:44:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iskren Chernev X-Patchwork-Id: 11485943 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DE5131392 for ; Mon, 13 Apr 2020 16:45:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C192E206E9 for ; Mon, 13 Apr 2020 16:45:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YP83sfYk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731749AbgDMQpU (ORCPT ); Mon, 13 Apr 2020 12:45:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1731735AbgDMQpN (ORCPT ); Mon, 13 Apr 2020 12:45:13 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 880D2C0A3BDC; Mon, 13 Apr 2020 09:45:13 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id 131so7017530lfh.11; Mon, 13 Apr 2020 09:45:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2YVpEsdAD3gdou5O12iibPQ3XhGh37dAHJSGf0NXN0w=; b=YP83sfYkJzjjL19EAeyMmpmI97iR/GfkRrCy6ay6bm3o6v6P9RxZbQiSkOfz+GbOmY DTqA1h9WVANaT5ADT/C+SLfLBfwZCEsrB9bsHsTNBIEQyZ18pOBwJmbvApGhxBhY86KK 67jaP7Y031u5l3u7dBNCAYL+Bhv0alpKIjvw0/1dW3bISdLgMwxZz0b07ZsiOap82ulA 7ulpP1iRJECuGuPeXn840GpJJ3JzhJctzeYYEsZkL+1biT4EKtLUug2DMKTnvmAsS0dP ysjZWFSHzAybk9J8CT4rOHJ3w1S1qxgeMeNdtEZva3xr8iAOa5ej2s357w2AaPS0h0US VEKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2YVpEsdAD3gdou5O12iibPQ3XhGh37dAHJSGf0NXN0w=; b=r28lMVNblZZeTmm9KI5NHmUks5fRu3985SM+vs2WIiXOv15yk/hZMIAOKBzbBwlZ54 IxJzvOo6yZ8DxDs9athPeMEVcVrYJ04wdfaHjxXtNs3CgJkzjJQxtIgB3RNfEhsqZ5Oe ug6wwfHCRFxHwwgwrWWHeJKVdmExen1Xq0cLwTxsat/KdDAdH0Q7uxKLuVeVr11OfFNl Xq90MaXgX2ZZzKgJ7coOtLPfNbYaAdcGU2/hXbnvvmZYQstwZBVLgMyAcPx6RIV1CT81 8grQ5iXrapT6wiVI1ieXdCLRFnhPJnqYqpT9ayCjtj5EE0e4qcD1mKCLrBiz04iponwd aBYg== X-Gm-Message-State: AGi0PuZ9zPrv7hu11SxGrj0l8mKosuP/taVVRjn4gZwRSz8Llm1DsBA3 UI1wQdhEsSUuN0VdCQ7xzy/HOOhG6t8S8g== X-Google-Smtp-Source: APiQypJniJ22q9ejT6dHNBXLjaeOMXx81p9W4vXAMZiLxguhcg8uVdZVBz7Hmz6Om+kNT50l6LRtYA== X-Received: by 2002:a05:6512:1109:: with SMTP id l9mr2428352lfg.12.1586796311588; Mon, 13 Apr 2020 09:45:11 -0700 (PDT) Received: from localhost ([213.191.183.145]) by smtp.gmail.com with ESMTPSA id f4sm2256280lfa.24.2020.04.13.09.45.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Apr 2020 09:45:10 -0700 (PDT) From: Iskren Chernev To: linux-arm-msm@vger.kernel.org Cc: Andy Gross , Bjorn Andersson , devicetree@vger.kernel.org, Liam Girdwood , linux-kernel@vger.kernel.org, Mark Brown , Rob Herring , ~postmarketos/upstreaming@lists.sr.ht, Iskren Chernev Subject: [PATCH 3/3] ARM: dts: qcom: msm8974-klte: Add max77826 pmic node Date: Mon, 13 Apr 2020 19:44:40 +0300 Message-Id: <20200413164440.1138178-4-iskren.chernev@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200413164440.1138178-1-iskren.chernev@gmail.com> References: <20200413164440.1138178-1-iskren.chernev@gmail.com> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This introduces the MAX77826 PMIC that powers some pheripherals on the klte, like the touchpad, touchkeys and camera. Signed-off-by: Iskren Chernev --- .../boot/dts/qcom-msm8974-samsung-klte.dts | 110 ++++++++++++++++++ arch/arm/boot/dts/qcom-msm8974.dtsi | 11 ++ 2 files changed, 121 insertions(+) diff --git a/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts b/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts index eaa1001d0a46..f6d3a9dcf0de 100644 --- a/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +++ b/arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts @@ -21,4 +21,114 @@ serial@f991e000 { status = "ok"; }; + pinctrl@fd510000 { + i2c6_pins: i2c6 { + mux { + pins = "gpio29", "gpio30"; + function = "blsp_i2c6"; + + drive-strength = <2>; + bias-disable; + }; + }; + }; + + i2c@f9928000 { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&i2c6_pins>; + + pmic@60 { + reg = <0x60>; + compatible = "maxim,max77826-regulator"; + + regulators { + max77826_ldo1: LDO1 { + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + }; + + max77826_ldo2: LDO2 { + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1000000>; + }; + + max77826_ldo3: LDO3 { + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + }; + + max77826_ldo4: LDO4 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + max77826_ldo5: LDO5 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + max77826_ldo6: LDO6 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + }; + + max77826_ldo7: LDO7 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + max77826_ldo8: LDO8 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + }; + + max77826_ldo9: LDO9 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + max77826_ldo10: LDO10 { + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2950000>; + }; + + max77826_ldo11: LDO11 { + regulator-min-microvolt = <2700000>; + regulator-max-microvolt = <2950000>; + }; + + max77826_ldo12: LDO12 { + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <3300000>; + }; + + max77826_ldo13: LDO13 { + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + max77826_ldo14: LDO14 { + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + max77826_ldo15: LDO15 { + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + max77826_buck: BUCK { + regulator-min-microvolt = <1225000>; + regulator-max-microvolt = <1225000>; + }; + + max77826_buckboost: BUCKBOOST { + regulator-min-microvolt = <3400000>; + regulator-max-microvolt = <3400000>; + }; + }; + }; + }; }; diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-msm8974.dtsi index 2ea2308d91b3..51f5f904f9eb 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -974,6 +974,17 @@ blsp_i2c3: i2c@f9925000 { #size-cells = <0>; }; + blsp_i2c6: i2c@f9928000 { + status = "disabled"; + compatible = "qcom,i2c-qup-v2.1.1"; + reg = <0xf9928000 0x1000>; + interrupts = ; + clocks = <&gcc GCC_BLSP1_QUP6_I2C_APPS_CLK>, <&gcc GCC_BLSP1_AHB_CLK>; + clock-names = "core", "iface"; + #address-cells = <1>; + #size-cells = <0>; + }; + blsp_i2c8: i2c@f9964000 { status = "disabled"; compatible = "qcom,i2c-qup-v2.1.1";