1 --- kernel-power-2.6.28/drivers/media/radio/radio-si4713.c 2012-02-17 20:44:03.508286080 +0100
2 +++ kernel-power-2.6.28/drivers/media/radio/radio-si4713.c 2012-02-17 20:45:13.976284020 +0100
4 static int radio_nr = -1; /* radio device minor (-1 ==> auto assign) */
6 /* properties lock for write operations */
7 -static int config_locked;
8 +static int config_locked = 1;
10 -/* saved power levels */
11 -static unsigned int max_pl;
12 -static unsigned int min_pl;
14 -/* structure for pid registration */
17 - struct list_head plist;
20 -#define APP_MAX_NUM 2
22 -static int pid_count;
23 -static LIST_HEAD(pid_list_head);
24 -static struct si4713_device *si4713_dev;
25 +/* module param for initial power level */
26 +static int init_power_level = 120;
30 @@ -193,17 +180,15 @@ static ssize_t si4713_lock_write(struct
39 sscanf(buf, "%d", &l);
43 + if (l != 0 && l != 1)
50 static ssize_t si4713_lock_read(struct device *dev,
51 @@ -219,7 +196,7 @@ static DEVICE_ATTR(lock, S_IRUGO | S_IWU
53 * Power level property
55 -/* power_level (rw) 88 - 115 or 0 */
56 +/* power_level (rw) 88 - 120 or 0 */
57 static ssize_t si4713_power_level_write(struct device *dev,
58 struct device_attribute *attr,
60 @@ -230,7 +207,7 @@ static ssize_t si4713_power_level_write(
69 @@ -420,109 +397,13 @@ static irqreturn_t si4713_handler(int ir
73 -static int register_pid(pid_t pid)
75 - struct pid_list *pitem;
77 - list_for_each_entry(pitem, &pid_list_head, plist) {
78 - if (pitem->pid == pid)
82 - pitem = kmalloc(sizeof(struct pid_list), GFP_KERNEL);
89 - list_add(&(pitem->plist), &pid_list_head);
95 -static int unregister_pid(pid_t pid)
97 - struct pid_list *pitem, *n;
99 - list_for_each_entry_safe(pitem, n, &pid_list_head, plist) {
100 - if (pitem->pid == pid) {
101 - list_del(&(pitem->plist));
112 static int si4713_priv_ioctl(struct inode *inode, struct file *file,
113 unsigned int cmd, unsigned long arg)
118 if (cmd != LOCK_LOW_POWER && cmd != RELEASE_LOW_POWER)
119 return video_ioctl2(inode, file, cmd, arg);
121 - pl = si4713_get_power_level(si4713_dev);
128 - if (copy_from_user(&pow, (void __user *)arg, sizeof(pow))) {
133 - if (cmd == LOCK_LOW_POWER) {
135 - if (pid_count == APP_MAX_NUM) {
140 - if (pid_count == 0) {
145 - /* Set max possible power level */
151 - rval = register_pid(current->pid);
156 - /* Lower min power level if asked */
162 - } else { /* RELEASE_LOW_POWER */
163 - rval = unregister_pid(current->pid);
168 - if (pid_count == 0) {
173 - rval = si4713_set_power_level(si4713_dev, pow);
181 @@ -906,8 +787,11 @@ static int si4713_i2c_driver_probe(struc
185 - /* save to global pointer for it to be accesible from ioctl() call */
187 + rval = si4713_set_power_level(sdev, init_power_level);
189 + dev_dbg(&client->dev, "Failed to set initial power level.\n");
195 @@ -1013,6 +897,12 @@ module_param(radio_nr, int, 0);
196 MODULE_PARM_DESC(radio_nr,
197 "Minor number for radio device (-1 ==> auto assign)");
199 +module_param(init_power_level, int, 120);
200 +MODULE_PARM_DESC(init_power_level, "Initial value of power level (default 120)");
202 +module_param(config_locked, int, 1);
203 +MODULE_PARM_DESC(config_locked, "Lock power level configuration on init (default 1 - locked)");
205 MODULE_LICENSE("GPL");
206 MODULE_AUTHOR(DRIVER_AUTHOR);
207 MODULE_DESCRIPTION(DRIVER_DESC);