muc_uart: Add VBUS Flag

Check the VOLTAGE_NOW property and if it is above 2 V
send back to MUC that VBUS is present.  This is needed
mostly for Factory test but might come in hPerry later on.

Change-Id: I16688520611e6087fb04a7cf8006db71496ec519
Signed-off-by: Kenny Kessler <kenny.kessler@motorola.com>
Reviewed-on: https://gerrit.mot.com/1259770
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Ryan Lattrel <ryanl@motorola.com>
Reviewed-by: Sridhar Vashist <svashist@motorola.com>
Reviewed-by: Kenneth Kessler <kennykessler@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Kenny Kessler 2018-10-23 16:17:18 -05:00 • committed by Kenneth Kessler
commit bc05412b1f
2 changed files with 6 additions and 0 deletions

View file

@ -63,6 +63,7 @@ struct power_status_t {
bool dc_in; /* DC IN Enabled. */
bool charging; /* Battery Charging. */
bool charger; /* MOD USBC Attached. */
bool vbus; /* VBUS Present */
int16_t battery_temp; /* Degrees Celsius */
uint16_t battery_capacity; /* % Capacity */
uint16_t battery_max_capacity; /* mAhr */

View file

@ -604,6 +604,7 @@ static int muc_uart_send_bootmode(struct mod_muc_data_t *mm_data)
sizeof(struct boot_mode_t));
}
#define VBUS_PRESENT_UV 2000000
static int muc_uart_send_power_status(struct mod_muc_data_t *mm_data)
{
struct power_status_t pstatus;
@ -675,6 +676,10 @@ static int muc_uart_send_power_status(struct mod_muc_data_t *mm_data)
POWER_SUPPLY_PROP_PRESENT, &pval))
pstatus.dc_in = pval.intval ? 1 : 0;
if (!power_supply_get_property(mm_data->usb_psy,
POWER_SUPPLY_PROP_VOLTAGE_NOW, &pval))
pstatus.vbus = (pval.intval >= VBUS_PRESENT_UV) ? 1 : 0;
/* TODO */
/* pstatus.reverse_boost;
* pstatus.mod_output_current;