static int bcm_keypad_led_probe(struct platform_device *pdev) { struct platform_keypad_led_data *data = pdev->dev.platform_data; struct backlight_device *bl; struct keypad_led_data *keyled; struct backlight_properties props; int ret; KLDBG("[KEYLED] bcm_keypad_led_probe, 0x%x\n", readl(HW_SYSCFG_BASE)); if (!data) { dev_err(&pdev->dev, "failed to find platform data\n"); return -EINVAL; } keyled = kzalloc(sizeof(*keyled), GFP_KERNEL); if (!keyled) { dev_err(&pdev->dev, "no memory for state\n"); ret = -ENOMEM; goto err_alloc; } keyled->ctrl_pin = data->ctrl_pin; memset(&props, 0, sizeof(struct backlight_properties)); props.max_brightness = data->max_brightness; bl = backlight_device_register(pdev->name, &pdev->dev, keyled, &bcm_keypad_led_ops, &props); if (IS_ERR(bl)) { dev_err(&pdev->dev, "failed to register backlight\n"); ret = PTR_ERR(bl); goto err_bl; } #ifdef CONFIG_HAS_EARLYSUSPEND keyled->pdev = pdev; keyled->early_suspend_desc.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN-1; keyled->early_suspend_desc.suspend = bcm_keypad_led_earlysuspend; keyled->early_suspend_desc.resume = bcm_keypad_led_earlyresume; register_early_suspend(&keyled->early_suspend_desc); #endif bl->props.max_brightness = data->max_brightness; bl->props.brightness = data->default_brightness; platform_set_drvdata(pdev, bl); bcm_keypad_led_update_status(bl); bcm_gpio_pull_up(keyled_pin, false); bcm_gpio_pull_up_down_enable(keyled_pin, true); return 0; err_bl: kfree(keyled); err_alloc: return ret; }
static void bcm_keypad_led_earlysuspend(struct early_suspend *desc) { struct keypad_led_data *keyled = container_of(desc, struct keypad_led_data, early_suspend_desc); struct backlight_device *bl = platform_get_drvdata(keyled->pdev); KLDBG("[KEYLED] bcm_keypad_led_earlysuspend\n"); bcm_gpio_pull_up(keyled_pin, false); bcm_gpio_pull_up_down_enable(keyled_pin, true); }
static int synaptics_ts_suspend(struct i2c_client *client, pm_message_t mesg) { int ret; struct synaptics_ts_data *ts = i2c_get_clientdata(client); printk("[TSP] %s+\n", __func__ ); if(now_tst200_update_luisa == 0) { if (ts->use_irq) { disable_irq(client->irq); } if(touch_present == 1) hrtimer_cancel(&ts->timer); gpio_direction_output( TSP_INT , 0 ); gpio_direction_output( TSP_SCL , 0 ); gpio_direction_output( TSP_SDA , 0 ); bcm_gpio_pull_up(TSP_INT, false); bcm_gpio_pull_up_down_enable(TSP_INT, true); #if USE_THREADED_IRQ #else ret = cancel_work_sync(&ts->work); if (ret && ts->use_irq) /* if work was pending disable-count is now 2 */ { enable_irq(client->irq); } #endif msleep(20); touch_ctrl_regulator(TOUCH_OFF); if(g_touch_info_press == 1) { TSP_forced_release_forkey(ts); } } printk("[TSP] %s-\n", __func__ ); return 0; }
static int __devinit synaptics_ts_init(void) { #if defined (CONFIG_TOUCHSCREEN_MMS128_TASSCOOPER) Synaptics_Loaded = 1; printk("[TSP][Synaptics][%s] %s\n", __func__,"Init Func Called"); if(Is_MMS128_Connected() == 1) { printk("[TSP][Synaptics][%s] %s\n", __func__,"Melfas already detected !!"); return -ENXIO; } if(Is_MMS128_Loaded() == 0) { #endif printk("[TSP] %s\n", __func__ ); gpio_request(TSP_INT, "ts_irq"); gpio_direction_input(TSP_INT); bcm_gpio_pull_up(TSP_INT, true); bcm_gpio_pull_up_down_enable(TSP_INT, true); set_irq_type(GPIO_TO_IRQ(TSP_INT), IRQF_TRIGGER_FALLING); //#if defined (CONFIG_TOUCHSCREEN_MMS128_TASSCOOPER) //disable BB internal pulls for touch int, scl, sda pin bcm_gpio_pull_up_down_enable(TSP_INT, 0); bcm_gpio_pull_up_down_enable(TSP_SCL, 0); bcm_gpio_pull_up_down_enable(TSP_SDA, 0); //#endif #if defined (CONFIG_TOUCHSCREEN_MMS128_TASSCOOPER) } #endif #if USE_THREADED_IRQ #else synaptics_wq = create_singlethread_workqueue("synaptics_wq"); if (!synaptics_wq) return -ENOMEM; #endif touch_regulator = regulator_get(NULL,"touch_vcc"); return i2c_add_driver(&synaptics_ts_driver); }
static int __devinit synaptics_ts_init(void) { printk("[TSP] %s\n", __func__ ); gpio_request(TSP_INT, "ts_irq"); gpio_direction_input(TSP_INT); bcm_gpio_pull_up(TSP_INT, true); bcm_gpio_pull_up_down_enable(TSP_INT, true); set_irq_type(GPIO_TO_IRQ(TSP_INT), IRQF_TRIGGER_FALLING); synaptics_wq = create_singlethread_workqueue("synaptics_wq"); if (!synaptics_wq) return -ENOMEM; touch_regulator = regulator_get(NULL,"touch_vcc"); return i2c_add_driver(&synaptics_ts_driver); }
int brcm_init_hostwake(const struct bcm_bt_lpm_platform_data *gpio_data) { unsigned int irq; int ret, err; if (bcm_bt_lpm_data.host_wake_installed) { pr_info("host wake irq is already installed \n"); return 0; } else bcm_bt_lpm_data.host_wake_installed = 1; #ifdef CONFIG_HAS_WAKELOCK wake_lock_init(&bcm_bt_lpm_data.host_wake_lock, WAKE_LOCK_SUSPEND, "HOSTWAKE"); #endif /* spin_lock_init(&bcm_bt_lpm_data.lock); */ err = gpio_request(gpio_data->gpio_host_wake, "gpio_host_wake"); if (err) { pr_info("%s: gpio_request failed for %d ", __FUNCTION__, gpio_data->gpio_host_wake); return 1; } gpio_direction_input(gpio_data->gpio_host_wake); /* make sure host_wake is pulled into the right direction if BT chips is NOT powered to avoid * wake lock being blocked accidentally! The value of HOST_WAKE_DEASSERT gives the direction * to pull to. */ #if defined (CONFIG_BOARD_THUNDERBIRD_EDN5x) || defined(CONFIG_BOARD_ACAR) || defined(CONFIG_BOARD_PASCAL) || defined(CONFIG_BOARD_L400) if ( 0 <= bcm_gpio_pull_up(gpio_data->gpio_host_wake, HOST_WAKE_DEASSERT) ) { if ( 0 > bcm_gpio_pull_up_down_enable(gpio_data->gpio_host_wake, 1) ) { pr_info( "bcm_gpio_pull_up_down_enable failed for gpio: %d", gpio_data->gpio_host_wake ); } } else { pr_info( "bcm_gpio_pull_up failed for gpio %d", gpio_data->gpio_host_wake ); } #endif irq = gpio_to_irq(gpio_data->gpio_host_wake); pr_info("host wake irq=%d \n", irq); ret = request_irq(irq, host_wake_isr, ( IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | IRQF_NO_SUSPEND ), "bt_host_wake", NULL); pr_info("request_irq returned value=%d \n", ret); return ret; }