Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: drivers/media/video/samsung/tv20/tv_power_s5pv210.c

Issue 2036011: V4L/DVB : Add S5PV210 TV out driver support (Closed) Base URL: swsolcc@12.23.106.100:kernel-samsung.git
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /* linux/drivers/media/video/samsung/tv20/tv_power_s5pv210.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PV210 - power raw ftn file for Samsung TVOut driver
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13 #include <linux/module.h>
14 #include <linux/kernel.h>
15 #include <linux/delay.h>
16 #include <linux/platform_device.h>
17
18 #include <linux/uaccess.h>
19 #include <linux/io.h>
20
21 #include <mach/map.h>
22 #include <mach/regs-clock.h>
23
24 #include "tv_out_s5pv210.h"
25
26 #if defined USE_POWERCON_FUNCTION
27 #undef USE_POWERCON_FUNCTION
28 #endif
29
30 #ifdef CONFIG_TVOUT_RAW_DBG
31 #define S5P_TVOUT_PM_DEBUG 1
32 #endif
33
34 #ifdef S5P_TVOUT_PM_DEBUG
35 #define TVPMPRINTK(fmt, args...) \
36 printk(KERN_INFO "\t\t[TVPM] %s: " fmt, __func__ , ## args)
37 #else
38 #define TVPMPRINTK(fmt, args...)
39 #endif
40
41 /* NORMAL_CFG */
42 #define TVPWR_SUBSYSTEM_ACTIVE (1<<4)
43 #define TVPWR_SUBSYSTEM_LP (0<<4)
44
45 /* MTC_STABLE */
46 #define TVPWR_MTC_COUNTER_CLEAR(a) (((~0xf)<<16)&a)
47 #define TVPWR_MTC_COUNTER_SET(a) ((0xf&a)<<16)
48
49 /* BLK_PWR_STAT */
50 #define TVPWR_TV_BLOCK_STATUS(a) ((0x1<<4)&a)
51
52 /* DAC Power */
53 static unsigned short g_dacPwrOn;
54
55 void tv_power_init_mtc_stable_counter(unsigned int value)
56 {
57 TVPMPRINTK("(%d)\n\r", value);
58
59 writel(TVPWR_MTC_COUNTER_CLEAR((readl(S5P_MTC_STABLE) |
60 TVPWR_MTC_COUNTER_SET(value))), S5P_MTC_STABLE);
61
62 TVPMPRINTK("(0x%08x)\n\r", readl(S5P_MTC_STABLE));
63 }
64
65 void tv_powerinitialize_dac_onoff(unsigned short on)
66 {
67 TVPMPRINTK("(%d)\n\r", on);
68
69 g_dacPwrOn = on;
70
71 TVPMPRINTK("(0x%08x)\n\r", g_dacPwrOn);
72 }
73
74 void tv_powerset_dac_onoff(unsigned short on)
75 {
76 TVPMPRINTK("(%d)\n\r", on);
77
78 if (on)
79 writel(S5P_DAC_ENABLE, S5P_DAC_CONTROL);
80 else
81 writel(S5P_DAC_DISABLE, S5P_DAC_CONTROL);
82
83 TVPMPRINTK("(0x%08x)\n\r", readl(S5P_DAC_CONTROL));
84 }
85
86
87 unsigned short tv_power_get_power_status(void)
88 {
89 TVPMPRINTK("(0x%08x)\n\r", readl(S5P_BLK_PWR_STAT));
90
91
92 return TVPWR_TV_BLOCK_STATUS(readl(S5P_BLK_PWR_STAT)) ? 1 : 0;
93 }
94
95 unsigned short tv_power_get_dac_power_status(void)
96 {
97 TVPMPRINTK("()\n\r");
98
99 TVPMPRINTK("(0x%08x)\n\r", readl(S5P_DAC_CONTROL));
100
101 return (readl(S5P_DAC_CONTROL) & S5P_DAC_ENABLE) ? 1 : 0;
102 }
103
104 void tv_poweron(void)
105 {
106 TVPMPRINTK("0x%08x\n\r", readl(S3C_VA_SYS + 0xE804));
107
108 writel(readl(S3C_VA_SYS + 0xE804) | 0x1, S3C_VA_SYS + 0xE804);
109
110 writel(readl(S5P_NORMAL_CFG) | TVPWR_SUBSYSTEM_ACTIVE, S5P_NORMAL_CFG);
111
112 while (!TVPWR_TV_BLOCK_STATUS(readl(S5P_BLK_PWR_STAT)))
113 msleep(1);
114
115 TVPMPRINTK("0x%08x,0x%08x)\n\r",
116 readl(S5P_NORMAL_CFG), readl(S5P_BLK_PWR_STAT));
117 }
118
119
120 void tv_poweroff(void)
121 {
122 TVPMPRINTK("()\n\r");
123
124 tv_powerset_dac_onoff(0);
125
126 writel(readl(S5P_NORMAL_CFG) & ~TVPWR_SUBSYSTEM_ACTIVE, S5P_NORMAL_CFG);
127
128 while (TVPWR_TV_BLOCK_STATUS(readl(S5P_BLK_PWR_STAT)))
129 msleep(1);
130
131 TVPMPRINTK("0x%08x,0x%08x)\n\r",
132 readl(S5P_NORMAL_CFG), readl(S5P_BLK_PWR_STAT));
133 }
OLDNEW
« no previous file with comments | « drivers/media/video/samsung/tv20/tv_out_s5pv210.h ('k') | drivers/media/video/samsung/tv20/vmixer_s5pv210.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698