Hello,
I'm not sure whether this or the kernel forum is right...
My actual problem occurs in a framebuffer driver i write to drive a SPI controlled 2BPP greyscale LCD.
From the bunch of challenges i face this one is the most problematic:
From several examples and drivers come with linux kernel i copied the driver skeleton as well as of how to allocate the Video Memory:
In the framebuffer
probe function i allocate RAM as frame buffer:
Here some extraction of it:
Code:
static int __devinit dogxl160fb_probe (struct spi_device *spi)
{u8 *vmem;
...
vmem = vzalloc(vmem_size_in);
/* vmem_size_in= WIDTH*HEIGHT*BPP_INPUT/8, WIDTH=160, HEIGHT=104, BPP_INPUT=16 */
if (!vmem) return retval;
info = framebuffer_alloc(sizeof(struct dogxl160fb_par), &spi->dev);
if (!info) goto fballoc_fail;
info->screen_base = (u8 __force __iomem *)vmem;
...
}
when the frame buffer is updated by some user space process i have a
update function which writes the vmem to SPI:
Code:
static void dogxl160fb_update_display(struct dogxl160fb_par *par)
{
...
u8 *vmem = par->info->screen_base;
...
/*WIDTH=160, HEIGHT=104, BPP_OUPUT=2 */
dogxl160fb_write_data(par, vmem, WIDTH*HEIGHT*BPP_OUTPUT/8);
Code:
static void dogxl160fb_write_data(struct dogxl160fb_par *par, void *txbuf, size_t size)
{
...
/* Set data mode */
gpio_set_value(par->dc, 1);
spi_write(par->spi, txbuf, size);
}
Sure the input (vmem) buffer matches not exactly the byte stream i need on the display (wrong pixel format, wrong order etc.) but i expected to see at least some noise on the display.
Instead of that the kernel crashes always when i try to send vmem (or a copy from it) via
spi_write function.
Analyzing the stack trace with GDB shows me that it crashes with the call of
write_data function, or if i try to access vmem in the
update function but only when I call
spi_write
I thought also about the possibility that it could be a user space / kernel space memory problem and tried to
copy_from_user() int another buffer. but that does not really help either (sometimes the module does not crash then but i don't have valid data).
The Platform is a ARM processor (ARM926EJ) on a NXP EA313X with 32MB RAM and a linux 3.3.0 kernel (from vendor of the board with the CPU and RAM already for IOs patched).
If there is any help or helpful idea out - would be great - i have spent already several weeks trying to understand where it fails ...
Thanks
Best Regards
Thomas S.