diff options
author | Paul Parsons <lost.distance@yahoo.com> | 2011-08-09 12:27:33 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-10-24 08:09:09 -0400 |
commit | e0b13b5b6a9ad3ccadaa6662524a92e13aa7a032 (patch) | |
tree | 2c355a640e235691fae829d610bc4ac37da0f245 /drivers/leds/leds-asic3.c | |
parent | 3c6e36537e40a41ddb0e27a80149cfd341a92d7d (diff) |
mfd: Add asic3 based LED suspend/resume handlers
Added led suspend/resume handlers to the leds/leds-asic3 and mfd/asic3 drivers.
On suspend the leds will be turned off and their clocks disabled. On resume the
reverse.
Signed-off-by: Paul Parsons <lost.distance@yahoo.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/leds/leds-asic3.c')
-rw-r--r-- | drivers/leds/leds-asic3.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/drivers/leds/leds-asic3.c b/drivers/leds/leds-asic3.c index 22f847c890c9..fbd5d88ccd8f 100644 --- a/drivers/leds/leds-asic3.c +++ b/drivers/leds/leds-asic3.c | |||
@@ -107,9 +107,10 @@ static int __devinit asic3_led_probe(struct platform_device *pdev) | |||
107 | } | 107 | } |
108 | 108 | ||
109 | led->cdev->name = led->name; | 109 | led->cdev->name = led->name; |
110 | led->cdev->default_trigger = led->default_trigger; | 110 | led->cdev->flags = LED_CORE_SUSPENDRESUME; |
111 | led->cdev->brightness_set = brightness_set; | 111 | led->cdev->brightness_set = brightness_set; |
112 | led->cdev->blink_set = blink_set; | 112 | led->cdev->blink_set = blink_set; |
113 | led->cdev->default_trigger = led->default_trigger; | ||
113 | 114 | ||
114 | ret = led_classdev_register(&pdev->dev, led->cdev); | 115 | ret = led_classdev_register(&pdev->dev, led->cdev); |
115 | if (ret < 0) | 116 | if (ret < 0) |
@@ -136,12 +137,44 @@ static int __devexit asic3_led_remove(struct platform_device *pdev) | |||
136 | return mfd_cell_disable(pdev); | 137 | return mfd_cell_disable(pdev); |
137 | } | 138 | } |
138 | 139 | ||
140 | static int asic3_led_suspend(struct device *dev) | ||
141 | { | ||
142 | struct platform_device *pdev = to_platform_device(dev); | ||
143 | const struct mfd_cell *cell = mfd_get_cell(pdev); | ||
144 | int ret; | ||
145 | |||
146 | ret = 0; | ||
147 | if (cell->suspend) | ||
148 | ret = (*cell->suspend)(pdev); | ||
149 | |||
150 | return ret; | ||
151 | } | ||
152 | |||
153 | static int asic3_led_resume(struct device *dev) | ||
154 | { | ||
155 | struct platform_device *pdev = to_platform_device(dev); | ||
156 | const struct mfd_cell *cell = mfd_get_cell(pdev); | ||
157 | int ret; | ||
158 | |||
159 | ret = 0; | ||
160 | if (cell->resume) | ||
161 | ret = (*cell->resume)(pdev); | ||
162 | |||
163 | return ret; | ||
164 | } | ||
165 | |||
166 | static const struct dev_pm_ops asic3_led_pm_ops = { | ||
167 | .suspend = asic3_led_suspend, | ||
168 | .resume = asic3_led_resume, | ||
169 | }; | ||
170 | |||
139 | static struct platform_driver asic3_led_driver = { | 171 | static struct platform_driver asic3_led_driver = { |
140 | .probe = asic3_led_probe, | 172 | .probe = asic3_led_probe, |
141 | .remove = __devexit_p(asic3_led_remove), | 173 | .remove = __devexit_p(asic3_led_remove), |
142 | .driver = { | 174 | .driver = { |
143 | .name = "leds-asic3", | 175 | .name = "leds-asic3", |
144 | .owner = THIS_MODULE, | 176 | .owner = THIS_MODULE, |
177 | .pm = &asic3_led_pm_ops, | ||
145 | }, | 178 | }, |
146 | }; | 179 | }; |
147 | 180 | ||