forked from Minki/linux
[media] davinci: vpif display: Add power management support
Implement power management operations - suspend and resume as part of dev_pm_ops for VPIF display 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>
This commit is contained in:
parent
6964b10363
commit
e9530dac31
@ -1882,10 +1882,81 @@ static int vpif_remove(struct platform_device *device)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_PM
|
||||||
|
static int vpif_suspend(struct device *dev)
|
||||||
|
{
|
||||||
|
struct common_obj *common;
|
||||||
|
struct channel_obj *ch;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) {
|
||||||
|
/* Get the pointer to the channel object */
|
||||||
|
ch = vpif_obj.dev[i];
|
||||||
|
common = &ch->common[VPIF_VIDEO_INDEX];
|
||||||
|
mutex_lock(&common->lock);
|
||||||
|
if (atomic_read(&ch->usrs) && common->io_usrs) {
|
||||||
|
/* Disable channel */
|
||||||
|
if (ch->channel_id == VPIF_CHANNEL2_VIDEO) {
|
||||||
|
enable_channel2(0);
|
||||||
|
channel2_intr_enable(0);
|
||||||
|
}
|
||||||
|
if (ch->channel_id == VPIF_CHANNEL3_VIDEO ||
|
||||||
|
common->started == 2) {
|
||||||
|
enable_channel3(0);
|
||||||
|
channel3_intr_enable(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mutex_unlock(&common->lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int vpif_resume(struct device *dev)
|
||||||
|
{
|
||||||
|
|
||||||
|
struct common_obj *common;
|
||||||
|
struct channel_obj *ch;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) {
|
||||||
|
/* Get the pointer to the channel object */
|
||||||
|
ch = vpif_obj.dev[i];
|
||||||
|
common = &ch->common[VPIF_VIDEO_INDEX];
|
||||||
|
mutex_lock(&common->lock);
|
||||||
|
if (atomic_read(&ch->usrs) && common->io_usrs) {
|
||||||
|
/* Enable channel */
|
||||||
|
if (ch->channel_id == VPIF_CHANNEL2_VIDEO) {
|
||||||
|
enable_channel2(1);
|
||||||
|
channel2_intr_enable(1);
|
||||||
|
}
|
||||||
|
if (ch->channel_id == VPIF_CHANNEL3_VIDEO ||
|
||||||
|
common->started == 2) {
|
||||||
|
enable_channel3(1);
|
||||||
|
channel3_intr_enable(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mutex_unlock(&common->lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct dev_pm_ops vpif_pm = {
|
||||||
|
.suspend = vpif_suspend,
|
||||||
|
.resume = vpif_resume,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define vpif_pm_ops (&vpif_pm)
|
||||||
|
#else
|
||||||
|
#define vpif_pm_ops NULL
|
||||||
|
#endif
|
||||||
|
|
||||||
static __refdata struct platform_driver vpif_driver = {
|
static __refdata struct platform_driver vpif_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "vpif_display",
|
.name = "vpif_display",
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
|
.pm = vpif_pm_ops,
|
||||||
},
|
},
|
||||||
.probe = vpif_probe,
|
.probe = vpif_probe,
|
||||||
.remove = vpif_remove,
|
.remove = vpif_remove,
|
||||||
|
Loading…
Reference in New Issue
Block a user