static void r_tpu_work(struct work_struct *work) { struct r_tpu_priv *p = container_of(work, struct r_tpu_priv, work); enum led_brightness brightness = p->new_brightness; r_tpu_disable(p); /* off and maximum are handled as GPIO pins, in between PWM */ if ((brightness == 0) || (brightness == p->ldev.max_brightness)) r_tpu_set_pin(p, R_TPU_PIN_GPIO, brightness); else { r_tpu_set_pin(p, R_TPU_PIN_GPIO_FN, 0); r_tpu_enable(p, brightness); } }
static void r_tpu_work(struct work_struct *work) { struct r_tpu_priv *p = container_of(work, struct r_tpu_priv, work); enum led_brightness brightness = p->new_brightness; r_tpu_disable(p); if ((brightness == 0) || (brightness == p->ldev.max_brightness)) r_tpu_set_pin(p, R_TPU_PIN_GPIO, brightness); else { r_tpu_set_pin(p, R_TPU_PIN_GPIO_FN, 0); r_tpu_enable(p, brightness); } }
static int r_tpu_remove(struct platform_device *pdev) { struct r_tpu_priv *p = platform_get_drvdata(pdev); r_tpu_set_brightness(&p->ldev, LED_OFF); led_classdev_unregister(&p->ldev); cancel_work_sync(&p->work); r_tpu_disable(p); r_tpu_set_pin(p, R_TPU_PIN_UNUSED, LED_OFF); pm_runtime_disable(&pdev->dev); clk_put(p->clk); iounmap(p->mapbase); return 0; }