From patchwork Mon Jul 2 18:12:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 140842 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp247265ljj; Mon, 2 Jul 2018 11:12:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdmNvncAdske77+cewisPvhQGtkmYmjY71s5Hap6RzvI669XOUeY4u+jJ4nZUesZ9JSwGdH X-Received: by 2002:a62:5601:: with SMTP id k1-v6mr26505668pfb.212.1530555147720; Mon, 02 Jul 2018 11:12:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530555147; cv=none; d=google.com; s=arc-20160816; b=DzDKX7J96ALNvhL6wohMAcA59ou32bKGk66wsHfmdovWB4JIyZijofvci8TbsYmaP5 NBYHhrGy1WVejVzn4NB2vWG/S6yVOceZOo+ufs4noTMxlV4ctFclICDDwRxvuNlUP763 VdlTYS0gIXDt5skYsRn0Ys3FuOMzOlE2xxzAiNtIjbrsN+Z1+INEwCejBBNazW96jJEo RUirlw5YYWyjZAdAeSxiHto9P9X9UJT3mlB69rRMcjXQPH0zlEd6EsEoBGUi7paj2mIH 44PH9s5o+Sf9inaDEVJ7U1xHurhodncPsCXxrLE8Bjn56YMVTMojR6x0h/HgQKnm24SN GRVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature:arc-authentication-results; bh=pNWj8EQXtENnvhhkHiZmBa9A5nW8s78VCFaancNPPCU=; b=kVcmrC9clwezv/EUVoYXL+6eEMZDEsHsik1gvpvE3Pjvfef27qgVqC1RDDUisouQDK P16S/ktF/EOGAXSK21rFPT4LSF7EPNkS1oYNz/79Tz66r8+BzJOlxT6ZNsdZn++4vXl4 Cye5xqlG2xJfEZqeWjQ4igYlPcm/ZBHPPafV8SYSm2EZogB69Ym3ViI9LrPD9Y1ynJQZ temn2VeU4rXMN4F1+gxbI+QY6EMhMKX0jzpaFmsm6Tpcq/j6K0KsneEbHyerez9oi3z8 Buiprg2Q5GKxAMsF2MghEVwzKETPJCyetRnlTE+P/kJeF3ebtv5bvZsSSapEvQ9bUXQF +kXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=yetXcNtq; 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 e66-v6si11296086pfk.198.2018.07.02.11.12.27; Mon, 02 Jul 2018 11:12:27 -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=yetXcNtq; 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 S1753459AbeGBSMZ (ORCPT + 31 others); Mon, 2 Jul 2018 14:12:25 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:45872 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752948AbeGBSMY (ORCPT ); Mon, 2 Jul 2018 14:12:24 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id w62ICIf8008096; Mon, 2 Jul 2018 13:12:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1530555138; bh=pNWj8EQXtENnvhhkHiZmBa9A5nW8s78VCFaancNPPCU=; h=From:To:CC:Subject:Date; b=yetXcNtqsxi58bMLhXgSuY3igToHzFLAV85PIhzSp+QD6xVy6RNC4FUugB3oj+mHs 5JcuwT5ugmA+kgJe9k2PGUmvPTFJTAJmHCjBe7Tm+h7lAb9lbp1hfPK2hjxOKlnXAo Wi1V7cR8HlWoDClTrC2ZW/d2OFBGOI6GFPJLXRm4= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w62ICI8A002967; Mon, 2 Jul 2018 13:12:18 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) 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.1466.3; Mon, 2 Jul 2018 13:12:18 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Mon, 2 Jul 2018 13:12:18 -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 w62ICIDV016772; Mon, 2 Jul 2018 13:12:18 -0500 Received: from localhost (a0272616local-lt.dhcp.ti.com [172.22.180.30]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id w62ICHx02905; Mon, 2 Jul 2018 13:12:17 -0500 (CDT) From: Dan Murphy To: , , , CC: , , , Dan Murphy Subject: [PATCH 1/4] leds: lm3692x: Update license header to SPDX Date: Mon, 2 Jul 2018 13:12:13 -0500 Message-ID: <20180702181216.19660-1-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 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 Update the license header to the current SPDX licensing format. Signed-off-by: Dan Murphy --- drivers/leds/leds-lm3692x.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) -- 2.17.0.582.gccdcbd54c diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c index 437173d1712c..1a06d8c97789 100644 --- a/drivers/leds/leds-lm3692x.c +++ b/drivers/leds/leds-lm3692x.c @@ -1,17 +1,6 @@ -/* - * TI lm3692x LED Driver - * - * Copyright (C) 2017 Texas Instruments - * - * Author: Dan Murphy - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 as published by the Free Software Foundation. - * - * Data sheet is located - * http://www.ti.com/lit/ds/snvsa29/snvsa29.pdf - */ +// SPDX-License-Identifier: GPL-2.0 +// TI LM3692x LED chip family driver +// Copyright (C) 2017-18 Texas Instruments Incorporated - http://www.ti.com/ #include #include From patchwork Mon Jul 2 18:12:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 140845 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp247696ljj; Mon, 2 Jul 2018 11:12:55 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdE/cZrO+PS3Hr7DWntAXyXUbWqRH36C7oQLsVe3cMqhIcng3R1MOcyLlTo6owepRSidJnX X-Received: by 2002:a62:9849:: with SMTP id q70-v6mr12689262pfd.178.1530555175678; Mon, 02 Jul 2018 11:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530555175; cv=none; d=google.com; s=arc-20160816; b=rvDwoTQe2aGeK5eE07U0pZkgNLMIlI4KFHw7FqS0nSASySJsZB0Df/BCEiS96J/Xjh Yv7XDzOHMYMC1QxWOlFt/h6gdP/jW3dA0ZbhwXLo+y21lyZF0IHEpPY6A0HaacNi+3Z+ Z+RgERiic2AszlHIzKIdv/bvFcWXFPP6+G5CUh6oRD3br11nUIE22I2s5fdi/sFtyYDs q8FFve5SMML0niDIGFCmocWmzpNaLpwDj2rahKoPczZX89XznhBOn7MDPqUZsyVtWnaD GD5tee0ykRoqBSxHD8e0fMbeXZQLkkaqs/lFa/3H24vD6gbRU+UQnd4cNrZ6Pp7bNdrC uFAA== 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 :arc-authentication-results; bh=8dSTKhrLAxjwZbEM0vByHtuyhwXB+A2b0Dnf/FadgIg=; b=d0SgL+JjhHm3ru6S9tbkhKJXvLGBxGus9MARHLXFCd6ZoDw/oTK6EANeTzDb5H1RjJ FAG6hOSKw/eBv24FSlgHCe8V0arQgBrFTHg5Y7eFPfpFJKsg+2WcYAf1n3EiR1U0JrYj WRloa/RWb3fjRVAXDl+5KGKFlVH5qoDa9sB1Un3tTV+FKMSpf25hhf7K2D90i7Onsy/i /ldt/hpD8E+fHcAwfJi4ngI/GKl4ii7pcAqDl+2Y2CwzGH48I5dENVgw+bsxIrLP7Mqr z8mTvOmqXRTPRqezLnffUqcxTTMjyRykcj/cxh25kktiOFTtJTVNfXtOunpq4C4Q78Au fczQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=EAlBGgGk; 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 b135-v6si12663627pga.51.2018.07.02.11.12.55; Mon, 02 Jul 2018 11:12:55 -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=EAlBGgGk; 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 S932097AbeGBSMy (ORCPT + 31 others); Mon, 2 Jul 2018 14:12:54 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:47298 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753155AbeGBSMY (ORCPT ); Mon, 2 Jul 2018 14:12:24 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id w62ICJUB021213; Mon, 2 Jul 2018 13:12:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1530555139; bh=8dSTKhrLAxjwZbEM0vByHtuyhwXB+A2b0Dnf/FadgIg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=EAlBGgGkC+KthjIrb+AlFH4EtYaezRbNkTuu04J8xqGjnKJce/RBE8TYaUzn8mpV9 maVKVCyPQTQkleTpkdainFNiFNaZJ9TeI3HVx2kzxTMw01dWomgdIgg2x0DnoA6TGN mqA+HxwctKqENVzismaqu/G9zmEoOAYvW2inaunw= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w62ICJa9025277; Mon, 2 Jul 2018 13:12:19 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) 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.1466.3; Mon, 2 Jul 2018 13:12:18 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Mon, 2 Jul 2018 13:12:18 -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 w62ICIYH017666; Mon, 2 Jul 2018 13:12:18 -0500 Received: from localhost (a0272616local-lt.dhcp.ti.com [172.22.180.30]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id w62ICIx02911; Mon, 2 Jul 2018 13:12:18 -0500 (CDT) From: Dan Murphy To: , , , CC: , , , Dan Murphy Subject: [PATCH 2/4] leds: lm3692x: Change DT calls to fwnode calls Date: Mon, 2 Jul 2018 13:12:14 -0500 Message-ID: <20180702181216.19660-2-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20180702181216.19660-1-dmurphy@ti.com> References: <20180702181216.19660-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 Update the code to use the fwnode calls as opposed to ARM DT node api's. This allows the device to be used with either DT configurations or ACPI definitions. Signed-off-by: Dan Murphy --- drivers/leds/leds-lm3692x.c | 38 ++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) -- 2.17.0.582.gccdcbd54c diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c index 1a06d8c97789..ade4abfceb46 100644 --- a/drivers/leds/leds-lm3692x.c +++ b/drivers/leds/leds-lm3692x.c @@ -267,30 +267,15 @@ static int lm3692x_init(struct lm3692x_led *led) static int lm3692x_probe(struct i2c_client *client, const struct i2c_device_id *id) { - int ret; + struct fwnode_handle *child = NULL; struct lm3692x_led *led; - struct device_node *np = client->dev.of_node; - struct device_node *child_node; const char *name; + int ret; led = devm_kzalloc(&client->dev, sizeof(*led), GFP_KERNEL); if (!led) return -ENOMEM; - for_each_available_child_of_node(np, child_node) { - led->led_dev.default_trigger = of_get_property(child_node, - "linux,default-trigger", - NULL); - - ret = of_property_read_string(child_node, "label", &name); - if (!ret) - snprintf(led->label, sizeof(led->label), - "%s:%s", id->name, name); - else - snprintf(led->label, sizeof(led->label), - "%s::backlight_cluster", id->name); - }; - led->enable_gpio = devm_gpiod_get_optional(&client->dev, "enable", GPIOD_OUT_LOW); if (IS_ERR(led->enable_gpio)) { @@ -323,6 +308,25 @@ static int lm3692x_probe(struct i2c_client *client, if (ret) return ret; + child = device_get_next_child_node(&led->client->dev, child); + if (!child) { + dev_err(&led->client->dev, "No LED Child node\n"); + return ret; + } + + 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::", led->client->name); + else + snprintf(led->label, sizeof(led->label), + "%s:%s", led->client->name, name); + + led->led_dev.dev->of_node = to_of_node(child); + ret = devm_led_classdev_register(&client->dev, &led->led_dev); if (ret) { dev_err(&client->dev, "led register err: %d\n", ret); From patchwork Mon Jul 2 18:12:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 140844 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp247687ljj; Mon, 2 Jul 2018 11:12:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJjzr1zG+6eaO7Lu8Dq5k0X6I4m37Zk4vVqe7GDOaRz0dxVRtHPdvh/PV3bAzc2XAT3TIai X-Received: by 2002:a17:902:6a89:: with SMTP id n9-v6mr26660186plk.302.1530555174979; Mon, 02 Jul 2018 11:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530555174; cv=none; d=google.com; s=arc-20160816; b=HASCSbqxzHuVWjjBAXV5vMiXJOE9Bqq3a/JWypVZiGGrtNSzEoEVpQbZ4405hDQyNk jf6Kt9x3lVlWBdhdmjwPQnz917+6bo+o6EzEZ19S9Cs3G+/QgKtx8lUHKsqi4NEx4esR PkkKFWMlaVXWHYjvt7PMEENCSYOin8+bQmZ7NadY7s8RkqMqnERykqNGfGyxg0aiQUsF aIBKWBqWxLSs5tiQkcTog8z5qQDMvFjQ6JFjN2AegMyj8O1zqKqpMPtwFC6h35eGxwLm x9KkVpo1C6QEszuYeSsGtbLSWT/cYPPLgC/ztK7zORRacd2xvdCuN6Xp+RiUjKsi1ROg susA== 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 :arc-authentication-results; bh=bKg+rYBVLwSZ1gI528KpwTNUAeRAwalAOFpCP1Lp9DE=; b=veW2xAnVh7fNw2uD3cFIKTBx5c0Q89h28Au/ev52X3Y6fqqY6KC49VOTDRquJn2bqP zua6ijjnQbaY0vr+2r8GpWJBCmhWS+0+yedP5wk0iZNNNYygCXqR24paJSDxQN7DUAf4 Wo1ZXknvEu4fdL1viRyvoe9sWpswhCoE9NLu0rpj8ZlezOIhDIFNkB8Ii+LsUGPLJrDN 8Fqc8Q1yaX9pK6ilAnyVPNAiC6sQMlYBH9jOID9NK/TSsn5wlrp/KiBM1liCBJ7E0eSU hVbDbgjSeNkvpBdO8XSyby/ooxBHWs/lpbTCEjuiq1aOuGCD2I2WzIYDsP8sAY0lkgRB IL+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=X8V0e3ud; 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 b135-v6si12663627pga.51.2018.07.02.11.12.54; Mon, 02 Jul 2018 11:12:54 -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=X8V0e3ud; 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 S1753488AbeGBSMx (ORCPT + 31 others); Mon, 2 Jul 2018 14:12:53 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:45876 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753348AbeGBSMY (ORCPT ); Mon, 2 Jul 2018 14:12:24 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id w62ICJGZ008100; Mon, 2 Jul 2018 13:12:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1530555139; bh=bKg+rYBVLwSZ1gI528KpwTNUAeRAwalAOFpCP1Lp9DE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=X8V0e3ud+af4ueYWiHO7EWevkcIQ3UOq5OIX39ctkp2MuAcDns0ePb4Fu0F7dtOlJ 4MoJruh8h2l6jlQZtposi8mGPUK1AahPwTcP3ON4J8U1o7K+6wdouKlI5AGvhPRjl2 LzM2oHovHOInKttTxbqnGKDXlXrSaHZNUhvqf1sE= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w62ICJ7X002979; Mon, 2 Jul 2018 13:12:19 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 2 Jul 2018 13:12:19 -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; Mon, 2 Jul 2018 13:12:19 -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 w62ICJOa017669; Mon, 2 Jul 2018 13:12:19 -0500 Received: from localhost (a0272616local-lt.dhcp.ti.com [172.22.180.30]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id w62ICIx02919; Mon, 2 Jul 2018 13:12:18 -0500 (CDT) From: Dan Murphy To: , , , CC: , , , Dan Murphy Subject: [PATCH 3/4] dt: bindings: lm3692x: Update binding for LED sync control Date: Mon, 2 Jul 2018 13:12:15 -0500 Message-ID: <20180702181216.19660-3-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20180702181216.19660-1-dmurphy@ti.com> References: <20180702181216.19660-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 Update the binding to be able to configure the LED sync to turn on. The LM36922 has one output but can sync current to 2 LED strings. The user may only use one sync so the other syncs need to be disabled. The LM36923 has 3 LED syncs. Signed-off-by: Dan Murphy --- Documentation/devicetree/bindings/leds/leds-lm3692x.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.17.0.582.gccdcbd54c diff --git a/Documentation/devicetree/bindings/leds/leds-lm3692x.txt b/Documentation/devicetree/bindings/leds/leds-lm3692x.txt index 6c9074f84a51..08b352840bd7 100644 --- a/Documentation/devicetree/bindings/leds/leds-lm3692x.txt +++ b/Documentation/devicetree/bindings/leds/leds-lm3692x.txt @@ -20,7 +20,10 @@ Optional properties: - vled-supply : LED supply Required child properties: - - reg : 0 + - reg : 0 - Will enable all LED sync paths + 1 - Will enable the LED1 sync + 2 - Will enable the LED2 sync + 3 - Will enable the LED3 sync (LM36923 only) Optional child properties: - label : see Documentation/devicetree/bindings/leds/common.txt From patchwork Mon Jul 2 18:12:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 140843 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp247384ljj; Mon, 2 Jul 2018 11:12:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfQn2TDtB1+3pUUD7mJuJUAGbc3Pb0Dbhyj+ZBq3pxHPF34LqyI7MbytmffXidMS32/ciXR X-Received: by 2002:a62:2119:: with SMTP id h25-v6mr13707029pfh.112.1530555155341; Mon, 02 Jul 2018 11:12:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530555155; cv=none; d=google.com; s=arc-20160816; b=zkMcEbPL/oCLnVfz2C3OzNDPFQDyfrSTUf1w6HyeS54G2yHXTWyrz4I3aZlgI0FS9M LOAgLCnRaDYGBiVADB99z2ECgQ42euwoMHQcaqCduT0qMRAnyhgHb8NRbbF9y946GZyo rEAzxtoT/5wnt4xMnI8E1HcpRpE1n8P6fr2XZYs04eI1k0d224BoZ9qTgiMDN064aRJC cQacLC1Ct3g+5XuuaKrmv8ao7cMDp4w80R7P6GI/0j/DBi1FrxkS4h2eiXsXj6M/jGsu t1LZketDZ9d64FrQH2w7W8Mmwk9LKtWHeUGHi282zqQg/rdv/8TnuONFQnh37wFsmXbK xfyg== 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 :arc-authentication-results; bh=ydUmpLoENXHhCWICtO3J2ZU/NvrZEBKE2rJZa4Mp2ws=; b=c5lrA+CZmeIt7dcT3BGG2XSxVpQvHpplUabfPEvlm0rmNuZG0bLigijzY6yPixiwNg Efx0HBqbVY48iQAgE+9taKuHzGu47NI5Nxtg0CrGa9Sa7O1U7ji4sX5hDsAihyDtHYIf b2p4U2GFa218l8mWV+P11vYGewaeQT3K9oGw8Wm7H7/e3TCeAPWFUp2qPbrPpjK5UA3N nCTXE2Yn5/+eHc/VppuxfEtndXAhm32Adu/FX0YXPPlCRb3Wob/dy51/hIsgpMNvVBlV /GlR6Qmow1+Xao8a3WSWpBrYQ6fJotZzmrNgN2iv6Uy/8Vo7hYZw1W9zSPJ/KMNmvmdc MrdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=p8r6O5It; 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 u26-v6si7636133pge.590.2018.07.02.11.12.35; Mon, 02 Jul 2018 11:12:35 -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=p8r6O5It; 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 S1753469AbeGBSMd (ORCPT + 31 others); Mon, 2 Jul 2018 14:12:33 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:47304 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752948AbeGBSMa (ORCPT ); Mon, 2 Jul 2018 14:12:30 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id w62ICKWZ021217; Mon, 2 Jul 2018 13:12:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1530555140; bh=ydUmpLoENXHhCWICtO3J2ZU/NvrZEBKE2rJZa4Mp2ws=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=p8r6O5ItN5g0aMKPeNvj7rDr6Mw2P9UdJy8ponNcbNHpU8wG2bS98x+t4WQWXNOTJ BrTsoCiXxZyGq8z2evYJObC8lyUlJeLMMpPCwfBi2N1sVzoE/gvjshn3sjhYWGj306 kCfVi+OlsK/K88dZVgqloVSvHKAt3z50aYIUCBPo= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w62ICKLQ003001; Mon, 2 Jul 2018 13:12:20 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) 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.1466.3; Mon, 2 Jul 2018 13:12:19 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Mon, 2 Jul 2018 13:12:19 -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 w62ICJam016790; Mon, 2 Jul 2018 13:12:19 -0500 Received: from localhost (a0272616local-lt.dhcp.ti.com [172.22.180.30]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id w62ICJx02932; Mon, 2 Jul 2018 13:12:19 -0500 (CDT) From: Dan Murphy To: , , , CC: , , , Dan Murphy Subject: [PATCH 4/4] leds: lm3692x: Support LED sync configuration Date: Mon, 2 Jul 2018 13:12:16 -0500 Message-ID: <20180702181216.19660-4-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20180702181216.19660-1-dmurphy@ti.com> References: <20180702181216.19660-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 The LM36922 has one output but can sync current to 2 LED strings. The user may only use one sync so the other syncs need to be disabled. The LM36923 has 3 LED syncs. Signed-off-by: Dan Murphy --- drivers/leds/leds-lm3692x.c | 158 +++++++++++++++++++++++++++--------- 1 file changed, 120 insertions(+), 38 deletions(-) -- 2.17.0.582.gccdcbd54c diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c index ade4abfceb46..06f0ad954b55 100644 --- a/drivers/leds/leds-lm3692x.c +++ b/drivers/leds/leds-lm3692x.c @@ -15,6 +15,9 @@ #include #include +#define LM36922_MODEL 0 +#define LM36923_MODEL 1 + #define LM3692X_REV 0x0 #define LM3692X_RESET 0x1 #define LM3692X_EN 0x10 @@ -33,6 +36,9 @@ #define LM3692X_DEVICE_EN BIT(0) #define LM3692X_LED1_EN BIT(1) #define LM3692X_LED2_EN BIT(2) +#define LM36923_LED3_EN BIT(3) +#define LM3692X_ENABLE_MASK (LM3692X_DEVICE_EN | LM3692X_LED1_EN | \ + LM3692X_LED2_EN | LM36923_LED3_EN) /* Brightness Control Bits */ #define LM3692X_BL_ADJ_POL BIT(0) @@ -98,6 +104,8 @@ * @enable_gpio - VDDIO/EN gpio to enable communication interface * @regulator - LED supply regulator pointer * @label - LED label + * @led_enable - LED sync to be enabled + * @model_id - Current device model ID enumerated */ struct lm3692x_led { struct mutex lock; @@ -107,6 +115,8 @@ struct lm3692x_led { struct gpio_desc *enable_gpio; struct regulator *regulator; char label[LED_MAX_NAME_SIZE]; + int led_enable; + int model_id; }; static const struct reg_default lm3692x_reg_defs[] = { @@ -189,6 +199,7 @@ static int lm3692x_brightness_set(struct led_classdev *led_cdev, static int lm3692x_init(struct lm3692x_led *led) { + int enable_state; int ret; if (led->regulator) { @@ -215,9 +226,25 @@ static int lm3692x_init(struct lm3692x_led *led) /* * For glitch free operation, the following data should - * only be written while device enable bit is 0 + * only be written while LEDx enable bits are 0 and the device enable + * bit is set to 1. * per Section 7.5.14 of the data sheet */ + ret = regmap_write(led->regmap, LM3692X_EN, LM3692X_DEVICE_EN); + if (ret) + goto out; + + /* Set the brightness to 0 so when enabled the LEDs do not come + * on with full brightness. + */ + ret = regmap_write(led->regmap, LM3692X_BRT_MSB, 0); + if (ret) + goto out; + + ret = regmap_write(led->regmap, LM3692X_BRT_LSB, 0); + if (ret) + goto out; + ret = regmap_write(led->regmap, LM3692X_PWM_CTRL, LM3692X_PWM_FILTER_100 | LM3692X_PWM_SAMP_24MHZ); if (ret) @@ -247,6 +274,38 @@ static int lm3692x_init(struct lm3692x_led *led) if (ret) goto out; + switch (led->led_enable) { + case 0: + default: + if (led->model_id == LM36923_MODEL) + enable_state = LM3692X_LED1_EN | LM3692X_LED2_EN | + LM36923_LED3_EN; + else + enable_state = LM3692X_LED1_EN | LM3692X_LED2_EN; + + break; + case 1: + enable_state = LM3692X_LED1_EN; + break; + case 2: + enable_state = LM3692X_LED2_EN; + break; + + case 3: + if (led->model_id == LM36923_MODEL) { + enable_state = LM36923_LED3_EN; + break; + } + + ret = -EINVAL; + dev_err(&led->client->dev, + "LED3 sync not available on this device\n"); + goto out; + } + + ret = regmap_update_bits(led->regmap, LM3692X_EN, LM3692X_ENABLE_MASK, + enable_state | LM3692X_DEVICE_EN); + return ret; out: dev_err(&led->client->dev, "Fail writing initialization values\n"); @@ -263,55 +322,29 @@ static int lm3692x_init(struct lm3692x_led *led) return ret; } - -static int lm3692x_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int lm3692x_probe_dt(struct lm3692x_led *led) { struct fwnode_handle *child = NULL; - struct lm3692x_led *led; const char *name; int ret; - led = devm_kzalloc(&client->dev, sizeof(*led), GFP_KERNEL); - if (!led) - return -ENOMEM; - - led->enable_gpio = devm_gpiod_get_optional(&client->dev, + led->enable_gpio = devm_gpiod_get_optional(&led->client->dev, "enable", GPIOD_OUT_LOW); if (IS_ERR(led->enable_gpio)) { ret = PTR_ERR(led->enable_gpio); - dev_err(&client->dev, "Failed to get enable gpio: %d\n", ret); + dev_err(&led->client->dev, "Failed to get enable gpio: %d\n", + ret); return ret; } - led->regulator = devm_regulator_get(&client->dev, "vled"); + led->regulator = devm_regulator_get(&led->client->dev, "vled"); if (IS_ERR(led->regulator)) led->regulator = NULL; - led->client = client; - led->led_dev.name = led->label; - led->led_dev.brightness_set_blocking = lm3692x_brightness_set; - - mutex_init(&led->lock); - - i2c_set_clientdata(client, led); - - led->regmap = devm_regmap_init_i2c(client, &lm3692x_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 = lm3692x_init(led); - if (ret) - return ret; - child = device_get_next_child_node(&led->client->dev, child); if (!child) { dev_err(&led->client->dev, "No LED Child node\n"); - return ret; + return -ENODEV; } fwnode_property_read_string(child, "linux,default-trigger", @@ -325,14 +358,57 @@ static int lm3692x_probe(struct i2c_client *client, snprintf(led->label, sizeof(led->label), "%s:%s", led->client->name, name); - led->led_dev.dev->of_node = to_of_node(child); + ret = fwnode_property_read_u32(child, "reg", &led->led_enable); + if (ret) { + dev_err(&led->client->dev, "reg DT property missing\n"); + return ret; + } + + led->led_dev.name = led->label; - ret = devm_led_classdev_register(&client->dev, &led->led_dev); + ret = devm_led_classdev_register(&led->client->dev, &led->led_dev); if (ret) { - dev_err(&client->dev, "led register err: %d\n", ret); + dev_err(&led->client->dev, "led register err: %d\n", ret); + return ret; + } + + led->led_dev.dev->of_node = to_of_node(child); + + return 0; +} + +static int lm3692x_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct lm3692x_led *led; + int ret; + + led = devm_kzalloc(&client->dev, sizeof(*led), GFP_KERNEL); + if (!led) + return -ENOMEM; + + mutex_init(&led->lock); + led->client = client; + led->led_dev.brightness_set_blocking = lm3692x_brightness_set; + led->model_id = id->driver_data; + i2c_set_clientdata(client, led); + + led->regmap = devm_regmap_init_i2c(client, &lm3692x_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 = lm3692x_probe_dt(led); + if (ret) + return ret; + + ret = lm3692x_init(led); + if (ret) + return ret; + return 0; } @@ -341,6 +417,12 @@ static int lm3692x_remove(struct i2c_client *client) struct lm3692x_led *led = i2c_get_clientdata(client); int ret; + ret = regmap_update_bits(led->regmap, LM3692X_EN, LM3692X_DEVICE_EN, 0); + if (ret) { + dev_err(&led->client->dev, "Failed to disable regulator\n"); + return ret; + } + if (led->enable_gpio) gpiod_direction_output(led->enable_gpio, 0); @@ -357,8 +439,8 @@ static int lm3692x_remove(struct i2c_client *client) } static const struct i2c_device_id lm3692x_id[] = { - { "lm36922", 0 }, - { "lm36923", 1 }, + { "lm36922", LM36922_MODEL }, + { "lm36923", LM36923_MODEL }, { } }; MODULE_DEVICE_TABLE(i2c, lm3692x_id);