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>
This commit is contained in:
Ben Lok
2015-11-24 14:34:34 +08:00
committed by chrome-bot
parent af3172cd7e
commit 9ea7ca8d87
5 changed files with 26 additions and 0 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)