Lines Matching refs:pcc

219 static int acpi_pcc_write_sset(struct pcc_acpi *pcc, int func, int val)  in acpi_pcc_write_sset()  argument
233 status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SSET, in acpi_pcc_write_sset()
255 static int acpi_pcc_retrieve_biosdata(struct pcc_acpi *pcc) in acpi_pcc_retrieve_biosdata() argument
262 status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SINF, NULL, in acpi_pcc_retrieve_biosdata()
277 if (pcc->num_sifr < hkey->package.count) { in acpi_pcc_retrieve_biosdata()
287 pcc->sinf[i] = element->integer.value; in acpi_pcc_retrieve_biosdata()
292 pcc->sinf[hkey->package.count] = -1; in acpi_pcc_retrieve_biosdata()
308 struct pcc_acpi *pcc = bl_get_data(bd); in bl_get() local
310 if (!acpi_pcc_retrieve_biosdata(pcc)) in bl_get()
313 return pcc->sinf[SINF_AC_CUR_BRIGHT]; in bl_get()
318 struct pcc_acpi *pcc = bl_get_data(bd); in bl_set_status() local
322 if (!acpi_pcc_retrieve_biosdata(pcc)) in bl_set_status()
325 if (bright < pcc->sinf[SINF_AC_MIN_BRIGHT]) in bl_set_status()
326 bright = pcc->sinf[SINF_AC_MIN_BRIGHT]; in bl_set_status()
328 if (bright < pcc->sinf[SINF_DC_MIN_BRIGHT]) in bl_set_status()
329 bright = pcc->sinf[SINF_DC_MIN_BRIGHT]; in bl_set_status()
331 if (bright < pcc->sinf[SINF_AC_MIN_BRIGHT] || in bl_set_status()
332 bright > pcc->sinf[SINF_AC_MAX_BRIGHT]) in bl_set_status()
335 rc = acpi_pcc_write_sset(pcc, SINF_AC_CUR_BRIGHT, bright); in bl_set_status()
339 return acpi_pcc_write_sset(pcc, SINF_DC_CUR_BRIGHT, bright); in bl_set_status()
354 struct pcc_acpi *pcc = acpi_driver_data(acpi); in show_numbatt() local
356 if (!acpi_pcc_retrieve_biosdata(pcc)) in show_numbatt()
359 return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_NUM_BATTERIES]); in show_numbatt()
366 struct pcc_acpi *pcc = acpi_driver_data(acpi); in show_lcdtype() local
368 if (!acpi_pcc_retrieve_biosdata(pcc)) in show_lcdtype()
371 return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_LCD_TYPE]); in show_lcdtype()
378 struct pcc_acpi *pcc = acpi_driver_data(acpi); in show_mute() local
380 if (!acpi_pcc_retrieve_biosdata(pcc)) in show_mute()
383 return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_MUTE]); in show_mute()
390 struct pcc_acpi *pcc = acpi_driver_data(acpi); in show_sticky() local
392 if (!acpi_pcc_retrieve_biosdata(pcc)) in show_sticky()
395 return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_STICKY_KEY]); in show_sticky()
402 struct pcc_acpi *pcc = acpi_driver_data(acpi); in set_sticky() local
407 acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, val); in set_sticky()
408 pcc->sticky_mode = val; in set_sticky()
436 static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc) in acpi_pcc_generate_keyinput() argument
438 struct input_dev *hotk_input_dev = pcc->input_dev; in acpi_pcc_generate_keyinput()
442 rc = acpi_evaluate_integer(pcc->handle, METHOD_HKEY_QUERY, in acpi_pcc_generate_keyinput()
467 struct pcc_acpi *pcc = acpi_driver_data(device); in acpi_pcc_hotkey_notify() local
471 acpi_pcc_generate_keyinput(pcc); in acpi_pcc_hotkey_notify()
479 static int acpi_pcc_init_input(struct pcc_acpi *pcc) in acpi_pcc_init_input() argument
509 pcc->input_dev = input_dev; in acpi_pcc_init_input()
522 struct pcc_acpi *pcc; in acpi_pcc_hotkey_resume() local
527 pcc = acpi_driver_data(to_acpi_device(dev)); in acpi_pcc_hotkey_resume()
528 if (!pcc) in acpi_pcc_hotkey_resume()
532 pcc->sticky_mode)); in acpi_pcc_hotkey_resume()
534 return acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_mode); in acpi_pcc_hotkey_resume()
541 struct pcc_acpi *pcc; in acpi_pcc_hotkey_add() local
554 pcc = kzalloc(sizeof(struct pcc_acpi), GFP_KERNEL); in acpi_pcc_hotkey_add()
555 if (!pcc) { in acpi_pcc_hotkey_add()
561 pcc->sinf = kcalloc(num_sifr + 1, sizeof(u32), GFP_KERNEL); in acpi_pcc_hotkey_add()
562 if (!pcc->sinf) { in acpi_pcc_hotkey_add()
567 pcc->device = device; in acpi_pcc_hotkey_add()
568 pcc->handle = device->handle; in acpi_pcc_hotkey_add()
569 pcc->num_sifr = num_sifr; in acpi_pcc_hotkey_add()
570 device->driver_data = pcc; in acpi_pcc_hotkey_add()
574 result = acpi_pcc_init_input(pcc); in acpi_pcc_hotkey_add()
581 if (!acpi_pcc_retrieve_biosdata(pcc)) { in acpi_pcc_hotkey_add()
590 props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT]; in acpi_pcc_hotkey_add()
591 pcc->backlight = backlight_device_register("panasonic", NULL, pcc, in acpi_pcc_hotkey_add()
593 if (IS_ERR(pcc->backlight)) { in acpi_pcc_hotkey_add()
594 result = PTR_ERR(pcc->backlight); in acpi_pcc_hotkey_add()
599 pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT]; in acpi_pcc_hotkey_add()
602 pcc->sticky_mode = pcc->sinf[SINF_STICKY_KEY]; in acpi_pcc_hotkey_add()
612 backlight_device_unregister(pcc->backlight); in acpi_pcc_hotkey_add()
614 input_unregister_device(pcc->input_dev); in acpi_pcc_hotkey_add()
616 kfree(pcc->sinf); in acpi_pcc_hotkey_add()
618 kfree(pcc); in acpi_pcc_hotkey_add()
625 struct pcc_acpi *pcc = acpi_driver_data(device); in acpi_pcc_hotkey_remove() local
627 if (!device || !pcc) in acpi_pcc_hotkey_remove()
632 backlight_device_unregister(pcc->backlight); in acpi_pcc_hotkey_remove()
634 input_unregister_device(pcc->input_dev); in acpi_pcc_hotkey_remove()
636 kfree(pcc->sinf); in acpi_pcc_hotkey_remove()
637 kfree(pcc); in acpi_pcc_hotkey_remove()