From patchwork Fri Sep 28 18:29:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 147801 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1082489lji; Fri, 28 Sep 2018 11:30:08 -0700 (PDT) X-Google-Smtp-Source: ACcGV60UKQKA+L4ud3dEHDFNQiFV6suxTrxSlWE2exz4A+5IMOspZz0bV3FuhIJlKKXwaWfUnuEH X-Received: by 2002:a63:3cc:: with SMTP id 195-v6mr16427876pgd.262.1538159408054; Fri, 28 Sep 2018 11:30:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538159408; cv=none; d=google.com; s=arc-20160816; b=RWIj8SroDTVXWn27Oi1Q6K0uguoVAWTKK0MGH8COdld9vcpIrutay+Tk7O4hUJWggR 9CEhFwR1CbT7/+R9LVkYRm6l3O8hY8OcnIFAT2ab7F6vTVFqk2gF3l2GuefN80Z9n5Cg XbJHchNLhQwzX4EF/8dpG2RWCzuk5hfbYx0yi6WILruv8Xk0trQVHZdIwOTFiY8W4W54 zyb3s/TEly/MASJsu1FzCw5oymKhh3PmrKUhLXI30wOpHVltdATyligeG9HjbR+v9h8p uobIDG0Mn0TEqFZXdSL5oGSf8W+6JSRoX2+d+0xXOM9XC1Ed+YEZaOVhZ6rtuUd0+yMB hnUQ== 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=3GAuzUXbOd8jWOv+t3OUo6wLb5KapUn+jO53TkxpDGM=; b=Ew7+qmbG/mxnBibn+xeKqeLswHpA5ywT1T3qgykWVBSK4zj5Iz61IbSIf3SqE0L3AR FCx5IGFnunDFfTa5iv+L8XsC3hYHDanIXCCmIkOLcORxKRkMcUGnv6rGQkc82truglNO nj6m1e3aGueF3mHmG7jUxaHoKG/cCFYNG/RqEjMIBHIz2l8zKOMQ3L1UJA4h9SxLlTwa 2phv7+uTt4xuo2oeLoIz39PQ6RsdUNqpc93BsUKzJuW7JT6ESPxaNMoJCSwccLV9S2i5 phMD6UEnXJMQJTB5xnlu60oT03ah3suBAh8gcxT/J4FoNYqKoAK3Vlc71eoJsyMhYc7t rmnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=rsVcXnnq; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-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 f88-v6si5842995pfh.33.2018.09.28.11.30.07; Fri, 28 Sep 2018 11:30:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-leds-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=rsVcXnnq; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-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 S1726405AbeI2AzH (ORCPT + 1 other); Fri, 28 Sep 2018 20:55:07 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:43118 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726118AbeI2AzH (ORCPT ); Fri, 28 Sep 2018 20:55:07 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id w8SITxdr085394; Fri, 28 Sep 2018 13:29:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1538159399; bh=3GAuzUXbOd8jWOv+t3OUo6wLb5KapUn+jO53TkxpDGM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=rsVcXnnq+A0KKb1qwg0PbLffQO3/wgUY/1pMEGCPORUyDK+/IRWjNyCWIjQl4IZuH UpaKBY0EBxkxgn9eF76Jam22Sp/hCLfwqgIq1T89fqzryxOwZW0RJsOE+Fn+O8hksr jWszUVsJUz3Sj1pqy9g6BA+Ky4viGxOuIPr9s74k= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w8SITxJT017013; Fri, 28 Sep 2018 13:29:59 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 28 Sep 2018 13:29:58 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Fri, 28 Sep 2018 13:29:58 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w8SITwi9014925; Fri, 28 Sep 2018 13:29:58 -0500 Received: from localhost (a0272616local-lt.dhcp.ti.com [172.22.149.181]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id w8SITwx27698; Fri, 28 Sep 2018 13:29:58 -0500 (CDT) From: Dan Murphy To: , , CC: , , , , , Milo Kim , Sebastian Reichel Subject: [RFC PATCH v2 1/9] leds: add TI LMU backlight driver Date: Fri, 28 Sep 2018 13:29:46 -0500 Message-ID: <20180928182954.25446-2-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20180928182954.25446-1-dmurphy@ti.com> References: <20180928182954.25446-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org From: Pavel Machek This adds backlight support for the following TI LMU chips: LM3532, LM3631, LM3632, LM3633, LM3695 and LM3697. It controls LEDs on Droid 4 smartphone, including keyboard and screen backlights. Signed-off-by: Milo Kim [add LED subsystem support for keyboard backlight and rework DT binding according to Rob Herrings feedback] Signed-off-by: Sebastian Reichel [remove backlight subsystem support for now] Signed-off-by: Pavel Machek --- drivers/leds/Kconfig | 8 ++ drivers/leds/Makefile | 1 + drivers/leds/ti-lmu-led-common.c | 138 +++++++++++++++++++++++++++++++ drivers/leds/ti-lmu-led-common.h | 54 ++++++++++++ 4 files changed, 201 insertions(+) create mode 100644 drivers/leds/ti-lmu-led-common.c create mode 100644 drivers/leds/ti-lmu-led-common.h -- 2.19.0 diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 44097a3e0fcc..dc717b30d9d3 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -756,6 +756,14 @@ config LEDS_NIC78BX To compile this driver as a module, choose M here: the module will be called leds-nic78bx. +config LEDS_TI_LMU_COMMON + tristate "LED driver for TI LMU" + depends on REGMAP + 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. + comment "LED Triggers" source "drivers/leds/trigger/Kconfig" diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 420b5d2cfa62..e09bb27bc7ea 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -78,6 +78,7 @@ obj-$(CONFIG_LEDS_MT6323) += leds-mt6323.o obj-$(CONFIG_LEDS_LM3692X) += leds-lm3692x.o obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o obj-$(CONFIG_LEDS_LM3601X) += leds-lm3601x.o +obj-$(CONFIG_LEDS_TI_LMU_COMMON) += ti-lmu-led-common.o # LED SPI Drivers obj-$(CONFIG_LEDS_CR0014114) += leds-cr0014114.o diff --git a/drivers/leds/ti-lmu-led-common.c b/drivers/leds/ti-lmu-led-common.c new file mode 100644 index 000000000000..2d4f22f480d1 --- /dev/null +++ b/drivers/leds/ti-lmu-led-common.c @@ -0,0 +1,138 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2015 Texas Instruments + * Copyright 2018 Sebastian Reichel + * Copyright 2018 Pavel Machek + * + * TI LMU Led driver, based on previous work from + * Milo Kim + */ + +#include +#include +#include +#include +#include + +#include "ti-lmu-led-common.h" + +const static int ramp_table[16] = { 2, 262, 524, 1049, 2090, 4194, 8389, + 16780, 33550, 41940, 50330, 58720, + 67110, 83880, 100660, 117440}; + +static int ti_lmu_common_update_brightness_register(struct ti_lmu_bank *lmu_bank, + int brightness) +{ + struct regmap *regmap = lmu_bank->regmap; + u8 reg, val; + int ret; + + /* + * Brightness register update + * + * 11 bit dimming: update LSB bits and write MSB byte. + * MSB brightness should be shifted. + * 8 bit dimming: write MSB byte. + */ + if (lmu_bank->max_brightness == MAX_BRIGHTNESS_11BIT) { + reg = lmu_bank->lsb_brightness_reg; + ret = regmap_update_bits(regmap, reg, + LMU_11BIT_LSB_MASK, + brightness); + if (ret) + return ret; + + val = brightness >> LMU_11BIT_MSB_SHIFT; + } else { + val = brightness; + } + + reg = lmu_bank->msb_brightness_reg; + + return regmap_write(regmap, reg, val); +} + +int ti_lmu_common_set_brightness(struct ti_lmu_bank *lmu_bank, + int brightness) +{ + lmu_bank->current_brightness = brightness; + + return ti_lmu_common_update_brightness_register(lmu_bank, brightness); +} +EXPORT_SYMBOL(ti_lmu_common_set_brightness); + +static int ti_lmu_common_convert_ramp_to_index(unsigned int msec) +{ + int size = ARRAY_SIZE(ramp_table); + int i; + + if (msec <= ramp_table[0]) + return 0; + + if (msec > ramp_table[size - 1]) + return size - 1; + + for (i = 1; i < size; i++) { + if (msec == ramp_table[i]) + return i; + + /* Find an approximate index by looking up the table */ + if (msec > ramp_table[i - 1] && msec < ramp_table[i]) { + if (msec - ramp_table[i - 1] < ramp_table[i] - msec) + return i - 1; + else + return i; + } + } + + return -EINVAL; +} + +int ti_lmu_common_set_ramp(struct ti_lmu_bank *lmu_bank) +{ + struct regmap *regmap = lmu_bank->regmap; + u8 ramp, ramp_up, ramp_down; + + if (lmu_bank->ramp_up_msec == 0 && lmu_bank->ramp_down_msec == 0) { + ramp_up = 0; + ramp_down = 0; + } else { + ramp_up = ti_lmu_common_convert_ramp_to_index(lmu_bank->ramp_up_msec); + ramp_down = ti_lmu_common_convert_ramp_to_index(lmu_bank->ramp_down_msec); + } + + if (ramp_up < 0 || ramp_down < 0) + return -EINVAL; + + ramp = (ramp_up << 4) | ramp_down; + + return regmap_write(regmap, lmu_bank->runtime_ramp_reg, ramp); + +} +EXPORT_SYMBOL(ti_lmu_common_set_ramp); + +int ti_lmu_common_get_ramp_params(struct device *dev, + struct fwnode_handle *child, + struct ti_lmu_bank *lmu_data) +{ + int ret; + + ret = fwnode_property_read_u32(child, "ramp-up-ms", + &lmu_data->ramp_up_msec); + if (ret) + dev_warn(dev, "ramp-up-ms property missing\n"); + + + ret = fwnode_property_read_u32(child, "ramp-down-ms", + &lmu_data->ramp_down_msec); + if (ret) + dev_warn(dev, "ramp-down-ms property missing\n"); + + return 0; +} +EXPORT_SYMBOL(ti_lmu_common_get_ramp_params); + +MODULE_DESCRIPTION("TI LMU LED Driver"); +MODULE_AUTHOR("Sebastian Reichel"); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:ti-lmu-led"); diff --git a/drivers/leds/ti-lmu-led-common.h b/drivers/leds/ti-lmu-led-common.h new file mode 100644 index 000000000000..511768dd54b6 --- /dev/null +++ b/drivers/leds/ti-lmu-led-common.h @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: GPL-2.0 +// TI LMU Common Core +// Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define LMU_DUAL_CHANNEL_USED (BIT(0) | BIT(1)) +#define LMU_11BIT_LSB_MASK (BIT(0) | BIT(1) | BIT(2)) +#define LMU_11BIT_MSB_SHIFT 3 + +#define MAX_BRIGHTNESS_8BIT 255 +#define MAX_BRIGHTNESS_11BIT 2047 + +#define NUM_DUAL_CHANNEL 2 + +struct ti_lmu_bank { + struct regmap *regmap; + + int bank_id; + int fault_monitor_used; + + u8 enable_reg; + unsigned long enable_usec; + + int current_brightness; + u32 default_brightness; + int max_brightness; + + u8 lsb_brightness_reg; + u8 msb_brightness_reg; + + u8 runtime_ramp_reg; + u32 ramp_up_msec; + u32 ramp_down_msec; +}; + + +int ti_lmu_common_set_brightness(struct ti_lmu_bank *lmu_bank, + int brightness); + +int ti_lmu_common_set_ramp(struct ti_lmu_bank *lmu_bank); + +int ti_lmu_common_get_ramp_params(struct device *dev, + struct fwnode_handle *child, + struct ti_lmu_bank *lmu_data); From patchwork Fri Sep 28 18:29:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 147800 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1082484lji; Fri, 28 Sep 2018 11:30:07 -0700 (PDT) X-Google-Smtp-Source: ACcGV617SS1nfLQuXOA7/u5iyn8FV95CcAe1Mt4HgfIBd4hEqVd9xEYJd8tJXQeR9id1xXIEvIT+ X-Received: by 2002:a62:225d:: with SMTP id i90-v6mr17886228pfi.246.1538159407781; Fri, 28 Sep 2018 11:30:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538159407; cv=none; d=google.com; s=arc-20160816; b=LM17XsMf96pwd94bn/kjOZFX09VR99aUvvL2ZC5FJizQekdt5ffAOwFiJp9WFRb/kv 0e9L1fwXzKxquXIDEi/Od67O0TNLhpL17eUoCTPmzeKlDOFmpVrGTJiBL59JorcGj+Tp e7Gx1cC6O4n7pXkDgMPcWZWV2jJjuIXd/EJZ3HBPjgCu6KnV+GiD22CBla7xb7GvuGXm /F/2aK4hMTZ+mJxrwTn34HdWxlI7GCYBjLdSLrfMp6DPU1i467pl1+JmtUkah3jyrE6f bj1MGVWKJPRo+hNf9Mk8Py47r3+EjbTcxC0mDYYvGVkX4nP+qhNbO/FqGwI9R2Z6S127 VdFg== 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=pSmD2M/O+yZuviPXrMoZZB16/Jfgp2hSP7dtvrq1WXQ=; b=DUpfIWJyOgwI+xc7m0AAyR8mO/drZKsSaEy0Es+iNzlp6ZSqDqx9P3wlQBwzOI7rdZ ED7ASBmvjfV+7E23sioEIDdAv45Eddsv8SOpG0zAwwxObwGpwPsyKdGqoOfYX+rIkkdc hOD/F37VmMS99QI6NfYwliiH6BWwPfAx+akSiVNRbzBRS7yyf91hdKwuJDN83j+2Lf61 gXHBaylJvhUN3ndfednbD8TAkT9CJx1B+mLbM1gagRyuwV56XiOVYl4CGErcdADjoztW c0Qal5yY5nC672n6Kf9HzwyYl3I94WRbkYtHU2/icmumbsNo8QnQuOfGwweR5tvPMn/+ T1tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=SFUuihIZ; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-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 f88-v6si5842995pfh.33.2018.09.28.11.30.07; Fri, 28 Sep 2018 11:30:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-leds-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=SFUuihIZ; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-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 S1726505AbeI2AzH (ORCPT + 1 other); Fri, 28 Sep 2018 20:55:07 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:39308 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726405AbeI2AzH (ORCPT ); Fri, 28 Sep 2018 20:55:07 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id w8SIU2f1105751; Fri, 28 Sep 2018 13:30:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1538159402; bh=pSmD2M/O+yZuviPXrMoZZB16/Jfgp2hSP7dtvrq1WXQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=SFUuihIZy3+TXii2DRD7hJbyo5zIjezgZW4d3E78azALhF58ubeLz90JUPqA61kqr SY5RIDndnl/u01mpxLjTjgEMlTqVT+eJYRRvSTWAXmUZcF/zyuScd3AUnB2zM4DLNU F+/PL7Fw7THOADK8+iMxQYcwS+PMmSEqh+KWR3g4= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w8SIU10J017185; Fri, 28 Sep 2018 13:30:02 -0500 Received: from DLEE114.ent.ti.com (157.170.170.25) 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.1466.3; Fri, 28 Sep 2018 13:30:00 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Fri, 28 Sep 2018 13:30:00 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w8SIU04x015017; Fri, 28 Sep 2018 13:30:00 -0500 Received: from localhost (a0272616local-lt.dhcp.ti.com [172.22.149.181]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id w8SIU0x27710; Fri, 28 Sep 2018 13:30:00 -0500 (CDT) From: Dan Murphy To: , , CC: , , , , , Dan Murphy Subject: [RFC PATCH v2 4/9] dt-bindings: leds: Add bindings for lm3697 driver Date: Fri, 28 Sep 2018 13:29:49 -0500 Message-ID: <20180928182954.25446-5-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20180928182954.25446-1-dmurphy@ti.com> References: <20180928182954.25446-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Add the device tree bindings for the lm3697 LED driver for backlighting and display. Signed-off-by: Dan Murphy --- .../devicetree/bindings/leds/leds-lm3697.txt | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-lm3697.txt -- 2.19.0 diff --git a/Documentation/devicetree/bindings/leds/leds-lm3697.txt b/Documentation/devicetree/bindings/leds/leds-lm3697.txt new file mode 100644 index 000000000000..4bb2ed51025b --- /dev/null +++ b/Documentation/devicetree/bindings/leds/leds-lm3697.txt @@ -0,0 +1,98 @@ +* Texas Instruments - LM3697 Highly Efficient White LED Driver + +The LM3697 11-bit LED driver provides high- +performance backlight dimming for 1, 2, or 3 series +LED strings while delivering up to 90% efficiency. + +This device is suitable for display and keypad Lighting + +Required properties: + - compatible: + "ti,lm3697" + - reg : I2C slave address + - #address-cells : 1 + - #size-cells : 0 + +Optional properties: + - enable-gpios : GPIO pin to enable/disable the device + - vled-supply : LED supply + +Required child properties: + - reg : 0 - LED is Controlled by bank A + 1 - LED is Controlled by bank B + - led-sources : Indicates which HVLED string is associated to which + control bank. Each element in the array is associated + with a specific HVLED string. Element 0 is HVLED1, + element 1 is HVLED2 and element 2 HVLED3. + Additional information is contained + in Documentation/devicetree/bindings/leds/common.txt + 0 - HVLED is not active in this control bank + 1 - HVLED string is controlled by this control bank + +Optional child properties: + - runtime-ramp-up-msec: Current ramping from one brightness level to + the a higher brightness level. + Range from 2048 us - 117.44 s + - runtime-ramp-down-msec: Current ramping from one brightness level to + the a lower brightness level. + Range from 2048 us - 117.44 s + - 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. + +led-controller@36 { + compatible = "ti,lm3697"; + reg = <0x36>; + #address-cells = <1>; + #size-cells = <0>; + + enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>; + vled-supply = <&vbatt>; + + led@0 { + reg = <0>; + led-sources = <1 0 1>; + runtime-ramp-up-msec = <5000>; + runtime-ramp-down-msec = <1000>; + label = "white:first_backlight_cluster"; + linux,default-trigger = "backlight"; + }; + + led@1 { + reg = <1>; + led-sources = <0 1 0>; + runtime-ramp-up-msec = <500>; + runtime-ramp-down-msec = <1000>; + label = "white:second_backlight_cluster"; + linux,default-trigger = "backlight"; + }; +} + +All HVLED strings controlled by control bank A + +led-controller@36 { + compatible = "ti,lm3697"; + reg = <0x36>; + #address-cells = <1>; + #size-cells = <0>; + + enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>; + vled-supply = <&vbatt>; + + led@0 { + reg = <0>; + led-sources = <1 1 1>; + runtime-ramp-up-msec = <500>; + runtime-ramp-down-msec = <1000>; + label = "white:backlight_cluster"; + linux,default-trigger = "backlight"; + }; +} + +For more product information please see the link below: +http://www.ti.com/lit/ds/symlink/lm3697.pdf From patchwork Fri Sep 28 18:29:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 147802 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1082508lji; Fri, 28 Sep 2018 11:30:10 -0700 (PDT) X-Google-Smtp-Source: ACcGV61z0++13gnt2UZrHgOFb0p64wsT8GRgQkwWS3v0CcuGXLKru4D0uqaQKMxrZ4NKvv450W5A X-Received: by 2002:a62:cd45:: with SMTP id o66-v6mr3555185pfg.12.1538159409945; Fri, 28 Sep 2018 11:30:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538159409; cv=none; d=google.com; s=arc-20160816; b=Ve9BRxS4CXwFHQhAKYK4GeZ2icHik6nqiElXYseXBjJZ6uygvvQa1RAuBcaQzBY4NI A54Uw7sb0AkwmUfpedJKFv009lEcazN1y8uur5z+dNLABJL/uULPE6ihEIdy4cBGBB0u qRW98GORpIDthyNES/LEsBrhaDAzHyqaeY/KUS3jm8Ekf8Al782i/v9B6o/8X9mDnH9I StALRHzTHFZ4xIvGdwf8JVjqz5j5jRP28kfBkpeNLOZ+FR/L7k/zwFjLlu44Ug1z97Dq IcKWqOk1LIpT0or/p5WPgpvKuEvs4FAorYZAqQEJgUHghZ2D4OWd2bKiNhLeT+PnSHc9 i9Fw== 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=Di5TTVK8nMsFF6vs8+PC410nXwy/9n2E3w86bq7ehcw=; b=JHv7pd+ZLNUaMBc9ERRZpugkRJtLw0IQRoiNwTYjqNppoqKdJ3dNR9wRJcfSsTRVUT vOfxwySwA2MrWWvKi9o6XDKIeVc536Jp6m2XePivYlnsCuzcfPrdU5FKsZPup5KBeYi1 8p+4XtOYzViHW+ZStIik41q21MZpeIq/yPXaO9u/kK799cmRLMc+S5KeetV22q7OguQz Swqqwh4KDuCC8cQ8vzACEl56Xah8XnQL+VAbMrwjEpQUWRPsBs70EsZ4d568x+s29QEG PmGtdbxwX9JXebW96OcY1N7XIPmPz5dS4jpdrgh176mA2rFgO5fS2WzlBLtwKvkBtd+E w4Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=HSBPaRxO; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-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 j22-v6si1687066pll.86.2018.09.28.11.30.09; Fri, 28 Sep 2018 11:30:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-leds-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=HSBPaRxO; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-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 S1727239AbeI2AzJ (ORCPT + 1 other); Fri, 28 Sep 2018 20:55:09 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:39318 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726473AbeI2AzI (ORCPT ); Fri, 28 Sep 2018 20:55:08 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id w8SIU3Rj105772; Fri, 28 Sep 2018 13:30:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1538159403; bh=Di5TTVK8nMsFF6vs8+PC410nXwy/9n2E3w86bq7ehcw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=HSBPaRxOos/y9NdRWIXa/ak9Bc8cBqEy1I2TCLJ9eYo7yESX4kjyA+mpNW89fv+lw eGjzgLCh8ZBtwpSfaUQwK0l1pz1R7dDUEODnZa2YlF7XXUGkT3n6gAtifbCZAX0fQW /wAaIYuos2TS49Gp+RaqORcWdRBM7B3Efrrm2yfU= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w8SIU1GH002155; Fri, 28 Sep 2018 13:30:03 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 28 Sep 2018 13:30:02 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Fri, 28 Sep 2018 13:30:02 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w8SIU21T002872; Fri, 28 Sep 2018 13:30:02 -0500 Received: from localhost (a0272616local-lt.dhcp.ti.com [172.22.149.181]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id w8SIU1x27721; Fri, 28 Sep 2018 13:30:01 -0500 (CDT) From: Dan Murphy To: , , CC: , , , , , Dan Murphy Subject: [RFC PATCH v2 6/9] dt-bindings: leds: Add support for the LM3633 Date: Fri, 28 Sep 2018 13:29:51 -0500 Message-ID: <20180928182954.25446-7-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20180928182954.25446-1-dmurphy@ti.com> References: <20180928182954.25446-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Add support for the TI LM3633 LED driver. This device has 9 control banks 3 high voltage LED channels and 6 low voltage LED channels. Data sheet: http://www.ti.com/lit/ds/symlink/lm3633.pdf Signed-off-by: Dan Murphy --- .../devicetree/bindings/leds/leds-lm3633.txt | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-lm3633.txt -- 2.19.0 diff --git a/Documentation/devicetree/bindings/leds/leds-lm3633.txt b/Documentation/devicetree/bindings/leds/leds-lm3633.txt new file mode 100644 index 000000000000..d791b891ea6e --- /dev/null +++ b/Documentation/devicetree/bindings/leds/leds-lm3633.txt @@ -0,0 +1,102 @@ +* Texas Instruments - LM3633 Lighting Power Solution for Smartphone Handsets + +The LM3633 is a complete power source for +backlight, keypad, and indicator LEDs in smartphone +handsets. + +This device is suitable for display and keypad Lighting + +Required properties: + - compatible: + "ti,lm3633" + - reg : I2C slave address + - #address-cells : 1 + - #size-cells : 0 + +Optional properties: + - enable-gpios : GPIO pin to enable/disable the device + - vled-supply : LED supply + +Required child properties: + - reg : 0 - HVLED is Controlled by bank A + 1 - HVLED is Controlled by bank B + 2,3,4 - LVLED1, 2 and 3 are Controlled by bank C, D and E + 5,6,7 - LVLED4, 5 and 6 are Controlled by bank F, G and H + - led-sources : Indicates which LED string is associated to which + control bank. + 0 - LED is not active in this control bank + 1 - LED string is controlled by this control bank + +Optional child properties: + - runtime-ramp-up-msec: Current ramping from one brightness level to + the a higher brightness level. + Range from 2048 us - 117.44 s + - runtime-ramp-down-msec: Current ramping from one brightness level to + the a lower brightness level. + Range from 2048 us - 117.44 s + - label : see Documentation/devicetree/bindings/leds/common.txt + - linux,default-trigger : + see Documentation/devicetree/bindings/leds/common.txt + +Example: +Control bank C output to 3 LVLEDs and Control F, G and H have independent +controls of the LVLEDs. + +led-controller@36 { + compatible = "ti,lm3633"; + reg = <0x36>; + #address-cells = <1>; + #size-cells = <0>; + + enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>; + led@0 { + reg = <0>; + led-sources = < 1 0 1 >; + label = "white:backlight"; + ramp-up-ms = <100000>; + ramp-down-ms = <1000>; + linux,default-trigger = "backlight"; + }; + + led@1 { + reg = <1>; + led-sources = < 0 1 0 >; + label = "white:light"; + ramp-up-ms = <100000>; + ramp-down-ms = <1000>; + }; + + led@2 { + reg = <2>; + led-sources = <1>; + ramp-up-ms = <100000>; + ramp-down-ms = <1000>; + label = "white:indicator1"; + }; + + led@5 { + reg = <5>; + led-sources = <1>; + ramp-up-ms = <100000>; + ramp-down-ms = <1000>; + label = "red:light"; + }; + + led@6 { + reg = <6>; + led-sources = <1>; + ramp-up-ms = <41940>; + ramp-down-ms = <1000>; + label = "green:light"; + }; + + led@7 { + reg = <7>; + led-sources = <1>; + ramp-up-ms = <100000>; + ramp-down-ms = <1000>; + label = "blue:light"; + }; +}; +For more product information please see the link below: +http://www.ti.com/lit/ds/symlink/lm3633.pdf