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

Commit 5d2aa83e authored by Harsh Agarwal's avatar Harsh Agarwal Committed by Mayank Rana
Browse files

usb: core: Add marker for device enumeration



Add markers when a new device is configured or an existing device
is reset. This is required to capture USB host-mode boot KPIs on
some platforms.

Change-Id: I72136942359076e34c1e6ae67cbe099216630400
Signed-off-by: default avatarHarsh Agarwal <harshq@codeaurora.org>
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent c5cf46ec
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -30,6 +30,9 @@
#include <linux/random.h>
#include <linux/pm_qos.h>
#include <linux/kobject.h>
#ifdef CONFIG_QGKI_MSM_BOOT_TIME_MARKER
#include <soc/qcom/boot_stats.h>
#endif

#include <linux/uaccess.h>
#include <asm/byteorder.h>
@@ -5712,6 +5715,7 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
	struct usb_hcd			*hcd = bus_to_hcd(udev->bus);
	struct usb_device_descriptor	descriptor = udev->descriptor;
	struct usb_host_bos		*bos;
	char				buf[50];
	int				i, j, ret = 0;
	int				port1 = udev->portnum;

@@ -5792,6 +5796,18 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
	mutex_unlock(hcd->bandwidth_mutex);
	usb_set_device_state(udev, USB_STATE_CONFIGURED);

	/* Skip this marker for root-hubs */
	if (udev->parent != NULL) {
		scnprintf(buf, sizeof(buf),
				"USB device reset with VID=%04x, PID=%04x ",
				le16_to_cpu(udev->descriptor.idVendor),
				le16_to_cpu(udev->descriptor.idProduct));
		dev_info(&udev->dev, "%s\n", buf);
#ifdef CONFIG_QGKI_MSM_BOOT_TIME_MARKER
		place_marker(buf);
#endif
	}

	/* Put interfaces back into the same altsettings as before.
	 * Don't bother to send the Set-Interface request for interfaces
	 * that were already in altsetting 0; besides being unnecessary,
+16 −0
Original line number Diff line number Diff line
@@ -20,6 +20,9 @@
#include <linux/usb/hcd.h>	/* for usbcore internals */
#include <linux/usb/of.h>
#include <asm/byteorder.h>
#ifdef CONFIG_QGKI_MSM_BOOT_TIME_MARKER
#include <soc/qcom/boot_stats.h>
#endif

#include "usb.h"

@@ -1808,6 +1811,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
	struct usb_host_config *cp = NULL;
	struct usb_interface **new_interfaces = NULL;
	struct usb_hcd *hcd = bus_to_hcd(dev->bus);
	char buf[50];
	int n, nintf;

	if (dev->authorized == 0 || configuration == -1)
@@ -1990,6 +1994,18 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
	}
	usb_set_device_state(dev, USB_STATE_CONFIGURED);

	/* Skip this marker for root-hubs */
	if (dev->parent != NULL) {
		scnprintf(buf, sizeof(buf),
				"New USB device found, VID=%04x, PID=%04x ",
				le16_to_cpu(dev->descriptor.idVendor),
				le16_to_cpu(dev->descriptor.idProduct));
		dev_info(&dev->dev, "%s\n", buf);
#ifdef CONFIG_QGKI_MSM_BOOT_TIME_MARKER
		place_marker(buf);
#endif
	}

	if (cp->string == NULL &&
			!(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS))
		cp->string = usb_cache_string(dev, cp->desc.iConfiguration);