From patchwork Wed Dec 3 01:39:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 5425971 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6B4A39F319 for ; Wed, 3 Dec 2014 01:39:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 85B802034B for ; Wed, 3 Dec 2014 01:39:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5246D20353 for ; Wed, 3 Dec 2014 01:39:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751022AbaLCBj1 (ORCPT ); Tue, 2 Dec 2014 20:39:27 -0500 Received: from mail-ie0-f176.google.com ([209.85.223.176]:54428 "EHLO mail-ie0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751111AbaLCBj0 (ORCPT ); Tue, 2 Dec 2014 20:39:26 -0500 Received: by mail-ie0-f176.google.com with SMTP id tr6so12382495ieb.7 for ; Tue, 02 Dec 2014 17:39:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=O7VSpzo0czdEWtnTLrlg2etQwbCESRPEUxeT/FYc+5o=; b=HNJnV9eW0ml7DYao3R4kq7fx9BitzWAYx8G0dmglnN4o+BZV+A1BkXClvkQMEZeTsE s66+gSiyCoYxOxyy7ydx7aGrB2XotiHSgJoQ7yJmHfyUGS8WSyzfI/FfPNAGc7YipM4A 99+ORtoD49ieCjJmRvyVUpY/4nOryHZThw6Mo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=O7VSpzo0czdEWtnTLrlg2etQwbCESRPEUxeT/FYc+5o=; b=GDDj9mDrCJJErkZEBCm35WlDovQGlT/IXRU/pHU7GCiE2185YWWffe0TvpSFOXHUOE oqf0W8rhAWcEMvio9PC889Zp5d/ccV5DBH8h0+VQ7hKXMEQ9Be0UgnsMoeJI12k8EYRH iOvestr4fSbLKn0uHiHTxzU1GUkGaJiaIWKgBnJ7n3xy60cIeMY00dSCSU4LISfEecSf GaPLxCG/11KMRPA+LuGki/Kim+hQL/uLU2jMYteszPFhi/0tu8a6RWxDHt7UTXAjnAVV kdPzfeEcBT2IbwjiGA67jd5IbEOgfK8iFBPE4Z5+k46RytED1GX8E+5XKCnjPO9ovh8o dMPQ== X-Gm-Message-State: ALoCoQk1AM5vtiggNau99Ly5Y+OuRJJTD8XvX8cHtQ8Sx3i1KmW4krTKOTXvARK2hz0SZIxtJ8Vt X-Received: by 10.107.14.208 with SMTP id 199mr2468834ioo.28.1417570765828; Tue, 02 Dec 2014 17:39:25 -0800 (PST) Received: from davidriley-lab.mtv.corp.google.com ([172.22.64.15]) by mx.google.com with ESMTPSA id jg3sm9232854igb.12.2014.12.02.17.39.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Dec 2014 17:39:25 -0800 (PST) From: Sean Paul To: milo.kim@ti.com, cooloney@gmail.com, linux-fbdev@vger.kernel.org, devicetree@vger.kernel.org Cc: jg1.han@samsung.com, lee.jones@linaro.org, Sean Paul , =?UTF-8?q?St=C3=A9phane=20Marchesin?= , Aaron Durbin Subject: [PATCH v2 2/2] backlight/lp855x: Add supply regulator to lp855x Date: Tue, 2 Dec 2014 17:39:12 -0800 Message-Id: <1417570752-23633-2-git-send-email-seanpaul@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1417570752-23633-1-git-send-email-seanpaul@chromium.org> References: <1417570752-23633-1-git-send-email-seanpaul@chromium.org> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds a supply regulator to the lp855x platform data to facilitate powering on/off the 3V rail attached to the controller. Cc: Stéphane Marchesin Cc: Aaron Durbin Acked-by: Milo Kim Signed-off-by: Sean Paul Acked-by: Milo Kim Acked-by: Jingoo Han Acked-by: Bryan Wu --- Changes in v2: - Add NULL check in lp855x_remove .../devicetree/bindings/video/backlight/lp855x.txt | 2 ++ drivers/video/backlight/lp855x_bl.c | 18 ++++++++++++++++++ include/linux/platform_data/lp855x.h | 2 ++ 3 files changed, 22 insertions(+) diff --git a/Documentation/devicetree/bindings/video/backlight/lp855x.txt b/Documentation/devicetree/bindings/video/backlight/lp855x.txt index 96e83a5..0a3ecbc 100644 --- a/Documentation/devicetree/bindings/video/backlight/lp855x.txt +++ b/Documentation/devicetree/bindings/video/backlight/lp855x.txt @@ -12,6 +12,7 @@ Optional properties: - pwm-period: PWM period value. Set only PWM input mode used (u32) - rom-addr: Register address of ROM area to be updated (u8) - rom-val: Register value to be updated (u8) + - power-supply: Regulator which controls the 3V rail Example: @@ -56,6 +57,7 @@ Example: backlight@2c { compatible = "ti,lp8557"; reg = <0x2c>; + power-supply = <&backlight_vdd>; dev-ctrl = /bits/ 8 <0x41>; init-brt = /bits/ 8 <0x0a>; diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c index 257b3ba..a26d3bb 100644 --- a/drivers/video/backlight/lp855x_bl.c +++ b/drivers/video/backlight/lp855x_bl.c @@ -17,6 +17,7 @@ #include #include #include +#include /* LP8550/1/2/3/6 Registers */ #define LP855X_BRIGHTNESS_CTRL 0x00 @@ -383,6 +384,13 @@ static int lp855x_parse_dt(struct lp855x *lp) pdata->rom_data = &rom[0]; } + pdata->supply = devm_regulator_get(dev, "power"); + if (IS_ERR(pdata->supply)) { + if (PTR_ERR(pdata->supply) == -EPROBE_DEFER) + return -EPROBE_DEFER; + pdata->supply = NULL; + } + lp->pdata = pdata; return 0; @@ -423,6 +431,14 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id) else lp->mode = REGISTER_BASED; + if (lp->pdata->supply) { + ret = regulator_enable(lp->pdata->supply); + if (ret < 0) { + dev_err(&cl->dev, "failed to enable supply: %d\n", ret); + return ret; + } + } + i2c_set_clientdata(cl, lp); ret = lp855x_configure(lp); @@ -454,6 +470,8 @@ static int lp855x_remove(struct i2c_client *cl) lp->bl->props.brightness = 0; backlight_update_status(lp->bl); + if (lp->pdata->supply) + regulator_disable(lp->pdata->supply); sysfs_remove_group(&lp->dev->kobj, &lp855x_attr_group); return 0; diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h index 1b2ba24..9c7fd1e 100644 --- a/include/linux/platform_data/lp855x.h +++ b/include/linux/platform_data/lp855x.h @@ -136,6 +136,7 @@ struct lp855x_rom_data { Only valid when mode is PWM_BASED. * @size_program : total size of lp855x_rom_data * @rom_data : list of new eeprom/eprom registers + * @supply : regulator that supplies 3V input */ struct lp855x_platform_data { const char *name; @@ -144,6 +145,7 @@ struct lp855x_platform_data { unsigned int period_ns; int size_program; struct lp855x_rom_data *rom_data; + struct regulator *supply; }; #endif