/*
*******************************************************************************
*                     pin_init
*
* Description:
*    void
*
* Parameters:
*    void
*
* Return value:
*    void
*
* note:
*    void
*
*******************************************************************************
*/
static int alloc_pin(struct sw_hci_hcd *sw_ehci)
{
    u32 ret = 1;

    if(sw_ehci->drv_vbus_gpio_valid){
        ret = gpio_request(sw_ehci->drv_vbus_gpio_set.gpio.gpio, NULL);
        if(ret != 0){
            DMSG_PANIC("ERR: gpio_request failed\n");
            sw_ehci->drv_vbus_gpio_valid = 0;
        }else{
            /* set config, ouput */
            sw_gpio_setcfg(sw_ehci->drv_vbus_gpio_set.gpio.gpio, 1);

            /* reserved is pull down */
            sw_gpio_setpull(sw_ehci->drv_vbus_gpio_set.gpio.gpio, 2);
        }
    }

    if(sw_ehci->usb_restrict_valid){
        ret = gpio_request(sw_ehci->restrict_gpio_set.gpio.gpio, NULL);
        if(ret != 0){
            DMSG_PANIC("ERR: gpio_request failed\n");
            sw_ehci->usb_restrict_valid = 0;
        }else{
            /* set config, ouput */
            sw_gpio_setcfg(sw_ehci->restrict_gpio_set.gpio.gpio, 1);

            /* reserved is pull down */
            sw_gpio_setpull(sw_ehci->restrict_gpio_set.gpio.gpio, 2);
        }
    }
    if(sw_ehci->usb_restrict_valid){
        if(sw_ehci->usb_restrict_flag){
             __gpio_set_value(sw_ehci->restrict_gpio_set.gpio.gpio, 0);
        }else{
             __gpio_set_value(sw_ehci->restrict_gpio_set.gpio.gpio, 1);
        }
    }

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

	int ret = 0;
    if(_mt5931_powered_on == 0) 
	{ 
        _mt5931_powered_on = 1;         
        printk(KERN_INFO "[mt5931_power_on] config EINT_PIN\n"); 
            
		ret = gpio_request(GPIO_MT5931_PMU_EN, "MT5931_PMU_EN");
		if (ret) 
		{          
			printk("failed to request MT5931_PMU_EN %d!\n", GPIO_MT5931_PMU_EN);          
			return -1;	      
		}         //set the gpio to output mode, low val  
		
            
		ret = gpio_request(GPIO_MT5931_RST, "MT5931_RST");  
		if (ret) 
		{          
			printk("failed to request MT5931_RST %d!\n", GPIO_MT5931_RST);          
			return -1;	      
		} 
              

	#if 0
		mt_wifi_disable_irq(); 
		mt_set_gpio_mode(GPIO_WIFI_EINT_PIN, GPIO_WIFI_EINT_PIN_M_EINT); /* EINT5 */ 
		mt_set_gpio_pull_enable(GPIO_WIFI_PMU_EN_PIN, GPIO_PULL_DISABLE);
		if(0 != sw_gpio_eint_set_enable(gpio_eint, 0))
			printk("set enable status failed\n");
				sw_gpio_setcfg(gpio_eint,6);//EINT6
		sw_gpio_setpull(gpio_dis,0);//pull disabled
	#endif

	
		
		gpio_direction_output(GPIO_MT5931_RST, 0);
		gpio_direction_output(GPIO_MT5931_PMU_EN, 0);
		msleep(MT5931_OFF_TIME);
		gpio_direction_output(GPIO_MT5931_PMU_EN, 1);
		msleep(MT5931_PMU_EN_TIME);
		gpio_direction_output(GPIO_MT5931_RST, 1);
		msleep(MT5931_RST_TIME);


    }else{
    	printk("mt5931 unmatched power on\n");
    } 
	return 0; 
}
예제 #3
0
static int	gpio_sw_pull_set(struct gpio_sw_classdev *gpio_sw_cdev,int  pull)
{
    struct gpio_sw *gpio = to_gpio(gpio_sw_cdev);
    int ret ;

    GPIO_SW_DEBUG("attending gpio_sw_pull_set \n");
    GPIO_SW_DEBUG("pio_hdle is %u \n",gpio->cdev.pio_hdle);

    ret =   sw_gpio_setpull(gpio->cdev.pio_hdle, pull);
    if ( !ret )
        gpio_sw_cdev->pull=pull;
    GPIO_SW_DEBUG("left gpio_sw_pull_set \n");
    return ret ;
}