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

Commit 3162c5cb authored by Mayank Rana's avatar Mayank Rana
Browse files

gpio-usbdetect: Update charger type before notifying USB cable status



USB controller driver expects to receive charger type before USB cable
connected or not notification. Without charger type nofication, USB
controller driver doesn't know what is connected on USB port which result
into no USB enumeration when USB cable is connected to SDP port. Hence
update charger type as SDP when USB cable is connected.

Change-Id: If98b0e345e526e51d1d0a103335221153eace4ee
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent 0597b5d5
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -34,8 +34,14 @@ static irqreturn_t gpio_usbdetect_vbus_irq(int irq, void *data)
	int vbus;

	vbus = !!irq_read_line(irq);
	power_supply_set_present(usb->usb_psy, vbus);
	if (vbus)
		power_supply_set_supply_type(usb->usb_psy,
				POWER_SUPPLY_TYPE_USB);
	else
		power_supply_set_supply_type(usb->usb_psy,
				POWER_SUPPLY_TYPE_UNKNOWN);

	power_supply_set_present(usb->usb_psy, vbus);
	return IRQ_HANDLED;
}

@@ -43,7 +49,7 @@ static int gpio_usbdetect_probe(struct platform_device *pdev)
{
	struct gpio_usbdetect *usb;
	struct power_supply *usb_psy;
	int rc, vbus;
	int rc;
	unsigned long flags;

	usb_psy = power_supply_get_by_name("usb");
@@ -101,11 +107,9 @@ static int gpio_usbdetect_probe(struct platform_device *pdev)

	/* Read and report initial VBUS state */
	local_irq_save(flags);
	vbus = !!irq_read_line(usb->vbus_det_irq);
	gpio_usbdetect_vbus_irq(usb->vbus_det_irq, usb);
	local_irq_restore(flags);

	power_supply_set_present(usb->usb_psy, vbus);

	return 0;
}