linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] power_supply: Add Apple Brick ID power supply type
@ 2017-05-08 22:02 Benson Leung
  2017-05-15 14:13 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Benson Leung @ 2017-05-08 22:02 UTC (permalink / raw)
  To: sre, linux-pm, linux-kernel; +Cc: ras, tomeu.vizoso, bleung, bleung

Apple currently supports three very common USB chargers:
https://www.apple.com/power-adapters/

These chargers implement a proprietary Apple method for advertising
1A, 2.1A, and 2.4A at 5V called "Brick ID".
In addition, 3rd parties implement the same charging method in many
charging accessories that work with iOS devices.

Devices that have charger detection chips such as the Pericom PI3USB9281,
eg. Google Chromebook Pixel 2015, are capable of detecting
these chargers, so let's add a type to facilicate passing that info
up to userspace.

This adds a separate power supply type for Apple's proprietary
"Brick ID" charging method.

Signed-off-by: Benson Leung <bleung@chromium.org>
---
 drivers/power/supply/power_supply_sysfs.c |  2 +-
 include/linux/power_supply.h              | 15 ++++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
index bcde8d13476a..07b484f995c1 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -46,7 +46,7 @@ static ssize_t power_supply_show_property(struct device *dev,
 	static char *type_text[] = {
 		"Unknown", "Battery", "UPS", "Mains", "USB",
 		"USB_DCP", "USB_CDP", "USB_ACA", "USB_C",
-		"USB_PD", "USB_PD_DRP"
+		"USB_PD", "USB_PD_DRP", "BrickID"
 	};
 	static char *status_text[] = {
 		"Unknown", "Charging", "Discharging", "Not charging", "Full"
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 3965503315ef..4bd34051995e 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -159,13 +159,14 @@ enum power_supply_type {
 	POWER_SUPPLY_TYPE_BATTERY,
 	POWER_SUPPLY_TYPE_UPS,
 	POWER_SUPPLY_TYPE_MAINS,
-	POWER_SUPPLY_TYPE_USB,		/* Standard Downstream Port */
-	POWER_SUPPLY_TYPE_USB_DCP,	/* Dedicated Charging Port */
-	POWER_SUPPLY_TYPE_USB_CDP,	/* Charging Downstream Port */
-	POWER_SUPPLY_TYPE_USB_ACA,	/* Accessory Charger Adapters */
-	POWER_SUPPLY_TYPE_USB_TYPE_C,	/* Type C Port */
-	POWER_SUPPLY_TYPE_USB_PD,	/* Power Delivery Port */
-	POWER_SUPPLY_TYPE_USB_PD_DRP,	/* PD Dual Role Port */
+	POWER_SUPPLY_TYPE_USB,			/* Standard Downstream Port */
+	POWER_SUPPLY_TYPE_USB_DCP,		/* Dedicated Charging Port */
+	POWER_SUPPLY_TYPE_USB_CDP,		/* Charging Downstream Port */
+	POWER_SUPPLY_TYPE_USB_ACA,		/* Accessory Charger Adapters */
+	POWER_SUPPLY_TYPE_USB_TYPE_C,		/* Type C Port */
+	POWER_SUPPLY_TYPE_USB_PD,		/* Power Delivery Port */
+	POWER_SUPPLY_TYPE_USB_PD_DRP,		/* PD Dual Role Port */
+	POWER_SUPPLY_TYPE_APPLE_BRICK_ID,	/* Apple Charging Method */
 };
 
 enum power_supply_notifier_events {
-- 
2.13.0.rc1.294.g07d810a77f-goog

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] power_supply: Add Apple Brick ID power supply type
  2017-05-08 22:02 [PATCH] power_supply: Add Apple Brick ID power supply type Benson Leung
@ 2017-05-15 14:13 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2017-05-15 14:13 UTC (permalink / raw)
  To: Benson Leung; +Cc: linux-pm, linux-kernel, ras, tomeu.vizoso, bleung

[-- Attachment #1: Type: text/plain, Size: 3018 bytes --]

Hi,

On Mon, May 08, 2017 at 03:02:48PM -0700, Benson Leung wrote:
> Apple currently supports three very common USB chargers:
> https://www.apple.com/power-adapters/
> 
> These chargers implement a proprietary Apple method for advertising
> 1A, 2.1A, and 2.4A at 5V called "Brick ID".
> In addition, 3rd parties implement the same charging method in many
> charging accessories that work with iOS devices.
> 
> Devices that have charger detection chips such as the Pericom PI3USB9281,
> eg. Google Chromebook Pixel 2015, are capable of detecting
> these chargers, so let's add a type to facilicate passing that info
> up to userspace.
> 
> This adds a separate power supply type for Apple's proprietary
> "Brick ID" charging method.
> 
> Signed-off-by: Benson Leung <bleung@chromium.org>

Thanks, queued.

-- Sebastian

> ---
>  drivers/power/supply/power_supply_sysfs.c |  2 +-
>  include/linux/power_supply.h              | 15 ++++++++-------
>  2 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
> index bcde8d13476a..07b484f995c1 100644
> --- a/drivers/power/supply/power_supply_sysfs.c
> +++ b/drivers/power/supply/power_supply_sysfs.c
> @@ -46,7 +46,7 @@ static ssize_t power_supply_show_property(struct device *dev,
>  	static char *type_text[] = {
>  		"Unknown", "Battery", "UPS", "Mains", "USB",
>  		"USB_DCP", "USB_CDP", "USB_ACA", "USB_C",
> -		"USB_PD", "USB_PD_DRP"
> +		"USB_PD", "USB_PD_DRP", "BrickID"
>  	};
>  	static char *status_text[] = {
>  		"Unknown", "Charging", "Discharging", "Not charging", "Full"
> diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
> index 3965503315ef..4bd34051995e 100644
> --- a/include/linux/power_supply.h
> +++ b/include/linux/power_supply.h
> @@ -159,13 +159,14 @@ enum power_supply_type {
>  	POWER_SUPPLY_TYPE_BATTERY,
>  	POWER_SUPPLY_TYPE_UPS,
>  	POWER_SUPPLY_TYPE_MAINS,
> -	POWER_SUPPLY_TYPE_USB,		/* Standard Downstream Port */
> -	POWER_SUPPLY_TYPE_USB_DCP,	/* Dedicated Charging Port */
> -	POWER_SUPPLY_TYPE_USB_CDP,	/* Charging Downstream Port */
> -	POWER_SUPPLY_TYPE_USB_ACA,	/* Accessory Charger Adapters */
> -	POWER_SUPPLY_TYPE_USB_TYPE_C,	/* Type C Port */
> -	POWER_SUPPLY_TYPE_USB_PD,	/* Power Delivery Port */
> -	POWER_SUPPLY_TYPE_USB_PD_DRP,	/* PD Dual Role Port */
> +	POWER_SUPPLY_TYPE_USB,			/* Standard Downstream Port */
> +	POWER_SUPPLY_TYPE_USB_DCP,		/* Dedicated Charging Port */
> +	POWER_SUPPLY_TYPE_USB_CDP,		/* Charging Downstream Port */
> +	POWER_SUPPLY_TYPE_USB_ACA,		/* Accessory Charger Adapters */
> +	POWER_SUPPLY_TYPE_USB_TYPE_C,		/* Type C Port */
> +	POWER_SUPPLY_TYPE_USB_PD,		/* Power Delivery Port */
> +	POWER_SUPPLY_TYPE_USB_PD_DRP,		/* PD Dual Role Port */
> +	POWER_SUPPLY_TYPE_APPLE_BRICK_ID,	/* Apple Charging Method */
>  };
>  
>  enum power_supply_notifier_events {
> -- 
> 2.13.0.rc1.294.g07d810a77f-goog
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-15 14:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-08 22:02 [PATCH] power_supply: Add Apple Brick ID power supply type Benson Leung
2017-05-15 14:13 ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).