Shreeya Patel
Shreeya Patel

Reputation: 135

Is it necessary to include DTS files for the driver?

My goal is to port this driver on current Linux Kernel. Things which I did till now....

1) Downloaded the source code of the current kernel version.

2) Downloaded the dev_parallel.c, Makefile, Kconfig for reworking on the code.

3) Using "make" command I was able to compile the driver with no errors.

4) Using "make modules" command I was able to generate a .o file.

5) Using "make modules_install" command I was able to get the .ko file.

6) Using "modprobe" command I was able to successfully load the module without any kernel panics.

But I see that there is a DTS file for this driver located here. I know that dts files are compiled to dtb files which are read by the kernel during boot time and it automatically loads the module.

But is it necessary to have this DTS file or just modprobe command will do the job for me?

The driver which I am talking about is for an Electronic paper display (EPD).

So If I connect EPD and then do modprobe for loading the driver, will it work or do I need to have DTS file for making it work correctly?

Upvotes: 2

Views: 2170

Answers (1)

Masoud Rahimi
Masoud Rahimi

Reputation: 6051

It is not necessary to use DTS file in a driver but for some reasons like defining pins, setting configurations, etc. It should get parameters from DTS file to prevent user to modify the driver and recompile it.

It seems that your example doesn't get any parameters from the DTS file but on the other side, it hardcoded some pin definitions so you need to take care of them. If you want to force it to read parameters from DTS file you should rewrite the driver. You can use this for driver and this for GPIO. Then you must include the new driver in your current DTS file and recompile it.

For the driver compilation, you can create a kernel module. You can use this tutorial for the basics.

Upvotes: 3

Related Questions