From patchwork Tue Dec 2 12:33:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yadwinder Singh Brar X-Patchwork-Id: 5419611 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 10754BEEA8 for ; Tue, 2 Dec 2014 12:35:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 23AB7202AE for ; Tue, 2 Dec 2014 12:35:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CE2FB202A1 for ; Tue, 2 Dec 2014 12:35:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932343AbaLBMfy (ORCPT ); Tue, 2 Dec 2014 07:35:54 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:53474 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932079AbaLBMfx (ORCPT ); Tue, 2 Dec 2014 07:35:53 -0500 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NFY0012QGBRPOE0@mailout1.samsung.com>; Tue, 02 Dec 2014 21:35:51 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.125]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id DB.88.19034.722BD745; Tue, 02 Dec 2014 21:35:51 +0900 (KST) X-AuditID: cbfee691-f79b86d000004a5a-07-547db2278129 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 61.F8.09430.722BD745; Tue, 02 Dec 2014 21:35:51 +0900 (KST) Received: from localhost.localdomain ([107.108.83.81]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NFY007HSG8FCJE0@mmp2.samsung.com>; Tue, 02 Dec 2014 21:35:51 +0900 (KST) From: Yadwinder Singh Brar To: devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: lee.jones@linaro.org, sameo@linux.intel.com, akpm@linux-foundation.org, tomasz.figa@gmail.com, robh+dt@kernel.org, yadi.brar01@gmail.com, Yadwinder Singh Brar Subject: [PATCH] mfd: max77686: Fix parent of rtc device Date: Tue, 02 Dec 2014 18:03:40 +0530 Message-id: <1417523620-4311-1-git-send-email-yadi.brar@samsung.com> X-Mailer: git-send-email 1.7.0.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPLMWRmVeSWpSXmKPExsWyRsSkVld9U22IwbIHihZz1q9hs5h/5Byr xf2vRxktNj2+xmox4/w+JovWvUfYLU53s1qs2vWH0WLu70ZWiznT3zE5cHnsnHWX3WPTqk42 jzvX9rB5nJjxm8Vj3slAj81L6j36tqxi9Pi8SS6AI4rLJiU1J7MstUjfLoErY86yduaCSeIV C69dZmxg3CXUxcjJISFgIvHy0QRGCFtM4sK99WxdjFwcQgJLGSWmHDnKBlN06uVURojEdEaJ jS/3sUA4bUwSLV0/mLsYOTjYBIwkXh2zA2kQEciUuNS6hgmkhllgH6PExM1rmEESwgIWEqu2 7gSzWQRUJfbs+sUOYvMKuEhM+biEGWKbgkTrskPsIM0SAuvYJfa9nswK0SAg8W3yIRaQZRIC shKbDkDVS0ocXHGDZQKj4AJGhlWMoqkFyQXFSelFpnrFibnFpXnpesn5uZsYgeF++t+ziTsY 7x+wPsQowMGoxMN74nxNiBBrYllxZe4hRlOgDROZpUST84FRlVcSb2hsZmRhamJqbGRuaaYk zqsj/TNYSCA9sSQ1OzW1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/Sm+JL8m1Gr72QpsRRnJBpq MRcVJwIAQ5FT1rwCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected 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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 rtc have different i2c client than power(pmic) block. So rtc device should sit under its own i2c client in device hierarchy, which reflects in sysfs also. This patch modifies code to register rtc cell with rtc->dev as parent. Without this patch : driver max77686-pmic modalias power uevent max77686-clk max77686-rtc name subsystem After applying patch : driver/ modalias power/ uevent max77686-rtc/ name subsystem/ Signed-off-by: Yadwinder Singh Brar --- Or Can we follow another (exhaustive but more cleaner) approach, which will be more like code refactoring and cleanup rather than only fix: Since rtc uses i2c client, which gets created using i2c_new_dummy() and is not shared by any other cell of max77686. So we can covert rtc platform driver itself to i2c client driver. It will also allow to expilicitly describe max77686-rtc in DT which we can't do now. It can be applicable to some other existing and new mfd pmic drivers. Any suggestion/comments ? --- drivers/mfd/max77686.c | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c index 929795e..22c0948 100644 --- a/drivers/mfd/max77686.c +++ b/drivers/mfd/max77686.c @@ -39,10 +39,13 @@ static const struct mfd_cell max77686_devs[] = { { .name = "max77686-pmic", }, - { .name = "max77686-rtc", }, { .name = "max77686-clk", }, }; +static const struct mfd_cell max77686_rtc_dev[] = { + { .name = "max77686-rtc", }, +}; + static const struct mfd_cell max77802_devs[] = { { .name = "max77802-pmic", }, { .name = "max77802-clk", }, @@ -332,14 +335,27 @@ static int max77686_i2c_probe(struct i2c_client *i2c, goto err_del_irqc; } + if (max77686->type == TYPE_MAX77686) { + ret = mfd_add_devices(&max77686->rtc->dev, -1, max77686_rtc_dev, + 1, NULL, 0, NULL); + if (ret < 0) { + dev_err(&max77686->rtc->dev, + "failed to add RTC device %d\n", ret); + goto err_del_rtc_irqc; + } + } + ret = mfd_add_devices(max77686->dev, -1, cells, n_devs, NULL, 0, NULL); if (ret < 0) { dev_err(&i2c->dev, "failed to add MFD devices: %d\n", ret); - goto err_del_rtc_irqc; + goto err_del_rtc_dev; } return 0; +err_del_rtc_dev: + if (max77686->type == TYPE_MAX77686) + mfd_remove_devices(&max77686->rtc->dev); err_del_rtc_irqc: regmap_del_irq_chip(max77686->irq, max77686->rtc_irq_data); err_del_irqc: @@ -356,6 +372,8 @@ static int max77686_i2c_remove(struct i2c_client *i2c) struct max77686_dev *max77686 = i2c_get_clientdata(i2c); mfd_remove_devices(max77686->dev); + if (max77686->type == TYPE_MAX77686) + mfd_remove_devices(&max77686->rtc->dev); regmap_del_irq_chip(max77686->irq, max77686->rtc_irq_data); regmap_del_irq_chip(max77686->irq, max77686->irq_data);