From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760900AbcALDwH (ORCPT ); Mon, 11 Jan 2016 22:52:07 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:31667 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759190AbcALDwA (ORCPT ); Mon, 11 Jan 2016 22:52:00 -0500 X-AuditID: cbfec7f4-f79026d00000418a-c0-5694785dbdb5 Subject: Re: [rtc-linux] [PATCH 5/6] rtc: max77620: add support for max77620/max20024 RTC driver To: Laxman Dewangan , Alexandre Belloni References: <1452177524-23192-1-git-send-email-ldewangan@nvidia.com> <1452177524-23192-6-git-send-email-ldewangan@nvidia.com> <568F8D7E.10500@nvidia.com> <20160108125117.GM6588@sirena.org.uk> <568FB3DD.4090503@nvidia.com> <20160108133648.GQ6588@sirena.org.uk> <568FBB6D.2020904@nvidia.com> <5693AB6E.4090700@nvidia.com> <20160111160419.GA3367@piout.net> <5693E14B.4050306@nvidia.com> <56944520.6090301@samsung.com> <569465DA.10609@nvidia.com> Cc: Mark Brown , rtc-linux@googlegroups.com, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, linus.walleij@linaro.org, gnurou@gmail.com, lee.jones@linaro.org, a.zummo@towertech.it, lgirdwood@gmail.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, swarren@nvidia.com, treding@nvidia.com, Chaitanya Bandi From: Krzysztof Kozlowski X-Enigmail-Draft-Status: N1110 Message-id: <56947857.30709@samsung.com> Date: Tue, 12 Jan 2016 12:51:51 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-version: 1.0 In-reply-to: <569465DA.10609@nvidia.com> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLIsWRmVeSWpSXmKPExsVy+t/xy7qxFVPCDNo+SVgsuXiV3aLj2mIm i7knOtgspj58wmYx/8g5Vov+NwtZLc69esQCJFYyWrx+YWixdN9qFov7X48yWny70sFkMeXP ciaLzfP/MFpc3jWHzWLp9YtMFhOmr2WxaN17hN1if2cHo8WN6S2sFrd/8zmIeqyZt4bR43Jf L5PHk00XGT12zrrL7rFn4kk2j5XLv7B5bFrVyeZx59oeNo/e5ndsHn1bVjF6TJ/3k8nj8ya5 AJ4oLpuU1JzMstQifbsErox1K66xFUwWrHg/8R1rA+Nd3i5GDg4JAROJ7bfCuhg5gUwxiQv3 1rN1MXJxCAksZZT4+3gHM4TzlFHi3dWNLCBVwgJJEhPvX2UEsUUE0iQmnn/PBFHUyyLRdW0C WDuzwDlmidsHdoN1sAkYS2xevoQNYoecRG/3JLA4r4CGxJ2t/5hAbBYBVYk9t34wg5wkKhAh sWhHJkSJoMSPyffAyjmByvv+vWAEKWEW0JO4f1ELJMwsIC+xec1b5gmMgrOQdMxCqJqFpGoB I/MqRtHU0uSC4qT0XEO94sTc4tK8dL3k/NxNjJBI/rKDcfExq0OMAhyMSjy8GexTwoRYE8uK K3MPMUpwMCuJ8DoFAYV4UxIrq1KL8uOLSnNSiw8xSnOwKInzzt31PkRIID2xJDU7NbUgtQgm y8TBKdXAyGFwemFT5vPOjMOze1wOydk2HU/5/L+VZUfWNpnjD193vcuUWLriYuLce3xCLwOd jeMWTw1I2fJTni2JYWq0R1xjvUbZuTPsLFdy9q7wrHv9cJL3vs9FsleOmqzr7Dysu/RDILO2 peneL0eLpzVI3jgskcq9ZMGRup1TdL9P5l1tOJ3d4bHkSSWW4oxEQy3mouJEAHBRvn/gAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12.01.2016 11:32, Laxman Dewangan wrote: > > On Tuesday 12 January 2016 05:43 AM, Krzysztof Kozlowski wrote: >> On 12.01.2016 02:07, Laxman Dewangan wrote: >>>>> The RTC driver parent is not the same parent for which i2c slave >>>>> address get >>>>> registered. >>>>> There is two slave address from max77620, 0x3C (for general) and 0x68 >>>>> for >>>>> RTC. >>>>> >>>>> In max77620 mfd driver, we make dummy i2c client for 0x68 and >>>>> initialize >>>>> regmap with this address. >>>>> >>>>> Now on mfd_add_devices, we pass the device for 0x3c and hence the RTC >>>>> driver >>>>> treat the parent as the 0x3c device but actually it should be 0x68 to >>>>> get >>>>> the proper regmap. >>>>> >>>>> >>>>> Two approach: >>>>> 1. If we add the option to pass parent_dev when adding cells form >>>>> mfd_add_devices and select the parent device based on this option >>>>> then it >>>>> can be easily handle. >>>>> Add parent_dev structure in struct mfd_cell and then change the >>>>> parent >>>>> in mfd_add_device() if cells has parent device. >>>>> >>>>> 2. Register the RTC driver with different mfd_add_devices with >>>>> dummy i2c >>>>> client device. >>>>> So two times mfd_add_devices. >> Lexman, >> >> I don't quite get the problem. This looks exactly the same as for >> max77686. What is the difference? I don't see any need to change the >> mfd_cell for current drivers... >> >> > > Here the change is only required to pass the regmap handle from mfd to > the rtc driver. There is no change for rest of rtc driver. > > RTC i2c regmap registered with i2c dummy client device, not with actual > parent device and hence we need to register RTC with this dummy i2c > client device. This way we can get regmap handle by using the > dev_get_regmap(pdev->dev.parent). It seems that both max77620 and max77686 use separate I2C addresses for RTC block. The max77802 does not. This means that probably each child driver should be responsible for its own regmap. The max77620 and max77686 will create new I2C dummy devices and new regmaps. The max77802 will re-use references passed by parent (MFD). Best regards, Krzysztof