summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lok <ben.lok@mediatek.com>2015-11-24 14:34:34 +0800
committerchrome-bot <chrome-bot@chromium.org>2015-12-01 01:11:04 -0800
commit9ea7ca8d87a5d6d9a8ff8e95230d7f38ee2f1eda (patch)
tree3172cfa2691a46f9ab00e665e47fc183892d6e20
parentaf3172cd7ef56ab1f3ff835aad62ff7196960f1a (diff)
downloadchrome-ec-9ea7ca8d87a5d6d9a8ff8e95230d7f38ee2f1eda.tar.gz
pd: send power change event to AP whenever input power is changed
Send power change event to AP whenever input power is changed, ensure that AP gets the latest power charging info. BUG=chrome-os-partner:47677 BRANCH=none TEST=tested on Oak by plug/unplug AC adapter to type-C ports and verifying the UI battery icon shows the correct status instantly. Change-Id: I7465afcd8bc9b1c56ecf70fc74446866a8ab1b9a Signed-off-by: Ben Lok <ben.lok@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/313926 Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r--board/chell/usb_pd_policy.c5
-rw-r--r--board/glados/usb_pd_policy.c5
-rw-r--r--board/kunimitsu/usb_pd_policy.c5
-rw-r--r--board/lars/usb_pd_policy.c5
-rw-r--r--board/oak/usb_pd_policy.c6
5 files changed, 26 insertions, 0 deletions
diff --git a/board/chell/usb_pd_policy.c b/board/chell/usb_pd_policy.c
index b1a65b73bf..cc2c87d239 100644
--- a/board/chell/usb_pd_policy.c
+++ b/board/chell/usb_pd_policy.c
@@ -56,6 +56,9 @@ int pd_set_power_supply_ready(int port)
gpio_set_level(port ? GPIO_USB_C1_5V_EN :
GPIO_USB_C0_5V_EN, 1);
+ /* notify host of power info change */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
+
return EC_SUCCESS; /* we are ready */
}
@@ -80,6 +83,7 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge);
#endif
/* 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,
@@ -94,6 +98,7 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
#endif
/* 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/glados/usb_pd_policy.c b/board/glados/usb_pd_policy.c
index ff88ede3bc..e07454e887 100644
--- a/board/glados/usb_pd_policy.c
+++ b/board/glados/usb_pd_policy.c
@@ -56,6 +56,9 @@ int pd_set_power_supply_ready(int port)
gpio_set_level(port ? GPIO_USB_C1_5V_EN :
GPIO_USB_C0_5V_EN, 1);
+ /* notify host of power info change */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
+
return EC_SUCCESS; /* we are ready */
}
@@ -79,6 +82,7 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge);
#endif
/* 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,
@@ -92,6 +96,7 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
#endif
/* 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/kunimitsu/usb_pd_policy.c b/board/kunimitsu/usb_pd_policy.c
index 6489d0e391..b8a9ad3c67 100644
--- a/board/kunimitsu/usb_pd_policy.c
+++ b/board/kunimitsu/usb_pd_policy.c
@@ -56,6 +56,9 @@ int pd_set_power_supply_ready(int port)
gpio_set_level(port ? GPIO_USB_C1_5V_EN :
GPIO_USB_C0_5V_EN, 1);
+ /* notify host of power info change */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
+
return EC_SUCCESS; /* we are ready */
}
@@ -79,6 +82,7 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge);
#endif
/* 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,
@@ -92,6 +96,7 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
#endif
/* 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/lars/usb_pd_policy.c b/board/lars/usb_pd_policy.c
index f3877a0241..419a805a22 100644
--- a/board/lars/usb_pd_policy.c
+++ b/board/lars/usb_pd_policy.c
@@ -59,6 +59,9 @@ int pd_set_power_supply_ready(int port)
/* Provide VBUS */
gpio_set_level(GPIO_USB_C0_5V_EN, 1);
+ /* notify host of power info change */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
+
return EC_SUCCESS; /* we are ready */
}
@@ -82,6 +85,7 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge);
#endif
/* 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,
@@ -96,6 +100,7 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
#endif
/* 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/oak/usb_pd_policy.c b/board/oak/usb_pd_policy.c
index 33009e763e..9a37c8b205 100644
--- a/board/oak/usb_pd_policy.c
+++ b/board/oak/usb_pd_policy.c
@@ -56,6 +56,9 @@ int pd_set_power_supply_ready(int port)
gpio_set_level(port ? GPIO_USB_C1_5V_EN :
GPIO_USB_C0_5V_EN, 1);
+ /* notify host of power info change */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
+
return EC_SUCCESS; /* we are ready */
}
@@ -65,6 +68,7 @@ void pd_power_supply_reset(int port)
gpio_set_level(port ? GPIO_USB_C1_5V_EN :
GPIO_USB_C0_5V_EN, 0);
+ /* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -78,6 +82,7 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge);
#endif
/* 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,
@@ -91,6 +96,7 @@ void typec_set_input_current_limit(int port, uint32_t max_ma,
#endif
/* notify host of power info change */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
int pd_board_checks(void)