Message ID | a1275df1b8de5112d81e4f0b57f34af34a4a0942.1585838678.git.mirq-linux@rere.qmqm.pl (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Series | power: supply: bq25890: fix and extend | expand |
Hi "Michał, I love your patch! Yet something to improve: [auto build test ERROR on power-supply/for-next] [also build test ERROR on linus/master v5.6 next-20200403] [cannot apply to linux/master] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Micha-Miros-aw/power-supply-bq25890-fix-and-extend/20200404-010738 base: https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next config: parisc-allyesconfig (attached as .config) compiler: hppa-linux-gcc (GCC) 9.3.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=9.3.0 make.cross ARCH=parisc If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/power/supply/bq25890_charger.c: In function 'bq25890_is_adc_property': >> drivers/power/supply/bq25890_charger.c:381:7: error: 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT'? 381 | case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT drivers/power/supply/bq25890_charger.c:381:7: note: each undeclared identifier is reported only once for each function it appears in >> drivers/power/supply/bq25890_charger.c:382:7: error: 'POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_VOLTAGE_NOW'? 382 | case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | POWER_SUPPLY_PROP_VOLTAGE_NOW drivers/power/supply/bq25890_charger.c: At top level: drivers/power/supply/bq25890_charger.c:686:16: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 686 | .properties = bq25890_power_supply_props, | ^~~~~~~~~~~~~~~~~~~~~~~~~~ vim +381 drivers/power/supply/bq25890_charger.c 377 378 static bool bq25890_is_adc_property(enum power_supply_property psp) 379 { 380 switch (psp) { > 381 case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW: > 382 case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW: 383 case POWER_SUPPLY_PROP_VOLTAGE_NOW: 384 case POWER_SUPPLY_PROP_CURRENT_NOW: 385 return true; 386 387 default: 388 return false; 389 } 390 } 391 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi "Michał, I love your patch! Yet something to improve: [auto build test ERROR on power-supply/for-next] [also build test ERROR on linus/master v5.6 next-20200403] [cannot apply to linux/master] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Micha-Miros-aw/power-supply-bq25890-fix-and-extend/20200404-010738 base: https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next config: mips-allyesconfig (attached as .config) compiler: mips-linux-gcc (GCC) 9.3.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=9.3.0 make.cross ARCH=mips If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/power/supply/bq25890_charger.c: In function 'bq25890_is_adc_property': >> drivers/power/supply/bq25890_charger.c:381:7: error: 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT'? 381 | case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT drivers/power/supply/bq25890_charger.c:381:7: note: each undeclared identifier is reported only once for each function it appears in >> drivers/power/supply/bq25890_charger.c:382:7: error: 'POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW' undeclared (first use in this function); did you mean 'POWER_SUPPLY_PROP_VOLTAGE_NOW'? 382 | case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | POWER_SUPPLY_PROP_VOLTAGE_NOW drivers/power/supply/bq25890_charger.c: At top level: drivers/power/supply/bq25890_charger.c:686:16: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 686 | .properties = bq25890_power_supply_props, | ^~~~~~~~~~~~~~~~~~~~~~~~~~ vim +381 drivers/power/supply/bq25890_charger.c 377 378 static bool bq25890_is_adc_property(enum power_supply_property psp) 379 { 380 switch (psp) { > 381 case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW: > 382 case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW: 383 case POWER_SUPPLY_PROP_VOLTAGE_NOW: 384 case POWER_SUPPLY_PROP_CURRENT_NOW: 385 return true; 386 387 default: 388 return false; 389 } 390 } 391 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi "Michał, I love your patch! Perhaps something to improve: [auto build test WARNING on power-supply/for-next] [also build test WARNING on linus/master v5.6 next-20200403] [cannot apply to linux/master] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Micha-Miros-aw/power-supply-bq25890-fix-and-extend/20200404-010738 base: https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next reproduce: # apt-get install sparse # sparse version: v0.6.1-188-g79f7ac98-dirty make ARCH=x86_64 allmodconfig make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot <lkp@intel.com> sparse warnings: (new ones prefixed by >>) drivers/power/supply/bq25890_charger.c:381:14: sparse: sparse: undefined identifier 'POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW' drivers/power/supply/bq25890_charger.c:382:14: sparse: sparse: undefined identifier 'POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW' >> drivers/power/supply/bq25890_charger.c:381:14: sparse: sparse: incompatible types for 'case' statement drivers/power/supply/bq25890_charger.c:382:14: sparse: sparse: incompatible types for 'case' statement drivers/power/supply/bq25890_charger.c:686:23: sparse: sparse: incorrect type in initializer (different modifiers) @@ expected unsigned int enum power_supply_property *properties @@ got unsignunsigned int enum power_supply_property *properties @@ drivers/power/supply/bq25890_charger.c:686:23: sparse: expected unsigned int enum power_supply_property *properties drivers/power/supply/bq25890_charger.c:686:23: sparse: got unsigned int enum power_supply_property const * drivers/power/supply/bq25890_charger.c:381:14: sparse: sparse: Expected constant expression in case statement drivers/power/supply/bq25890_charger.c:382:14: sparse: sparse: Expected constant expression in case statement vim +/case +381 drivers/power/supply/bq25890_charger.c 377 378 static bool bq25890_is_adc_property(enum power_supply_property psp) 379 { 380 switch (psp) { > 381 case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW: 382 case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW: 383 case POWER_SUPPLY_PROP_VOLTAGE_NOW: 384 case POWER_SUPPLY_PROP_CURRENT_NOW: 385 return true; 386 387 default: 388 return false; 389 } 390 } 391 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c index 9339e216651f..3b02fa80aedd 100644 --- a/drivers/power/supply/bq25890_charger.c +++ b/drivers/power/supply/bq25890_charger.c @@ -126,6 +126,7 @@ static const struct regmap_access_table bq25890_writeable_regs = { static const struct regmap_range bq25890_volatile_reg_ranges[] = { regmap_reg_range(0x00, 0x00), + regmap_reg_range(0x02, 0x02), regmap_reg_range(0x09, 0x09), regmap_reg_range(0x0b, 0x14), }; @@ -374,18 +375,40 @@ enum bq25890_chrg_fault { CHRG_FAULT_TIMER_EXPIRED, }; +static bool bq25890_is_adc_property(enum power_supply_property psp) +{ + switch (psp) { + case POWER_SUPPLY_PROP_INPUT_VOLTAGE_NOW: + case POWER_SUPPLY_PROP_OUTPUT_VOLTAGE_NOW: + case POWER_SUPPLY_PROP_VOLTAGE_NOW: + case POWER_SUPPLY_PROP_CURRENT_NOW: + return true; + + default: + return false; + } +} + static int bq25890_power_supply_get_property(struct power_supply *psy, enum power_supply_property psp, union power_supply_propval *val) { - int ret; struct bq25890_device *bq = power_supply_get_drvdata(psy); struct bq25890_state state; + bool do_adc_conv; + int ret; mutex_lock(&bq->lock); state = bq->state; + do_adc_conv = !state.online && bq25890_is_adc_property(psp); + if (do_adc_conv) + bq25890_field_write(bq, F_CONV_START, 1); mutex_unlock(&bq->lock); + if (do_adc_conv) + regmap_field_read_poll_timeout(bq->rmap_fields[F_CONV_START], + ret, !ret, 25000, 1000000); + switch (psp) { case POWER_SUPPLY_PROP_STATUS: if (!state.online) @@ -623,8 +646,8 @@ static int bq25890_hw_init(struct bq25890_device *bq) } } - /* Configure ADC for continuous conversions. This does not enable it. */ - ret = bq25890_field_write(bq, F_CONV_RATE, 1); + /* Configure ADC for continuous conversions when charging */ + ret = bq25890_field_write(bq, F_CONV_RATE, !!bq->state.online); if (ret < 0) { dev_dbg(bq->dev, "Config ADC failed %d\n", ret); return ret; @@ -966,7 +989,7 @@ static int bq25890_suspend(struct device *dev) * If charger is removed, while in suspend, make sure ADC is diabled * since it consumes slightly more power. */ - return bq25890_field_write(bq, F_CONV_START, 0); + return bq25890_field_write(bq, F_CONV_RATE, 0); } static int bq25890_resume(struct device *dev) @@ -982,7 +1005,7 @@ static int bq25890_resume(struct device *dev) /* Re-enable ADC only if charger is plugged in. */ if (bq->state.online) { - ret = bq25890_field_write(bq, F_CONV_START, 1); + ret = bq25890_field_write(bq, F_CONV_RATE, 1); if (ret < 0) return ret; }
Datasheet describes two modes for reading ADC measurements: 1. continuous, 1 Hz - enabled and started by CONV_RATE bit 2. one-shot - triggered by CONV_START bit In continuous mode, CONV_START is read-only and signifies an ongoing conversion. Change the code to follow the datasheet and really disable continuous mode for power saving. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> --- drivers/power/supply/bq25890_charger.c | 33 ++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 5 deletions(-)