From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754744AbcANBJu (ORCPT ); Wed, 13 Jan 2016 20:09:50 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:45410 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754696AbcANBI5 (ORCPT ); Wed, 13 Jan 2016 20:08:57 -0500 X-AuditID: cbfec7f4-f79026d00000418a-04-5696f5257606 Subject: Re: Need APIs to add regmap in dev To: Laxman Dewangan , Mark Brown References: <56969E11.7060407@nvidia.com> Cc: LKML From: Krzysztof Kozlowski Message-id: <5696F528.8060506@samsung.com> Date: Thu, 14 Jan 2016 10:08:56 +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: <56969E11.7060407@nvidia.com> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCLMWRmVeSWpSXmKPExsVy+t/xq7qqX6eFGRx+aGUx9eETNovXLwwt lu5bzWJxedccNgcWj02rOtk8epvfsXn0bVnF6PF5k1wASxSXTUpqTmZZapG+XQJXxuJTM9gL dvFWbLp7ha2B8TpXFyMnh4SAicT+FWuZIWwxiQv31rN1MXJxCAksZZTYtukHE4TzlFHi6Zpv rCBVwgLaEnsubgbrEBHwlnh55QkTiC0koCkx5+wDdhCbWUBdYtu+K2D1bALGEpuXL2EDsXkF tCTa3+8Fi7MIqErMO7AEaA4Hh6hAhMSiHZkQJYISPybfYwGxOYHKD72cwApSwiygJ3H/ohbE dHmJzWveMk9gFJiFpGMWQtUsJFULGJlXMYqmliYXFCel5xrqFSfmFpfmpesl5+duYoSE7Zcd jIuPWR1iFOBgVOLh/XF3WpgQa2JZcWXuIUYJDmYlEd67b4FCvCmJlVWpRfnxRaU5qcWHGKU5 WJTEeefueh8iJJCeWJKanZpakFoEk2Xi4JRqYBQXZXC+KJjCet+oOTHNN/Fl2vvT4kmJvfxO tzdLOjfbdhpm/HfYJmqsYSMUyCbp/afSXWBrwp6/ts/21/CkvBX/eOVM9lb9C4p7gyuXa90T 1l2/4+6bCTq+obP+r+LbxPptg+CffTyP9gr7H1rB85azXKz4+b3NUhoaXZd6l9otturhuaQy WYmlOCPRUIu5qDgRAPukL3lXAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14.01.2016 03:57, Laxman Dewangan wrote: > Hi Mark, > when working on unification of Max77620, MAX77686 RTC driver, I came to > need of APIs from regmap to add the device as devres. > > int dev_add_regmap(dev, regmap); > > This will add the regmap in the dev resource of device. This will help > to get the regmap handle from device using dev_get_regmap(). This APIs > will be different from the regmap_attach_dev() where map->dev is moved > to new device. > > The requirement came from multiple i2c slave address device like MAX77620. > MAX77620 has 2 i2c address 0x3C and 0x68. 0x68 is for RTC IP block. > we register device with 0x3C and create dummy i2c client for 0x68 inside > driver. > We create two regmap, one from 0x3C i2c client as rmap_0x3c and other > from 0x68 i2c dummy client rmap_0x68. > > Now in RTC driver(mfd device), we have the parent device as dev_0x3c. > When we try to get the regmap handle, we only get one regmap per device > as we register regmap with different devices. > > If I had above API then I can add the rmap_0x68 in the dev_0x3c as > dev_res. By this I can have two regmap list on dev_0x3c and get rmap > handle by dev_get_regmap(dev_0x3c, "pmic-slave") and > dev_get_regmap(dev_0x3c, "rtc-slave"); > > > I like to know your comment on this approach to add the regmap on > different device resource. As I pointed on previous discussions (e.g. https://lkml.org/lkml/2016/1/11/1158 ) the child should be responsible for its I2C dummy device and regmap. You ignored that idea previously - dunno why. Just don't create the RTC regmap in parent MFD. Let the child manage its resources. That is the real decoupling. BR, Krzysztof