//Aviod udelay problem cause tps61165 Es mode time window wrong.
static void select_1wire_mode(void)
{
	gpio_direction_output(lcd_bkl_ctl, 1);
	myudelay(300);//myudelay(275);//myudelay(360);//myudelay(150);
	gpio_direction_output(lcd_bkl_ctl, 0);
	myudelay(600);//myudelay(650);//myudelay(840);//myudelay(300);				
	gpio_direction_output(lcd_bkl_ctl, 1);
	myudelay(700);//myudelay(770);//myudelay(1000);//myudelay(700);				
	
}
Esempio n. 2
0
//added by zte_gequn091966,20110428
static void select_1wire_mode(void)
{
	gpio_direction_output(lcd_bkl_ctl, 1);
	myudelay(120);
	gpio_direction_output(lcd_bkl_ctl, 0);
	myudelay(280);				////ZTE_LCD_LUYA_20100226_001
	gpio_direction_output(lcd_bkl_ctl, 1);
	myudelay(650);				////ZTE_LCD_LUYA_20100226_001
	
}
static void send_bkl_data(int level)
{
	unsigned int i,j;
	
	i = level & 0x1F;
	//printk("PM_DEBUG_MXP: tps61165 backlight data = %d \n",i);
	gpio_direction_output(lcd_bkl_ctl, 1);
	myudelay(10);
	//printk("PM_DEBUG_MXP: send_bkl_data \n");
	for(j = 0; j < 8; j++)
	{
		if(i & 0x80)
		{
			gpio_direction_output(lcd_bkl_ctl, 0);
			myudelay(10);
			gpio_direction_output(lcd_bkl_ctl, 1);
			myudelay(40);//myudelay(180);
		}
		else
		{
			gpio_direction_output(lcd_bkl_ctl, 0);
			myudelay(40);//myudelay(180);
			gpio_direction_output(lcd_bkl_ctl, 1);
			myudelay(10);
		}
		i <<= 1;
	}
	gpio_direction_output(lcd_bkl_ctl, 0);
	myudelay(10);
	gpio_direction_output(lcd_bkl_ctl, 1);

}
static void send_bkl_address(void)
{
	unsigned int i,j;
	i = TPS61165_DEVICE_ADDRESS;//0x72
	gpio_direction_output(lcd_bkl_ctl, 1);
	myudelay(10);
	//printk("PM_DEBUG_MXP: send_bkl_address \n");
	for(j = 0; j < 8; j++)
	{
		if(i & 0x80)
		{
			gpio_direction_output(lcd_bkl_ctl, 0);
			myudelay(10);
			gpio_direction_output(lcd_bkl_ctl, 1);
			myudelay(40);//myudelay(180);
		}
		else
		{
			gpio_direction_output(lcd_bkl_ctl, 0);
			myudelay(40);//myudelay(180);
			gpio_direction_output(lcd_bkl_ctl, 1);
			myudelay(10);
		}
		i <<= 1;
	}
	gpio_direction_output(lcd_bkl_ctl, 0);
	myudelay(10);
	gpio_direction_output(lcd_bkl_ctl, 1);

}
Esempio n. 5
0
static void send_bkl_data(int level)
{
	unsigned int i,j;
	i = level & 0x1F;
	gpio_direction_output(lcd_bkl_ctl, 1);
	myudelay(10);
	printk("[LY] send_bkl_data \n");
	for(j = 0; j < 8; j++)
	{
		if(i & 0x80)
		{
			gpio_direction_output(lcd_bkl_ctl, 0);
			myudelay(10);
			gpio_direction_output(lcd_bkl_ctl, 1);
			myudelay(180);
		}
		else
		{
			gpio_direction_output(lcd_bkl_ctl, 0);
			myudelay(180);
			gpio_direction_output(lcd_bkl_ctl, 1);
			myudelay(10);
		}
		i <<= 1;
	}
	gpio_direction_output(lcd_bkl_ctl, 0);
	myudelay(10);
	gpio_direction_output(lcd_bkl_ctl, 1);

}
Esempio n. 6
0
static void send_bkl_address(void)
{
	unsigned int i,j;
	i = 0x72;
	gpio_direction_output(lcd_bkl_ctl, 1);
	myudelay(10);
	printk("[LY] send_bkl_address \n");
	for(j = 0; j < 8; j++)
	{
		if(i & 0x80)
		{
			gpio_direction_output(lcd_bkl_ctl, 0);
			myudelay(10);
			gpio_direction_output(lcd_bkl_ctl, 1);
			myudelay(180);
		}
		else
		{
			gpio_direction_output(lcd_bkl_ctl, 0);
			myudelay(180);
			gpio_direction_output(lcd_bkl_ctl, 1);
			myudelay(10);
		}
		i <<= 1;
	}
	gpio_direction_output(lcd_bkl_ctl, 0);
	myudelay(10);
	gpio_direction_output(lcd_bkl_ctl, 1);

}
Esempio n. 7
0
static void atp_attach(struct device * parent, struct device * self, void *aux)
{
	atp_sata_t *sc = (atp_sata_t * )self;
        struct pci_attach_args *pa = aux;
        pci_chipset_tag_t pc = pa->pa_pc;
        bus_space_tag_t iot = pa->pa_iot;
        bus_addr_t iobase;
        bus_size_t iosize;
        bus_addr_t ideaddr;
	atp_sata_info_t info;
	u32	iog_base;
	u32	ioaddr;
	int i;

        if (pci_io_find(pc, pa->pa_tag, 0x14, &iobase, &iosize))
        {
               printf(": can't find i/o space\n");
               return;
        }

        if (bus_space_map(iot, iobase, iosize, 0,  &sc->reg_base))
        {
               printf(": can't map i/o space\n");
               return;
        }

	ioaddr = sc->reg_base; 
        if (pci_io_find(pc, pa->pa_tag, 0x10, &iobase, &iosize))
        {
               printf(": can't find i/o space\n");
               return;
        }

        if (bus_space_map(iot, iobase, iosize, 0,  &ideaddr))
        {
               printf(": can't map i/o space\n");
               return;
        }

	iog_base = ioaddr + 0x100;
	outb(iog_base + 0x0004,0x01);//send COMRESET
	while(inb(iog_base + 0x0004) & 0x01)
	{
	      myudelay(10);
	}
	outb(iog_base + 0x0004,0x0);

	for(i = 0;i <= 1;i++)
	{
		info.sata_reg_base = ioaddr + i * 0x80;
		info.flags = i;
		info.aa_link.aa_type=0xff; //just for not match ide
		config_found(self,(void *)&info,NULL);
	}
 
	sc->sc_wdcdev.PIO_cap = 0;
	sc->sc_wdcdev.DMA_cap = 0;
	sc->sc_wdcdev.channels = sc->wdc_chanarray;
	sc->sc_wdcdev.nchannels = 1;
	sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA32;//WDC_CAPABILITY_DATA16;
	sc->wdc_chanarray[0] = &sc->wdc_channel;
	sc->wdc_channel.channel = 0;
	sc->wdc_channel.wdc = &sc->sc_wdcdev;
	sc->wdc_channel.ch_queue =
	    malloc(sizeof(struct channel_queue), M_DEVBUF, M_NOWAIT);
	if (sc->wdc_channel.ch_queue == NULL) {
		printf("%s: "
			"cannot allocate memory for command queue",
		sc->sc_wdcdev.sc_dev.dv_xname);
		 return ;
	}
	 sc->wdc_channel.cmd_iot=iot;
	 sc->wdc_channel.ctl_iot=iot;
	 sc->wdc_channel.cmd_ioh= ideaddr+0x80;
	 sc->wdc_channel.ctl_ioh= ideaddr+0x8e;
			sc->wdc_channel.data32iot = sc->wdc_channel.cmd_iot;
			sc->wdc_channel.data32ioh = sc->wdc_channel.cmd_ioh;

	 wdcattach(sc->wdc_chanarray[0]);
}