예제 #1
0
static void key_in_gpio_init(void)
{
	int	i;

	rockchip_mux_api_set(KROW0_IOMUX_PINNAME,0);
	rockchip_mux_api_set(KROW1_IOMUX_PINNAME,0);
	rockchip_mux_api_set(KROW2_IOMUX_PINNAME,0);
	rockchip_mux_api_set(KCOL0_IOMUX_PINNAME,0);
	rockchip_mux_api_set(KCOL1_IOMUX_PINNAME,0);
	rockchip_mux_api_set(KCOL2_IOMUX_PINNAME,0);
	
	for(i = 0; i <MAX_GPIO_IN_CNT; i++) {
		GPIOSetPinLevel(gpio_in[i], GPIO_HIGH);
		GPIOSetPinDirection(gpio_in[i], GPIO_IN);
		GPIOPullUpDown(gpio_in[i],GPIONormal);
	}

	for(i = 0; i < MAX_GPIO_OUT_CNT; i++) {
		GPIOSetPinLevel(gpio_out[i], GPIO_HIGH);
		GPIOSetPinDirection(gpio_out[i], GPIO_OUT);
		GPIOPullUpDown(gpio_out[i],GPIONormal);
	}

	return;
}
예제 #2
0
static void rk28_power_on(void)
{

	rockchip_mux_api_set((char *)DDR_CTL_IOMUX_PINNAME,(unsigned int)DDR_CTL_IOMUX_PINDIR);
	GPIOSetPinLevel(DDR_CTL_IOPIN,GPIO_LOW);
	GPIOSetPinDirection(DDR_CTL_IOPIN,GPIO_OUT);
	GPIOPullUpDown(DDR_CTL_IOPIN,GPIONormal);
	GPIOSetPinLevel(DDR_CTL_IOPIN,GPIO_LOW);

	rockchip_mux_api_set((char *)HOST_ON_IOMUX_PINNAME,(unsigned int)HOST_ON_IOMUX_PINDIR);
	GPIOSetPinLevel(HOST_ON_IOPIN,GPIO_LOW);
	GPIOSetPinDirection(HOST_ON_IOPIN,GPIO_OUT);
	GPIOPullUpDown(HOST_ON_IOPIN,GPIONormal);
	GPIOSetPinLevel(HOST_ON_IOPIN,GPIO_LOW);

	rockchip_mux_api_set((char *)SLEEP_CTL_IOMUX_PINNAME,(unsigned int)SLEEP_CTL_IOMUX_PINDIR);
	GPIOSetPinLevel(SLEEP_CTL_IOPIN,GPIO_HIGH);
	GPIOSetPinDirection(SLEEP_CTL_IOPIN,GPIO_OUT);
	GPIOPullUpDown(SLEEP_CTL_IOPIN,GPIONormal);
	GPIOSetPinLevel(SLEEP_CTL_IOPIN,GPIO_HIGH);

	rockchip_mux_api_set((char *)PWR_ON_IOMUX_PINNAME,(unsigned int)PWR_ON_IOMUX_PINDIR);
	GPIOSetPinLevel(PWR_ON_IOPIN,GPIO_HIGH);
	GPIOSetPinDirection(PWR_ON_IOPIN,GPIO_OUT);
	GPIOPullUpDown(PWR_ON_IOPIN,GPIOPullUp);
	GPIOSetPinLevel(PWR_ON_IOPIN,GPIO_HIGH);

#if defined (CONFIG_SND_SOC_ES8388)
	/*disable audio output */
	rockchip_mux_api_set((char *)GPIOE_SPI1_FLASH_SEL2_NAME, (unsigned int)IOMUXA_GPIO1_A3B7);
	GPIOSetPinLevel(GPIOPortF_Pin7,GPIO_LOW);
	GPIOSetPinDirection(GPIOPortF_Pin7, GPIO_OUT);
	GPIOSetPinLevel(GPIOPortF_Pin7,GPIO_LOW);
#endif
}
예제 #3
0
static void key_signal_io_init_hw(void)
{
	int ret = 0;

	rockchip_mux_api_set(GPIOA0_HOSTDATA16_SEL_NAME, PAGE_DOWN_IOMUX_PINDIR);   
	GPIOPullUpDown(PAGE_DOWN_IOPIN,GPIOPullUp);
	GPIOSetPinDirection(PAGE_DOWN_IOPIN, GPIO_IN);

	rockchip_mux_api_set(GPIOA1_HOSTDATA17_SEL_NAME, IOMUXB_GPIO0_A1);  
	GPIOPullUpDown(PAGE_UP_IOPIN,GPIOPullUp);
	GPIOSetPinDirection(PAGE_UP_IOPIN, GPIO_IN);

	rockchip_mux_api_set(GPIOE_I2C0_SEL_NAME, IOMUXA_GPIO1_A45);   
	GPIOPullUpDown(VOL_UP_IOPIN,GPIOPullUp);
	GPIOSetPinDirection(VOL_UP_IOPIN, GPIO_IN);

	rockchip_mux_api_set(GPIOE_I2C0_SEL_NAME, IOMUXA_GPIO1_A45);  
	GPIOPullUpDown(VOL_DOWN_IOPIN,GPIOPullUp);
	GPIOSetPinDirection(VOL_DOWN_IOPIN, GPIO_IN);

	ret = request_gpio_irq(PAGE_DOWN_IOPIN,(pFunc)rk28_key_down_irq_handler,GPIOEdgelRising,NULL);
	if (ret)
		goto fail;

	ret = request_gpio_irq(PAGE_UP_IOPIN,(pFunc)rk28_key_up_irq_handler,GPIOEdgelRising,NULL);
	if (ret)
		goto fail;

	ret = request_gpio_irq(VOL_UP_IOPIN,(pFunc)rk28_key_vol_up_irq_handler,GPIOEdgelRising,NULL);
	if (ret)
		goto fail;

	ret = request_gpio_irq(VOL_DOWN_IOPIN,(pFunc)rk28_key_vol_down_irq_handler,GPIOEdgelRising,NULL);
	if (ret)
		goto fail;
	INIT_WORK(&scan_page_up_task,page_up_key_handle);
	INIT_WORK(&scan_page_down_task,page_down_key_handle);
	INIT_WORK(&scan_vol_up_task,vol_up_key_handle);
	INIT_WORK(&scan_vol_down_task,vol_down_key_handle);
	
	return;
fail:
	printk("%s %d\n", __FUNCTION__,__LINE__);
	return;
}
예제 #4
0
void rk28_power_off(void)
{
	local_irq_enable();     /* open for some logs */
	rockchip_mux_api_set((char *)PLAY_ON_IOMUX_PINNAME,(unsigned int)PLAY_ON_IOMUX_PINDIR);
	GPIOPullUpDown(PLAY_ON_IOPIN,GPIOPullDown);
	
	rockchip_mux_api_set((char *)PWR_ON_IOMUX_PINNAME,PWR_ON_IOMUX_PINDIR);
	GPIOSetPinDirection(PWR_ON_IOPIN,GPIO_OUT);
	GPIOSetPinLevel(PWR_ON_IOPIN,GPIO_LOW);
	while( 1 ) {
		rockchip_mux_api_set((char *)PWR_ON_IOMUX_PINNAME,(unsigned int)PWR_ON_IOMUX_PINDIR);
		GPIOSetPinDirection(PWR_ON_IOPIN,GPIO_OUT);
		if(GPIOGetPinLevel(PWR_ON_IOPIN) == GPIO_HIGH)
			GPIOSetPinLevel(PWR_ON_IOPIN,GPIO_LOW);
		if(GPIOGetPinLevel(PLAY_ON_IOPIN) == GPIO_HIGH)
			break;
	}
	rk28_restart( 0 );
}
예제 #5
0
static int __devinit rk28_AD_button_probe(struct platform_device *pdev)
{
	struct rk28_AD_button *AD_button;
	struct input_dev *input_dev;
	int  error,i;
	AD_button = kzalloc(sizeof(struct rk28_AD_button), GFP_KERNEL);
	/* Create and register the input driver. */
	input_dev = input_allocate_device();
	if (!input_dev || !AD_button) {
		dev_err(&pdev->dev, "failed to allocate input device\n");
		error = -ENOMEM;
		goto failed1;
	}

    //a@nzy
	int ret = request_irq(IRQ_NR_ADC, rk28_AD_irq_handler, 0, "ADC", NULL);
	if (ret < 0) {
		printk(KERN_CRIT "Can't register IRQ for ADC\n");
		return ret;
	}
	
	memcpy(AD_button->keycodes, initkey_code, sizeof(AD_button->keycodes));
	input_dev->name = pdev->name;
	input_dev->open = rk28_AD_button_open;
	input_dev->close = rk28_AD_button_close;
	input_dev->dev.parent = &pdev->dev;
	input_dev->phys = KEY_PHYS_NAME;
	input_dev->id.vendor = 0x0001;
	input_dev->id.product = 0x0001;
	input_dev->id.version = 0x0100;
	input_dev->keycode = AD_button->keycodes;
	input_dev->keycodesize = sizeof(unsigned char);
	input_dev->keycodemax = ARRAY_SIZE(initkey_code);
	for (i = 0; i < ARRAY_SIZE(initkey_code); i++)
		set_bit(initkey_code[i], input_dev->keybit);
	clear_bit(0, input_dev->keybit);

	AD_button->input_dev = input_dev;
	input_set_drvdata(input_dev, AD_button);

	input_dev->evbit[0] = BIT_MASK(EV_KEY) ;

	platform_set_drvdata(pdev, AD_button);

	ADCInit();
	prockAD_button=AD_button;

	/* Register the input device */
	error = input_register_device(input_dev);
	if (error) {
		dev_err(&pdev->dev, "failed to register input device\n");
		goto failed2;
	}

	setup_timer(&AD_button->timer, rk28_adkeyscan_timer, (unsigned long)AD_button);
	//mod_timer(&AD_button->timer, 100);
	AD_button->timer.expires  = jiffies + 3;
	add_timer(&AD_button->timer);
#if 0//def CONFIG_MACH_RK2808SDK
        error = request_gpio_irq(WAKEUP_KEY_PORT,rk28_AD_irq_handler,GPIOEdgelFalling,NULL);
	if(error)
	{
		printk("unable to request recover key IRQ\n");
		goto failed2;
	}	
#endif        

#if 1//def CONFIG_MACH_PWS700AA
    error = request_gpio_irq(GPIOPortE_Pin2,rk28_AD_irq_handler,GPIOEdgelRising,NULL);
    GPIOPullUpDown(GPIOPortE_Pin2,GPIOPullDown);    
	if(error)
	{
		printk("unable to request recover key IRQ\n");
		goto failed2;
	}	
#endif        

	return 0;

failed2:
	input_unregister_device(AD_button->input_dev);
	platform_set_drvdata(pdev, NULL);	
failed1:
	input_free_device(input_dev);
	kfree(AD_button);
	return error;
}
예제 #6
0
static int	__devinit xpt2046_ts_proble(struct spi_device *spi)
{

    struct XPT2046_TS_EVENT  *ts_dev;
    struct input_dev *xpt2046_ts_dev;
    unsigned int err = 0;

    rk28printk("************>%s.....%s.....%d\n",__FILE__,__FUNCTION__,__LINE__);


    ts_dev=kzalloc(sizeof(struct XPT2046_TS_EVENT), GFP_KERNEL);
    if(!ts_dev)
    {
        printk("failed to allocate memory!!\n");
        goto nomem;
    }

    ts_dev->spi = spi;	/*ts_dev to spi reference*/
    printk("touch device spi speed = %d\n",spi->max_speed_hz);

    xpt2046_ts_dev = input_allocate_device();
    if(!xpt2046_ts_dev)
    {
        printk("rk28 xpt2046_ts allocate input device failed!!!\n");
        goto fail1;
    }
    ts_dev->input = xpt2046_ts_dev;
    /*init	timer to dispose workqueue */
    hrtimer_init(&ts_dev->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
    ts_dev->timer.function = xpt2046_dostimer;

    ts_dev->x = 0;
    ts_dev->y = 0;
    ts_dev->z1 = 0;
    ts_dev->z2 = 0;
    ts_dev->touch_x = 0;
    ts_dev->touch_y = 0;
    ts_dev->status = 0;
    ts_dev->pendown = 0;
    ts_dev->irq =XPT2046_IRQ;
    snprintf(ts_dev->phys,sizeof(ts_dev->phys),"%s/input0",spi->dev.bus_id);

    xpt2046_ts_dev->evbit[0] = BIT_MASK(EV_ABS)|BIT_MASK(EV_KEY);
    xpt2046_ts_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
    //input_set_abs_params(xpt2046_ts_dev,ABS_X,400,3680,0,0);
    //input_set_abs_params(xpt2046_ts_dev,ABS_Y,550,3350,0,0);

    input_set_abs_params(xpt2046_ts_dev,ABS_X,0,LCD_MAX_LENGTH,0,0);
    input_set_abs_params(xpt2046_ts_dev,ABS_Y,0,LCD_MAX_WIDTH,0,0);
    //input_set_abs_params(xpt2046_ts_dev, ABS_PRESSURE,0,4096, 0, 0);
    xpt2046_ts_dev->name = XPT2046_NAME;

#ifdef CONFIG_ANDROID_POWER

    ts_early_suspend.suspend = rk28_ts_suspend;

    ts_early_suspend.resume = rk28_ts_resume;

    android_register_early_suspend(&ts_early_suspend);

#endif
    xpt2046_ts_dev->phys = ts_dev->phys;


    dev_set_drvdata(&spi->dev, ts_dev);
    xpt2046_ts_dev->dev.parent = &spi->dev;

    //xpt2046_read_values(ts_dev,MAX_SAMPLE_TIMES);
    xpt2046_read_values(ts_dev);
    rk28printk("************>%s....x=%d...y=%d...z1=%d...z2=%d\n",__FUNCTION__,ts_dev->x,ts_dev->y,ts_dev->z1,ts_dev->z2);

    ///__raw_writel(__raw_readl(GPIO1_BASE_ADDR_VA + 0x30)|0x80,(GPIO1_BASE_ADDR_VA + 0x30));
    //err = request_irq(ts_dev->irq,xpt2046_ts_interrupt,IRQF_TRIGGER_FALLING,spi->dev.driver->name,ts_dev);
    GPIOPullUpDown(PT2046_PENIRQ,GPIOPullUp);
    err = request_gpio_irq(PT2046_PENIRQ,xpt2046_ts_interrupt,GPIOEdgelFalling,ts_dev);
    if(err<0)
    {
        printk("xpt2046 request irq failed !!\n");
        err = -EBUSY;
        goto fail1;
    }
    err = input_register_device(xpt2046_ts_dev);
    if(err)
        goto fail2;
    return err;

fail2:
    free_irq(XPT2046_IRQ,NULL);

fail1:
    input_free_device(xpt2046_ts_dev);
    hrtimer_cancel(&ts_dev->timer);
nomem:
    kfree(ts_dev);

    return err;
}