Project

General

Profile

Actions

Bug #1073

open

Make rk818-bat stop spewing to serial console

Added by Hammel about 1 year ago. Updated 10 months ago.

Status:
In Progress
Priority:
Urgent
Assignee:
Target version:
Start date:
08 Nov 2023
Due date:
% Done:

70%

Estimated time:
Severity:
02 - High

Description

It does periodic spewing like so:

root(tty)$ rk818-bat: changed: dsoc=42, rsoc=46, v=3673, ov=3863 c=-545, cap=1234, f=2708, st=charge off, hotdie=0
rk818-bat: dl=56, rl=56, v=3732, halt=0, halt_n=0, max=0, init=0, sw=0, calib=0, below0=0, force=0

This is really annoying on the serial console.

Actions #1

Updated by Hammel about 1 year ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

Look to drivers/power/supply/rk818_battery.c, and especially check if there is an updated kernel available. This may already be fixed.

See:
  1. https://github.com/torvalds/linux/blob/96ae6c2ea090e55425dc276e11e65f88b6964a42/drivers/power/supply/rk818_battery.c#L2443 (from old commit)
  2. https://megous.com/git/linux/tree/drivers/power/supply/rk818_battery.c?h=orange-pi-6.6&id=6fa0d75ad544046dff9b29a721efc60c0b43cf1e#n2437 (megi's kernel repo)
Actions #2

Updated by Hammel about 1 year ago

BAT_INFO is a pr_info macro. The default console log level is set to

CONFIG_CONSOLE_LOGLEVEL_DEFAULT=15

in the defconfig. Additionally the kernel command line can be updated in src/bootloader/boot.txt to include

loglevel=3

to change it from the default to only printing errors.

Additional information can be found on the eLinux.org site or in this stackoverflow discussion.

Actions #3

Updated by Hammel about 1 year ago

  • % Done changed from 10 to 50
Actions #4

Updated by Hammel 10 months ago

  • Priority changed from Immediate to Urgent
  • % Done changed from 50 to 70
  • Severity changed from 03 - Medium to 02 - High

Experimented with this a bit. Setting loglevel=6 reduces console output considerably and also gets rid of the rk818-bat message. However, I want all those other messages, just not the rk818-bat message.

So I would probably want to patch the kernel driver to disable this. Since BAT_INFO() is used throughout the driver, and I only want to quiet the power changed message that pops up on the console repeatedly, I can just #if 0 the block of code. An alternative would be to add a sysfs entry to enable or disable it.

There is already a sysfs setup in rk818_bat_init_sysfs() that uses rk818_bat_attr[] which is a set of sysfs files/functions to enable. Currently the only sysfs function is bat_info_store() but it should be easy to convert rk818_bat_power_supply_changed() info a function that stuffs new values into module variables that can be queried from user space.

For now, just know that the message can be stopped by setting loglevel=6 in the boot.txt file. I'll consider submitting a patch for the driver later.

Actions

Also available in: Atom PDF