From patchwork Thu May 8 21:16:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 29862 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0A8EC20534 for ; Thu, 8 May 2014 21:17:26 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id y10sf12013419pdj.7 for ; Thu, 08 May 2014 14:17: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:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=uKFxjgaAgStQUSipKL+SwwyOXuObzUf4rOgMXP1ktFE=; b=kXDu86oxzAUpq+YFPeMBLyFBYCArNJBjJtyGGrUN49wGwYGrpm0d5ponPJZC06b1fW J7nzCc9kbsW1zQI5vQtek0axWaIw9GFThlI04WcdvpLhxMVD8ycK661biOb7RTc/gBVr RArnobuO+UDN17RmCFFp/3HJhL/k/oC26oNSdhDu/Ij6AbdKGUE9UIHfZgbj8X/q3o9r AsHfa33uX6JHFy+XCE3AVs37yPOY7OX8dwBT13g74UXUO8LSKBP3ERk5lTmjLQjTqcI2 6DyX4djD9EKLytw3OPS/1mIHGR0Ici4DKIijMk4ykrw26BC8E7kiiAwU8/Acze+KCq/c g+cw== X-Gm-Message-State: ALoCoQlHpLuz/Nxepftc8rPT6bdYdL+kkQ0h402OVMgdcsQARQyRvEZVY5Syn6nUvzfR86iS0W3D X-Received: by 10.66.65.202 with SMTP id z10mr457756pas.45.1399583846173; Thu, 08 May 2014 14:17:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.91.201 with SMTP id z67ls35407qgd.59.gmail; Thu, 08 May 2014 14:17:26 -0700 (PDT) X-Received: by 10.52.95.171 with SMTP id dl11mr3915607vdb.36.1399583846034; Thu, 08 May 2014 14:17:26 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id sw4si371667vdc.210.2014.05.08.14.17.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 08 May 2014 14:17:26 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id lg15so4059055vcb.21 for ; Thu, 08 May 2014 14:17:26 -0700 (PDT) X-Received: by 10.220.167.2 with SMTP id o2mr4724650vcy.8.1399583845947; Thu, 08 May 2014 14:17:25 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp25887vcb; Thu, 8 May 2014 14:17:25 -0700 (PDT) X-Received: by 10.66.230.193 with SMTP id ta1mr12014208pac.29.1399583845127; Thu, 08 May 2014 14:17:25 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fm5si1093040pbc.34.2014.05.08.14.17.24; Thu, 08 May 2014 14:17:24 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755801AbaEHVRD (ORCPT + 27 others); Thu, 8 May 2014 17:17:03 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:43332 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755714AbaEHVQ7 (ORCPT ); Thu, 8 May 2014 17:16:59 -0400 Received: by mail-wg0-f44.google.com with SMTP id a1so3041987wgh.3 for ; Thu, 08 May 2014 14:16:58 -0700 (PDT) X-Received: by 10.180.126.33 with SMTP id mv1mr147472wib.6.1399583818147; Thu, 08 May 2014 14:16:58 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id gd5sm2726629wjb.40.2014.05.08.14.16.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 May 2014 14:16:56 -0700 (PDT) From: Linus Walleij To: Samuel Ortiz , Lee Jones , linux-kernel@vger.kernel.org Cc: Linus Walleij Subject: [RESEND PATCH 2/6] mfd: stmpe: add optional regulators Date: Thu, 8 May 2014 23:16:35 +0200 Message-Id: <1399583799-23517-2-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1399583799-23517-1-git-send-email-linus.walleij@linaro.org> References: <1399583799-23517-1-git-send-email-linus.walleij@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The STMPE has VCC and VIO supply lines, and sometimes (as on Ux500) this comes from a software-controlled regulator. Make it possible to supply the STMPE with power from these regulators. Signed-off-by: Linus Walleij --- drivers/mfd/stmpe.c | 18 ++++++++++++++++++ include/linux/mfd/stmpe.h | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index 6155230ae29c..692452442ead 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "stmpe.h" static int __stmpe_enable(struct stmpe *stmpe, unsigned int blocks) @@ -1172,6 +1173,18 @@ int stmpe_probe(struct stmpe_client_info *ci, int partnum) stmpe->variant = stmpe_variant_info[partnum]; stmpe->regs = stmpe->variant->regs; stmpe->num_gpios = stmpe->variant->num_gpios; + stmpe->vcc = devm_regulator_get_optional(ci->dev, "vcc"); + if (!IS_ERR(stmpe->vcc)) { + ret = regulator_enable(stmpe->vcc); + if (ret) + dev_warn(ci->dev, "failed to enable VCC supply\n"); + } + stmpe->vio = devm_regulator_get_optional(ci->dev, "vio"); + if (!IS_ERR(stmpe->vio)) { + ret = regulator_enable(stmpe->vio); + if (ret) + dev_warn(ci->dev, "failed to enable VIO supply\n"); + } dev_set_drvdata(stmpe->dev, stmpe); if (ci->init) @@ -1238,6 +1251,11 @@ int stmpe_probe(struct stmpe_client_info *ci, int partnum) int stmpe_remove(struct stmpe *stmpe) { + if (!IS_ERR(stmpe->vio)) + regulator_disable(stmpe->vio); + if (!IS_ERR(stmpe->vcc)) + regulator_disable(stmpe->vcc); + mfd_remove_devices(stmpe->dev); return 0; diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h index 3f8798e4a87d..575a86c7fcbd 100644 --- a/include/linux/mfd/stmpe.h +++ b/include/linux/mfd/stmpe.h @@ -11,6 +11,7 @@ #include struct device; +struct regulator; enum stmpe_block { STMPE_BLOCK_GPIO = 1 << 0, @@ -62,6 +63,8 @@ struct stmpe_client_info; /** * struct stmpe - STMPE MFD structure + * @vcc: optional VCC regulator + * @vio: optional VIO regulator * @lock: lock protecting I/O operations * @irq_lock: IRQ bus lock * @dev: device, mostly for dev_dbg() @@ -79,6 +82,8 @@ struct stmpe_client_info; * @pdata: platform data */ struct stmpe { + struct regulator *vcc; + struct regulator *vio; struct mutex lock; struct mutex irq_lock; struct device *dev;