From d997e3a57c6e83fa651b6f9daa80ac308b17c51f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Mon, 22 Jun 2020 02:28:01 +0200
Subject: power: supply: Add support for USB_BC_ENABLED and
 USB_DCP_INPUT_CURRENT_LIMIT

- USB_BC_ENABLED - enabling/disabling BC 1.2 USB type detection
- USB_DCP_INPUT_CURRENT_LIMIT - setting a default current limit for DCP/CDP
                                ports

Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
 drivers/power/supply/power_supply_sysfs.c | 2 ++
 include/linux/power_supply.h              | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
index edb058c19c9c..430d64b974c0 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -213,6 +213,8 @@ static struct power_supply_attr power_supply_attrs[] __ro_after_init = {
 	POWER_SUPPLY_ATTR(TIME_TO_FULL_AVG),
 	POWER_SUPPLY_ENUM_ATTR(TYPE),
 	POWER_SUPPLY_ENUM_ATTR(USB_TYPE),
+	POWER_SUPPLY_ATTR(USB_BC_ENABLED),
+	POWER_SUPPLY_ATTR(USB_DCP_INPUT_CURRENT_LIMIT),
 	POWER_SUPPLY_ENUM_ATTR(SCOPE),
 	POWER_SUPPLY_ATTR(PRECHARGE_CURRENT),
 	POWER_SUPPLY_ATTR(CHARGE_TERM_CURRENT),
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 6ed53b292162..dec890d882c2 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -166,6 +166,8 @@ enum power_supply_property {
 	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
 	POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
 	POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */
+	POWER_SUPPLY_PROP_USB_BC_ENABLED,
+	POWER_SUPPLY_PROP_USB_DCP_INPUT_CURRENT_LIMIT,
 	POWER_SUPPLY_PROP_USB_TYPE,
 	POWER_SUPPLY_PROP_SCOPE,
 	POWER_SUPPLY_PROP_PRECHARGE_CURRENT,
-- 
2.35.3

