Message ID | 20210703084224.31623-5-andreas@kemnade.info (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Series | mfd: rn5t618: Extend ADC support | expand |
Hi Andreas, Thank you for the patch! Yet something to improve: [auto build test ERROR on power-supply/for-next] [also build test ERROR on next-20210701] [cannot apply to lee-mfd/for-mfd-next iio/togreg robh/for-next v5.13] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Andreas-Kemnade/mfd-rn5t618-Extend-ADC-support/20210703-164312 base: https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next config: i386-randconfig-c021-20210703 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/99953e2eb9d653eb8bc74eb482cef7c9fb4e69d7 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Andreas-Kemnade/mfd-rn5t618-Extend-ADC-support/20210703-164312 git checkout 99953e2eb9d653eb8bc74eb482cef7c9fb4e69d7 # save the attached .config to linux build tree mkdir build_dir make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): ld: drivers/regulator/bd71815-regulator.o: in function `set_hw_dvs_levels': bd71815-regulator.c:(.text+0xbf): undefined reference to `rohm_regulator_set_dvs_levels' ld: drivers/regulator/bd71815-regulator.o: in function `buck12_set_hw_dvs_levels': bd71815-regulator.c:(.text+0x2be): undefined reference to `rohm_regulator_set_dvs_levels' ld: drivers/power/supply/rn5t618_power.o: in function `rn5t618_adp_get_property': >> rn5t618_power.c:(.text+0x34d): undefined reference to `iio_read_channel_processed' ld: drivers/power/supply/rn5t618_power.o: in function `rn5t618_power_probe': >> rn5t618_power.c:(.text+0x4a8): undefined reference to `devm_iio_channel_get' >> ld: rn5t618_power.c:(.text+0x4c2): undefined reference to `devm_iio_channel_get' ld: drivers/power/supply/rn5t618_power.o: in function `rn5t618_usb_get_property': rn5t618_power.c:(.text+0x79d): undefined reference to `iio_read_channel_processed' --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Andreas, Thank you for the patch! Yet something to improve: [auto build test ERROR on power-supply/for-next] [also build test ERROR on next-20210701] [cannot apply to lee-mfd/for-mfd-next iio/togreg robh/for-next v5.13] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Andreas-Kemnade/mfd-rn5t618-Extend-ADC-support/20210703-164312 base: https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next config: i386-randconfig-m031-20210702 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/99953e2eb9d653eb8bc74eb482cef7c9fb4e69d7 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Andreas-Kemnade/mfd-rn5t618-Extend-ADC-support/20210703-164312 git checkout 99953e2eb9d653eb8bc74eb482cef7c9fb4e69d7 # save the attached .config to linux build tree make W=1 ARCH=i386 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>, old ones prefixed by <<): >> ERROR: modpost: "devm_iio_channel_get" [drivers/power/supply/rn5t618_power.ko] undefined! >> ERROR: modpost: "iio_read_channel_processed" [drivers/power/supply/rn5t618_power.ko] undefined! --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi, oh, I forgot to add some depends IIO in the Makefile. I will wait some days for human reviewers before spinning a v2. Regards, Andreas On Sat, 3 Jul 2021 22:35:27 +0800 kernel test robot <lkp@intel.com> wrote: > Hi Andreas, > > Thank you for the patch! Yet something to improve: > > [auto build test ERROR on power-supply/for-next] > [also build test ERROR on next-20210701] > [cannot apply to lee-mfd/for-mfd-next iio/togreg robh/for-next v5.13] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch] > > url: https://github.com/0day-ci/linux/commits/Andreas-Kemnade/mfd-rn5t618-Extend-ADC-support/20210703-164312 > base: https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next > config: i386-randconfig-m031-20210702 (attached as .config) > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 > reproduce (this is a W=1 build): > # https://github.com/0day-ci/linux/commit/99953e2eb9d653eb8bc74eb482cef7c9fb4e69d7 > git remote add linux-review https://github.com/0day-ci/linux > git fetch --no-tags linux-review Andreas-Kemnade/mfd-rn5t618-Extend-ADC-support/20210703-164312 > git checkout 99953e2eb9d653eb8bc74eb482cef7c9fb4e69d7 > # save the attached .config to linux build tree > make W=1 ARCH=i386 > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot <lkp@intel.com> > > All errors (new ones prefixed by >>, old ones prefixed by <<): > > >> ERROR: modpost: "devm_iio_channel_get" [drivers/power/supply/rn5t618_power.ko] undefined! > >> ERROR: modpost: "iio_read_channel_processed" [drivers/power/supply/rn5t618_power.ko] undefined! > > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
On Sat, 3 Jul 2021 10:42:24 +0200 Andreas Kemnade <andreas@kemnade.info> wrote: > Read voltage_now via IIO and provide the property. > > Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Hi Andreas, One comment inline, but looks fine to me in general. > --- > drivers/power/supply/rn5t618_power.c | 56 ++++++++++++++++++++++++++++ > 1 file changed, 56 insertions(+) > > diff --git a/drivers/power/supply/rn5t618_power.c b/drivers/power/supply/rn5t618_power.c > index 819061918b2a..b062208c8a91 100644 > --- a/drivers/power/supply/rn5t618_power.c > +++ b/drivers/power/supply/rn5t618_power.c > @@ -9,10 +9,12 @@ > #include <linux/device.h> > #include <linux/bitops.h> > #include <linux/errno.h> > +#include <linux/iio/consumer.h> > #include <linux/init.h> > #include <linux/interrupt.h> > #include <linux/module.h> > #include <linux/mfd/rn5t618.h> > +#include <linux/of_device.h> > #include <linux/platform_device.h> > #include <linux/power_supply.h> > #include <linux/regmap.h> > @@ -64,6 +66,8 @@ struct rn5t618_power_info { > struct power_supply *battery; > struct power_supply *usb; > struct power_supply *adp; > + struct iio_channel *channel_vusb; > + struct iio_channel *channel_vadp; > int irq; > }; > > @@ -77,6 +81,7 @@ static enum power_supply_usb_type rn5t618_usb_types[] = { > static enum power_supply_property rn5t618_usb_props[] = { > /* input current limit is not very accurate */ > POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, > + POWER_SUPPLY_PROP_VOLTAGE_NOW, > POWER_SUPPLY_PROP_STATUS, > POWER_SUPPLY_PROP_USB_TYPE, > POWER_SUPPLY_PROP_ONLINE, > @@ -85,6 +90,7 @@ static enum power_supply_property rn5t618_usb_props[] = { > static enum power_supply_property rn5t618_adp_props[] = { > /* input current limit is not very accurate */ > POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, > + POWER_SUPPLY_PROP_VOLTAGE_NOW, > POWER_SUPPLY_PROP_STATUS, > POWER_SUPPLY_PROP_ONLINE, > }; > @@ -464,6 +470,16 @@ static int rn5t618_adp_get_property(struct power_supply *psy, > > val->intval = FROM_CUR_REG(regval); > break; > + case POWER_SUPPLY_PROP_VOLTAGE_NOW: > + if (!info->channel_vadp) > + return -ENODATA; > + > + ret = iio_read_channel_processed(info->channel_vadp, &val->intval); > + if (ret < 0) > + return ret; > + > + val->intval *= 1000; > + break; > default: > return -EINVAL; > } > @@ -589,6 +605,16 @@ static int rn5t618_usb_get_property(struct power_supply *psy, > val->intval = FROM_CUR_REG(regval); > } > break; > + case POWER_SUPPLY_PROP_VOLTAGE_NOW: > + if (!info->channel_vusb) > + return -ENODATA; > + > + ret = iio_read_channel_processed(info->channel_vusb, &val->intval); > + if (ret < 0) > + return ret; > + > + val->intval *= 1000; > + break; > default: > return -EINVAL; > } > @@ -711,6 +737,28 @@ static int rn5t618_power_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, info); > > + info->channel_vusb = devm_iio_channel_get(&pdev->dev, "vusb"); > + if (IS_ERR(info->channel_vusb)) { > + ret = PTR_ERR(info->channel_vusb); > + if (ret == -EPROBE_DEFER) > + return ret; > + > + dev_warn(&pdev->dev, "could not request vusb iio channel (%d)", > + ret); I wonder if you should distinguish between -ENODEV to indicate there wasn't one specified vs something else when wrong. Might not be worth bothering as there are not many things that could go wrong (things like small memory allocations which will never fail..) > + info->channel_vusb = NULL; > + } > + > + info->channel_vadp = devm_iio_channel_get(&pdev->dev, "vadp"); > + if (IS_ERR(info->channel_vadp)) { > + ret = PTR_ERR(info->channel_vadp); > + if (ret == -EPROBE_DEFER) > + return ret; > + > + dev_warn(&pdev->dev, "could not request vadp iio channel (%d)", > + ret); > + info->channel_vadp = NULL; > + } > + > ret = regmap_read(info->rn5t618->regmap, RN5T618_CONTROL, &v); > if (ret) > return ret; > @@ -778,9 +826,17 @@ static int rn5t618_power_probe(struct platform_device *pdev) > return 0; > } > > +static const struct of_device_id rn5t618_power_of_match[] = { > + {.compatible = "ricoh,rc5t619-power", }, > + {.compatible = "ricoh,rn5t618-power", }, > + { } > +}; > +MODULE_DEVICE_TABLE(of, rn5t618_power_of_match); > + > static struct platform_driver rn5t618_power_driver = { > .driver = { > .name = "rn5t618-power", > + .of_match_table = of_match_ptr(rn5t618_power_of_match), > }, > .probe = rn5t618_power_probe, > };
diff --git a/drivers/power/supply/rn5t618_power.c b/drivers/power/supply/rn5t618_power.c index 819061918b2a..b062208c8a91 100644 --- a/drivers/power/supply/rn5t618_power.c +++ b/drivers/power/supply/rn5t618_power.c @@ -9,10 +9,12 @@ #include <linux/device.h> #include <linux/bitops.h> #include <linux/errno.h> +#include <linux/iio/consumer.h> #include <linux/init.h> #include <linux/interrupt.h> #include <linux/module.h> #include <linux/mfd/rn5t618.h> +#include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/power_supply.h> #include <linux/regmap.h> @@ -64,6 +66,8 @@ struct rn5t618_power_info { struct power_supply *battery; struct power_supply *usb; struct power_supply *adp; + struct iio_channel *channel_vusb; + struct iio_channel *channel_vadp; int irq; }; @@ -77,6 +81,7 @@ static enum power_supply_usb_type rn5t618_usb_types[] = { static enum power_supply_property rn5t618_usb_props[] = { /* input current limit is not very accurate */ POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, + POWER_SUPPLY_PROP_VOLTAGE_NOW, POWER_SUPPLY_PROP_STATUS, POWER_SUPPLY_PROP_USB_TYPE, POWER_SUPPLY_PROP_ONLINE, @@ -85,6 +90,7 @@ static enum power_supply_property rn5t618_usb_props[] = { static enum power_supply_property rn5t618_adp_props[] = { /* input current limit is not very accurate */ POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, + POWER_SUPPLY_PROP_VOLTAGE_NOW, POWER_SUPPLY_PROP_STATUS, POWER_SUPPLY_PROP_ONLINE, }; @@ -464,6 +470,16 @@ static int rn5t618_adp_get_property(struct power_supply *psy, val->intval = FROM_CUR_REG(regval); break; + case POWER_SUPPLY_PROP_VOLTAGE_NOW: + if (!info->channel_vadp) + return -ENODATA; + + ret = iio_read_channel_processed(info->channel_vadp, &val->intval); + if (ret < 0) + return ret; + + val->intval *= 1000; + break; default: return -EINVAL; } @@ -589,6 +605,16 @@ static int rn5t618_usb_get_property(struct power_supply *psy, val->intval = FROM_CUR_REG(regval); } break; + case POWER_SUPPLY_PROP_VOLTAGE_NOW: + if (!info->channel_vusb) + return -ENODATA; + + ret = iio_read_channel_processed(info->channel_vusb, &val->intval); + if (ret < 0) + return ret; + + val->intval *= 1000; + break; default: return -EINVAL; } @@ -711,6 +737,28 @@ static int rn5t618_power_probe(struct platform_device *pdev) platform_set_drvdata(pdev, info); + info->channel_vusb = devm_iio_channel_get(&pdev->dev, "vusb"); + if (IS_ERR(info->channel_vusb)) { + ret = PTR_ERR(info->channel_vusb); + if (ret == -EPROBE_DEFER) + return ret; + + dev_warn(&pdev->dev, "could not request vusb iio channel (%d)", + ret); + info->channel_vusb = NULL; + } + + info->channel_vadp = devm_iio_channel_get(&pdev->dev, "vadp"); + if (IS_ERR(info->channel_vadp)) { + ret = PTR_ERR(info->channel_vadp); + if (ret == -EPROBE_DEFER) + return ret; + + dev_warn(&pdev->dev, "could not request vadp iio channel (%d)", + ret); + info->channel_vadp = NULL; + } + ret = regmap_read(info->rn5t618->regmap, RN5T618_CONTROL, &v); if (ret) return ret; @@ -778,9 +826,17 @@ static int rn5t618_power_probe(struct platform_device *pdev) return 0; } +static const struct of_device_id rn5t618_power_of_match[] = { + {.compatible = "ricoh,rc5t619-power", }, + {.compatible = "ricoh,rn5t618-power", }, + { } +}; +MODULE_DEVICE_TABLE(of, rn5t618_power_of_match); + static struct platform_driver rn5t618_power_driver = { .driver = { .name = "rn5t618-power", + .of_match_table = of_match_ptr(rn5t618_power_of_match), }, .probe = rn5t618_power_probe, };
Read voltage_now via IIO and provide the property. Signed-off-by: Andreas Kemnade <andreas@kemnade.info> --- drivers/power/supply/rn5t618_power.c | 56 ++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)