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"); }
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 int bluetooth_set_power(void *data, enum rfkill_user_states state) { int ret = 0; int irq; /* BT Host Wake IRQ */ irq = IRQ_BT_HOST_WAKE; switch (state) { case RFKILL_USER_STATE_UNBLOCKED: pr_debug("[BT] Device Powering ON\n"); bt_config_gpio_table(ARRAY_SIZE(bt_uart_on_table), bt_uart_on_table); /* CSR8811 Project(Alan.Ko) 2011.07.02 */ #if 0 if (gpio_is_valid(GPIO_BT_EN)) gpio_direction_output(GPIO_BT_EN, GPIO_LEVEL_HIGH); #endif /* CSR8811 Project(Alan.Ko) End */ if (gpio_is_valid(GPIO_BT_nRST)) gpio_direction_output(GPIO_BT_nRST, GPIO_LEVEL_LOW); pr_debug("[BT] GPIO_BT_nRST = %d\n", gpio_get_value(GPIO_BT_nRST)); /* CSR8811 Project(Alan.Ko) 2011.07.02 */ #if 0 /* Set GPIO_BT_WLAN_REG_ON high */ s3c_gpio_setpull(GPIO_BT_EN, S3C_GPIO_PULL_NONE); gpio_set_value(GPIO_BT_EN, GPIO_LEVEL_HIGH); s3c_gpio_slp_cfgpin(GPIO_BT_EN, S3C_GPIO_SLP_OUT1); s3c_gpio_slp_setpull_updown(GPIO_BT_EN, S3C_GPIO_PULL_NONE); pr_debug("[BT] GPIO_BT_EN = %d\n", gpio_get_value(GPIO_BT_EN)); #endif /* CSR8811 Project(Alan.Ko) End */ /* * FIXME sleep should be enabled disabled since the device is * not booting if its enabled */ /* * 100msec, delay between reg_on & rst. * (bcm4329 powerup sequence) */ //msleep(100); /* Set GPIO_BT_nRST high */ s3c_gpio_setpull(GPIO_BT_nRST, S3C_GPIO_PULL_NONE); gpio_set_value(GPIO_BT_nRST, GPIO_LEVEL_HIGH); s3c_gpio_slp_cfgpin(GPIO_BT_nRST, S3C_GPIO_SLP_OUT1); s3c_gpio_slp_setpull_updown(GPIO_BT_nRST, S3C_GPIO_PULL_NONE); pr_debug("[BT] GPIO_BT_nRST = %d\n", gpio_get_value(GPIO_BT_nRST)); /* * 50msec, delay after bt rst * (bcm4329 powerup sequence) */ msleep(50); ret = enable_irq_wake(irq); if (ret < 0) pr_err("[BT] set wakeup src failed\n"); enable_irq(irq); break; case RFKILL_USER_STATE_SOFT_BLOCKED: pr_debug("[BT] Device Powering OFF\n"); bt_is_running = 0; ret = disable_irq_wake(irq); if (ret < 0) pr_err("[BT] unset wakeup src failed\n"); disable_irq(irq); wake_unlock(&rfkill_wake_lock); s3c_gpio_setpull(GPIO_BT_nRST, S3C_GPIO_PULL_NONE); gpio_set_value(GPIO_BT_nRST, GPIO_LEVEL_LOW); s3c_gpio_slp_cfgpin(GPIO_BT_nRST, S3C_GPIO_SLP_OUT0); s3c_gpio_slp_setpull_updown(GPIO_BT_nRST, S3C_GPIO_PULL_NONE); pr_debug("[BT] GPIO_BT_nRST = %d\n", gpio_get_value(GPIO_BT_nRST)); /* CSR8811 Project(Alan.Ko) 2011.07.02 */ #if 0 s3c_gpio_setpull(GPIO_BT_EN, S3C_GPIO_PULL_NONE); gpio_set_value(GPIO_BT_EN, GPIO_LEVEL_LOW); s3c_gpio_slp_cfgpin(GPIO_BT_EN, S3C_GPIO_SLP_OUT0); s3c_gpio_slp_setpull_updown(GPIO_BT_EN, S3C_GPIO_PULL_NONE); pr_debug("[BT] GPIO_BT_EN = %d\n", gpio_get_value(GPIO_BT_EN)); #endif /* CSR8811 Project(Alan.Ko) End */ break; default: pr_err("[BT] Bad bluetooth rfkill state %d\n", state); } return 0; }
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_ARIES_NTT) unsigned gpio_flm_sel = mdmctl_data.gpio_flm_sel; unsigned gpio_usim_boot = mdmctl_data.gpio_usim_boot; 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_ARIES_NTT) 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); } 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); } #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 wacom_init(void) { int gpio; int ret; #ifdef GPIO_PEN_RESET_N_18V /*Reset*/ gpio = GPIO_PEN_RESET_N_18V; ret = gpio_request(gpio, "PEN_RESET_N"); if (ret) { printk(KERN_ERR "epen:failed to request PEN_RESET_N.(%d)\n", ret); return ; } s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0x1)); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); gpio_direction_output(gpio, 0); #endif /*SLP & FWE1*/ gpio = GPIO_PEN_FWE1_18V; ret = gpio_request(gpio, "PEN_FWE1"); if (ret) { printk(KERN_ERR "epen:failed to request PEN_FWE1.(%d)\n", ret); return ; } s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0x1)); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); gpio_direction_output(gpio, 0); /*PDCT*/ gpio = GPIO_PEN_PDCT_18V; ret = gpio_request(gpio, "PEN_PDCT"); if (ret) { printk(KERN_ERR "epen:failed to request PEN_PDCT.(%d)\n", ret); return ; } s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_register_gpio_interrupt(gpio); gpio_direction_input(gpio); irq_set_irq_type(gpio_to_irq(gpio), IRQ_TYPE_EDGE_BOTH); /*IRQ*/ gpio = GPIO_PEN_IRQ_18V; ret = gpio_request(gpio, "PEN_IRQ"); if (ret) { printk(KERN_ERR "epen:failed to request PEN_IRQ.(%d)\n", ret); return ; } s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); s5p_register_gpio_interrupt(gpio); gpio_direction_input(gpio); wacom_i2c_devs[0].irq = gpio_to_irq(gpio); irq_set_irq_type(wacom_i2c_devs[0].irq, IRQ_TYPE_EDGE_RISING); s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); /*LDO_EN*/ #ifdef GPIO_PEN_LDO_EN gpio = GPIO_PEN_LDO_EN; ret = gpio_request(gpio, "PEN_LDO_EN"); if (ret) { printk(KERN_ERR "epen:failed to request PEN_LDO_EN.(%d)\n", ret); return ; } s3c_gpio_cfgpin(gpio, S3C_GPIO_OUTPUT); gpio_direction_output(gpio, 0); #else wacom_power(0); #endif /*WACOM_SET_I2C(3, NULL, wacom_i2c_devs);*/ exynos5_hs_i2c4_set_platdata(NULL); i2c_register_board_info(8, wacom_i2c_devs, ARRAY_SIZE(wacom_i2c_devs)); printk(KERN_INFO "epen:: wacom IC initialized.\n"); }
/** * sdhci_s3c_cfg_wp - configure GPIO for WP pin * @gpio_num: GPIO number which connected with WP line from SD/MMC slot * * Configure GPIO for using WP line */ static void sdhci_s3c_cfg_wp(unsigned int gpio_num) { s3c_gpio_cfgpin(gpio_num, S3C_GPIO_INPUT); s3c_gpio_setpull(gpio_num, S3C_GPIO_PULL_UP); }
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); }
/* add by cym 20121121 */ static int sr200pc20_power(int flag) { int err; printk("cym: sensor is power %s\n",flag == 1 ?"on":"off"); //Attention: Power On the all the camera module when system turn on //Here only control the reset&&powerdown pin /* Camera A */ if(flag == 1) { //poweron // for TC4 zhuxuezhen //poweron #ifndef CONFIG_TC4_EVT regulator_enable(vdd18_cam_regulator); udelay(10); regulator_enable(vdd28_cam_regulator); udelay(10); regulator_enable(VDD28_AF); udelay(10); regulator_enable(VDD28_CAM); udelay(10); regulator_enable(VDD18_CAM); udelay(10); #endif err = gpio_request(EXYNOS4_GPL0(3), "GPL0_3"); if (err) printk(KERN_ERR "#### failed to request GPL0_3 ####\n"); s3c_gpio_setpull(EXYNOS4_GPL0(3), S3C_GPIO_PULL_NONE); gpio_direction_output(EXYNOS4_GPL0(3), 0); gpio_free(EXYNOS4_GPL0(3)); //VDD //PMIC_Control_Set(PMIC_CONTROL_VDD18_CAM,POWERON); //reset err = gpio_request(EXYNOS4_GPL0(1), "GPL0_1"); if (err) printk(KERN_ERR "#### failed to request GPL0_1 ####\n"); s3c_gpio_setpull(EXYNOS4_GPL0(1), S3C_GPIO_PULL_NONE); gpio_direction_output(EXYNOS4_GPL0(1), 1); msleep(5); gpio_direction_output(EXYNOS4_GPL0(1), 0); msleep(5); gpio_direction_output(EXYNOS4_GPL0(1), 1); gpio_free(EXYNOS4_GPL0(1)); msleep(1); //VDD_PLL //PMIC_Control_Set(PMIC_CONTROL_VDD28_CAM,POWERON); } else { // for TC4 zhuxuezhen //PMIC_Control_Set(PMIC_CONTROL_VDD28_CAM,POWEROFF); err = gpio_request(EXYNOS4_GPL0(1), "GPL0_1"); if (err) printk(KERN_ERR "#### failed to request GPL0_1 ####\n"); s3c_gpio_setpull(EXYNOS4_GPL0(1), S3C_GPIO_PULL_NONE); gpio_direction_output(EXYNOS4_GPL0(1), 0); gpio_free(EXYNOS4_GPL0(1)); //powerdown err = gpio_request(EXYNOS4_GPL0(3), "GPL0_3"); if (err) printk(KERN_ERR "#### failed to request GPL0_3 ####\n"); s3c_gpio_setpull(EXYNOS4_GPL0(3), S3C_GPIO_PULL_NONE); gpio_direction_output(EXYNOS4_GPL0(3), 1); gpio_free(EXYNOS4_GPL0(3)); #ifndef CONFIG_TC4_EVT regulator_disable(vdd18_cam_regulator); udelay(10); regulator_disable(vdd28_cam_regulator); udelay(10); regulator_disable(VDD28_AF); udelay(10); regulator_disable(VDD28_CAM); udelay(10); regulator_disable(VDD18_CAM); udelay(10); #endif //PMIC_Control_Set(PMIC_CONTROL_VDD18_CAM,POWEROFF); } return 0; }
static int fpga_open(struct inode *inode, struct file *file) { int r = 0; unsigned n; unsigned long timeout; pr_info("%s:\n", __func__); mutex_lock(&fpga_mutex); if (fpga_open_count) { mutex_unlock(&fpga_mutex); return -EBUSY; } fpga_open_count++; for (n = 0; n < ARRAY_SIZE(fpga_pins); n++) { r = gpio_request(fpga_pins[n].pin, fpga_pins[n].name); if (r) { pr_warning("%s: failed to allocate gpio %s (%u)\n", __func__, fpga_pins[n].name, fpga_pins[n].pin); } else fpga_pin_requested[n] = 1; } s3c_gpio_setpull(FPGA_INIT_B, S3C_GPIO_PULL_UP); s3c_gpio_setpull(FPGA_DONE, S3C_GPIO_PULL_UP); s3c_gpio_setpull(FPGA_DIN, S3C_GPIO_PULL_UP); gpio_direction_output(FPGA_PROG_B, 0); gpio_direction_input(FPGA_INIT_B); gpio_direction_input(FPGA_DONE); gpio_direction_output(FPGA_CCLK, 0); gpio_direction_output(FPGA_DIN, 1); msleep(1); printk("INIT_B %u\n", gpio_get_value(FPGA_INIT_B)); gpio_set_value(FPGA_PROG_B, 1); printk("INIT_B %u\n", gpio_get_value(FPGA_INIT_B)); timeout = jiffies + HZ; while (!gpio_get_value(FPGA_INIT_B)) { if (time_after(jiffies, timeout)) { pr_err("%s: timeout waiting for INIT_B to go high\n", __func__); r = -ETIMEDOUT; goto err; } msleep(1); } printk("INIT_B %u\n", gpio_get_value(FPGA_INIT_B)); printk("DONE %u\n", gpio_get_value(FPGA_DONE)); msleep(1); mutex_unlock(&fpga_mutex); return 0; err: for (n = 0; n < ARRAY_SIZE(fpga_pins); n++) { if (fpga_pin_requested[n]) { gpio_free(fpga_pins[n].pin); fpga_pin_requested[n] = 0; } } fpga_open_count--; mutex_unlock(&fpga_mutex); return r; }
void smm6260_cfg(void) { static int smm6260_initialed=0; int err = 0; if(smm6260_initialed) return; /*TODO: check uart init func AP FLM BOOT RX -- */ //printk("\n---%s()Start\n",__FUNCTION__); // USB_SEL err = gpio_request(EXYNOS4_GPK3(2), "USB_SEL"); if(err){ printk(KERN_ERR "fail to request gpio %s\n", "USB_SEL"); }else{ gpio_direction_output(EXYNOS4_GPK3(2), 0); s3c_gpio_setpull(EXYNOS4_GPK3(2), S3C_GPIO_PULL_NONE); gpio_free(EXYNOS4_GPK3(2)); } msleep(100); // Reset_BB err = gpio_request(GPIO_CP_RST, "CP_RST"); if (err) { printk(KERN_ERR "fail to request gpio %s\n", "CP_RST"); } else { gpio_direction_output(GPIO_CP_RST, 0); s3c_gpio_cfgpin(GPIO_CP_RST, S3C_GPIO_INPUT); s3c_gpio_setpull(GPIO_CP_RST, S3C_GPIO_PULL_NONE); gpio_free(GPIO_CP_RST); } // ResetN err = gpio_request(GPIO_CP_PMU_RST, "CP_PMU_RST"); if (err) { printk(KERN_ERR "fail to request gpio %s\n", "CP_PMU_RST"); } else { gpio_direction_output(GPIO_CP_PMU_RST, 1); s3c_gpio_setpull(GPIO_CP_PMU_RST, S3C_GPIO_PULL_NONE); //gpio_free(GPIO_CP_PMU_RST); } msleep(100); err = gpio_request(GPIO_PHONE_ON, "PHONE_ON"); if (err) { printk(KERN_ERR "fail to request gpio %s\n", "PHONE_ON"); } else { gpio_direction_output(GPIO_PHONE_ON, 0);//zkx@cellon modify for ON1/2 compatible gpio_direction_output(GPIO_PHONE_ON, 0); s3c_gpio_setpull(GPIO_PHONE_ON, S3C_GPIO_PULL_NONE); gpio_free(GPIO_PHONE_ON); } msleep(100); #if 0 err = gpio_request(GPIO_PHONE_ON, "PHONE_ON"); if (err) { printk(KERN_ERR "fail to request gpio %s\n", "PHONE_ON"); } else { gpio_direction_output(GPIO_PHONE_ON, 0); s3c_gpio_setpull(GPIO_PHONE_ON, S3C_GPIO_PULL_NONE); gpio_free(GPIO_PHONE_ON); } #endif udelay(80); err = gpio_request(GPIO_IPC_SLAVE_WAKEUP, "IPC_SLAVE_WAKEUP"); if (err) { printk(KERN_ERR "fail to request gpio %s\n", "IPC_SLAVE_WAKEUP"); } else { gpio_direction_output(GPIO_IPC_SLAVE_WAKEUP, 0); s3c_gpio_setpull(GPIO_IPC_SLAVE_WAKEUP, S3C_GPIO_PULL_NONE); gpio_free(GPIO_IPC_SLAVE_WAKEUP); } err = gpio_request(GPIO_IPC_HOST_WAKEUP, "IPC_HOST_WAKEUP"); if (err) { printk(KERN_ERR "fail to request gpio %s\n", "IPC_HOST_WAKEUP"); } else { gpio_direction_output(GPIO_IPC_HOST_WAKEUP, 0); s3c_gpio_cfgpin(GPIO_IPC_HOST_WAKEUP, S3C_GPIO_INPUT); s3c_gpio_setpull(GPIO_IPC_HOST_WAKEUP, S3C_GPIO_PULL_NONE); gpio_free(GPIO_IPC_HOST_WAKEUP); } err = gpio_request(GPIO_SUSPEND_REQUEST, "IPC_SUSPEND_REQUEST"); if (err) { printk(KERN_ERR "fail to request gpio %s\n", "IPC_SUSPEND_REQUEST"); } else { gpio_direction_output(GPIO_SUSPEND_REQUEST, 0); s3c_gpio_cfgpin(GPIO_SUSPEND_REQUEST, S3C_GPIO_INPUT); s3c_gpio_setpull(GPIO_SUSPEND_REQUEST, S3C_GPIO_PULL_NONE); gpio_free(GPIO_SUSPEND_REQUEST); } err = gpio_request(GPIO_ACTIVE_STATE, "ACTIVE_STATE"); if (err) { printk(KERN_ERR "fail to request gpio %s\n", "ACTIVE_STATE"); } else { gpio_direction_output(GPIO_ACTIVE_STATE, 0); s3c_gpio_setpull(GPIO_ACTIVE_STATE, S3C_GPIO_PULL_NONE); gpio_free(GPIO_ACTIVE_STATE); } // shengliang, this need to be checked. #if 0 err = gpio_request(GPIO_CP_RESET_REPORT, "CP_RESET_REPORT"); if (err) { printk(KERN_ERR "fail to request gpio %s\n", "CP_RESET_REPORT"); } else { gpio_direction_output(GPIO_CP_RESET_REPORT, 0); s3c_gpio_cfgpin(GPIO_CP_RESET_REPORT, S3C_GPIO_INPUT); s3c_gpio_setpull(GPIO_CP_RESET_REPORT, S3C_GPIO_PULL_NONE); gpio_free(GPIO_CP_RESET_REPORT); } #endif //mask by cellon justy.yang 20121031 for don't user GPIO EXYNOS4_GPL2(6) #if 0 err = gpio_request(GPIO_XUJIE_MONITOR, "XUJIE_MONITOR"); if (err) { printk(KERN_ERR "fail to request gpio %s\n", "XUJIE_MONITOR"); } else { gpio_direction_output(GPIO_XUJIE_MONITOR, 0); s3c_gpio_setpull(GPIO_XUJIE_MONITOR, S3C_GPIO_PULL_NONE); gpio_free(GPIO_XUJIE_MONITOR); } #endif smm6260_initialed = 1; //printk("\n---%s(): finish\n",__FUNCTION__); }
static int s6evr01_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, &s6evr01_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, &s6evr01_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); s6evr01_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 = s6evr01_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 = s6evr01_early_suspend; lcd_late_resume = s6evr01_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; }
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"); if (5 <= hw_rev) { gpio = GPIO_TSP_LDO_ON2; gpio_request(gpio, "TSP_LDO_ON2"); gpio_direction_output(gpio, 0); gpio_export(gpio, 0); gpio = GPIO_TSP_LDO_ON1; gpio_request(gpio, "TSP_LDO_ON1"); gpio_direction_output(gpio, 0); gpio_export(gpio, 0); gpio = GPIO_TSP_LDO_ON; gpio_request(gpio, "TSP_LDO_ON"); gpio_direction_output(gpio, 0); gpio_export(gpio, 0); gpio = GPIO_TSP_RST; gpio_request(gpio, "TSP_RST"); gpio_direction_output(gpio, 0); gpio_export(gpio, 0); switch_config(hw_rev); } else { 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 (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 */ }
void EXT_LED_Init(void){ //GPB_0,1,4,5,6,7 : Output //Outp32(GPBCON,(Inp32(GPBCON) &= (~0xFFFF00FF))); //Outp32(GPBCON,(Inp32(GPBCON) |= 0x11110011)); //GPB_0,1,4,5,6,7 : Pull-up //Outp32(GPBPUD,(Inp32(GPBPUD) &= (~0x0000FF0F))); //Outp32(GPBPUD,(Inp32(GPBPUD) |= 0x0000AA0A)); s3c_gpio_cfgpin(LED_D0, S3C_GPIO_SFN(MODE_OUT)); s3c_gpio_setpull(LED_D0, S3C_GPIO_PULL_NONE); s3c_gpio_cfgpin(LED_D1, S3C_GPIO_SFN(MODE_OUT)); s3c_gpio_setpull(LED_D1, S3C_GPIO_PULL_NONE); s3c_gpio_cfgpin(LED_D2, S3C_GPIO_SFN(MODE_OUT)); s3c_gpio_setpull(LED_D2, S3C_GPIO_PULL_NONE); s3c_gpio_cfgpin(LED_D3, S3C_GPIO_SFN(MODE_OUT)); s3c_gpio_setpull(LED_D3, S3C_GPIO_PULL_NONE); s3c_gpio_cfgpin(LED_C0, S3C_GPIO_SFN(MODE_OUT)); s3c_gpio_setpull(LED_C0, S3C_GPIO_PULL_NONE); //GPA0_2 : Output //Outp32(GPA0CON,(Inp32(GPA0CON) &= (~0x00000F00))); //Outp32(GPA0CON,(Inp32(GPA0CON) |= 0x00000100 )); //GPA0_2 : Pull-up //Outp32(GPA0PUD,(Inp32(GPA0PUD) &= (~0x00000030))); //Outp32(GPA0PUD,(Inp32(GPA0PUD) |= 0x00000020)); s3c_gpio_cfgpin(LED_C1, S3C_GPIO_SFN(MODE_OUT)); s3c_gpio_setpull(LED_C1, S3C_GPIO_PULL_NONE); //GPB_4,5,6,7 : 0 -> 1 //Outp32(GPBDAT,(Inp32(GPBDAT) &= (~0x000000F0))); //Outp32(GPBDAT,(Inp32(GPBDAT) |= 0x000000F0)); s3c_gpio_setpin(LED_D0, 1); s3c_gpio_setpin(LED_D1, 1); s3c_gpio_setpin(LED_D2, 1); s3c_gpio_setpin(LED_D3, 1); #if 1 //GPB_1 : 0 -> 1 -> 0 //Outp32(GPBDAT,(Inp32(GPBDAT) &= (~0x00000002))); //Outp32(GPBDAT,(Inp32(GPBDAT) |= (0x00000002))); //Outp32(GPBDAT,(Inp32(GPBDAT) &= (~0x00000002))); s3c_gpio_setpin(LED_C0, 0); s3c_gpio_setpin(LED_C0, 1); s3c_gpio_setpin(LED_C0, 0); //GPA0_2 : 0 -> 1 -> 0 //Outp32(GPA0DAT,(Inp32(GPBDAT) &= (~0x00000004))); //Outp32(GPA0DAT,(Inp32(GPBDAT) |= (0x00000004))); //Outp32(GPA0DAT,(Inp32(GPBDAT) &= (~0x00000004))); s3c_gpio_setpin(LED_C1, 0); s3c_gpio_setpin(LED_C1, 1); s3c_gpio_setpin(LED_C1, 0); #endif #if 1 //GPB_0 : 1 //Outp32(GPBDAT,(Inp32(GPBDAT) |= 0x00000001)); s3c_gpio_setpin(KEY_CTL, 1); #endif }
static void __init __maybe_unused smdk5410_drd1_init(void) { /* Initialize DRD1 gpio */ if (gpio_request(EXYNOS5410_GPK2(4), "UDRD3_1_OVERCUR_U2")) { pr_err("failed to request UDRD3_1_OVERCUR_U2\n"); } else { s3c_gpio_cfgpin(EXYNOS5410_GPK2(4), (0x2 << 16)); s3c_gpio_setpull(EXYNOS5410_GPK2(4), S3C_GPIO_PULL_NONE); gpio_free(EXYNOS5410_GPK2(4)); } if (gpio_request(EXYNOS5410_GPK2(5), "UDRD3_1_OVERCUR_U3")) { pr_err("failed to request UDRD3_1_OVERCUR_U3\n"); } else { s3c_gpio_cfgpin(EXYNOS5410_GPK2(5), (0x2 << 20)); s3c_gpio_setpull(EXYNOS5410_GPK2(5), S3C_GPIO_PULL_NONE); gpio_free(EXYNOS5410_GPK2(5)); } if (gpio_request_one(EXYNOS5410_GPK2(6), GPIOF_OUT_INIT_LOW, "UDRD3_1_VBUSCTRL_U2")) { pr_err("failed to request UDRD3_1_VBUSCTRL_U2\n"); } else { s3c_gpio_setpull(EXYNOS5410_GPK2(6), S3C_GPIO_PULL_NONE); gpio_free(EXYNOS5410_GPK2(6)); } if (gpio_request_one(EXYNOS5410_GPK2(7), GPIOF_OUT_INIT_LOW, "UDRD3_1_VBUSCTRL_U3")) { pr_err("failed to request UDRD3_1_VBUSCTRL_U3\n"); } else { s3c_gpio_setpull(EXYNOS5410_GPK2(7), S3C_GPIO_PULL_NONE); gpio_free(EXYNOS5410_GPK2(7)); } #if defined(CONFIG_USB_EXYNOS5_USB3_DRD_CH1) if (gpio_request_one(SMDK5410_ID1_GPIO, GPIOF_IN, "UDRD3_1_ID")) { pr_err("failed to request UDRD3_1_ID\n"); smdk5410_drd_pdata.id_irq = -1; } else { s3c_gpio_cfgpin(SMDK5410_ID1_GPIO, S3C_GPIO_SFN(0xF)); s3c_gpio_setpull(SMDK5410_ID1_GPIO, S3C_GPIO_PULL_NONE); gpio_free(SMDK5410_ID1_GPIO); smdk5410_drd_pdata.id_irq = gpio_to_irq(SMDK5410_ID1_GPIO); } if (gpio_request_one(SMDK5410_VBUS1_GPIO, GPIOF_IN, "UDRD3_1_VBUS")) { pr_err("failed to request UDRD3_1_VBUS\n"); smdk5410_drd_pdata.vbus_irq = -1; } else { s3c_gpio_cfgpin(SMDK5410_VBUS1_GPIO, S3C_GPIO_SFN(0xF)); s3c_gpio_setpull(SMDK5410_VBUS1_GPIO, S3C_GPIO_PULL_NONE); gpio_free(SMDK5410_VBUS1_GPIO); smdk5410_drd_pdata.vbus_irq = gpio_to_irq(SMDK5410_VBUS1_GPIO); } smdk5410_drd_pdata.quirks = 0; #if !defined(CONFIG_USB_XHCI_EXYNOS) smdk5410_drd_pdata.quirks |= FORCE_RUN_PERIPHERAL; #endif #else smdk5410_drd_pdata.id_irq = -1; smdk5410_drd_pdata.vbus_irq = -1; smdk5410_drd_pdata.quirks = DUMMY_DRD; #endif exynos5_usb3_drd1_set_platdata(&smdk5410_drd_pdata); }
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 void universal5410_gpio_keys_config_setup(void) { s3c_gpio_setpull(EXYNOS5410_GPX0(2), S3C_GPIO_PULL_UP); s3c_gpio_setpull(EXYNOS5410_GPX0(3), S3C_GPIO_PULL_UP); }
static void __init smdk5250_usbswitch_init(void) { struct s5p_usbswitch_platdata *pdata = &smdk5250_usbswitch_pdata; int err; /* USB 2.0 detect GPIO */ if (samsung_rev() < EXYNOS5250_REV_1_0) { pdata->gpio_device_detect = 0; pdata->gpio_host_vbus = 0; } else { pdata->gpio_host_detect = EXYNOS5_GPX1(6); err = gpio_request_one(pdata->gpio_host_detect, GPIOF_IN, "HOST_DETECT"); if (err) { printk(KERN_ERR "failed to request host gpio\n"); return; } s3c_gpio_cfgpin(pdata->gpio_host_detect, S3C_GPIO_SFN(0xF)); s3c_gpio_setpull(pdata->gpio_host_detect, S3C_GPIO_PULL_NONE); gpio_free(pdata->gpio_host_detect); pdata->gpio_device_detect = EXYNOS5_GPX3(4); err = gpio_request_one(pdata->gpio_device_detect, GPIOF_IN, "DEVICE_DETECT"); if (err) { printk(KERN_ERR "failed to request device gpio\n"); return; } s3c_gpio_cfgpin(pdata->gpio_device_detect, S3C_GPIO_SFN(0xF)); s3c_gpio_setpull(pdata->gpio_device_detect, S3C_GPIO_PULL_NONE); gpio_free(pdata->gpio_device_detect); pdata->gpio_host_vbus = EXYNOS5_GPX2(6); err = gpio_request_one(pdata->gpio_host_vbus, GPIOF_OUT_INIT_LOW, "HOST_VBUS_CONTROL"); if (err) { printk(KERN_ERR "failed to request host_vbus gpio\n"); return; } s3c_gpio_setpull(pdata->gpio_host_vbus, S3C_GPIO_PULL_NONE); gpio_free(pdata->gpio_host_vbus); } /* USB 3.0 DRD detect GPIO */ if (samsung_rev() < EXYNOS5250_REV_1_0) { pdata->gpio_drd_host_detect = 0; pdata->gpio_drd_device_detect = 0; } else { pdata->gpio_drd_host_detect = EXYNOS5_GPX1(7); err = gpio_request_one(pdata->gpio_drd_host_detect, GPIOF_IN, "DRD_HOST_DETECT"); if (err) { printk(KERN_ERR "failed to request drd_host gpio\n"); return; } s3c_gpio_cfgpin(pdata->gpio_drd_host_detect, S3C_GPIO_SFN(0xF)); s3c_gpio_setpull(pdata->gpio_drd_host_detect, S3C_GPIO_PULL_NONE); gpio_free(pdata->gpio_drd_host_detect); pdata->gpio_drd_device_detect = EXYNOS5_GPX0(6); err = gpio_request_one(pdata->gpio_drd_device_detect, GPIOF_IN, "DRD_DEVICE_DETECT"); if (err) { printk(KERN_ERR "failed to request drd_device\n"); return; } s3c_gpio_cfgpin(pdata->gpio_drd_device_detect, S3C_GPIO_SFN(0xF)); s3c_gpio_setpull(pdata->gpio_drd_device_detect, S3C_GPIO_PULL_NONE); gpio_free(pdata->gpio_drd_device_detect); } s5p_usbswitch_set_platdata(pdata); }
/* * s3c6410_spi_probe - probe spi driver * @pdev : platform device struct * * platform driver member function for probing */ static int s3c6410_spi_probe(struct platform_device *pdev) { struct s3c6410_spi *hw; struct spi_master *master; struct spi_board_info *bi; struct resource *res; int err = 0; int i; unsigned int spi_chcfg; master = spi_alloc_master(&pdev->dev, sizeof(struct s3c6410_spi)); if (master == NULL) { dev_err(&pdev->dev, "No memory for spi_master\n"); err = -ENOMEM; goto err_nomem; } hw = spi_master_get_devdata(master); memset(hw, 0, sizeof(struct s3c6410_spi)); hw->master = spi_master_get(master); hw->master->num_chipselect = 2; hw->pdata = pdev->dev.platform_data; hw->dev = &pdev->dev; hw->id = pdev->id; hw->bits_per_word = 16; if (hw->pdata == NULL) { dev_err(&pdev->dev, "No platform data supplied\n"); err = -ENOENT; goto err_no_pdata; } platform_set_drvdata(pdev, hw); /* setup the state for the bitbang driver */ hw->bitbang.master = hw->master; hw->bitbang.setup_transfer = s3c6410_spi_setupxfer; hw->bitbang.chipselect = s3c6410_spi_chipsel; hw->bitbang.txrx_bufs = s3c6410_spi_txrx; hw->bitbang.master->setup = s3c6410_spi_setup; init_completion(&hw->done); /* find and map our resources */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res == NULL) { dev_err(&pdev->dev, "Cannot get IORESOURCE_MEM\n"); err = -ENOENT; goto err_no_iores; } hw->ioarea = request_mem_region(res->start, (res->end - res->start)+1, pdev->name); if (hw->ioarea == NULL) { dev_err(&pdev->dev, "Cannot reserve region\n"); err = -ENXIO; goto err_no_iores; } hw->regs = ioremap(res->start, (res->end - res->start)+1); hw->regs += 0x1000 * hw->id; if (hw->regs == NULL) { dev_err(&pdev->dev, "Cannot map IO\n"); err = -ENXIO; goto err_no_iomap; } hw->irq = platform_get_irq(pdev, 0); if (hw->irq < 0) { dev_err(&pdev->dev, "No IRQ specified\n"); err = -ENOENT; goto err_no_irq; } err = request_irq(hw->irq, s3c6410_spi_irq, IRQF_DISABLED, pdev->name, hw); if (err) { dev_err(&pdev->dev, "Cannot claim IRQ\n"); goto err_no_irq; } hw->clk = clk_get(&pdev->dev, "spi"); if (IS_ERR(hw->clk)) { dev_err(&pdev->dev, "No clock for device\n"); err = PTR_ERR(hw->clk); goto err_no_clk; } printk("S3C6410 SPI Driver at 0x%x, irq %d\n", (unsigned int)hw->regs, hw->irq); /* for the moment, permanently enable the clock */ #ifdef CONFIG_SPICLK_PCLK clk_enable(hw->clk); hw->in_clk = clk_get_rate(hw->clk); #elif defined (CONFIG_SPICLK_EPLL) writel((readl(S3C_PCLK_GATE)|S3C_CLKCON_PCLK_SPI0|S3C_CLKCON_PCLK_SPI1),S3C_PCLK_GATE); writel((readl(S3C_SCLK_GATE)|S3C_CLKCON_SCLK_SPI0|S3C_CLKCON_SCLK_SPI1),S3C_SCLK_GATE); writel(readl(S3C_CLK_SRC)|S3C_CLKSRC_MPLL_CLKSEL, S3C_CLK_SRC); /* Set SPi Clock to DOUTMPLL*/ if(hw->id == 0) /* SPI_CHANNEL = 0 */ writel((readl(S3C_CLK_SRC)&~(0x3<<14))|(1<<14), S3C_CLK_SRC); else /* SPI_CHANNEL = 1 */ writel((readl(S3C_CLK_SRC)&~(0x3<<16))|(1<<16), S3C_CLK_SRC); /* CLK_DIV2 setting */ /* SPI Input Clock(88.87Mhz) = 266.66Mhz / (2 + 1)*/ writel(((readl(S3C_CLK_DIV2) & ~(0xff << 0)) | 2) , S3C_CLK_DIV2); hw->in_clk = 266660000; #elif defined (CONFIG_SPICLK_USBCLK) writel((readl(S3C_PCLK_GATE)| S3C_CLKCON_PCLK_SPI0|S3C_CLKCON_PCLK_SPI1),S3C_PCLK_GATE); writel((readl(S3C_SCLK_GATE)|S3C_CLKCON_SCLK_SPI0_48|S3C_CLKCON_SCLK_SPI1_48),S3C_SCLK_GATE); hw->in_clk = 48000000; #endif printk("SPI: Source Clock = %ldMhz\n", hw->in_clk); /* initialize the gpio */ if (hw->id == 0) { s3c_gpio_cfgpin(S3C64XX_GPC(0), S3C64XX_GPC0_SPI_MISO0); s3c_gpio_cfgpin(S3C64XX_GPC(1), S3C64XX_GPC1_SPI_CLK0); s3c_gpio_cfgpin(S3C64XX_GPC(2), S3C64XX_GPC2_SPI_MOSI0); s3c_gpio_cfgpin(S3C64XX_GPC(3), S3C64XX_GPC3_SPI_nCS0); s3c_gpio_setpull(S3C64XX_GPC(0), S3C_GPIO_PULL_UP); s3c_gpio_setpull(S3C64XX_GPC(1), S3C_GPIO_PULL_UP); s3c_gpio_setpull(S3C64XX_GPC(2), S3C_GPIO_PULL_UP); s3c_gpio_setpull(S3C64XX_GPC(3), S3C_GPIO_PULL_UP); } else { s3c_gpio_cfgpin(S3C64XX_GPC(4), S3C64XX_GPC4_SPI_MISO1); s3c_gpio_cfgpin(S3C64XX_GPC(5), S3C64XX_GPC5_SPI_CLK1); s3c_gpio_cfgpin(S3C64XX_GPC(6), S3C64XX_GPC6_SPI_MOSI1); s3c_gpio_cfgpin(S3C64XX_GPC(7), S3C64XX_GPC7_SPI_nCS1); s3c_gpio_setpull(S3C64XX_GPC(4), S3C_GPIO_PULL_UP); s3c_gpio_setpull(S3C64XX_GPC(5), S3C_GPIO_PULL_UP); s3c_gpio_setpull(S3C64XX_GPC(6), S3C_GPIO_PULL_UP); s3c_gpio_setpull(S3C64XX_GPC(7), S3C_GPIO_PULL_UP); } /* SW Reset */ writel(readl(hw->regs + S3C_CH_CFG) | SPI_CH_SW_RST, hw->regs + S3C_CH_CFG); udelay(100); writel(readl(hw->regs + S3C_CH_CFG) & (~SPI_CH_SW_RST), hw->regs + S3C_CH_CFG); udelay(100); /* disable SPI Interrupt */ writel(SPI_INT_ALL_DISABLE, hw->regs + S3C_SPI_INT_EN); /* Set transfer type (CPOL & CPHA set) */ spi_chcfg = readl(hw->regs + S3C_CH_CFG); spi_chcfg &= ~SPI_CH_HSPD_EN; spi_chcfg |= SPI_CH_FORMAT_B | SPI_CH_RISING | SPI_CH_MASTER; writel(spi_chcfg, hw->regs + S3C_CH_CFG); /* Set NSSOUT to start high after Reset */ s3c6410_spi_set_cs(hw, BITBANG_CS_INACTIVE); /* register our spi controller */ err = spi_bitbang_start(&hw->bitbang); if (err) { dev_err(&pdev->dev, "Failed to register SPI master\n"); goto err_register; } /* register all the devices associated */ bi = hw->pdata->board_info; for (i = 0; i < hw->pdata->board_size; i++, bi++) { dev_info(hw->dev, "registering %s\n", bi->modalias); bi->controller_data = hw; spi_new_device(master, bi); } /* for suspend & resume */ test_hw = hw; return 0; err_register: clk_disable(hw->clk); clk_put(hw->clk); err_no_clk: free_irq(hw->irq, hw); err_no_irq: iounmap(hw->regs); err_no_iomap: release_resource(hw->ioarea); kfree(hw->ioarea); err_no_iores: err_no_pdata: spi_master_put(hw->master);; err_nomem: return err; }
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; 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); sc->cur_clk = ptr; 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; #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; 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 SD controller's WP pin donsn't connected with SD card and there is an * allocated GPIO for getting WP data form SD card, use this quirk and send * the GPIO number in pdata->wp_gpio. */ if (pdata->has_wp_gpio && gpio_is_valid(pdata->wp_gpio)) { sdhci_s3c_ops.get_ro = sdhci_s3c_get_ro; host->quirks |= SDHCI_QUIRK_NO_WP_BIT; sdhci_s3c_cfg_wp(pdata->wp_gpio); } host->quirks |= SDHCI_QUIRK_NO_HISPD_BIT; #ifdef CONFIG_ARCH_S5PV310 host->quirks |= SDHCI_QUIRK_NONSTANDARD_CLOCK; host->quirks |= SDHCI_QUIRK_BROKEN_CLOCK_DIVIDER; #endif mmc_host_sd_set_present(host->mmc); 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; ret = sdhci_add_host(host); if (ret) { dev_err(dev, "sdhci_add_host() failed\n"); goto err_add_host; } if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT) { host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION; host->mmc->caps |= MMC_CAP_NONREMOVABLE; } /* pdata->ext_cd_init might call sdhci_s3c_notify_change immediately, so it can be called only after sdhci_add_host() */ if (pdata->cd_type == S3C_SDHCI_CD_EXTERNAL && pdata->ext_cd_init) { pdata->ext_cd_init(&sdhci_s3c_notify_change); #ifndef CONFIG_MACH_P4W_REV00 /* original */ if (pdata->ext_pdev) pdata->ext_pdev(pdev); #endif } if (pdata->cd_type == S3C_SDHCI_CD_GPIO && gpio_is_valid(pdata->ext_cd_gpio)) { host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION; gpio_request(pdata->ext_cd_gpio, "SDHCI EXT CD"); sc->ext_cd_gpio = pdata->ext_cd_gpio; sc->ext_cd_irq = gpio_to_irq(pdata->ext_cd_gpio); sc->regulator_workq = create_singlethread_workqueue("ktflash_requlatord"); if (!sc->regulator_workq) { pr_info("%s : ERROR: workqueue for Tflash's regulator.\n" "Regulator for Tflash will be always ON\n", __func__); } INIT_DELAYED_WORK(&sc->regul_work, sdhci_s3c_requlator_work); if (sc->ext_cd_irq && request_irq(sc->ext_cd_irq, sdhci_s3c_gpio_card_detect_isr, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, dev_name(&pdev->dev), sc)) { dev_err(&pdev->dev, "cannot request irq for card detect\n"); sc->ext_cd_irq = 0; } else { int status = gpio_get_value(sc->ext_cd_gpio); /* T-Flash EINT for CD SHOULD be wakeup source */ set_irq_wake(sc->ext_cd_irq, 1); /* disable pull-up/down for detection gpio */ s3c_gpio_setpull(sc->ext_cd_gpio, S3C_GPIO_PULL_NONE); if (pdata->ext_cd_gpio_invert) status = !status; if (status) mmc_host_sd_set_present(host->mmc); else mmc_host_sd_clear_present(host->mmc); sdhci_s3c_notify_change(sc->pdev, status); } if (tflash_detection_cmd_dev == NULL && sc->ext_cd_gpio) { tflash_detection_cmd_dev = device_create(sec_class, NULL, 0, NULL, "tctest"); if (IS_ERR(tflash_detection_cmd_dev)) pr_err("%s : Failed to create device(ts)!\n", __func__); if (device_create_file(tflash_detection_cmd_dev, &dev_attr_tftest) < 0) pr_err("%s : Failed to create device file(%s)!\n", __func__, dev_attr_tftest.attr.name); dev_set_drvdata(tflash_detection_cmd_dev, sc); } } 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; }
/* ** Function definitions */ static void config_umts_modem_gpio(void) { int err; 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_active_state = umts_modem_data.gpio_host_active; unsigned gpio_host_wakeup = umts_modem_data.gpio_host_wakeup; unsigned gpio_slave_wakeup = umts_modem_data.gpio_slave_wakeup; unsigned gpio_dpram_int = umts_modem_data.gpio_dpram_int; unsigned gpio_dpram_status = umts_modem_data.gpio_dpram_status; unsigned gpio_dpram_wakeup = umts_modem_data.gpio_dpram_wakeup; unsigned gpio_dynamic_switching = umts_modem_data.gpio_dynamic_switching; #ifdef CONFIG_EXYNOS4_CPUFREQ unsigned gpio_cpufreq_lock = umts_modem_data.gpio_cpufreq_lock; #endif if (gpio_cp_on) { err = gpio_request(gpio_cp_on, "CMC_ON"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_ON"); } else { gpio_direction_output(gpio_cp_on, 0); s3c_gpio_setpull(gpio_cp_on, S3C_GPIO_PULL_NONE); } } if (gpio_cp_rst) { err = gpio_request(gpio_cp_rst, "CMC_RST"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_RST"); } else { 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) { mif_err("ERR: fail to request gpio %s\n", "PDA_ACTIVE"); } else { gpio_direction_output(gpio_pda_active, 0); s3c_gpio_setpull(gpio_pda_active, S3C_GPIO_PULL_NONE); } } if (gpio_phone_active) { err = gpio_request(gpio_phone_active, "CMC_ACTIVE"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_ACTIVE"); } else { /* Configure as a wake-up source */ gpio_direction_input(gpio_phone_active); s3c_gpio_setpull(gpio_phone_active, S3C_GPIO_PULL_DOWN); s3c_gpio_cfgpin(gpio_phone_active, S3C_GPIO_SFN(0xF)); } } if (gpio_active_state) { err = gpio_request(gpio_active_state, "CMC_ACTIVE_STATE"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_ACTIVE_STATE"); } else { gpio_direction_output(gpio_active_state, 0); s3c_gpio_setpull(gpio_active_state, S3C_GPIO_PULL_NONE); } } if (gpio_slave_wakeup) { err = gpio_request(gpio_slave_wakeup, "CMC_SLAVE_WAKEUP"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_SLAVE_WAKEUP"); } else { gpio_direction_output(gpio_slave_wakeup, 0); s3c_gpio_setpull(gpio_slave_wakeup, S3C_GPIO_PULL_NONE); } } if (gpio_host_wakeup) { err = gpio_request(gpio_host_wakeup, "CMC_HOST_WAKEUP"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_HOST_WAKEUP"); } else { /* Configure as a wake-up source */ gpio_direction_input(gpio_host_wakeup); s3c_gpio_setpull(gpio_host_wakeup, S3C_GPIO_PULL_DOWN); s3c_gpio_cfgpin(gpio_host_wakeup, S3C_GPIO_SFN(0xF)); } } if (gpio_dpram_int) { err = gpio_request(gpio_dpram_int, "CMC_DPRAM_INT"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_DPRAM_INT"); } else { /* Configure as a wake-up source */ gpio_direction_input(gpio_dpram_int); s3c_gpio_setpull(gpio_dpram_int, S3C_GPIO_PULL_NONE); s3c_gpio_cfgpin(gpio_dpram_int, S3C_GPIO_SFN(0xF)); } } if (gpio_dpram_status) { err = gpio_request(gpio_dpram_status, "CMC_DPRAM_STATUS"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_DPRAM_STATUS"); } else { gpio_direction_input(gpio_dpram_status); s3c_gpio_setpull(gpio_dpram_status, S3C_GPIO_PULL_NONE); } } if (gpio_dpram_wakeup) { err = gpio_request(gpio_dpram_wakeup, "CMC_DPRAM_WAKEUP"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_DPRAM_WAKEUP"); } else { gpio_direction_output(gpio_dpram_wakeup, 1); s3c_gpio_setpull(gpio_dpram_wakeup, S3C_GPIO_PULL_NONE); } } if (gpio_dynamic_switching) { err = gpio_request(gpio_dynamic_switching, "DYNAMIC_SWITCHING"); if (err) { mif_err("ERR: fail to request gpio %s\n", "DYNAMIC_SWITCHING\n"); } else { gpio_direction_input(gpio_dynamic_switching); s3c_gpio_setpull(gpio_dynamic_switching, S3C_GPIO_PULL_DOWN); } } #ifdef CONFIG_EXYNOS4_CPUFREQ if (gpio_cpufreq_lock) { err = gpio_request(gpio_cpufreq_lock, "CPUFREQ_LOCK_CNT"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CPUFREQ_LOCK_CNT\n"); } else { gpio_direction_input(gpio_cpufreq_lock); s3c_gpio_setpull(gpio_cpufreq_lock, S3C_GPIO_PULL_NONE); } s5p_register_gpio_interrupt(gpio_cpufreq_lock); } #endif mif_info("done\n"); }
void universal_sdhci2_cfg_ext_cd(void) { printk(KERN_DEBUG "Universal :SD Detect configuration\n"); s3c_gpio_setpull(S5PV210_GPH3(4), S3C_GPIO_PULL_NONE); set_irq_type(IRQ_EINT(28), IRQ_TYPE_EDGE_BOTH); }
static void sii8240_cfg_gpio(void) { printk(KERN_INFO "%s()\n", __func__); #ifdef CONFIG_MACH_JA #if defined(CONFIG_MACH_JA_KOR_LGT) if ( (system_rev < 06) || (system_rev == 7) ) { #else if (system_rev < 06 ) { #endif #endif /* AP_MHL_SDA */ s3c_gpio_cfgpin(GPIO_MHL_SDA_18V, S3C_GPIO_SFN(0x0)); s3c_gpio_setpull(GPIO_MHL_SDA_18V, S3C_GPIO_PULL_NONE); /* AP_MHL_SCL */ s3c_gpio_cfgpin(GPIO_MHL_SCL_18V, S3C_GPIO_SFN(0x0)); s3c_gpio_setpull(GPIO_MHL_SCL_18V, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(GPIO_MHL_SCL_18V, S5P_GPIO_DRVSTR_LV4); s5p_gpio_set_drvstr(GPIO_MHL_SDA_18V, S5P_GPIO_DRVSTR_LV4); #ifdef CONFIG_MACH_JA } else { /* AP_MHL_SDA */ s3c_gpio_cfgpin(GPIO_MHL_SDA_18V_06, S3C_GPIO_SFN(0x0)); s3c_gpio_setpull(GPIO_MHL_SDA_18V_06, S3C_GPIO_PULL_NONE); /* AP_MHL_SCL */ s3c_gpio_cfgpin(GPIO_MHL_SCL_18V_06, S3C_GPIO_SFN(0x0)); s3c_gpio_setpull(GPIO_MHL_SCL_18V_06, S3C_GPIO_PULL_NONE); s5p_gpio_set_drvstr(GPIO_MHL_SCL_18V_06, S5P_GPIO_DRVSTR_LV4); s5p_gpio_set_drvstr(GPIO_MHL_SDA_18V_06, S5P_GPIO_DRVSTR_LV4); } #endif gpio_request(GPIO_MHL_INT, "MHL_INT"); s5p_register_gpio_interrupt(GPIO_MHL_INT); s3c_gpio_setpull(GPIO_MHL_INT, S3C_GPIO_PULL_DOWN); irq_set_irq_type(gpio_to_irq(GPIO_MHL_INT), IRQ_TYPE_EDGE_RISING); s3c_gpio_cfgpin(GPIO_MHL_INT, S3C_GPIO_SFN(0xF)); s3c_gpio_cfgpin(GPIO_MHL_RST, S3C_GPIO_OUTPUT); s3c_gpio_setpull(GPIO_MHL_RST, S3C_GPIO_PULL_NONE); gpio_set_value(GPIO_MHL_RST, 0); } static void sii8240_power_onoff(bool on) { struct regulator *regulator1_8, *regulator3_3, *regulator1_2; regulator1_8 = regulator_get(NULL, MHL_LDO1_8); regulator3_3 = regulator_get(NULL, MHL_LDO3_3); regulator1_2 = regulator_get(NULL, MHL_LDO1_2); if ((IS_ERR(regulator1_8)) || (IS_ERR(regulator3_3)) || (IS_ERR(regulator1_2))) { pr_err("%s : regulato is not available", __func__); return; } if (mhl_power_on == on) { pr_info("sii8240 : sii8240_power_onoff : alread %d\n", on); regulator_put(regulator1_2); regulator_put(regulator3_3); regulator_put(regulator1_8); return; } mhl_power_on = on; pr_info("sii8240 : sii8240_power_onoff : %d\n", on); if (on) { /* To avoid floating state of the HPD pin * * in the absence of external pull-up */ s3c_gpio_setpull(GPIO_HDMI_HPD, S3C_GPIO_PULL_NONE); regulator_enable(regulator3_3); regulator_enable(regulator1_8); regulator_enable(regulator1_2); usleep_range(10000, 20000); } else { /* To avoid floating state of the HPD pin * * in the absence of external pull-up */ s3c_gpio_setpull(GPIO_HDMI_HPD, S3C_GPIO_PULL_DOWN); regulator_disable(regulator3_3); regulator_disable(regulator1_8); regulator_disable(regulator1_2); gpio_set_value(GPIO_MHL_RST, 0); } regulator_put(regulator3_3); regulator_put(regulator1_8); regulator_put(regulator1_2); } static void sii8240_reset(void) { printk(KERN_INFO "%s()\n", __func__); s3c_gpio_cfgpin(GPIO_MHL_RST, S3C_GPIO_OUTPUT); s3c_gpio_setpull(GPIO_MHL_RST, S3C_GPIO_PULL_NONE); gpio_set_value(GPIO_MHL_RST, 0); usleep_range(10000, 20000); gpio_set_value(GPIO_MHL_RST, 1); usleep_range(10000, 20000); }
/* 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); }
static int s6e8ax0_probe(struct device *dev) { int ret = 0; 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->siop_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_siop_enable); 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->ld->dev, &dev_attr_read_acl); 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, "s6e8aa0 lcd panel driver has been probed.\n"); #ifdef SMART_DIMMING s6e8aa0_check_id(lcd, lcd->id); init_table_info(&lcd->smart); ret = s6e8ax0_read_mtp(lcd, mtp_data); if (!ret) { printk(KERN_ERR "[LCD:ERROR] : %s read mtp failed\n", __func__); /*return -EPERM;*/ } calc_voltage_table(&lcd->smart, mtp_data); if (lcd->support_elvss) ret = init_elvss_table(lcd); else { lcd->elvss_table = (unsigned char **)ELVSS_TABLE; ret = 0; } ret += init_gamma_table(lcd); #ifdef CONFIG_AID_DIMMING if (lcd->id[1] == 0x20 || lcd->id[1] == 0x40 || lcd->id[1] == 0x60) { printk(KERN_INFO "AID Dimming is started. %d\n", lcd->id[1]); lcd->support_aid = 1; ret += init_aid_dimming_table(lcd); } #endif if (ret) { printk(KERN_ERR "gamma table generation is failed\n"); lcd->gamma_table = (unsigned char **)gamma22_table; lcd->elvss_table = (unsigned char **)ELVSS_TABLE; } update_brightness(lcd, 1); #endif #ifdef CONFIG_FB_S5P_PREVENTESD if (lcd->connected && !lpcharge) { INIT_DELAYED_WORK(&lcd->check_ddi, check_ddi_work); schedule_delayed_work(&lcd->check_ddi, msecs_to_jiffies(20000)); } #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 !defined(CONFIG_FB_S5P_PREVENTESD) 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 } #endif lcd_early_suspend = s6e8ax0_early_suspend; lcd_late_resume = s6e8ax0_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 ssize_t MHD_check_read(struct device *dev, struct device_attribute *attr, char *buf) { int count; int res=0; #if 0 s3c_gpio_setpull(GPIO_MHL_SEL, S3C_GPIO_PULL_UP); //MHL_SEL s3c_gpio_setpin(GPIO_MHL_SEL, 1); //TVout_LDO_ctrl(true); if(!MHD_HW_IsOn()) { sii9234_tpi_init(); res = MHD_Read_deviceID(); MHD_HW_Off(); } else { sii9234_tpi_init(); res = MHD_Read_deviceID(); } I2C_WriteByte(0x72, 0xA5, 0xE1); res = 0; res = I2C_ReadByte(0x72, 0xA5); printk("A5 res %x",res); res = 0; res = I2C_ReadByte(0x72, 0x1B); printk("Device ID res %x",res); res = 0; res = I2C_ReadByte(0x72, 0x1C); printk("Device Rev ID res %x",res); res = 0; res = I2C_ReadByte(0x72, 0x1D); printk("Device Reserved ID res %x",res); printk("\n####HDMI_EN1 %x MHL_RST %x GPIO_MHL_SEL %x\n",gpio_get_value(GPIO_HDMI_EN1),gpio_get_value(GPIO_MHL_RST),gpio_get_value(GPIO_MHL_SEL)); res = I2C_ReadByte(0x7A, 0x3D); res = I2C_ReadByte(0x7A, 0xFF); s3c_gpio_setpull(GPIO_MHL_SEL, S3C_GPIO_PULL_NONE); //MHL_SEL s3c_gpio_setpin(GPIO_MHL_SEL, 0); #endif count = sprintf(buf,"%d\n", res ); //TVout_LDO_ctrl(false); return count; }
static int s3c_keygpio_isr_setup(void *pdev) { int ret; //volume down s3c_gpio_setpull(S5PV210_GPH3(1), S3C_GPIO_PULL_NONE); set_irq_type(IRQ_EINT(25), IRQ_TYPE_EDGE_BOTH); ret = request_irq(IRQ_EINT(25), s3c_keygpio_vol_down_isr, IRQF_SAMPLE_RANDOM, "key vol down", (void *)pdev); if (ret) { printk("request_irq failed (IRQ_KEYPAD (key vol down)) !!!\n"); ret = -EIO; return ret; } //volume up s3c_gpio_setpull(S5PV210_GPH3(2), S3C_GPIO_PULL_NONE); set_irq_type(IRQ_EINT(26), IRQ_TYPE_EDGE_BOTH); ret = request_irq(IRQ_EINT(26), s3c_keygpio_vol_up26_isr, IRQF_SAMPLE_RANDOM, "key vol up(26)", (void *)pdev); if (ret) { printk ("request_irq failed (IRQ_KEYPAD (key vol up(26))) !!!\n"); ret = -EIO; return ret; } //ok key s3c_gpio_setpull(S5PV210_GPH3(5), S3C_GPIO_PULL_NONE); set_irq_type(IRQ_EINT(29), IRQ_TYPE_EDGE_BOTH); ret = request_irq(IRQ_EINT(29), s3c_keygpio_ok_isr, IRQF_DISABLED | IRQF_SAMPLE_RANDOM, "key ok", (void *)pdev); if (ret) { printk("request_irq failed (IRQ_KEYPAD (key ok)) !!!\n"); ret = -EIO; return ret; } //ok key #if 0 s3c_gpio_setpull(S5PC11X_GPH3(0), S3C_GPIO_PULL_UP); set_irq_type(IRQ_EINT(24), IRQ_TYPE_EDGE_BOTH); ret = request_irq(IRQ_EINT(24), s3c_keygpio_ok_isr, IRQF_SAMPLE_RANDOM, "key ok", (void *)pdev); if (ret) { printk("request_irq failed (IRQ_KEYPAD (key ok)) !!!\n"); ret = -EIO; return ret; } #endif //PWR key s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_NONE); set_irq_type(IRQ_EINT(22), IRQ_TYPE_EDGE_BOTH); // stk.lim: Add IRQF_DISABLED to eliminate any possible race // regarding key status ret = request_irq(IRQ_EINT(22), s3c_keygpio_isr, IRQF_DISABLED | IRQF_SAMPLE_RANDOM, "key gpio", (void *)pdev); if (ret) { printk("request_irq failed (IRQ_KEYPAD (gpio)) !!!\n"); ret = -EIO; } return ret; }
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); }
/* ** Function definitions */ static void config_umts_modem_gpio(void) { int err; 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_active_state = umts_modem_data.gpio_host_active; unsigned gpio_host_wakeup = umts_modem_data.gpio_host_wakeup; unsigned gpio_slave_wakeup = umts_modem_data.gpio_slave_wakeup; unsigned gpio_ipc_int2ap = umts_modem_data.gpio_ipc_int2ap; unsigned gpio_cp_status = umts_modem_data.gpio_cp_status; unsigned gpio_cp_wakeup = umts_modem_data.gpio_cp_wakeup; unsigned gpio_link_switch = umts_modem_data.gpio_link_switch; if (gpio_cp_on) { err = gpio_request(gpio_cp_on, "CMC_ON"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_ON"); } else { gpio_direction_output(gpio_cp_on, 0); s3c_gpio_setpull(gpio_cp_on, S3C_GPIO_PULL_NONE); } } if (gpio_cp_rst) { err = gpio_request(gpio_cp_rst, "CMC_RST"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_RST"); } else { 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) { mif_err("ERR: fail to request gpio %s\n", "PDA_ACTIVE"); } else { gpio_direction_output(gpio_pda_active, 0); s3c_gpio_setpull(gpio_pda_active, S3C_GPIO_PULL_NONE); } } if (gpio_phone_active) { err = gpio_request(gpio_phone_active, "CMC_ACTIVE"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_ACTIVE"); } else { /* Configure as a wake-up source */ gpio_direction_input(gpio_phone_active); s3c_gpio_setpull(gpio_phone_active, S3C_GPIO_PULL_DOWN); s3c_gpio_cfgpin(gpio_phone_active, S3C_GPIO_SFN(0xF)); } } if (gpio_active_state) { err = gpio_request(gpio_active_state, "CMC_ACTIVE_STATE"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_ACTIVE_STATE"); } else { gpio_direction_output(gpio_active_state, 0); s3c_gpio_setpull(gpio_active_state, S3C_GPIO_PULL_NONE); } } if (gpio_slave_wakeup) { err = gpio_request(gpio_slave_wakeup, "CMC_SLAVE_WAKEUP"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_SLAVE_WAKEUP"); } else { gpio_direction_output(gpio_slave_wakeup, 0); s3c_gpio_setpull(gpio_slave_wakeup, S3C_GPIO_PULL_NONE); } } if (gpio_host_wakeup) { err = gpio_request(gpio_host_wakeup, "CMC_HOST_WAKEUP"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_HOST_WAKEUP"); } else { /* Configure as a wake-up source */ gpio_direction_input(gpio_host_wakeup); s3c_gpio_setpull(gpio_host_wakeup, S3C_GPIO_PULL_DOWN); s3c_gpio_cfgpin(gpio_host_wakeup, S3C_GPIO_SFN(0xF)); } } if (gpio_ipc_int2ap) { err = gpio_request(gpio_ipc_int2ap, "CMC_DPRAM_INT"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_DPRAM_INT"); } else { /* Configure as a wake-up source */ gpio_direction_input(gpio_ipc_int2ap); s3c_gpio_setpull(gpio_ipc_int2ap, S3C_GPIO_PULL_NONE); s3c_gpio_cfgpin(gpio_ipc_int2ap, S3C_GPIO_SFN(0xF)); } } if (gpio_cp_status) { err = gpio_request(gpio_cp_status, "CMC_DPRAM_STATUS"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_DPRAM_STATUS"); } else { gpio_direction_input(gpio_cp_status); s3c_gpio_setpull(gpio_cp_status, S3C_GPIO_PULL_NONE); } } if (gpio_cp_wakeup) { err = gpio_request(gpio_cp_wakeup, "CMC_DPRAM_WAKEUP"); if (err) { mif_err("ERR: fail to request gpio %s\n", "CMC_DPRAM_WAKEUP"); } else { gpio_direction_output(gpio_cp_wakeup, 1); s3c_gpio_setpull(gpio_cp_wakeup, S3C_GPIO_PULL_NONE); } } if (gpio_link_switch) { err = gpio_request(gpio_link_switch, "DYNAMIC_SWITCHING"); if (err) { mif_err("ERR: fail to request gpio %s\n", "DYNAMIC_SWITCHING\n"); } else { gpio_direction_input(gpio_link_switch); s3c_gpio_setpull(gpio_link_switch, S3C_GPIO_PULL_DOWN); } } mif_info("done\n"); }
static int bluetooth_set_power(void *data, enum rfkill_user_states state) { int ret = 0; switch (state) { case RFKILL_USER_STATE_UNBLOCKED: printk(KERN_DEBUG "[BT] Device Powering ON \n"); s3c_setup_uart_cfg_gpio(0); if (gpio_is_valid(GPIO_WLAN_BT_EN)) { ret = gpio_request(GPIO_WLAN_BT_EN, "GPB"); if (ret < 0) { printk(KERN_ERR "[BT] Failed to request GPIO_WLAN_BT_EN!\n"); return ret; } gpio_direction_output(GPIO_WLAN_BT_EN, GPIO_LEVEL_HIGH); } if (gpio_is_valid(GPIO_BT_nRST)) { ret = gpio_request(GPIO_BT_nRST, "GPB"); if (ret < 0) { gpio_free(GPIO_WLAN_BT_EN); printk(KERN_ERR "[BT] Failed to request GPIO_BT_nRST\n"); return ret; } gpio_direction_output(GPIO_BT_nRST, GPIO_LEVEL_LOW); } printk(KERN_DEBUG "[BT] GPIO_BT_nRST = %d\n", gpio_get_value(GPIO_BT_nRST)); /* Set GPIO_BT_WLAN_REG_ON high */ s3c_gpio_setpull(GPIO_WLAN_BT_EN, S3C_GPIO_PULL_NONE); gpio_set_value(GPIO_WLAN_BT_EN, GPIO_LEVEL_HIGH); s3c_gpio_slp_cfgpin(GPIO_WLAN_BT_EN, S3C_GPIO_SLP_OUT1); s3c_gpio_slp_setpull_updown(GPIO_WLAN_BT_EN, S3C_GPIO_PULL_NONE); printk( "[BT] GPIO_WLAN_BT_EN = %d\n", gpio_get_value(GPIO_WLAN_BT_EN)); /*FIXME sleep should be enabled disabled since the device is not booting * if its enabled*/ msleep(100); // 100msec, delay between reg_on & rst. (bcm4329 powerup sequence) /* Set GPIO_BT_nRST high */ s3c_gpio_setpull(GPIO_BT_nRST, S3C_GPIO_PULL_NONE); gpio_set_value(GPIO_BT_nRST, GPIO_LEVEL_HIGH); s3c_gpio_slp_cfgpin(GPIO_BT_nRST, S3C_GPIO_SLP_OUT1); s3c_gpio_slp_setpull_updown(GPIO_BT_nRST, S3C_GPIO_PULL_NONE); printk("[BT] GPIO_BT_nRST = %d\n", gpio_get_value(GPIO_BT_nRST)); gpio_free(GPIO_BT_nRST); gpio_free(GPIO_WLAN_BT_EN); break; case RFKILL_USER_STATE_SOFT_BLOCKED: printk(KERN_DEBUG "[BT] Device Powering OFF \n"); // s3c_reset_uart_cfg_gpio(0); s3c_gpio_setpull(GPIO_BT_nRST, S3C_GPIO_PULL_NONE); gpio_set_value(GPIO_BT_nRST, GPIO_LEVEL_LOW); s3c_gpio_slp_cfgpin(GPIO_BT_nRST, S3C_GPIO_SLP_OUT0); s3c_gpio_slp_setpull_updown(GPIO_BT_nRST, S3C_GPIO_PULL_NONE); printk("[BT] GPIO_BT_nRST = %d\n",gpio_get_value(GPIO_BT_nRST)); if(gpio_get_value(GPIO_WLAN_nRST) == 0) { s3c_gpio_setpull(GPIO_WLAN_BT_EN, S3C_GPIO_PULL_NONE); gpio_set_value(GPIO_WLAN_BT_EN, GPIO_LEVEL_LOW); s3c_gpio_slp_cfgpin(GPIO_WLAN_BT_EN, S3C_GPIO_SLP_OUT0); s3c_gpio_slp_setpull_updown(GPIO_WLAN_BT_EN, S3C_GPIO_PULL_NONE); printk("[BT] GPIO_WLAN_BT_EN = %d\n", gpio_get_value(GPIO_WLAN_BT_EN)); } gpio_free(GPIO_BT_nRST); gpio_free(GPIO_WLAN_BT_EN); break; default: printk(KERN_ERR "[BT] Bad bluetooth rfkill state %d\n", state); } 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_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", gpio_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"); }