aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLad, Prabhakar <prabhakar.csengg@gmail.com>2014-05-16 09:33:50 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-05-24 15:43:24 -0400
commitb7047713bda9c21f97494985e96b3bc7df1d0af1 (patch)
tree0149584253050ea1d5a49f9e2e923cbc1b58ac5e
parent7b4657fa45a9273d64060667d2558f600a573db7 (diff)
[media] media: davinci: vpif_capture: use SIMPLE_DEV_PM_OPS
this patch uses SIMPLE_DEV_PM_OPS, and drops unneeded members from io_usrs, usrs and makes use of vb2 helepers instead. Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/platform/davinci/vpif_capture.c63
-rw-r--r--drivers/media/platform/davinci/vpif_capture.h4
2 files changed, 30 insertions, 37 deletions
diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 799c226d0995..ce532034ba7c 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -1647,7 +1647,7 @@ static int vpif_remove(struct platform_device *device)
1647 return 0; 1647 return 0;
1648} 1648}
1649 1649
1650#ifdef CONFIG_PM 1650#ifdef CONFIG_PM_SLEEP
1651/** 1651/**
1652 * vpif_suspend: vpif device suspend 1652 * vpif_suspend: vpif device suspend
1653 */ 1653 */
@@ -1662,18 +1662,20 @@ static int vpif_suspend(struct device *dev)
1662 /* Get the pointer to the channel object */ 1662 /* Get the pointer to the channel object */
1663 ch = vpif_obj.dev[i]; 1663 ch = vpif_obj.dev[i];
1664 common = &ch->common[VPIF_VIDEO_INDEX]; 1664 common = &ch->common[VPIF_VIDEO_INDEX];
1665
1666 if (!vb2_is_streaming(&common->buffer_queue))
1667 continue;
1668
1665 mutex_lock(&common->lock); 1669 mutex_lock(&common->lock);
1666 if (ch->usrs && common->io_usrs) { 1670 /* Disable channel */
1667 /* Disable channel */ 1671 if (ch->channel_id == VPIF_CHANNEL0_VIDEO) {
1668 if (ch->channel_id == VPIF_CHANNEL0_VIDEO) { 1672 enable_channel0(0);
1669 enable_channel0(0); 1673 channel0_intr_enable(0);
1670 channel0_intr_enable(0); 1674 }
1671 } 1675 if (ch->channel_id == VPIF_CHANNEL1_VIDEO ||
1672 if (ch->channel_id == VPIF_CHANNEL1_VIDEO || 1676 ycmux_mode == 2) {
1673 ycmux_mode == 2) { 1677 enable_channel1(0);
1674 enable_channel1(0); 1678 channel1_intr_enable(0);
1675 channel1_intr_enable(0);
1676 }
1677 } 1679 }
1678 mutex_unlock(&common->lock); 1680 mutex_unlock(&common->lock);
1679 } 1681 }
@@ -1694,40 +1696,35 @@ static int vpif_resume(struct device *dev)
1694 /* Get the pointer to the channel object */ 1696 /* Get the pointer to the channel object */
1695 ch = vpif_obj.dev[i]; 1697 ch = vpif_obj.dev[i];
1696 common = &ch->common[VPIF_VIDEO_INDEX]; 1698 common = &ch->common[VPIF_VIDEO_INDEX];
1699
1700 if (!vb2_is_streaming(&common->buffer_queue))
1701 continue;
1702
1697 mutex_lock(&common->lock); 1703 mutex_lock(&common->lock);
1698 if (ch->usrs && common->io_usrs) { 1704 /* Enable channel */
1699 /* Disable channel */ 1705 if (ch->channel_id == VPIF_CHANNEL0_VIDEO) {
1700 if (ch->channel_id == VPIF_CHANNEL0_VIDEO) { 1706 enable_channel0(1);
1701 enable_channel0(1); 1707 channel0_intr_enable(1);
1702 channel0_intr_enable(1); 1708 }
1703 } 1709 if (ch->channel_id == VPIF_CHANNEL1_VIDEO ||
1704 if (ch->channel_id == VPIF_CHANNEL1_VIDEO || 1710 ycmux_mode == 2) {
1705 ycmux_mode == 2) { 1711 enable_channel1(1);
1706 enable_channel1(1); 1712 channel1_intr_enable(1);
1707 channel1_intr_enable(1);
1708 }
1709 } 1713 }
1710 mutex_unlock(&common->lock); 1714 mutex_unlock(&common->lock);
1711 } 1715 }
1712 1716
1713 return 0; 1717 return 0;
1714} 1718}
1715
1716static const struct dev_pm_ops vpif_dev_pm_ops = {
1717 .suspend = vpif_suspend,
1718 .resume = vpif_resume,
1719};
1720
1721#define vpif_pm_ops (&vpif_dev_pm_ops)
1722#else
1723#define vpif_pm_ops NULL
1724#endif 1719#endif
1725 1720
1721static SIMPLE_DEV_PM_OPS(vpif_pm_ops, vpif_suspend, vpif_resume);
1722
1726static __refdata struct platform_driver vpif_driver = { 1723static __refdata struct platform_driver vpif_driver = {
1727 .driver = { 1724 .driver = {
1728 .name = VPIF_DRIVER_NAME, 1725 .name = VPIF_DRIVER_NAME,
1729 .owner = THIS_MODULE, 1726 .owner = THIS_MODULE,
1730 .pm = vpif_pm_ops, 1727 .pm = &vpif_pm_ops,
1731 }, 1728 },
1732 .probe = vpif_probe, 1729 .probe = vpif_probe,
1733 .remove = vpif_remove, 1730 .remove = vpif_remove,
diff --git a/drivers/media/platform/davinci/vpif_capture.h b/drivers/media/platform/davinci/vpif_capture.h
index 4960504a5108..ebf2da99cc41 100644
--- a/drivers/media/platform/davinci/vpif_capture.h
+++ b/drivers/media/platform/davinci/vpif_capture.h
@@ -75,8 +75,6 @@ struct common_obj {
75 spinlock_t irqlock; 75 spinlock_t irqlock;
76 /* lock used to access this structure */ 76 /* lock used to access this structure */
77 struct mutex lock; 77 struct mutex lock;
78 /* number of users performing IO */
79 u32 io_usrs;
80 /* Function pointer to set the addresses */ 78 /* Function pointer to set the addresses */
81 void (*set_addr) (unsigned long, unsigned long, unsigned long, 79 void (*set_addr) (unsigned long, unsigned long, unsigned long,
82 unsigned long); 80 unsigned long);
@@ -97,8 +95,6 @@ struct common_obj {
97struct channel_obj { 95struct channel_obj {
98 /* Identifies video device for this channel */ 96 /* Identifies video device for this channel */
99 struct video_device *video_dev; 97 struct video_device *video_dev;
100 /* number of open instances of the channel */
101 int usrs;
102 /* Indicates id of the field which is being displayed */ 98 /* Indicates id of the field which is being displayed */
103 u32 field_id; 99 u32 field_id;
104 /* flag to indicate whether decoder is initialized */ 100 /* flag to indicate whether decoder is initialized */