Support for PWM7 on Jetson orin NX

Hello every, need some help please on integrating the PWM1/PWM7 on the external header of the dev kit using seeed-j4012 carrier with jetson orin nx 16G SOM, here my device tree configuration.

Note:

  • I already added the support of pwm of backlight in fbtft-core.
  • I see all my data on the spi interface and they are coherent.
  • I see my pwm backlight instance in sysfs and also as a consumer of pwmchip3 (pwm@32e0000).
  • I see my pinmux is applyed.
  • all my drivers are probed form fbtft, pwm, backlight…

Am other last point may I know why the pwm is not officially exposed as pin function in the kernel dts, this will help me to know how to design my stuff around the Jetson products.

I noticed that if we take the jetPack 6.1/6.2 it works only if we use jetson-io to generate an overlay.

Does anyone faced this kind of issue.
Thanks in advance for your support.

/ {
    bus@0 {
        
		backlight_enable: regulator-backlight-enable {
			compatible = "regulator-fixed";
			regulator-name = "BACKLIGHT_ENABLE";
			regulator-min-microvolt = <3300000>;
			regulator-max-microvolt = <3300000>;
			gpio = <&gpio TEGRA234_MAIN_GPIO(N, 1) GPIO_ACTIVE_HIGH>;
			enable-active-high;
		};

        pwm@32e0000 {
			pinctrl-names = "default";
			pinctrl-0 = <&pwm7_pinmux>;
			status = "okay";
		};

         pwm_backlight: pwm-backlight@7 {
			compatible = "pwm-backlight";
			power-supply = <&backlight_enable>;
			pwms = <&pwm7 0 45334>;
		        brightness-levels = <0 51 53 56 62 75 101 152 255>;
			default-brightness-level = <7>;
			status = "okay";
	    };

		spi_hdr40: spi@3210000 {
			num-cs = <1>;
			cs-gpios = <&gpio TEGRA234_MAIN_GPIO(Z, 6) GPIO_ACTIVE_LOW>;
			status = "okay";
            
            /delete-node/ spi@0;

			display@0 {
				compatible = "sitronix,st7789v";
				pinctrl-names = "default";
				pinctrl-0 = <&spi1_pinmux>;
				backlight = <&pwm_backlight>;
                spi-max-frequency = <25000000>;
				reset-gpios = <&gpio TEGRA234_MAIN_GPIO(AC, 6) GPIO_ACTIVE_LOW>;
				dc-gpios = <&gpio TEGRA234_MAIN_GPIO(Z, 7) GPIO_ACTIVE_HIGH>;
				spi-cs-high;
				width = <320>;
				height = <240>;
				buswidth = <8>;
                of_backlight = <1>;
				reg = <0>;
				status = "okay";
			};
		};
    };
};

&pinmux {
	pwm7_pinmux: pinmux-pwm7 {
		hdr40-pin32 {
			nvidia,pins = "soc_gpio19_pg6";
			nvidia,function = "gp";
			nvidia,pin-group = "pwm7";
			nvidia,tristate = <TEGRA_PIN_DISABLE>;
			nvidia,enable-input = <TEGRA_PIN_DISABLE>;		
		};
		
		hdr40-pin15 {
			nvidia,pins = "soc_gpio39_pn1";
			nvidia,function = "gp";
			nvidia,pin-group = "pwm1";
			nvidia,tristate = <TEGRA_PIN_DISABLE>;
			nvidia,enable-input = <TEGRA_PIN_DISABLE>;
		};
	};

	spi1_pinmux: pinmux-spi1 {

		hdr40-pin23 {
			nvidia,pins = "spi1_sck_pz3";
			nvidia,function = "spi1";
			nvidia,pin-label = "spi1_sck";
			nvidia,tristate = <TEGRA_PIN_DISABLE>;
			nvidia,enable-input = <TEGRA_PIN_ENABLE>;
		};
		
		hdr40-pin24 {
			nvidia,pins = "spi1_cs0_pz6";
			nvidia,function = "spi1";
			nvidia,pin-label = "spi1_cs0";
			nvidia,tristate = <TEGRA_PIN_DISABLE>;
			nvidia,enable-input = <TEGRA_PIN_ENABLE>;
		};

		hdr40-pin19 {
			nvidia,pins = "spi1_mosi_pz5";
			nvidia,function = "spi1";
			nvidia,pin-label = "spi1_dout";
			nvidia,tristate = <TEGRA_PIN_DISABLE>;
			nvidia,enable-input = <TEGRA_PIN_ENABLE>;
		};

		hdr40-pin26 {
			nvidia,pins = "spi1_cs1_pz7";
			nvidia,function = "spi1";
			nvidia,pin-label = "spi1_cs1";
			nvidia,tristate = <TEGRA_PIN_DISABLE>;
			nvidia,enable-input = <TEGRA_PIN_ENABLE>;
		};
	};
};

Hello,

Thanks for visiting the NVIDIA Developer forums.

Your topic will be best served in the Jetson category, I have moved this post for better visibility.

Cheers,
Tom

Hi anis.chali,

It seems you are using the custom carrier board from SeeedStudio.
What’s the Jetpack version in use?

Do you mean it could work after using Jetson-IO to configure PWM?

Jetson-IO is used to configure the pinmux.
Is the custom carrier board designed by you?
If not, you may need to request the vendor for the pinmux spreadsheet.

It seems you added a device node to handle with your PWM backlight.
Please also share the full dmesg and device tree for further check.

What’s the Jetpack version in use?

I use meta-tegra on scarthgap, I don’t know which version of jetPack corresponds. My L4T version is 36.4.0.

Do you mean it could work after using Jetson-IO to configure PWM?

When Installing jetPack 6.1/6.2, we use jetson-io and only after configuring the Pinmux with that tool we see our peripherals.

Is the custom carrier board designed by you?

It’s not a custom carrier, we just added custom extension plugged on the RPI 40 Pin Header of the seeed J4012 carrier board.

Please also share the full dmesg and device tree for further check.

Yes of course, but in my dmesg all seems to work and there is no errors.
tegra234-j401-p3768-0000+p3767-0000-recomputer.txt (4.0 KB)
dmesg.txt (48.9 KB)

Do you know why the pin function is not officially supported in the linux pinmux group table ? this will really help to decide what direction to take with our design.

I thought maybe the pinmux is not applied by the mb1/mb2 or is blocked by bootloader firewall, could you please provide details if there is any implication of the mb1/mb2?

Are you using yocto project fro Orin NX?

For us, Seeed J4012 is a custom carrier board designed by SeeedStudio.
We don’t know if they have custom pin definition or design on their board.
You may also request your vendor for the pinmux for this board.

I would expect your overlay should be applied for pinmux@2430000 node in device tree.

Please note that the pinmux/gpio dtsi are loaded in early boot stage(MB1), which is used configured the default state.
If you want to configure the pinmux in kernel, you should add those configurations in pinmux@2430000 node so that tegra pinctrl driver will configure them in kernel.

Thank you for the help, I think I understand, I will force to use a dt overlay in yocto.

Ufortunatly, I forced a dt overlay and it’s not workig. The pinmux seems to be what I pasted before, I took it from the seeed datasheet. What I am unable to determine is what jetson-io is actually doing in runtime to bring up the pwm and this is comming from the nvidia image I guess.

Sorry that I’m not clear about your custom carrier board(Seeed J4012) and the how yocto project works.

Jetson-IO will create a new entry in /boot/extlinux/exlinux.conf and specify the FDT and OVERLAYS to use the DTB and overlay specified.
It may not work on your board since the custom carrier board may have its own design different from the devkit.

pinmux@2430000 in device tree will configure the pinmux for PWM pin.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.