From patchwork Tue Apr 30 19:17:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 163151 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp3626746ill; Tue, 30 Apr 2019 12:17:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIRlEUR4aAr00+bkjZ4A28GVOlPGTh+k1M8Jdfd55bUZ7nKWn7u749b+rqWzukkjMchOfZ X-Received: by 2002:a17:902:9693:: with SMTP id n19mr63154839plp.92.1556651854635; Tue, 30 Apr 2019 12:17:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556651854; cv=none; d=google.com; s=arc-20160816; b=P/gCGxpuQbsEWgYJPOWXwTdxWolR5UirbOM94IE0tWoVKN4YKbZVhZudFjabLVTpSN kKbM4vRndkDRDJE0O6FYpjjEDLGosjOulKd9gw25Hr7Oj7YYM2llecL4PDTqFiHix5V3 nFO9H0sekhrJZRK2pEQgY04UVlO+wQuCdCOkdrleW51MRO+P2YR4xP4oMked7Nfg4Z/k QWVI0Dx0to/Sts/Snq26s8tF2oBTWoLt+NNEJ4BoTM23Bq1+IKiFtikG81ZO8eP4MnJv lBEPtpTClJbUHMnpqu0tU9FOo/ntPCU9UYK2qFRipkYFShs5Q2hFWGiyofTyLJRQEJrM Sgqg== 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=CAcuzsZlcjBc1jlbv8INWEI3nZWV72+jYZzsHbl232A=; b=Oo4ZOnC7ZH81F2Myi73CqhQoq/gOmZzhQn574JTAcrgArU2Wp92HSBKKdK85LzWpBd B6GBlI1lEtss7oHuWpR/wtBYSeV2eFVdDwJf2FzSRZJ3aVgbZdJZHWucblts0f5Ji3sE bjiCGUps9rJIPT7/e3SGr/2dUhAESlhl8q1+HgQpe4HxVDelJo+YIzJ0QSHIJd0gsTSJ t/HUfw2aPvXLl9k7kcJvqGQmQ75ZjfAETtMxVEOzwBu5anlX7v/BCUH4CeYZoCOuTF0i rElLc77pjTsu2XqRx8i/0juc9NQXkhV1XbN55ogaHUH7RvcHqSh6h3VqUhOMmimJYCOl DrqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=L9SVJOCQ; 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 p21si4741692plr.233.2019.04.30.12.17.34; Tue, 30 Apr 2019 12:17:34 -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=L9SVJOCQ; 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 S1725996AbfD3TRe (ORCPT + 1 other); Tue, 30 Apr 2019 15:17:34 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:52836 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726123AbfD3TRe (ORCPT ); Tue, 30 Apr 2019 15:17:34 -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 x3UJHSZt072407; Tue, 30 Apr 2019 14:17:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1556651848; bh=CAcuzsZlcjBc1jlbv8INWEI3nZWV72+jYZzsHbl232A=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=L9SVJOCQHLa5Obp/l5mycVeZWzFCg6+Cv2vmz1TKT64Ik4hk+onDEIbmaUJ76r+Xa 0jWJI2cdcExASiJAxmfKKCKLBjLoRj/+I5jogjzMz44a8rpVkjDh2e96b+ugSm/Ywn dXbZLuUYFIyAOyGVy/7BEcAO0w3Brv37zxmE0JMw= Received: from DFLE110.ent.ti.com (dfle110.ent.ti.com [10.64.6.31]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x3UJHSGA078475 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 30 Apr 2019 14:17:28 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 30 Apr 2019 14:17:28 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) 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; Tue, 30 Apr 2019 14:17:28 -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 x3UJHSSI007754; Tue, 30 Apr 2019 14:17:28 -0500 From: Dan Murphy To: , CC: , , Dan Murphy , Rob Herring Subject: [PATCH v3 1/7] dt-bindings: mfd: LMU: Fix lm3632 dt binding example Date: Tue, 30 Apr 2019 14:17:24 -0500 Message-ID: <20190430191730.19450-2-dmurphy@ti.com> X-Mailer: git-send-email 2.21.0.5.gaeb582a983 In-Reply-To: <20190430191730.19450-1-dmurphy@ti.com> References: <20190430191730.19450-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 Fix the lm3632 dt binding examples as the LCM enable GPIOs are defined as enable GPIOs per the regulator/lm363x-regulator.txt bindings document. Reviewed-by: Rob Herring Signed-off-by: Dan Murphy --- v3 - No changes added Reviewed-by Rob - https://lore.kernel.org/patchwork/patch/1058757/ v2 - There was no v2 I add this patch on top of this series Documentation/devicetree/bindings/mfd/ti-lmu.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.21.0.5.gaeb582a983 diff --git a/Documentation/devicetree/bindings/mfd/ti-lmu.txt b/Documentation/devicetree/bindings/mfd/ti-lmu.txt index 980394d701a7..86ca786d54fc 100644 --- a/Documentation/devicetree/bindings/mfd/ti-lmu.txt +++ b/Documentation/devicetree/bindings/mfd/ti-lmu.txt @@ -104,8 +104,8 @@ lm3632@11 { regulators { compatible = "ti,lm363x-regulator"; - ti,lcm-en1-gpio = <&pioC 0 GPIO_ACTIVE_HIGH>; /* PC0 */ - ti,lcm-en2-gpio = <&pioC 1 GPIO_ACTIVE_HIGH>; /* PC1 */ + enable-gpios = <&pioC 0 GPIO_ACTIVE_HIGH>, + <&pioC 1 GPIO_ACTIVE_HIGH>; vboost { regulator-name = "lcd_boost"; From patchwork Tue Apr 30 19:17:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 163153 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp3626872ill; Tue, 30 Apr 2019 12:17:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRJErHZGBoqkQ4lZERsNzKOXVLuxZ9A6bCflLQFdWaz2F9mLwn9IZPqM0EbaTGXId3i9Aw X-Received: by 2002:a63:6a42:: with SMTP id f63mr20947538pgc.377.1556651860121; Tue, 30 Apr 2019 12:17:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556651860; cv=none; d=google.com; s=arc-20160816; b=YO5Rl0ZtoK6bU4uwgfyMJqBu6qC4fAAQ9XRpXVvSFlhs3teniAnpVlyIkYTk39jnGy auul/KUWEQ0XAdzAMUpPg2IB9kwKsp4ATaI0/xeIsfkmPpwrTteLAUb3v97AKgZ6VVxy bvi026FGAAxWBJ60T6MkiOAmgf+snKSV2OaTnZF9TBsN0X2C9wuvln/TYIBXjJdM0QuS 5UKFj4pM8HCQYpjEzlpJ1oLMROUEeC/qoLZcdaUEbV8xIdxDpx2Y7w2Hri+7dFXkH+Ok okpAMjtkcRO43NEvvoLPBHAtYIcIObAqff+Zl9xBfy5X5qc6E7MZJK62E9JY4opQXKUx 3HTQ== 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=DBVpWzS6+eBA2YDAgUhsz0NAmJ+G2vM/BxVVyNYpCHc=; b=u+h8BnBp0dM+EMSoe/5veKfkhmEQp8aTmQvFaISHoG/hiOiYDFo4KftH8LPdQBw9+f zbq8MF/9mLhTcI5vPxnU32ABqtp3lwftJKjfFuDWz8sTLQ0CMaWGJAXtPQlujYW5J8pZ rn5cHH8jqAox5VB1OpEevmCMRb7Suc4zwHiPhPDJsp7E4m8K20SN82MlC3u48zCOIDf2 KHx4hMfX03L/3b4LcFBi+s18cS1ih71FGOj74O8CD2ddy2VSLuddGua2uGuJO2Pi7Woi wYr7QgbPN1nXISXe9M8XXWERGQcmsff2YCTWuNa6a/Hojamg0axuTJobCWZ3diY9/sZc OV5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Bn8Jqn+f; 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 i37si4945543plb.252.2019.04.30.12.17.40; Tue, 30 Apr 2019 12:17:40 -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=Bn8Jqn+f; 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 S1727121AbfD3TRj (ORCPT + 1 other); Tue, 30 Apr 2019 15:17:39 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:50940 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726926AbfD3TRj (ORCPT ); Tue, 30 Apr 2019 15:17:39 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x3UJHYG6028256; Tue, 30 Apr 2019 14:17:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1556651854; bh=DBVpWzS6+eBA2YDAgUhsz0NAmJ+G2vM/BxVVyNYpCHc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Bn8Jqn+f8SOu8/cNH3P/shqmP5F1OUJMhLnAoDynPSkM3RECt/WwMMTJ8wr9gKA6T YxtxKligwAwXA4Q8WklM2or42s6yM2Vzase/mmMIGWibjupe3Es6JYADG9ihVB4/DO QK4B7/mu089TwqZOYyAonY+doObJfRHYpD3x5lEc= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x3UJHY8w088678 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 30 Apr 2019 14:17:34 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) 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, 30 Apr 2019 14:17:34 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE104.ent.ti.com (157.170.170.34) 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, 30 Apr 2019 14:17:34 -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 x3UJHXsw007885; Tue, 30 Apr 2019 14:17:34 -0500 From: Dan Murphy To: , CC: , , Dan Murphy , Rob Herring Subject: [PATCH v3 3/7] dt-bindings: mfd: LMU: Add ti,brightness-resolution Date: Tue, 30 Apr 2019 14:17:26 -0500 Message-ID: <20190430191730.19450-4-dmurphy@ti.com> X-Mailer: git-send-email 2.21.0.5.gaeb582a983 In-Reply-To: <20190430191730.19450-1-dmurphy@ti.com> References: <20190430191730.19450-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 ti,brightness-resolution to the TI LMU binding to define whether the device uses 8-bit brightness or 11-bit brightness. Reviewed-by: Rob Herring Signed-off-by: Dan Murphy --- v3 - No changes added Reviewed-by Rob - https://lore.kernel.org/patchwork/patch/1058763/ v2 - New patch. Add brightness resolution to ti-lmu.txt. See patch comments for context. - https://lore.kernel.org/patchwork/patch/1054501/ Documentation/devicetree/bindings/mfd/ti-lmu.txt | 11 +++++++++++ 1 file changed, 11 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 adae96c79d39..5881929d5f7a 100644 --- a/Documentation/devicetree/bindings/mfd/ti-lmu.txt +++ b/Documentation/devicetree/bindings/mfd/ti-lmu.txt @@ -31,6 +31,16 @@ Optional property: - ramp-down-ms: Current ramping from one brightness level to the a lower brightness level. Range from 2048 us - 117.44 s + - ti,brightness-resolution - This determines whether to use 8 bit brightness + mode or 11 bit brightness mode. If this value is + not set the device is defaulted to the preferred + 8bit brightness mode per 7.3.4.1 of the data + sheet. This setting can either be in the parent + node or as part of the LED child nodes. This + is determined by the part itself if the strings + have a common brightness register or individual + brightness registers. + The values are 255 (8bit) or 2047 (11bit). Required node: - backlight: All LMU devices have backlight child nodes. @@ -217,6 +227,7 @@ lm3697@36 { compatible = "ti,lm3697-backlight"; lcd { + ti,brightness-resolution = <255>; led-sources = <0 1 2>; ramp-up-ms = <200>; ramp-down-ms = <200>; From patchwork Tue Apr 30 19:17:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 163157 Delivered-To: patch@linaro.org Received: by 2002:a92:7e86:0:0:0:0:0 with SMTP id q6csp3627345ill; Tue, 30 Apr 2019 12:18:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3yI7y/0HJ4dZca0lhhAJY/pqANOnuOt5kmjPAwxW0Nq3Lw8t60jJwbkU6mkk9q6UYii95 X-Received: by 2002:a63:fe0a:: with SMTP id p10mr67310616pgh.86.1556651885426; Tue, 30 Apr 2019 12:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556651885; cv=none; d=google.com; s=arc-20160816; b=VHCckPc1P6TG5pYUhcI9Vj3nRQcwXONVI4YhKGOVv3wZstMHCEzI56wKwUgR1X5N+F 3bqN4CDCNUhJSiG0s44Dj5TgGcxZ9Xr91Q0czbLq7U5fP0oM9itqaBHYixUkBjot4fQe YIiil+BNMw2pY5yPgA7ZaxA5/3txHk1NVP1i8CcIhF5o6zPuDMzYedby0CBnCGjwhXL4 jfgG2dyEzSnSwAQ74VsOHBaB+Ert5H/S6nMLXTx3qvGYrdlm/61BHtg8X6y8Jw3GfNAU du2rfyiSN8CQXYZnS9XJ1Sym27w8Pl5MghFwpIA50G3E2VWymflOTjNkCjIL2WwOEWKp gsOQ== 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=ZzyeQ3x3ANUdlAcwp7iXw9L6D76lf1mLe23WtE6rnLM=; b=BLRU+t7uJRA3/pcIShRIYM3FoxZV6zlCyuz5fC3ABnRpFls4cXXyUdN1A20HASqH+T Y8m5C/pxLS88P+ZuL2W346DAD15oE4D1vylOviJ0+U5RTJYlu6KJrcbmEAEcGuYV04oy MbwmWOx+qJtJzj6k++NQI61jTpw5T3xH4zPsg9MycONUaWudRhMUAdiDAKqzWkdNotuv hlnzjVNvn8vcH/wpGmgLW2iJ8Yu5iyPaTVz9ljYll8b5nxzciZR37OiWOBM2SxG9TxqZ 2uQaaMlN+8jhyDutVPNzfUCrmj3O5ZEgztz3PeT7BBlfNTSxdPnPPcHe6VCK18LZIBHd lTrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=gRz84F2e; 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 b21si28240211pgh.357.2019.04.30.12.18.05; Tue, 30 Apr 2019 12:18:05 -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=gRz84F2e; 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 S1726723AbfD3TSE (ORCPT + 1 other); Tue, 30 Apr 2019 15:18:04 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:52844 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726930AbfD3TRj (ORCPT ); Tue, 30 Apr 2019 15:17:39 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x3UJHaAo072417; Tue, 30 Apr 2019 14:17:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1556651856; bh=ZzyeQ3x3ANUdlAcwp7iXw9L6D76lf1mLe23WtE6rnLM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=gRz84F2ehi55smkqvJRfBYrbQ+ZbS3dE+8TxaF9Tsd2OWyZg7CJsRQwDbreFuq7XK 7n/C3y24+dJLaunga9jxz8RR99qwAoEJ5vD6vAuM8L6jXtMPamtsl87+4W9DgTlac2 69Wnf8Iku8qIbw8qB1CiqA5MHb6As9PFbwS61+hw= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x3UJHasB005542 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 30 Apr 2019 14:17:36 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 30 Apr 2019 14:17:36 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE107.ent.ti.com (10.64.6.28) 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, 30 Apr 2019 14:17:36 -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 x3UJHZJU031106; Tue, 30 Apr 2019 14:17:35 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v3 7/7] leds: lm3697: Introduce the lm3697 driver Date: Tue, 30 Apr 2019 14:17:30 -0500 Message-ID: <20190430191730.19450-8-dmurphy@ti.com> X-Mailer: git-send-email 2.21.0.5.gaeb582a983 In-Reply-To: <20190430191730.19450-1-dmurphy@ti.com> References: <20190430191730.19450-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 Introduce the lm3697 LED driver for backlighting and display. Datasheet location: http://www.ti.com/lit/ds/symlink/lm3697.pdf Signed-off-by: Dan Murphy --- v3 - Moved TI_COMMON_LMU flag above LM3697 flag for inheritance also fixed removed REGMAP dependency - v1 comments https://lore.kernel.org/patchwork/patch/1054503/ v2 comments https://lore.kernel.org/patchwork/patch/1058761/ v2 - Made changes to get max_brightness from ti_lmu common code, fixed commit message extra LF otherwise no additional changes - https://lore.kernel.org/patchwork/patch/1054503/ drivers/leds/Kconfig | 7 + drivers/leds/Makefile | 1 + drivers/leds/leds-lm3697.c | 395 +++++++++++++++++++++++++++++++++++++ 3 files changed, 403 insertions(+) create mode 100644 drivers/leds/leds-lm3697.c -- 2.21.0.5.gaeb582a983 diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 3ae24eaf4cde..c00bd738fe21 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -784,6 +784,13 @@ config LEDS_TI_LMU_COMMON This supports common features between the TI LM3532, LM3631, LM3632, LM3633, LM3695 and LM3697. +config LEDS_LM3697 + tristate "LED driver for LM3697" + depends on LEDS_TI_LMU_COMMON + help + Say Y to enable the LM3697 LED driver for TI LMU devices. + This supports the LED device LM3697. + comment "LED Triggers" source "drivers/leds/trigger/Kconfig" diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 85fd449c002d..2eb0225d8dc6 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -80,6 +80,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_LM3697) += leds-lm3697.o obj-$(CONFIG_LEDS_TI_LMU_COMMON) += ti-lmu-led-common.o # LED SPI Drivers diff --git a/drivers/leds/leds-lm3697.c b/drivers/leds/leds-lm3697.c new file mode 100644 index 000000000000..101d49d2ad3f --- /dev/null +++ b/drivers/leds/leds-lm3697.c @@ -0,0 +1,395 @@ +// SPDX-License-Identifier: GPL-2.0 +// TI LM3697 LED chip family driver +// Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ + +#include +#include +#include +#include +#include +#include + +#define LM3697_REV 0x0 +#define LM3697_RESET 0x1 +#define LM3697_OUTPUT_CONFIG 0x10 +#define LM3697_CTRL_A_RAMP 0x11 +#define LM3697_CTRL_B_RAMP 0x12 +#define LM3697_CTRL_A_B_RT_RAMP 0x13 +#define LM3697_CTRL_A_B_RAMP_CFG 0x14 +#define LM3697_CTRL_A_B_BRT_CFG 0x16 +#define LM3697_CTRL_A_FS_CURR_CFG 0x17 +#define LM3697_CTRL_B_FS_CURR_CFG 0x18 +#define LM3697_PWM_CFG 0x1c +#define LM3697_CTRL_A_BRT_LSB 0x20 +#define LM3697_CTRL_A_BRT_MSB 0x21 +#define LM3697_CTRL_B_BRT_LSB 0x22 +#define LM3697_CTRL_B_BRT_MSB 0x23 +#define LM3697_CTRL_ENABLE 0x24 + +#define LM3697_SW_RESET BIT(0) + +#define LM3697_CTRL_A_EN BIT(0) +#define LM3697_CTRL_B_EN BIT(1) +#define LM3697_CTRL_A_B_EN (LM3697_CTRL_A_EN | LM3697_CTRL_B_EN) + +#define LM3697_MAX_LED_STRINGS 3 + +#define LM3697_CONTROL_A 0 +#define LM3697_CONTROL_B 1 +#define LM3697_MAX_CONTROL_BANKS 2 + +/** + * struct lm3697_led - + * @hvled_strings: Array of LED strings associated with a control bank + * @label: LED label + * @led_dev: LED class device + * @priv: Pointer to the device struct + * @lmu_data: Register and setting values for common code + * @control_bank: Control bank the LED is associated to. 0 is control bank A + * 1 is control bank B + */ +struct lm3697_led { + u32 hvled_strings[LM3697_MAX_LED_STRINGS]; + char label[LED_MAX_NAME_SIZE]; + struct led_classdev led_dev; + struct lm3697 *priv; + struct ti_lmu_bank lmu_data; + int control_bank; + int enabled; + int num_leds; +}; + +/** + * struct lm3697 - + * @enable_gpio: Hardware enable gpio + * @regulator: LED supply regulator pointer + * @client: Pointer to the I2C client + * @regmap: Devices register map + * @dev: Pointer to the devices device struct + * @lock: Lock for reading/writing the device + * @leds: Array of LED strings + */ +struct lm3697 { + struct gpio_desc *enable_gpio; + struct regulator *regulator; + struct i2c_client *client; + struct regmap *regmap; + struct device *dev; + struct mutex lock; + + int bank_cfg; + + struct lm3697_led leds[]; +}; + +static const struct reg_default lm3697_reg_defs[] = { + {LM3697_OUTPUT_CONFIG, 0x6}, + {LM3697_CTRL_A_RAMP, 0x0}, + {LM3697_CTRL_B_RAMP, 0x0}, + {LM3697_CTRL_A_B_RT_RAMP, 0x0}, + {LM3697_CTRL_A_B_RAMP_CFG, 0x0}, + {LM3697_CTRL_A_B_BRT_CFG, 0x0}, + {LM3697_CTRL_A_FS_CURR_CFG, 0x13}, + {LM3697_CTRL_B_FS_CURR_CFG, 0x13}, + {LM3697_PWM_CFG, 0xc}, + {LM3697_CTRL_A_BRT_LSB, 0x0}, + {LM3697_CTRL_A_BRT_MSB, 0x0}, + {LM3697_CTRL_B_BRT_LSB, 0x0}, + {LM3697_CTRL_B_BRT_MSB, 0x0}, + {LM3697_CTRL_ENABLE, 0x0}, +}; + +static const struct regmap_config lm3697_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + + .max_register = LM3697_CTRL_ENABLE, + .reg_defaults = lm3697_reg_defs, + .num_reg_defaults = ARRAY_SIZE(lm3697_reg_defs), + .cache_type = REGCACHE_FLAT, +}; + +static int lm3697_brightness_set(struct led_classdev *led_cdev, + enum led_brightness brt_val) +{ + struct lm3697_led *led = container_of(led_cdev, struct lm3697_led, + led_dev); + int ctrl_en_val = (1 << led->control_bank); + int ret; + + mutex_lock(&led->priv->lock); + + if (brt_val == LED_OFF) { + ret = regmap_update_bits(led->priv->regmap, LM3697_CTRL_ENABLE, + ctrl_en_val, ~ctrl_en_val); + if (ret) { + dev_err(&led->priv->client->dev, "Cannot write ctrl register\n"); + goto brightness_out; + } + + led->enabled = LED_OFF; + } else { + ret = ti_lmu_common_set_brightness(&led->lmu_data, brt_val); + if (ret) { + dev_err(&led->priv->client->dev, + "Cannot write brightness\n"); + goto brightness_out; + } + + if (!led->enabled) { + ret = regmap_update_bits(led->priv->regmap, + LM3697_CTRL_ENABLE, + ctrl_en_val, ctrl_en_val); + if (ret) { + dev_err(&led->priv->client->dev, + "Cannot enable the device\n"); + goto brightness_out; + } + + led->enabled = brt_val; + } + } + +brightness_out: + mutex_unlock(&led->priv->lock); + return ret; +} + +static int lm3697_init(struct lm3697 *priv) +{ + struct lm3697_led *led; + int i, ret; + + if (priv->enable_gpio) { + gpiod_direction_output(priv->enable_gpio, 1); + } else { + ret = regmap_write(priv->regmap, LM3697_RESET, LM3697_SW_RESET); + if (ret) { + dev_err(&priv->client->dev, "Cannot reset the device\n"); + goto out; + } + } + + ret = regmap_write(priv->regmap, LM3697_CTRL_ENABLE, 0x0); + if (ret) { + dev_err(&priv->client->dev, "Cannot write ctrl enable\n"); + goto out; + } + + ret = regmap_write(priv->regmap, LM3697_OUTPUT_CONFIG, priv->bank_cfg); + if (ret) + dev_err(&priv->client->dev, "Cannot write OUTPUT config\n"); + + for (i = 0; i < LM3697_MAX_CONTROL_BANKS; i++) { + led = &priv->leds[i]; + ret = ti_lmu_common_set_ramp(&led->lmu_data); + if (ret) + dev_err(&priv->client->dev, "Setting the ramp rate failed\n"); + } +out: + return ret; +} + +static int lm3697_probe_dt(struct lm3697 *priv) +{ + struct fwnode_handle *child = NULL; + struct lm3697_led *led; + const char *name; + int control_bank; + size_t i = 0; + int ret = -EINVAL; + int j; + + priv->enable_gpio = devm_gpiod_get_optional(&priv->client->dev, + "enable", GPIOD_OUT_LOW); + if (IS_ERR(priv->enable_gpio)) { + ret = PTR_ERR(priv->enable_gpio); + dev_err(&priv->client->dev, "Failed to get enable gpio: %d\n", + ret); + return ret; + } + + priv->regulator = devm_regulator_get(&priv->client->dev, "vled"); + if (IS_ERR(priv->regulator)) + priv->regulator = NULL; + + device_for_each_child_node(priv->dev, child) { + ret = fwnode_property_read_u32(child, "reg", &control_bank); + if (ret) { + dev_err(&priv->client->dev, "reg property missing\n"); + fwnode_handle_put(child); + goto child_out; + } + + if (control_bank > LM3697_CONTROL_B) { + dev_err(&priv->client->dev, "reg property is invalid\n"); + ret = -EINVAL; + fwnode_handle_put(child); + goto child_out; + } + + led = &priv->leds[i]; + + ret = ti_lmu_common_get_brt_res(&priv->client->dev, + child, &led->lmu_data); + if (ret) + dev_warn(&priv->client->dev, "brightness resolution property missing\n"); + + led->control_bank = control_bank; + led->lmu_data.regmap = priv->regmap; + led->lmu_data.runtime_ramp_reg = LM3697_CTRL_A_RAMP + + control_bank; + led->lmu_data.msb_brightness_reg = LM3697_CTRL_A_BRT_MSB + + led->control_bank * 2; + led->lmu_data.lsb_brightness_reg = LM3697_CTRL_A_BRT_LSB + + led->control_bank * 2; + + led->num_leds = fwnode_property_read_u32_array(child, + "led-sources", + NULL, 0); + + if (led->num_leds > LM3697_MAX_LED_STRINGS) { + dev_err(&priv->client->dev, "To many LED strings defined\n"); + continue; + } + + ret = fwnode_property_read_u32_array(child, "led-sources", + led->hvled_strings, + led->num_leds); + if (ret) { + dev_err(&priv->client->dev, "led-sources property missing\n"); + fwnode_handle_put(child); + goto child_out; + } + + for (j = 0; j < led->num_leds; j++) + priv->bank_cfg |= + (led->control_bank << led->hvled_strings[j]); + + ret = ti_lmu_common_get_ramp_params(&priv->client->dev, + child, &led->lmu_data); + if (ret) + dev_warn(&priv->client->dev, "runtime-ramp properties missing\n"); + + fwnode_property_read_string(child, "linux,default-trigger", + &led->led_dev.default_trigger); + + ret = fwnode_property_read_string(child, "label", &name); + if (ret) + snprintf(led->label, sizeof(led->label), + "%s::", priv->client->name); + else + snprintf(led->label, sizeof(led->label), + "%s:%s", priv->client->name, name); + + led->priv = priv; + led->led_dev.name = led->label; + led->led_dev.max_brightness = led->lmu_data.max_brightness; + led->led_dev.brightness_set_blocking = lm3697_brightness_set; + + ret = devm_led_classdev_register(priv->dev, &led->led_dev); + if (ret) { + dev_err(&priv->client->dev, "led register err: %d\n", + ret); + fwnode_handle_put(child); + goto child_out; + } + + i++; + } + +child_out: + return ret; +} + +static int lm3697_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct lm3697 *led; + int count; + int ret; + + count = device_get_child_node_count(&client->dev); + if (!count) { + dev_err(&client->dev, "LEDs are not defined in device tree!"); + return -ENODEV; + } + + led = devm_kzalloc(&client->dev, struct_size(led, leds, count), + GFP_KERNEL); + if (!led) + return -ENOMEM; + + mutex_init(&led->lock); + i2c_set_clientdata(client, led); + + led->client = client; + led->dev = &client->dev; + led->regmap = devm_regmap_init_i2c(client, &lm3697_regmap_config); + if (IS_ERR(led->regmap)) { + ret = PTR_ERR(led->regmap); + dev_err(&client->dev, "Failed to allocate register map: %d\n", + ret); + return ret; + } + + ret = lm3697_probe_dt(led); + if (ret) + return ret; + + return lm3697_init(led); +} + +static int lm3697_remove(struct i2c_client *client) +{ + struct lm3697 *led = i2c_get_clientdata(client); + int ret; + + ret = regmap_update_bits(led->regmap, LM3697_CTRL_ENABLE, + LM3697_CTRL_A_B_EN, 0); + if (ret) { + dev_err(&led->client->dev, "Failed to disable the device\n"); + return ret; + } + + if (led->enable_gpio) + gpiod_direction_output(led->enable_gpio, 0); + + if (led->regulator) { + ret = regulator_disable(led->regulator); + if (ret) + dev_err(&led->client->dev, + "Failed to disable regulator\n"); + } + + mutex_destroy(&led->lock); + + return 0; +} + +static const struct i2c_device_id lm3697_id[] = { + { "lm3697", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, lm3697_id); + +static const struct of_device_id of_lm3697_leds_match[] = { + { .compatible = "ti,lm3697", }, + {}, +}; +MODULE_DEVICE_TABLE(of, of_lm3697_leds_match); + +static struct i2c_driver lm3697_driver = { + .driver = { + .name = "lm3697", + .of_match_table = of_lm3697_leds_match, + }, + .probe = lm3697_probe, + .remove = lm3697_remove, + .id_table = lm3697_id, +}; +module_i2c_driver(lm3697_driver); + +MODULE_DESCRIPTION("Texas Instruments LM3697 LED driver"); +MODULE_AUTHOR("Dan Murphy "); +MODULE_LICENSE("GPL v2");