LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   "Back-porting" silead GSL1680 touchscreen driver on custom linux board(Emcraft BSP) (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/back-porting-silead-gsl1680-touchscreen-driver-on-custom-linux-board-emcraft-bsp-4175622042/)

vegeta1in 01-20-2018 08:25 AM

"Back-porting" silead GSL1680 touchscreen driver on custom linux board(Emcraft BSP)
 
Hi all,

I am working on a project with a custom linux board(https://www.emcraft.com/products/777) and I am looking to integrate a touch-screen device with it(based on silead gsl1680). I referred to this patch https://patchwork.kernel.org/patch/9172645/ and did the following things with a hope to compile the code with the custom TS.

1) add silead_gsl1680.txt in -> /Documentation/devicetree/bindings/input/touchscreen
2) change Kconfig found in -> drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
3) change makefile in -> drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
4) add silead.c in -> /drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c
5) Also added the relevant information in the .kernel file ==> CONFIG_TOUCHSCREEN_SILEAD=y and commented out the goodix config.


However, I get an error saying
Code:

drivers/input/touchscreen/silead.c:79:32: error: field 'prop' has incomplete type
  struct touchscreen_properties prop;
                                ^
drivers/input/touchscreen/silead.c: In function 'silead_ts_request_input_dev':
drivers/input/touchscreen/silead.c:106:2: error: too many arguments to function 'touchscreen_parse_properties'
  touchscreen_parse_properties(data->input, true, &data->prop);

I asked this question to the BSP vendor and he said that apparently the driver is not compatible with the Emcraft kernel version, so I would have to make them manually compatible("backporting").
How do I go about doing that?

Also, my LCD vendor has provided another set of .c and .h files for this particular LCD screen, but after putting them in my linux tree, I get an error saying

Code:

fatal error: linux/earlysuspend.h: No such file or directory. Compilation terminated
I am not sure how to go about this stuff. Any pointers would be very much appreciated.

Thanks

Mara 01-21-2018 04:58 AM

To help you it will be useful to know which version of the kernel you're on right now and which version the driver did work with. The reason is that the internal kernel interfaces do change and drivers needs to adapt. Those included in the mainline are modified each time the interface changes. Those that are not.. well.. that's exactly your case.

With the first code example, you have an error about touchscreen_parse_properties. In he latest kernels it has the following parameters:
Code:

void touchscreen_parse_properties(struct input_dev *input, bool multitouch,
                                  struct touchscreen_properties *prop);

But in 4.4 it was:
Code:

void touchscreen_parse_properties(struct input_dev *dev, bool multitouch);
It seems to me that your kernel is closer to 4.4 than to 4.15. It means that you should remove the prop parameter and check how to pass the data to the right function so that the end result is the same.

If you want to compare code between different kernel versions you can use sites like: https://elixir.free-electrons.com/linux/

vegeta1in 01-22-2018 01:59 AM

Hi Mara,

Thanks a lot for the reply. I see. The version I am using right now is => 4.5.0
I didn't quite get what you mean by "which version the driver did work with", but I did use the source-code in the current linux kernel source tree from git-hub (which is 4.15.0) for compiling. No surprises it didn't compile.

I checked the repository and silead.c does not exist for v4.5.0, and I am not too confident of changing the device driver source file itself since I have absolutely no experience in doing so. But if that is the only way, I will have to go for it. Is there any easier way?

Thanks again!

Mara 01-22-2018 04:24 PM

Is this the same driver as: https://lkml.org/lkml/2015/8/25/738

This is a post from 2015 so way before your 4.5 kernel. Your ideal solution would be to find the version that it was for 4.5 (if there are no differences in functionalities).

What I can see is that it was added in 4.8. If you go from there, you have three versions to go. It should be way easier than from 4.15.

Other option is to do the modifications. The driver isn't big so it shouldn't be very hard. However, the first option may be easier if you're starting with kernel programming.

vegeta1in 01-22-2018 04:43 PM

I am absolutely ecstatic!
I used the driver you shared in the link and the code just compiled! Well that's a step forward(or at least feels like it at the moment). Not sure if it will work with my touchscreen however, it is something I will try out soon.

I too tried getting the driver for 4.5, but couldn't find one in the 4.5 version on github => https://github.com/torvalds/linux/tags?after=v4.6-rc7

Is there any other place I should look for, for the driver belonging to the 4.5 kernel?
Also, the above driver just compiled, but is there any potential pitfall I should be aware of? Is it recommended to get the driver meant for v4.5?

Thanks a zillion!

Mara 01-24-2018 03:49 PM

To answer your questions in an order :)

The driver did exist before 4.8. However, until that time it wasn't included in the official kernel. There have been submissions of it on the LKML (lkml.org, the linux kernel mailing list) and you can find them in the mailing list archive.

The version you have in 4.8 got through a review so I'd probably stick to it for now. You can look what the modifications were from 4.8 to 4.15 using git log on the driver file. You may want to backport some of the modification maybe if they are related to the features you need or fix bugs you'll run into. Just trying the driver you have looks like a good first step however.

What the risk may be? Normally there should be none. This is a pretty small change in kernel versions. Differences happen when kernel internal interfaces change. It might be that the touchscreen one didn't change much between 4.5 and 4.8. I find it probable. If there are important changes, the code simply does not compile or it gives warnings (in a very big majority of cases!). If you have no warnings when compiling it, it should be fine (beware of warning about assignments of wrong type, for example, after backporting a driver).


All times are GMT -5. The time now is 05:37 AM.