Kernel tweaking learning

Screwface
Hi,

I'm trying to learn linux and its kernel the hard way. I have compiled a
vanilla kernel (3.1.6) for my mini2440. I wanted to compile TS_LIB and
Qt-4.8 also.
I know this can be easy using a BSP like Pengutronix one, but I would like
to get a working linux "from scratch" at least once, to understand things.

My problem is, I can't get a working touchscreen. I have only
/dev/input/event0 which is not the touch screen as cat /dev/input/event0
doesn't report anything when I touch the screen.

I have selected
+-- Input Device Support
   +-- Touchscreens
      +--Samsung S3C2410/generic touchscreen input driver

I have seen in buserror's 2.6.32-rc8 kernel some touchscreen related things
in mach-mini2440.c file.
Should I hack the corresponding vanilla file the same way, or is there
another way to get the touchscreen working?

Another thing: when booting, the screen backlight is on a very small time.
On buserror's kernel, it take much more time to turn off. Where is this on
time calibrated?

Thanks for your help!

And happy new year!!

Juergen Beisert
Take a look into the /sys/bus/platform/devices directory. These devices you
kernel knows at run-time and can link a driver to the device if one exists.
If the ADC device (required for the touchscreen) does not exist, nobody has
registered it. Registering devices is the job of the platform file. So,
extending the mach-mini2440.c is the correct way to make the touchscreen
work.

Screwface
Hi Juergen,

Thank you very much for your advice. There was no ADC device in the
mentionned folder. I have taken mach-mini6410.c as an example to implement
touchscreen on mini2440. It is cleaner to my eyes  (and easier for me) than
doing the same modifications buserror did in his 2.6.32-rc8 kernel.

Anyway, my second problem is still there: the screen shuts off a few
seconds after power on. I don't know where to modify this. Because of this,
I'm not able to calibrate tslib...

Thanks for your help!

Juergen Beisert
Its also platform file related. Some GPIOs are used to control the LCD
power and backlight. You must tell the LCDC driver what GPIOs used for what
purpose and what level (which level means 'on', which 'off). Or you must
provide some callback functions the LCDC driver will call to switch on/off
the LCD and its backlight.
Take a (really short) look in my BSP (the Pengutronix one) to get an idea
how to configure the LCDC (and then close the editor, because you want to
do it by yourself! ;-) )

Screwface
I had a look to your BSP but I'm not so familiar with ptxdist for the
moment. I think I had an error at the end of building the toolchain
(someting related to cp command but I don't remember exactly what, it was
late). Anyway, is there a way to get your patched kernel to take the
"really short" look ;-) at what you did?
In my mach-mini2440.c file, leds are described and linked to triggers
(already done in the vanilla kernel). Led5 is dedicated to backlight and is
linked to a backlight trigger:

static struct s3c24xx_led_platdata mini2440_led_backlight_pdata = {
        .name           = "backlight",
        .gpio           = S3C2410_GPG(4),
        .def_trigger    = "backlight",
};

and later

static struct platform_device mini2440_led_backlight = {
         .name           = "s3c24xx_led",
         .id             = 5,
         .dev            = {
                 .platform_data  = &mini2440_led_backlight_pdata, 
    },


So I think the led is correctly linked to a trigger called backlight. But
this is not so clear for me.
I have found somewhere that there were problems with framebuffer or
something like that.

Can you light my candle?

Juergen Beisert
Extract a recent BSP archive and take a look into the
"configs/platform-friendlyarm-mini2440/patches/linux-3.1/" directory.
PTXdist will extract a vanilla Linux-3.1 and apply all these patches. You
can take a look into these patches if they may also work for you

If you enable the 'framebuffer console' feature, the console switches off
the screen after a while when there is no keyboard action ("screen saver").
To avoid it, you can:

 - disable the 'framebuffer console'
 - use the "consoleblank=0' kernel parameter to disable screen blank
   (refer 'Documentation/kernel-parameters.txt' in the kernel)

Screwface
OK, thank you very much Juergen for your precious help.
Another question: do you plan to add Vladimir Fonov CAM130 video driver to
your BSP?

http://code.google.com/p/s3c2440camera/

Screwface
Juergen,

I wonder why you have to patch so many files with ptxdist. Did you submit
your modifications to make them integrated in the mainstream kernel? Is it
just to wait for them to be accepted?