diff options
author | Manjunath Hadli <manjunath.hadli@ti.com> | 2012-04-13 03:50:55 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-07-30 18:08:20 -0400 |
commit | 3d5946dcfd4d221126f3f190c5ca4ea41c20f138 (patch) | |
tree | 1e7451ef7b202754162210826f8aa30a40507ce7 /drivers/media/video/davinci | |
parent | e9530dac31c0c0296242e9209c89f5a580a2d64b (diff) |
[media] davinci: vpif capture:Add power management support
Implement power management operations - suspend and resume as part of
dev_pm_ops for VPIF capture driver.
Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com>
Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/davinci')
-rw-r--r-- | drivers/media/video/davinci/vpif_capture.c | 73 |
1 files changed, 61 insertions, 12 deletions
diff --git a/drivers/media/video/davinci/vpif_capture.c b/drivers/media/video/davinci/vpif_capture.c index 1d4427aa08a5..2727919fe251 100644 --- a/drivers/media/video/davinci/vpif_capture.c +++ b/drivers/media/video/davinci/vpif_capture.c | |||
@@ -2312,26 +2312,70 @@ static int vpif_remove(struct platform_device *device) | |||
2312 | return 0; | 2312 | return 0; |
2313 | } | 2313 | } |
2314 | 2314 | ||
2315 | #ifdef CONFIG_PM | ||
2315 | /** | 2316 | /** |
2316 | * vpif_suspend: vpif device suspend | 2317 | * vpif_suspend: vpif device suspend |
2317 | * | ||
2318 | * TODO: Add suspend code here | ||
2319 | */ | 2318 | */ |
2320 | static int | 2319 | static int vpif_suspend(struct device *dev) |
2321 | vpif_suspend(struct device *dev) | ||
2322 | { | 2320 | { |
2323 | return -1; | 2321 | |
2322 | struct common_obj *common; | ||
2323 | struct channel_obj *ch; | ||
2324 | int i; | ||
2325 | |||
2326 | for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) { | ||
2327 | /* Get the pointer to the channel object */ | ||
2328 | ch = vpif_obj.dev[i]; | ||
2329 | common = &ch->common[VPIF_VIDEO_INDEX]; | ||
2330 | mutex_lock(&common->lock); | ||
2331 | if (ch->usrs && common->io_usrs) { | ||
2332 | /* Disable channel */ | ||
2333 | if (ch->channel_id == VPIF_CHANNEL0_VIDEO) { | ||
2334 | enable_channel0(0); | ||
2335 | channel0_intr_enable(0); | ||
2336 | } | ||
2337 | if (ch->channel_id == VPIF_CHANNEL1_VIDEO || | ||
2338 | common->started == 2) { | ||
2339 | enable_channel1(0); | ||
2340 | channel1_intr_enable(0); | ||
2341 | } | ||
2342 | } | ||
2343 | mutex_unlock(&common->lock); | ||
2344 | } | ||
2345 | |||
2346 | return 0; | ||
2324 | } | 2347 | } |
2325 | 2348 | ||
2326 | /** | 2349 | /* |
2327 | * vpif_resume: vpif device suspend | 2350 | * vpif_resume: vpif device suspend |
2328 | * | ||
2329 | * TODO: Add resume code here | ||
2330 | */ | 2351 | */ |
2331 | static int | 2352 | static int vpif_resume(struct device *dev) |
2332 | vpif_resume(struct device *dev) | ||
2333 | { | 2353 | { |
2334 | return -1; | 2354 | struct common_obj *common; |
2355 | struct channel_obj *ch; | ||
2356 | int i; | ||
2357 | |||
2358 | for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) { | ||
2359 | /* Get the pointer to the channel object */ | ||
2360 | ch = vpif_obj.dev[i]; | ||
2361 | common = &ch->common[VPIF_VIDEO_INDEX]; | ||
2362 | mutex_lock(&common->lock); | ||
2363 | if (ch->usrs && common->io_usrs) { | ||
2364 | /* Disable channel */ | ||
2365 | if (ch->channel_id == VPIF_CHANNEL0_VIDEO) { | ||
2366 | enable_channel0(1); | ||
2367 | channel0_intr_enable(1); | ||
2368 | } | ||
2369 | if (ch->channel_id == VPIF_CHANNEL1_VIDEO || | ||
2370 | common->started == 2) { | ||
2371 | enable_channel1(1); | ||
2372 | channel1_intr_enable(1); | ||
2373 | } | ||
2374 | } | ||
2375 | mutex_unlock(&common->lock); | ||
2376 | } | ||
2377 | |||
2378 | return 0; | ||
2335 | } | 2379 | } |
2336 | 2380 | ||
2337 | static const struct dev_pm_ops vpif_dev_pm_ops = { | 2381 | static const struct dev_pm_ops vpif_dev_pm_ops = { |
@@ -2339,11 +2383,16 @@ static const struct dev_pm_ops vpif_dev_pm_ops = { | |||
2339 | .resume = vpif_resume, | 2383 | .resume = vpif_resume, |
2340 | }; | 2384 | }; |
2341 | 2385 | ||
2386 | #define vpif_pm_ops (&vpif_dev_pm_ops) | ||
2387 | #else | ||
2388 | #define vpif_pm_ops NULL | ||
2389 | #endif | ||
2390 | |||
2342 | static __refdata struct platform_driver vpif_driver = { | 2391 | static __refdata struct platform_driver vpif_driver = { |
2343 | .driver = { | 2392 | .driver = { |
2344 | .name = "vpif_capture", | 2393 | .name = "vpif_capture", |
2345 | .owner = THIS_MODULE, | 2394 | .owner = THIS_MODULE, |
2346 | .pm = &vpif_dev_pm_ops, | 2395 | .pm = vpif_pm_ops, |
2347 | }, | 2396 | }, |
2348 | .probe = vpif_probe, | 2397 | .probe = vpif_probe, |
2349 | .remove = vpif_remove, | 2398 | .remove = vpif_remove, |