From patchwork Mon Oct 27 15:03:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 5161781 Return-Path: X-Original-To: patchwork-linux-arm@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 4CBE49F318 for ; Mon, 27 Oct 2014 15:33:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 62650201F5 for ; Mon, 27 Oct 2014 15:33:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E55082017D for ; Mon, 27 Oct 2014 15:33:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XimFv-0007Kt-G2; Mon, 27 Oct 2014 15:30:51 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XimF0-0005kJ-LA for linux-arm-kernel@lists.infradead.org; Mon, 27 Oct 2014 15:29:57 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) 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 <0NE4000ZF0HT1E80@mailout2.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 27 Oct 2014 15:32:17 +0000 (GMT) X-AuditID: cbfec7f4-b7f6c6d00000120b-f7-544e64d90055 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 73.E5.04619.9D46E445; Mon, 27 Oct 2014 15:29:29 +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:29 +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 Subject: [PATCH 2/8] regulator: max77686: Remove support for board files Date: Mon, 27 Oct 2014 16:03:40 +0100 Message-id: <1414422226-10948-3-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/xa7o3U/xCDFY/47XYOGM9q8WkdQeY LKY+fMJmcf3Lc1aL+UfOsVoc/V1g8fqFoUXvgqtsFmeb3rBb3P96lNHi25UOJotNj6+xWlze NYfNYsb5fUwWty/zWqw9cpfd4nQ3q4OgR0tzD5vH3+fXWTz+rnrB7LFz1l12j02rOtk87lzb w+Yx72Sgx+Yl9R59W1YxenzeJBfAFcVlk5Kak1mWWqRvl8CVcXfHRPaCf3IVJ9ccZW5g3C3Z xcjJISFgIrH712kWCFtM4sK99WxdjFwcQgJLGSUOP9/DCOH0MUm0H3zLBFLFJmAssXn5ErAq EYFOZomeg73MIA6zwGomiZ9XTjGDVAkLeEh0HvsN1sEioCqx9fYEdhCbV8Bd4seMz1D75CRO HpvMCmJzAtW/vv8VrFcIqObz+62MExh5FzAyrGIUTS1NLihOSs811CtOzC0uzUvXS87P3cQI CfIvOxgXH7M6xCjAwajEw7tjmm+IEGtiWXFl7iFGCQ5mJRHeUwF+IUK8KYmVValF+fFFpTmp xYcYmTg4pRoYLZbGeaaGehsZtxouyJ309+GRbbtMej4JBb+Onrv2b+a1/1sf2K1kuZfl+Gpy 261zT/PnLfbMnuCfdvras+JWbYmnUirTE03iAgSrnxuyxuxu+eYcfSv194KTUcsOuD3wTxOw tw/iTt114efFi3Giv/O7LQ/FJhvvYtij8LmtzE/7sfGrea8DlViKMxINtZiLihMBq+J6A1AC AAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141027_082954_841098_18D36BC4 X-CRM114-Status: GOOD ( 17.81 ) X-Spam-Score: -5.6 (-----) Cc: Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Chanwoo Choi , Kyungmin Park , Javier Martinez Canillas , Marek Szyprowski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 Exynos4 based boards with DTS support. Convert the driver to DTS-only version. Signed-off-by: Krzysztof Kozlowski --- drivers/regulator/max77686.c | 51 +++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c index c6bf6f79bd2a..04af7a2b0910 100644 --- a/drivers/regulator/max77686.c +++ b/drivers/regulator/max77686.c @@ -82,6 +82,9 @@ enum max77686_ramp_rate { }; struct max77686_data { + struct max77686_regulator_data *regulators; + int num_regulators; + unsigned int opmode[MAX77686_REGULATORS]; }; @@ -430,9 +433,8 @@ static struct regulator_desc regulators[] = { regulator_desc_buck(9), }; -#ifdef CONFIG_OF -static int max77686_pmic_dt_parse_pdata(struct platform_device *pdev, - struct max77686_platform_data *pdata) +static int max77686_pmic_dt_parse(struct platform_device *pdev, + struct max77686_data *max77686) { struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); struct device_node *pmic_np, *regulators_np; @@ -447,15 +449,15 @@ static int max77686_pmic_dt_parse_pdata(struct platform_device *pdev, return -EINVAL; } - pdata->num_regulators = ARRAY_SIZE(regulators); + max77686->num_regulators = ARRAY_SIZE(regulators); rdata = devm_kzalloc(&pdev->dev, sizeof(*rdata) * - pdata->num_regulators, GFP_KERNEL); + max77686->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 < max77686->num_regulators; i++) { rmatch.name = regulators[i].name; rmatch.init_data = NULL; rmatch.of_node = NULL; @@ -464,51 +466,36 @@ static int max77686_pmic_dt_parse_pdata(struct platform_device *pdev, rdata[i].of_node = rmatch.of_node; } - pdata->regulators = rdata; + max77686->regulators = rdata; of_node_put(regulators_np); return 0; } -#else -static int max77686_pmic_dt_parse_pdata(struct platform_device *pdev, - struct max77686_platform_data *pdata) -{ - return 0; -} -#endif /* CONFIG_OF */ static int max77686_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 max77686_data *max77686; int i, ret = 0; struct regulator_config config = { }; dev_dbg(&pdev->dev, "%s\n", __func__); - if (!pdata) { - dev_err(&pdev->dev, "no platform data found for regulator\n"); - return -ENODEV; - } + max77686 = devm_kzalloc(&pdev->dev, sizeof(struct max77686_data), + GFP_KERNEL); + if (!max77686) + return -ENOMEM; - if (iodev->dev->of_node) { - ret = max77686_pmic_dt_parse_pdata(pdev, pdata); - if (ret) - return ret; - } + ret = max77686_pmic_dt_parse(pdev, max77686); + if (ret) + return ret; - if (pdata->num_regulators != MAX77686_REGULATORS) { + if (max77686->num_regulators != MAX77686_REGULATORS) { dev_err(&pdev->dev, "Invalid initial data for regulator's initialiation\n"); return -EINVAL; } - max77686 = devm_kzalloc(&pdev->dev, sizeof(struct max77686_data), - GFP_KERNEL); - if (!max77686) - return -ENOMEM; - config.dev = &pdev->dev; config.regmap = iodev->regmap; config.driver_data = max77686; @@ -517,8 +504,8 @@ static int max77686_pmic_probe(struct platform_device *pdev) for (i = 0; i < MAX77686_REGULATORS; i++) { struct regulator_dev *rdev; - config.init_data = pdata->regulators[i].initdata; - config.of_node = pdata->regulators[i].of_node; + config.init_data = max77686->regulators[i].initdata; + config.of_node = max77686->regulators[i].of_node; max77686->opmode[i] = regulators[i].enable_mask >> max77686_get_opmode_shift(i);