&s5p_device_fimd1, }; static struct platform_device *odroidxu_mipi_display_devices[] __initdata = { &s5p_device_mipi_dsim1, }; static struct platform_device *odroidxu_dp_display_devices[] __initdata = { &s5p_device_dp, &odroidxu_dp_lcd, }; /* LCD Backlight data */ static struct samsung_bl_gpio_info odroidxu_bl_gpio_info = { .no = EXYNOS5410_GPB2(3), .func = S3C_GPIO_SFN(2), }; static struct platform_pwm_backlight_data odroidxu_bl_data = { .pwm_id = 3, .pwm_period_ns = 30000, }; void s5p_dp_set_parameter(void) { odroidxu_fb_default.win_mode.left_margin = simple_strtol(FbLeft , NULL, 10); odroidxu_fb_default.win_mode.right_margin = simple_strtol(FbRight, NULL, 10); odroidxu_fb_default.win_mode.upper_margin = simple_strtol(FbUpper, NULL, 10); odroidxu_fb_default.win_mode.lower_margin = simple_strtol(FbLower, NULL, 10); odroidxu_fb_default.win_mode.hsync_len = simple_strtol(FbHsync, NULL, 10); odroidxu_fb_default.win_mode.vsync_len = simple_strtol(FbVsync, NULL, 10);
static void modem_link_pm_config_gpio(void) { int err = 0; unsigned gpio_link_enable = modem_link_pm_data.gpio_link_enable; unsigned gpio_link_active = modem_link_pm_data.gpio_link_active; unsigned gpio_link_hostwake = modem_link_pm_data.gpio_link_hostwake; unsigned gpio_link_slavewake = modem_link_pm_data.gpio_link_slavewake; /* unsigned irq_link_hostwake = umts_modem_res[1].start; */ if (gpio_link_enable) { err = gpio_request(gpio_link_enable, "LINK_EN"); if (err) { printk(KERN_ERR "fail to request gpio %s : %d\n", "LINK_EN", err); } gpio_direction_output(gpio_link_enable, 0); } if (gpio_link_active) { err = gpio_request(gpio_link_active, "LINK_ACTIVE"); if (err) { printk(KERN_ERR "fail to request gpio %s : %d\n", "LINK_ACTIVE", err); } gpio_direction_output(gpio_link_active, 0); } if (gpio_link_hostwake) { err = gpio_request(gpio_link_hostwake, "HOSTWAKE"); if (err) { printk(KERN_ERR "fail to request gpio %s : %d\n", "HOSTWAKE", err); } gpio_direction_input(gpio_link_hostwake); s3c_gpio_cfgpin(gpio_link_hostwake, S3C_GPIO_SFN(0xF)); s3c_gpio_setpull(gpio_link_hostwake, S3C_GPIO_PULL_NONE); } if (gpio_link_slavewake) { err = gpio_request(gpio_link_slavewake, "SLAVEWAKE"); if (err) { printk(KERN_ERR "fail to request gpio %s : %d\n", "SLAVEWAKE", err); } gpio_direction_output(gpio_link_slavewake, 0); s3c_gpio_setpull(gpio_link_slavewake, S3C_GPIO_PULL_NONE); } if (gpio_link_hostwake) irq_set_irq_type(gpio_to_irq(gpio_link_hostwake), IRQ_TYPE_EDGE_BOTH); active_ctl.gpio_initialized = 1; if (active_ctl.gpio_request_host_active) { pr_err(" [MODEM_IF] Active States = 1, %s\n", __func__); gpio_direction_output(modem_link_pm_data.gpio_link_active, 1); } printk(KERN_INFO "modem_link_pm_config_gpio done\n"); }
S3C_GPIO_PULL_NONE, S5P_GPIO_DRVSTR_LV1}, /* PS_ALS_INT */ #else {EXYNOS4_GPX0(2), S3C_GPIO_INPUT, S3C_GPIO_SETPIN_NONE, S3C_GPIO_PULL_DOWN, S5P_GPIO_DRVSTR_LV1}, /* EAR_SEND_END_AP */ #endif {EXYNOS4_GPX0(3), S3C_GPIO_INPUT, S3C_GPIO_SETPIN_NONE, S3C_GPIO_PULL_NONE, S5P_GPIO_DRVSTR_LV1}, /* COVER_DET */ {EXYNOS4_GPX0(4), S3C_GPIO_INPUT, S3C_GPIO_SETPIN_NONE, S3C_GPIO_PULL_DOWN, S5P_GPIO_DRVSTR_LV1}, /* DOCK_INT -> NC*/ #if !defined(CONFIG_QC_MODEM) {EXYNOS4_GPX0(5), S3C_GPIO_INPUT, S3C_GPIO_SETPIN_NONE, S3C_GPIO_PULL_DOWN, S5P_GPIO_DRVSTR_LV1}, /* REMOTE_SENSE_IRQ -> NC */ {EXYNOS4_GPX0(6), S3C_GPIO_INPUT, S3C_GPIO_SETPIN_NONE, S3C_GPIO_PULL_DOWN, S5P_GPIO_DRVSTR_LV1}, /* CHG_INT -> NC*/ #endif {EXYNOS4_GPX0(7), S3C_GPIO_SFN(0xF), S3C_GPIO_SETPIN_NONE, S3C_GPIO_PULL_NONE, S5P_GPIO_DRVSTR_LV1}, /* AP_PMIC_IRQ */ {EXYNOS4_GPX1(3), S3C_GPIO_INPUT, S3C_GPIO_SETPIN_NONE, S3C_GPIO_PULL_DOWN, S5P_GPIO_DRVSTR_LV1}, /* ACCESSORY_INT -> NC */ {EXYNOS4_GPX1(5), S3C_GPIO_INPUT, S3C_GPIO_SETPIN_NONE, S3C_GPIO_PULL_NONE, S5P_GPIO_DRVSTR_LV1}, /* OVP_FLAG */ #if defined(CONFIG_SEC_MODEM) || defined(CONFIG_QC_MODEM) {EXYNOS4_GPX1(7), S3C_GPIO_INPUT, S3C_GPIO_SETPIN_NONE, S3C_GPIO_PULL_NONE, S5P_GPIO_DRVSTR_LV1}, /* SIM_DETECT */ #endif #if !defined(CONFIG_QC_MODEM) {EXYNOS4_GPX2(0), S3C_GPIO_INPUT, S3C_GPIO_SETPIN_NONE, S3C_GPIO_PULL_DOWN, S5P_GPIO_DRVSTR_LV1}, /* BUCK3_SEL */
static int gp2a_prox_probe(struct i2c_client *client,const struct i2c_device_id *id) { int ret =0; u8 reg_value; printk("------ %s start \n", __func__); /* Allocate driver_data */ gp2a_data = kzalloc(sizeof(struct gp2a_prox_data),GFP_KERNEL); if(!gp2a_data) { error("kzalloc:allocating driver_data error"); return -ENOMEM; } gp2a_data->gp2a_prox_i2c_client = client; i2c_set_clientdata(client, gp2a_data); /*misc device registration*/ if( (ret = misc_register(&gp2a_prox_misc_device)) < 0 ) { error("gp2a_prox driver misc_register failed"); goto FREE_GP2A_DATA; } wake_lock_init(&prox_wakelock,WAKE_LOCK_SUSPEND,"prox_wakelock"); /*Initialisation of GPIO_PS_OUT of proximity sensor*/ s3c_gpio_cfgpin(GPIO_PS_OUT, S3C_GPIO_SFN(GPIO_PS_OUT_STATE)); s3c_gpio_setpull(GPIO_PS_OUT, S3C_GPIO_PULL_NONE); /*Input Device Settings*/ gp2a_data->prox_input_dev = input_allocate_device(); if (!gp2a_data->prox_input_dev) { error("Not enough memory for gp2a_data->prox_input_dev"); ret = -ENOMEM; goto MISC_DREG; } gp2a_data->prox_input_dev->name = "gp2a_prox"; set_bit(EV_SYN,gp2a_data->prox_input_dev->evbit); set_bit(EV_ABS,gp2a_data->prox_input_dev->evbit); input_set_abs_params(gp2a_data->prox_input_dev, ABS_DISTANCE, 0, 1, 0, 0); ret = input_register_device(gp2a_data->prox_input_dev); if (ret) { error("Failed to register input device"); input_free_device(gp2a_data->prox_input_dev); goto MISC_DREG; } debug("Input device settings complete"); /* Workqueue Settings */ gp2a_prox_wq = create_singlethread_workqueue("gp2a_prox_wq"); if (!gp2a_prox_wq) { error("Not enough memory for gp2a_prox_wq"); ret = -ENOMEM; goto INPUT_DEV_DREG; } INIT_WORK(&gp2a_data->work_prox, gp2a_prox_work_func); debug("Workqueue settings complete"); gp2a_data->irq = -1; set_irq_type(PROX_IRQ, IRQ_TYPE_EDGE_BOTH); if( (ret = request_irq(PROX_IRQ, gp2a_irq_handler,IRQF_DISABLED , "proximity_int", NULL )) ) { error("GP2A request_irq failed IRQ_NO:%d", PROX_IRQ); goto DESTROY_WORK_QUEUE; } else debug("GP2A request_irq success IRQ_NO:%d", PROX_IRQ); gp2a_data->irq = PROX_IRQ; /*create sysfs attributes*/ ret = sysfs_create_group(&client->dev.kobj, &gp2a_prox_attr_group); if (ret) { error("Failed to create sysfs attributes"); goto FREE_IRQ; } /*Device Initialisation with recommended register values from datasheet*/ reg_value = 0x18; if((ret=gp2a_i2c_write(GP2A_REG_CON,®_value))<0) error("gp2a_i2c_write 1 failed"); reg_value = 0x08; if((ret=gp2a_i2c_write(GP2A_REG_GAIN,®_value))<0) error("gp2a_i2c_write 2 failed"); reg_value = 0xC2; if((ret=gp2a_i2c_write(GP2A_REG_HYS,®_value))<0) error("gp2a_i2c_write 3 failed"); reg_value = 0x04; if((ret=gp2a_i2c_write(GP2A_REG_CYCLE,®_value))<0) error("gp2a_i2c_write 4 failed"); /*Pulling the GPIO_PS_OUT Pin High*/ s3c_gpio_setpull(GPIO_PS_OUT, S3C_GPIO_PULL_UP); /*Setting the device into shutdown mode*/ gp2a_prox_mode(0); printk("------ %s end\n", __func__); return ret; FREE_IRQ: free_irq(PROX_IRQ,NULL); DESTROY_WORK_QUEUE: destroy_workqueue(gp2a_prox_wq); INPUT_DEV_DREG: input_unregister_device(gp2a_data->prox_input_dev); MISC_DREG: misc_deregister(&gp2a_prox_misc_device); FREE_GP2A_DATA: kfree(gp2a_data); return ret; }
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_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) { printk(KERN_ERR "fail to request gpio %s : %d\n", "RESET_REQ_N", err); } gpio_direction_output(gpio_reset_req_n, 0); } if (gpio_cp_on) { err = gpio_request(gpio_cp_on, "CP_ON"); if (err) { printk(KERN_ERR "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) { printk(KERN_ERR "fail to request gpio %s : %d\n", "CP_RST", err); } gpio_direction_output(gpio_cp_rst, 0); s3c_gpio_setpull(gpio_cp_rst, S3C_GPIO_PULL_NONE); } if (gpio_pda_active) { err = gpio_request(gpio_pda_active, "PDA_ACTIVE"); if (err) { printk(KERN_ERR "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) { printk(KERN_ERR "fail to request gpio %s : %d\n", "PHONE_ACTIVE", err); } /* gpio_direction_input(gpio_phone_active); */ s3c_gpio_cfgpin(gpio_phone_active, S3C_GPIO_SFN(0xF)); s3c_gpio_setpull(gpio_phone_active, S3C_GPIO_PULL_NONE); pr_err("check phone active = %d\n", irq_phone_active); } if (gpio_cp_dump_int) { err = gpio_request(gpio_cp_dump_int, "CP_DUMP_INT"); if (err) { printk(KERN_ERR "fail to request gpio %s : %d\n", "CP_DUMP_INT", err); } gpio_direction_input(gpio_cp_dump_int); } if (gpio_flm_uart_sel) { err = gpio_request(gpio_flm_uart_sel, "GPS_UART_SEL"); if (err) { printk(KERN_ERR "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); 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); } printk(KERN_INFO "umts_modem_cfg_gpio done\n"); }
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_sim_ndetect = mdmctl_data.gpio_sim_ndetect; #if defined (CONFIG_CP_CHIPSET_STE) unsigned gpio_int_resout = mdmctl_data.gpio_int_resout; unsigned gpio_int_cp_pwr_rst = mdmctl_data.gpio_int_cp_pwr_rst; #endif #if defined (CONFIG_CP_CHIPSET_STE) 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); } #endif 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_HIGH); s3c_gpio_setpull(gpio_pda_active, S3C_GPIO_PULL_NONE); } if (mdmctl_data.gpio_reset_req_n) { err = gpio_request(mdmctl_data.gpio_reset_req_n, "RST_REQN"); if (err) { printk("fail to request gpio %s\n","RST_REQN"); } } #if defined (CONFIG_CP_CHIPSET_STE) err = gpio_request(gpio_int_resout, "INT_RESOUT"); if (err) { printk("fail to request gpio %s\n","INT_RESOUT"); } else { gpio_direction_output(gpio_int_resout, GPIO_LEVEL_LOW); s3c_gpio_setpull(gpio_int_resout, S3C_GPIO_PULL_NONE); } s3c_gpio_cfgpin(gpio_int_resout, S3C_GPIO_SFN(0xF)); s3c_gpio_setpull(gpio_int_resout, S3C_GPIO_PULL_NONE); set_irq_type(gpio_int_resout, IRQ_TYPE_EDGE_BOTH); err = gpio_request(gpio_int_cp_pwr_rst, "INT_CP_PWR_RST"); if (err) { printk("fail to request gpio %s\n","INT_CP_PWR_RST"); } else { gpio_direction_output(gpio_int_cp_pwr_rst, GPIO_LEVEL_LOW); s3c_gpio_setpull(gpio_int_cp_pwr_rst, S3C_GPIO_PULL_NONE); } s3c_gpio_cfgpin(gpio_int_cp_pwr_rst, S3C_GPIO_SFN(0xF)); s3c_gpio_setpull(gpio_int_cp_pwr_rst, S3C_GPIO_PULL_NONE); set_irq_type(gpio_int_cp_pwr_rst, IRQ_TYPE_EDGE_BOTH); #endif s3c_gpio_cfgpin(gpio_phone_active, S3C_GPIO_SFN(0xF)); s3c_gpio_setpull(gpio_phone_active, S3C_GPIO_PULL_NONE); 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); set_irq_type(gpio_sim_ndetect, IRQ_TYPE_EDGE_BOTH); }
void init_display_gpio_exynos(void) { unsigned int reg = 0; #if defined(CONFIG_S5P_DP) unsigned gpio_dp_hotplug = 0; gpio_dp_hotplug = get_display_dp_hotplug_gpio_exynos(); /* Set Hotplug detect for DP */ gpio_request(gpio_dp_hotplug, "dp_hotplug"); /* TO DO */ s3c_gpio_cfgpin(gpio_dp_hotplug, S3C_GPIO_SFN(3)); #endif /* * Set DISP1BLK_CFG register for Display path selection * * FIMD of DISP1_BLK Bypass selection : DISP1BLK_CFG[15] * --------------------- * 1 | FIMD : selected */ reg = __raw_readl(S3C_VA_SYS + 0x0214); reg &= ~(1 << 15); /* To save other reset values */ reg |= (1 << 15); __raw_writel(reg, S3C_VA_SYS + 0x0214); #if defined(CONFIG_S5P_DP) /* Reference clcok selection for DPTX_PHY: PAD_OSC_IN */ reg = __raw_readl(S3C_VA_SYS + 0x04d4); reg &= ~(1 << 0); __raw_writel(reg, S3C_VA_SYS + 0x04d4); /* DPTX_PHY: XXTI */ reg = __raw_readl(S3C_VA_SYS + 0x04d8); reg &= ~(1 << 3); __raw_writel(reg, S3C_VA_SYS + 0x04d8); #endif /* * Set DISP1BLK_CFG register for Display path selection * * MIC of DISP1_BLK Bypass selection: DISP1BLK_CFG[11] * -------------------- * 0 | MIC * 1 | Bypass : selected */ reg = __raw_readl(S3C_VA_SYS + 0x0214); reg &= ~(1 << 11); #ifndef CONFIG_DECON_MIC reg |= (1 << 11); #endif __raw_writel(reg, S3C_VA_SYS + 0x0214); #if defined (CONFIG_FB_I80_COMMAND_MODE) && !defined (FIMD_VIDEO_PSR) reg = __raw_readl(S3C_VA_SYS + 0x0214); reg |= (1 << 24); __raw_writel(reg, S3C_VA_SYS + 0x0214); #endif #if defined (CONFIG_SOC_EXYNOS5422_REV_0) /* related to convertor between FIMD & MIPI */ reg = __raw_readl(S3C_VA_SYS + 0x0214); reg |= (1 << 12); __raw_writel(reg, S3C_VA_SYS + 0x0214); #endif }
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_add_host; } /* 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; /* 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); return 0; err_add_host: if (host->ioaddr) iounmap(host->ioaddr); release_mem_region(sc->ioarea->start, resource_size(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; }
static int s6e8ax0_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, &s6e8ax0_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, &s6e8ax0_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->cur_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_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); s6e8ax0_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_ea8061(&lcd->smart); ret = s6e8ax0_read_mtp(lcd, mtp_data); if (!ret) printk(KERN_ERR "[LCD:ERROR] : %s read mtp failed\n", __func__); calc_voltage_table_ea8061(&lcd->smart, mtp_data); 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_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 = ea8061_early_suspend; lcd_late_resume = ea8061_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; }
u32 pud; }; struct sleep_gpio_tables { struct gpio_sleep_data *table; u32 arr_size; }; #define MAX_BOARD_REV 0xf static struct sleep_gpio_tables klimt_sleep_gpio_tables[MAX_BOARD_REV]; static int nr_klimt_sleep_gpio_table; /* init gpio table for KLIMT project */ static struct gpio_init_data __initdata init_gpio_table[] = { /* GPA 0 */ { EXYNOS5420_GPA0(0), S3C_GPIO_SFN(2), GPIO_LV_N, S3C_GPIO_PULL_NONE }, /* BT_UART_RXD */ { EXYNOS5420_GPA0(2), S3C_GPIO_SFN(2), GPIO_LV_N, S3C_GPIO_PULL_NONE }, /* BT_UART_CTS */ #if defined(CONFIG_KLIMT_TD) { EXYNOS5420_GPA0(4), S3C_GPIO_INPUT, GPIO_LV_N, S3C_GPIO_PULL_DOWN }, /* NC */ { EXYNOS5420_GPA0(5), S3C_GPIO_INPUT, GPIO_LV_N, S3C_GPIO_PULL_DOWN }, /* NC */ { EXYNOS5420_GPA0(6), S3C_GPIO_INPUT, GPIO_LV_N, S3C_GPIO_PULL_DOWN }, /* NC */ { EXYNOS5420_GPA0(7), S3C_GPIO_INPUT, GPIO_LV_N, S3C_GPIO_PULL_DOWN }, /* NC */ #endif /* GPA 1 */ { EXYNOS5420_GPA1(2), S3C_GPIO_INPUT, GPIO_LV_N, S3C_GPIO_PULL_NONE }, /* SENSOR_I2C_SDA */ { EXYNOS5420_GPA1(3), S3C_GPIO_INPUT, GPIO_LV_N, S3C_GPIO_PULL_NONE }, /* SENSOR_I2C_SCL */ /* GPA 2 */ #if !defined(CONFIG_KLIMT_WIFI) { EXYNOS5420_GPA2(0), S3C_GPIO_INPUT, GPIO_LV_N, S3C_GPIO_PULL_NONE }, /* GRIP_SDA */ { EXYNOS5420_GPA2(1), S3C_GPIO_INPUT, GPIO_LV_N, S3C_GPIO_PULL_NONE }, /* GRIP_SCL */ #endif
static int cyttsp5_hw_power(struct cyttsp5_core_platform_data *pdata, struct device *dev, int on) { struct regulator *regulator_vdd; struct regulator *regulator_avdd; mutex_lock(&pdata->poweronoff_lock); if (enabled == on) { tsp_debug_err(true, dev, "%s: same command. not excute(%d)\n", __func__, enabled); mutex_unlock(&pdata->poweronoff_lock); return 0; } regulator_vdd = regulator_get(NULL, "vdd_tsp_1v8"); if (IS_ERR(regulator_vdd)) { tsp_debug_err(true, dev, "%s: tsp_vdd regulator_get failed\n", __func__); mutex_unlock(&pdata->poweronoff_lock); return PTR_ERR(regulator_vdd); } regulator_avdd = regulator_get(NULL, "vtsp_a3v3"); if (IS_ERR(regulator_avdd)) { tsp_debug_err(true, dev, "%s: tsp_avdd regulator_get failed\n", __func__); regulator_put(regulator_vdd); mutex_unlock(&pdata->poweronoff_lock); return PTR_ERR(regulator_avdd); } tsp_debug_err(true, dev, "%s %s\n", __func__, on ? "on" : "off"); if (on) { regulator_enable(regulator_avdd); regulator_enable(regulator_vdd); s3c_gpio_cfgpin(GPIO_TSP_INT, S3C_GPIO_SFN(0xf)); #ifdef CONFIG_MACH_KMINI if (system_rev >= 1) s3c_gpio_setpull(GPIO_TSP_INT, S3C_GPIO_PULL_UP); else s3c_gpio_setpull(GPIO_TSP_INT, S3C_GPIO_PULL_NONE); #else s3c_gpio_setpull(GPIO_TSP_INT, S3C_GPIO_PULL_NONE); #endif } else { s3c_gpio_cfgpin(GPIO_TSP_INT, S3C_GPIO_INPUT); s3c_gpio_setpull(GPIO_TSP_INT, S3C_GPIO_PULL_DOWN); /* * TODO: If there is a case the regulator must be disabled * (e,g firmware update?), consider regulator_force_disable. */ regulator_disable(regulator_vdd); regulator_disable(regulator_avdd); /* TODO: Delay time should be adjusted */ //msleep(10); } enabled = on; regulator_put(regulator_vdd); regulator_put(regulator_avdd); mutex_unlock(&pdata->poweronoff_lock); return 0; }
static int db8131m_power_on(void) { struct regulator *regulator; int ret = 0; pr_debug("%s: in", __func__); db8131m_gpio_request(); /* 5M_CAM_nSTBY(5M STBY) LOW */ ret = gpio_request(GPIO_5M_CAM_nSTBY, "GPM0"); if (ret) { pr_err("faile to request gpio(GPIO_5M_CAM_nSTBY)"); return ret; } ret = gpio_direction_output(GPIO_5M_CAM_nSTBY, 0); CAM_CHECK_ERR_RET(ret, "low 5M_CAM_nSTBY"); /* 5M_CAM_RESET(5M RESET) LOW */ ret = gpio_request(GPIO_5M_CAM_RESET, "GPF1"); if (ret) { pr_err("faile to request gpio(GPIO_5M_CAM_RESET)"); return ret; } ret = gpio_direction_output(GPIO_5M_CAM_RESET, 0); CAM_CHECK_ERR_RET(ret, "low 5M_CAM_RESET"); /* VT_CAM_1.8V(VDDIO) */ regulator = regulator_get(NULL, "vt_cam_1.8v"); if (IS_ERR(regulator)) return -ENODEV; ret = regulator_enable(regulator); regulator_put(regulator); CAM_CHECK_ERR_RET(ret, "enable vt_cam_1.8v"); /* CAM_SENSOR_A2.8V */ regulator = regulator_get(NULL, "cam_sensor_a2.8v"); if (IS_ERR(regulator)) return -ENODEV; ret = regulator_enable(regulator); regulator_put(regulator); CAM_CHECK_ERR_RET(ret, "enable cam_sensor_a2.8v"); /* CAM_DVDD_1.5V(1.3M Core 1.8V) */ regulator = regulator_get(NULL, "cam_dvdd_1.5v"); if (IS_ERR(regulator)) return -ENODEV; ret = regulator_enable(regulator); regulator_put(regulator); CAM_CHECK_ERR_RET(ret, "enable cam_dvdd_1.5v"); /* CAM_ISP_CORE_1.2V ENABLE */ regulator = regulator_get(NULL, "cam_isp_core_1.2v"); if (IS_ERR(regulator)) return -ENODEV; ret = regulator_enable(regulator); CAM_CHECK_ERR_RET(ret, "enable cam_isp_core_1.2v"); mdelay(2); /* 1ms */ /* CAM_ISP_CORE_1.2V DISABLE */ ret = regulator_force_disable(regulator); regulator_put(regulator); CAM_CHECK_ERR_RET(ret, "disable cam_isp_core_1.2v"); /* VT_CAM_nSTBY(1.3M EN) EN */ ret = gpio_direction_output(GPIO_VT_CAM_nSTBY, 1); CAM_CHECK_ERR_RET(ret, "high VT_CAM_nSTBY"); /* MCLK */ ret = s3c_gpio_cfgpin(GPIO_CAM_MCLK, S3C_GPIO_SFN(2)); CAM_CHECK_ERR_RET(ret, "cfg mclk"); s3c_gpio_setpull(GPIO_CAM_MCLK, S3C_GPIO_PULL_NONE); mdelay(1); /* 20us */ /* CAM_VT_nRST(1.3M RESET) EN */ ret = gpio_direction_output(GPIO_CAM_VT_nRST, 1); CAM_CHECK_ERR_RET(ret, "high CAM_VT_nRST"); mdelay(5); /* 70000 cycle */ gpio_free(GPIO_5M_CAM_nSTBY); gpio_free(GPIO_5M_CAM_RESET); gpio_free(GPIO_VT_CAM_nSTBY); gpio_free(GPIO_CAM_VT_nRST); gpio_free(GPIO_VT_CAM_ID); return ret; }
static int s5k4ecgx_power_on(void) { struct regulator *regulator; int ret = 0; pr_debug("%s: in", __func__); s5k4ecgx_gpio_request(); /* CAM_SENSOR_IO_1.8V */ regulator = regulator_get(NULL, "cam_sensor_io_1.8v"); if (IS_ERR(regulator)) return -ENODEV; ret = regulator_enable(regulator); regulator_put(regulator); CAM_CHECK_ERR_RET(ret, "enable cam_sensor_io_1.8v"); /* CAM_SENSOR_A2.8V */ regulator = regulator_get(NULL, "cam_sensor_a2.8v"); if (IS_ERR(regulator)) return -ENODEV; ret = regulator_enable(regulator); regulator_put(regulator); CAM_CHECK_ERR_RET(ret, "enable cam_sensor_a2.8v"); /* CAM_DVDD_1.5V(1.3M Core 1.8V) */ regulator = regulator_get(NULL, "cam_dvdd_1.5v"); if (IS_ERR(regulator)) return -ENODEV; ret = regulator_enable(regulator); regulator_put(regulator); CAM_CHECK_ERR_RET(ret, "enable cam_dvdd_1.5v"); /* MCLK */ ret = s3c_gpio_cfgpin(GPIO_CAM_MCLK, S3C_GPIO_SFN(2)); CAM_CHECK_ERR_RET(ret, "cfg mclk"); s3c_gpio_setpull(GPIO_CAM_MCLK, S3C_GPIO_PULL_NONE); /* CAM_ISP_CORE_1.2V */ regulator = regulator_get(NULL, "cam_isp_core_1.2v"); if (IS_ERR(regulator)) return -ENODEV; ret = regulator_enable(regulator); regulator_put(regulator); CAM_CHECK_ERR_RET(ret, "enable cam_isp_core_1.2v"); /* VT_CAM_nSTBY(1.3M EN) LOW */ ret = gpio_request(GPIO_VT_CAM_nSTBY, "GPM0"); if (ret) { pr_err("faile to request gpio(GPIO_VT_CAM_nSTBY)"); return ret; } ret = gpio_direction_output(GPIO_VT_CAM_nSTBY, 0); CAM_CHECK_ERR_RET(ret, "low VT_CAM_nSTBY"); /* CAM_VT_nRST(1.3M RESET) LOW */ ret = gpio_request(GPIO_CAM_VT_nRST, "GPM1"); if (ret) { pr_err("faile to request gpio(GPIO_CAM_VT_nRST)"); return ret; } ret = gpio_direction_output(GPIO_CAM_VT_nRST, 0); CAM_CHECK_ERR_RET(ret, "low CAM_VT_nRST"); /* CAM_AF_2.8V */ regulator = regulator_get(NULL, "cam_af_2.8v"); if (IS_ERR(regulator)) return -ENODEV; ret = regulator_enable(regulator); regulator_put(regulator); CAM_CHECK_ERR_RET(ret, "enable cam_af_2.8v"); mdelay(1); /* 10us */ /* 5M_CAM_nSTBY(5M STBY) */ ret = gpio_direction_output(GPIO_5M_CAM_nSTBY, 1); CAM_CHECK_ERR_RET(ret, "high 5M_CAM_nSTBY"); mdelay(1); /* 15us */ /* 5M_CAM_RESET(5M RESET) */ ret = gpio_direction_output(GPIO_5M_CAM_RESET, 1); CAM_CHECK_ERR_RET(ret, "high 5M_CAM_RESET"); mdelay(1); /* 60us */ gpio_free(GPIO_VT_CAM_nSTBY); gpio_free(GPIO_CAM_VT_nRST); gpio_free(GPIO_5M_CAM_nSTBY); gpio_free(GPIO_5M_CAM_RESET); return ret; }
static int __init s5p_cec_probe(struct platform_device *pdev) { u8 *buffer; int irq_num; int ret = 0; s3c_gpio_cfgpin(S5PV210_GPH1(4), S3C_GPIO_SFN(0x4)); s3c_gpio_setpull(S5PV210_GPH1(4), S3C_GPIO_PULL_NONE); /* get ioremap addr */ ret = s5p_cec_probe_core(pdev); if (ret != 0) { pr_err("%s::s5p_cec_probe_core() fail\n", __func__); goto err_s5p_cec_probe_core; } if (misc_register(&cec_misc_device)) { pr_err("%s::Couldn't register device 10, %d.\n", __func__, CEC_MINOR); ret = -EBUSY; goto err_misc_reg; } irq_num = platform_get_irq(pdev, 0); if (irq_num < 0) { pr_err("%s::failed to get %s irq resource\n", __func__, "cec"); ret = -ENOENT; goto err_req_fw; } ret = request_irq(irq_num, s5p_cec_irq_handler, IRQF_DISABLED, pdev->name, &pdev->id); if (ret != 0) { pr_err("%s::failed to install %s irq (%d)\n", __func__, "cec", ret); goto err_req_fw; } init_waitqueue_head(&g_cec_rx_struct.waitq); spin_lock_init(&g_cec_rx_struct.lock); init_waitqueue_head(&g_cec_tx_struct.waitq); buffer = kmalloc(CEC_TX_BUFF_SIZE, GFP_KERNEL); if (!buffer) { pr_err("%s::kmalloc(CEC_TX_BUFF_SIZE %d) failed!\n", __func__, CEC_TX_BUFF_SIZE); ret = -EIO; goto err_kmalloc; } g_cec_rx_struct.buffer = buffer; g_cec_rx_struct.size = 0; return 0; err_kmalloc: free_irq(irq_num, NULL); err_req_fw: misc_deregister(&cec_misc_device); err_misc_reg: s5p_cec_release_core(pdev); err_s5p_cec_probe_core: return ret; }
void s3c_i2c5_cfg_gpio(struct platform_device *dev) { s3c_gpio_cfgall_range(EXYNOS4_GPB(6), 2, S3C_GPIO_SFN(3), S3C_GPIO_PULL_NONE);//S3C_GPIO_PULL_UP }
#include <linux/gpio.h> #include <plat/iic.h> #include <plat/gpio-cfg.h> #include <plat/cpu.h> void s3c_i2c0_cfg_gpio(struct platform_device *dev) { <<<<<<< HEAD ======= <<<<<<< HEAD >>>>>>> ae1773bb70f3d7cf73324ce8fba787e01d8fa9f2 if (soc_is_exynos5250()) /* will be implemented with gpio function */ return; s3c_gpio_cfgall_range(EXYNOS4_GPD1(0), 2, S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); <<<<<<< HEAD ======= ======= if (soc_is_exynos5210() || soc_is_exynos5250()) s3c_gpio_cfgall_range(EXYNOS5_GPB3(0), 2, S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); else s3c_gpio_cfgall_range(EXYNOS4_GPD1(0), 2, S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); >>>>>>> 58a75b6a81be54a8b491263ca1af243e9d8617b9 >>>>>>> ae1773bb70f3d7cf73324ce8fba787e01d8fa9f2 }
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 int smartq_bl_init(struct device *dev) { s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_SFN(2)); return 0; }
/* 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); set_irq_type(GPIO_nINT_ONEDRAM_AP, IRQ_TYPE_LEVEL_LOW); }
void __init p4_tsp_init(u32 system_rev) { int gpio = 0, irq = 0; hw_rev = system_rev; printk(KERN_DEBUG "[TSP] %s rev : %u\n", __func__, hw_rev); printk(KERN_DEBUG "[TSP] TSP IC : %s\n", (5 <= hw_rev) ? "Atmel" : "Synaptics"); gpio = GPIO_TSP_RST; gpio_request(gpio, "TSP_RST"); gpio_direction_output(gpio, 1); gpio_export(gpio, 0); gpio = GPIO_TSP_LDO_ON; gpio_request(gpio, "TSP_LDO_ON"); gpio_direction_output(gpio, 1); gpio_export(gpio, 0); if (5 <= hw_rev) { gpio = GPIO_TSP_LDO_ON1; gpio_request(gpio, "TSP_LDO_ON1"); gpio_direction_output(gpio, 1); gpio_export(gpio, 0); gpio = GPIO_TSP_LDO_ON2; gpio_request(gpio, "TSP_LDO_ON2"); gpio_direction_output(gpio, 1); gpio_export(gpio, 0); switch_config(hw_rev); } else if (1 <= hw_rev) have_tsp_ldo = true; gpio = GPIO_TSP_INT; gpio_request(gpio, "TSP_INT"); s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); s5p_register_gpio_interrupt(gpio); irq = gpio_to_irq(gpio); #ifdef CONFIG_S3C_DEV_I2C3 s3c_i2c3_set_platdata(NULL); #if defined(CONFIG_TOUCHSCREEN_ATMEL_MXT1664S) && \ defined(CONFIG_TOUCHSCREEN_SYNAPTICS_S7301) if (5 <= system_rev) { i2c_mxt1664s[0].irq = irq; i2c_register_board_info(3, i2c_mxt1664s, ARRAY_SIZE(i2c_mxt1664s)); } else { i2c_synaptics[0].irq = irq; i2c_register_board_info(3, i2c_synaptics, ARRAY_SIZE(i2c_synaptics)); } #endif #endif /* CONFIG_S3C_DEV_I2C3 */ }
int s3c64xx_spi1_cfg_gpio(void) { s3c_gpio_cfgall_range(S5PC100_GPB(4), 3, S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); return 0; }
int s3c64xx_spi1_cfg_gpio(struct platform_device *dev) { s3c_gpio_cfgall_range(S5PC100_GPB(4), 3, S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); return 0; }