Jump to content

Recommended Posts

Posted

Hi

 

I want to work with g_audio drivers on the usb type c otg port.

When I build the image with current kernel, by applying the following overlay (I only change dr_mode to peripheral)  i am able to convert the usb port in peripheral mode and successfully load the g_audio drivers and audio interfaces also come up.

/dts-v1/;
/plugin/;

/ {
    compatible = "rockchip,rk3588s";

    fragment@0 {
        target = <&usb_host0_xhci>;  // This matches the label in the device tree

        __overlay__ {
            dr_mode = "peripheral";
        };
    };
};


But when i want to do similar with the vendor kernel, which has different device tree, changing dr_mode doesn't work.

/dts-v1/;
/plugin/;

/ {
    compatible = "rockchip,rk3588s";

    fragment@0 {
        target = <&usbdrd3_0>;  // Target the usbdrd3_0 node

        __overlay__ {
            usb@fc000000 {
                dr_mode = "peripheral";  // Change dr_mode to peripheral
            };
        };
    };
};


The device trees for usb type c port for both kernels are as below -

//***This node is of current kernel***
usb@fc000000 {
		power-domains = <0x21 0x1f>;
		snps,dis-u1-entry-quirk;
		snps,dis_enblslpm_quirk;
		phy-names = "usb2-phy\0usb3-phy";
		clock-names = "ref_clk\0suspend_clk\0bus_clk";
		snps,dis-u2-freeclk-exists-quirk;
		usb-role-switch;
		phy_type = "utmi_wide";
		resets = <0x1f 0x152>;
		interrupts = <0x00 0xdc 0x04 0x00>;
		clocks = <0x1f 0x194 0x1f 0x193 0x1f 0x192>;
		snps,dis-u2-entry-quirk;
		compatible = "rockchip,rk3588-dwc3\0snps,dwc3";
		snps,dis-del-phy-power-chg-quirk;
		status = "okay";
		phys = <0x23 0x24 0x04>;
		reg = <0x00 0xfc000000 0x00 0x400000>;
		phandle = <0x116>;
		dr_mode = "peripheral";
		snps,dis-tx-ipgap-linecheck-quirk;

		port {

			endpoint {
				remote-endpoint = <0x25>;
				phandle = <0xeb>;
			};
		};
	};


------------
dmesg output
[   15.417624] i2c 6-0022: deferred probe pending: typec_fusb302: cannot register tcpm port
[  600.475296] g_audio gadget.0: Linux USB Audio Gadget, version: Feb 2, 2012
[  600.475317] g_audio gadget.0: g_audio ready


Vendor Kernel

//***This node is of vendor kernel
	usbdrd3_0 {
		#address-cells = <0x02>;
		clock-names = "ref\0suspend\0bus";
		clocks = <0x02 0x1a3 0x02 0x1a2 0x02 0x1a1>;
		#size-cells = <0x02>;
		compatible = "rockchip,rk3588-dwc3\0rockchip,rk3399-dwc3";
		ranges;
		status = "okay";
		phandle = <0x22b>;

		usb@fc000000 {
			power-domains = <0x06 0x1f>;
			snps,dis-u1-entry-quirk;
			snps,dis_enblslpm_quirk;
			phy-names = "usb2-phy\0usb3-phy";
			snps,dis-u2-freeclk-exists-quirk;
			usb-role-switch;
			phy_type = "utmi_wide";
			quirk-skip-phy-init;
			resets = <0x02 0x2a4>;
			interrupts = <0x00 0xdc 0x04>;
			snps,dis-u2-entry-quirk;
			compatible = "snps,dwc3";
			snps,parkmode-disable-hs-quirk;
			snps,dis-del-phy-power-chg-quirk;
			status = "okay";
			snps,parkmode-disable-ss-quirk;
			phys = <0x74 0x75>;
			reg = <0x00 0xfc000000 0x00 0x400000>;
			phandle = <0x22c>;
			dr_mode = "otg";
			reset-names = "usb3-otg";
			snps,dis-tx-ipgap-linecheck-quirk;

			port {
				#address-cells = <0x01>;
				#size-cells = <0x00>;

				endpoint@0 {
					remote-endpoint = <0x76>;
					reg = <0x00>;
					phandle = <0x183>;
				};
			};
		};
	};

//dmesg output
[   41.238153] [GTP-ERR][__do_register_ext_module:79] Module [goodix-fwu] timeout
[  243.574594] g_audio gadget.0: Hardware params: access 3, format 2, channels 2, rate 48000
[  243.574756] g_audio gadget.0: Linux USB Audio Gadget, version: Feb 2, 2012
[  243.574773] g_audio gadget.0: g_audio ready
[  243.578558] typec_fusb302 6-0022: Looking up vbus-supply from device tree
[  243.581576] dwc3 fcd00000.usb: device reset





Can some one help me what kind of overlay should i make to convert the port to peripheral mode.


 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines