From patchwork Tue Jan 5 03:02:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianqun Xu X-Patchwork-Id: 7952461 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 32157BEEE5 for ; Tue, 5 Jan 2016 03:03:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 50F962034F for ; Tue, 5 Jan 2016 03:03:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 83B4A2034E for ; Tue, 5 Jan 2016 03:03:08 +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 1aGHtq-0001x8-Dy; Tue, 05 Jan 2016 03:03:06 +0000 Received: from regular1.263xmail.com ([211.150.99.131]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aGHtf-0001sy-QM; Tue, 05 Jan 2016 03:02:57 +0000 Received: from jay.xu?rock-chips.com (unknown [192.168.167.129]) by regular1.263xmail.com (Postfix) with SMTP id 997F63C08; Tue, 5 Jan 2016 11:02:23 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 74E35129BE; Tue, 5 Jan 2016 11:02:21 +0800 (CST) X-RL-SENDER: jay.xu@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: jay.xu@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: xjq@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 30038NZCC9I; Tue, 05 Jan 2016 11:02:22 +0800 (CST) From: "jianqun.xu" To: heiko@sntech.de, wsa@the-dreams.de, wdc@rock-chips.com Subject: [PATCH] i2c: rk3x: init module as subsys call Date: Tue, 5 Jan 2016 11:02:18 +0800 Message-Id: <1451962938-17398-1-git-send-email-jay.xu@rock-chips.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160104_190256_868449_3CF7A5DC X-CRM114-Status: UNSURE ( 8.95 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.6 (/) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huangtao@rock-chips.com, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-i2c@vger.kernel.org, Xu Jianqun , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 From: Xu Jianqun There is a requirement from pmic device, which is on the i2c bus, that the pmic needs to be called earlier then devices powered by the outputs of the pmic, if not, the devices maybe fail to probe. For example, a pmic on i2c0, and touchscreen device on i2c2, i2c0: - pmic(rk818) i2c2: - ts(gt911), powered by rk818 on i2c0 The problem will happen if the i2c2 node in dts file is ordered before i2c0 node, then ts(gt911) will be probed before pmic(rk818), since the power from the pmic(rk818) for ts(gt911) hasn't enabled, so ts(gt911) will fail to probe due to the failure of i2c test. But if we set the i2c0 node before i2c2, there is no this issue. The stable way to make sure that pmic can be intalized before other peripher devices is to make the pmic module be subsys call, the i2c module need to be subsys call firstly. Signed-off-by: Xu Jianqun --- drivers/i2c/busses/i2c-rk3x.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c index c1935eb..00e5959 100644 --- a/drivers/i2c/busses/i2c-rk3x.c +++ b/drivers/i2c/busses/i2c-rk3x.c @@ -1037,7 +1037,17 @@ static struct platform_driver rk3x_i2c_driver = { }, }; -module_platform_driver(rk3x_i2c_driver); +static int __init rk3x_i2c_init(void) +{ + return platform_driver_register(&rk3x_i2c_driver); +} +subsys_initcall(rk3x_i2c_init); + +static void __exit rk3x_i2c_exit(void) +{ + platform_driver_unregister(&rk3x_i2c_driver); +} +module_exit(rk3x_i2c_exit); MODULE_DESCRIPTION("Rockchip RK3xxx I2C Bus driver"); MODULE_AUTHOR("Max Schwarz ");