首先是開發環境的選擇,這裏咱們使用TI SDK(ti-sdk-am335x-evm-05.06.00.00-Linux-x86)中提供的Linux內核與最精簡根文件系統(arago-base-tisdk-image-am335x-evm.tar.gz)。 linux
修改Linux內核支持Chipsee擴展板LCD與電容屏
這個能夠對照chipsee提供的修改過的內核來作,無非就是添加兩個驅動支持(具體設備名稱參見chipsee提供的資料)。
1) 添加LCD相關支持
(1) LCD背光支持,不用手動添加,原始代碼中已有,這裏列出相關代碼。
shell
arch/arm/mach-omap2/board-am335xevm.c:
ide
static struct platform_pwm_backlight_data am335x_backlight_data0 = { .pwm_id = "ecap.0", .ch = -1, .lth_brightness = 21, .max_brightness = AM335X_BACKLIGHT_MAX_BRIGHTNESS, .dft_brightness = AM335X_BACKLIGHT_DEFAULT_BRIGHTNESS, .pwm_period_ns = AM335X_PWM_PERIOD_NANO_SECONDS, }; static struct platform_pwm_backlight_data am335x_backlight_data2 = { .pwm_id = "ecap.2", .ch = -1, .lth_brightness = 21, .max_brightness = AM335X_BACKLIGHT_MAX_BRIGHTNESS, .dft_brightness = AM335X_BACKLIGHT_DEFAULT_BRIGHTNESS, .pwm_period_ns = AM335X_PWM_PERIOD_NANO_SECONDS, }; ... ... /* Setup pwm-backlight */ static struct platform_device am335x_backlight = { .name = "pwm-backlight", .id = -1, .dev = { .platform_data = &am335x_backlight_data0, // 我也不知道爲何要先設成data0再修改爲data2,可能有些其餘evm板使用的是ecap.0吧 }, }; ... ... static int __init backlight_init(void) { int status = 0; if (backlight_enable) { int ecap_index = 0; // 默認使用ecap.0 switch (am335x_evm_get_id()) { case GEN_PURP_EVM: case GEN_PURP_DDR3_EVM: ecap_index = 0; break; case EVM_SK: /* * Invert polarity of PWM wave from ECAP to handle * backlight intensity to pwm brightness */ ecap_index = 2; pwm_pdata[ecap_index].chan_attrib[0].inverse_pol = true; am335x_backlight.dev.platform_data = &am335x_backlight_data2; // Beaglebone使用ecap.2 break; default: pr_err("%s: Error on attempting to enable backlight," " not supported\n", __func__); return -EINVAL; } am33xx_register_ecap(ecap_index, &pwm_pdata[ecap_index]); // 註冊設備 platform_device_register(&am335x_backlight); // sys文件系統 } return status; } late_initcall(backlight_init); // board初始化後調用
(2) LCD控制器初始化,一個是TFP410(TI芯片,位於擴展板),另外一個爲INNOLUX_TN92(位於LCD屏幕上,使用TFP410進行控制)。 函數
arch/arm/mach-omap2/board-am335xevm.c: 測試
static const struct display_panel disp_panel = { WVGA, 16, 16, COLOR_ACTIVE, }; ... ... static struct lcd_ctrl_config lcd_cfg = { &disp_panel, .ac_bias = 255, .ac_bias_intrpt = 0, .dma_burst_sz = 16, .bpp = 16, .fdd = 0x80, .tft_alt_mode = 0, .stn_565_mode = 0, .mono_8bit_mode = 0, .invert_line_clock = 0, .invert_frm_clock = 1, .sync_edge = 0, .sync_ctrl = 1, .raster_order = 0, }; struct da8xx_lcdc_platform_data TFC_S9700RTWV35TR_01B_pdata = { .manu_name = "ThreeFive", .controller_data = &lcd_cfg, .type = "INNOLUX_TN92", }; static void csun_lcdc_init(int evm_id, int profile) { setup_pin_mux(lcdc_pin_mux); // lcdc_pin_mux 此結構太長且不準要修改在這就不列出了 if (conf_disp_pll(300000000)) { pr_info("Failed configure display PLL, not attempting to" "register LCDC\n"); return; } if (am33xx_register_lcdc(&TFC_S9700RTWV35TR_01B_pdata)) pr_info("Failed to register LCDC device\n"); } ... ...drivers/video/ da8xx-fb.c:
static struct da8xx_panel known_lcd_panels[] = { /* Sharp LCD035Q3DG01 */ [0] = { .name = "Sharp_LCD035Q3DG01", .width = 320, .height = 240, .hfp = 8, .hbp = 6, .hsw = 0, .vfp = 2, .vbp = 2, .vsw = 0, .pxl_clk = 4608000, .invert_pxl_clk = 1, }, ... ... /* INNOLUX AT070TN92 */ // 添加 "INNOLUX AT070TN92" panel [4] = { .name = "INNOLUX_TN92", .width = 800, .height = 480, .hfp = 1, .hbp = 45, .hsw = 48, .vfp = 12, .vbp = 20, .vsw = 2, .pxl_clk = 25000000, .invert_pxl_clk = 0, }, };
2) 添加觸摸屏支持
(1) 觸摸屏初始化,其實就是初始化管腳配置,具體工做留給相應驅動程序完成。
ui
arch/arm/mach-omap2/board-am335xevm.c:
spa
/* Pin mux for captive touch screen */ static struct pinmux_config cap_tsc_pin_mux[] = { {"gpmc_wait0.gpio0_30", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT}, {"NULL",0}, }; #define CAP_TSC_INT GPIO_TO_PIN(0,30) static void cap_tsc_init(int evm_id,int profile) { setup_pin_mux(cap_tsc_pin_mux); return; }(2) 添加對應觸摸屏的驅動程序與頭文件: drivers/input/touchscreen/ ft5x0x_ts.c; include/linux/i2c/ ft5x06_ts.h; include/linux/ earlysuspend.h (均可以從Android中扒過來) ,然後修改drivers/input/touchscreen 目錄下的Kconfig文件與Makefile:
... ... config TOUCHSCREEN_FT5X0X tristate "FocalTech ft5x0x touchscreen" depends on I2C default n ... ...
wm97xx-ts-y := wm97xx-core.o obj-$(CONFIG_TOUCHSCREEN_FT5X0X) += ft5x0x_ts.o obj-$(CONFIG_TOUCHSCREEN_88PM860X) += 88pm860x-ts.o ... ...
3) 向beaglebone 初始化結構中添加相應函數 unix
arch/arm/mach-omap2/board-am335xevm.c: code
... ... /* Beaglebone Rev A3 and after */ static struct evm_dev_cfg beaglebone_dev_cfg[] = { {am335x_rtc_init, DEV_ON_BASEBOARD, PROFILE_NONE}, {clkout2_enable, DEV_ON_BASEBOARD, PROFILE_NONE}, {tps65217_init, DEV_ON_BASEBOARD, PROFILE_NONE}, {csun_lcdc_init, DEV_ON_BASEBOARD, PROFILE_NONE}, // ADD BY Cedric Sun, lcd controller {cap_tsc_init, DEV_ON_BASEBOARD, PROFILE_NONE}, // ADD BY Cedric Sun, capacitive touch screen pin mux {mii1_init, DEV_ON_BASEBOARD, PROFILE_NONE}, {usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE}, {usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE}, {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE}, {i2c1_init, DEV_ON_BASEBOARD, PROFILE_NONE}, // ADD BY Cedric Sun, used by capacitive touch screen {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE}, {NULL, 0, 0}, }; ... ...4) 一切準備穩當,從新編譯內核,別忘了選擇觸摸屏模塊,編譯成模塊或是直接進內核都行。
5) 使用tslib 來進行測試,具體tslib 的編譯安裝這裏不表。 orm
添加QT4.8.4支持
1) 從 http://download.qt-project.org/official_releases/qt/4.8/4.8.4/qt-everywhere-opensource-src-4.8.4.tar.gz 下載源碼。2) 添加mkspecs 文件,在qt-src/mkspecs/qws 目錄下添加linux-arago-g++ 文件夾,在其下建立兩個文件"qmake.conf", "qplatformdefs.h"。
qmake.conf:
# # qmake configuration for building with arm-linux-g++ # QMAKE_CFLAGS_RELEASE = -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp QMAKE_INCDIR = /home/cedric/Projects/beaglebone/tools/tslib/install/include QMAKE_LIBDIR = /home/cedric/Projects/beaglebone/tools/tslib/install/lib include(../../common/linux.conf) include(../../common/gcc-base-unix.conf) include(../../common/g++-unix.conf) include(../../common/qws.conf) # modifications to g++.conf QMAKE_CC = arm-arago-linux-gnueabi-gcc QMAKE_CXX = arm-arago-linux-gnueabi-g++ QMAKE_LINK = arm-arago-linux-gnueabi-g++ QMAKE_LINK_SHLIB = arm-arago-linux-gnueabi-g++ # modifications to linux.conf QMAKE_AR = arm-arago-linux-gnueabi-ar cqs QMAKE_OBJCOPY = arm-arago-linux-gnueabi-objcopy QMAKE_STRIP = arm-arago-linux-gnueabi-strip load(qt_config)
qplatformdefs.h:
#include "../../linux-g++/qplatformdefs.h"3) 在qt-src 目錄下執行./configure
./configure -opensource -confirm-license -no-pch -platform linux-g++-64 -xplatform qws/linux-arago-g++ -embedded armv7 -prefix /opt/qt -qt-gfx-linuxfb -qt-gfx-vnc -no-largefile -exceptions -no-accessibility -no-qt3support -no-sse2 -qt-zlib -no-gif -no-libtiff -qt-libpng -no-libmng -qt-libjpeg -openssl -no-nis -no-cups -qt-kbd-linuxinput -nomake demos -nomake examples -qt-mouse-linuxinput -qt-mouse-tslib4) make -j5; make install(可能出錯,依編譯環境而定)
export OE_QMAKE_CC=arm-arago-linux-gnueabi-gcc export OE_QMAKE_CXX=arm-arago-linux-gnueabi-g++ export OE_QMAKE_LINK=arm-arago-linux-gnueabi-g++ export OE_QMAKE_LINK_SHLIB=arm-arago-linux-gnueabi-g++ export OE_QMAKE_AR=arm-arago-linux-gnueabi-ar export OE_QMAKE_OBJCOPY=arm-arago-linux-gnueabi-objcopy export OE_QMAKE_STRIP=arm-arago-linux-gnueabi-strip export OE_QMAKE_CFLAGS="-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp" export PATH=$PATH:"/usr/local/ti-sdk-am335x-evm/linux-devkit/bin"7) 設置執行環境(在beaglebone 開發板上調用),使用以下腳本,source 一下就好
#!/bin/sh # QWS export QWS_MOUSE_PROTO=Tslib:/dev/input/event0 export POINTERCAL_FILE=$TSLIB_ROOT/etc/pointercal export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/qt/lib # tslib export TSLIB_ROOT=/opt/tslib export TSLIB_TSDEVICE=/dev/input/event0 export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts export TSLIB_CALIBFILE=$TSLIB_ROOT/etc/pointercal export TSLIB_FBDEVICE=/dev/fb0 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TSLIB_ROOT/lib8) 編譯example進行測試就好。