Re: [PATCH v1 2/6] power: supply: Add battery gauge driver for Acer Iconia Tab A500

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, Aug 24, 2020 at 09:55:14PM +0300, Dmitry Osipenko wrote:
> 24.08.2020 17:07, Sebastian Reichel пишет:
> >> +static int a500_battery_get_serial_number(struct a500_battery *bat,
> >> +					  union power_supply_propval *val)
> >> +{
> >> +	unsigned int i;
> >> +	s32 ret = 0;
> >> +
> >> +	if (bat->serial[0])
> >> +		goto done;
> >> +
> >> +	a500_ec_lock(bat->ec_chip);
> >> +	for (i = 0; i < BATTERY_SERIAL_LEN / 2; i++) {
> >> +		ret = a500_ec_read_locked(bat->ec_chip,
> >> +					  &ec_data[REG_SERIAL_NUMBER].cmd);
> >> +		if (ret < 0) {
> >> +			bat->serial[0] = '\0';
> >> +			break;
> >> +		}
> >> +
> >> +		bat->serial[i * 2 + 0] = (ret >> 0) & 0xff;
> >> +		bat->serial[i * 2 + 1] = (ret >> 8) & 0xff;
> >> +	}
> >> +	a500_ec_unlock(bat->ec_chip);
> >> +done:
> >> +	val->strval = bat->serial;
> >> +
> >> +	return ret;
> >> +}
> > 
> > If battery is swapped, this will keep the old serial.
> 
> Hello, Sebastian! The battery isn't hot-swappable on A500, but it also
> should be okay to always re-read the serialno. I'll consider removing
> the caching in the v2, thanks.

I assumed it would be hot-swappable because of a500_battery_get_presence().
If it's not hot-swappable, the caching is fine.

-- Sebastian

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux