Re: [PATCH 3/7] power_supply : add supported charger cable feature
From: Anton Vorontsov
Date: Sun Nov 18 2012 - 19:55:55 EST
On Thu, Oct 18, 2012 at 10:14:02PM +0530, Jenny TC wrote:
> A charger can support different types of charger sources (cables).
> It make sense to define a field to inform the power supply subsystem
> what kind of cable a charger driver supports. Since a bitmask would
> be the easy way to do define, it's good to have a enum which has
> the bitmask definition for each cable types
>
> Signed-off-by: Jenny TC <jenny.tc@xxxxxxxxx>
> ---
> include/linux/power_supply.h | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
> index 7c06956..eea1709 100644
> --- a/include/linux/power_supply.h
> +++ b/include/linux/power_supply.h
> @@ -163,6 +163,21 @@ enum power_supply_type {
> POWER_SUPPLY_TYPE_USB_ACA, /* Accessory Charger Adapters */
> };
>
> +enum power_supply_charger_cable_type {
> + POWER_SUPPLY_CHARGER_TYPE_NONE = 0,
> + POWER_SUPPLY_CHARGER_TYPE_USB_SDP = 1 << 0,
> + POWER_SUPPLY_CHARGER_TYPE_USB_DCP = 1 << 1,
> + POWER_SUPPLY_CHARGER_TYPE_USB_CDP = 1 << 2,
> + POWER_SUPPLY_CHARGER_TYPE_USB_ACA = 1 << 3,
> + POWER_SUPPLY_CHARGER_TYPE_AC = 1 << 4,
> +};
> +
> +#define POWER_SUPPLY_CHARGER_TYPE_USB \
> + (POWER_SUPPLY_CHARGER_TYPE_USB_SDP | \
> + POWER_SUPPLY_CHARGER_TYPE_USB_DCP | \
> + POWER_SUPPLY_CHARGER_TYPE_USB_CDP | \
> + POWER_SUPPLY_CHARGER_TYPE_USB_ACA)
> +
> union power_supply_propval {
> int intval;
> const char *strval;
> @@ -175,6 +190,7 @@ struct power_supply {
> size_t num_properties;
>
> char **supplied_to;
> + unsigned long supported_cables;
Enums have an integer resolution. Why do we need long type here?..
Thanks.
> size_t num_supplicants;
>
> int (*get_property)(struct power_supply *psy,
> --
> 1.7.9.5
--
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/