From patchwork Mon Oct 27 15:03:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 5161841 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 10C31C11AC for ; Mon, 27 Oct 2014 15:33:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2DF1320221 for ; Mon, 27 Oct 2014 15:33:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 86243201F5 for ; Mon, 27 Oct 2014 15:33:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751752AbaJ0P3k (ORCPT ); Mon, 27 Oct 2014 11:29:40 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:12633 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751386AbaJ0P3c (ORCPT ); Mon, 27 Oct 2014 11:29:32 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NE400M110HTWY90@mailout2.w1.samsung.com>; Mon, 27 Oct 2014 15:32:17 +0000 (GMT) X-AuditID: cbfec7f5-b7f956d000005ed7-8c-544e64d837b7 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 10.2F.24279.8D46E445; Mon, 27 Oct 2014 15:29:28 +0000 (GMT) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NE4003280CPPUA0@eusync4.samsung.com>; Mon, 27 Oct 2014 15:29:28 +0000 (GMT) From: Krzysztof Kozlowski To: Samuel Ortiz , Lee Jones , Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org, Ben Dooks , Kukjin Kim , Russell King , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org Cc: Kyungmin Park , Marek Szyprowski , Bartlomiej Zolnierkiewicz , Javier Martinez Canillas , Chanwoo Choi , Krzysztof Kozlowski Subject: [PATCH 1/8] regulator: max77802: Remove support for board files Date: Mon, 27 Oct 2014 16:03:39 +0100 Message-id: <1414422226-10948-2-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1414422226-10948-1-git-send-email-k.kozlowski@samsung.com> References: <1414422226-10948-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLLMWRmVeSWpSXmKPExsVy+t/xa7o3UvxCDDb+k7HYOGM9q8WkdQeY LKY+fMJmcf3Lc1aL+UfOsVoc/V1g8fqFoUXvgqtsFmeb3rBb3P96lNHi25UOJotNj6+xWlze NYfNYsb5fUwWty/zWqw9cpfd4nQ3q4OgR0tzD5vH3+fXWTz+rnrB7LFz1l12j02rOtk87lzb w+Yx72Sgx+Yl9R59W1YxenzeJBfAFcVlk5Kak1mWWqRvl8CV8WndNpaCe7IVh+59Y2lg3CrR xcjJISFgItG4bzsLhC0mceHeerYuRi4OIYGljBL7zkyCcvqYJJoWnWMCqWITMJbYvHwJWEJE oJNZoudgLzOIwyywmkni55VTzCBVwgIeEsc6L7GD2CwCqhKTp21iBLF5BdwlNny8DbVPTuLk scmsIDYnUP3r+1/BeoWAaj6/38o4gZF3ASPDKkbR1NLkguKk9FwjveLE3OLSvHS95PzcTYyQ IP+6g3HpMatDjAIcjEo8vBOKfUOEWBPLiitzDzFKcDArifCeCvALEeJNSaysSi3Kjy8qzUkt PsTIxMEp1cCYm2mi2yaubXDu1Da7n7bpwT88ePNFlrPVfZmfcJd5tntcRN+GqVW/fZjzM4sP pj13P5IlkmvUe7X8ZPnO/pIzbjwXytYY8zLLi33TXS3OtujT8ZJ9c/13HNDP4pHbJnclYMUW 45dit8LevI+VNPu19NbCdNnvyfkpZbdnGzhn8cd+aJKKO6HEUpyRaKjFXFScCACRs+6yUAIA AA== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 The driver is used only on Exynos based boards with DTS support. Convert the driver to DTS-only version. Signed-off-by: Krzysztof Kozlowski Acked-by: Javier Martinez Canillas --- drivers/regulator/max77802.c | 44 +++++++++++++++----------------------------- 1 file changed, 15 insertions(+), 29 deletions(-) diff --git a/drivers/regulator/max77802.c b/drivers/regulator/max77802.c index 5839c4509e1f..61d03e9f8acf 100644 --- a/drivers/regulator/max77802.c +++ b/drivers/regulator/max77802.c @@ -70,6 +70,9 @@ static unsigned int ramp_table_77802_4bit[] = { }; struct max77802_regulator_prv { + struct max77686_regulator_data *regulators; + int num_regulators; + unsigned int opmode[MAX77802_REG_MAX]; }; @@ -517,9 +520,8 @@ static struct regulator_desc regulators[] = { regulator_77802_desc_n_ldo(35, 2, 1), }; -#ifdef CONFIG_OF -static int max77802_pmic_dt_parse_pdata(struct platform_device *pdev, - struct max77686_platform_data *pdata) +static int max77802_pmic_dt_parse(struct platform_device *pdev, + struct max77802_regulator_prv *max77802) { struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); struct device_node *pmic_np, *regulators_np; @@ -534,15 +536,15 @@ static int max77802_pmic_dt_parse_pdata(struct platform_device *pdev, return -EINVAL; } - pdata->num_regulators = ARRAY_SIZE(regulators); + max77802->num_regulators = ARRAY_SIZE(regulators); rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) * - pdata->num_regulators, GFP_KERNEL); + max77802->num_regulators, GFP_KERNEL); if (!rdata) { of_node_put(regulators_np); return -ENOMEM; } - for (i = 0; i < pdata->num_regulators; i++) { + for (i = 0; i < max77802->num_regulators; i++) { rmatch.name = regulators[i].name; rmatch.init_data = NULL; rmatch.of_node = NULL; @@ -557,44 +559,28 @@ static int max77802_pmic_dt_parse_pdata(struct platform_device *pdev, rdata[i].id = regulators[i].id; } - pdata->regulators = rdata; + max77802->regulators = rdata; of_node_put(regulators_np); return 0; } -#else -static int max77802_pmic_dt_parse_pdata(struct platform_device *pdev, - struct max77686_platform_data *pdata) -{ - return 0; -} -#endif /* CONFIG_OF */ static int max77802_pmic_probe(struct platform_device *pdev) { struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); - struct max77686_platform_data *pdata = dev_get_platdata(iodev->dev); struct max77802_regulator_prv *max77802; int i, ret = 0, val; struct regulator_config config = { }; - /* This is allocated by the MFD driver */ - if (!pdata) { - dev_err(&pdev->dev, "no platform data found for regulator\n"); - return -ENODEV; - } - max77802 = devm_kzalloc(&pdev->dev, sizeof(struct max77802_regulator_prv), GFP_KERNEL); if (!max77802) return -ENOMEM; - if (iodev->dev->of_node) { - ret = max77802_pmic_dt_parse_pdata(pdev, pdata); - if (ret) - return ret; - } + ret = max77802_pmic_dt_parse(pdev, max77802); + if (ret) + return ret; config.dev = iodev->dev; config.regmap = iodev->regmap; @@ -603,11 +589,11 @@ static int max77802_pmic_probe(struct platform_device *pdev) for (i = 0; i < MAX77802_REG_MAX; i++) { struct regulator_dev *rdev; - int id = pdata->regulators[i].id; + int id = max77802->regulators[i].id; int shift = max77802_get_opmode_shift(id); - config.init_data = pdata->regulators[i].initdata; - config.of_node = pdata->regulators[i].of_node; + config.init_data = max77802->regulators[i].initdata; + config.of_node = max77802->regulators[i].of_node; ret = regmap_read(iodev->regmap, regulators[i].enable_reg, &val); val = val >> shift & MAX77802_OPMODE_MASK;