18

I am trying to use loadable Kernel module to modify the LCD display parameters. Following is compiled code for the kernel.

void set_fb_video ()
{
    platform_device_unregister(&goldfish_lcd);
    ((atmel_lcdfb_info*)goldfish_lcd.dev.platform_data)->default_monspecs->modedb->xres = 10;
    platform_device_register(&goldfish_lcd);
};

EXPORT_SYMBOL("set_fb_video");

Then I have a loadable kernel module lcd_modify.ko

int __init init_module(void)
{
..
..
set_fb_video();
..
..
return;
}

Then the module is loaded to the device using insmod lcd_modify.ko

The device at this point hangs up.

Question:

  1. Can I use loadable kernal module to modify the lcd display?
  2. Are parameters real-time? If so, what am I doing wrong?
  3. If not, what is a better way to modify lcd the parameters real-time?

Thank you for your feedback in advance.

Steven Im
  • 98
  • 7
Mahendra Gunawardena
  • 1,956
  • 5
  • 26
  • 45
  • 2
    You can not call `platform_device_unregister()` from an external module, unless all the users of the **fb** are turned off. It is probably better to use `echo 1 > /sys/class/graphics/fb0/blank` or something like that to put the display to sleep first, but even that may not work. Some Android processes may have the `/dev/fb0` as `mmap()` and you will probably be pulling the memory away from them. There is an programming interface to set display geometries, but not all drivers support it. See [`man fbset`](http://linux.about.com/library/cmd/blcmdl8_fbset.htm). – artless noise Jan 07 '14 at 15:19
  • @artlessnoise: Thank you for the response. On the android device that I am working on fbset is not available. I check the fbset on the host machine and achieved the desired results. I also found this post on use of fbset on android. Hopefully it will be of assistance to someone. http://e2e.ti.com/support/embedded/android/f/509/t/142583.aspx – Mahendra Gunawardena Jan 07 '14 at 16:25
  • 2
    I guess you don't want to change the kernel and it has the display driver linked? You are better off to alter the driver to support the mode changes. These are `ioctl()` calls to the driver and they are defined in [*fb.h*](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/fb.h). *fbset* itself doesn't have to exist. Any user program can use these `ioctl()` calls if they have write access to */dev/fb0*. This seems like a better structure to me? Do you have an issue with modifying the display driver? – artless noise Jan 07 '14 at 17:21
  • 1
    [How to write directly to FB](http://stackoverflow.com/questions/1527039/how-to-write-directly-to-linux-framebuffer) and [FBIOPUT_VSCREENINFO and modelines](http://stackoverflow.com/questions/11530874/fbioput-vscreeninfo-and-modelines) have relevant information. – artless noise Jan 07 '14 at 17:25
  • @artlessnoise: Eventually I need to modify the kernel. But I need the find the optimum values. I don't have access to display documentation. So I need to do some reverse engineering to figure the display specifications. fbset utility and the above link form e2e.ti.com might be the way to go. Also from the above link using ioctl() might be another good option. Thank you for recommending fbset utility. – Mahendra Gunawardena Jan 07 '14 at 18:08

0 Answers0