From patchwork Tue Nov 13 09:35:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 1733051 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id BB12E3FCAE for ; Tue, 13 Nov 2012 09:35:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754543Ab2KMJfw (ORCPT ); Tue, 13 Nov 2012 04:35:52 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:62538 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754470Ab2KMJfv (ORCPT ); Tue, 13 Nov 2012 04:35:51 -0500 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MDF005OK6N3JY50@mailout2.samsung.com>; Tue, 13 Nov 2012 18:35:50 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-e4-50a2147602a9 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 8A.A2.01231.67412A05; Tue, 13 Nov 2012 18:35:50 +0900 (KST) Received: from localhost.localdomain ([106.116.147.30]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MDF00MLK6NDNJ40@mmp1.samsung.com>; Tue, 13 Nov 2012 18:35:50 +0900 (KST) From: Marek Szyprowski To: linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org Cc: Marek Szyprowski , Kyungmin Park , Mark Brown , Liam Girdwood , Chris Ball Subject: [PATCH v2] regulator: treat regulators with constant volatage as fixed Date: Tue, 13 Nov 2012 10:35:34 +0100 Message-id: <1352799334-13898-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <20121113090007.GS18224@opensource.wolfsonmicro.com> References: <20121113090007.GS18224@opensource.wolfsonmicro.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGJMWRmVeSWpSXmKPExsVy+t9jAd0ykUUBBpMaxS0u75rDZnHkfz+j A5PH501yAYxRXDYpqTmZZalF+nYJXBmdTU1sBZPZKy7cW87YwPiHtYuRk0NCwERi97yPLBC2 mMSFe+vZuhi5OIQEFjFKfP/4kAXCaWeSmL71KhtIFZuAoUTX2y4gm4NDRMBaYu9CX5AaZoHT jBKTZm0HqxEW8JfouPqMCcRmEVCVWHxqApjNK+Ah0ff0OVivhICCxJxJNiBhTgFHiVcXe8FK hAQcJE7vm8U+gZF3ASPDKkbR1ILkguKk9FxDveLE3OLSvHS95PzcTYxg3z+T2sG4ssHiEKMA B6MSD+8Nl4UBQqyJZcWVuYcYJTiYlUR4f3AsChDiTUmsrEotyo8vKs1JLT7EKM3BoiTO2+yR EiAkkJ5YkpqdmlqQWgSTZeLglGpgbJ34LGFmUOhOY78fTR+sdv6s/aTA/L5V0p3fy+uNjbrv oYhVsf/3T2GUkHr43WDFjOM70zZzTVh3T69zgZVsnvx3zh+Lj8VO4zbXZHozJfCRyJfGZ4fr d3lPV1u8/pHzLf4Ih9op6nts8pbddFSsu1t7Zf6EAwd6rP2iIxk+XIx8dtRIem/8AyWW4oxE Qy3mouJEANaTyID5AQAA Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Some drivers has additional logic for fixed regulators. Let regulator core to treat regulators which cannot change their voltage due to applied constraints as fixed. Signed-off-by: Marek Szyprowski --- drivers/regulator/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 042c1ff..78b34b7 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1872,7 +1872,11 @@ int regulator_count_voltages(struct regulator *regulator) { struct regulator_dev *rdev = regulator->rdev; - return rdev->desc->n_voltages ? : -EINVAL; + if (rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE) + return rdev->desc->n_voltages ? rdev->desc->n_voltages : + -EINVAL; + else + return 1; } EXPORT_SYMBOL_GPL(regulator_count_voltages);