I am trying to develop a loadable Kernel Module (LKM) to modify signal characteristics to an LCD display. The module loaded on the android device I get the following error.
I belive the error occurs when the am33xx_register_lcdc function is called.
HW; TI Sitara SK
SW: JB
Error
[ 333.613861] cw_device_init test [ 333.617218] Configure Display PLL Complete [ 333.621612] Reached test 1 [ 333.624572] Internal error: Oops - undefined instruction: 0 [#1] [ 333.630859] Modules linked in: lcdc_load_device(O+) wl12xx(O) mac80211(O) cfg80211(O) compat(O) [ 333.639953] CPU: 0 Tainted: G O (3.2.0-00244-gcf99001-dirty #1) [ 333.647399] PC is at omap2_init_devices+0x21c/0x250 [ 333.652496] LR is at cw_device_init+0x80/0xc4 [lcdc_load_device] [ 333.658782] pc : [<c07927a0>] lr : [<bf031080>] psr: 60000013 [ 333.658782] sp : c1f2fe80 ip : c1f2fd90 fp : c1f2fe94 [ 333.670745] r10: c0075f98 r9 : 00000144 r8 : 00000001 [ 333.676208] r7 : 00000001 r6 : 00000000 r5 : 00000000 r4 : c07f8a94
I have attache the full error file as an attachment.
1261.error.txt
Below is a LKM code
#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> #include <linux/clk.h> #include <linux/ioport.h> #include <linux/err.h> #include <video/da8xx-fb.h> #include <mach/hardware.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> #include <asm/hardware/asp.h> #include <plat/omap_device.h> #include <plat/omap_hwmod.h> #include <plat/lcdc.h> #include <plat/omap-pm.h> MODULE_LICENSE("GPL"); MODULE_AUTHOR("CW"); MODULE_DESCRIPTION("DISPLAY"); static const struct display_panel disp_panel = { QVGA, 24, 24, COLOR_ACTIVE, }; static struct lcd_ctrl_config lcd_cfg = { &disp_panel, .ac_bias = 255, .ac_bias_intrpt = 0, .dma_burst_sz = 16, .bpp = 24, .fdd = 0x80, .tft_alt_mode = 0, .stn_565_mode = 0, .mono_8bit_mode = 0, .invert_line_clock = 1, .invert_frm_clock = 1, .sync_edge = 0, .sync_ctrl = 1, .raster_order = 0, }; struct da8xx_lcdc_platform_data CW_pdata = { .manu_name = "NHD", .controller_data = &lcd_cfg, .type = "NHD-4.3-ATXI#-T-1", }; static int __init conf_disp_pll(int rate) { struct clk *disp_pll; int ret = -EINVAL; disp_pll = clk_get(NULL, "dpll_disp_ck"); if (IS_ERR(disp_pll)) { printk(KERN_INFO "Cannot clk_get disp_pll\n"); } else { ret = clk_set_rate(disp_pll, rate); clk_put(disp_pll); } printk(KERN_INFO "Configure Display PLL Complete \n"); return ret; } static int __init cw_device_init(void) { int ret = 0; struct da8xx_lcdc_platform_data *lcdc_pdata; printk(KERN_INFO "cw_device_init test\n"); if ((ret = conf_disp_pll(300000000))) { printk(KERN_ALERT "Failed configure display PLL, not attempting to register LCDC\n"); return ret; } printk(KERN_INFO "Reached test 1 \n"); lcdc_pdata = &CW_pdata; /* lcdc_pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count; */ /* lcdc_pdata->get_context_loss_count = 0; */ if ((am33xx_register_lcdc(lcdc_pdata))) { printk(KERN_ALERT "Failed to register LCDC device\n"); } printk(KERN_INFO "Reached test 2\n"); return ret; } static void __exit cw_device_cleanup (void) { printk(KERN_INFO "cw_device_cleanup \n"); } module_init(cw_device_init); module_exit(cw_device_cleanup);
I have added an EXPORT_SYMBOL(am33xx_register_lcdc) in the devices.c file. The kernel was recompiled and I verified that the symbol was present in the Module.symver file.