From patchwork Thu Sep 1 11:39:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 9308923 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3384A607D6 for ; Thu, 1 Sep 2016 11:39:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 233C72930A for ; Thu, 1 Sep 2016 11:39:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12F5229314; Thu, 1 Sep 2016 11:39:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA4512930A for ; Thu, 1 Sep 2016 11:39:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933222AbcIALjj (ORCPT ); Thu, 1 Sep 2016 07:39:39 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:44181 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755066AbcIALjh (ORCPT ); Thu, 1 Sep 2016 07:39:37 -0400 Received: from epcpsbgm2new.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OCT025TFPPZDD50@mailout2.samsung.com>; Thu, 01 Sep 2016 20:39:35 +0900 (KST) X-AuditID: cbfee61b-f79466d000001e3c-91-57c813770eec Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 31.88.07740.77318C75; Thu, 1 Sep 2016 04:39:35 -0700 (MST) Received: from AMDC1344.digital.local ([106.116.147.32]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OCT003WTPPLGR00@mmp2.samsung.com>; Thu, 01 Sep 2016 20:39:35 +0900 (KST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Cc: m.szyprowski@samsung.com, wsa@the-dreams.de, b.zolnierkie@samsung.com, linux-samsung-soc@vger.kernel.org, Sylwester Nawrocki , stable@vger.kernel.org Subject: [PATCH 1/4] exynos4-is: Clear isp-i2c adapter power.ignore_children flag Date: Thu, 01 Sep 2016 13:39:16 +0200 Message-id: <1472729956-17475-1-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGJMWRmVeSWpSXmKPExsVy+t9jQd1y4RPhBocfcVtsnLGe1aJnw1ZW ixnn9zFZrD1yl93i8Jt2VosFGx8xWqw8MYvZgd2jb8sqRo+Tp56weHzeJBfAHMVlk5Kak1mW WqRvl8CV8f3WBMaCv8IVfW9vsTcwXhXoYuTkkBAwkdjS8oQJwhaTuHBvPVsXIxeHkMAsRomt B/4zQTi/GCUu9RxlBKliEzCU6D3aB2aLCMhLPOm9AdbBLLCVUaKx/RELSEJYIFhi17deVhCb RUBV4sHNJWwgNq+Am8T5G2ug1slJnDw2mXUCI/cCRoZVjBKpBckFxUnpuUZ5qeV6xYm5xaV5 6XrJ+bmbGMGh8Ux6B+PhXe6HGAU4GJV4eGdYHg8XYk0sK67MPcQowcGsJMI7SehEuBBvSmJl VWpRfnxRaU5q8SFGaQ4WJXHex//XhQkJpCeWpGanphakFsFkmTg4pRoYZU07zzzcqprc6bz4 RWzMxU0OKzZ5qO1OO1LGfHVK8uYp5a+Pyz93XnSshemnxVLt2Okbgz9M8HS4y3bs1W7G1K03 Y3KY3v6aJ7ueWemct6H+3pimF9ed+6+/ied48HMap3ex6tUOpw32JyWbj7unfzi58kbrnS9c W3av0ZqY3pv8N9LlM3PjCiWW4oxEQy3mouJEAC++WQMJAgAA Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since commit 04f59143b571161d25315dd52d7a2ecc022cb71a ("i2c: let I2C masters ignore their children for PM") the power.ignore_children flag is set when registering an I2C adapter. Since I2C transfers are not managed by the fimc-isp-i2c driver its clients use pm_runtime_* calls directly to communicate required power state of the bus controller. However when the power.ignore_children flag is set that doesn't work, so clear that flag back after registering the adapter. While at it drop pm_runtime_enable() call on the i2c_adapter as it is already done by the I2C subsystem when registering I2C adapter. Cc: # 4.7+ Reported-by: Marek Szyprowski Signed-off-by: Sylwester Nawrocki Reviewed-by: Bartlomiej Zolnierkiewicz --- drivers/media/platform/exynos4-is/fimc-is-i2c.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-is-i2c.c b/drivers/media/platform/exynos4-is/fimc-is-i2c.c index 7521aa5..03b4246 100644 --- a/drivers/media/platform/exynos4-is/fimc-is-i2c.c +++ b/drivers/media/platform/exynos4-is/fimc-is-i2c.c @@ -55,26 +55,37 @@ static int fimc_is_i2c_probe(struct platform_device *pdev) i2c_adap->algo = &fimc_is_i2c_algorithm; i2c_adap->class = I2C_CLASS_SPD; + platform_set_drvdata(pdev, isp_i2c); + pm_runtime_enable(&pdev->dev); + ret = i2c_add_adapter(i2c_adap); if (ret < 0) { dev_err(&pdev->dev, "failed to add I2C bus %s\n", node->full_name); - return ret; + goto err_pm_dis; } - platform_set_drvdata(pdev, isp_i2c); - - pm_runtime_enable(&pdev->dev); - pm_runtime_enable(&i2c_adap->dev); - + /* + * Client drivers of this adapter don't do any I2C transfers as that + * is handled by the ISP firmware. But we rely on the runtime PM + * state propagation from the clients up to the adapter driver so + * clear the ignore_children flags here. PM rutnime calls are not + * used in probe() handler of clients of this adapter so there is + * no issues with clearing the flag right after registering the I2C + * adapter. + */ + pm_suspend_ignore_children(&i2c_adap->dev, false); return 0; + +err_pm_dis: + pm_runtime_disable(&pdev->dev); + return ret; } static int fimc_is_i2c_remove(struct platform_device *pdev) { struct fimc_is_i2c *isp_i2c = platform_get_drvdata(pdev); - pm_runtime_disable(&isp_i2c->adapter.dev); pm_runtime_disable(&pdev->dev); i2c_del_adapter(&isp_i2c->adapter);