From patchwork Tue Jun 4 17:43:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 165803 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp6159984ili; Tue, 4 Jun 2019 10:43:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjBZF0HJOm0Y2bOjWYQjevleOz6887jsEr9DkGAE4l781Q/1ZYOIGpxp+0vL9g9j8hA725 X-Received: by 2002:a63:4f07:: with SMTP id d7mr36240826pgb.77.1559670238229; Tue, 04 Jun 2019 10:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559670238; cv=none; d=google.com; s=arc-20160816; b=MtNfrVGcTnZuF4VN1Zh6Sed7p+jl4zkCM0dGA2l9XL02GYBLBCqyG5OCeAs01V9uGD KaD2zh8bOijqyaswCeU2BkcjyTESVEWNeXFS9z+/oaMb/kvanNYYxoPTTmiuEAl8QT0F BR7rLhOkxCPKm5bHuCycpGeSTy5f3SXfTKwt+1LHrT8n5GJ3z9PZUL3ZCmAdHT8pLbVZ mYrcVRfYM9AYifunLn14Fr2xE1/NIujRCs4SyyOd1Xv1qOdmrx++BHRrYuX0zANzcFEH 4iBRuF3xuatPK4j3DooA9+LwU3TQXYJRBLwfpRM89v3+aK5X0aEsAL2slnkbt0An6rtv nNJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XLBp72GNScLOrVq/d4JB8Q0BOdPFlnC8VxZtdpxaqxs=; b=VkaBxLDNNNQqydqOfnNMB4kX5uMsSsRzR37wV64zrYhe5BnkuBRFbXlegodpEvtqLt QkWvLkG/alpNDOp3R4TaWWNFrIJYwct+Q3ATQ2EyhqjQVFPDuSeiX+5mEHViRT/3rCkn MrpuPQmofC/UnQRP3xcNfrLtgFaffueBI8sH+fVVIOl1avQX0Mh9JXcICXepi29N5DW9 9Ow4hPysMRwRiMdMSv+jQ5Ks08Gqn6pnA8OaY1ga2qfRLG4Ud8pC7ftj3M+KMbY4rK9m lrambhm3hTeW9rKgqU0PTW7J4Jzx9gE8Xy0Es1Rc9ibcM5XPcjvQi/L64PxHOoIiaESb +uAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="M4sD4OJ/"; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s97si24194679pjc.9.2019.06.04.10.43.57; Tue, 04 Jun 2019 10:43:58 -0700 (PDT) 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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="M4sD4OJ/"; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726693AbfFDRn4 (ORCPT + 30 others); Tue, 4 Jun 2019 13:43:56 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:37494 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726490AbfFDRny (ORCPT ); Tue, 4 Jun 2019 13:43:54 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x54HhnaL027619; Tue, 4 Jun 2019 12:43:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1559670229; bh=XLBp72GNScLOrVq/d4JB8Q0BOdPFlnC8VxZtdpxaqxs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=M4sD4OJ/At4qHuSkUcXeqO/bFQvwC+eq5LW/TkUsTkydafEN+IhqnVArKpKpwg+pR AKLet3vsJMtlTt+OicBMWaElXCpDwLyz2XzHQal+mk/D6V0L5nfQdZm+uTkrkJQuOD HARPGTddEgv6TAqNn/uefHwrKzPDP0gXDQUJ6fEE= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x54Hhn94064383 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 4 Jun 2019 12:43:49 -0500 Received: from DFLE101.ent.ti.com (10.64.6.22) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 4 Jun 2019 12:43:49 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 4 Jun 2019 12:43:49 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x54Hhm82097229; Tue, 4 Jun 2019 12:43:49 -0500 From: Dan Murphy To: , , , CC: , , , Dan Murphy Subject: [PATCH v5 4/6] regulator: lm363x: Add support for LM36274 Date: Tue, 4 Jun 2019 12:43:43 -0500 Message-ID: <20190604174345.14841-5-dmurphy@ti.com> X-Mailer: git-send-email 2.21.0.5.gaeb582a983 In-Reply-To: <20190604174345.14841-1-dmurphy@ti.com> References: <20190604174345.14841-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding regulator support for the LM36274 backlight driver. This device can leverage this existing code as the functionality and registers are common enough between the LM36274 and the LM363x series of devices. Signed-off-by: Dan Murphy Signed-off-by: Jacek Anaszewski --- v5 - Add flexibility when setting the EXT_EN GPIO bit for the LM3633 and LM36274 Based on comments made in patch 1 - https://lore.kernel.org/patchwork/patch/1077408/ drivers/regulator/Kconfig | 2 +- drivers/regulator/lm363x-regulator.c | 52 ++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) -- 2.21.0.5.gaeb582a983 diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 6c37f0df9323..34e03691dd00 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -363,7 +363,7 @@ config REGULATOR_LM363X tristate "TI LM363X voltage regulators" depends on MFD_TI_LMU help - This driver supports LM3631 and LM3632 voltage regulators for + This driver supports LM3631, LM3632 and LM36274 voltage regulators for the LCD bias. One boost output voltage is configurable and always on. Other LDOs are used for the display module. diff --git a/drivers/regulator/lm363x-regulator.c b/drivers/regulator/lm363x-regulator.c index 1b5d7d2f26b8..b053e2254684 100644 --- a/drivers/regulator/lm363x-regulator.c +++ b/drivers/regulator/lm363x-regulator.c @@ -37,6 +37,11 @@ #define LM3632_VBOOST_MIN 4500000 #define LM3632_VLDO_MIN 4000000 +/* LM36274 */ +#define LM36274_BOOST_VSEL_MAX 0x3f +#define LM36274_LDO_VSEL_MAX 0x34 +#define LM36274_VOLTAGE_MIN 4000000 + /* Common */ #define LM363X_STEP_50mV 50000 #define LM363X_STEP_500mV 500000 @@ -217,6 +222,51 @@ static const struct regulator_desc lm363x_regulator_desc[] = { .enable_reg = LM3632_REG_BIAS_CONFIG, .enable_mask = LM3632_EN_VNEG_MASK, }, + + /* LM36274 */ + { + .name = "vboost", + .of_match = "vboost", + .id = LM36274_BOOST, + .ops = &lm363x_boost_voltage_table_ops, + .n_voltages = LM36274_BOOST_VSEL_MAX, + .min_uV = LM36274_VOLTAGE_MIN, + .uV_step = LM363X_STEP_50mV, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + .vsel_reg = LM36274_REG_VOUT_BOOST, + .vsel_mask = LM36274_VOUT_MASK, + }, + { + .name = "ldo_vpos", + .of_match = "vpos", + .id = LM36274_LDO_POS, + .ops = &lm363x_regulator_voltage_table_ops, + .n_voltages = LM36274_LDO_VSEL_MAX, + .min_uV = LM36274_VOLTAGE_MIN, + .uV_step = LM363X_STEP_50mV, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + .vsel_reg = LM36274_REG_VOUT_POS, + .vsel_mask = LM36274_VOUT_MASK, + .enable_reg = LM36274_REG_BIAS_CONFIG_1, + .enable_mask = LM36274_EN_VPOS_MASK, + }, + { + .name = "ldo_vneg", + .of_match = "vneg", + .id = LM36274_LDO_NEG, + .ops = &lm363x_regulator_voltage_table_ops, + .n_voltages = LM36274_LDO_VSEL_MAX, + .min_uV = LM36274_VOLTAGE_MIN, + .uV_step = LM363X_STEP_50mV, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + .vsel_reg = LM36274_REG_VOUT_NEG, + .vsel_mask = LM36274_VOUT_MASK, + .enable_reg = LM36274_REG_BIAS_CONFIG_1, + .enable_mask = LM36274_EN_VNEG_MASK, + }, }; static struct gpio_desc *lm363x_regulator_of_get_enable_gpio(struct device *dev, int id) @@ -229,9 +279,11 @@ static struct gpio_desc *lm363x_regulator_of_get_enable_gpio(struct device *dev, */ switch (id) { case LM3632_LDO_POS: + case LM36274_LDO_POS: return gpiod_get_index_optional(dev, "enable", 0, GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE); case LM3632_LDO_NEG: + case LM36274_LDO_NEG: return gpiod_get_index_optional(dev, "enable", 1, GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE); default: