void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *dev, int width) { unsigned int gpio; #if defined (CONFIG_TARGET_LOCALE_EUR) || defined(CONFIG_TARGET_LOCALE_HKTW) || defined (CONFIG_TARGET_LOCALE_HKTW_FET) || defined(CONFIG_TARGET_LOCALE_VZW) || defined(CONFIG_TARGET_LOCALE_USAGSM) if (HWREV >= 12) { #else /* CONFIG_TARGET_LOCALE_KOR */ if (HWREV >= 10 && HWREV != 17) { #endif /* CONFIG_TARGET_LOCALE */ switch (width) { /* Channel 3 supports 4-bit bus width */ case 0: case 1: case 4: /* Set all the necessary GPIO function and pull up/down */ for (gpio = S5PV210_GPG3(0); gpio <= S5PV210_GPG3(6); gpio++) { if (gpio != S5PV210_GPG3(2)) { s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); } } writel(0x2aaa, S5PV210_GPG3DRV); /* Chip detect pin Pull up*/ /* S5PV210_GPG3(2) is WLAN_reset, Chip detect pin is not required. */ // s3c_gpio_setpull(S5PV210_GPG3(2), S3C_GPIO_PULL_UP); break; default: printk(KERN_ERR "Wrong SD/MMC bus width : %d\n", width); } } } #define S3C_SDHCI_CTRL3_FCSELTX_INVERT (0) #define S3C_SDHCI_CTRL3_FCSELTX_BASIC (S3C_SDHCI_CTRL3_FCSEL3 | S3C_SDHCI_CTRL3_FCSEL2) #define S3C_SDHCI_CTRL3_FCSELRX_INVERT (0) #define S3C_SDHCI_CTRL3_FCSELRX_BASIC (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0) void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev, void __iomem *r, struct mmc_ios *ios, struct mmc_card *card) { u32 ctrl2; u32 ctrl3; ctrl2 = readl(r + S3C_SDHCI_CONTROL2); ctrl2 &= S3C_SDHCI_CTRL2_SELBASECLK_MASK; ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR | S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK | S3C_SDHCI_CTRL2_DFCNT_NONE | S3C_SDHCI_CTRL2_ENCLKOUTHOLD); if (ios->clock <= (400 * 1000)) { ctrl2 &= ~(S3C_SDHCI_CTRL2_ENFBCLKTX | S3C_SDHCI_CTRL2_ENFBCLKRX); ctrl3 = 0; } else { u32 range_start; u32 range_end; ctrl2 |= S3C_SDHCI_CTRL2_ENFBCLKTX | S3C_SDHCI_CTRL2_ENFBCLKRX; if (card->type == MMC_TYPE_MMC) /* MMC */ range_start = 20 * 1000 * 1000; else /* SD, SDIO */ range_start = 25 * 1000 * 1000; range_end = 37 * 1000 * 1000; if ((ios->clock > range_start) && (ios->clock < range_end)) { ctrl3 = S3C_SDHCI_CTRL3_FCSELTX_BASIC | S3C_SDHCI_CTRL3_FCSELRX_BASIC; } else { #if defined (CONFIG_TARGET_LOCALE_EUR) || defined (CONFIG_TARGET_LOCALE_HKTW) || defined (CONFIG_TARGET_LOCALE_HKTW_FET) || defined (CONFIG_TARGET_LOCALE_USAGSM) if (card->type == MMC_TYPE_SD) ctrl3 = S3C_SDHCI_CTRL3_FCSELTX_BASIC | S3C_SDHCI_CTRL3_FCSELRX_BASIC; else #endif /* CONFIG_TARGET_LOCALE_EUR */ ctrl3 = S3C_SDHCI_CTRL3_FCSELTX_BASIC | S3C_SDHCI_CTRL3_FCSELRX_INVERT; } } writel(ctrl2, r + S3C_SDHCI_CONTROL2); writel(ctrl3, r + S3C_SDHCI_CONTROL3); }
static int s6d6aa1_probe(struct device *dev) { int ret = 0; struct lcd_info *lcd; lcd = kzalloc(sizeof(struct lcd_info), GFP_KERNEL); if (!lcd) { pr_err("failed to allocate for lcd\n"); ret = -ENOMEM; goto err_alloc; } g_lcd = lcd; lcd->ld = lcd_device_register("panel", dev, lcd, &panel_lcd_ops); if (IS_ERR(lcd->ld)) { pr_err("failed to register lcd device\n"); ret = PTR_ERR(lcd->ld); goto out_free_lcd; } lcd->bd = backlight_device_register("panel", dev, lcd, &panel_backlight_ops, NULL); if (IS_ERR(lcd->bd)) { pr_err("failed to register backlight device\n"); ret = PTR_ERR(lcd->bd); goto out_free_backlight; } lcd->dev = dev; lcd->dsim = (struct dsim_global *)dev_get_drvdata(dev->parent); lcd->bd->props.max_brightness = MAX_BRIGHTNESS; lcd->bd->props.brightness = DEFAULT_BRIGHTNESS; lcd->bl = 0; lcd->current_bl = lcd->bl; lcd->power = FB_BLANK_UNBLANK; lcd->ldi_enable = 1; lcd->connected = 1; ret = device_create_file(&lcd->ld->dev, &dev_attr_lcd_type); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->bd->dev, &dev_attr_auto_brightness); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); dev_set_drvdata(dev, lcd); mutex_init(&lcd->lock); mutex_init(&lcd->bl_lock); dev_info(&lcd->ld->dev, "s6e8aa0 lcd panel driver has been probed.\n"); #if defined(GPIO_OLED_DET) if (lcd->connected) { INIT_DELAYED_WORK(&lcd->oled_detection, oled_detection_work); lcd->irq = gpio_to_irq(GPIO_OLED_DET); s3c_gpio_cfgpin(GPIO_OLED_DET, S3C_GPIO_SFN(0xf)); s3c_gpio_setpull(GPIO_OLED_DET, S3C_GPIO_PULL_NONE); if (request_irq(lcd->irq, oled_detection_int, IRQF_TRIGGER_FALLING, "oled_detection", lcd)) pr_err("failed to reqeust irq. %d\n", lcd->irq); } #endif lcd_early_suspend = s6d6aa1_early_suspend; lcd_late_resume = s6d6aa1_late_resume; return 0; out_free_backlight: lcd_device_unregister(lcd->ld); kfree(lcd); return ret; out_free_lcd: kfree(lcd); return ret; err_alloc: return ret; }
static int __init s3c_keypad_probe(struct platform_device *pdev) { struct resource *res, *keypad_mem, *keypad_irq; struct input_dev *input_dev; struct s3c_keypad *s3c_keypad; int ret, size; int key, code; struct class *key_class; struct device *keypress; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res == NULL) { dev_err(&pdev->dev,"no memory resource specified\n"); return -ENOENT; } size = (res->end - res->start) + 1; keypad_mem = request_mem_region(res->start, size, pdev->name); if (keypad_mem == NULL) { dev_err(&pdev->dev, "failed to get memory region\n"); ret = -ENOENT; goto err_req; } key_base = ioremap(res->start, size); if (key_base == NULL) { printk(KERN_ERR "Failed to remap register block\n"); ret = -ENOMEM; goto err_map; } keypad_clock = clk_get(&pdev->dev, "keypad"); if (IS_ERR(keypad_clock)) { dev_err(&pdev->dev, "failed to find keypad clock source\n"); ret = PTR_ERR(keypad_clock); goto err_clk; } clk_enable(keypad_clock); s3c_keypad = kzalloc(sizeof(struct s3c_keypad), GFP_KERNEL); input_dev = input_allocate_device(); g_dev = input_dev; if (!s3c_keypad || !input_dev) { ret = -ENOMEM; goto err_alloc; } platform_set_drvdata(pdev, s3c_keypad); s3c_keypad->dev = input_dev; /* Set GPIO Port for keypad mode and pull-up disable*/ s3c_setup_keypad_cfg_gpio(KEYPAD_ROWS, KEYPAD_COLUMNS); /* STEALTH-V don't use KBR(0)-GPH3- for keypad */ #ifndef CONFIG_MACH_CHIEF s3c_gpio_cfgpin(S5PV210_GPH3(0), S3C_GPIO_INPUT); s3c_gpio_setpull(S5PV210_GPH3(0), S3C_GPIO_PULL_UP); #endif writel(KEYIFCON_INIT, key_base+S3C_KEYIFCON); writel(KEYIFFC_DIV, key_base+S3C_KEYIFFC); writel(KEYIFCOL_CLEAR, key_base+S3C_KEYIFCOL); #ifdef CONFIG_MACH_CHIEF /* GPIO_CONTROL */ gpio_set_value(GPIO_KEYSCAN6, GPIO_LEVEL_LOW) ; gpio_set_value(GPIO_KEYSCAN7, GPIO_LEVEL_LOW) ; #endif /* create and register the input driver */ set_bit(EV_KEY, input_dev->evbit); /*Commenting the generation of repeat events*/ //set_bit(EV_REP, input_dev->evbit); s3c_keypad->nr_rows = KEYPAD_ROWS; s3c_keypad->no_cols = KEYPAD_COLUMNS; s3c_keypad->total_keys = MAX_KEYPAD_NR; for(key = 0; key < s3c_keypad->total_keys; key++){ code = s3c_keypad->keycodes[key] = keypad_keycode[key]; if(code<=0) continue; set_bit(code & KEY_MAX, input_dev->keybit); } //printk("%s, keypad row number is %d, column is %d",__FUNCTION__, s3c_keypad->nr_rows, s3c_keypad->no_cols); #ifndef CONFIG_MACH_CHIEF set_bit(26 & KEY_MAX, input_dev->keybit); set_bit(42 & KEY_MAX, input_dev->keybit); #endif #ifdef CONFIG_MACH_CHIEF input_set_capability(input_dev, EV_SW, SW_LID); // TODO:FORTE #endif input_dev->name = DEVICE_NAME; input_dev->phys = "s3c-keypad/input0"; input_dev->id.bustype = BUS_HOST; input_dev->id.vendor = 0x0001; input_dev->id.product = 0x0001; input_dev->id.version = 0x0001; input_dev->keycode = keypad_keycode; ret = input_register_device(input_dev); if (ret) { printk("Unable to register s3c-keypad input device!!!\n"); goto err_regi; } /* keypad_led timer init */ #ifdef CONFIG_MACH_CHIEF init_timer(&keyled_timer); keyled_timer.function = keyled_timer_handler; keyled_timer.data = (unsigned long)s3c_keypad; s3c_keygpio_isr_setup((void *)s3c_keypad); #endif /* For IRQ_KEYPAD */ keypad_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (keypad_irq == NULL) { dev_err(&pdev->dev, "no irq resource specified\n"); ret = -ENOENT; goto err_irq; } ret = request_irq(keypad_irq->start, s3c_keypad_isr, IRQF_SAMPLE_RANDOM, DEVICE_NAME, (void *) s3c_keypad); if (ret) { printk("request_irq failed (IRQ_KEYPAD) !!!\n"); ret = -EIO; goto err_irq; } #if 0 /* gpio key use gpio-event.c */ s3c_keygpio_init((void *)s3c_keypad); s3c_keygpio_isr_register((void *)s3c_keypad); #endif /* for 1-5 applicaion /sys/devices/virtual/key/key/key */ key_class = class_create(THIS_MODULE,"key"); if(IS_ERR(key_class)){ printk("failed to keyclass\n"); goto out; } keypress = device_create(key_class, NULL, 0 , s3c_keypad, "key"); if(IS_ERR(keypress)) printk("failed to create a keypress device\n"); else{ if(device_create_file(keypress, &dev_attr_key)<0) printk("failed to create device file key\n"); } if (device_create_file(keypress, &dev_attr_brightness) < 0) { printk("fail to create device file brightness\n"); } if (device_create_file(keypress, &dev_attr_keywakeup) < 0) { printk("fail to create device file keywakeup\n"); } printk( DEVICE_NAME " Initialized\n"); return 0; out: free_irq(keypad_irq->start, input_dev); err_irq: err_regi: input_free_device(input_dev); kfree(s3c_keypad); err_alloc: clk_disable(keypad_clock); clk_put(keypad_clock); err_clk: iounmap(key_base); err_map: release_resource(keypad_mem); kfree(keypad_mem); err_req: return ret; }
int s3cfb_set_gpio(void) { unsigned long val; int i, err; #if 0 /* See mach-smdk6410.c:smdk6410_map_io() - S3C64XX_MODEM_MIFPCON */ /* Must be '0' for Normal-path instead of By-pass */ writel(0x0, S3C_HOSTIFB_MIFPCON); #endif /* enable clock to LCD */ val = readl(S3C_HCLK_GATE); val |= S3C_CLKCON_HCLK_LCD; writel(val, S3C_HCLK_GATE); /* select TFT LCD type (RGB I/F) */ val = readl(S3C64XX_SPCON); val &= ~0x3; val |= (1 << 0); writel(val, S3C64XX_SPCON); /* VD */ for (i = 0; i < 16; i++) s3c_gpio_cfgpin(S3C64XX_GPI(i), S3C_GPIO_SFN(2)); for (i = 0; i < 12; i++) s3c_gpio_cfgpin(S3C64XX_GPJ(i), S3C_GPIO_SFN(2)); /* backlight ON */ //printk("oPEN LCD BACKLIGHT1.\n"); if (gpio_is_valid(S3C64XX_GPF(14))) { //NOTE: orign GPF15 here err = gpio_request(S3C64XX_GPF(14), "GPF"); if (err) { printk(KERN_ERR "failed to request GPF for " "lcd backlight control\n"); return err; } gpio_direction_output(S3C64XX_GPF(14), 1); gpio_set_value(S3C64XX_GPF(14), 1); } //printk("oPEN LCD BACKLIGHT2.\n"); if (gpio_is_valid(S3C64XX_GPE(0))) { err = gpio_request(S3C64XX_GPE(0), "GPE"); if (err) { printk(KERN_ERR "failed to request GPE for " "lcd reset control\n"); return err; } gpio_direction_output(S3C64XX_GPE(0), 1); } gpio_set_value(S3C64XX_GPE(0), 1); gpio_free(S3C64XX_GPE(0)); /* module reset */ /*if (gpio_is_valid(S3C64XX_GPN(5))) { err = gpio_request(S3C64XX_GPN(5), "GPN"); if (err) { printk(KERN_ERR "failed to request GPN for " "lcd reset control\n"); return err; } gpio_direction_output(S3C64XX_GPN(5), 1); } mdelay(100); gpio_set_value(S3C64XX_GPN(5), 0); mdelay(10); gpio_set_value(S3C64XX_GPN(5), 1); mdelay(10); */ #ifndef CONFIG_BACKLIGHT_PWM gpio_free(S3C64XX_GPF(14)); #endif //gpio_free(S3C64XX_GPN(5)); return 0; }
static void max8997_motor_init(void) { gpio_request(GPIO_VIBTONE_EN, "VIBTONE_EN"); s3c_gpio_cfgpin(GPIO_VIBTONE_EN, S3C_GPIO_OUTPUT); s3c_gpio_setpull(GPIO_VIBTONE_EN, S3C_GPIO_PULL_NONE); }
static void modemctl_cfg_gpio(void) { int err = 0; unsigned gpio_phone_on = mdmctl_data.gpio_phone_on; unsigned gpio_phone_active = mdmctl_data.gpio_phone_active; unsigned gpio_cp_rst = mdmctl_data.gpio_cp_reset; unsigned gpio_pda_active = mdmctl_data.gpio_pda_active; unsigned gpio_usim_boot = mdmctl_data.gpio_usim_boot; unsigned gpio_flm_sel = mdmctl_data.gpio_flm_sel; unsigned gpio_flm_sel_03 = mdmctl_data.gpio_flm_sel_03; //unsigned gpio_sim_ndetect = mdmctl_data.gpio_sim_ndetect; err = gpio_request(gpio_phone_on, "PHONE_ON"); if (err) { printk("fail to request gpio %s\n","PHONE_ON"); } else { gpio_direction_output(gpio_phone_on, GPIO_LEVEL_LOW); s3c_gpio_setpull(gpio_phone_on, S3C_GPIO_PULL_NONE); } err = gpio_request(gpio_cp_rst, "CP_RST"); if (err) { printk("fail to request gpio %s\n","CP_RST"); } else { gpio_direction_output(gpio_cp_rst, GPIO_LEVEL_LOW); s3c_gpio_setpull(gpio_cp_rst, S3C_GPIO_PULL_NONE); } err = gpio_request(gpio_pda_active, "PDA_ACTIVE"); if (err) { printk("fail to request gpio %s\n","PDA_ACTIVE"); } else { gpio_direction_output(gpio_pda_active, GPIO_LEVEL_LOW); s3c_gpio_setpull(gpio_pda_active, S3C_GPIO_PULL_NONE); } err = gpio_request(gpio_usim_boot, "USIM_BOOT"); if (err) { printk("fail to request gpio %s\n","USIM_BOOT"); } else { gpio_direction_output(gpio_usim_boot, GPIO_LEVEL_LOW); s3c_gpio_setpull(gpio_usim_boot, S3C_GPIO_PULL_NONE); } if(HWREV > 3) { err = gpio_request(gpio_flm_sel, "FLM_SEL"); if (err) { printk("fail to request gpio %s\n","FLM_SEL"); } else { gpio_direction_output(gpio_flm_sel, GPIO_LEVEL_LOW); s3c_gpio_setpull(gpio_flm_sel, S3C_GPIO_PULL_NONE); } } else { err = gpio_request(gpio_flm_sel_03, "FLM_SEL"); if (err) { printk("fail to request gpio %s\n","FLM_SEL"); } else { gpio_direction_output(gpio_flm_sel_03, GPIO_LEVEL_LOW); s3c_gpio_setpull(gpio_flm_sel_03, S3C_GPIO_PULL_NONE); } } s3c_gpio_cfgpin(gpio_phone_active, S3C_GPIO_SFN(0xF)); s3c_gpio_setpull(gpio_phone_active, S3C_GPIO_PULL_NONE); irq_set_irq_type(gpio_phone_active, IRQ_TYPE_EDGE_BOTH); /*s3c_gpio_cfgpin(gpio_sim_ndetect, S3C_GPIO_SFN(0xF)); s3c_gpio_setpull(gpio_sim_ndetect, S3C_GPIO_PULL_NONE); irq_set_irq_type(gpio_sim_ndetect, IRQ_TYPE_EDGE_BOTH);*/ }
static int smartq_bl_init(struct device *dev) { s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_SFN(2)); return 0; }
void exynos4_setup_mshci_set_power(struct platform_device *dev, int en) { struct s3c_mshci_platdata *pdata = dev->dev.platform_data; unsigned int gpio = 0; if (pdata->int_power_gpio) { if (en) { #if defined(CONFIG_MACH_Q1_BD) mdelay(20); #elif defined(CONFIG_MACH_PX) mdelay(10); #endif /*CMD/CLK*/ for (gpio = EXYNOS4_GPK0(0); gpio < EXYNOS4_GPK0(2); gpio++) { s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3)); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); } /*DAT[0]~[3]*/ for (gpio = EXYNOS4_GPK0(3); gpio <= EXYNOS4_GPK0(6); gpio++) { s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3)); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); } /*DAT[4]~[7]*/ for (gpio = EXYNOS4_GPK1(3); gpio <= EXYNOS4_GPK1(6); gpio++) { s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(4)); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); } gpio_set_value(pdata->int_power_gpio, 1); pr_info("%s : internal MMC Card ON samsung-mshc.\n", __func__); } else { #if defined(CONFIG_MACH_M0_CTC) s3c_gpio_cfgpin(pdata->int_power_gpio, S3C_GPIO_OUTPUT); s3c_gpio_setpull(pdata->int_power_gpio, S3C_GPIO_PULL_NONE); #endif gpio_set_value(pdata->int_power_gpio, 0); /*CMD/CLK*/ for (gpio = EXYNOS4_GPK0(0); gpio < EXYNOS4_GPK0(2); gpio++) { s3c_gpio_cfgpin(gpio, S3C_GPIO_INPUT); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN); } /*DAT[0]~[3]*/ for (gpio = EXYNOS4_GPK0(3); gpio <= EXYNOS4_GPK0(6); gpio++) { s3c_gpio_cfgpin(gpio, S3C_GPIO_INPUT); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN); } /*DAT[4]~[7]*/ for (gpio = EXYNOS4_GPK1(3); gpio <= EXYNOS4_GPK1(6); gpio++) { s3c_gpio_cfgpin(gpio, S3C_GPIO_INPUT); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN); } pr_info("%s : internal MMC Card OFF samsung-mshc.\n", __func__); mdelay(50); } } }
static void __init origen_power_init(void) { gpio_request(EXYNOS4_GPX0(4), "PMIC_IRQ"); s3c_gpio_cfgpin(EXYNOS4_GPX0(4), S3C_GPIO_SFN(0xf)); s3c_gpio_setpull(EXYNOS4_GPX0(4), S3C_GPIO_PULL_NONE); }
static int s5pv310_cfg_i2s(struct platform_device *pdev) { /* configure GPIO for i2s port */ switch (pdev->id) { case 1: s3c_gpio_cfgpin(S5PV310_GPC0(0), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(S5PV310_GPC0(1), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(S5PV310_GPC0(2), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(S5PV310_GPC0(3), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(S5PV310_GPC0(4), S3C_GPIO_SFN(2)); break; case 2: s3c_gpio_cfgpin(S5PV310_GPC1(0), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(S5PV310_GPC1(1), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(S5PV310_GPC1(2), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(S5PV310_GPC1(3), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(S5PV310_GPC1(4), S3C_GPIO_SFN(2)); break; case -1: s3c_gpio_cfgpin(S5PV310_GPZ(0), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(S5PV310_GPZ(1), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(S5PV310_GPZ(2), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(S5PV310_GPZ(3), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(S5PV310_GPZ(4), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(S5PV310_GPZ(5), S3C_GPIO_SFN(2)); s3c_gpio_cfgpin(S5PV310_GPZ(6), S3C_GPIO_SFN(2)); break; default: printk(KERN_ERR "Invalid Device %d\n", pdev->id); return -EINVAL; } return 0; }
static int s5pv310_pcm_cfg_gpio(struct platform_device *pdev) { switch (pdev->id) { case 1: s3c_gpio_cfgpin(S5PV310_GPC0(0), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin(S5PV310_GPC0(1), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin(S5PV310_GPC0(2), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin(S5PV310_GPC0(3), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin(S5PV310_GPC0(4), S3C_GPIO_SFN(3)); break; case 2: s3c_gpio_cfgpin(S5PV310_GPC1(0), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin(S5PV310_GPC1(1), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin(S5PV310_GPC1(2), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin(S5PV310_GPC1(3), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin(S5PV310_GPC1(4), S3C_GPIO_SFN(3)); break; case 0: s3c_gpio_cfgpin(S5PV310_GPZ(0), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin(S5PV310_GPZ(1), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin(S5PV310_GPZ(2), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin(S5PV310_GPZ(3), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin(S5PV310_GPZ(4), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin(S5PV310_GPZ(5), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin(S5PV310_GPZ(6), S3C_GPIO_SFN(3)); break; default: printk(KERN_DEBUG "Invalid PCM Controller number!"); return -EINVAL; } return 0; }
int bcm4329_wifi_power(int on) { int ret; struct regulator *wlan32k_regulator; static int regulator_flag = 0; printk("%s: %d\n", __func__, on); /*stuttgart, enable max77676 32khz for wlan*/ wlan32k_regulator = regulator_get(NULL, "wlan_32khz"); if(IS_ERR(wlan32k_regulator)){ pr_err("%s: failed to get %s\n", __func__, "wlan_32khz"); return -1; }; /*end*/ mdelay(100); if(on) { /*stuttgart, enable max77676 32khz for wlan*/ if(!regulator_flag) { regulator_enable(wlan32k_regulator); regulator_flag = 1; } /*end*/ /* ret = gpio_request(WL_REG_ON, WL_REG_ON_DES); if (ret) printk(KERN_ERR "#### failed to request GPK3-2\n "); */ s3c_gpio_cfgpin(WL_REG_ON, S3C_GPIO_OUTPUT); s3c_gpio_setpull(WL_REG_ON, S3C_GPIO_PULL_NONE); gpio_set_value(WL_REG_ON, 1); s5p_gpio_set_pd_cfg(WL_REG_ON, S5P_GPIO_PD_OUTPUT1); s5p_gpio_set_pd_pull(WL_REG_ON, S5P_GPIO_PD_UPDOWN_DISABLE); /* ret = gpio_request(EXYNOS4_GPX2(7), "GPX2"); if (ret) printk(KERN_ERR "#### failed to request GPX2-7\n "); s3c_gpio_cfgpin(EXYNOS4_GPX2(7), S3C_GPIO_SFN(0x2)); s3c_gpio_setpull (EXYNOS4_GPX2(7),S3C_GPIO_PULL_NONE); */ //irq_set_irq_wake(gpio_to_irq(EXYNOS4_GPX2(7)), 1); } else { s3c_gpio_cfgpin(WL_REG_ON, S3C_GPIO_INPUT); s3c_gpio_setpull(WL_REG_ON, S3C_GPIO_PULL_DOWN); s5p_gpio_set_pd_cfg(WL_REG_ON, S5P_GPIO_PD_INPUT); s5p_gpio_set_pd_pull(WL_REG_ON, S5P_GPIO_PD_DOWN_ENABLE); //irq_set_irq_wake(gpio_to_irq(EXYNOS4_GPX2(7)), 0); /* s3c_gpio_cfgpin(EXYNOS4_GPX2(7), S3C_GPIO_INPUT); s3c_gpio_setpull (EXYNOS4_GPX2(7),S3C_GPIO_PULL_DOWN); */ /*gpio_free(WL_REG_ON);*/ /*gpio_free(EXYNOS4_GPX2(7));*/ /*stuttgart, disable max77676 32khz for wlan*/ if(regulator_flag) { regulator_disable(wlan32k_regulator); regulator_flag = 0; } /*end*/ } /*stuttgart, put regulator*/ regulator_put(wlan32k_regulator); /*end*/ mdelay(200); bcm4329_wifi_power_state = on; return 0; }
static int cdma_manager_probe(struct platform_device *dev) { /* if (gpio_is_valid(GPIO_CDMA_PWR_ON_OUT)) { if (gpio_request(GPIO_CDMA_PWR_ON_OUT, "GPH2")) printk(KERN_ERR "Failed to request GPIO_CDMA_PWR_ON_OUT!\n"); gpio_direction_output(GPIO_CDMA_PWR_ON_OUT, GPIO_LEVEL_LOW); } s3c_gpio_setpull(GPIO_CDMA_PWR_ON_OUT, S3C_GPIO_PULL_DOWN); if (gpio_is_valid(GPIO_CDMA_RESET_OUT)) { if (gpio_request(GPIO_CDMA_RESET_OUT, "GPH2")) printk(KERN_ERR "Failed to request GPIO_CDMA_RESET_OUT!\n"); gpio_direction_output(GPIO_CDMA_RESET_OUT, GPIO_LEVEL_LOW); } s3c_gpio_setpull(GPIO_CDMA_RESET_OUT, S3C_GPIO_PULL_NONE); if (gpio_is_valid(GPIO_CDMA_READY_SIGNAL_IN)) { if (gpio_request(GPIO_CDMA_READY_SIGNAL_IN, "GPH2")) printk(KERN_ERR "Failed to request GPIO_CDMA_READY_SIGNAL_IN!\n"); gpio_direction_input(GPIO_CDMA_READY_SIGNAL_IN); } s3c_gpio_setpull(GPIO_CDMA_READY_SIGNAL_IN, S3C_GPIO_PULL_DOWN); if (gpio_is_valid(GPIO_CDMA_SLEEP_CTL_OUT)) { if (gpio_request(GPIO_CDMA_SLEEP_CTL_OUT, "GPH2")) printk(KERN_ERR "Failed to request GPIO_CDMA_SLEEP_CTL_OUT!\n"); gpio_direction_output(GPIO_CDMA_SLEEP_CTL_OUT,1); } s3c_gpio_setpull(GPIO_CDMA_SLEEP_CTL_OUT, S3C_GPIO_PULL_UP);*/ int ret = 0; int irq; ril_wakeup = 1; ret = device_create_file(&(dev->dev), &dev_attr_wakeup); if (ret < 0) { printk("failed to add sysfs entries\n"); return -1; } //[yoon 20110504]changed cdma power squency : iriver_init_gpio() -> cdma_manager_probe() #if 1 mx100_cdma_power(0); #endif s3c_gpio_cfgpin(GPIO_CDMA_HOST_WAKE, S3C_GPIO_SFN(0xF)); s3c_gpio_setpull(GPIO_CDMA_HOST_WAKE, S3C_GPIO_PULL_NONE); cdma_uart_port_config(3); irq = IRQ_CDMA_HOST_WAKE; wake_lock_init(&cdma_wake_lock, WAKE_LOCK_SUSPEND, "cdma_host_wake"); ret = request_irq(irq, cdma_host_wake_irq_handler,IRQF_TRIGGER_RISING, "cdma_host_wake_irq_handler", NULL); if (ret < 0) { pr_err("[CDMA] Request_irq failed\n"); return ret; } disable_irq(irq); ret = enable_irq_wake(irq); if (ret < 0) pr_err("[CDMA] set wakeup src failed\n"); enable_irq(irq); return 0; }
static void setup_sdhci0_gpio_wp(void) { s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_INPUT); s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_DOWN); }
static int smdkc110_set_gpio(int id) { switch(id) { case 0: s3c_gpio_cfgpin (S5PV210_GPC1(0), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin (S5PV210_GPC1(1), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin (S5PV210_GPC1(2), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin (S5PV210_GPC1(3), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin (S5PV210_GPC1(4), S3C_GPIO_SFN(3)); s3c_gpio_setpull(S5PV210_GPC1(0), S3C_GPIO_PULL_NONE); s3c_gpio_setpull(S5PV210_GPC1(1), S3C_GPIO_PULL_NONE); s3c_gpio_setpull(S5PV210_GPC1(2), S3C_GPIO_PULL_NONE); s3c_gpio_setpull(S5PV210_GPC1(3), S3C_GPIO_PULL_NONE); s3c_gpio_setpull(S5PV210_GPC1(4), S3C_GPIO_PULL_NONE); break; case 1: s3c_gpio_cfgpin (S5PV210_GPC0(0), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin (S5PV210_GPC0(1), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin (S5PV210_GPC0(2), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin (S5PV210_GPC0(3), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin (S5PV210_GPC0(4), S3C_GPIO_SFN(3)); s3c_gpio_setpull(S5PV210_GPC0(0), S3C_GPIO_PULL_NONE); s3c_gpio_setpull(S5PV210_GPC0(1), S3C_GPIO_PULL_NONE); s3c_gpio_setpull(S5PV210_GPC0(2), S3C_GPIO_PULL_NONE); s3c_gpio_setpull(S5PV210_GPC0(3), S3C_GPIO_PULL_NONE); s3c_gpio_setpull(S5PV210_GPC0(4), S3C_GPIO_PULL_NONE); break; case 2: s3c_gpio_cfgpin (S5PV210_GPI(0), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin (S5PV210_GPI(1), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin (S5PV210_GPI(2), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin (S5PV210_GPI(3), S3C_GPIO_SFN(3)); s3c_gpio_cfgpin (S5PV210_GPI(4), S3C_GPIO_SFN(3)); s3c_gpio_setpull(S5PV210_GPI(0), S3C_GPIO_PULL_NONE); s3c_gpio_setpull(S5PV210_GPI(1), S3C_GPIO_PULL_NONE); s3c_gpio_setpull(S5PV210_GPI(2), S3C_GPIO_PULL_NONE); s3c_gpio_setpull(S5PV210_GPI(3), S3C_GPIO_PULL_NONE); s3c_gpio_setpull(S5PV210_GPI(4), S3C_GPIO_PULL_NONE); break; default: debug_msg("Not a valid PCM IP Number. - %d\n", id); return -EINVAL; } return 0; }
int S5PC11X_timer_setup (int channel, int usec, unsigned long g_tcnt, unsigned long g_tcmp) { unsigned long tcon; unsigned long tcnt; unsigned long tcmp; unsigned long tcfg1; unsigned long tcfg0; unsigned long pclk; struct clk *clk; printk("\nPWM channel %d set g_tcnt = %ld, g_tcmp = %ld \n", channel, g_tcnt, g_tcmp); tcnt = 0xffffffff; /* default value for tcnt */ /* read the current timer configuration bits */ tcon = __raw_readl(S3C_TCON); tcfg1 = __raw_readl(S3C_TCFG1); tcfg0 = __raw_readl(S3C_TCFG0); clk = clk_get(NULL, "timers"); if (IS_ERR(clk)) panic("failed to get clock for pwm timer"); clk_enable(clk); pclk = clk_get_rate(clk); /* configure clock tick */ switch(channel) { case 0: /* set gpio as PWM TIMER0 to signal output*/ s3c_gpio_cfgpin(S5PC11X_GPD(0), S5PC11X_GPD0_TOUT_0); gpio_set_value(S5PC11X_GPD(0), 0); tcfg1 &= ~S3C_TCFG1_MUX0_MASK; tcfg1 |= S3C_TCFG1_MUX1_DIV2; tcfg0 &= ~S3C_TCFG_PRESCALER0_MASK; tcfg0 |= (PRESCALER) << S3C_TCFG_PRESCALER0_SHIFT; tcon &= ~(7<<0); tcon |= S3C_TCON_T0RELOAD; break; case 1: /* set gpio as PWM TIMER1 to signal output*/ s3c_gpio_cfgpin(S5PC11X_GPD(1), S5PC11X_GPD1_TOUT_1); gpio_set_value(S5PC11X_GPD(1), 0); tcfg1 &= ~S3C_TCFG1_MUX1_MASK; tcfg1 |= S3C_TCFG1_MUX1_DIV2; tcfg0 &= ~S3C_TCFG_PRESCALER0_MASK; tcfg0 |= (PRESCALER) << S3C_TCFG_PRESCALER0_SHIFT; tcon &= ~(7<<8); tcon |= S3C_TCON_T1RELOAD; break; case 2: /* set gpio as PWM TIMER2 to signal output*/ s3c_gpio_cfgpin(S5PC11X_GPD(2), S5PC11X_GPD0_TOUT_0); gpio_set_value(S5PC11X_GPD(2), 0); tcfg1 &= ~S3C_TCFG1_MUX2_MASK; tcfg1 |= S3C_TCFG1_MUX2_DIV2; tcfg0 &= ~S3C_TCFG_PRESCALER1_MASK; tcfg0 |= (PRESCALER) << S3C_TCFG_PRESCALER1_SHIFT; tcon &= ~(7<<12); tcon |= S3C_TCON_T2RELOAD; break; case 3: tcfg1 &= ~S3C_TCFG1_MUX3_MASK; tcfg1 |= S3C_TCFG1_MUX3_DIV2; tcfg0 &= ~S3C_TCFG_PRESCALER1_MASK; tcfg0 |= (PRESCALER) << S3C_TCFG_PRESCALER1_SHIFT; tcon &= ~(7<<16); tcon |= S3C_TCON_T3RELOAD; break; case 4: tcfg1 &= ~S3C_TCFG1_MUX4_MASK; tcfg1 |= S3C_TCFG1_MUX4_DIV2; tcfg0 &= ~S3C_TCFG_PRESCALER1_MASK; tcfg0 |= (PRESCALER) << S3C_TCFG_PRESCALER1_SHIFT; tcon &= ~(7<<20); tcon |= S3C_TCON_T3RELOAD; break; } __raw_writel(tcfg1, S3C_TCFG1); __raw_writel(tcfg0, S3C_TCFG0); __raw_writel(tcon, S3C_TCON); /*tcnt = 160; __raw_writel(tcnt, S3C_TCNTB(channel)); tcmp = 110; __raw_writel(tcmp, S3C_TCMPB(channel));*/ switch(channel) { case 0: tcon |= S3C_TCON_T0MANUALUPD; break; case 1: tcon |= S3C_TCON_T1MANUALUPD; break; case 2: tcon |= S3C_TCON_T2MANUALUPD; break; case 3: tcon |= S3C_TCON_T3MANUALUPD; break; case 4: tcon |= S3C_TCON_T4MANUALUPD; break; } __raw_writel(tcon, S3C_TCON); tcnt = g_tcnt; __raw_writel(tcnt, S3C_TCNTB(channel)); tcmp = g_tcmp; __raw_writel(tcmp, S3C_TCMPB(channel)); /* start the timer running */ S5PC11X_pwm_start ( channel); return 0; }
static void bast_pm_resume(void) { s3c_gpio_cfgpin(S3C2410_GPA(21), S3C2410_GPA21_nRSTOUT); }
static void __init jive_machine_init(void) { /* register system devices for managing low level suspend */ sysdev_class_register(&jive_pm_sysclass); sysdev_register(&jive_pm_sysdev); /* write our sleep configurations for the IO. Pull down all unused * IO, ensure that we have turned off all peripherals we do not * need, and configure the ones we do need. */ /* Port B sleep */ __raw_writel(S3C2412_SLPCON_IN(0) | S3C2412_SLPCON_PULL(1) | S3C2412_SLPCON_HIGH(2) | S3C2412_SLPCON_PULL(3) | S3C2412_SLPCON_PULL(4) | S3C2412_SLPCON_PULL(5) | S3C2412_SLPCON_PULL(6) | S3C2412_SLPCON_HIGH(7) | S3C2412_SLPCON_PULL(8) | S3C2412_SLPCON_PULL(9) | S3C2412_SLPCON_PULL(10), S3C2412_GPBSLPCON); /* Port C sleep */ __raw_writel(S3C2412_SLPCON_PULL(0) | S3C2412_SLPCON_PULL(1) | S3C2412_SLPCON_PULL(2) | S3C2412_SLPCON_PULL(3) | S3C2412_SLPCON_PULL(4) | S3C2412_SLPCON_PULL(5) | S3C2412_SLPCON_LOW(6) | S3C2412_SLPCON_PULL(6) | S3C2412_SLPCON_PULL(7) | S3C2412_SLPCON_PULL(8) | S3C2412_SLPCON_PULL(9) | S3C2412_SLPCON_PULL(10) | S3C2412_SLPCON_PULL(11) | S3C2412_SLPCON_PULL(12) | S3C2412_SLPCON_PULL(13) | S3C2412_SLPCON_PULL(14) | S3C2412_SLPCON_PULL(15), S3C2412_GPCSLPCON); /* Port D sleep */ __raw_writel(S3C2412_SLPCON_ALL_PULL, S3C2412_GPDSLPCON); /* Port F sleep */ __raw_writel(S3C2412_SLPCON_LOW(0) | S3C2412_SLPCON_LOW(1) | S3C2412_SLPCON_LOW(2) | S3C2412_SLPCON_EINT(3) | S3C2412_SLPCON_EINT(4) | S3C2412_SLPCON_EINT(5) | S3C2412_SLPCON_EINT(6) | S3C2412_SLPCON_EINT(7), S3C2412_GPFSLPCON); /* Port G sleep */ __raw_writel(S3C2412_SLPCON_IN(0) | S3C2412_SLPCON_IN(1) | S3C2412_SLPCON_IN(2) | S3C2412_SLPCON_IN(3) | S3C2412_SLPCON_IN(4) | S3C2412_SLPCON_IN(5) | S3C2412_SLPCON_IN(6) | S3C2412_SLPCON_IN(7) | S3C2412_SLPCON_PULL(8) | S3C2412_SLPCON_PULL(9) | S3C2412_SLPCON_IN(10) | S3C2412_SLPCON_PULL(11) | S3C2412_SLPCON_PULL(12) | S3C2412_SLPCON_PULL(13) | S3C2412_SLPCON_IN(14) | S3C2412_SLPCON_PULL(15), S3C2412_GPGSLPCON); /* Port H sleep */ __raw_writel(S3C2412_SLPCON_PULL(0) | S3C2412_SLPCON_PULL(1) | S3C2412_SLPCON_PULL(2) | S3C2412_SLPCON_PULL(3) | S3C2412_SLPCON_PULL(4) | S3C2412_SLPCON_PULL(5) | S3C2412_SLPCON_PULL(6) | S3C2412_SLPCON_IN(7) | S3C2412_SLPCON_IN(8) | S3C2412_SLPCON_PULL(9) | S3C2412_SLPCON_IN(10), S3C2412_GPHSLPCON); /* initialise the power management now we've setup everything. */ s3c_pm_init(); /** TODO - check that this is after the cmdline option! */ s3c_nand_set_platdata(&jive_nand_info); /* initialise the spi */ gpio_request(S3C2410_GPG(13), "lcm reset"); gpio_direction_output(S3C2410_GPG(13), 0); gpio_request(S3C2410_GPB(7), "jive spi"); gpio_direction_output(S3C2410_GPB(7), 1); s3c2410_gpio_setpin(S3C2410_GPB(6), 0); s3c_gpio_cfgpin(S3C2410_GPB(6), S3C2410_GPIO_OUTPUT); s3c2410_gpio_setpin(S3C2410_GPG(8), 1); s3c_gpio_cfgpin(S3C2410_GPG(8), S3C2410_GPIO_OUTPUT); /* initialise the WM8750 spi */ gpio_request(S3C2410_GPH(10), "jive wm8750 spi"); gpio_direction_output(S3C2410_GPH(10), 1); /* Turn off suspend on both USB ports, and switch the * selectable USB port to USB device mode. */ s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | S3C2410_MISCCR_USBSUSPND0 | S3C2410_MISCCR_USBSUSPND1, 0x0); s3c24xx_udc_set_platdata(&jive_udc_cfg); s3c24xx_fb_set_platdata(&jive_lcd_config); spi_register_board_info(jive_spi_devs, ARRAY_SIZE(jive_spi_devs)); s3c_i2c0_set_platdata(&jive_i2c_cfg); i2c_register_board_info(0, jive_i2c_devs, ARRAY_SIZE(jive_i2c_devs)); pm_power_off = jive_power_off; platform_add_devices(jive_devices, ARRAY_SIZE(jive_devices)); }
/* onedram */ static void onedram_cfg_gpio(void) { s3c_gpio_cfgpin(GPIO_nINT_ONEDRAM_AP, S3C_GPIO_SFN(GPIO_nINT_ONEDRAM_AP_AF)); s3c_gpio_setpull(GPIO_nINT_ONEDRAM_AP, S3C_GPIO_PULL_UP); irq_set_irq_type(GPIO_nINT_ONEDRAM_AP, IRQ_TYPE_LEVEL_LOW); }
void midas_power_set_muic_pdata(void *pdata, int gpio) { gpio_request(gpio, "AP_PMIC_IRQ"); s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); }
static int s3c_irq_eint_set_type(struct irq_data *data, unsigned int type) { int offs = eint_offset(data->irq); int pin, pin_val; int shift; u32 ctrl, mask; u32 newvalue = 0; void __iomem *reg; if (offs > 27) return -EINVAL; if (offs <= 15) reg = S3C64XX_EINT0CON0; else reg = S3C64XX_EINT0CON1; switch (type) { case IRQ_TYPE_NONE: printk(KERN_WARNING "No edge setting!\n"); break; case IRQ_TYPE_EDGE_RISING: newvalue = S3C2410_EXTINT_RISEEDGE; break; case IRQ_TYPE_EDGE_FALLING: newvalue = S3C2410_EXTINT_FALLEDGE; break; case IRQ_TYPE_EDGE_BOTH: newvalue = S3C2410_EXTINT_BOTHEDGE; break; case IRQ_TYPE_LEVEL_LOW: newvalue = S3C2410_EXTINT_LOWLEV; break; case IRQ_TYPE_LEVEL_HIGH: newvalue = S3C2410_EXTINT_HILEV; break; default: printk(KERN_ERR "No such irq type %d", type); return -1; } if (offs <= 15) shift = (offs / 2) * 4; else shift = ((offs - 16) / 2) * 4; mask = 0x7 << shift; ctrl = __raw_readl(reg); ctrl &= ~mask; ctrl |= newvalue << shift; __raw_writel(ctrl, reg); /* set the GPIO pin appropriately */ if (offs < 16) { pin = S3C64XX_GPN(offs); pin_val = S3C_GPIO_SFN(2); } else if (offs < 23) { pin = S3C64XX_GPL(offs + 8 - 16); pin_val = S3C_GPIO_SFN(3); } else { pin = S3C64XX_GPM(offs - 23); pin_val = S3C_GPIO_SFN(3); } s3c_gpio_cfgpin(pin, pin_val); return 0; }
static void umts_modem_cfg_gpio(void) { int err = 0; unsigned gpio_reset_req_n = umts_modem_data.gpio_reset_req_n; unsigned gpio_cp_on = umts_modem_data.gpio_cp_on; unsigned gpio_cp_rst = umts_modem_data.gpio_cp_reset; unsigned gpio_pda_active = umts_modem_data.gpio_pda_active; unsigned gpio_phone_active = umts_modem_data.gpio_phone_active; unsigned gpio_cp_dump_int = umts_modem_data.gpio_cp_dump_int; unsigned gpio_ap_dump_int = umts_modem_data.gpio_ap_dump_int; unsigned gpio_flm_uart_sel = umts_modem_data.gpio_flm_uart_sel; unsigned gpio_sim_detect = umts_modem_data.gpio_sim_detect; unsigned irq_phone_active = umts_modem_res[0].start; if (gpio_reset_req_n) { err = gpio_request(gpio_reset_req_n, "RESET_REQ_N"); if (err) { pr_err(LOG_TAG "fail to request gpio %s : %d\n", "RESET_REQ_N", err); } s5p_gpio_set_pd_cfg(gpio_reset_req_n, S5P_GPIO_PD_OUTPUT1); gpio_direction_output(gpio_reset_req_n, 0); } if (gpio_cp_on) { err = gpio_request(gpio_cp_on, "CP_ON"); if (err) { pr_err(LOG_TAG "fail to request gpio %s : %d\n", "CP_ON", err); } gpio_direction_output(gpio_cp_on, 0); } if (gpio_cp_rst) { err = gpio_request(gpio_cp_rst, "CP_RST"); if (err) { pr_err(LOG_TAG "fail to request gpio %s : %d\n", "CP_RST", err); } s5p_gpio_set_pd_cfg(gpio_cp_rst, S5P_GPIO_PD_OUTPUT1); gpio_direction_output(gpio_cp_rst, 0); } if (gpio_pda_active) { err = gpio_request(gpio_pda_active, "PDA_ACTIVE"); if (err) { pr_err(LOG_TAG "fail to request gpio %s : %d\n", "PDA_ACTIVE", err); } gpio_direction_output(gpio_pda_active, 0); } if (gpio_phone_active) { err = gpio_request(gpio_phone_active, "PHONE_ACTIVE"); if (err) { pr_err(LOG_TAG "fail to request gpio %s : %d\n", "PHONE_ACTIVE", err); } gpio_direction_input(gpio_phone_active); pr_err(LOG_TAG "check phone active = %d\n", irq_phone_active); } if (gpio_sim_detect) { err = gpio_request(gpio_sim_detect, "SIM_DETECT"); if (err) printk(KERN_ERR "fail to request gpio %s: %d\n", "SIM_DETECT", err); /* gpio_direction_input(gpio_sim_detect); */ s3c_gpio_cfgpin(gpio_sim_detect, S3C_GPIO_SFN(0xF)); s3c_gpio_setpull(gpio_sim_detect, S3C_GPIO_PULL_NONE); irq_set_irq_type(gpio_to_irq(gpio_sim_detect), IRQ_TYPE_EDGE_BOTH); } if (gpio_cp_dump_int) { err = gpio_request(gpio_cp_dump_int, "CP_DUMP_INT"); if (err) { pr_err(LOG_TAG "fail to request gpio %s : %d\n", "CP_DUMP_INT", err); } gpio_direction_input(gpio_cp_dump_int); } if (gpio_ap_dump_int) { err = gpio_request(gpio_ap_dump_int, "AP_DUMP_INT"); if (err) { pr_err(LOG_TAG "fail to request gpio %s : %d\n", "AP_DUMP_INT", err); } gpio_direction_output(gpio_ap_dump_int, 0); } if (gpio_flm_uart_sel) { err = gpio_request(gpio_flm_uart_sel, "GPS_UART_SEL"); if (err) { pr_err(LOG_TAG "fail to request gpio %s : %d\n", "GPS_UART_SEL", err); } gpio_direction_output(gpio_reset_req_n, 0); } if (gpio_phone_active) irq_set_irq_type(gpio_to_irq(gpio_phone_active), IRQ_TYPE_LEVEL_HIGH); /* set low unused gpios between AP and CP */ err = gpio_request(GPIO_SUSPEND_REQUEST, "SUS_REQ"); if (err) pr_err(LOG_TAG "fail to request gpio %s : %d\n", "SUS_REQ", err); else { gpio_direction_output(GPIO_SUSPEND_REQUEST, 0); s3c_gpio_setpull(GPIO_SUSPEND_REQUEST, S3C_GPIO_PULL_NONE); } pr_info(LOG_TAG "umts_modem_cfg_gpio done\n"); }
static int s6evr02_probe(struct device *dev) { int ret = 0, i; struct lcd_info *lcd; #ifdef SMART_DIMMING u8 mtp_data[LDI_MTP_LENGTH] = {0,}; #endif lcd = kzalloc(sizeof(struct lcd_info), GFP_KERNEL); if (!lcd) { pr_err("failed to allocate for lcd\n"); ret = -ENOMEM; goto err_alloc; } g_lcd = lcd; lcd->ld = lcd_device_register("panel", dev, lcd, &s6evr02_lcd_ops); if (IS_ERR(lcd->ld)) { pr_err("failed to register lcd device\n"); ret = PTR_ERR(lcd->ld); goto out_free_lcd; } lcd->bd = backlight_device_register("panel", dev, lcd, &s6evr02_backlight_ops, NULL); if (IS_ERR(lcd->bd)) { pr_err("failed to register backlight device\n"); ret = PTR_ERR(lcd->bd); goto out_free_backlight; } lcd->dev = dev; lcd->dsim = (struct dsim_global *)dev_get_drvdata(dev->parent); lcd->bd->props.max_brightness = MAX_BRIGHTNESS; lcd->bd->props.brightness = DEFAULT_BRIGHTNESS; lcd->bl = DEFAULT_GAMMA_LEVEL; lcd->current_bl = lcd->bl; lcd->acl_enable = 0; lcd->current_acl = 0; lcd->power = FB_BLANK_UNBLANK; lcd->ldi_enable = 1; lcd->connected = 1; lcd->auto_brightness = 0; ret = device_create_file(&lcd->ld->dev, &dev_attr_power_reduce); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_lcd_type); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_window_type); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_gamma_table); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->bd->dev, &dev_attr_auto_brightness); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); dev_set_drvdata(dev, lcd); mutex_init(&lcd->lock); mutex_init(&lcd->bl_lock); s6evr02_read_id(lcd, lcd->id); dev_info(&lcd->ld->dev, "ID: %x, %x, %x\n", lcd->id[0], lcd->id[1], lcd->id[2]); dev_info(&lcd->ld->dev, "%s lcd panel driver has been probed.\n", dev_name(dev)); #ifdef SMART_DIMMING for (i = 0; i < LDI_ID_LEN; i++) { lcd->smart.panelid[i] = lcd->id[i]; } init_table_info(&lcd->smart); ret = s6evr02_read_mtp(lcd, mtp_data); /* for (i = 0; i < LDI_MTP_LENGTH ; i++) printk(" %dth mtp value is %x\n", i, mtp_data[i]); */ if (!ret) { printk(KERN_ERR "[LCD:ERROR] : %s read mtp failed\n", __func__); /*return -EPERM;*/ } calc_voltage_table(&lcd->smart, mtp_data); ret = init_elvss_table(lcd); ret += init_gamma_table(lcd, mtp_data); ret += init_aid_dimming_table(lcd); if (ret) printk(KERN_ERR "gamma table generation is failed\n"); update_brightness(lcd, 1); #endif #if defined(GPIO_ERR_FG) if (lcd->connected) { INIT_DELAYED_WORK(&lcd->err_fg_detection, err_fg_detection_work); lcd->irq = gpio_to_irq(GPIO_ERR_FG); irq_set_irq_type(lcd->irq, IRQ_TYPE_EDGE_RISING); s3c_gpio_cfgpin(GPIO_ERR_FG, S3C_GPIO_SFN(0xf)); s3c_gpio_setpull(GPIO_ERR_FG, S3C_GPIO_PULL_NONE); if (request_irq(lcd->irq, err_fg_detection_int, IRQF_TRIGGER_RISING, "err_fg_detection", lcd)) pr_err("failed to reqeust irq. %d\n", lcd->irq); } #endif #if defined(GPIO_OLED_DET) if (lcd->connected) { INIT_DELAYED_WORK(&lcd->oled_detection, oled_detection_work); s3c_gpio_cfgpin(GPIO_OLED_DET, S3C_GPIO_SFN(0xf)); s3c_gpio_setpull(GPIO_OLED_DET, S3C_GPIO_PULL_NONE); if (request_irq(gpio_to_irq(GPIO_OLED_DET), oled_detection_int, IRQF_TRIGGER_FALLING, "oled_detection", lcd)) pr_err("failed to reqeust irq. %d\n", gpio_to_irq(GPIO_OLED_DET)); } #endif lcd_early_suspend = s6evr02_early_suspend; lcd_late_resume = s6evr02_late_resume; return 0; out_free_backlight: lcd_device_unregister(lcd->ld); kfree(lcd); return ret; out_free_lcd: kfree(lcd); return ret; err_alloc: return ret; }
static int __devinit sdhci_s3c_probe(struct platform_device *pdev) { struct s3c_sdhci_platdata *pdata = pdev->dev.platform_data; struct device *dev = &pdev->dev; struct sdhci_host *host; struct sdhci_s3c *sc; struct resource *res; int ret, irq, ptr, clks; if (!pdata) { dev_err(dev, "no device data specified\n"); return -ENOENT; } irq = platform_get_irq(pdev, 0); if (irq < 0) { dev_err(dev, "no irq specified\n"); return irq; } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err(dev, "no memory specified\n"); return -ENOENT; } host = sdhci_alloc_host(dev, sizeof(struct sdhci_s3c)); if (IS_ERR(host)) { dev_err(dev, "sdhci_alloc_host() failed\n"); return PTR_ERR(host); } sc = sdhci_priv(host); sc->host = host; sc->pdev = pdev; sc->pdata = pdata; platform_set_drvdata(pdev, host); sc->clk_io = clk_get(dev, "hsmmc"); if (IS_ERR(sc->clk_io)) { dev_err(dev, "failed to get io clock\n"); ret = PTR_ERR(sc->clk_io); goto err_io_clk; } /* enable the local io clock and keep it running for the moment. */ clk_enable(sc->clk_io); for (clks = 0, ptr = 0; ptr < MAX_BUS_CLK; ptr++) { struct clk *clk; char *name = pdata->clocks[ptr]; if (name == NULL) continue; clk = clk_get(dev, name); if (IS_ERR(clk)) { dev_err(dev, "failed to get clock %s\n", name); continue; } clks++; sc->clk_bus[ptr] = clk; clk_enable(clk); dev_info(dev, "clock source %d: %s (%ld Hz)\n", ptr, name, clk_get_rate(clk)); } if (clks == 0) { dev_err(dev, "failed to find any bus clocks\n"); ret = -ENOENT; goto err_no_busclks; } sc->ioarea = request_mem_region(res->start, resource_size(res), mmc_hostname(host->mmc)); if (!sc->ioarea) { dev_err(dev, "failed to reserve register area\n"); ret = -ENXIO; goto err_req_regs; } host->ioaddr = ioremap_nocache(res->start, resource_size(res)); if (!host->ioaddr) { dev_err(dev, "failed to map registers\n"); ret = -ENXIO; goto err_req_regs; } /* Ensure we have minimal gpio selected CMD/CLK/Detect */ if (pdata->cfg_gpio) pdata->cfg_gpio(pdev, pdata->max_width); if (pdata->get_ro) sdhci_s3c_ops.get_ro = sdhci_s3c_get_ro; host->hw_name = "samsung-hsmmc"; host->ops = &sdhci_s3c_ops; host->quirks = 0; host->irq = irq; /* Setup quirks for the controller */ host->quirks |= SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC; host->quirks |= SDHCI_QUIRK_BROKEN_CARD_PRESENT_BIT; host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; #ifndef CONFIG_MMC_SDHCI_S3C_DMA /* we currently see overruns on errors, so disable the SDMA * support as well. */ host->quirks |= SDHCI_QUIRK_BROKEN_DMA; /* PIO currently has problems with multi-block IO */ host->quirks |= SDHCI_QUIRK_NO_MULTIBLOCK; #endif /* CONFIG_MMC_SDHCI_S3C_DMA */ /* It seems we do not get an DATA transfer complete on non-busy * transfers, not sure if this is a problem with this specific * SDHCI block, or a missing configuration that needs to be set. */ host->quirks |= SDHCI_QUIRK_NO_BUSY_IRQ; host->quirks |= (SDHCI_QUIRK_32BIT_DMA_ADDR | SDHCI_QUIRK_32BIT_DMA_SIZE); host->quirks |= SDHCI_QUIRK_NO_HISPD_BIT; if (pdata->host_caps) host->mmc->caps = pdata->host_caps; else host->mmc->caps = 0; /* Set pm_flags for built_in device */ host->mmc->pm_caps = MMC_PM_KEEP_POWER | MMC_PM_IGNORE_PM_NOTIFY; if (pdata->built_in) host->mmc->pm_flags = MMC_PM_KEEP_POWER | MMC_PM_IGNORE_PM_NOTIFY; /* to add external irq as a card detect signal */ if (pdata->cfg_ext_cd) { pdata->cfg_ext_cd(); if (pdata->detect_ext_cd()) host->flags |= SDHCI_DEVICE_ALIVE; } /* to configure gpio pin as a card write protection signal */ if (pdata->cfg_wp) pdata->cfg_wp(); ret = sdhci_add_host(host); if (ret) { dev_err(dev, "sdhci_add_host() failed\n"); goto err_add_host; } /* register external irq here (after all init is done) */ if (pdata->cfg_ext_cd) { ret = request_irq(pdata->ext_cd, sdhci_irq_cd, IRQF_SHARED, mmc_hostname(host->mmc), sc); if(ret) goto err_add_host; } #if SD_DYNAMIC if (strcmp(mmc_hostname(host->mmc),"mmc1")==0) { int retval=0; spin_lock_init(&s3c_sd_changed_lock); INIT_WORK(&sd_monitor_work, sd_extr_work); s3c_gpio_cfgpin(SD_DET_WAKE, S3C_GPIO_SFN(0xf)); s3c_gpio_setpull(SD_DET_WAKE, 0); retval = request_irq(__gpio_to_irq(SD_DET_WAKE), s3c_sdhci_power_irq, IRQ_TYPE_EDGE_BOTH, sd_driver_name, NULL); if (retval != 0) { printk(KERN_ERR "%s: can't get irq %i, err %d\n", sd_driver_name, __gpio_to_irq(SD_DET_WAKE), retval); } printk(KERN_ERR "%s: get irq %i, err %d\n", sd_driver_name, __gpio_to_irq(SD_DET_WAKE), retval); } #endif return 0; err_add_host: release_resource(sc->ioarea); kfree(sc->ioarea); err_req_regs: for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) { if (sc->clk_bus[ptr]) { clk_disable(sc->clk_bus[ptr]); clk_put(sc->clk_bus[ptr]); } } err_no_busclks: clk_disable(sc->clk_io); clk_put(sc->clk_io); err_io_clk: sdhci_free_host(host); return ret; }
static int __devinit sdhci_s3c_probe(struct platform_device *pdev) { struct s3c_sdhci_platdata *pdata = pdev->dev.platform_data; struct device *dev = &pdev->dev; struct sdhci_host *host; struct sdhci_s3c *sc; struct resource *res; int ret, irq, ptr, clks; if (!pdata) { dev_err(dev, "no device data specified\n"); return -ENOENT; } irq = platform_get_irq(pdev, 0); if (irq < 0) { dev_err(dev, "no irq specified\n"); return irq; } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err(dev, "no memory specified\n"); return -ENOENT; } host = sdhci_alloc_host(dev, sizeof(struct sdhci_s3c)); if (IS_ERR(host)) { dev_err(dev, "sdhci_alloc_host() failed\n"); return PTR_ERR(host); } sc = sdhci_priv(host); sc->host = host; sc->pdev = pdev; sc->pdata = pdata; sc->ext_cd_gpio = -1; /* invalid gpio number */ platform_set_drvdata(pdev, host); sc->clk_io = clk_get(dev, "hsmmc"); if (IS_ERR(sc->clk_io)) { dev_err(dev, "failed to get io clock\n"); ret = PTR_ERR(sc->clk_io); goto err_io_clk; } /* enable the local io clock and keep it running for the moment. */ clk_enable(sc->clk_io); for (clks = 0, ptr = 0; ptr < MAX_BUS_CLK; ptr++) { struct clk *clk; char *name = pdata->clocks[ptr]; if (name == NULL) continue; clk = clk_get(dev, name); if (IS_ERR(clk)) { dev_err(dev, "failed to get clock %s\n", name); continue; } clks++; sc->clk_bus[ptr] = clk; /* * save current clock index to know which clock bus * is used later in overriding functions. */ sc->cur_clk = ptr; clk_enable(clk); dev_info(dev, "clock source %d: %s (%ld Hz)\n", ptr, name, clk_get_rate(clk)); } if (clks == 0) { dev_err(dev, "failed to find any bus clocks\n"); ret = -ENOENT; goto err_no_busclks; } sc->ioarea = request_mem_region(res->start, resource_size(res), mmc_hostname(host->mmc)); if (!sc->ioarea) { dev_err(dev, "failed to reserve register area\n"); ret = -ENXIO; goto err_req_regs; } host->ioaddr = ioremap_nocache(res->start, resource_size(res)); if (!host->ioaddr) { dev_err(dev, "failed to map registers\n"); ret = -ENXIO; goto err_req_regs; } /* Ensure we have minimal gpio selected CMD/CLK/Detect */ if (pdata->cfg_gpio) pdata->cfg_gpio(pdev, pdata->max_width); host->hw_name = "samsung-hsmmc"; host->ops = &sdhci_s3c_ops; host->quirks = 0; host->irq = irq; /* Setup quirks for the controller */ host->quirks |= SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC; host->quirks |= SDHCI_QUIRK_NO_HISPD_BIT; #ifndef CONFIG_MMC_SDHCI_S3C_DMA /* we currently see overruns on errors, so disable the SDMA * support as well. */ host->quirks |= SDHCI_QUIRK_BROKEN_DMA; #endif /* CONFIG_MMC_SDHCI_S3C_DMA */ /* It seems we do not get an DATA transfer complete on non-busy * transfers, not sure if this is a problem with this specific * SDHCI block, or a missing configuration that needs to be set. */ host->quirks |= SDHCI_QUIRK_NO_BUSY_IRQ; if (pdata->cd_type == S3C_SDHCI_CD_NONE) host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION; if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT) host->mmc->caps = MMC_CAP_NONREMOVABLE; if (pdata->host_caps) host->mmc->caps |= pdata->host_caps; /* if vmmc_name is in pdata */ if (pdata->vmmc_name) host->vmmc_name = pdata->vmmc_name; host->quirks |= (SDHCI_QUIRK_32BIT_DMA_ADDR | SDHCI_QUIRK_32BIT_DMA_SIZE); /* HSMMC on Samsung SoCs uses SDCLK as timeout clock */ host->quirks |= SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK; /* * If controller does not have internal clock divider, * we can use overriding functions instead of default. */ if (pdata->clk_type) { sdhci_s3c_ops.set_clock = sdhci_cmu_set_clock; sdhci_s3c_ops.get_min_clock = sdhci_cmu_get_min_clock; sdhci_s3c_ops.get_max_clock = sdhci_cmu_get_max_clock; } /* It supports additional host capabilities if needed */ if (pdata->host_caps) host->mmc->caps |= pdata->host_caps; /* for BCM WIFI */ if (pdata->pm_flags) host->mmc->pm_flags |= pdata->pm_flags; #ifdef CONFIG_MACH_MIDAS_01_BD /* before calling shhci_add_host, you should turn vdd_tflash on */ sdhci_s3c_vtf_on_off(1); #endif /* To turn on vmmc regulator only if sd card exists, GPIO pin for card detection should be initialized. Moved from sdhci_s3c_setup_card_detect_gpio() function */ if (pdata->cd_type == S3C_SDHCI_CD_GPIO && gpio_is_valid(pdata->ext_cd_gpio)) { if (gpio_request(pdata->ext_cd_gpio, "SDHCI EXT CD") == 0) { sc->ext_cd_gpio = pdata->ext_cd_gpio; sc->ext_cd_gpio_invert = pdata->ext_cd_gpio_invert; mmc_host_sd_set_present(host->mmc); if (sd_detection_cmd_dev == NULL && sc->ext_cd_gpio) { sd_detection_cmd_dev = device_create(sec_class, NULL, 0, NULL, "sdcard"); if (IS_ERR(sd_detection_cmd_dev)) pr_err("Fail to create sysfs dev\n"); if (device_create_file(sd_detection_cmd_dev, &dev_attr_status) < 0) pr_err("Fail to create sysfs file\n"); dev_set_drvdata(sd_detection_cmd_dev, sc); } #ifdef CONFIG_MIDAS_COMMON /* set TF_EN gpio as OUTPUT */ gpio_request(GPIO_TF_EN, "TF_EN"); gpio_direction_output(GPIO_TF_EN, 1); s3c_gpio_cfgpin(GPIO_TF_EN, S3C_GPIO_SFN(1)); s3c_gpio_setpull(GPIO_TF_EN, S3C_GPIO_PULL_NONE); #endif } else { dev_err(dev, "cannot request gpio for card detect\n"); } } ret = sdhci_add_host(host); if (ret) { dev_err(dev, "sdhci_add_host() failed\n"); goto err_add_host; } /* if it is set SDHCI_QUIRK_BROKEN_CARD_DETECTION before calling sdhci_add_host, in sdhci_add_host, MMC_CAP_NEEDS_POLL flag will be set. The flag S3C_SDHCI_CD_PERMANENT dose not need to detect a card by polling. */ if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT || \ pdata->cd_type == S3C_SDHCI_CD_GPIO) host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION; /* The following two methods of card detection might call sdhci_s3c_notify_change() immediately, so they can be called only after sdhci_add_host(). Setup errors are ignored. */ if (pdata->cd_type == S3C_SDHCI_CD_EXTERNAL && pdata->ext_cd_init) { pdata->ext_cd_init(&sdhci_s3c_notify_change); #ifdef CONFIG_MACH_PX if (pdata->ext_pdev) pdata->ext_pdev(pdev); #endif } if (pdata->cd_type == S3C_SDHCI_CD_GPIO && gpio_is_valid(pdata->ext_cd_gpio)) sdhci_s3c_setup_card_detect_gpio(sc); #ifdef CONFIG_MACH_MIDAS_01_BD /* if card dose not exist, it should turn vtf off */ if (pdata->cd_type == S3C_SDHCI_CD_GPIO && sdhci_s3c_get_card_exist(host)) sdhci_s3c_vtf_on_off(1); else sdhci_s3c_vtf_on_off(0); #endif return 0; err_add_host: release_resource(sc->ioarea); kfree(sc->ioarea); err_req_regs: for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) { clk_disable(sc->clk_bus[ptr]); clk_put(sc->clk_bus[ptr]); } err_no_busclks: clk_disable(sc->clk_io); clk_put(sc->clk_io); err_io_clk: sdhci_free_host(host); return ret; }
void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *dev, int width) { struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; unsigned int gpio; #if defined(CONFIG_WIMAX_CMC) /* && defined(CONFIG_TARGET_LOCALE_NA) */ if (gpio_get_value(GPIO_WIMAX_EN)) { for (gpio = EXYNOS4_GPK3(0); gpio < EXYNOS4_GPK3(2); gpio++) { s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2); } for (gpio = EXYNOS4_GPK3(3); gpio <= EXYNOS4_GPK3(6); gpio++) { s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2); } for (gpio = EXYNOS4_GPK3(0); gpio < EXYNOS4_GPK3(2); gpio++) { s3c_gpio_slp_cfgpin(gpio, S3C_GPIO_SLP_INPUT); s3c_gpio_slp_setpull_updown(gpio, S3C_GPIO_PULL_NONE); } for (gpio = EXYNOS4_GPK3(3); gpio <= EXYNOS4_GPK3(6); gpio++) { s3c_gpio_slp_cfgpin(gpio, S3C_GPIO_SLP_INPUT); s3c_gpio_slp_setpull_updown(gpio, S3C_GPIO_PULL_NONE); } } else { for (gpio = EXYNOS4_GPK3(0); gpio < EXYNOS4_GPK3(2); gpio++) { s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0)); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN); } for (gpio = EXYNOS4_GPK3(3); gpio <= EXYNOS4_GPK3(6); gpio++) { s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0)); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN); } for (gpio = EXYNOS4_GPK3(0); gpio < EXYNOS4_GPK3(2); gpio++) { s3c_gpio_slp_cfgpin(gpio, S3C_GPIO_SLP_INPUT); s3c_gpio_slp_setpull_updown(gpio, S3C_GPIO_PULL_DOWN); } for (gpio = EXYNOS4_GPK3(3); gpio <= EXYNOS4_GPK3(6); gpio++) { s3c_gpio_slp_cfgpin(gpio, S3C_GPIO_SLP_INPUT); s3c_gpio_slp_setpull_updown(gpio, S3C_GPIO_PULL_DOWN); } } #else /* Set all the necessary GPK3[0:1] pins to special-function 2 */ for (gpio = EXYNOS4_GPK3(0); gpio < EXYNOS4_GPK3(2); gpio++) { s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); #ifdef CONFIG_MACH_U1 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2); #elif defined(CONFIG_MACH_MIDAS) s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); #elif defined(CONFIG_MACH_PX) s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); #else s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); #endif } #if defined(CONFIG_MACH_PX) s3c_gpio_setpull(EXYNOS4_GPK3(1), S3C_GPIO_PULL_UP); #endif for (gpio = EXYNOS4_GPK3(3); gpio <= EXYNOS4_GPK3(6); gpio++) { /* Data pin GPK3[3:6] to special-function 2 */ s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); #ifdef CONFIG_MACH_U1 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2); #elif defined(CONFIG_MACH_MIDAS) s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); #elif defined(CONFIG_MACH_PX) s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); #else s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); #endif } if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { s3c_gpio_cfgpin(EXYNOS4_GPK3(2), S3C_GPIO_SFN(2)); s3c_gpio_setpull(EXYNOS4_GPK3(2), S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2); } #endif }
u_long hwProcessPrivateCmd(MINIPORT_ADAPTER *pAdapter, void *Buffer) { PHW_PRIVATE_PACKET cmd = (PHW_PRIVATE_PACKET)Buffer; UCHAR *bufp; ENTER; switch(cmd->Code) { case HwCodeMacResponse: { DumpDebug(RX_DPC, "WiBro SDIO: MAC Response"); bufp = (PUCHAR)Buffer; /* processing for mac_req request */ complete(&pAdapter->hFWInitCompleteEvent); DumpDebug(RX_DPC,"MAC address = {%x, %x, %x, %x, %x, %x}", bufp[3], bufp[4], bufp[5], bufp[6], bufp[7], bufp[8]); memcpy(pAdapter->CurrentAddress, bufp + 3, MINIPORT_LENGTH_OF_ADDRESS); // create ethernet header memcpy(pAdapter->hw.EthHeader, pAdapter->CurrentAddress, MINIPORT_LENGTH_OF_ADDRESS); memcpy(pAdapter->hw.EthHeader + MINIPORT_LENGTH_OF_ADDRESS, pAdapter->CurrentAddress, MINIPORT_LENGTH_OF_ADDRESS); pAdapter->hw.EthHeader[(MINIPORT_LENGTH_OF_ADDRESS * 2) - 1] += 1; memcpy(pAdapter->net->dev_addr, bufp + 3, MINIPORT_LENGTH_OF_ADDRESS); pAdapter->acquired_mac_address=TRUE; s3c_gpio_cfgpin(WIMAX_WAKEUP, S3C_GPIO_SFN(1)); s3c_gpio_setpull(WIMAX_WAKEUP, S3C_GPIO_PULL_NONE); gpio_set_value(WIMAX_WAKEUP, GPIO_LEVEL_HIGH); if(pAdapter->DownloadMode) { pAdapter->bFWDNEndFlag = TRUE; wake_up_interruptible(&pAdapter->hFWDNEndEvent); } return (sizeof(HW_PRIVATE_PACKET) + MINIPORT_LENGTH_OF_ADDRESS - sizeof(UCHAR)); } case HwCodeLinkIndication: { DumpDebug(RX_DPC, " link indication packet (%04x), value(%04x)",cmd->Code, cmd->Value); #ifdef MINIPORT_USE_WMI_OID if (pAdapter->mgt.Enabled) { DumpDebug(RX_DPC, "WiBro SDIO: indication skipped"); break; } #endif if ((cmd->Value == HW_PROT_VALUE_LINK_DOWN) && (pAdapter->MediaState != MEDIA_DISCONNECTED)) { // start disconnect indication timer #ifdef DISCONNECT_TIMER hwStartDisconnectTimer(pAdapter); #else pAdapter->MediaState = MEDIA_DISCONNECTED; netif_stop_queue(pAdapter->net); netif_carrier_off(pAdapter->net); //cky 20100402 pAdapter->WibroStatus = WIBRO_STATE_READY; DumpDebug(RX_DPC, "LINK_DOWN_INDICATION"); // AP sleep mode: WIMAX VI gpio_set_value(WIMAX_IF_MODE1, GPIO_LEVEL_LOW); #endif } else if ((cmd->Value == HW_PROT_VALUE_LINK_UP) && (pAdapter->MediaState != MEDIA_CONNECTED)) { // set value to structure pAdapter->MediaState = MEDIA_CONNECTED; // indicate link up netif_start_queue(pAdapter->net); pAdapter->net->mtu = MINIPORT_MTU_SIZE; //sangam set mtu after connect netif_carrier_on(pAdapter->net); pAdapter->WibroStatus = WIBRO_STATE_NORMAL; DumpDebug(RX_DPC, "LINK_UP_INDICATION"); // AP sleep mode: WIMAX IDLE or VI gpio_set_value(WIMAX_IF_MODE1, getWiMAXSleepMode()); DumpDebug(RX_DPC, "AP SLEEP: WIMAX %d (0: VI, 1: IDLE)", getWiMAXSleepMode()); } break; } case HwCodeHaltedIndication: { DumpDebug(RX_DPC, "Device is about to reset, stop driver"); pAdapter->bHaltPending = TRUE; break; } case HwCodeRxReadyIndication: { DumpDebug(RX_DPC, "Device RxReady"); // stop timer #ifdef DISCONNECT_TIMER hwStopRetryTimer(pAdapter); #endif // increase stats pAdapter->stats.tx.Ack++; // device ready to receive new packet DumpDebug(RX_DPC, "Ack"); // sangam : to start the data packet send queue again after stopping in xmit if (pAdapter->MediaState == MEDIA_CONNECTED) netif_wake_queue(pAdapter->net); break; } case HwCodeIdleNtfy: { // set idle DumpDebug(RX_DPC, "hwProcessPrivateCmd: Device is going to idle mode - Status:[%d]", pAdapter->WibroStatus); if(pAdapter->WibroStatus == WIBRO_STATE_NORMAL || pAdapter->WibroStatus == WIBRO_STATE_IDLE) { DumpDebug(RX_DPC, "hwProcessPrivateCmd: Set IDLE"); pAdapter->WibroStatus = WIBRO_STATE_IDLE; } else { DumpDebug(RX_DPC, "hwProcessPrivateCmd: Set VIRTUAL IDLE - Status:[%d]", pAdapter->WibroStatus); pAdapter->WibroStatus = WIBRO_STATE_VIRTUAL_IDLE; } s3c_bat_use_wimax(0); //cky 20100624 break; } case HwCodeWakeUpNtfy: { // clear idle DumpDebug(RX_DPC, "hwProcessPrivateCmd: Device is now in normal state and ready to operate - Status: [%d]", pAdapter->WibroStatus); #ifdef WAKEUP_BY_GPIO if(pAdapter->WibroStatus == WIBRO_STATE_AWAKE_REQUESTED) { complete(&pAdapter->hAwakeAckEvent); break; } #endif if(pAdapter->WibroStatus == WIBRO_STATE_IDLE) { DumpDebug(RX_DPC, "hwProcessPrivateCmd: IDLE -> NORMAL"); pAdapter->WibroStatus = WIBRO_STATE_NORMAL; } else if(pAdapter->WibroStatus == WIBRO_STATE_NORMAL) { DumpDebug(RX_DPC, "hwProcessPrivateCmd: Already Normal maybe AP Wakeup"); pAdapter->WibroStatus = WIBRO_STATE_NORMAL; } else { DumpDebug(RX_DPC, "hwProcessPrivateCmd: VI -> READY"); pAdapter->WibroStatus = WIBRO_STATE_READY; } s3c_bat_use_wimax(1); //cky 20100624 break; } default: DumpDebug(RX_DPC, "Command = %04x", cmd->Code); } return sizeof(HW_PRIVATE_PACKET); LEAVE; }
void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width) { struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; unsigned int gpio; /* Set all the necessary GPK2[0:1] pins to special-function 2 */ for (gpio = EXYNOS4_GPK2(0); gpio < EXYNOS4_GPK2(2); gpio++) { s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); #ifdef CONFIG_MACH_U1 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV3); #elif defined(CONFIG_MACH_MIDAS) s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); #else s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); #endif } switch (width) { case 8: for (gpio = EXYNOS4_GPK3(3); gpio <= EXYNOS4_GPK3(6); gpio++) { /* Data pin GPK3[3:6] to special-function 3 */ s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3)); #ifdef CONFIG_MACH_U1 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV3); #elif defined(CONFIG_MACH_MIDAS) s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); #else s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); #endif } case 4: for (gpio = EXYNOS4_GPK2(3); gpio <= EXYNOS4_GPK2(6); gpio++) { /* Data pin GPK2[3:6] to special-function 2 */ s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); #ifdef CONFIG_MACH_U1 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV3); #elif defined(CONFIG_MACH_MIDAS) s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); #else s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); #endif } default: break; } if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { s3c_gpio_cfgpin(EXYNOS4_GPK2(2), S3C_GPIO_SFN(2)); s3c_gpio_setpull(EXYNOS4_GPK2(2), S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2); } }
static void __init gps_gpio_init(void) { if (gpio_request(GPIO_GPS_nRST, "GPS_nRST")) WARN(1, "fail to request gpio (GPS_nRST)\n"); s3c_gpio_setpull(GPIO_GPS_nRST, S3C_GPIO_PULL_UP); s3c_gpio_cfgpin(GPIO_GPS_nRST, S3C_GPIO_OUTPUT); gpio_direction_output(GPIO_GPS_nRST, 1); #ifdef CONFIG_TARGET_LOCALE_NTT if (system_rev >= 11) { if (gpio_request(GPIO_GPS_PWR_EN, "GPS_PWR_EN")) WARN(1, "fail to request gpio (GPS_PWR_EN)\n"); s3c_gpio_setpull(GPIO_GPS_PWR_EN, S3C_GPIO_PULL_NONE); s3c_gpio_cfgpin(GPIO_GPS_PWR_EN, S3C_GPIO_OUTPUT); gpio_direction_output(GPIO_GPS_PWR_EN, 0); gpio_export(GPIO_GPS_nRST, 1); gpio_export(GPIO_GPS_PWR_EN, 1); } else { if (gpio_request(GPIO_GPS_PWR_EN_SPI, "GPS_PWR_EN")) WARN(1, "fail to request gpio (GPS_PWR_EN)\n"); s3c_gpio_setpull(GPIO_GPS_PWR_EN_SPI, S3C_GPIO_PULL_NONE); s3c_gpio_cfgpin(GPIO_GPS_PWR_EN_SPI, S3C_GPIO_OUTPUT); gpio_direction_output(GPIO_GPS_PWR_EN_SPI, 0); gpio_export(GPIO_GPS_nRST, 1); gpio_export(GPIO_GPS_PWR_EN_SPI, 1); } #else if (gpio_request(GPIO_GPS_PWR_EN, "GPS_PWR_EN")) WARN(1, "fail to request gpio (GPS_PWR_EN)\n"); s3c_gpio_setpull(GPIO_GPS_PWR_EN, S3C_GPIO_PULL_NONE); s3c_gpio_cfgpin(GPIO_GPS_PWR_EN, S3C_GPIO_OUTPUT); gpio_direction_output(GPIO_GPS_PWR_EN, 0); gpio_export(GPIO_GPS_nRST, 1); gpio_export(GPIO_GPS_PWR_EN, 1); #endif #ifdef CONFIG_TARGET_LOCALE_KOR if (system_rev >= 7) { if (gpio_request(GPIO_GPS_RTS, "GPS_RTS")) WARN(1, "fail to request gpio (GPS_RTS)\n"); s3c_gpio_setpull(GPIO_GPS_RTS, S3C_GPIO_PULL_UP); s3c_gpio_cfgpin(GPIO_GPS_RTS, S3C_GPIO_OUTPUT); gpio_direction_output(GPIO_GPS_RTS, 1); if (gpio_request(GPIO_GPS_CTS, "GPS_CTS")) WARN(1, "fail to request gpio (GPS_RTS)\n"); s3c_gpio_setpull(GPIO_GPS_CTS, S3C_GPIO_PULL_UP); s3c_gpio_cfgpin(GPIO_GPS_CTS, S3C_GPIO_OUTPUT); gpio_direction_output(GPIO_GPS_CTS, 1); } #endif BUG_ON(!gps_dev); gpio_export_link(gps_dev, "GPS_nRST", GPIO_GPS_nRST); #ifdef CONFIG_TARGET_LOCALE_NTT if (system_rev >= 11) gpio_export_link(gps_dev, "GPS_PWR_EN", GPIO_GPS_PWR_EN); else gpio_export_link(gps_dev, "GPS_PWR_EN", GPIO_GPS_PWR_EN_SPI); #else gpio_export_link(gps_dev, "GPS_PWR_EN", GPIO_GPS_PWR_EN); #endif gps_uart_cfg_gpio(ARRAY_SIZE(gps_uart_on_table), gps_uart_on_table); }
static int s5p_idpram_prepare_suspend(struct dpram_link_device *dpld) { struct link_device *ld = &dpld->ld; struct idpram_pm_data *pm_data = &dpld->pm_data; struct modem_ctl *mc = dpld->ld.mc; struct completion *cmpl; unsigned long timeout; unsigned long rest; int cnt = 0; u16 cmd = INT_CMD(INT_CMD_IDPRAM_SUSPEND_REQ); mif_info("+++\n"); pm_data->pm_state = IDPRAM_PM_SUSPEND_PREPARE; pm_data->last_msg = 0; s5p_idpram_set_pm_lock(dpld, 1); /* * Because, if dpram was powered down, cp dpram random intr was * ocurred. so, fixed by muxing cp dpram intr pin to GPIO output * high,.. */ gpio_set_value(dpld->gpio_int2cp, 1); s3c_gpio_cfgpin(dpld->gpio_int2cp, S3C_GPIO_OUTPUT); /* prevent PDA_ACTIVE status is low */ gpio_set_value(mc->gpio_pda_active, 1); cmpl = &pm_data->down_cmpl; timeout = IDPRAM_SUSPEND_REQ_TIMEOUT; cnt = 0; do { init_completion(cmpl); mif_info("send IDPRAM_SUSPEND_REQ (0x%X)\n", cmd); dpld->send_intr(dpld, cmd); rest = wait_for_completion_timeout(cmpl, timeout); if (rest == 0) { cnt++; mif_err("timeout!!! (count = %d)\n", cnt); if (cnt >= 3) { mif_err("ERR! no response from CP\n"); break; } } } while (rest == 0); switch (pm_data->last_msg) { case INT_CMD(INT_CMD_IDPRAM_SUSPEND_ACK): mif_info("recv IDPRAM_SUSPEND_ACK (0x%X)\n", pm_data->last_msg); pm_data->pm_state = IDPRAM_PM_DPRAM_POWER_DOWN; break; default: mif_err("ERR! %s down or not ready!!! (intr 0x%04X)\n", ld->name, dpld->recv_intr(dpld)); timeout = msecs_to_jiffies(500); wake_lock_timeout(&pm_data->hold_wlock, timeout); s5p_idpram_set_pm_lock(dpld, 0); break; } mif_info("---\n"); return 0; }