Dragonboard 410c usb mode

We are running latest android with “release/android/qcomlt-4.14” kernel mentioned in the following link on dragonboard 410c?

https://www.96boards.org/documentation/consumer/dragonboard/dragonboard410c/guides/aosp.md.html

Dynamic switch of USB OTG between Host and Device mode is not happening during run-time. It is either running only in Host mode or Device mode according to the configurations in dts files in kernel i.e

apq8016-sbc-pmic-pins.dtsi:

usb_sw_sel_pm: usb_sw_sel_pm {
	pinconf {
		pins = "gpio4";
		function = PMIC_GPIO_FUNC_NORMAL;
		power-source = <PM8916_GPIO_VPH>;
		input-disable;
		output-high; // high for Host mode, low for Device mode
	};
};

apq8016-sbc.dtsi:

	usb@78d9000 {
		extcon = <&usb_id>;
		status = "okay";
		adp-disable;
		hnp-disable;
		srp-disable;
		dr_mode = "host"; // host for Host, otg for OTG, peripheral for Device
		pinctrl-names = "default";
		pinctrl-0 = <&usb_sw_sel_pm>;
		ulpi {
			phy {
				v1p8-supply = <&pm8916_l7>;
				v3p3-supply = <&pm8916_l13>;
				extcon = <&usb_id>;
			};
		};
	};

Before running latest version of android we ran pre-builts (i.e following link) in which dynamic switch is happening automatically during run-time.

According to hardware user manual (i.e following link), usb mode is software controlled by using USB_SW_SEL_PM (i.e PMIC GPIO_4) pin. According to dts files no driver is controlling that pin except pin configuration.

What things should be done so that we can switch between Device mode and Host mode during run-time?

You can try to apply the top patches of this branch:
https://git.linaro.org/people/loic.poulain/linux.git/log/?h=qcomlt-4.14-usb
starting at usb: chipidea: Add dynamic pinctrl selection

Let me know…

It is working after applying the patches