• Home
  • Raw
  • Download

Lines Matching +full:merge +full:- +full:mute

1 // SPDX-License-Identifier: GPL-2.0-only
4 * (C) 2004 Hiroshi Miura <miura@da-cha.org>
8 * (C) 2006-2008 Harald Welte <laforge@gnumonks.org>
10 * derived from toshiba_acpi.c, Copyright (C) 2002-2004 John Belmonte
12 *---------------------------------------------------------------------------
16 * -v0.95 rename driver from drivers/acpi/pcc_acpi.c to
17 * drivers/misc/panasonic-laptop.c
20 * -v0.94 replace /proc interface with device attributes
24 * -v0.92 merge with 2.6.26-rc6 input API changes
32 * -v0.91 merge with 2.6.24-rc6 ACPI changes
34 * Nov.04, 2006 Hiroshi Miura <miura@da-cha.org>
35 * -v0.9 remove warning about section reference.
38 * merge dbronaugh's enhancement
40 * - Added screen brightness setting interface
44 * May.29, 2006 Hiroshi Miura <miura@da-cha.org>
45 * -v0.8.4 follow to change keyinput structure
46 * thanks Fabian Yamaguchi <fabs@cs.tu-berlin.de>,
50 * Oct.02, 2004 Hiroshi Miura <miura@da-cha.org>
51 * -v0.8.2 merge code of YOKOTA Hiroshi
56 * Sep.15, 2004 Hiroshi Miura <miura@da-cha.org>
57 * -v0.8 Generate key input event on input subsystem.
61 * Sep.10, 2004 Hiroshi Miura <miura@da-cha.org>
62 * -v0.7 Change proc interface functions using seq_file
65 * Aug.28, 2004 Hiroshi Miura <miura@da-cha.org>
66 * -v0.6.4 Fix a silly error with status checking
68 * Aug.25, 2004 Hiroshi Miura <miura@da-cha.org>
69 * -v0.6.3 replace read_acpi_int by standard function
76 * -v0.6.2 Add check on ACPI data (num_sifr)
78 * Fixed an off-by-one error in memory allocation
81 * -v0.6.1 Fix a silly error with status checking
84 * - v0.6 Correct brightness controls to reflect reality
88 * Aug.10, 2004 Hiroshi Miura <miura@da-cha.org>
89 * - v0.5 support LCD brightness control
92 * Jul.25, 2004 Hiroshi Miura <miura@da-cha.org>
93 * - v0.4 first post version
96 * Jul.24, 2004 Hiroshi Miura <miura@da-cha.org>
97 * - v0.3 get proper status of hotkey
99 * Jul.22, 2004 Hiroshi Miura <miura@da-cha.org>
100 * - v0.2 add HotKey handler
102 * Jul.17, 2004 Hiroshi Miura <miura@da-cha.org>
103 * - v0.1 start from toshiba_acpi driver written by John Belmonte
117 #include <linux/input/sparse-keymap.h>
145 /* LCD_TYPEs: 0 = Normal, 1 = Semi-transparent
233 status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SSET, in acpi_pcc_write_sset()
236 return (status == AE_OK) ? 0 : -EIO; in acpi_pcc_write_sset()
244 status = acpi_evaluate_integer(device->handle, METHOD_HKEY_SQTY, in acpi_pcc_get_sqty()
251 return -EINVAL; in acpi_pcc_get_sqty()
262 status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SINF, NULL, in acpi_pcc_retrieve_biosdata()
271 if (!hkey || (hkey->type != ACPI_TYPE_PACKAGE)) { in acpi_pcc_retrieve_biosdata()
277 if (pcc->num_sifr < hkey->package.count) { in acpi_pcc_retrieve_biosdata()
284 for (i = 0; i < hkey->package.count; i++) { in acpi_pcc_retrieve_biosdata()
285 union acpi_object *element = &(hkey->package.elements[i]); in acpi_pcc_retrieve_biosdata()
286 if (likely(element->type == ACPI_TYPE_INTEGER)) { 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()
311 return -EIO; in bl_get()
313 return pcc->sinf[SINF_AC_CUR_BRIGHT]; in bl_get()
319 int bright = bd->props.brightness; in bl_set_status()
323 return -EIO; 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()
333 return -EINVAL; in bl_set_status()
357 return -EIO; in show_numbatt()
359 return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_NUM_BATTERIES]); in show_numbatt()
369 return -EIO; in show_lcdtype()
371 return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_LCD_TYPE]); in show_lcdtype()
381 return -EIO; in show_mute()
383 return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_MUTE]); in show_mute()
393 return -EIO; in show_sticky()
395 return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_STICKY_KEY]); in show_sticky()
408 pcc->sticky_mode = val; in set_sticky()
416 static DEVICE_ATTR(mute, S_IRUGO, show_mute, NULL);
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()
486 return -ENOMEM; in acpi_pcc_init_input()
488 input_dev->name = ACPI_PCC_DRIVER_NAME; in acpi_pcc_init_input()
489 input_dev->phys = ACPI_PCC_INPUT_PHYS; in acpi_pcc_init_input()
490 input_dev->id.bustype = BUS_HOST; in acpi_pcc_init_input()
491 input_dev->id.vendor = 0x0001; in acpi_pcc_init_input()
492 input_dev->id.product = 0x0001; in acpi_pcc_init_input()
493 input_dev->id.version = 0x0100; in acpi_pcc_init_input()
509 pcc->input_dev = input_dev; in acpi_pcc_init_input()
525 return -EINVAL; in acpi_pcc_hotkey_resume()
529 return -EINVAL; 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()
545 return -EINVAL; in acpi_pcc_hotkey_add()
551 return -ENODEV; in acpi_pcc_hotkey_add()
558 return -ENOMEM; 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()
563 result = -ENOMEM; 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()
584 result = -EIO; 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()
605 result = sysfs_create_group(&device->dev.kobj, &pcc_attr_group); 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()
628 return -EINVAL; in acpi_pcc_hotkey_remove()
630 sysfs_remove_group(&device->dev.kobj, &pcc_attr_group); 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()