static void tps_work(void *unused) { for (;;) { u8 leds; local_irq_disable(); leds = tps_leds_change; tps_leds_change = 0; local_irq_enable(); if (!leds) break; /* careful: the set_led() value is on/off/blink */ if (leds & GREEN_LED) tps65010_set_led(LED1, !!(hw_led_state & GREEN_LED)); if (leds & AMBER_LED) tps65010_set_led(LED2, !!(hw_led_state & AMBER_LED)); /* the gpio led doesn't have that issue */ if (leds & RED_LED) tps65010_set_gpio_out_value(GPIO2, !(hw_led_state & RED_LED)); } }
static int __init osk_tps_init(void) { if (!machine_is_omap_osk()) return 0; /* Let LED1 (D9) blink */ tps65010_set_led(LED1, BLINK); /* Disable LED 2 (D2) */ tps65010_set_led(LED2, OFF); /* Set GPIO 1 HIGH to disable VBUS power supply; * OHCI driver powers it up/down as needed. */ tps65010_set_gpio_out_value(GPIO1, HIGH); /* Set GPIO 2 low to turn on LED D3 */ tps65010_set_gpio_out_value(GPIO2, HIGH); /* Set GPIO 3 low to take ethernet out of reset */ tps65010_set_gpio_out_value(GPIO3, LOW); /* gpio4 for VDD_DSP */ /* FIXME send power to DSP iff it's configured */ /* Enable LOW_PWR */ tps65010_set_low_pwr(ON); /* Switch VLDO2 to 3.0V for AIC23 */ tps65010_config_vregs1(TPS_LDO2_ENABLE | TPS_VLDO2_3_0V | TPS_LDO1_ENABLE); return 0; }
static int palmtt3led_suspend_late(struct platform_device *dev, pm_message_t state) { tps65010_set_led(LED1, OFF); tps65010_set_led(LED2, OFF); tps65010_set_vib(OFF); return 0; }
static int osk_tps_setup(struct i2c_client *client, void *context) { if (!IS_BUILTIN(CONFIG_TPS65010)) return -ENOSYS; /* Set GPIO 1 HIGH to disable VBUS power supply; * OHCI driver powers it up/down as needed. */ gpio_request(OSK_TPS_GPIO_USB_PWR_EN, "n_vbus_en"); gpio_direction_output(OSK_TPS_GPIO_USB_PWR_EN, 1); /* Set GPIO 2 high so LED D3 is off by default */ tps65010_set_gpio_out_value(GPIO2, HIGH); /* Set GPIO 3 low to take ethernet out of reset */ gpio_request(OSK_TPS_GPIO_LAN_RESET, "smc_reset"); gpio_direction_output(OSK_TPS_GPIO_LAN_RESET, 0); /* GPIO4 is VDD_DSP */ gpio_request(OSK_TPS_GPIO_DSP_PWR_EN, "dsp_power"); gpio_direction_output(OSK_TPS_GPIO_DSP_PWR_EN, 1); /* REVISIT if DSP support isn't configured, power it off ... */ /* Let LED1 (D9) blink; leds-gpio may override it */ tps65010_set_led(LED1, BLINK); /* Set LED2 off by default */ tps65010_set_led(LED2, OFF); /* Enable LOW_PWR handshake */ tps65010_set_low_pwr(ON); /* Switch VLDO2 to 3.0V for AIC23 */ tps65010_config_vregs1(TPS_LDO2_ENABLE | TPS_VLDO2_3_0V | TPS_LDO1_ENABLE); /* register these three LEDs */ osk5912_tps_leds.dev.parent = &client->dev; platform_device_register(&osk5912_tps_leds); return 0; }
static void tps650101_scheduled_leds(struct work_struct *work) { tps65010_set_led(LED1,palmtt3led_work.led1); tps65010_set_led(LED2,palmtt3led_work.led2); tps65010_set_vib(palmtt3led_work.vibra); }