コード例 #1
0
ファイル: slcd_seg.c プロジェクト: Arcko/trochili
/*!
    \brief      init the GPIO port of the SLCD and SLCD peripheral
    \param[in]  none
    \param[out] none
    \retval     none
*/
void slcd_seg_config(void)
{
    uint16_t i;

    /* configure the SLCD GPIO pins */
    slcd_gpio_config();

    /* enable the clock of SLCD */
    rcu_periph_clock_enable(RCU_SLCD);
    /* wait 2 RTC clock to write SLCD register */
    for(i = 0;i < 500;i++);
    /* config the prescaler and the divider of SLCD clock */
    slcd_clock_config(SLCD_PRESCALER_4,SLCD_DIVIDER_19);
    /* SLCD bias voltage select */
    slcd_bias_voltage_select(SLCD_BIAS_1_3);
    /* SLCD duty cycle select */
    slcd_duty_select(SLCD_DUTY_1_4);
    /* SLCD voltage source select */
    slcd_voltage_source_select(SLCD_VOLTAGE_EXTERNAL);
    /* SLCD pulse on duration config */
    slcd_pulse_on_duration_config(SLCD_PULSEON_DURATION_7);
    /* SLCD dead time duration config */
    slcd_dead_time_config(SLCD_DEADTIME_PERIOD_7);
    /* enable the permanent high drive */
    slcd_high_drive_config(ENABLE);
    /* wait for SLCD CFG register synchronization */
    while (!slcd_flag_get(SLCD_FLAG_SYNF));
    /* enable SLCD interface */
    slcd_enable();
    /* wait for SLCD controller on flag */
    while (!slcd_flag_get(SLCD_FLAG_ONF));
    /* wait for SLCD voltage ready flag */
    while (!slcd_flag_get(SLCD_FLAG_VRDYF));
}
コード例 #2
0
ファイル: mxcfb_epson.c プロジェクト: AvalueAES/rev-sa01
/*!
 * Function to initialize the panel. First it resets the panel and then
 * initilizes panel.
 */
static void _init_panel(int disp)
{
	uint32_t cmd_param;
	uint32_t i;

	gpio_lcd_active();
	slcd_gpio_config();

	/* DATCTL */
#ifdef CONFIG_FB_MXC_ASYNC_PANEL_IFC_16_BIT
	/* 16-bit 565 mode */
	cmd_param = 0x28;
#else
	/* 8-bit 666 mode */
	cmd_param = 0x08;
#endif
	ipu_adc_write_cmd(disp, CMD, DATCTL, &cmd_param, 1);

	/* Sleep OUT */
	ipu_adc_write_cmd(disp, CMD, SLPOUT, 0, 0);

	/* Set display to white
	Setup page and column addresses */
	set_panel_region(disp, MXCFB_SCREEN_LEFT_OFFSET,
			 MXCFB_SCREEN_WIDTH + MXCFB_SCREEN_LEFT_OFFSET - 1,
			 0, MXCFB_SCREEN_HEIGHT - 1);
	/* Do RAM write cmd */
	ipu_adc_write_cmd(disp, CMD, RAMWR, 0, 0);
#ifdef CONFIG_FB_MXC_ASYNC_PANEL_IFC_16_BIT
	for (i = 0; i < (MXCFB_SCREEN_WIDTH * MXCFB_SCREEN_HEIGHT); i++)
#else
	for (i = 0; i < (MXCFB_SCREEN_WIDTH * MXCFB_SCREEN_HEIGHT * 3); i++)
#endif
		ipu_adc_write_cmd(disp, DAT, 0xFFFF, 0, 0);

	/* Pause 80 ms */
	mdelay(80);

	/* Display ON */
	ipu_adc_write_cmd(disp, CMD, DISON, 0, 0);
	/* Pause 200 ms */
	mdelay(200);

	pr_debug("initialized panel\n");
}
コード例 #3
0
bool bs_hw_init(void)
{

	bool result = true;
	bsaddr = ioremap(0x10000000, 4);

	//printk(KERN_ALERT "hello broadsheet!\n");

//reset broadsheet

	// GPC7  EINK_3.3V_EN config output
		gpcon = __raw_readl(S3C64XX_GPCCON);
		gpcon = gpcon & ~(0xF << 28);
		__raw_writel(gpcon | (0x1 << 28), S3C64XX_GPCCON);		
	//GPC7 EINK_3.3V_EN set low
		gpdata = __raw_readl(S3C64XX_GPCDAT);
		gpdata =(gpdata & ~(1<<7));
		__raw_writel(gpdata,S3C64XX_GPCDAT);

	//GPC6 EINK_1.8V_EN config output
		gpcon = __raw_readl(S3C64XX_GPCCON);
		gpcon = gpcon & ~(0xF << 24);
		__raw_writel(gpcon | (0x1 << 24), S3C64XX_GPCCON);
	
	//GPC6 EINK_1.8V_EN set low
		gpdata = __raw_readl(S3C64XX_GPCDAT);
		gpdata =(gpdata & ~(1<<6));
		__raw_writel(gpdata,S3C64XX_GPCDAT);
	
	//GPP2 OSC_EN config output
		gpcon = __raw_readl(S3C64XX_GPPCON);
		gpcon  = (gpcon & ~(3<<4));
		 __raw_writel(gpcon|(0x1<<4), S3C64XX_GPPCON);
	//GPP2 OSC_EN set high
		gpdata = __raw_readl(S3C64XX_GPPDAT);
		gpdata =(gpdata & ~(1<<2));
		__raw_writel(gpdata|(0x1<<2),S3C64XX_GPPDAT);
		mdelay(10);

	//GPP9 HnRST config output
	gpcon = __raw_readl(S3C64XX_GPPCON);
	gpcon  = (gpcon & ~(3<<18));
	__raw_writel(gpcon|(0x1<<18), S3C64XX_GPPCON);
	
      HIGH_RESET_PIN;
	mdelay(10);
      LOW_RESET_PIN;
      mdelay(100); 
      HIGH_RESET_PIN;


//setup HD/C signalconfig
	gpcon = __raw_readl(S3C64XX_GPOCON);
	gpcon =(gpcon & ~(3<<4));
	__raw_writel(gpcon|(0x1<<4),S3C64XX_GPOCON);

	gpdata = __raw_readl(S3C64XX_GPODAT);
        gpdata =(gpdata & ~(1<<2));
        __raw_writel(gpdata|(0x1<<2),S3C64XX_GPODAT);

	//GPO3 HIRQ config input
		gpcon = __raw_readl(S3C64XX_GPOCON);
		gpcon  = (gpcon & ~(3<<6));
		__raw_writel(gpcon, S3C64XX_GPOCON);

//now HRDY  setup to input
	gpcon = __raw_readl(S3C64XX_GPOCON);
        gpcon  = (gpcon & ~(3<<8));
        __raw_writel(gpcon, S3C64XX_GPOCON);


	sromdata = __raw_readl(S3C64XX_VA_SROMC);
        sromdata &=~(0xF<<0);
        sromdata |= (1<<3) | (1<<2) | (1<<0);
        __raw_writel(sromdata, S3C64XX_VA_SROMC);
		
	//SROM_BC0 config
		//__raw_writel((0x1<<28)|(0xf<<24)|(0x1c<<16)|(0x1<<12)|(0x6<<8)|(0x2<<4)|(0x0<<0), S3C64XX_VA_SROMC+4);
    __raw_writel((0x0<<28)|(0x0<<24)|(0xA<<16)|(0x1<<12)|(0x0<<8)|(0x2<<4)|(0x0<<0), S3C64XX_VA_SROMC+4);

	//printk(KERN_ALERT "Product id is %x\n",__raw_readw(bsaddr));
	//printk(KERN_ALERT "The new bs driver\n");
#ifdef MXC31
	for(i=0;i<100;i++)
	{
	mdelay(500);
	__raw_writew(0xffff,bsaddr);
	//printk(KERN_ALERT "write the %dth times data\n",i);
	}
#endif

#ifdef USE_BS_IRQ
    int  rqstatus;
#endif
#ifdef MXC31
    ipu_adc_sig_cfg_t sig = { 0, 0, 0, 0, 0, 0, 0, 0,
            IPU_ADC_BURST_WCS,
            IPU_ADC_IFC_MODE_SYS80_TYPE2,
            16, 0, 0, IPU_ADC_SER_NO_RW
    };

    // Init DI interface
    if ( IS_NELL() || IS_MARIO() || IS_ADS() )
    {
        broadsheet_screen_height = BROADSHEET_SCREEN_HEIGHT_NELL;
        broadsheet_screen_width  = BROADSHEET_SCREEN_WIDTH_NELL;

        broadsheet_screen_size   = BROADSHEET_SCREEN_SIZE_NELL;
    }

    ipu_adc_init_panel(BROADSHEET_DISPLAY_NUMBER,
                       broadsheet_screen_width,
                       broadsheet_screen_height,
                       BROADSHEET_PIXEL_FORMAT, broadsheet_screen_size, sig, XY, 0, VsyncInternal);

    // Set IPU timing for read cycles
    ipu_adc_init_ifc_timing(BROADSHEET_DISPLAY_NUMBER, true,
                            BROADSHEET_READ_CYCLE_TIME,
                            BROADSHEET_READ_UP_TIME,
                            BROADSHEET_READ_DOWN_TIME,
                            BROADSHEET_READ_LATCH_TIME,
                            BROADSHEET_PIXEL_CLK);
    // Set IPU timing for write cycles
    ipu_adc_init_ifc_timing(BROADSHEET_DISPLAY_NUMBER, false,
                            BROADSHEET_WRITE_CYCLE_TIME,
                            BROADSHEET_WRITE_UP_TIME,
                            BROADSHEET_WRITE_DOWN_TIME,
                            0, 0);

    ipu_adc_set_update_mode(ADC_SYS1, IPU_ADC_REFRESH_NONE, 0, 0, 0);

    gpio_lcd_active();
    slcd_gpio_config();

#ifdef CONFIG_MACH_MX31ADS
    // Reset the level translator for the two GPIO inputs (HIRQ and HRDY)
    pin_addr = PBC_BCTRL2_LDCIO_EN;
    __raw_writew(pin_addr, PBC_BASE_ADDRESS + PBC_BCTRL2_CLEAR);
#endif

#ifdef USE_BS_IRQ
    // Set up IRQ for for Broadsheet HIRQ line
    disable_irq(BROADSHEET_HIRQ_IRQ);
    set_irq_type(BROADSHEET_HIRQ_IRQ, IRQF_TRIGGER_RISING);
    rqstatus = request_irq(BROADSHEET_HIRQ_IRQ, (irq_handler_t) bs_irq_handler, 0, "eink_fb_hal_broads", NULL);
    if (rqstatus != 0) {
        einkfb_print_crit("Failed IRQ request for Broadsheet HIRQ line; request status = %d\n", rqstatus);
        result = false;
    }
#endif

     // Set up GPIO pins
    if (mxc_request_gpio(BROADSHEET_HIRQ_LINE)) {
        einkfb_print_crit("Could not obtain GPIO pin for HIRQ\n");
        result = false;
    }
    else {
        // Set HIRQ pin as input
        mxc_set_gpio_direction(BROADSHEET_HIRQ_LINE, 1);
    }
    if (mxc_request_gpio(BROADSHEET_HRDY_LINE)) {
        einkfb_print_crit("Could not obtain GPIO pin for HRDY\n");
        result = false;
    }
    else {
        // Set HRDY pin as input
        mxc_set_gpio_direction(BROADSHEET_HRDY_LINE, 1);
    }
#ifdef CONFIG_MACH_MARIO_MX
    if (mxc_request_gpio(BROADSHEET_RST_LINE)) {
        einkfb_print_crit("Could not obtain GPIO pin for RST\n");
        result = false;
    }
    else {
        // Set RST pin as output and initialize to zero (it's active LOW)
        mxc_set_gpio_direction(BROADSHEET_RST_LINE, 0);
        mxc_set_gpio_dataout(BROADSHEET_RST_LINE, 0);
    }
#endif

#ifdef CONFIG_MACH_MX31ADS
    // Enable the level translator for the two GPIO inputs (HIRQ and HRDY)
    mdelay(100);    // Pause 100 ms to allow level translator to settle
    pin_addr = PBC_BCTRL2_LDCIO_EN;
    __raw_writew(pin_addr, PBC_BASE_ADDRESS + PBC_BCTRL2_SET);
#endif
    // Reset Broadsheet
    einkfb_debug("Sending RST signal to Broadsheet...\n");
    LOW_RESET_PIN;	//WR_GPIO_LINE(BROADSHEET_RST_LINE, BROADSHEET_RESET_VAL);     // Assert RST
    mdelay(100);    // Pause 100 ms during reset
    HIGH_RESET_PIN;
 //WR_GPIO_LINE(BROADSHEET_RST_LINE, BROADSHEET_NON_RESET_VAL); // Clear RST
    mdelay(400);    // Pause 400 ms to allow Broasheet time to come up
    einkfb_debug("Broadsheet reset done.\n");
//#ifdef TEST_BROADSHEET
//    test_broadsheet(disp);
//#endif
#endif
#ifdef USE_BS_IRQ
    // Set up Broadsheet for interrupt generation (enable all conditions)
    bs_cmd_wr_reg(BS_INTR_CTL_REG, BS_ALL_IRQS);
    bs_cmd_wr_reg(BS_INTR_RAW_STATUS_REG, BS_ALL_IRQS);

    // Enable all Broadsheet display engine interrupts
    bs_cmd_wr_reg(BS_DE_INTR_ENABLE_REG, BS_DE_ALL_IRQS);
    bs_cmd_wr_reg(BS_DE_INTR_RAW_STATUS_REG, BS_DE_ALL_IRQS);
#endif
    //ipu_adc_write_cmd(CMD,0x11);
    //ipu_adc_write_cmd(DAT,0x030a);
    //ipu_adc_write_cmd(DAT,0x0123);

/*
    	ipu_adc_write_cmd(CMD,0x10);
        __raw_writew(0x02,bsaddr);

        udelay(1);

        printk(KERN_ALERT "Product id re-get is %x\n",__raw_readw(bsaddr));
        //printk(KERN_ALERT "The new bs driver\n");
*/

#if defined(CONFIG_HW_EP3_DVT) || defined(CONFIG_HW_EP4_DVT)  || defined(CONFIG_HW_EP1_DVT)  || defined(CONFIG_HW_EP2_DVT)			
    u16 rd_reg;
    unsigned short value = 0;	
    rd_reg = bs_cmd_rd_reg(0x00a) & ~(1 << 12);
    bs_cmd_wr_reg(0x00a, (value | (1 << 12)));		//REG[000Ah] bit 12 = 1b

 //Henry Li 0927 fro saving time in resume 	
    mdelay(4);
    
    bs_cmd_init_sys_run();
    udelay(EPD_CMD_DELAY);
    rd_reg=0;
    while(!value)
	{
		value = GET_HRDY_STATUS;
   	       udelay(50);
		rd_reg++;
		if (rd_reg > 60000)
			break;
	}
    //rd_reg = bs_cmd_rd_reg(0x0204) | (1 << 7);  // spi flash control reg: Display Engine access mode is selected.
       rd_reg = 0x99;
    bs_cmd_wr_reg(0x0204, rd_reg);
/* //Henry Li 0927 fro saving time in resume 	
    udelay(EPD_CMD_DELAY);
    printk("reg[0x0204] is 0x%x\n", rd_reg);
*/    
#endif	
/* //Henry Li 0927 fro saving time in resume 	
    ipu_adc_write_cmd(CMD,0x10);
    ipu_adc_write_cmd(DAT,0x02);
    printk(KERN_ALERT "register 0x0002 content is 0x%4x\n",ipu_adc_read_data());
*/
     einkfb_debug("GPIOs and IRQ set; Broadsheet has been reset\n");
#if defined(CONFIG_HW_EP3_DVT) || defined(CONFIG_HW_EP4_DVT) 
/* //Henry Li 0927 fro saving time in resume 	
    mdelay(1);
*/    
    bs_cmd_wr_reg(0x300, BS97_INIT_VSIZE);	//Frame Data Length Register
    											//Henry: as instruction code init it as 825
/* //Henry Li 0927 fro saving time in resume 	
    mdelay(1);
*/    
#endif
    return ( result );
}
コード例 #4
0
/*!
 * Function to initialize the panel. First it resets the panel and then
 * initilizes panel.
 */
static void _init_panel(int disp)
{
	uint32_t cmd_param;
	uint32_t i;

	slcd_gpio_config();

	// Reset
	cmd_param = 0x01;
	ipu_adc_write_cmd(disp, CMD, 0x03, &cmd_param, 1);

	// Turn on oscillator
	cmd_param = 0x01;
	ipu_adc_write_cmd(disp, CMD, 0x3A, &cmd_param, 1);

	cmd_param = 0x02;
	ipu_adc_write_cmd(disp, CMD, 0x32, &cmd_param, 1);

	cmd_param = 0x01;
	ipu_adc_write_cmd(disp, CMD, 0x33, &cmd_param, 1);

	cmd_param = 0x00;
	ipu_adc_write_cmd(disp, CMD, 0x37, &cmd_param, 1);

	cmd_param = 0x0FFF;
	ipu_adc_write_cmd(disp, CMD, 0x77, &cmd_param, 1);

	cmd_param = 0x01;
	ipu_adc_write_cmd(disp, CMD, 0x72, &cmd_param, 1);

	cmd_param = 0x1C3B;
	ipu_adc_write_cmd(disp, CMD, 0x1C, &cmd_param, 1);

	cmd_param = 0x21;
	ipu_adc_write_cmd(disp, CMD, 0x52, &cmd_param, 1);

	cmd_param = 0x11;
	ipu_adc_write_cmd(disp, CMD, 0x53, &cmd_param, 1);

	cmd_param = 0x79;
	ipu_adc_write_cmd(disp, CMD, 0x24, &cmd_param, 1);

	cmd_param = 0x79;
	ipu_adc_write_cmd(disp, CMD, 0x25, &cmd_param, 1);

	cmd_param = 0x10;
	ipu_adc_write_cmd(disp, CMD, 0x26, &cmd_param, 1);

	cmd_param = 0x10;
	ipu_adc_write_cmd(disp, CMD, 0x27, &cmd_param, 1);

	cmd_param = 0x28;
	ipu_adc_write_cmd(disp, CMD, 0x61, &cmd_param, 1);

	cmd_param = 0x1A;
	ipu_adc_write_cmd(disp, CMD, 0x62, &cmd_param, 1);

	cmd_param = 0x1E;
	ipu_adc_write_cmd(disp, CMD, 0x63, &cmd_param, 1);

	cmd_param = 0x21;
	ipu_adc_write_cmd(disp, CMD, 0x64, &cmd_param, 1);

	cmd_param = 0x1B;
	ipu_adc_write_cmd(disp, CMD, 0x65, &cmd_param, 1);

	cmd_param = 0x29;
	ipu_adc_write_cmd(disp, CMD, 0x66, &cmd_param, 1);

	cmd_param = 0x205;
	ipu_adc_write_cmd(disp, CMD, 0x4D, &cmd_param, 1);

	cmd_param = 0x01;
	ipu_adc_write_cmd(disp, CMD, 0x4E, &cmd_param, 1);

	cmd_param = 0x104;
	ipu_adc_write_cmd(disp, CMD, 0x4F, &cmd_param, 1);

	cmd_param = 0x2F;
	ipu_adc_write_cmd(disp, CMD, 0x2E, &cmd_param, 1);

	cmd_param = 0x0;
	ipu_adc_write_cmd(disp, CMD, 0x29, &cmd_param, 1);

	cmd_param = 0x0;
	ipu_adc_write_cmd(disp, CMD, 0x2A, &cmd_param, 1);

	cmd_param = 0xEF;
	ipu_adc_write_cmd(disp, CMD, 0x2B, &cmd_param, 1);

	cmd_param = 0x13F;
	ipu_adc_write_cmd(disp, CMD, 0x2C, &cmd_param, 1);

	/* Window area setting */
	cmd_param = 0x0;
	ipu_adc_write_cmd(disp, CMD, 0x08, &cmd_param, 1);
	cmd_param = 0xEF;
	ipu_adc_write_cmd(disp, CMD, 0x09, &cmd_param, 1);
	cmd_param = 0x0;
	ipu_adc_write_cmd(disp, CMD, 0x0A, &cmd_param, 1);
	cmd_param = 0x13F;
	ipu_adc_write_cmd(disp, CMD, 0x0B, &cmd_param, 1);

	/* Window mode setting */
	cmd_param = 0x00;
	ipu_adc_write_cmd(disp, CMD, 0x05, &cmd_param, 1);

	/* Ram address setting */
	cmd_param = 0x0;
	ipu_adc_write_cmd(disp, CMD, 0x06, &cmd_param, 1);
	cmd_param = 0x0;
	ipu_adc_write_cmd(disp, CMD, 0x07, &cmd_param, 1);

	/* Initialize RAM */
	ipu_adc_write_cmd(disp, CMD, 0x0E, 0, 0);
	for (i = 0; i < (MXCFB_SCREEN_WIDTH * MXCFB_SCREEN_HEIGHT / 2); i++)
		ipu_adc_write_cmd(disp, DAT, 0x3FFFF, 0, 0);
	for (i = 0; i < (MXCFB_SCREEN_WIDTH * MXCFB_SCREEN_HEIGHT / 2); i++)
		ipu_adc_write_cmd(disp, DAT, 0, 0, 0);

	cmd_param = 0x1F6A;
	ipu_adc_write_cmd(disp, CMD, 0x18, &cmd_param, 1);

	cmd_param = 0x00A2;
	ipu_adc_write_cmd(disp, CMD, 0x1A, &cmd_param, 1);

	cmd_param = 0x0028;
	ipu_adc_write_cmd(disp, CMD, 0x1B, &cmd_param, 1);

	cmd_param = 0x1C3B;
	ipu_adc_write_cmd(disp, CMD, 0x1C, &cmd_param, 1);

	cmd_param = 0x0075;
	ipu_adc_write_cmd(disp, CMD, 0x1D, &cmd_param, 1);

	cmd_param = 0x003D;
	ipu_adc_write_cmd(disp, CMD, 0x1F, &cmd_param, 1);

	cmd_param = 0x0080;
	ipu_adc_write_cmd(disp, CMD, 0x20, &cmd_param, 1);

	/* DC/DC on */
	cmd_param = 0x1F6B;
	ipu_adc_write_cmd(disp, CMD, 0x18, &cmd_param, 1);
	msleep(100);

	/* VCOM on */
	cmd_param = 0x0021;
	ipu_adc_write_cmd(disp, CMD, 0x1E, &cmd_param, 1);

	/* GOE1,GOE2 setting (Gate output enable) */
	cmd_param = 0x0001;
	ipu_adc_write_cmd(disp, CMD, 0x3B, &cmd_param, 1);

	cmd_param = 0x00;
	ipu_adc_write_cmd(disp, CMD, 0x2, &cmd_param, 1);
	/* Display on */
	cmd_param = 0x00;
	ipu_adc_write_cmd(disp, CMD, 0x0, &cmd_param, 1);

	msleep(10);

	pr_debug("initialized panel\n");
}
コード例 #5
0
bool bs_hw_init(void)
{
    bool result = true;
#ifdef USE_BS_IRQ
    int  rqstatus;
#endif
    
    ipu_adc_sig_cfg_t sig = { 0, 0, 0, 0, 0, 0, 0, 0,
            IPU_ADC_BURST_WCS,
            IPU_ADC_IFC_MODE_SYS80_TYPE2,
            16, 0, 0, IPU_ADC_SER_NO_RW
    };

    // Init DI interface
    if ( IS_NELL() || IS_MARIO() || IS_ADS() )
    {
        broadsheet_screen_height = BROADSHEET_SCREEN_HEIGHT_NELL;
        broadsheet_screen_width  = BROADSHEET_SCREEN_WIDTH_NELL;
        
        broadsheet_screen_size   = BROADSHEET_SCREEN_SIZE_NELL;
    }

    ipu_adc_init_panel(BROADSHEET_DISPLAY_NUMBER,
                       broadsheet_screen_width,
                       broadsheet_screen_height,
                       BROADSHEET_PIXEL_FORMAT, broadsheet_screen_size, sig, XY, 0, VsyncInternal);

    // Set IPU timing for read cycles
    ipu_adc_init_ifc_timing(BROADSHEET_DISPLAY_NUMBER, true,
                            BROADSHEET_READ_CYCLE_TIME,
                            BROADSHEET_READ_UP_TIME,
                            BROADSHEET_READ_DOWN_TIME,
                            BROADSHEET_READ_LATCH_TIME,
                            BROADSHEET_PIXEL_CLK);
    // Set IPU timing for write cycles
    ipu_adc_init_ifc_timing(BROADSHEET_DISPLAY_NUMBER, false,
                            BROADSHEET_WRITE_CYCLE_TIME,
                            BROADSHEET_WRITE_UP_TIME,
                            BROADSHEET_WRITE_DOWN_TIME,
                            0, 0);

    ipu_adc_set_update_mode(ADC_SYS1, IPU_ADC_REFRESH_NONE, 0, 0, 0);

    gpio_lcd_active();
    slcd_gpio_config();

#ifdef CONFIG_MACH_MX31ADS
    // Reset the level translator for the two GPIO inputs (HIRQ and HRDY)
    pin_addr = PBC_BCTRL2_LDCIO_EN;
    __raw_writew(pin_addr, PBC_BASE_ADDRESS + PBC_BCTRL2_CLEAR);
#endif

#ifdef USE_BS_IRQ
    // Set up IRQ for for Broadsheet HIRQ line
    disable_irq(BROADSHEET_HIRQ_IRQ);
    set_irq_type(BROADSHEET_HIRQ_IRQ, IRQF_TRIGGER_RISING);
    rqstatus = request_irq(BROADSHEET_HIRQ_IRQ, (irq_handler_t) bs_irq_handler, 0, "eink_fb_hal_broads", NULL);
    if (rqstatus != 0) {
        einkfb_print_crit("Failed IRQ request for Broadsheet HIRQ line; request status = %d\n", rqstatus);
        result = false;
    }
#endif

     // Set up GPIO pins
    if (mxc_request_gpio(BROADSHEET_HIRQ_LINE)) {
        einkfb_print_crit("Could not obtain GPIO pin for HIRQ\n");
        result = false;
    }
    else {
        // Set HIRQ pin as input
        mxc_set_gpio_direction(BROADSHEET_HIRQ_LINE, 1);
    }
    if (mxc_request_gpio(BROADSHEET_HRDY_LINE)) {
        einkfb_print_crit("Could not obtain GPIO pin for HRDY\n");
        result = false;
    }
    else {
        // Set HRDY pin as input
        mxc_set_gpio_direction(BROADSHEET_HRDY_LINE, 1);
    }
#ifdef CONFIG_MACH_MARIO_MX
    if (mxc_request_gpio(BROADSHEET_RST_LINE)) {
        einkfb_print_crit("Could not obtain GPIO pin for RST\n");
        result = false;
    }
    else {
        // Set RST pin as output and initialize to zero (it's active LOW)
        mxc_set_gpio_direction(BROADSHEET_RST_LINE, 0);
        mxc_set_gpio_dataout(BROADSHEET_RST_LINE, 0);
    }
#endif

#ifdef CONFIG_MACH_MX31ADS
    // Enable the level translator for the two GPIO inputs (HIRQ and HRDY)
    mdelay(100);    // Pause 100 ms to allow level translator to settle
    pin_addr = PBC_BCTRL2_LDCIO_EN;
    __raw_writew(pin_addr, PBC_BASE_ADDRESS + PBC_BCTRL2_SET);
#endif

    // Reset Broadsheet
    einkfb_debug("Sending RST signal to Broadsheet...\n");
    WR_GPIO_LINE(BROADSHEET_RST_LINE, BROADSHEET_RESET_VAL);     // Assert RST
    mdelay(100);    // Pause 100 ms during reset
    WR_GPIO_LINE(BROADSHEET_RST_LINE, BROADSHEET_NON_RESET_VAL); // Clear RST
    mdelay(400);    // Pause 400 ms to allow Broasheet time to come up
    einkfb_debug("Broadsheet reset done.\n");

#ifdef TEST_BROADSHEET
    test_broadsheet(disp);
#endif

#ifdef USE_BS_IRQ
    // Set up Broadsheet for interrupt generation (enable all conditions)
    bs_cmd_wr_reg(BS_INTR_CTL_REG, BS_ALL_IRQS);
    bs_cmd_wr_reg(BS_INTR_RAW_STATUS_REG, BS_ALL_IRQS);

    // Enable all Broadsheet display engine interrupts
    bs_cmd_wr_reg(BS_DE_INTR_ENABLE_REG, BS_DE_ALL_IRQS);
    bs_cmd_wr_reg(BS_DE_INTR_RAW_STATUS_REG, BS_DE_ALL_IRQS);
#endif

    einkfb_debug("GPIOs and IRQ set; Broadsheet has been reset\n");
    
    return ( result );
}