Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966489AbdLSGvj (ORCPT ); Tue, 19 Dec 2017 01:51:39 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:14607 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S966410AbdLSGv1 (ORCPT ); Tue, 19 Dec 2017 01:51:27 -0500 X-UUID: 709beda7fed5439bb97500b7792948b4-20171219 From: Jun Gao To: Wolfram Sang , Matthias Brugger CC: , , , , , , Jun Gao Subject: [PATCH 3/3] i2c: mediatek: Enable i2c module clock before i2c registers access. Date: Tue, 19 Dec 2017 14:51:03 +0800 Message-ID: <1513666263-6443-4-git-send-email-jun.gao@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1513666263-6443-1-git-send-email-jun.gao@mediatek.com> References: <1513666263-6443-1-git-send-email-jun.gao@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 844 Lines: 36 From: Jun Gao Make sure i2c module clock has been enabled before i2c registers access. Signed-off-by: Jun Gao --- drivers/i2c/busses/i2c-mt65xx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c index 58d6401..cf23a74 100644 --- a/drivers/i2c/busses/i2c-mt65xx.c +++ b/drivers/i2c/busses/i2c-mt65xx.c @@ -861,10 +861,19 @@ static int mtk_i2c_remove(struct platform_device *pdev) #ifdef CONFIG_PM_SLEEP static int mtk_i2c_resume(struct device *dev) { + int ret; struct mtk_i2c *i2c = dev_get_drvdata(dev); + ret = mtk_i2c_clock_enable(i2c); + if (ret) { + dev_err(dev, "clock enable failed!\n"); + return ret; + } + mtk_i2c_init_hw(i2c); + mtk_i2c_clock_disable(i2c); + return 0; } #endif -- 1.8.1.1