|
Lines 137-144
static inline int acpi_pcc_get_sqty(stru
Link Here
|
| 137 |
return(s); |
137 |
return(s); |
| 138 |
} |
138 |
} |
| 139 |
else { |
139 |
else { |
| 140 |
printk(PCC_ERR "acpi_pcc_get_sqty() evaluation error \ |
140 |
printk(PCC_ERR "acpi_pcc_get_sqty() evaluation error " |
| 141 |
HKEY.SQTY\n"); |
141 |
"HKEY.SQTY\n"); |
| 142 |
return(-EINVAL); |
142 |
return(-EINVAL); |
| 143 |
} |
143 |
} |
| 144 |
} |
144 |
} |
|
Lines 152-172
static int acpi_pcc_retrieve_biosdata(st
Link Here
|
| 152 |
|
152 |
|
| 153 |
status = acpi_evaluate_object(hotkey->handle, "SINF", 0 , &buffer); |
153 |
status = acpi_evaluate_object(hotkey->handle, "SINF", 0 , &buffer); |
| 154 |
if (ACPI_FAILURE(status)) { |
154 |
if (ACPI_FAILURE(status)) { |
| 155 |
printk(PCC_ERR "acpi_pcc_retrieve_biosdata() evaluation error \ |
155 |
printk(PCC_ERR "acpi_pcc_retrieve_biosdata() evaluation error " |
| 156 |
HKEY.SINF\n"); |
156 |
"HKEY.SINF\n"); |
| 157 |
return 0; |
157 |
return 0; |
| 158 |
} |
158 |
} |
| 159 |
|
159 |
|
| 160 |
hkey = buffer.pointer; |
160 |
hkey = buffer.pointer; |
| 161 |
if (!hkey || (hkey->type != ACPI_TYPE_PACKAGE)) { |
161 |
if (!hkey || (hkey->type != ACPI_TYPE_PACKAGE)) { |
| 162 |
printk(PCC_ERR "acpi_pcc_retrieve_biosdata() invalid \ |
162 |
printk(PCC_ERR "acpi_pcc_retrieve_biosdata() invalid " |
| 163 |
HKEY.SINF\n"); |
163 |
"HKEY.SINF\n"); |
| 164 |
goto end; |
164 |
goto end; |
| 165 |
} |
165 |
} |
| 166 |
|
166 |
|
| 167 |
if (hotkey->num_sifr < hkey->package.count) { |
167 |
if (hotkey->num_sifr < hkey->package.count) { |
| 168 |
printk(PCC_ERR "acpi_pcc_retrieve_biosdata() SQTY reports bad \ |
168 |
printk(PCC_ERR "acpi_pcc_retrieve_biosdata() SQTY reports bad " |
| 169 |
SINF length\n"); |
169 |
"SINF length\n"); |
| 170 |
status = AE_ERROR; |
170 |
status = AE_ERROR; |
| 171 |
goto end; |
171 |
goto end; |
| 172 |
} |
172 |
} |
|
Lines 177-184
static int acpi_pcc_retrieve_biosdata(st
Link Here
|
| 177 |
sinf[i] = element->integer.value; |
177 |
sinf[i] = element->integer.value; |
| 178 |
} |
178 |
} |
| 179 |
else { |
179 |
else { |
| 180 |
printk(PCC_ERR "acpi_pcc_retrieve_biosdata() invalid \ |
180 |
printk(PCC_ERR "acpi_pcc_retrieve_biosdata() invalid " |
| 181 |
HKEY.SINF data"); |
181 |
"HKEY.SINF data"); |
| 182 |
} |
182 |
} |
| 183 |
} |
183 |
} |
| 184 |
sinf[hkey->package.count] = -1; |
184 |
sinf[hkey->package.count] = -1; |
|
Lines 187-196
end:
Link Here
|
| 187 |
acpi_os_free(buffer.pointer); |
187 |
acpi_os_free(buffer.pointer); |
| 188 |
|
188 |
|
| 189 |
if (status != AE_OK) { |
189 |
if (status != AE_OK) { |
| 190 |
return -1; |
190 |
return 0; |
| 191 |
} |
191 |
} |
| 192 |
|
192 |
|
| 193 |
return 0; |
193 |
return 1; |
| 194 |
} |
194 |
} |
| 195 |
|
195 |
|
| 196 |
static int acpi_pcc_read_sinf_field(struct seq_file *seq, int field) |
196 |
static int acpi_pcc_read_sinf_field(struct seq_file *seq, int field) |
|
Lines 199-206
static int acpi_pcc_read_sinf_field(stru
Link Here
|
| 199 |
u32* sinf = kmalloc(sizeof(u32) * (hotkey->num_sifr + 1), GFP_KERNEL); |
199 |
u32* sinf = kmalloc(sizeof(u32) * (hotkey->num_sifr + 1), GFP_KERNEL); |
| 200 |
|
200 |
|
| 201 |
if (!sinf) { |
201 |
if (!sinf) { |
| 202 |
printk(PCC_ERR "acpi_pcc_read_sinf_field() could not allocate \ |
202 |
printk(PCC_ERR "acpi_pcc_read_sinf_field() could not allocate " |
| 203 |
%li bytes\n", sizeof(u32) * hotkey->num_sifr); |
203 |
"%li bytes\n", sizeof(u32) * hotkey->num_sifr); |
| 204 |
return 0; |
204 |
return 0; |
| 205 |
} |
205 |
} |
| 206 |
|
206 |
|
|
Lines 208-215
static int acpi_pcc_read_sinf_field(stru
Link Here
|
| 208 |
seq_printf(seq, "%u\n", sinf[field]); |
208 |
seq_printf(seq, "%u\n", sinf[field]); |
| 209 |
} |
209 |
} |
| 210 |
else { |
210 |
else { |
| 211 |
printk(PCC_ERR "acpi_pcc_read_sinf_field() could not retrieve \ |
211 |
seq_printf(seq, "error"); |
| 212 |
BIOS data\n"); |
212 |
printk(PCC_ERR "acpi_pcc_read_sinf_field() could not retrieve " |
|
|
213 |
"BIOS data\n"); |
| 213 |
} |
214 |
} |
| 214 |
|
215 |
|
| 215 |
kfree(sinf); |
216 |
kfree(sinf); |
|
Lines 321-328
static unsigned long acpi_pcc_write_brig
Link Here
|
| 321 |
} |
322 |
} |
| 322 |
|
323 |
|
| 323 |
if (!sinf) { |
324 |
if (!sinf) { |
| 324 |
printk(PCC_ERR "acpi_pcc_write_brightness() could not \ |
325 |
printk(PCC_ERR "acpi_pcc_write_brightness() could not " |
| 325 |
allocate %li bytes\n", |
326 |
"allocate %li bytes\n", |
| 326 |
sizeof(u32) * hotkey->num_sifr); |
327 |
sizeof(u32) * hotkey->num_sifr); |
| 327 |
return -EFAULT; |
328 |
return -EFAULT; |
| 328 |
} |
329 |
} |
|
Lines 334-341
static unsigned long acpi_pcc_write_brig
Link Here
|
| 334 |
write_string[count] = '\0'; |
335 |
write_string[count] = '\0'; |
| 335 |
|
336 |
|
| 336 |
if (!acpi_pcc_retrieve_biosdata(hotkey, sinf)) { |
337 |
if (!acpi_pcc_retrieve_biosdata(hotkey, sinf)) { |
| 337 |
printk(PCC_ERR "acpi_pcc_write_brightness() could not \ |
338 |
printk(PCC_ERR "acpi_pcc_write_brightness() could not " |
| 338 |
retrieve BIOS data\n"); |
339 |
"retrieve BIOS data\n"); |
| 339 |
goto end; |
340 |
goto end; |
| 340 |
} |
341 |
} |
| 341 |
|
342 |
|
|
Lines 444-451
static void acpi_pcc_generete_keyinput(s
Link Here
|
| 444 |
hkey_num = hinf & 0xf; |
445 |
hkey_num = hinf & 0xf; |
| 445 |
|
446 |
|
| 446 |
if ((0 > hkey_num) || (hkey_num > ARRAY_SIZE(key_map))) { |
447 |
if ((0 > hkey_num) || (hkey_num > ARRAY_SIZE(key_map))) { |
| 447 |
printk(PCC_ERR "acpi_pcc_generete_keyinput() hotkey \ |
448 |
printk(PCC_ERR "acpi_pcc_generete_keyinput() hotkey " |
| 448 |
number (%d) out of range\n", hkey_num); |
449 |
"number (%d) out of range\n", hkey_num); |
| 449 |
return; |
450 |
return; |
| 450 |
} |
451 |
} |
| 451 |
|
452 |
|
|
Lines 471-478
static int acpi_pcc_hotkey_get_key(struc
Link Here
|
| 471 |
hotkey->status = result; |
472 |
hotkey->status = result; |
| 472 |
} |
473 |
} |
| 473 |
else { |
474 |
else { |
| 474 |
printk(PCC_ERR "acpi_pcc_hotkey_get_key() error getting \ |
475 |
printk(PCC_ERR "acpi_pcc_hotkey_get_key() error getting " |
| 475 |
hotkey status\n"); |
476 |
"hotkey status\n"); |
| 476 |
} |
477 |
} |
| 477 |
|
478 |
|
| 478 |
if (status != AE_OK) { |
479 |
if (status != AE_OK) { |
|
Lines 687-694
static int __init acpi_pcc_proc_init(str
Link Here
|
| 687 |
acpi_pcc_dir = proc_mkdir(PROC_PCC, acpi_root_dir); |
688 |
acpi_pcc_dir = proc_mkdir(PROC_PCC, acpi_root_dir); |
| 688 |
|
689 |
|
| 689 |
if (unlikely(!acpi_pcc_dir)) { |
690 |
if (unlikely(!acpi_pcc_dir)) { |
| 690 |
printk(PCC_ERR "acpi_pcc_proc_init() could not create proc \ |
691 |
printk(PCC_ERR "acpi_pcc_proc_init() could not create proc " |
| 691 |
entry\n"); |
692 |
"entry\n"); |
| 692 |
return -ENODEV; |
693 |
return -ENODEV; |
| 693 |
} |
694 |
} |
| 694 |
|
695 |
|
|
Lines 745-760
static int acpi_pcc_init_input(struct ac
Link Here
|
| 745 |
hotk_input_dev = kmalloc(sizeof(struct input_dev),GFP_KERNEL); |
746 |
hotk_input_dev = kmalloc(sizeof(struct input_dev),GFP_KERNEL); |
| 746 |
|
747 |
|
| 747 |
if (!hotk_input_dev) { |
748 |
if (!hotk_input_dev) { |
| 748 |
printk(PCC_ERR "acpi_pcc_init_input() could not allocate \ |
749 |
printk(PCC_ERR "acpi_pcc_init_input() could not allocate " |
| 749 |
memory\n"); |
750 |
"memory\n"); |
| 750 |
return -ENOMEM; |
751 |
return -ENOMEM; |
| 751 |
} |
752 |
} |
| 752 |
|
753 |
|
| 753 |
pcc_keyinput = kmalloc(sizeof(struct pcc_keyinput),GFP_KERNEL); |
754 |
pcc_keyinput = kmalloc(sizeof(struct pcc_keyinput),GFP_KERNEL); |
| 754 |
|
755 |
|
| 755 |
if (!pcc_keyinput) { |
756 |
if (!pcc_keyinput) { |
| 756 |
printk(PCC_ERR "acpi_pcc_init_input() could not allocate \ |
757 |
printk(PCC_ERR "acpi_pcc_init_input() could not allocate " |
| 757 |
memory\n"); |
758 |
"memory\n"); |
| 758 |
return -ENOMEM; |
759 |
return -ENOMEM; |
| 759 |
} |
760 |
} |
| 760 |
|
761 |
|
|
Lines 806-821
static int acpi_pcc_hotkey_add (struct a
Link Here
|
| 806 |
num_sifr = acpi_pcc_get_sqty(device); |
807 |
num_sifr = acpi_pcc_get_sqty(device); |
| 807 |
|
808 |
|
| 808 |
if (num_sifr > 255) { |
809 |
if (num_sifr > 255) { |
| 809 |
printk(PCC_ERR "acpi_pcc_hotkey_add() num_sifr too large \ |
810 |
printk(PCC_ERR "acpi_pcc_hotkey_add() num_sifr too large " |
| 810 |
(%i)\n", num_sifr); |
811 |
"(%i)\n", num_sifr); |
| 811 |
return -ENODEV; |
812 |
return -ENODEV; |
| 812 |
} |
813 |
} |
| 813 |
|
814 |
|
| 814 |
hotkey = kmalloc(sizeof(struct acpi_hotkey), GFP_KERNEL); |
815 |
hotkey = kmalloc(sizeof(struct acpi_hotkey), GFP_KERNEL); |
| 815 |
|
816 |
|
| 816 |
if (!hotkey) { |
817 |
if (!hotkey) { |
| 817 |
printk(PCC_ERR "acpi_pcc_hotkey_add() could not allocate \ |
818 |
printk(PCC_ERR "acpi_pcc_hotkey_add() could not allocate " |
| 818 |
memory\n"); |
819 |
"memory\n"); |
| 819 |
return -ENOMEM; |
820 |
return -ENOMEM; |
| 820 |
} |
821 |
} |
| 821 |
|
822 |
|
|
Lines 835-842
static int acpi_pcc_hotkey_add (struct a
Link Here
|
| 835 |
hotkey); |
836 |
hotkey); |
| 836 |
|
837 |
|
| 837 |
if (ACPI_FAILURE(status)) { |
838 |
if (ACPI_FAILURE(status)) { |
| 838 |
printk(PCC_ERR "acpi_pcc_hotkey_add() error installing notify \ |
839 |
printk(PCC_ERR "acpi_pcc_hotkey_add() error installing notify " |
| 839 |
handler\n"); |
840 |
"handler\n"); |
| 840 |
kfree(hotkey); |
841 |
kfree(hotkey); |
| 841 |
return -ENODEV; |
842 |
return -ENODEV; |
| 842 |
} |
843 |
} |
|
Lines 844-851
static int acpi_pcc_hotkey_add (struct a
Link Here
|
| 844 |
result = acpi_pcc_init_input(hotkey); |
845 |
result = acpi_pcc_init_input(hotkey); |
| 845 |
|
846 |
|
| 846 |
if (result) { |
847 |
if (result) { |
| 847 |
printk(PCC_ERR "acpi_pcc_hotkey_add() error installing input \ |
848 |
printk(PCC_ERR "acpi_pcc_hotkey_add() error installing input " |
| 848 |
handler\n"); |
849 |
"handler\n"); |
| 849 |
kfree(hotkey); |
850 |
kfree(hotkey); |
| 850 |
return result; |
851 |
return result; |
| 851 |
} |
852 |
} |
|
Lines 874-883
static int acpi_pcc_hotkey_remove(struct
Link Here
|
| 874 |
ACPI_DEVICE_NOTIFY, acpi_pcc_hotkey_notify); |
875 |
ACPI_DEVICE_NOTIFY, acpi_pcc_hotkey_notify); |
| 875 |
|
876 |
|
| 876 |
if (ACPI_FAILURE(status)) { |
877 |
if (ACPI_FAILURE(status)) { |
| 877 |
printk(PCC_ERR "acpi_pcc_hotkey_remove() error removing \ |
878 |
printk(PCC_ERR "acpi_pcc_hotkey_remove() error removing " |
| 878 |
notify handler\n"); |
879 |
"notify handler\n"); |
| 879 |
} |
880 |
} |
| 880 |
|
881 |
|
|
|
882 |
input_unregister_device(hotkey->input_dev); |
| 883 |
|
| 881 |
kfree(hotkey); |
884 |
kfree(hotkey); |
| 882 |
|
885 |
|
| 883 |
if(status != AE_OK) { |
886 |
if(status != AE_OK) { |