[RAMEN9610-15070] [COMMON] drivers: led: turn off all leds at shutdown
authorKeunho Hwang <keunho.hwang@samsung.com>
Fri, 10 May 2019 07:10:04 +0000 (07:10 +0000)
committerKim Gunho <gunho.kim@samsung.com>
Fri, 28 Jun 2019 14:45:27 +0000 (23:45 +0900)
Change-Id: Ib1fbbfd98d83998dc1f46a1cee7ba21bd2eab13f
Signed-off-by: Keunho Hwang <keunho.hwang@samsung.com>
drivers/leds/leds-s2mu106.c

index 0a4ef70ef7c2a7dd09ef4f26de5575d9ef17536a..7e0d2a041110a12839ef38131c40adead50b7988 100644 (file)
@@ -871,6 +871,23 @@ static int s2mu106_led_remove(struct platform_device *pdev)
        return 0;
 }
 
+static void s2mu106_led_shutdown(struct platform_device *pdev)
+{
+       struct s2mu106_fled_data *fled_data =
+               platform_get_drvdata(pdev);
+       int chan;
+
+       if (!fled_data->i2c) {
+               pr_err("%s: no i2c client\n", __func__);
+               return;
+       }
+
+       /* Turn off all leds when power off */
+       pr_info("%s: turn off all leds\n", __func__);
+       for (chan = 1; chan <= S2MU106_CH_MAX; chan++)
+               s2mu106_fled_set_mode(fled_data, chan, S2MU106_FLED_MODE_OFF);
+}
+
 static struct platform_driver s2mu106_led_driver = {
        .driver = {
                .name  = "leds-s2mu106",
@@ -878,6 +895,7 @@ static struct platform_driver s2mu106_led_driver = {
                },
        .probe  = s2mu106_led_probe,
        .remove = s2mu106_led_remove,
+       .shutdown = s2mu106_led_shutdown,
 };
 
 static int __init s2mu106_led_driver_init(void)