Date: | 2011-10-04 12:04:43 (12 years 2 months ago) |
---|---|
Author: | Maarten ter Huurne |
Commit: | 85dd1596e0f79827843c569b12617228f66600c1 |
Message: | media: radio: RDA5807: Implemented suspend and resume. On suspend, disable the chip to save power. On resume, enable the chip if the radio device is not muted. |
Files: |
drivers/media/radio/radio-rda5807.c (3 diffs) |
Change Details
drivers/media/radio/radio-rda5807.c | ||
---|---|---|
36 | 36 | #include <linux/module.h> |
37 | 37 | #include <linux/i2c.h> |
38 | 38 | #include <linux/kernel.h> |
39 | #include <linux/pm.h> | |
39 | 40 | #include <linux/slab.h> |
40 | 41 | #include <linux/types.h> |
41 | 42 | #include <linux/videodev2.h> |
... | ... | |
440 | 441 | return 0; |
441 | 442 | } |
442 | 443 | |
444 | #ifdef CONFIG_PM | |
445 | ||
446 | static int rda5807_suspend(struct device *dev) | |
447 | { | |
448 | struct i2c_client *client = to_i2c_client(dev); | |
449 | struct rda5807_driver *radio = i2c_get_clientdata(client); | |
450 | ||
451 | return rda5807_set_enable(radio, 0); | |
452 | } | |
453 | ||
454 | static int rda5807_resume(struct device *dev) | |
455 | { | |
456 | struct i2c_client *client = to_i2c_client(dev); | |
457 | struct rda5807_driver *radio = i2c_get_clientdata(client); | |
458 | struct v4l2_ctrl *mute_ctrl = v4l2_ctrl_find(&radio->ctrl_handler, | |
459 | V4L2_CID_AUDIO_MUTE); | |
460 | s32 mute_val = v4l2_ctrl_g_ctrl(mute_ctrl); | |
461 | int enabled = !mute_val; | |
462 | ||
463 | if (enabled) | |
464 | return rda5807_set_enable(radio, enabled); | |
465 | else | |
466 | return 0; | |
467 | } | |
468 | ||
469 | static SIMPLE_DEV_PM_OPS(rda5807_pm_ops, rda5807_suspend, rda5807_resume); | |
470 | #define RDA5807_PM_OPS (&rda5807_pm_ops) | |
471 | ||
472 | #else | |
473 | ||
474 | #define RDA5807_PM_OPS NULL | |
475 | ||
476 | #endif | |
477 | ||
443 | 478 | static const struct i2c_device_id rda5807_id[] = { |
444 | 479 | { "radio-rda5807", 0 }, |
445 | 480 | { } |
... | ... | |
451 | 486 | .remove = __devexit_p(rda5807_i2c_remove), |
452 | 487 | .id_table = rda5807_id, |
453 | 488 | .driver = { |
454 | .name = "radio-rda5807", | |
455 | .owner = THIS_MODULE, | |
489 | .name = "radio-rda5807", | |
490 | .owner = THIS_MODULE, | |
491 | .pm = RDA5807_PM_OPS, | |
456 | 492 | }, |
457 | 493 | }; |
458 | 494 |
Branches:
ben-wpan
ben-wpan-stefan
5396a9238205f20f811ea57898980d3ca82df0b6
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9