From patchwork Wed Nov 26 19:11:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 5387441 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 421AB9F462 for ; Wed, 26 Nov 2014 19:12:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61AB52017D for ; Wed, 26 Nov 2014 19:12:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 82923201F5 for ; Wed, 26 Nov 2014 19:12:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751240AbaKZTME (ORCPT ); Wed, 26 Nov 2014 14:12:04 -0500 Received: from mail-qg0-f54.google.com ([209.85.192.54]:41406 "EHLO mail-qg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751038AbaKZTMA (ORCPT ); Wed, 26 Nov 2014 14:12:00 -0500 Received: by mail-qg0-f54.google.com with SMTP id q107so2526022qgd.13 for ; Wed, 26 Nov 2014 11:11:59 -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=5WIuIKGLvpvajHq4RCHX4cv2Mzt4vNaO29ip1zYofhM=; b=jhdsKj+KLWwZOtzLkN6BGxXrBuiMiZqhnXRUhKO30K9nLR6+BefsA642pQeVybg62h THz8UyBbw/qxqk8JZvwaub1eKTkCR2Bxp0BQA1HLojye8pTi0ajpOzIF+NloDw9hwKV3 efjx1eozyrtwqc6d0VECzgHT5YJkpyZ56E5WY= 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=5WIuIKGLvpvajHq4RCHX4cv2Mzt4vNaO29ip1zYofhM=; b=UIO0rSNLyz8HwRO2ZJukWkB5U8CvVu6NTjWYzJtfmB45Lj0Ew1oOWPHUzY9iYyxQ8e n440725nINrgd11w5RzjLoobR6CWgFf2LbqR+suCTrMKv4Bs7aXsceU5qrBNxGMXYlz2 LcPtzQSyGQfF9rgnH6g+uCdS5NRgylYbbofD08K1tj+FR3xfNkVT7o4LmsBSxJr8HQgk AUZa4mdDAIA32JxyQYfk10NB00rAEo4kwGVtL6sgxBqk7926D8Pq9IspKNCE4GPlM1Ac p+3MfemKulRTwzCSAJT3aEfwvwYVP8OGOSvDX5KbYYsYnij2Jh1IsYo2GbLEnwJYULOe pHPw== X-Gm-Message-State: ALoCoQmGqAuEdd5b2fAqat+q0eJOBeDFqLQwFQlZ3qrBiKzZui6o2Az4Sq75o+ls/oPSghcAsles X-Received: by 10.224.38.5 with SMTP id z5mr48208789qad.89.1417029119338; Wed, 26 Nov 2014 11:11:59 -0800 (PST) Received: from philcollins.nc.rr.com (cpe-173-095-180-236.nc.res.rr.com. [173.95.180.236]) by mx.google.com with ESMTPSA id z32sm4612477qgd.40.2014.11.26.11.11.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Nov 2014 11:11:58 -0800 (PST) From: Sean Paul To: linux-fbdev@vger.kernel.org, devicetree@vger.kernel.org, milo.kim@ti.com Cc: seanpaul@chromium.org, =?UTF-8?q?St=C3=A9phane=20Marchesin?= , Aaron Durbin Subject: [PATCH 2/2] backlight/lp855x: Add supply regulator to lp855x Date: Wed, 26 Nov 2014 14:11:04 -0500 Message-Id: <1417029064-12460-2-git-send-email-seanpaul@chromium.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1417029064-12460-1-git-send-email-seanpaul@chromium.org> References: <1417029064-12460-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=ham 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 Signed-off-by: Sean Paul --- .../devicetree/bindings/video/backlight/lp855x.txt | 2 ++ drivers/video/backlight/lp855x_bl.c | 17 +++++++++++++++++ include/linux/platform_data/lp855x.h | 2 ++ 3 files changed, 21 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..8021009 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,7 @@ static int lp855x_remove(struct i2c_client *cl) lp->bl->props.brightness = 0; backlight_update_status(lp->bl); + 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