Enabling PWM in R21.4

Hi all,

I have had the TK1 for about a month and am now trying to figure out how to get PWM working so I can use it to control 2 motors and a linear actuator. I have been following the guide at http://elinux.org/Jetson/PWM#PWM, and from my understanding it seems that I should be able to get PWM working in R21 by applying a few patches via Git. These patches are listed on that elinux page. That being said, I have been unable to figure out where and how exactly that patch is applied (my apologies, git is far from my strong suit - in the past I have just used SourceTree as a means to circumvent Git Bash). Would anyone be provide a bit more complete instruction on how to install these patches?

Much thanks,

The patches shown are not actually “a git thing”, but git was shown in order to identify which files the patch is comparing. The “diff” command is illustrating the changes the patch will make compared to the unpatched source regardless of whether or not git provided one of the sources.

This part of the diff says there are two source trees looking at file “tegra124-jetson_tk1-gpio-pm375-0000-c00-00.dtsi” in kernel source subdirectory “arch/arm/boot/dts/tegra124-platforms/”:

--- a/arch/arm/boot/dts/tegra124-platforms/tegra124-jetson_tk1-gpio-pm375-0000-c00-00.dtsi
+++ b/arch/arm/boot/dts/tegra124-platforms/tegra124-jetson_tk1-gpio-pm375-0000-c00-00.dtsi

So if you are manually exploring or hand editing, you’d go to your unpatched kernel source and look at subdirectory “arch/arm/boot/dts/tegra124-platforms/”, then edit file “tegra124-jetson_tk1-gpio-pm375-0000-c00-00.dtsi”.

The rest of the patch simply identifies line numbers in a way that the patch command can use to remove lines, add lines, or leave lines alone. Mostly you will see a line removal followed by a line addition if a line is edited. Lines can also be added without removing something, or lines can be removed and nothing added back. The leading “+” or “-” tells you if it is an addition or removal. A “-” followed by a “+” just means an edit. The notation “@@ -36,10 +36,7 @@” says this is about 10 lines of the first file, and after patch, the second file will have 7 lines. In both cases of the source and destination, the block of lines start at line 36:

@@ -36,10 +36,7 @@
gpio-output-low = <

The above sample from the PWM patch URL means you are removing three lines and not adding anything back. The patch command can be used to automate this if you have both the unpatched file and the patch (but not the end product…once patch is done, you will have end product).

So basically you start with the kernel source from the download page of L4T R21.4.