I'm currently trying to build one of linux drivers as module (pmod oled driver from Digilent). My board is Zedboard, and I want to make work OLED screen that is onboard. I have chosen Analog Devices kernel tree, because of additional drivers that ADV added there to support HDMI, and audio codec. Here is what I did:
git clone github.com/.../linux.git make zynq_xcomm_adv7511_defconfig make menuconfig -> marked divers/spi/GPIO_bitbang as builtin (this is dependency of pmodoled), and drivers/staging/pmods/pmodoled1 as module make uImage LOADADDR=0x00008000
And everything builded fine, except my OLED module didn't built. I directory /drivers/staging/pmods I only found one, small object file: built-in.o. So here is my first question: why did it happened, and how to make this module build automatically with the kernel?
Actually, I found workaround on this. I did:
make modules SUBDIRS=drivers/staging/pmods/
and module pmodoled-gpio.ko appeared. So I copied it to devicetree, together with scripts for loading pictures to screen, but when I booted linux, and insmoded this module, I get error:
platform spi_gpio.2: spi_busnum_to_master(2) returned NULL pmodoled-gpio zed_oled: add_gpio_pmodoled_device_to_bus failed: -38 Device 'spi_gpio.2' does not have a release() function, it is broken and must be fixed.
I also tried to make it builtin, and this way it works, so it is not devicetree fault. I could leave it like that, but but when I halt system, driver should do specific poweroff sequence on OLED screen, and when driver is builtin it does not do it, and when it is module, it does (in Out-Of-The-Box image it works like that). The fact that it works as builtin also proves that this driver is compatible with this kernel.
So, what could I do to avoid error message above? And maybe there is a way to invoke this poweroff code, when driver is builtin? That would be perfect, as I prefer it to be builtin.
Link to the driver (in linux tree it is on drivers/staging/pmods): https://github.com/analogdevicesinc/linux/blob/xcomm_zynq/drivers/staging/pmods/pmodoled-gpio.c
And link to the documentation on it: https://github.com/analogdevicesinc/linux/blob/xcomm_zynq/Documentation/pmods/pmodoled.txt