Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1308742 > unrolled thread
| Started by | Laxman Dewangan <ldewangan@nvidia.com> |
|---|---|
| First post | 2016-01-13 20:10 +0100 |
| Last post | 2016-01-14 13:00 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
Need APIs to add regmap in dev Laxman Dewangan <ldewangan@nvidia.com> - 2016-01-13 20:10 +0100
Re: Need APIs to add regmap in dev Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-01-14 02:10 +0100
Re: Need APIs to add regmap in dev Laxman Dewangan <ldewangan@nvidia.com> - 2016-01-14 13:00 +0100
| From | Laxman Dewangan <ldewangan@nvidia.com> |
|---|---|
| Date | 2016-01-13 20:10 +0100 |
| Subject | Need APIs to add regmap in dev |
| Message-ID | <qQyXU-41l-29@gated-at.bofh.it> |
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. Thanks, Laxman
[toc] | [next] | [standalone]
| From | Krzysztof Kozlowski <k.kozlowski@samsung.com> |
|---|---|
| Date | 2016-01-14 02:10 +0100 |
| Message-ID | <qQEAi-7UG-11@gated-at.bofh.it> |
| In reply to | #1308742 |
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
[toc] | [prev] | [next] | [standalone]
| From | Laxman Dewangan <ldewangan@nvidia.com> |
|---|---|
| Date | 2016-01-14 13:00 +0100 |
| Message-ID | <qQOJj-6rt-9@gated-at.bofh.it> |
| In reply to | #1308924 |
On Thursday 14 January 2016 06:38 AM, Krzysztof Kozlowski wrote: > 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. One of discussion, Mark suggested to use dev_get_regmap() and explored to get both regmap handle via this call. That's why did not routed to create one regmap in mfd and other regmap in the rtc driver. > > Just don't create the RTC regmap in parent MFD. Let the child manage its > resources. That is the real decoupling. This is also very possible to handle everything on RTC driver. Will try this route now.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web