static int __init printer_board_lateinit(void) { printk(">>>>>>start init sew-290 modem\n"); if (!gpio_is_valid(GPIO_PB(29))) printk("GPIO_PB(29) invaild.\n"); if (gpio_request(GPIO_PB(29), "modem_rst")) printk("GPIO_PB(29) request failed.\n"); else gpio_direction_output(GPIO_PB(29), 0); if (!gpio_is_valid(GPIO_PE(8))) printk("GPIO_PE(8) invaild.\n"); if(gpio_request(GPIO_PE(8), "modem_vcc")) printk("GPIO_PE(8) request failed.\n"); else gpio_direction_output(GPIO_PE(8), 1); if (!gpio_is_valid(GPIO_PD(12))) printk("GPIO_PD(12), is invaild.\n"); if(gpio_request(GPIO_PD(12), "modem_init")) printk("GPIO_PD(12) request faild.\n"); else gpio_direction_output(GPIO_PD(12), 1); INIT_DELAYED_WORK(&modem_work, init_modem); schedule_delayed_work(&modem_work, msecs_to_jiffies(5000)); return 0; }
int board_early_init_f(void) { /* Power on TF-card */ gpio_direction_output(GPIO_PB(3), 1); act8600_regulator_init(); return 0; }
static int leaf_backlight_init(struct device *dev) { #if 0 struct regulator *vlcd; vlcd = regulator_get(dev, "vlcd"); if(IS_ERR(vlcd)){ printk("get vlcd power failed!\r"); return -EINVAL; } regulator_enable(vlcd); #endif gpio_request(GPIO_PB(23), "lcd_pwr_en"); gpio_direction_output(GPIO_PB(23), 1); return 0; }
static void gpio_setup(void) { /* Enable GPIOB clock. */ rcc_enable_clock(RCC_GPIOB); /* Set PB6 and PB7 to 'output push-pull'. */ gpio_config_output(GPIO_PUSHPULL, GPIO_400KHZ, GPIO_NOPUPD, GPIO_PB(6, 7)); /* LED(PB6) on */ gpio_set(GPIO_PB6); /* LED(PB7) off */ gpio_clear(GPIO_PB7); }
int main(void) { int i; clock_setup(); gpio_setup(); /* Blink the LED (PB6 and PB7) on the board. */ while (1) { gpio_toggle(GPIO_PB(6, 7)); /* LED on/off */ for (i = 0; i < 800000; i++) /* Wait a bit. */ __asm__ ("nop"); } return 0; }
static void spi_setup(void) { /* Enable GPIOB clock. */ rcc_enable_clock(RCC_GPIOB); /* 'nRST' LOW */ gpio_clear(GPIO_PB11); /* Set GPIO11 (in GPIO port B) to 'output push-pull'. */ gpio_config_output(GPIO_PUSHPULL, GPIO_40MHZ, GPIO_NOPUPD, GPIO_PB11); /* Enable SPI2 clock. */ rcc_enable_clock(RCC_SPI2); /* Set GPIO13, 15 (in GPIO port B) to 'altfn push-pull'. */ gpio_config_altfn(GPIO_SPI1_2, GPIO_PUSHPULL, GPIO_40MHZ, GPIO_NOPUPD, GPIO_PB(SPI2_SCK, SPI2_MOSI)); /* Set SPI mode (32 / 4 = 8MHz). */ spi_set_mode(SPI2, 4, SPI_16BIT | SPI_LSB_FIRST | SPI_NSS_SOFTWARE | SPI_NSS_HIGH | SPI_MASTER | SPI_ENABLE); }
#include <linux/mm.h> #include <linux/console.h> #include <linux/delay.h> #include <linux/gpio.h> #include <linux/pwm_backlight.h> #include <mach/jzfb.h> #include <mach/fb_hdmi_modes.h> #include <linux/regulator/consumer.h> #include <linux/jzlcd_pdata.h> static struct jzlcd_platform_data lcd_pdata= { .gpio_de = GPIO_PC(9), .gpio_vs = GPIO_PC(19), .gpio_hs = GPIO_PC(18), .gpio_reset = GPIO_PB(22), .de_mode = 0, }; /* LCD Panel Device */ struct platform_device jzlcd_device = { .name = "jz-lcd", .dev = { .platform_data = &lcd_pdata, }, }; #ifdef CONFIG_FB_JZ4780_LCDC0 /* LCDC0 output to HDMI and the default hdmi video mode list * define in soc-4780/include/mach/fb_hdmi_modes.h
#include <mach/jz_efuse.h> #include <gpio.h> #include <linux/jz_dwc.h> #include <linux/interrupt.h> //#include <sound/jz-aic.h> #include "board_base.h" #ifdef CONFIG_LEDS_GPIO #include <linux/leds.h> #endif #ifdef CONFIG_LEDS_GPIO static struct gpio_led gpio_leds[] = { { .name = "led-blue", .gpio = GPIO_PB(6), .active_low = false, .default_state = LEDS_GPIO_DEFSTATE_ON, .retain_state_suspended = true, .default_trigger = NULL, }, { .name = "led-white", .gpio = GPIO_PB(7), .active_low = false, .default_state = LEDS_GPIO_DEFSTATE_ON, .retain_state_suspended = true, .default_trigger = NULL, }, };
/** * Fixed voltage Regulators. * GPIO silulator regulators. Everyone is an independent device. */ /* FIXME! when board fixed, remove it */ FIXED_REGULATOR_DEF( zpad80_vbus, "OTG-Vbus", 5000000, -1, HIGH_ENABLE, UN_AT_BOOT, 0, NULL, "vdrvvbus", NULL); FIXED_REGULATOR_DEF( zpad80_vcim, "Camera", 2800000, GPIO_PB(27), HIGH_ENABLE, UN_AT_BOOT, 0, NULL, "vcim", "jz-cim"); FIXED_REGULATOR_DEF( zpad80_vbklight, "vbklight", 3300000, GPIO_PF(10), HIGH_ENABLE, EN_AT_BOOT, 0, NULL, "vbklight", NULL); FIXED_REGULATOR_DEF( zpad80_vlcd_en, "vlcd_en", 3300000, GPIO_PB(23), HIGH_ENABLE, EN_AT_BOOT, 0, NULL, "vlcd_en", NULL);
#include <linux/i2c.h> #include <gpio.h> /** * Fixed voltage Regulators. * GPIO silulator regulators. Everyone is an independent device. */ FIXED_REGULATOR_DEF( hdmi_80_vcc5, "Vcc-5V", 5000000, GPIO_PE(15), HIGH_ENABLE, UN_AT_BOOT, 0, NULL, "vhdmi", "jz-hdmi"); FIXED_REGULATOR_DEF( hdmi_80_vbus, "OTG-Vbus", 5000000, GPIO_PB(10), LOW_ENABLE, UN_AT_BOOT, 0, NULL, "vbus", NULL); FIXED_REGULATOR_DEF( hdmi_80_vwifi, "vwifi", 3000000, GPIO_PD(8), HIGH_ENABLE, UN_AT_BOOT, 0, NULL, "vwifi", NULL); /* FIXED_REGULATOR_DEF( hdmi_80_ucharger, "ucharger", 3000000, GPIO_PD(21), HIGH_ENABLE, UN_AT_BOOT, 0, NULL, "ucharger", NULL);
.sleep_current = 30, }; static struct jz_adc_platform_data adc_platform_data; #endif /* ac charger */ static char *npm801_ac_supplied_to[] = { "battery", }; static struct ac_charger_platform_data npm801_ac_charger_pdata = { .name = "ac", .type = POWER_SUPPLY_TYPE_MAINS, .gpio_ac = GPIO_PA(16), .gpio_ac_active_low = 0, .gpio_charging = GPIO_PB(3), .gpio_charging_active_low = 1, .supplied_to = npm801_ac_supplied_to, .num_supplicants = ARRAY_SIZE(npm801_ac_supplied_to), }; static struct platform_device npm801_ac_charger_device = { .name = "ac-charger", .dev = { .platform_data = &npm801_ac_charger_pdata, }, }; #ifdef CONFIG_SPI_JZ4780 #ifdef CONFIG_SPI0_JZ4780 static struct spi_board_info jz_spi0_board_info[] = {
.bpp = 24, .pixclk_falling_edge = 1, .date_enable_active_low = 0, .lvds = 0, .dither_enable = 0, #else #error "Please add the board data!!!" #endif }; #ifdef CONFIG_VIDEO_BYD_BM8766U #include <jz_lcd/byd_bm8766u.h> struct byd_bm8766u_data byd_bm8766u_pdata = { .gpio_lcd_disp = GPIO_PB(30), .gpio_lcd_de = 0, //GPIO_PC(9), /* chose sync mode */ .gpio_lcd_vsync = 0, //GPIO_PC(19), .gpio_lcd_hsync = 0, //GPIO_PC(18), }; #endif /* CONFIG_LCD_BYD_BM8766U */ #ifdef CONFIG_VIDEO_BM347WV_F_8991FTGF #include <jz_lcd/byd_8991.h> struct byd_8991_data byd_8991_pdata = { .gpio_lcd_disp = GPIO_PB(30), .gpio_lcd_de = 0, .gpio_lcd_vsync = 0, .gpio_lcd_hsync = 0, .gpio_spi_cs = GPIO_PC(0), .gpio_spi_clk = GPIO_PC(1),
#include <linux/gpio.h> #include <linux/pwm_backlight.h> #include <linux/digital_pulse_backlight.h> //#include <linux/at070tn93.h> #include <mach/jzfb.h> #include <mach/fb_hdmi_modes.h> #include <linux/kfm701a21_1a.h> #include "board.h" static struct platform_kfm701a21_1a_data kfm701a21_1a_pdata = { .gpio_lcd_cs = GPIO_PC(21), .gpio_lcd_reset = GPIO_PB(28), }; /* LCD Panel Device */ struct platform_device kfm701a21_1a_device = { .name = "kfm701a21_1a-lcd", .dev = { .platform_data = &kfm701a21_1a_pdata, }, }; static struct smart_lcd_data_table kfm701a21_1a_data_table[] = { /* soft reset */ {0x0600, 0x0001, 0, 10000}, /* soft reset */ {0x0600, 0x0000, 0, 10000},
EXCLUSIVE_REGULATOR_DEF( vcc5v, "VCC5V", "vcc5v", NULL, NULL, 5000000, 0); EXCLUSIVE_REGULATOR_DEF( vlcd, "Vlcd", "vlcd", NULL, NULL, 3300000, 0); #ifndef CONFIG_NAND FIXED_REGULATOR_DEF( vmmc, "TF", 3000000, GPIO_PB(3), HIGH_ENABLE, UN_AT_BOOT, 0, NULL, "vmmc.2", NULL); #else FIXED_REGULATOR_DEF( vmmc, "TF", 3000000, GPIO_PB(3), HIGH_ENABLE, UN_AT_BOOT, 0, NULL, "vmmc.0", NULL); #endif FIXED_REGULATOR_DEF( vtsc, "Touch Screen", 3000000, -1, HIGH_ENABLE, UN_AT_BOOT, 0, NULL, "vtsc", NULL);
}; /* LCD Panel Device */ struct platform_device kr070la0s_270_device = { .name = "kr070la0s_270-lcd", .dev = { .platform_data = &kr070la0s_270_pdata, }, }; #endif #ifdef CONFIG_LCD_HSD101PWW1 #include <linux/hsd101pww1.h> static struct platform_hsd101pww1_data hsd101pww1_pdata= { /* gpio had been hardware control */ .gpio_rest = GPIO_PB(22), }; /* LCD Panel Device */ struct platform_device hsd101pww1_device = { .name = "hsd101pww1-lcd", .dev = { .platform_data = &hsd101pww1_pdata, }, }; #endif #ifdef CONFIG_LCD_LP101WX1_SLN2 #include <linux/lp101wx1_sln2.h> static struct platform_lp101wx1_sln2_data lp101wx1_sln2_pdata= { /* gpio had been hardware control */
.gpioMosi = GPIO_PA(7), .gpioSclk = GPIO_PA(5), .gpioNss = GPIO_PA(4), .gpioFunc = GPIO_AF_SPI1, .gpioSpeed = GPIO_SPEED_MEDIUM, .irqNss = EXTI4_IRQn, .dmaRx = SPI1_DMA_RX_CFG_B, .dmaTx = SPI1_DMA_TX_CFG_B, .sleepDev = -1, }, [1] = { .gpioMiso = GPIO_PB(14), .gpioMosi = GPIO_PB(15), .gpioSclk = GPIO_PB(13), .gpioNss = GPIO_PB(12), .gpioSpeed = GPIO_SPEED_MEDIUM, .gpioFunc = GPIO_AF_SPI2_A, .irqNss = EXTI15_10_IRQn, .dmaRx = SPI2_DMA_RX_CFG, .dmaTx = SPI2_DMA_TX_CFG, .sleepDev = Stm32sleepDevSpi2, }, };
gpio_direction_output(GPIO_PC(20), 1); mdelay(5); gpio_direction_output(GPIO_PE(0), 1); /*PWM0 */ gpio_direction_output(GPIO_PC(17), 1); /*LCD_DD11 */ gpio_direction_output(GPIO_PC(21), 0); gpio_direction_input(GPIO_PC(0)); return 0; } #ifdef CONFIG_LCD_BYD_BM8766U #include <linux/byd_bm8766u.h> static struct platform_byd_bm8766u_data byd_bm8766u_pdata = { .gpio_lcd_disp = GPIO_PB(30), .gpio_lcd_de = 0, /*GPIO_PC(9) *//* chose sync mode */ .gpio_lcd_vsync = 0, /*GPIO_PC(19) */ .gpio_lcd_hsync = 0, /*GPIO_PC(18) */ }; /* LCD device */ struct platform_device byd_bm8766u_device = { .name = "byd_bm8766u-lcd", .dev = { .platform_data = &byd_bm8766u_pdata, }, }; #endif #ifdef CONFIG_LCD_KD50G2_40NM_A2
.gpio = GPIO_PA(16), .gpio_active_low = 0, .supplied_to = t700d_ac_supplied_to, .num_supplicants = ARRAY_SIZE(t700d_ac_supplied_to), }; static struct platform_device t700d_ac_charger_device = { .name = "gpio-charger", .dev = { .platform_data = &t700d_ac_charger_pdata, }, }; /* li-ion charger */ static struct li_ion_charger_platform_data t700d_li_ion_charger_pdata = { .gpio = GPIO_PB(3), .gpio_active_low = 1, }; static struct platform_device t700d_li_ion_charger_device = { .name = "li-ion-charger", .dev = { .platform_data = &t700d_li_ion_charger_pdata, }, }; #ifdef CONFIG_SPI_JZ4780 #ifdef CONFIG_SPI0_JZ4780 static struct spi_board_info jz_spi0_board_info[] = { [0] = { .modalias = "spidev",