summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2015-06-19 11:58:48 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-24 23:13:16 +0000
commit68198a2446bd07d670cdd7a0323ded8c4f5d2391 (patch)
treefd25f814856e14eff545788bcf8655e3e86b65e7
parentc650a7391c655bd3394f0c2e68bd9f29f139dd31 (diff)
downloadchrome-ec-68198a2446bd07d670cdd7a0323ded8c4f5d2391.tar.gz
ryu: add missing PD power events
Send PD_EVENT_POWER_CHANGE events for all changes in the type-C/PD configuration to ensure we are not missing any transition from the AP. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=smaug BUG=chrome-os-partner:41676 TEST=On Ryu, plug and unplug type-C chargers, C-to-A receptacle adapters and A-to-C cables and see the proper "extcon" traces in the kernel log. Change-Id: I918b9c42867f069852a2222b0f47ef0df8d124aa Reviewed-on: https://chromium-review.googlesource.com/280870 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/ryu/usb_pd_policy.c12
-rw-r--r--board/ryu_p4p5/usb_pd_policy.c12
2 files changed, 24 insertions, 0 deletions
diff --git a/board/ryu/usb_pd_policy.c b/board/ryu/usb_pd_policy.c
index b783cdc3b8..2e9ad58bf0 100644
--- a/board/ryu/usb_pd_policy.c
+++ b/board/ryu/usb_pd_policy.c
@@ -42,6 +42,9 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
charge.current = max_ma;
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge);
+
+ /* notify host of power info change */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
void typec_set_input_current_limit(int port, uint32_t max_ma,
@@ -51,6 +54,9 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
charge.current = max_ma;
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge);
+
+ /* notify host of power info change */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
int pd_is_valid_input_voltage(int mv)
@@ -96,6 +102,9 @@ int pd_set_power_supply_ready(int port)
gpio_set_level(GPIO_CHGR_OTG, 1);
charger_enable_otg_power(1);
+ /* notify host of power info change */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
+
return EC_SUCCESS; /* we are ready */
}
@@ -104,6 +113,9 @@ void pd_power_supply_reset(int port)
/* Kill VBUS */
charger_enable_otg_power(0);
gpio_set_level(GPIO_CHGR_OTG, 0);
+
+ /* notify host of power info change */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
int pd_snk_is_vbus_provided(int port)
diff --git a/board/ryu_p4p5/usb_pd_policy.c b/board/ryu_p4p5/usb_pd_policy.c
index 07563aebbd..4962a4d044 100644
--- a/board/ryu_p4p5/usb_pd_policy.c
+++ b/board/ryu_p4p5/usb_pd_policy.c
@@ -39,6 +39,9 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
charge.current = max_ma;
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge);
+
+ /* notify host of power info change */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
void typec_set_input_current_limit(int port, uint32_t max_ma,
@@ -48,6 +51,9 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
charge.current = max_ma;
charge.voltage = supply_voltage;
charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge);
+
+ /* notify host of power info change */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
int pd_is_valid_input_voltage(int mv)
@@ -92,6 +98,9 @@ int pd_set_power_supply_ready(int port)
/* provide VBUS */
gpio_set_level(GPIO_USBC_5V_EN, 1);
+ /* notify host of power info change */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
+
return EC_SUCCESS; /* we are ready */
}
@@ -99,6 +108,9 @@ void pd_power_supply_reset(int port)
{
/* Kill VBUS */
gpio_set_level(GPIO_USBC_5V_EN, 0);
+
+ /* notify host of power info change */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
int pd_snk_is_vbus_provided(int port)