BigW Consortium Gitlab

Commit 0f371ad4 by David Frey

Add experimental driver for e-ink display

Add a Linux framebuffer driver for Waveshare e-ink displays written by Thong Nguyen <nxthongbk@gmail.com>. Only the 2.13 Inch display has been tested so far. See the README.md file for information on what is required to get this device working.
parent 3158e36c
#
# FBWS IMU driver
#
config FBWS
tristate
depends on FB
select FB_SYS_IMAGEBLIT
select FB_DEFERRED_IO
config RPIFB
tristate "Bosch FBWS SPI driver"
depends on SPI
select FBWS
select REGMAP_SPI
help
If you say yes here you get support for BMI160 IMU on SPI with
accelerometer, gyroscope and external BMG160 magnetometer.
This driver can also be built as a module. If so, the module will be
called bmi160_spi.
#
# Makefile for Bosch BMI160 IMU
#
obj-$(CONFIG_FBWS) += fb_waveshare_eink.o
obj-$(CONFIG_RPIFB) += rpifb.o
# mangOH Waveshare E-Ink Linux Framebuffer driver
For integration mangOH Red and Waveshare E-Ink Display
### 1. Download Legato Distribution Source Package from sierra wireless website:
Yocto Source (Around 4 GB)
The file name is Legato-Dist-Source-mdm9x15-SWI9X15Y_07.13.05.00.tar.bz2
### 2. Extract the downloaded Distribution source package:
Run command: tar -xvjf Legato-Dist-Source-mdm9x15-SWI9X15Y_07.13.05.00.tar.bz2
### 3. Disable Legato configuration to build Yocto
Run command: cd yocto
Run command: export LEGATO_BUILD=0
### 4. Build Yocto images from source
Run command: make image_bin
If you get the error not found 'serf.h', then follow the steps below, otherwise skip to the next step.
Go to directory: cd meta-swi/common/recipes-devtools/
create directory: mkdir subversion
Put attach file: subversion_1.8.9.bbappend, under directory subversion
The full path would be: yocto/meta-swi/common/recipes-devtools/subversion/subversion_1.8.9.bbappend
build Yocto images again: make image_bin
### 5. Set environment under yocto directory, this will get command bitbake run:
Run Command: . ./poky/oe-init-build-env
### 6. Build Linux kernel with Buffer Frame driver modules support
Go to directory: yocto/build_bin (cd …/build_bin)
Configure kernel with default:
Run command: bitbake linux-yocto -c kernel_configme -f
Configure kernel to add BT driver module in Linux configuration
Run command: bitbake linux-yocto -c menuconfig
Enter Device Driver -> Graphic Support
Enter <M> Suport for frameBuffer devices
<M> Ion Memory Manager
<> Lowlevel video output switch controls
<*> Support for frame buffer devices
[*] Enable firmware EDID
[*] Framebuffer foreign endianess support --->
-*- Enable Video Mode Hangling Helper
[*] Enable Tile Blitting Support
***Frame buffer hardware drivers***
<M> OpenCores VGA/LCD core 2.0 framebuffer support
<M> Epson S1D13XXX framebuffer support
<M> Toshiba Mobile IO framebuffer support
[*] tmiofb acceleration (NEW)
<M> SMSC UFX6000/7000 USB Framebuffer support
<M> Displaylink USB Framebuffer support
<M> Goldfish Framebuffer
<M> Vitrual Frame Buffer support(ONLY FOR TESTING)
<M> E-Ink Metronome/8track controller support
<M> MSM Framebuffer support
<M> E-Ink Broadsheet/Epson S1D13521 controller support
<M> AUO-K190X EPD controller support
<M> AUO-K1900 EPD controller support
<M> AUO-K190X\1 EPD controller support
[*] Simple framebuffer support
[*] Esynos Video driver support
Console display driver support
<*> Framebuffer Console support
[*] Map the console to primary display device
[*] Framebuffer Console Rotation
Exit and save Frame Buffer Linux config
Rebuild kernel image: bitbake -f linux-yocto
### 7. Rebuild rootfs filesystem and images
bitbake -c cleansstate mdm9x15-image-minimal
bitbake mdm9x15-image-minimal
Check new build CWE images: yocto_wp85.cwe
Go to images directory: cd build_bin/tmp/deploy/images/swi-mdm9x15
Reflash new image with Frame Buffer driver module support to the target board
on Windows: FDT command: fdt yocto_wp85.cwe
on Linux: by command: fwupdate download yocto_wp85.cwe
# Waveshare E-Ink Driver TODO
## Questions
What is the purpose of the `#ifdef __LITTLE_ENDIAN` sections in the driver? Add code comments to
clarify.
## Fixes Requested
* I think `eink_device->max_speed_hz` is still being initialized incorrectly. It should be
initialized with the max speed supported by the device, not the max speed supported by the SPI
master.
## Enhancements Requested
## Challenges
How should we deal with the fact that this driver depends on features of the kernel that aren't
explicitly selectable using menuconfig? I doubt the system reference team would be happy about us
enabling config for a bunch of device drivers for devices that we don't intend to use so that the
side-effect of getting `sys_imageblit()` (for example) included into the kernel is achieved.
#ifndef FB_WAVESHARE_EINK_H
#define FB_WAVESHARE_EINK_H
struct waveshare_eink_platform_data {
int rst_gpio;
int dc_gpio;
int busy_gpio;
};
#endif /* FB_WAVESHARE_EINK_H */
sources:
{
fb_waveshare_eink.c
}
cflags:
{
// -DDEBUG
}
params:
{
}
load: manual
#include <linux/module.h>
#include <linux/spi/spi.h>
#include "fb_waveshare_eink.h"
#define SPI_BUS 32766
#define SPI_BUS_CS1 1
#define SPI_BUS_SPEED 12000000
const char eink_device_name[] = "waveshare_213";
static struct spi_device *eink_device;
#if defined(CONFIG_ARCH_MSM9615)
#define CF3_GPIO22 (49)
#define CF3_GPIO23 (54)
#define CF3_GPIO24 (61)
#elif defined(CONFIG_ARCH_MDM9607)
#define CF3_GPIO22 (9)
#define CF3_GPIO23 (10)
#define CF3_GPIO24 (11)
#endif
static struct waveshare_eink_platform_data ws213_pdata = {
.rst_gpio = CF3_GPIO23,
.dc_gpio = CF3_GPIO22,
.busy_gpio = CF3_GPIO24,
};
static int __init add_ws213fb_device_to_bus(void)
{
struct spi_master *spi_master;
int status = 0;
spi_master = spi_busnum_to_master(SPI_BUS);
if (!spi_master) {
printk(KERN_ALERT "spi_busnum_to_master(%d) returned NULL\n",
SPI_BUS);
return -1;
}
eink_device = spi_alloc_device(spi_master);
if (!eink_device) {
put_device(&spi_master->dev);
printk(KERN_ALERT "spi_alloc_device() failed\n");
status = -1;
goto put_master;
}
eink_device->chip_select = SPI_BUS_CS1;
eink_device->max_speed_hz = SPI_BUS_SPEED;
eink_device->mode = SPI_MODE_3;
eink_device->bits_per_word = 8;
eink_device->irq = -1;
eink_device->dev.platform_data = &ws213_pdata;
eink_device->controller_state = NULL;
eink_device->controller_data = NULL;
strlcpy(eink_device->modalias, eink_device_name, SPI_NAME_SIZE);
status = spi_add_device(eink_device);
if (status < 0) {
spi_dev_put(eink_device);
printk(KERN_ALERT "spi_add_device() failed: %d\n", status);
}
put_master:
put_device(&spi_master->dev);
return status;
}
module_init(add_ws213fb_device_to_bus);
static void __exit exit_ws213fb_device(void)
{
spi_unregister_device(eink_device);
}
module_exit(exit_ws213fb_device);
MODULE_AUTHOR("Neil Greatorex");
MODULE_DESCRIPTION("Bind device driver to SPI ws213 e-ink display");
MODULE_LICENSE("GPL");
MODULE_VERSION("0.1");
sources:
{
mangOH_red_ws213.c
}
cflags:
{
-DCONFIG_FBWS
-DCONFIG_RPIFB
}
params:
{
}
load: manual
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment