static void bt_device_init(struct bt_dev_data *pdata) { if(pdata->gpio_reset > 0 ) { amlogic_gpio_request(pdata->gpio_reset, BT_RFKILL); } if(pdata->gpio_en > 0 ) { amlogic_gpio_request(pdata->gpio_en, BT_RFKILL); } if(pdata->gpio_wake > 0 ) { amlogic_gpio_request(pdata->gpio_wake, BT_RFKILL); amlogic_gpio_direction_output(pdata->gpio_wake, 1, BT_RFKILL); } }
static int si2168_fe_enter_mode(struct aml_fe *fe, int mode) { struct aml_fe_dev *dev = fe->dtv_demod; int ret; pr_dbg("=========================si2168 demod init\r\n"); ret=amlogic_gpio_request(dev->reset_gpio, "si2168_reset"); ret = amlogic_gpio_direction_output(dev->reset_gpio, dev->reset_value, "si2168_reset"); msleep(300); ret=amlogic_gpio_direction_output(dev->reset_gpio, !dev->reset_value, "si2168_reset"); //enable tuner power msleep(200); //reset int standard; standard=SILABS_DVB_T2; //Initialize LSI printf("Initializing LSI .. "); SiLabs_API_SW_Init(&front_end, DEMOD_ADDRESS+(fe1*2), TUNER_ADDRESS_TER+(fe1*2), TUNER_ADDRESS_SAT+(fe1*2)); front_end.Si2168_FE->demod->i2c=DEMOD_ADDRESS; SiLabs_API_switch_to_standard (&front_end, standard, 1); printk("chip id is %d, i2c is %x\n",front_end.chip,front_end.Si2168_FE->demod->i2c); SiLabs_API_Tuner_I2C_Enable(&front_end); if(MDrv_Tuner_Init()==1) pr_dbg("TUNER OK\n"); else pr_dbg("TUNER NG\n"); SiLabs_API_Tuner_I2C_Disable(&front_end); return 0; }
static int AVL6211_Reset(int reset_gpio) { amlogic_gpio_request(reset_gpio,device_name); amlogic_gpio_direction_output(reset_gpio, 0, device_name); msleep(300); amlogic_gpio_direction_output(reset_gpio, 1, device_name); return 0; }
// get gpio configuration from device tree. static void aml_config_gpio_irq(void) { int ret = 0; unsigned int gpio_irq; gpio_irq = devinfo->config.gpio_intr; ret = amlogic_gpio_request(gpio_irq, gMhlI2cIdTable[0].name); ret |= amlogic_gpio_direction_input(gpio_irq, gMhlI2cIdTable[0].name); ret |= amlogic_gpio_to_irq(gpio_irq, gMhlI2cIdTable[0].name, AML_GPIO_IRQ((gMhlDevice.pI2cClient->irq-INT_GPIO_0),FILTER_NUM7,GPIO_IRQ_LOW)); printk("sii5293 config gpio_irq, irq = %d, ret = %d\n",gMhlDevice.pI2cClient->irq, ret); return ; }
static long wifi_power_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { struct wifi_power_platform_data *pdata = NULL; pdata = (struct wifi_power_platform_data*)devp->platform_data; if(pdata == NULL){ printk("%s platform data is required!\n",__FUNCTION__); return -1; } amlogic_gpio_request(pdata->power_gpio,WIFI_POWER_MODULE_NAME); if(wifi_power_on_pin2) amlogic_gpio_request(pdata->power_gpio2,WIFI_POWER_MODULE_NAME); switch (cmd) { case POWER_UP: usb_wifi_power(!power); mdelay(500); usb_wifi_power(power); printk(KERN_INFO "Set usb wifi power up!\n"); break; case POWER_DOWN: usb_wifi_power(!power); printk(KERN_INFO "Set usb wifi power down!\n"); break; default: printk(KERN_ERR "usb wifi_power_ioctl: default !!!\n"); return - EINVAL; } return 0; }
int amlogic_request_gpio_to_irq(unsigned int pin,const char *label,unsigned int flag) { int ret=-1; unsigned long flags; if(gpio_range_check(pin)) return -1; ret=amlogic_gpio_request(pin, label); if(!ret) { spin_lock_irqsave(&gpio_irqlock, flags); gpio_flag=flag; __gpio_to_irq(pin); spin_unlock_irqrestore(&gpio_irqlock, flags); } return ret; }
void demod_reset(struct cxd2837_state *state) { //gpio_request(state->config.reset_pin, "cxd2837:RESET"); pr_info("the reset pin is %x\n",state->config.reset_pin); //state->config.reset_pin = 6; // gpio_out(state->config.reset_pin, 0); amlogic_gpio_request(state->config.reset_pin, "cxd2837_reset"); amlogic_gpio_direction_output(state->config.reset_pin, 0, "cxd2837_reset"); pr_dbg("Jay reset pin \n"); msleep(600); // gpio_out(state->config.reset_pin, 1); amlogic_gpio_direction_output(state->config.reset_pin, 1, "cxd2837_reset"); msleep(200); }