From patchwork Tue Jun 4 17:43:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 165805 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp6160069ili; Tue, 4 Jun 2019 10:44:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4q+9QA3G55dWtqmVUVR3a/5/rdKt5YnauRfFVkQuN64JyPAHzQtamulPeetio3kuNFAco X-Received: by 2002:a17:90a:26a9:: with SMTP id m38mr37610667pje.50.1559670243859; Tue, 04 Jun 2019 10:44:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559670243; cv=none; d=google.com; s=arc-20160816; b=SU2M0mp9iDjhyP+rv7W484aXcGwACekRYdyz6dfOjPkfb2J4I8SWdSxh6P10p+/KDy 6aa9iLeEYYqxatjfNSk1Fs4+V8kdz+aq/UzR38xP4Fjhq8Qu7i/X6iZSUEJmunC21p5B VkyAFRr4ic8HndRZiaWrDa7NLjgRciZaQ2VIRayMdpVq1HTbZlsgZznEkzzhv1RAJVvx U2aBqpm37WwRPI4MXCmTltou9qXojwWBkzjjXMdfZXQf9pVPjh08rvr65b+H2P+hO7QP KBsh21ivtqxppKmG+6IbrCdC3d+oFAgp96tBw1khs8J+tNo+A7TBnTjkjBiIcpelDz1R hcWg== 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=NsXqGZz+3lZLeXcH2N4X++kQC77uWAzEOXX0JL6PHoQ=; b=P7dDMjMMzhY5YEDjIHkkVKiYpXVXGJngItumXgC1HnAlpDmykPi+JdWYzzGdNcL1M6 3BH5cDLyde6bqkzxxSSgH2Zbq1DSTYPUxD5aBlmTkWZO+I37F0zzNOt4KwIgGWC9J91g KmI4SkncbjUyGnvbBYc6DZ299HZFFyldlDJCiur8jevXiSVTFZ6YDeb6BAStoDrsiQ/l eC2TvhFzWF1dw2cZeZL8QJqo9Uw4HZjMAZCAC1zgFT/b8cmD34JLS4tG/3/5miGxiT/1 Ltp1319F+n5Hr/k86tPnFamzPV3ETPhwVxZmyNAlgeO7R0HpcFcufWnSb3J8nYCOHpOe YFUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="Euw8LlT/"; 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.44.03; Tue, 04 Jun 2019 10:44:03 -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="Euw8LlT/"; 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 S1726779AbfFDRoC (ORCPT + 30 others); Tue, 4 Jun 2019 13:44:02 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:44318 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726211AbfFDRny (ORCPT ); Tue, 4 Jun 2019 13:43:54 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x54HhmBG058572; Tue, 4 Jun 2019 12:43:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1559670228; bh=NsXqGZz+3lZLeXcH2N4X++kQC77uWAzEOXX0JL6PHoQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Euw8LlT/ruoxlYiLNiU/P0Km0aJu5SoVJ1E5AaIc5i26PTyXorgIxz28ygeMCu+Ic VpqtlblWGTYwtTlwnm69CtuPXHwq9DsWxSqRZUkiUDHn8u12LaYVq1T1UqPUuhsppb ndj3DnHYI5eGkoWtFZFO8tfO1GHazC8P3dUAkV4o= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x54HhmbC111955 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 4 Jun 2019 12:43:48 -0500 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE115.ent.ti.com (157.170.170.26) 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:48 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE103.ent.ti.com (157.170.170.33) 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:48 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x54Hhm9H110656; Tue, 4 Jun 2019 12:43:48 -0500 From: Dan Murphy To: , , , CC: , , , Dan Murphy , Rob Herring Subject: [PATCH v5 2/6] dt-bindings: mfd: Add lm36274 bindings to ti-lmu Date: Tue, 4 Jun 2019 12:43:41 -0500 Message-ID: <20190604174345.14841-3-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 Add the LM36274 backlight driver with regulator support. This is a multi-function device for backlight applications. Backlight properties will be documented in it's a supplemental bindings document. Regulator support is documented in the regulator/lm363x-regulator.txt http://www.ti.com/lit/ds/symlink/lm36274.pdf Signed-off-by: Dan Murphy Reviewed-by: Rob Herring Acked-by: Lee Jones Signed-off-by: Jacek Anaszewski --- v5 - No changes .../devicetree/bindings/mfd/ti-lmu.txt | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) -- 2.21.0.5.gaeb582a983 diff --git a/Documentation/devicetree/bindings/mfd/ti-lmu.txt b/Documentation/devicetree/bindings/mfd/ti-lmu.txt index 782d3c9812ed..2296b8f24de4 100644 --- a/Documentation/devicetree/bindings/mfd/ti-lmu.txt +++ b/Documentation/devicetree/bindings/mfd/ti-lmu.txt @@ -8,6 +8,7 @@ TI LMU driver supports lighting devices below. LM3632 Backlight and regulator LM3633 Backlight, LED and fault monitor LM3695 Backlight + LM36274 Backlight and regulator Required properties: - compatible: Should be one of: @@ -15,11 +16,13 @@ Required properties: "ti,lm3632" "ti,lm3633" "ti,lm3695" + "ti,lm36274" - reg: I2C slave address. 0x11 for LM3632 0x29 for LM3631 0x36 for LM3633 0x63 for LM3695 + 0x11 for LM36274 Optional properties: - enable-gpios: A GPIO specifier for hardware enable pin. @@ -50,12 +53,14 @@ Optional nodes: - compatible: Should be one of: "ti,lm3633-fault-monitor" - leds: LED properties for LM3633. Please refer to [2]. + LED properties for LM36274. Please refer to [4]. - regulators: Regulator properties for LM3631 and LM3632. Please refer to [3]. [1] ../leds/backlight/ti-lmu-backlight.txt [2] ../leds/leds-lm3633.txt [3] ../regulator/lm363x-regulator.txt +[4] ../leds/leds-lm36274.txt lm3631@29 { compatible = "ti,lm3631"; @@ -213,3 +218,52 @@ lm3695@63 { }; }; }; + +lm36274@11 { + compatible = "ti,lm36274"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x11>; + + enable-gpios = <&pioC 2 GPIO_ACTIVE_HIGH>; + regulators { + #address-cells = <1>; + #size-cells = <0>; + compatible = "ti,lm363x-regulator"; + + enable-gpios = <&pioC 0 GPIO_ACTIVE_HIGH>, + <&pioC 1 GPIO_ACTIVE_HIGH>; + + vboost { + regulator-name = "lcd_boost"; + regulator-min-microvolt = <4000000>; + regulator-max-microvolt = <7150000>; + regulator-always-on; + }; + + vpos { + regulator-name = "lcd_vpos"; + regulator-min-microvolt = <4000000>; + regulator-max-microvolt = <6500000>; + }; + + vneg { + regulator-name = "lcd_vneg"; + regulator-min-microvolt = <4000000>; + regulator-max-microvolt = <6500000>; + }; + }; + + backlight { + #address-cells = <1>; + #size-cells = <0>; + compatible = "ti,lm36274-backlight"; + + led@0 { + reg = <0>; + led-sources = <0 2>; + label = "white:backlight_cluster"; + linux,default-trigger = "backlight"; + }; + }; +}; From patchwork Tue Jun 4 17:43:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 165804 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp6160035ili; Tue, 4 Jun 2019 10:44:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6JvLEDqs5E7O6zD1pHHr/9dFdmrCgvIc9XMI7kop2zMQmZTItwF1gMaxIxk5xOF8px6iA X-Received: by 2002:a63:f344:: with SMTP id t4mr23363909pgj.283.1559670241625; Tue, 04 Jun 2019 10:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559670241; cv=none; d=google.com; s=arc-20160816; b=ljYclxDONiDtVaR9oLA1FxxGGgRaDlvRsVn7O2OUy0B7RayQzHK6/kLk4sRKscs6E+ epI2jH3qst08tHK6elZojh1de+rgEIichAC2+doB5K55Qy7DpDbfgusObW7TVXiSj75N 6NzF2WcstgIdXbMtW/ZQV3ZTxBndG0sOyJ5kRD+0Wkd+fvn1vX+ttCSaQar60Re2FeGa fYzH8zS14c1i2gP3fE0ethhjcPGV1/ANZf4mLBp9BVZy/x389d+5psQXhIIBvBIBtUXn KF6qQzvo4gdx2N1jHLrPyzibDLxOm+CfL+r4xRya0oIBjZBL7aC2CzmvvX5DN5O3Bl0q tGfw== 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=//d0ZgtUE27inP2KL+Zr2FHNs+rF3UulcIDGdywsweg=; b=nNogf8Xd8mhMVaW5DFNX8kxfrF9QcckKYt2uX0UljzOmYnEiLrlWF47biH/86pEqpm v7d+L4lDExFCTj5ZCk30UP7dTUT2iWh/Sse7SICRvyXlQS27LtwUf1LD7U9HLsYp6zzP 8My0DPay9suusLYp5Kix3yxVJjcz5aPeifkPEvPniCxtu+4/THAwiO6KUpcEiwD+apze xGgdm/nca0r/AgSmZALEIYt8HIMvCV/0oUa3pg+m/70Hq5SfDU5NywzXmzCpInbyC/uQ WlrIejmk8YRgfGBs8gVTJCY30dt8cnDscNsNxaXgCeHG3swFxbiPRoCTxXrFt7F8vrkS Fexg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=nTc+Qpso; 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.44.01; Tue, 04 Jun 2019 10:44:01 -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=nTc+Qpso; 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 S1726752AbfFDRoA (ORCPT + 30 others); Tue, 4 Jun 2019 13:44:00 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:53252 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726422AbfFDRny (ORCPT ); Tue, 4 Jun 2019 13:43:54 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x54Hhn5d018132; 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=//d0ZgtUE27inP2KL+Zr2FHNs+rF3UulcIDGdywsweg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=nTc+QpsoB2tBEkI9za/qZuZeioTPXmMn18Gct8ID9tvKRTCAl8xInGE4um53k7Lod 4Ejf9XqvYi3wF2PYnRsh2eXcmlpSxdlq7YHgOYtNIafOqJt6xBbwj1rvgaCWLCqDha fN4mGUHsu5UIzBhi+nRsv6Ww0PAjTexHh0kfkNCI= Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x54Hhniq057671 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 4 Jun 2019 12:43:49 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE111.ent.ti.com (10.64.6.32) 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:48 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE102.ent.ti.com (10.64.6.23) 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:48 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x54Hhmq1123667; Tue, 4 Jun 2019 12:43:48 -0500 From: Dan Murphy To: , , , CC: , , , Dan Murphy Subject: [PATCH v5 3/6] mfd: ti-lmu: Add LM36274 support to the ti-lmu Date: Tue, 4 Jun 2019 12:43:42 -0500 Message-ID: <20190604174345.14841-4-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 Add the LM36274 register support to the ti-lmu MFD driver. Signed-off-by: Dan Murphy Acked-by: Lee Jones Signed-off-by: Jacek Anaszewski --- v5 - No changes drivers/mfd/Kconfig | 5 ++--- drivers/mfd/ti-lmu.c | 14 ++++++++++++++ include/linux/mfd/ti-lmu-register.h | 23 +++++++++++++++++++++++ include/linux/mfd/ti-lmu.h | 4 ++++ 4 files changed, 43 insertions(+), 3 deletions(-) -- 2.21.0.5.gaeb582a983 diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 8933485b28e7..a69aca3c2dab 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -1335,9 +1335,8 @@ config MFD_TI_LMU select REGMAP_I2C help Say yes here to enable support for TI LMU chips. - - TI LMU MFD supports LM3532, LM3631, LM3632, LM3633, and LM3695. - It consists of backlight, LED and regulator driver. + TI LMU MFD supports LM3532, LM3631, LM3632, LM3633, LM3695 and + LM36274. It consists of backlight, LED and regulator driver. It provides consistent device controls for lighting functions. config MFD_OMAP_USB_HOST diff --git a/drivers/mfd/ti-lmu.c b/drivers/mfd/ti-lmu.c index 89b1c5b584af..691ab9dd6236 100644 --- a/drivers/mfd/ti-lmu.c +++ b/drivers/mfd/ti-lmu.c @@ -111,6 +111,17 @@ static const struct mfd_cell lm3695_devices[] = { }, }; +static const struct mfd_cell lm36274_devices[] = { + LM363X_REGULATOR(LM36274_BOOST), + LM363X_REGULATOR(LM36274_LDO_POS), + LM363X_REGULATOR(LM36274_LDO_NEG), + { + .name = "lm36274-leds", + .id = LM36274, + .of_compatible = "ti,lm36274-backlight", + }, +}; + #define TI_LMU_DATA(chip, max_reg) \ static const struct ti_lmu_data chip##_data = \ { \ @@ -123,6 +134,7 @@ TI_LMU_DATA(lm3631, LM3631_MAX_REG); TI_LMU_DATA(lm3632, LM3632_MAX_REG); TI_LMU_DATA(lm3633, LM3633_MAX_REG); TI_LMU_DATA(lm3695, LM3695_MAX_REG); +TI_LMU_DATA(lm36274, LM36274_MAX_REG); static int ti_lmu_probe(struct i2c_client *cl, const struct i2c_device_id *id) { @@ -191,6 +203,7 @@ static const struct of_device_id ti_lmu_of_match[] = { { .compatible = "ti,lm3632", .data = &lm3632_data }, { .compatible = "ti,lm3633", .data = &lm3633_data }, { .compatible = "ti,lm3695", .data = &lm3695_data }, + { .compatible = "ti,lm36274", .data = &lm36274_data }, { } }; MODULE_DEVICE_TABLE(of, ti_lmu_of_match); @@ -200,6 +213,7 @@ static const struct i2c_device_id ti_lmu_ids[] = { { "lm3632", LM3632 }, { "lm3633", LM3633 }, { "lm3695", LM3695 }, + { "lm36274", LM36274 }, { } }; MODULE_DEVICE_TABLE(i2c, ti_lmu_ids); diff --git a/include/linux/mfd/ti-lmu-register.h b/include/linux/mfd/ti-lmu-register.h index 76998b01764b..076d8dea38fd 100644 --- a/include/linux/mfd/ti-lmu-register.h +++ b/include/linux/mfd/ti-lmu-register.h @@ -189,4 +189,27 @@ #define LM3695_REG_BRT_MSB 0x14 #define LM3695_MAX_REG 0x14 + +/* LM36274 */ +#define LM36274_REG_REV 0x01 +#define LM36274_REG_BL_CFG_1 0x02 +#define LM36274_REG_BL_CFG_2 0x03 +#define LM36274_REG_BRT_LSB 0x04 +#define LM36274_REG_BRT_MSB 0x05 +#define LM36274_REG_BL_EN 0x08 + +#define LM36274_REG_BIAS_CONFIG_1 0x09 +#define LM36274_EXT_EN_MASK BIT(0) +#define LM36274_EN_VNEG_MASK BIT(1) +#define LM36274_EN_VPOS_MASK BIT(2) + +#define LM36274_REG_BIAS_CONFIG_2 0x0a +#define LM36274_REG_BIAS_CONFIG_3 0x0b +#define LM36274_REG_VOUT_BOOST 0x0c +#define LM36274_REG_VOUT_POS 0x0d +#define LM36274_REG_VOUT_NEG 0x0e +#define LM36274_VOUT_MASK 0x3F + +#define LM36274_MAX_REG 0x13 + #endif diff --git a/include/linux/mfd/ti-lmu.h b/include/linux/mfd/ti-lmu.h index 54e9d272e81c..0957598c7d41 100644 --- a/include/linux/mfd/ti-lmu.h +++ b/include/linux/mfd/ti-lmu.h @@ -26,6 +26,7 @@ enum ti_lmu_id { LM3632, LM3633, LM3695, + LM36274, LMU_MAX_ID, }; @@ -67,6 +68,9 @@ enum lm363x_regulator_id { LM3632_BOOST, /* Boost output */ LM3632_LDO_POS, /* Positive display bias output */ LM3632_LDO_NEG, /* Negative display bias output */ + LM36274_BOOST, /* Boost output */ + LM36274_LDO_POS, /* Positive display bias output */ + LM36274_LDO_NEG, /* Negative display bias output */ }; /** 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: From patchwork Tue Jun 4 17:43:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 165806 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp6160175ili; Tue, 4 Jun 2019 10:44:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEycXGH7m9ixfwHkKfUTSUR3/cv7FTZrUbEjR3VPMJxjTzcZG6O3QuwAgm8ydZ+5IBHEL/ X-Received: by 2002:aa7:9104:: with SMTP id 4mr39487982pfh.66.1559670249176; Tue, 04 Jun 2019 10:44:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559670249; cv=none; d=google.com; s=arc-20160816; b=Zxj1nhULa2IhprceNSaZX4QGKyMO6F5vBkT731MgZeZP2NOgBZe084CRnANkk8rxoc sVS5pu9uLbPUajYe+6jRAXVTxyvvZ1opr+3iOPbFopawaVZJJcwQp8pzWvehWCYv4QDf 1LxhZpCEW3IQCPAaQR6sR2tQ8YkqFvkO232fvICC2mD/3rOn6F/5NikFYkI54HnhIj4H 2y96iLA8ojylJVKUEblk4wSUvtp8EEEL6alN/yNkRPhilcM3CxVBRmLQt9erkUVqRHpo L1xcUpOw9b2SpIDmiZ/AEYShH4eAgm+rfBX36lkAXjHE45iJRaBTiIX7kmxnRaQA75EQ jOaw== 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=p/w7U8M9/CoJS0HUsPEqCyOoFhRjhTcOtuoAb+KaDFE=; b=uSZ1laBHJvJczqX2KhCUjcjDQV5DUy7r6aMP34SahbYHEe6nY55pblPCno4544uITj iwZKk+kTWmFdQvtqujyIbSfzSuvCAPGFFOaedaAp9ESsyaiZSBy+wjc1G/y+Af7oW5Ml ME2XZOXsWlwHs1LHW7v6295BLkxRrelaUDRH5X2v7aPJFjVwuI1BLdbfnBIoNPbkBrgm LNhCiOACT8zw1bwYXgUldhN2VzkwhDhfr1kGHOXPlj5CTtUZMLHL8RPhRdX/bcJnr42j r7Q88fdxJz7s32kWEvifAk8j353zmTYcvhxTYK1BCyBJes6iG4OuBubvrecTl8Bw3DKp iQlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=vt+ZGbLl; 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 q28si22182284pgm.545.2019.06.04.10.44.08; Tue, 04 Jun 2019 10:44:09 -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=vt+ZGbLl; 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 S1726724AbfFDRn7 (ORCPT + 30 others); Tue, 4 Jun 2019 13:43:59 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:37492 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726486AbfFDRny (ORCPT ); Tue, 4 Jun 2019 13:43:54 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x54Hhnli027627; 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=p/w7U8M9/CoJS0HUsPEqCyOoFhRjhTcOtuoAb+KaDFE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=vt+ZGbLlmc2lBA6y2lSHwQp12JEmFp+6SduEQ9MRCo3Gsbha2UKdemBmPSdh5buVL xPjPXmSdfWxCDWIHG5C51dBYDfGNDI58iAPsGXHyHSE0HhSBLeQHz95RRyDz5Qq8Ig UKfQv0fDqGIq4qab++m6RSXHa98UJbVc0wb8M9JI= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x54Hhn3j057687 (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 fllv0040.itg.ti.com (10.64.41.20) 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 fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x54Hhn1G123676; Tue, 4 Jun 2019 12:43:49 -0500 From: Dan Murphy To: , , , CC: , , , Dan Murphy , Rob Herring Subject: [PATCH v5 5/6] dt-bindings: leds: Add LED bindings for the LM36274 Date: Tue, 4 Jun 2019 12:43:44 -0500 Message-ID: <20190604174345.14841-6-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 Add the LM36274 LED specific bindings. Signed-off-by: Dan Murphy Reviewed-by: Rob Herring Signed-off-by: Jacek Anaszewski --- v5 - No changes .../devicetree/bindings/leds/leds-lm36274.txt | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-lm36274.txt -- 2.21.0.5.gaeb582a983 diff --git a/Documentation/devicetree/bindings/leds/leds-lm36274.txt b/Documentation/devicetree/bindings/leds/leds-lm36274.txt new file mode 100644 index 000000000000..329393700191 --- /dev/null +++ b/Documentation/devicetree/bindings/leds/leds-lm36274.txt @@ -0,0 +1,82 @@ +* Texas Instruments LM36274 4-Channel LCD Backlight Driver w/Integrated Bias + +The LM36274 is an integrated four-channel WLED driver and LCD bias supply. +The backlight boost provides the power to bias four parallel LED strings with +up to 29V total output voltage. The 11-bit LED current is programmable via +the I2C bus and/or controlled via a logic level PWM input from 60 μA to 30 mA. + +Parent device properties are documented in ../mfd/ti_lmu.txt +Regulator properties are documented in ../regulator/lm363x-regulator.txt + +Required backlight properties: + - compatible: + "ti,lm36274-backlight" + - reg : 0 + - #address-cells : 1 + - #size-cells : 0 + - led-sources : Indicates which LED strings will be enabled. + Values from 0-3, sources is 0 based so strings will be + source value + 1. + +Optional backlight properties: + - label : see Documentation/devicetree/bindings/leds/common.txt + - linux,default-trigger : + see Documentation/devicetree/bindings/leds/common.txt + +Example: + +HVLED string 1 and 3 are controlled by control bank A and HVLED 2 string is +controlled by control bank B. + +lm36274@11 { + compatible = "ti,lm36274"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x11>; + + enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>; + + regulators { + #address-cells = <1>; + #size-cells = <0>; + compatible = "ti,lm363x-regulator"; + + enable-gpios = <&pioC 0 GPIO_ACTIVE_HIGH>, + <&pioC 1 GPIO_ACTIVE_HIGH>; + + vboost { + regulator-name = "lcd_boost"; + regulator-min-microvolt = <4000000>; + regulator-max-microvolt = <7150000>; + regulator-always-on; + }; + + vpos { + regulator-name = "lcd_vpos"; + regulator-min-microvolt = <4000000>; + regulator-max-microvolt = <6500000>; + }; + + vneg { + regulator-name = "lcd_vneg"; + regulator-min-microvolt = <4000000>; + regulator-max-microvolt = <6500000>; + }; + }; + + backlight { + #address-cells = <1>; + #size-cells = <0>; + compatible = "ti,lm36274-backlight"; + + led@0 { + reg = <0>; + led-sources = <0 2>; + label = "white:backlight_cluster"; + linux,default-trigger = "backlight"; + }; + }; +}; + +For more product information please see the link below: +http://www.ti.com/lit/ds/symlink/lm36274.pdf From patchwork Tue Jun 4 17:43:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 165807 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp6160272ili; Tue, 4 Jun 2019 10:44:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUHxwXeliIw7/Zeav5WGM5hcs4TPRX1SVZ338DduNURXQXzos+xXOIUKxIW7ufKdr1M/dA X-Received: by 2002:a65:6495:: with SMTP id e21mr36214936pgv.383.1559670254520; Tue, 04 Jun 2019 10:44:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559670254; cv=none; d=google.com; s=arc-20160816; b=PnJylB2ldYz4Deffw5hQJHZ82mCSyh2pr6mLNODD9xFlLDTRqKcyGq2VGVYjJMjuh0 nLU0NQybvBMXf44C4TWpx19oZ4hssKo611SNiFcRAmWY7Dn6HTLwjeFUUR/ixIdkTjRv co8kI7P+WFcncif92IzIVxDrYtFiqy4TlXpNCvUpFF/ThoPNt6R7xRE7bK8MhPPMMjYl 8LpTaIUw80uYzDLSlEv744IJGLo2csCKXB/oGXk7IOjF8Sw9dCBZw8clLq6Gmuby2/BY Jp1SSzeBj+moyuzjTpqWrn9GJm17hmAlmN+0wfS9RlslrIBVer9TWkoHHcr/qhV20F5C oYiQ== 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=fDHnhJLBG1WGvVdCW+tFwYvr1TQ8gB7ikNstQuuRzTE=; b=TQcnTGhz/I2s3sGTgeZvRm3sxW2EZqgxAfXJbIm98qDY010hD2tHRZ4GThQ3jp2Ie+ Z0akYZuJs8+ITt7KW8itMzy+YP0fOBi8QRmxYUcBspd9HUvqMCc/6uvdtpqZbDV/kUnc neJhNnctT1PYegAzXQYy9zD5LhhRSS80NIYJYwGlZTHaeZcTmVktIfiHhwCx1fZ8+L31 dtgsfqEAH7uI1xt7OkY6bSsJ4/csXOSaIu4Z+zly4bg7HdktXkCg1Z7+0nZmrGafs7Au abfTmqGLbLU/Oq6MxYYnmO9le+o8eJLXP+TbjxBC+noWspaZbnumKSMKm8Y63z3xD+Id F/ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=qpPmWOup; 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 99si24956963pla.397.2019.06.04.10.44.14; Tue, 04 Jun 2019 10:44:14 -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=qpPmWOup; 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 S1726795AbfFDRoN (ORCPT + 30 others); Tue, 4 Jun 2019 13:44:13 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:53254 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726605AbfFDRnz (ORCPT ); Tue, 4 Jun 2019 13:43:55 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x54HhpJL018142; Tue, 4 Jun 2019 12:43:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1559670231; bh=fDHnhJLBG1WGvVdCW+tFwYvr1TQ8gB7ikNstQuuRzTE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=qpPmWOupFm2IfSi3WBmfTudR5/5TF5PVw0hy/XQT0GNaeps83BBdzi0eWqHCOSaJz 9WOwsGSfJ59Ny7NevIkp0yfnBdVAzj6jYTDBEtRIk+ZyCd0B2J46m3gCQWfqXZkDhV RVmQFi+rsWGdw4oSxgrrl1BGXWfq7A1Fo2qZQzts= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x54HhpOh057703 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 4 Jun 2019 12:43:51 -0500 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE110.ent.ti.com (157.170.170.21) 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 lelv0327.itg.ti.com (10.180.67.183) by DLEE106.ent.ti.com (157.170.170.36) 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 lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x54Hhnul093804; Tue, 4 Jun 2019 12:43:49 -0500 From: Dan Murphy To: , , , CC: , , , Dan Murphy Subject: [PATCH v5 6/6] leds: lm36274: Introduce the TI LM36274 LED driver Date: Tue, 4 Jun 2019 12:43:45 -0500 Message-ID: <20190604174345.14841-7-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 Introduce the LM36274 LED driver. This driver uses the ti-lmu MFD driver to probe this LED driver. The driver configures only the LED registers and enables the outputs according to the config file. The driver utilizes the TI LMU (Lighting Management Unit) LED common framework to set the brightness bits. Signed-off-by: Dan Murphy Signed-off-by: Jacek Anaszewski --- v5 - No changes drivers/leds/Kconfig | 8 ++ drivers/leds/Makefile | 1 + drivers/leds/leds-lm36274.c | 174 ++++++++++++++++++++++++++++++++++++ 3 files changed, 183 insertions(+) create mode 100644 drivers/leds/leds-lm36274.c -- 2.21.0.5.gaeb582a983 diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 91cb047059a0..61c585049b2d 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -798,6 +798,14 @@ config LEDS_LM3697 Say Y to enable the LM3697 LED driver for TI LMU devices. This supports the LED device LM3697. +config LEDS_LM36274 + tristate "LED driver for LM36274" + depends on LEDS_TI_LMU_COMMON + depends on MFD_TI_LMU + help + Say Y to enable the LM36274 LED driver for TI LMU devices. + This supports the LED device LM36274. + comment "LED Triggers" source "drivers/leds/trigger/Kconfig" diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 6c3350404ede..c52934732c1a 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -83,6 +83,7 @@ obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o obj-$(CONFIG_LEDS_LM3601X) += leds-lm3601x.o obj-$(CONFIG_LEDS_TI_LMU_COMMON) += leds-ti-lmu-common.o obj-$(CONFIG_LEDS_LM3697) += leds-lm3697.o +obj-$(CONFIG_LEDS_LM36274) += leds-lm36274.o # LED SPI Drivers obj-$(CONFIG_LEDS_CR0014114) += leds-cr0014114.o diff --git a/drivers/leds/leds-lm36274.c b/drivers/leds/leds-lm36274.c new file mode 100644 index 000000000000..b47786d36d21 --- /dev/null +++ b/drivers/leds/leds-lm36274.c @@ -0,0 +1,174 @@ +// SPDX-License-Identifier: GPL-2.0 +// TI LM36274 LED chip family driver +// Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#define LM36274_MAX_STRINGS 4 +#define LM36274_BL_EN BIT(4) + +/** + * struct lm36274 + * @pdev: platform device + * @led_dev: led class device + * @lmu_data: Register and setting values for common code + * @regmap: Devices register map + * @dev: Pointer to the devices device struct + * @led_sources - The LED strings supported in this array + * @num_leds - Number of LED strings are supported in this array + */ +struct lm36274 { + struct platform_device *pdev; + struct led_classdev led_dev; + struct ti_lmu_bank lmu_data; + struct regmap *regmap; + struct device *dev; + + u32 led_sources[LM36274_MAX_STRINGS]; + int num_leds; +}; + +static int lm36274_brightness_set(struct led_classdev *led_cdev, + enum led_brightness brt_val) +{ + struct lm36274 *led = container_of(led_cdev, struct lm36274, led_dev); + + return ti_lmu_common_set_brightness(&led->lmu_data, brt_val); +} + +static int lm36274_init(struct lm36274 *lm36274_data) +{ + int enable_val = 0; + int i; + + for (i = 0; i < lm36274_data->num_leds; i++) + enable_val |= (1 << lm36274_data->led_sources[i]); + + if (!enable_val) { + dev_err(lm36274_data->dev, "No LEDs were enabled\n"); + return -EINVAL; + } + + enable_val |= LM36274_BL_EN; + + return regmap_write(lm36274_data->regmap, LM36274_REG_BL_EN, + enable_val); +} + +static int lm36274_parse_dt(struct lm36274 *lm36274_data) +{ + struct fwnode_handle *child = NULL; + char label[LED_MAX_NAME_SIZE]; + struct device *dev = &lm36274_data->pdev->dev; + const char *name; + int child_cnt; + int ret = -EINVAL; + + /* There should only be 1 node */ + child_cnt = device_get_child_node_count(dev); + if (child_cnt != 1) + return ret; + + device_for_each_child_node(dev, child) { + ret = fwnode_property_read_string(child, "label", &name); + if (ret) + snprintf(label, sizeof(label), + "%s::", lm36274_data->pdev->name); + else + snprintf(label, sizeof(label), + "%s:%s", lm36274_data->pdev->name, name); + + lm36274_data->num_leds = fwnode_property_read_u32_array(child, + "led-sources", + NULL, 0); + if (lm36274_data->num_leds <= 0) + return -ENODEV; + + ret = fwnode_property_read_u32_array(child, "led-sources", + lm36274_data->led_sources, + lm36274_data->num_leds); + if (ret) { + dev_err(dev, "led-sources property missing\n"); + return -EINVAL; + } + + fwnode_property_read_string(child, "linux,default-trigger", + &lm36274_data->led_dev.default_trigger); + + } + + lm36274_data->lmu_data.regmap = lm36274_data->regmap; + lm36274_data->lmu_data.max_brightness = MAX_BRIGHTNESS_11BIT; + lm36274_data->lmu_data.msb_brightness_reg = LM36274_REG_BRT_MSB; + lm36274_data->lmu_data.lsb_brightness_reg = LM36274_REG_BRT_LSB; + + lm36274_data->led_dev.name = label; + lm36274_data->led_dev.max_brightness = MAX_BRIGHTNESS_11BIT; + lm36274_data->led_dev.brightness_set_blocking = lm36274_brightness_set; + + return ret; +} + +static int lm36274_probe(struct platform_device *pdev) +{ + struct ti_lmu *lmu = dev_get_drvdata(pdev->dev.parent); + struct lm36274 *lm36274_data; + int ret; + + lm36274_data = devm_kzalloc(&pdev->dev, sizeof(*lm36274_data), + GFP_KERNEL); + if (!lm36274_data) { + ret = -ENOMEM; + return ret; + } + + lm36274_data->pdev = pdev; + lm36274_data->dev = lmu->dev; + lm36274_data->regmap = lmu->regmap; + dev_set_drvdata(&pdev->dev, lm36274_data); + + ret = lm36274_parse_dt(lm36274_data); + if (ret) { + dev_err(lm36274_data->dev, "Failed to parse DT node\n"); + return ret; + } + + ret = lm36274_init(lm36274_data); + if (ret) { + dev_err(lm36274_data->dev, "Failed to init the device\n"); + return ret; + } + + return devm_led_classdev_register(lm36274_data->dev, + &lm36274_data->led_dev); +} + +static const struct of_device_id of_lm36274_leds_match[] = { + { .compatible = "ti,lm36274-backlight", }, + {}, +}; +MODULE_DEVICE_TABLE(of, of_lm36274_leds_match); + +static struct platform_driver lm36274_driver = { + .probe = lm36274_probe, + .driver = { + .name = "lm36274-leds", + }, +}; +module_platform_driver(lm36274_driver) + +MODULE_DESCRIPTION("Texas Instruments LM36274 LED driver"); +MODULE_AUTHOR("Dan Murphy "); +MODULE_LICENSE("GPL v2");