aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/davinci
diff options
context:
space:
mode:
authorManjunath Hadli <manjunath.hadli@ti.com>2012-04-13 03:50:35 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-07-30 18:07:30 -0400
commite9530dac31c0c0296242e9209c89f5a580a2d64b (patch)
tree3721233d28c192626b90e4a0c9d730ab98518991 /drivers/media/video/davinci
parent6964b1036388fee258c48a911ac4a3ff4e55b62d (diff)
[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>
Diffstat (limited to 'drivers/media/video/davinci')
-rw-r--r--drivers/media/video/davinci/vpif_display.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c
index c3e2c193dda1..e129c98921ad 100644
--- a/drivers/media/video/davinci/vpif_display.c
+++ b/drivers/media/video/davinci/vpif_display.c
@@ -1882,10 +1882,81 @@ static int vpif_remove(struct platform_device *device)
1882 return 0; 1882 return 0;
1883} 1883}
1884 1884
1885#ifdef CONFIG_PM
1886static int vpif_suspend(struct device *dev)
1887{
1888 struct common_obj *common;
1889 struct channel_obj *ch;
1890 int i;
1891
1892 for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) {
1893 /* Get the pointer to the channel object */
1894 ch = vpif_obj.dev[i];
1895 common = &ch->common[VPIF_VIDEO_INDEX];
1896 mutex_lock(&common->lock);
1897 if (atomic_read(&ch->usrs) && common->io_usrs) {
1898 /* Disable channel */
1899 if (ch->channel_id == VPIF_CHANNEL2_VIDEO) {
1900 enable_channel2(0);
1901 channel2_intr_enable(0);
1902 }
1903 if (ch->channel_id == VPIF_CHANNEL3_VIDEO ||
1904 common->started == 2) {
1905 enable_channel3(0);
1906 channel3_intr_enable(0);
1907 }
1908 }
1909 mutex_unlock(&common->lock);
1910 }
1911
1912 return 0;
1913}
1914
1915static int vpif_resume(struct device *dev)
1916{
1917
1918 struct common_obj *common;
1919 struct channel_obj *ch;
1920 int i;
1921
1922 for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) {
1923 /* Get the pointer to the channel object */
1924 ch = vpif_obj.dev[i];
1925 common = &ch->common[VPIF_VIDEO_INDEX];
1926 mutex_lock(&common->lock);
1927 if (atomic_read(&ch->usrs) && common->io_usrs) {
1928 /* Enable channel */
1929 if (ch->channel_id == VPIF_CHANNEL2_VIDEO) {
1930 enable_channel2(1);
1931 channel2_intr_enable(1);
1932 }
1933 if (ch->channel_id == VPIF_CHANNEL3_VIDEO ||
1934 common->started == 2) {
1935 enable_channel3(1);
1936 channel3_intr_enable(1);
1937 }
1938 }
1939 mutex_unlock(&common->lock);
1940 }
1941
1942 return 0;
1943}
1944
1945static const struct dev_pm_ops vpif_pm = {
1946 .suspend = vpif_suspend,
1947 .resume = vpif_resume,
1948};
1949
1950#define vpif_pm_ops (&vpif_pm)
1951#else
1952#define vpif_pm_ops NULL
1953#endif
1954
1885static __refdata struct platform_driver vpif_driver = { 1955static __refdata struct platform_driver vpif_driver = {
1886 .driver = { 1956 .driver = {
1887 .name = "vpif_display", 1957 .name = "vpif_display",
1888 .owner = THIS_MODULE, 1958 .owner = THIS_MODULE,
1959 .pm = vpif_pm_ops,
1889 }, 1960 },
1890 .probe = vpif_probe, 1961 .probe = vpif_probe,
1891 .remove = vpif_remove, 1962 .remove = vpif_remove,