Re: [PATCH] power:power_supply_syfs : Treat PROP_TYPE as a regularattribute first

From: Anton Vorontsov
Date: Fri Oct 25 2013 - 18:15:14 EST


On Thu, Aug 15, 2013 at 02:09:58AM +0300, Philippe De Swert wrote:
> These days we often have USB powered devices. This means that often the
> type is variable. Common examples are smartphones which can be charged
> through a normal USB port on a PC/laptop, a dedicated charger, etc...
> Often those chips also have support for other charger types like a
> mains/DC charger. This means that often there are several psy structures
> in the driver and makes it impossible to stick to just one type.

I would guess that a lot of userland code assumes that the type is fixed.
We can't break this assumption. Plus I don't think we really need the
changing types.

> Userspace sometimes needs to behave differently based on the type of charger
> connected to such devices.

A system with several charger should either:

1. Register all of them (mains, usb, etc.) as a separate power supply
device, and then use PROP_ONLINE to specify whether something is connected
to the port or not.

2. Register only the charger type that is currently connected to the
system.

This is how we've been doing things from the very start.

Thanks,

Anton
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/