From patchwork Fri Apr 5 14:55:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 161875 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp534358jan; Fri, 5 Apr 2019 07:56:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzeBXJokzWFWd0zOCzcj825rrCl+UR0FuSTkTvhyK0XrUXhsfduG8GyblqYkxtXeXVcUMde X-Received: by 2002:a63:f40d:: with SMTP id g13mr12754074pgi.345.1554476161489; Fri, 05 Apr 2019 07:56:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554476161; cv=none; d=google.com; s=arc-20160816; b=QZWb5mFwfGJvylS62bfx45ssroJCl4e/HjddEytQY9+AAP9bZiGNJZcW4FcbMmzLWJ FMHb7htHqUGvWaRAR7Fgg83t7zisRSQUiwGhdKZhCgy4eRQHn/yKcgKyrTxqG9DxNzjt BIzBaW1bjN97ROVKvE58PPt6nEK+TeXxEq4uXV/DATjd3Xf7ANJ2mmfus3KnAkBPgvSx CFoRHKSmoZSrGdvCWyKUDnRU92ArjtSFaPRgzjGG16Rb4XkIvjy5fityJ0iU4+nyFU/4 ZH0qJTTXOh7DPGdVWmRP44gH5hG4k2XV1Fb7QeK5/H/xypN26b+BWdTxkW/UkHHJ02Cj VXdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=WsV8jHQsSWe30n80GjU+q1luZECi25VWLF52xZShihU=; b=qG00wYy/vGl/rwrFM6oKz/Q7LOzak5kK71Rm3xE4KwSynF95KX/sMVjSYsWXlfL0YK VgSxz7HT2GU5MCglyBCT6tZeLul/UeT8GXgjXNba+CJ62lp0t5qT5aYRW7KkZ1lji5qG AiD6oQbRhtWiy+jIDdg+RCS+vT/aktc3nkRMyVbjr5Rv0Gf7nsBQ13oiCn2qCDVyAKSw Cfp8lqEcg/AiflllCnNMowGk7zUET36G35xCpJgkr37T2cMtKhRG6BvFiS7/+Jb4zTAk oD3jEjvHAwWu1R03sdI7tiNq4Io4CqeRysYDQCNuk11tvkmwEODa+PsghJhya793Bl7u 2Jxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=WNp38kRe; 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 h63si2252681pge.558.2019.04.05.07.56.01; Fri, 05 Apr 2019 07:56: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=WNp38kRe; 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 S1731407AbfDEO4A (ORCPT + 31 others); Fri, 5 Apr 2019 10:56:00 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:43294 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731342AbfDEOz6 (ORCPT ); Fri, 5 Apr 2019 10:55:58 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x35EtqWP043227; Fri, 5 Apr 2019 09:55:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1554476152; bh=WsV8jHQsSWe30n80GjU+q1luZECi25VWLF52xZShihU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=WNp38kRetp3PIFQeBR7/DhTe95SFYLzcKPYhB8UI5Kiarmukw6kc0DPABAHEHJ5tv +qtbBs4R8nZkpMA+045Nv2vsPhixjfbCAj5omRJ+OWyhTlbvbBbOZvryGTXjLrs+aI uX5kbkfg6QTrF1HaUgGruHZ0hyIrVyOpSHUWcsOc= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x35EtqTS120165 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 5 Apr 2019 09:55:52 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 5 Apr 2019 09:55:52 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE105.ent.ti.com (10.64.6.26) 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; Fri, 5 Apr 2019 09:55:52 -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 x35EtqPr033333; Fri, 5 Apr 2019 09:55:52 -0500 From: Dan Murphy To: , , , CC: , , , Dan Murphy Subject: [PATCH 2/6] dt-bindings: mfd: Add lm36274 bindings to ti-lmu Date: Fri, 5 Apr 2019 09:55:36 -0500 Message-ID: <20190405145540.27703-3-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20190405145540.27703-1-dmurphy@ti.com> References: <20190405145540.27703-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 --- .../devicetree/bindings/mfd/ti-lmu.txt | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) -- 2.19.0 diff --git a/Documentation/devicetree/bindings/mfd/ti-lmu.txt b/Documentation/devicetree/bindings/mfd/ti-lmu.txt index a948a8f41b2c..6ada671c1038 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 property: - 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 Fri Apr 5 14:55:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 161878 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp534670jan; Fri, 5 Apr 2019 07:56:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwW5wkHW89NwWEKPmwjraabeBh9JxE4VnfP8hp5XQNXsI9S8peCTlkDSwSAOE+F6zY9gspY X-Received: by 2002:a17:902:778a:: with SMTP id o10mr1798225pll.135.1554476180837; Fri, 05 Apr 2019 07:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554476180; cv=none; d=google.com; s=arc-20160816; b=HUdXcyqDcpSeGTCLe3zVv5LGYQN02Er3i71uM/NPNJ3kY1RVFizIYLcRbGDrY64vDQ sVPIbSxQPwLC9FYujp91VNN7auhrN9PCxubt/hPzOM+k32aI26OihKVbNpsRikJiwRl7 6+DxDF7ZKP+FdIwETlEdSrrbyLUqe62FCnRlP20FBI+16YPR9YD/IPqzXWIyySClq3bp WKm0zULhMaV4mVxQKHtaoZq9gjZUz1dlJwoGsM33qAtTZjEPklOr6W5AYoq3tgO7EORb II1m/Z2ZTkCjmgULF3uzCnTHici1C7CA3cbwclKEgW28oNgPIO0F2QoYKQqsl514huL1 cSoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=dTEdE8TGqtDH/6NU2l1aZ1YRAJN9b9+Cexyp47E/TP8=; b=u56S+PMI0joEXHDrHjxWAMrJ9a0ZPP42/4HYxO2PHAE9A1c/0cX3PfJ+e4674HskfN ONS85qjdTtIca1ax+cFetXgskH6zJmi8XPQwDebBV8boQoNXM3iEHYmVaTrZF21m0z1B GNrnuHyQoLxq+RDbXrxMTJtKKl+6bMcmLdleJyHfapdE6s1tVmBNTAkYd2dXtg92Om4Y Cut56U6lr5+g11yEDZbPh7uoYhYZCq1vHvytAi1w1ZMewYoEHFtVX2fBj45KWWnM4o2X r6hmpg6ADhoveCxR7Yo2Iya8A0XKHbTGs70cVcNAZfIIHzmS0sOFn7LBjRY4YcPb94FA huvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=LGT5tiEg; 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 h5si18860964pgq.224.2019.04.05.07.56.20; Fri, 05 Apr 2019 07:56:20 -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=LGT5tiEg; 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 S1731463AbfDEO4S (ORCPT + 31 others); Fri, 5 Apr 2019 10:56:18 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:33322 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731330AbfDEOz5 (ORCPT ); Fri, 5 Apr 2019 10:55:57 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x35Etr6d105050; Fri, 5 Apr 2019 09:55:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1554476153; bh=dTEdE8TGqtDH/6NU2l1aZ1YRAJN9b9+Cexyp47E/TP8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=LGT5tiEg8G/u5sIi4yH6UMaEOak8HuiINGE0QemJqKrgmhU0IJxIQIBeATFoGPiuh FVnA0FPNbxXEV2NKFUcvq/0Kl+pGcfoC2Km81YVqI1ppr2+jG5V2VVLGQTkByapvdz S/eiMrQ/1EODzVw+zCRqXT1VrHzjC5T7/5Zf67aE= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x35EtqaX123314 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 5 Apr 2019 09:55:52 -0500 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 5 Apr 2019 09:55:52 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE108.ent.ti.com (157.170.170.38) 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; Fri, 5 Apr 2019 09:55:52 -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 x35EtqPV086623; Fri, 5 Apr 2019 09:55:52 -0500 From: Dan Murphy To: , , , CC: , , , Dan Murphy Subject: [PATCH 3/6] mfd: ti-lmu: Add LM36274 support to the ti-lmu Date: Fri, 5 Apr 2019 09:55:37 -0500 Message-ID: <20190405145540.27703-4-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20190405145540.27703-1-dmurphy@ti.com> References: <20190405145540.27703-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 --- 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.19.0 diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index fcae244229b3..5606411038bb 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -1311,9 +1311,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 Fri Apr 5 14:55:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 161876 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp534488jan; Fri, 5 Apr 2019 07:56:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSIuakBgM9ZIc1u0IpzD+WmSR0y1JcroYpIOnROIneJp82GsFi/pAzgaxEToFtAIgE/V1q X-Received: by 2002:a17:902:403:: with SMTP id 3mr13139093ple.48.1554476170734; Fri, 05 Apr 2019 07:56:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554476170; cv=none; d=google.com; s=arc-20160816; b=KpDI4Z7FrrxuZwBm25K/SUQTVofvyPHL+bKeuQ2r1hMj0yWKGlCiORfNQv9KWRvtIg sPKj59jA6aGcGHSu2d1KN1dJ/sk+UOOJpXt3McDaL8PwNGvxnoXDspiOYfmf0LngEPdb SvMX+GE6eCbVS+5XyzsVFgtfd3DBcy4DqtWKAswcXliN4X013U82qFxGcJCwi/XzlQqB mf4rxwDofiyjNZHL78+brtQZGhGadiz7+LjF19OYPIZalgTxAjm06xppzbNNHxjuMS0C P94mqKIWQTQ8vkt5CFKuorbx2hH+8iWCsxjX/6L9km/eC+7z2NVK03mZp+JTQCAISYKw PSKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=AKa+U/TawWkjTQEM6Wa0ywxCRzJ60DjmR5NjaxW0ARk=; b=nbxjtgyVso1CKRgA6yBFL6XJm0K+5n0K2Td/ZJnFA4eQmajOTSGxrpDsKB7lNnAw3o BScTYkQiBzg2w2Aw/d3iQjALVqlvr8koSt6HMzGinZCfu9WhJWT+IthlDLoBWD/vUgq1 Yk/pry5DVvRkJcoCSZrcNcT+8cukRpTfEHshSmF3sR0rcEzgxwIgAoUSd5Ow+6U5on3z +DnyewUeznbChCsBnVh01jhutwSWRhrHgO2fryiW4y5Lb6iMa5KqRD7BRtA7fmYgLtfR Y78AY2naq3f7792pnVnLSVQRiBjKbwq6YlrQ/Npt4a2ro03knTJuyLLDLXzuYVVhOBFF yCNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=OGRYZfuu; 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 196si5720868pgb.295.2019.04.05.07.56.10; Fri, 05 Apr 2019 07:56:10 -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=OGRYZfuu; 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 S1731430AbfDEO4J (ORCPT + 31 others); Fri, 5 Apr 2019 10:56:09 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:33316 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731314AbfDEOz6 (ORCPT ); Fri, 5 Apr 2019 10:55:58 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x35EtsjY105067; Fri, 5 Apr 2019 09:55:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1554476154; bh=AKa+U/TawWkjTQEM6Wa0ywxCRzJ60DjmR5NjaxW0ARk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=OGRYZfuuZF5JD2TeSWmDcj7PGQvBw3zpdQad0isl8GIwMtwdw+y3P7WwvVmRxNnAv rPzkyTYnTbfgooF0WqijEWoaIdbdLfc0QCSNtTDTxlcJPP2AaqTeY636M2Rexh7qG4 2AvNVIkQzC0WTOK1KsaJl5N3jh8E85AeeOXQUa/Y= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x35Etrhh121253 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 5 Apr 2019 09:55:54 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) 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; Fri, 5 Apr 2019 09:55:53 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE115.ent.ti.com (10.64.6.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; Fri, 5 Apr 2019 09:55:53 -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 x35EtrDp081088; Fri, 5 Apr 2019 09:55:53 -0500 From: Dan Murphy To: , , , CC: , , , Dan Murphy Subject: [PATCH 6/6] leds: lm36274: Introduce the TI LM36274 LED driver Date: Fri, 5 Apr 2019 09:55:40 -0500 Message-ID: <20190405145540.27703-7-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20190405145540.27703-1-dmurphy@ti.com> References: <20190405145540.27703-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-led-common framework to set the brightness bits. Signed-off-by: Dan Murphy --- drivers/leds/Kconfig | 9 +- drivers/leds/Makefile | 1 + drivers/leds/leds-lm36274.c | 174 ++++++++++++++++++++++++++++++++++++ 3 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 drivers/leds/leds-lm36274.c -- 2.19.0 diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 2d1576f4d5d6..c0bf59544886 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -783,12 +783,19 @@ 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 + help + Say Y to enable the LM36274 LED driver for TI LMU devices. + This supports the LED device LM36274. + config LEDS_TI_LMU_COMMON tristate "LED driver for TI LMU" help Say Y to enable the LED driver for TI LMU devices. This supports common features between the TI LM3532, LM3631, LM3632, - LM3633, LM3695 and LM3697. + LM3633, LM3695, LM3697 and LM36274 comment "LED Triggers" source "drivers/leds/trigger/Kconfig" diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 2eb0225d8dc6..7ff67215b38c 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -81,6 +81,7 @@ 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_LM3697) += leds-lm3697.o +obj-$(CONFIG_LEDS_LM36274) += leds-lm36274.o obj-$(CONFIG_LEDS_TI_LMU_COMMON) += ti-lmu-led-common.o # LED SPI Drivers diff --git a/drivers/leds/leds-lm36274.c b/drivers/leds/leds-lm36274.c new file mode 100644 index 000000000000..6a419c47c47f --- /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");