From patchwork Sun Sep 15 10:50:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 20316 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3AED4202C9 for ; Sun, 15 Sep 2013 10:50:26 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id cm18sf873656qab.0 for ; Sun, 15 Sep 2013 03:50:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=cvcHprmOBIi/MyXplu1maPvdnvDwKFSUe0J//IhDZh0=; b=mzFoAk9tYzSPrrz0GK8nVHweN6TCQ2SrKGu4UvK5OAeioAkwdz9DT1fByRLj1DhW48 UFout7il/QE1VXO3XYuqzLEQcK44l2Yq38A2VHyKjH4GeOEe+lO/6wA2MAVh8ow+Sg4S 296ZQdQvv/QGkj0Tt4tQy7BwnbyUDturiv480kmbCf8lE0TDhCGFm5KV8QiHySNn37bh +YPLhn0NMKp6Vhw9pfNAFK0sIlrGlD5Zwc/wCoZTE89BPEXt+oEFX2Ho1so+VoVGxQWX im11ntVNta7GhWBOTCaHm5XKuzaN74JAPVCz8CVPlSGhsN7177Cma7VvjfWs71B7wNSO NxEA== X-Gm-Message-State: ALoCoQnD6vYnXTFev6vClMvlteyDetym/JWXXSSXwe99q+Wxsthk7+hRuBlJpVwFMVD8sS/k46op X-Received: by 10.236.124.33 with SMTP id w21mr8505004yhh.15.1379242226343; Sun, 15 Sep 2013 03:50:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.1.65 with SMTP id 1ls1820768qek.72.gmail; Sun, 15 Sep 2013 03:50:26 -0700 (PDT) X-Received: by 10.52.114.132 with SMTP id jg4mr6554167vdb.6.1379242226228; Sun, 15 Sep 2013 03:50:26 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id is10si5697736veb.146.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 15 Sep 2013 03:50:25 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id oz11so2167448veb.17 for ; Sun, 15 Sep 2013 03:50:25 -0700 (PDT) X-Received: by 10.58.152.3 with SMTP id uu3mr21497322veb.16.1379242225620; Sun, 15 Sep 2013 03:50:25 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp45585vcz; Sun, 15 Sep 2013 03:50:24 -0700 (PDT) X-Received: by 10.112.29.147 with SMTP id k19mr20426213lbh.9.1379242224169; Sun, 15 Sep 2013 03:50:24 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com [209.85.217.178]) by mx.google.com with ESMTPS id y3si9434620lbq.68.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 15 Sep 2013 03:50:24 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.217.178 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id z5so3299239lbh.23 for ; Sun, 15 Sep 2013 03:50:23 -0700 (PDT) X-Received: by 10.112.57.49 with SMTP id f17mr978189lbq.26.1379242223266; Sun, 15 Sep 2013 03:50:23 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id w10sm10301276lbv.6.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 15 Sep 2013 03:50:22 -0700 (PDT) From: Linus Walleij To: Bryan Wu , Richard Purdie , Kim Milo Cc: linux-leds@vger.kernel.org, devicetree@vger.kernel.org, Linus Walleij Subject: [PATCH] leds: lp55xx: enable setting default trigger Date: Sun, 15 Sep 2013 12:50:17 +0200 Message-Id: <1379242217-32398-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.3.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This enables setting a default trigger on an LP55xx channel, either from platform data or device tree. This mechanism is identical to the mechanism for GPIO LEDs and references the common LEDs device tree bindings. Signed-off-by: Linus Walleij --- Documentation/devicetree/bindings/leds/leds-lp55xx.txt | 10 +++++++--- drivers/leds/leds-lp55xx-common.c | 3 +++ include/linux/platform_data/leds-lp55xx.h | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/leds/leds-lp55xx.txt b/Documentation/devicetree/bindings/leds/leds-lp55xx.txt index a61727f..d221e75 100644 --- a/Documentation/devicetree/bindings/leds/leds-lp55xx.txt +++ b/Documentation/devicetree/bindings/leds/leds-lp55xx.txt @@ -17,12 +17,15 @@ Optional properties: 2: D1~6 with VOUT, D7~9 with VDD 3: D1~9 are connected to VOUT -Alternatively, each child can have specific channel name -- chan-name: Name of each channel name +Alternatively, each child can have a specific channel name and trigger: +- chan-name (optional): name of channel +- linux,default-trigger (optional): see + Documentation/devicetree/bindings/leds/common.txt example 1) LP5521 3 LED channels, external clock used. Channel names are 'lp5521_pri:channel0', -'lp5521_pri:channel1' and 'lp5521_pri:channel2' +'lp5521_pri:channel1' and 'lp5521_pri:channel2', with a heartbeat trigger +on channel 0. lp5521@32 { compatible = "national,lp5521"; @@ -33,6 +36,7 @@ lp5521@32 { chan0 { led-cur = /bits/ 8 <0x2f>; max-cur = /bits/ 8 <0x5f>; + linux,default-trigger = "heartbeat"; }; chan1 { diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c index 351825b..075acf5 100644 --- a/drivers/leds/leds-lp55xx-common.c +++ b/drivers/leds/leds-lp55xx-common.c @@ -165,6 +165,7 @@ static int lp55xx_init_led(struct lp55xx_led *led, led->led_current = pdata->led_config[chan].led_current; led->max_current = pdata->led_config[chan].max_current; led->chan_nr = pdata->led_config[chan].chan_nr; + led->cdev.default_trigger = pdata->led_config[chan].default_trigger; if (led->chan_nr >= max_channel) { dev_err(dev, "Use channel numbers between 0 and %d\n", @@ -586,6 +587,8 @@ int lp55xx_of_populate_pdata(struct device *dev, struct device_node *np) of_property_read_string(child, "chan-name", &cfg[i].name); of_property_read_u8(child, "led-cur", &cfg[i].led_current); of_property_read_u8(child, "max-cur", &cfg[i].max_current); + cfg[i].default_trigger = + of_get_property(child, "linux,default-trigger", NULL); i++; } diff --git a/include/linux/platform_data/leds-lp55xx.h b/include/linux/platform_data/leds-lp55xx.h index 51a2ff5..c32de4d 100644 --- a/include/linux/platform_data/leds-lp55xx.h +++ b/include/linux/platform_data/leds-lp55xx.h @@ -22,6 +22,7 @@ struct lp55xx_led_config { const char *name; + const char *default_trigger; u8 chan_nr; u8 led_current; /* mA x10, 0 if led is not connected */ u8 max_current;