[PATCH v5 1/2] mfd: act8945a: add Active-semi ACT8945A PMIC MFD driver

Yang, Wenyou wenyou.yang at atmel.com
Tue Jan 19 23:50:29 PST 2016


Hi Peter,

On 2016/1/20 15:40, Peter Korsgaard wrote:
>>>>>> "Yang," == Yang, Wenyou <Wenyou.Yang at atmel.com> writes:
> Hi,
>
>>> But the charger driver can just as well do:
>   >>
>   >> dev_get_regmap(dev->parent);
>   >>
>   >> instead of:
>   >>
>   >> dev_get_drvdata(pdev->dev.parent)->regmap.
>
>   > For regulator, it works use the core do dev_get_regmap(dev->parent),
>   > but for charger, it need to export *act8945a.
>
> Why?

There is a callback (*get_property)(...), who will read the charger 
register via regmap,

but it doesn't provide the argument for regmap.

include/linux/power_supply.h

struct power_supply_desc {
         [ ... ]
         int (*get_property)(struct power_supply *psy,
                              enum power_supply_property psp,
                              union power_supply_propval *val);
         [ ... ]

}

>
> Just like the regulator core does, your battery driver can do:
>
> dev_get_regmap(dev->parent);
>

Best Regards,
Wenyou Yang



More information about the linux-arm-kernel mailing list