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

Commit 3a02bffa authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "USB: android: Add support to get usb-core-id using devicetree"

parents 2a4b26db f292fa9f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -23,6 +23,9 @@ Optional properties :
  a new LUN as CD-ROM.
- qcom,android-usb-uicc-nluns : Number of mass storage LUNs (8 bits) required
  for the UICC card.
- qcom,usb-core-id: Index to refer USB hardware core to bind android gadget driver
  with UDC if multiple USB peripheral controllers are present. If unspecified,
  core is set to zero by default.
Example Android USB device node :
	android_usb@fc42b0c8 {
		compatible = "qcom,android-usb";
@@ -30,4 +33,5 @@ Example Android USB device node :
		qcom,android-usb-swfi-latency = <1>;
		qcom,streaming-func = "rndis","mtp";
		qcom,android-usb-uicc-nluns = /bits/ 8 <1>;
		qcom,usb-core-id = <1>;
	};
+13 −4
Original line number Diff line number Diff line
@@ -3449,6 +3449,7 @@ static int android_create_device(struct android_dev *dev, u8 usb_core_id)
	 */
	snprintf(device_node_name, ANDROID_DEVICE_NODE_NAME_LENGTH,
		 "android%d", usb_core_id);
	pr_debug("%s(): creating android%d device\n", __func__, usb_core_id);
	dev->dev = device_create(android_class, NULL,
					MKDEV(0, 0), NULL, device_node_name);
	if (IS_ERR(dev->dev))
@@ -3565,6 +3566,7 @@ static int android_probe(struct platform_device *pdev)
	struct android_dev *android_dev;
	struct resource *res;
	int ret = 0, i, len = 0;
	u32 usb_core_id = 0;

	if (pdev->dev.of_node) {
		dev_dbg(&pdev->dev, "device tree enabled\n");
@@ -3577,6 +3579,11 @@ static int android_probe(struct platform_device *pdev)
		of_property_read_u32(pdev->dev.of_node,
				"qcom,android-usb-swfi-latency",
				&pdata->swfi_latency);
		ret = of_property_read_u32(pdev->dev.of_node,
					"qcom,usb-core-id",
					&usb_core_id);
		if (!ret)
			pdata->usb_core_id = usb_core_id;

		len = of_property_count_strings(pdev->dev.of_node,
				"qcom,streaming-func");
@@ -3657,15 +3664,17 @@ static int android_probe(struct platform_device *pdev)
	}

	if (pdata)
		ret = android_create_device(android_dev, pdata->usb_core_id);
	else
		ret = android_create_device(android_dev, 0);

		android_usb_driver.gadget_driver.usb_core_id =
						pdata->usb_core_id;
	ret = android_create_device(android_dev,
			android_usb_driver.gadget_driver.usb_core_id);
	if (ret) {
		pr_err("%s(): android_create_device failed\n", __func__);
		goto err_dev;
	}

	pr_debug("%s(): registering android_usb_driver with core id:%d\n",
		__func__, android_usb_driver.gadget_driver.usb_core_id);
	ret = usb_composite_probe(&android_usb_driver);
	if (ret) {
		/* Perhaps UDC hasn't probed yet, try again later */