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

Commit 8374a362 authored by Sujeet Kumar's avatar Sujeet Kumar
Browse files

USB: android: Enable cdrom lun creation from device tree



Allow lun information to be passed via DT and
create cdrom LUN if cdrom property is set.

A composition switch from default to mass_storage
based composition would create the LUNs but the
cdrom LUN cant be mounted because init script
only run once during the boot and hence there
is no place to detect LUN creation and mount
the cdrom media.

To overcome this issue, create LUN using previous
mechanism where LUN is created during the bootup
time itself.

CRs-Fixed: 594147
Change-Id: I7af82a93f15c530b6295f83e5385ccc181dfbade
Signed-off-by: default avatarSujeet Kumar <ksujeet@codeaurora.org>
parent 67683add
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -232,6 +232,8 @@ Optional properties :
  turnaround timeout is observed on enabling streaming. Hence it is required
  to see these errors and number of erros on enabling this at USB level to make
  final decision to enable this feature or not.
- qcom,android-usb-cdrom : if this property is present then device creates
  a new LUN as CD-ROM.
- qcom,android-usb-uicc-nluns : Number of mass storage LUNs (8 bits) required
  for the UICC card.
Example Android USB device node :
+10 −0
Original line number Diff line number Diff line
@@ -2208,6 +2208,14 @@ static int mass_storage_function_init(struct android_usb_function *f,
	snprintf(name[0], MAX_LUN_NAME, "lun");
	config->fsg.luns[0].removable = 1;

	if (dev->pdata && dev->pdata->cdrom) {
		config->fsg.luns[config->fsg.nluns].cdrom = 1;
		config->fsg.luns[config->fsg.nluns].ro = 1;
		config->fsg.luns[config->fsg.nluns].removable = 0;
		snprintf(name[config->fsg.nluns], MAX_LUN_NAME, "rom");
		config->fsg.nluns++;
	}

	if (uicc_nluns > FSG_MAX_LUNS - config->fsg.nluns) {
		uicc_nluns = FSG_MAX_LUNS - config->fsg.nluns;
		pr_debug("limiting uicc luns to %d\n", uicc_nluns);
@@ -3532,6 +3540,8 @@ static int android_probe(struct platform_device *pdev)

		pdata->streaming_func_count = len;

		pdata->cdrom = of_property_read_bool(pdev->dev.of_node,
			"qcom,android-usb-cdrom");
		ret = of_property_read_u8(pdev->dev.of_node,
				"qcom,android-usb-uicc-nluns",
				&pdata->uicc_nluns);
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ struct android_usb_platform_data {
	char streaming_func[MAX_STREAMING_FUNCS][FUNC_NAME_LEN];
	int  streaming_func_count;
	u8 uicc_nluns;
	bool cdrom;
};

#ifndef CONFIG_TARGET_CORE