From patchwork Wed Apr 16 14:44:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 28493 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AC562206A6 for ; Wed, 16 Apr 2014 14:48:14 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id rd18sf60143824iec.8 for ; Wed, 16 Apr 2014 07:48:14 -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=k1AcS4XA9YTGpKZ7/7sKBmprD/zxWLE/xhJmNA3wCFd0fF6sQpwHp7ggKkJ4o5oP4A EYDZ0AlVkSwynRC+sB9xb8F+/eRJLMhghzYCGYlBwvvTT6twkGS//FHl7P2qpEjiQx1I HJt9hHHiRHxkt9EOcY+ypKAr59xYhp10i7ucToBx65pMujGMawS4qsRJ8QT0hSH32QnB iFggChErHWpKBjOtqZgP41Jkpszw0lll81T8qwcDzAVgomdwlJiK2rnqT3zyUFAAQJzw tlGQeusIl/jxf/gqM939HLR3rShSXLrph+VOyv0QF6I9R/ipexTXLmBd8QsDfrChOUw9 aAug== X-Gm-Message-State: ALoCoQmlBY5ZqoCLbvKn4FHOd/svRLVQ+ZJXAe1mnoi47mYfNVYCNvvJkL4WJhBkFfiKkRIPhsHI X-Received: by 10.50.79.197 with SMTP id l5mr2447429igx.0.1397659694098; Wed, 16 Apr 2014 07:48:14 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.30.163 with SMTP id d32ls629487qgd.44.gmail; Wed, 16 Apr 2014 07:48:13 -0700 (PDT) X-Received: by 10.53.1.69 with SMTP id be5mr2003767vdd.27.1397659693937; Wed, 16 Apr 2014 07:48:13 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id y7si3245321veb.144.2014.04.16.07.48.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 16 Apr 2014 07:48:13 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.169 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.169; Received: by mail-ve0-f169.google.com with SMTP id pa12so11325786veb.28 for ; Wed, 16 Apr 2014 07:48:13 -0700 (PDT) X-Received: by 10.220.69.72 with SMTP id y8mr2400177vci.21.1397659693836; Wed, 16 Apr 2014 07:48:13 -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 ib8csp318098vcb; Wed, 16 Apr 2014 07:48:13 -0700 (PDT) X-Received: by 10.68.178.66 with SMTP id cw2mr8943148pbc.89.1397659692867; Wed, 16 Apr 2014 07:48:12 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 7si4427303pbe.3.2014.04.16.07.48.12; Wed, 16 Apr 2014 07:48:12 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161671AbaDPOon (ORCPT + 26 others); Wed, 16 Apr 2014 10:44:43 -0400 Received: from mail-wg0-f50.google.com ([74.125.82.50]:62946 "EHLO mail-wg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161145AbaDPOoj (ORCPT ); Wed, 16 Apr 2014 10:44:39 -0400 Received: by mail-wg0-f50.google.com with SMTP id x13so10879199wgg.33 for ; Wed, 16 Apr 2014 07:44:38 -0700 (PDT) X-Received: by 10.194.186.140 with SMTP id fk12mr7364083wjc.47.1397659478847; Wed, 16 Apr 2014 07:44:38 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id eu7sm5398968wib.18.2014.04.16.07.44.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Apr 2014 07:44:38 -0700 (PDT) From: Linus Walleij To: Samuel Ortiz , Lee Jones , linux-kernel@vger.kernel.org Cc: Silvio F , Philipp Zabel , Sascha Hauer , Shawn Guo , Viresh Kumar , Shiraz Hashim , spear-devel@list.st.com, Linus Walleij Subject: [PATCH 2/6] mfd: stmpe: add optional regulators Date: Wed, 16 Apr 2014 16:44:11 +0200 Message-Id: <1397659455-13638-3-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1397659455-13638-1-git-send-email-linus.walleij@linaro.org> References: <1397659455-13638-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: 209.85.128.169 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 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;