Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2764b53e authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "soc: eud: Fix event handling for input suspend/unsuspend"

parents 21161da7 831c82ec
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ struct eud_chip {
	struct extcon_dev		*extcon;
	struct uart_port		port;
	struct work_struct		eud_work;
	struct power_supply		*batt_psy;
};

static const unsigned int eud_extcon_cable[] = {
@@ -180,17 +181,33 @@ static const struct kernel_param_ops eud_param_ops = {

module_param_cb(enable, &eud_param_ops, &enable, 0644);

static bool is_batt_available(struct eud_chip *chip)
{
	if (!chip->batt_psy)
		chip->batt_psy = power_supply_get_by_name("battery");

	if (!chip->batt_psy)
		return false;

	return true;
}

static void eud_event_notifier(struct work_struct *eud_work)
{
	struct eud_chip *chip = container_of(eud_work, struct eud_chip,
					eud_work);
	union power_supply_propval pval;

	if (chip->int_status == EUD_INT_VBUS)
		extcon_set_state_sync(chip->extcon, chip->extcon_id,
					chip->usb_attach);
	else if (chip->int_status == EUD_INT_CHGR)
		extcon_set_state_sync(chip->extcon, chip->extcon_id,
					chip->chgr_enable);
	else if (chip->int_status == EUD_INT_CHGR) {
		if (is_batt_available(chip)) {
			pval.intval = !chip->chgr_enable;
			power_supply_set_property(chip->batt_psy,
				POWER_SUPPLY_PROP_INPUT_SUSPEND, &pval);
		}
	}
}

static void usb_attach_detach(struct eud_chip *chip)