From: Keunho Hwang Date: Fri, 10 May 2019 07:10:04 +0000 (+0000) Subject: [RAMEN9610-15070] [COMMON] drivers: led: turn off all leds at shutdown X-Git-Tag: MMI-QSAS30.62-33-3~903 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1436150f22b98167e45c76990ee5eb956e2ce4be;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git [RAMEN9610-15070] [COMMON] drivers: led: turn off all leds at shutdown Change-Id: Ib1fbbfd98d83998dc1f46a1cee7ba21bd2eab13f Signed-off-by: Keunho Hwang --- diff --git a/drivers/leds/leds-s2mu106.c b/drivers/leds/leds-s2mu106.c index 0a4ef70ef7c2..7e0d2a041110 100644 --- a/drivers/leds/leds-s2mu106.c +++ b/drivers/leds/leds-s2mu106.c @@ -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)