From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [RFC PATCH v3 9/9] power: supply: Add bd718(15/27/28/78) charger driver
Date: Thu, 18 Nov 2021 21:10:09 +0800 [thread overview]
Message-ID: <202111182139.yJOMrM6n-lkp@intel.com> (raw)
In-Reply-To: <dbd97c1b0d715aa35a8b4d79741e433d97c562aa.1637061794.git.matti.vaittinen@fi.rohmeurope.com>
[-- Attachment #1: Type: text/plain, Size: 8673 bytes --]
Hi Matti,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on sre-power-supply/for-next]
[also build test WARNING on lee-mfd/for-mfd-next v5.16-rc1 next-20211118]
[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/Matti-Vaittinen/power-supply-Add-some-fuel-gauge-logic/20211116-203220
base: https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next
config: riscv-randconfig-s031-20211116 (attached as .config)
compiler: riscv32-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/0day-ci/linux/commit/bcab8f5e195119b2d4e405451a1b54bb7edb82c5
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Matti-Vaittinen/power-supply-Add-some-fuel-gauge-logic/20211116-203220
git checkout bcab8f5e195119b2d4e405451a1b54bb7edb82c5
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/power/supply/bd71827-power.c:476:26: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [addressable] [usertype] tmp_curr @@ got int @@
drivers/power/supply/bd71827-power.c:476:26: sparse: expected restricted __be16 [addressable] [usertype] tmp_curr
drivers/power/supply/bd71827-power.c:476:26: sparse: got int
>> drivers/power/supply/bd71827-power.c:478:36: sparse: sparse: cast from restricted __be16
>> drivers/power/supply/bd71827-power.c:645:37: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned short [usertype] *swap_lo @@ got restricted __be16 [usertype] * @@
drivers/power/supply/bd71827-power.c:645:37: sparse: expected unsigned short [usertype] *swap_lo
drivers/power/supply/bd71827-power.c:645:37: sparse: got restricted __be16 [usertype] *
vim +476 drivers/power/supply/bd71827-power.c
456
457 static int bd71827_get_current_ds_adc(struct bd71827_power *pwr, int *curr, int *curr_avg)
458 {
459 __be16 tmp_curr;
460 char *tmp = (char *)&tmp_curr;
461 int dir = 1;
462 int regs[] = { pwr->regs->ibat, pwr->regs->ibat_avg };
463 int *vals[] = { curr, curr_avg };
464 int ret, i;
465
466 for (dir = 1, i = 0; i < ARRAY_SIZE(regs); i++) {
467 ret = regmap_bulk_read(pwr->regmap, regs[i], &tmp_curr,
468 sizeof(tmp_curr));
469 if (ret)
470 break;
471
472 if (*tmp & BD7182x_MASK_CURDIR_DISCHG)
473 dir = -1;
474
475 *tmp &= BD7182x_MASK_IBAT_U;
> 476 tmp_curr = be16_to_cpu(tmp_curr);
477
> 478 *vals[i] = dir * ((int)tmp_curr) * pwr->curr_factor;
479 }
480
481 return ret;
482 }
483
484 static int bd71827_voltage_to_capacity(struct simple_gauge *sw, int ocv,
485 int temp __always_unused,
486 int *dsoc);
487
488 static int bd71827_voltage_to_capacity(struct simple_gauge *sw, int ocv, int temp,
489 int *dsoc)
490 {
491 int i = 0;
492 struct bd71827_power *pwr;
493
494 /* If ocv_table is not given try luck with batinfo */
495 if (!use_load_bat_params || !ocv_table[0]) {
496 if (!sw)
497 return -EINVAL;
498
499 pwr = simple_gauge_get_drvdata(sw);
500 *dsoc = power_supply_batinfo_ocv2dcap(&pwr->batinfo, ocv, 0);
501 if (*dsoc < 0)
502 return *dsoc;
503
504 return 0;
505 }
506
507 /* Default or module param OCV table. We have NUM_BAT_PARAMS */
508 if (ocv > ocv_table[0]) {
509 *dsoc = soc_table[0];
510 } else {
511 for (i = 0; i < NUM_BAT_PARAMS; i++) {
512 if ((ocv <= ocv_table[i]) && (ocv > ocv_table[i+1])) {
513 *dsoc = (soc_table[i] - soc_table[i+1]) *
514 (ocv - ocv_table[i+1]) /
515 (ocv_table[i] - ocv_table[i+1]);
516 *dsoc += soc_table[i+1];
517 break;
518 }
519 }
520 if (i == NUM_BAT_PARAMS)
521 *dsoc = soc_table[i - 1];
522 }
523
524 return 0;
525 }
526
527 /* Unit is tenths of degree C */
528 static int bd71827_get_temp(struct simple_gauge *sw, int *temp)
529 {
530 struct bd71827_power *pwr = simple_gauge_get_drvdata(sw);
531 struct regmap *regmap = pwr->regmap;
532 int ret;
533 int t;
534
535 ret = regmap_read(regmap, pwr->regs->btemp_vth, &t);
536 t = 200 - t;
537
538 if (ret || t > 200) {
539 dev_err(pwr->dev, "Failed to read battery temperature\n");
540 *temp = 2000;
541 } else {
542 *temp = t * 10;
543 }
544
545 return ret;
546 }
547
548 /* Unit is tenths of degree C */
549 static int bd71828_get_temp(struct simple_gauge *sw, int *temp)
550 {
551 struct bd71827_power *pwr = simple_gauge_get_drvdata(sw);
552 uint16_t t;
553 int ret;
554 int tmp = 200 * 10000;
555
556 ret = bd7182x_read16_himask(pwr, pwr->regs->btemp_vth,
557 BD71828_MASK_VM_BTMP_U, &t);
558 if (ret || t > 3200)
559 dev_err(pwr->dev,
560 "Failed to read system min average voltage\n");
561
562 tmp -= 625ULL * (unsigned int)t;
563 *temp = tmp / 1000;
564
565 return ret;
566 }
567
568 static int bd71827_charge_status(struct bd71827_power *pwr,
569 int *s, int *h)
570 {
571 unsigned int state;
572 int status, health;
573 int ret = 1;
574
575 ret = regmap_read(pwr->regmap, pwr->regs->chg_state, &state);
576 if (ret)
577 dev_err(pwr->dev, "charger status reading failed (%d)\n", ret);
578
579 state &= BD7182x_MASK_CHG_STATE;
580
581 dev_dbg(pwr->dev, "CHG_STATE %d\n", state);
582
583 switch (state) {
584 case 0x00:
585 ret = 0;
586 status = POWER_SUPPLY_STATUS_DISCHARGING;
587 health = POWER_SUPPLY_HEALTH_GOOD;
588 break;
589 case 0x01:
590 case 0x02:
591 case 0x03:
592 case 0x0E:
593 status = POWER_SUPPLY_STATUS_CHARGING;
594 health = POWER_SUPPLY_HEALTH_GOOD;
595 break;
596 case 0x0F:
597 ret = 0;
598 status = POWER_SUPPLY_STATUS_FULL;
599 health = POWER_SUPPLY_HEALTH_GOOD;
600 break;
601 case 0x10:
602 case 0x11:
603 case 0x12:
604 case 0x13:
605 case 0x14:
606 case 0x20:
607 case 0x21:
608 case 0x22:
609 case 0x23:
610 case 0x24:
611 ret = 0;
612 status = POWER_SUPPLY_STATUS_NOT_CHARGING;
613 health = POWER_SUPPLY_HEALTH_OVERHEAT;
614 break;
615 case 0x30:
616 case 0x31:
617 case 0x32:
618 case 0x40:
619 ret = 0;
620 status = POWER_SUPPLY_STATUS_DISCHARGING;
621 health = POWER_SUPPLY_HEALTH_GOOD;
622 break;
623 case 0x7f:
624 default:
625 ret = 0;
626 status = POWER_SUPPLY_STATUS_NOT_CHARGING;
627 health = POWER_SUPPLY_HEALTH_DEAD;
628 break;
629 }
630
631 if (s)
632 *s = status;
633 if (h)
634 *h = health;
635
636 return ret;
637 }
638
639 static int __write_cc(struct bd71827_power *pwr, uint16_t bcap,
640 unsigned int reg, uint32_t *new)
641 {
642 int ret;
643 __be32 tmp;
644 __be16 *swap_hi = (__be16 *)&tmp;
> 645 uint16_t *swap_lo = swap_hi + 1;
646
647 *swap_hi = cpu_to_be16(bcap & BD7182x_MASK_CC_CCNTD_HI);
648 *swap_lo = 0;
649
650 ret = regmap_bulk_write(pwr->regmap, reg, &tmp, sizeof(tmp));
651 if (ret) {
652 dev_err(pwr->dev, "Failed to write coulomb counter\n");
653 return ret;
654 }
655 if (new)
656 *new = be32_to_cpu(tmp);
657
658 return ret;
659 }
660
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33028 bytes --]
prev parent reply other threads:[~2021-11-18 13:10 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-16 12:24 [RFC PATCH v3 0/9] power: supply: Add some fuel-gauge logic Matti Vaittinen
2021-11-16 12:24 ` [RFC PATCH v3 1/9] dt-bindings: battery: Add temperature-capacity degradation table Matti Vaittinen
2021-11-16 14:02 ` Rob Herring
2021-11-18 1:57 ` Linus Walleij
2021-11-18 5:27 ` Vaittinen, Matti
2021-11-16 12:25 ` [RFC PATCH v3 2/9] power: supply: add cap2ocv batinfo helper Matti Vaittinen
2021-11-18 2:02 ` Linus Walleij
2021-11-18 5:30 ` Vaittinen, Matti
2021-11-16 12:25 ` [RFC PATCH v3 3/9] power: supply: Support DT originated temperature-capacity tables Matti Vaittinen
2021-11-18 2:10 ` Linus Walleij
2021-11-18 6:11 ` Vaittinen, Matti
2021-11-26 11:56 ` Vaittinen, Matti
2021-11-26 12:35 ` Matti Vaittinen
2021-11-27 0:55 ` Linus Walleij
2021-11-27 0:54 ` Linus Walleij
2021-11-28 8:51 ` Vaittinen, Matti
2021-11-30 1:34 ` Linus Walleij
2021-11-30 6:33 ` Vaittinen, Matti
2021-12-02 1:57 ` Linus Walleij
2021-12-02 6:29 ` Vaittinen, Matti
2021-12-05 0:30 ` Linus Walleij
2021-11-16 12:26 ` [RFC PATCH v3 4/9] power: supply: Add batinfo getters usable prior supply registration Matti Vaittinen
2021-11-19 1:42 ` Linus Walleij
2021-11-16 12:27 ` [RFC PATCH v3 5/9] power: supply: Add constant battery aging degradation to batinfo Matti Vaittinen
2021-11-16 12:27 ` [RFC PATCH v3 6/9] power: supply: Add batinfo functions for OCV to SOC with 0.1% accuracy Matti Vaittinen
2021-11-19 1:49 ` Linus Walleij
2021-11-19 8:11 ` Matti Vaittinen
2021-11-16 12:28 ` [RFC PATCH v3 7/9] power: supply: add simple-gauge for SOC estimation and CC correction Matti Vaittinen
2021-11-19 1:54 ` Linus Walleij
2021-11-16 12:29 ` [RFC PATCH v3 8/9] mfd: bd71828, bd71815 prepare for power-supply support Matti Vaittinen
2021-11-16 12:29 ` [RFC PATCH v3 9/9] power: supply: Add bd718(15/27/28/78) charger driver Matti Vaittinen
2021-11-17 2:06 ` kernel test robot
2021-11-17 10:10 ` kernel test robot
2021-11-18 13:10 ` kernel test robot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202111182139.yJOMrM6n-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.