Lines Matching refs:pcc
283 static int acpi_pcc_write_sset(struct pcc_acpi *pcc, int func, int val) in acpi_pcc_write_sset() argument
297 status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SSET, in acpi_pcc_write_sset()
318 static int acpi_pcc_retrieve_biosdata(struct pcc_acpi *pcc) in acpi_pcc_retrieve_biosdata() argument
325 status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SINF, NULL, in acpi_pcc_retrieve_biosdata()
339 if (pcc->num_sifr < hkey->package.count) { in acpi_pcc_retrieve_biosdata()
348 pcc->sinf[i] = element->integer.value; in acpi_pcc_retrieve_biosdata()
352 pcc->sinf[hkey->package.count] = -1; in acpi_pcc_retrieve_biosdata()
368 struct pcc_acpi *pcc = bl_get_data(bd); in bl_get() local
370 if (!acpi_pcc_retrieve_biosdata(pcc)) in bl_get()
373 return pcc->sinf[SINF_AC_CUR_BRIGHT]; in bl_get()
378 struct pcc_acpi *pcc = bl_get_data(bd); in bl_set_status() local
382 if (!acpi_pcc_retrieve_biosdata(pcc)) in bl_set_status()
385 if (bright < pcc->sinf[SINF_AC_MIN_BRIGHT]) in bl_set_status()
386 bright = pcc->sinf[SINF_AC_MIN_BRIGHT]; in bl_set_status()
388 if (bright < pcc->sinf[SINF_DC_MIN_BRIGHT]) in bl_set_status()
389 bright = pcc->sinf[SINF_DC_MIN_BRIGHT]; in bl_set_status()
391 if (bright < pcc->sinf[SINF_AC_MIN_BRIGHT] || in bl_set_status()
392 bright > pcc->sinf[SINF_AC_MAX_BRIGHT]) in bl_set_status()
395 rc = acpi_pcc_write_sset(pcc, SINF_AC_CUR_BRIGHT, bright); in bl_set_status()
399 return acpi_pcc_write_sset(pcc, SINF_DC_CUR_BRIGHT, bright); in bl_set_status()
506 struct pcc_acpi *pcc = acpi_driver_data(acpi); in numbatt_show() local
508 if (!acpi_pcc_retrieve_biosdata(pcc)) in numbatt_show()
511 return sysfs_emit(buf, "%u\n", pcc->sinf[SINF_NUM_BATTERIES]); in numbatt_show()
518 struct pcc_acpi *pcc = acpi_driver_data(acpi); in lcdtype_show() local
520 if (!acpi_pcc_retrieve_biosdata(pcc)) in lcdtype_show()
523 return sysfs_emit(buf, "%u\n", pcc->sinf[SINF_LCD_TYPE]); in lcdtype_show()
530 struct pcc_acpi *pcc = acpi_driver_data(acpi); in mute_show() local
532 if (!acpi_pcc_retrieve_biosdata(pcc)) in mute_show()
535 return sysfs_emit(buf, "%u\n", pcc->sinf[SINF_MUTE]); in mute_show()
542 struct pcc_acpi *pcc = acpi_driver_data(acpi); in mute_store() local
549 acpi_pcc_write_sset(pcc, SINF_MUTE, val); in mute_store()
550 pcc->mute = val; in mute_store()
560 struct pcc_acpi *pcc = acpi_driver_data(acpi); in sticky_key_show() local
562 if (!acpi_pcc_retrieve_biosdata(pcc)) in sticky_key_show()
565 return sysfs_emit(buf, "%u\n", pcc->sticky_key); in sticky_key_show()
572 struct pcc_acpi *pcc = acpi_driver_data(acpi); in sticky_key_store() local
579 acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, val); in sticky_key_store()
580 pcc->sticky_key = val; in sticky_key_store()
590 struct pcc_acpi *pcc = acpi_driver_data(acpi); in eco_mode_show() local
593 if (!acpi_pcc_retrieve_biosdata(pcc)) in eco_mode_show()
596 switch (pcc->sinf[SINF_ECO_MODE]) { in eco_mode_show()
614 struct pcc_acpi *pcc = acpi_driver_data(acpi); in eco_mode_store() local
634 pcc->sinf[SINF_ECO_MODE] = 0; in eco_mode_store()
635 pcc->eco_mode = 0; in eco_mode_store()
639 pcc->sinf[SINF_ECO_MODE] = 1; in eco_mode_store()
640 pcc->eco_mode = 1; in eco_mode_store()
661 struct pcc_acpi *pcc = acpi_driver_data(acpi); in ac_brightness_show() local
663 if (!acpi_pcc_retrieve_biosdata(pcc)) in ac_brightness_show()
666 return sysfs_emit(buf, "%u\n", pcc->sinf[SINF_AC_CUR_BRIGHT]); in ac_brightness_show()
673 struct pcc_acpi *pcc = acpi_driver_data(acpi); in ac_brightness_store() local
680 acpi_pcc_write_sset(pcc, SINF_AC_CUR_BRIGHT, val); in ac_brightness_store()
681 pcc->ac_brightness = val; in ac_brightness_store()
691 struct pcc_acpi *pcc = acpi_driver_data(acpi); in dc_brightness_show() local
693 if (!acpi_pcc_retrieve_biosdata(pcc)) in dc_brightness_show()
696 return sysfs_emit(buf, "%u\n", pcc->sinf[SINF_DC_CUR_BRIGHT]); in dc_brightness_show()
703 struct pcc_acpi *pcc = acpi_driver_data(acpi); in dc_brightness_store() local
710 acpi_pcc_write_sset(pcc, SINF_DC_CUR_BRIGHT, val); in dc_brightness_store()
711 pcc->dc_brightness = val; in dc_brightness_store()
721 struct pcc_acpi *pcc = acpi_driver_data(acpi); in current_brightness_show() local
723 if (!acpi_pcc_retrieve_biosdata(pcc)) in current_brightness_show()
726 return sysfs_emit(buf, "%u\n", pcc->sinf[SINF_CUR_BRIGHT]); in current_brightness_show()
733 struct pcc_acpi *pcc = acpi_driver_data(acpi); in current_brightness_store() local
741 err = acpi_pcc_write_sset(pcc, SINF_CUR_BRIGHT, val); in current_brightness_store()
742 pcc->current_brightness = val; in current_brightness_store()
798 static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc) in acpi_pcc_generate_keyinput() argument
800 struct input_dev *hotk_input_dev = pcc->input_dev; in acpi_pcc_generate_keyinput()
806 rc = acpi_evaluate_integer(pcc->handle, METHOD_HKEY_QUERY, in acpi_pcc_generate_keyinput()
838 struct pcc_acpi *pcc = acpi_driver_data(device); in acpi_pcc_hotkey_notify() local
842 acpi_pcc_generate_keyinput(pcc); in acpi_pcc_hotkey_notify()
858 static int pcc_register_optd_notifier(struct pcc_acpi *pcc, char *node) in pcc_register_optd_notifier() argument
868 pcc_optd_notify, pcc); in pcc_register_optd_notifier()
877 static void pcc_unregister_optd_notifier(struct pcc_acpi *pcc, char *node) in pcc_unregister_optd_notifier() argument
894 static int acpi_pcc_init_input(struct pcc_acpi *pcc) in acpi_pcc_init_input() argument
922 pcc->input_dev = input_dev; in acpi_pcc_init_input()
935 struct pcc_acpi *pcc; in acpi_pcc_hotkey_resume() local
940 pcc = acpi_driver_data(to_acpi_device(dev)); in acpi_pcc_hotkey_resume()
941 if (!pcc) in acpi_pcc_hotkey_resume()
944 acpi_pcc_write_sset(pcc, SINF_MUTE, pcc->mute); in acpi_pcc_hotkey_resume()
945 acpi_pcc_write_sset(pcc, SINF_ECO_MODE, pcc->eco_mode); in acpi_pcc_hotkey_resume()
946 acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_key); in acpi_pcc_hotkey_resume()
947 acpi_pcc_write_sset(pcc, SINF_AC_CUR_BRIGHT, pcc->ac_brightness); in acpi_pcc_hotkey_resume()
948 acpi_pcc_write_sset(pcc, SINF_DC_CUR_BRIGHT, pcc->dc_brightness); in acpi_pcc_hotkey_resume()
949 acpi_pcc_write_sset(pcc, SINF_CUR_BRIGHT, pcc->current_brightness); in acpi_pcc_hotkey_resume()
958 struct pcc_acpi *pcc; in acpi_pcc_hotkey_add() local
971 pcc = kzalloc(sizeof(struct pcc_acpi), GFP_KERNEL); in acpi_pcc_hotkey_add()
972 if (!pcc) { in acpi_pcc_hotkey_add()
977 pcc->sinf = kcalloc(num_sifr + 1, sizeof(u32), GFP_KERNEL); in acpi_pcc_hotkey_add()
978 if (!pcc->sinf) { in acpi_pcc_hotkey_add()
983 pcc->device = device; in acpi_pcc_hotkey_add()
984 pcc->handle = device->handle; in acpi_pcc_hotkey_add()
985 pcc->num_sifr = num_sifr; in acpi_pcc_hotkey_add()
986 device->driver_data = pcc; in acpi_pcc_hotkey_add()
990 result = acpi_pcc_init_input(pcc); in acpi_pcc_hotkey_add()
996 if (!acpi_pcc_retrieve_biosdata(pcc)) { in acpi_pcc_hotkey_add()
1006 props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT]; in acpi_pcc_hotkey_add()
1008 pcc->backlight = backlight_device_register("panasonic", NULL, pcc, in acpi_pcc_hotkey_add()
1010 if (IS_ERR(pcc->backlight)) { in acpi_pcc_hotkey_add()
1011 result = PTR_ERR(pcc->backlight); in acpi_pcc_hotkey_add()
1016 pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT]; in acpi_pcc_hotkey_add()
1020 acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, 0); in acpi_pcc_hotkey_add()
1021 pcc->sticky_key = 0; in acpi_pcc_hotkey_add()
1023 pcc->eco_mode = pcc->sinf[SINF_ECO_MODE]; in acpi_pcc_hotkey_add()
1024 pcc->mute = pcc->sinf[SINF_MUTE]; in acpi_pcc_hotkey_add()
1025 pcc->ac_brightness = pcc->sinf[SINF_AC_CUR_BRIGHT]; in acpi_pcc_hotkey_add()
1026 pcc->dc_brightness = pcc->sinf[SINF_DC_CUR_BRIGHT]; in acpi_pcc_hotkey_add()
1027 pcc->current_brightness = pcc->sinf[SINF_CUR_BRIGHT]; in acpi_pcc_hotkey_add()
1036 pcc->platform = platform_device_register_simple("panasonic", in acpi_pcc_hotkey_add()
1038 if (IS_ERR(pcc->platform)) { in acpi_pcc_hotkey_add()
1039 result = PTR_ERR(pcc->platform); in acpi_pcc_hotkey_add()
1042 result = device_create_file(&pcc->platform->dev, in acpi_pcc_hotkey_add()
1044 pcc_register_optd_notifier(pcc, "\\_SB.PCI0.EHCI.ERHB.OPTD"); in acpi_pcc_hotkey_add()
1048 pcc->platform = NULL; in acpi_pcc_hotkey_add()
1055 platform_device_unregister(pcc->platform); in acpi_pcc_hotkey_add()
1057 backlight_device_unregister(pcc->backlight); in acpi_pcc_hotkey_add()
1059 input_unregister_device(pcc->input_dev); in acpi_pcc_hotkey_add()
1061 kfree(pcc->sinf); in acpi_pcc_hotkey_add()
1063 kfree(pcc); in acpi_pcc_hotkey_add()
1070 struct pcc_acpi *pcc = acpi_driver_data(device); in acpi_pcc_hotkey_remove() local
1072 if (!device || !pcc) in acpi_pcc_hotkey_remove()
1077 if (pcc->platform) { in acpi_pcc_hotkey_remove()
1078 device_remove_file(&pcc->platform->dev, &dev_attr_cdpower); in acpi_pcc_hotkey_remove()
1079 platform_device_unregister(pcc->platform); in acpi_pcc_hotkey_remove()
1081 pcc_unregister_optd_notifier(pcc, "\\_SB.PCI0.EHCI.ERHB.OPTD"); in acpi_pcc_hotkey_remove()
1085 backlight_device_unregister(pcc->backlight); in acpi_pcc_hotkey_remove()
1087 input_unregister_device(pcc->input_dev); in acpi_pcc_hotkey_remove()
1089 kfree(pcc->sinf); in acpi_pcc_hotkey_remove()
1090 kfree(pcc); in acpi_pcc_hotkey_remove()