aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorSeth Forshee <seth.forshee@canonical.com>2011-09-20 17:55:51 -0400
committerMatthew Garrett <mjg@redhat.com>2011-10-24 10:52:36 -0400
commit6e02cc7eb61aeafadb91f7b591a768cdb7a57740 (patch)
treec308c6910ed2a44dd6b23f8041d7fab897f3b3eb /drivers/platform
parent32bcd5cba02436336053d9c3b7a8ff86f889ebf4 (diff)
toshiba_acpi: Use handle for HCI calls
Now that we're using an acpi driver we already have a handle to the namespace of the HCI call, so there's no need to test various paths to the HCI call or even be aware of the path at all. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Seth Forshee <seth.forshee@canonical.com> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/toshiba_acpi.c55
1 files changed, 15 insertions, 40 deletions
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 6b281c040bc0..a924c7f77220 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -62,11 +62,7 @@ MODULE_DESCRIPTION("Toshiba Laptop ACPI Extras Driver");
62MODULE_LICENSE("GPL"); 62MODULE_LICENSE("GPL");
63 63
64/* Toshiba ACPI method paths */ 64/* Toshiba ACPI method paths */
65#define METHOD_LCD_BRIGHTNESS "\\_SB_.PCI0.VGA_.LCD_._BCM"
66#define TOSH_INTERFACE_1 "\\_SB_.VALD"
67#define TOSH_INTERFACE_2 "\\_SB_.VALZ"
68#define METHOD_VIDEO_OUT "\\_SB_.VALX.DSSX" 65#define METHOD_VIDEO_OUT "\\_SB_.VALX.DSSX"
69#define GHCI_METHOD ".GHCI"
70 66
71/* Toshiba HCI interface definitions 67/* Toshiba HCI interface definitions
72 * 68 *
@@ -121,7 +117,6 @@ struct toshiba_acpi_dev {
121 int force_fan; 117 int force_fan;
122 int last_key_event; 118 int last_key_event;
123 int key_event_valid; 119 int key_event_valid;
124 acpi_handle handle;
125 120
126 struct mutex mutex; 121 struct mutex mutex;
127}; 122};
@@ -170,15 +165,6 @@ static __inline__ void _set_bit(u32 * word, u32 mask, int value)
170/* acpi interface wrappers 165/* acpi interface wrappers
171 */ 166 */
172 167
173static int is_valid_acpi_path(const char *methodName)
174{
175 acpi_handle handle;
176 acpi_status status;
177
178 status = acpi_get_handle(NULL, (char *)methodName, &handle);
179 return !ACPI_FAILURE(status);
180}
181
182static int write_acpi_int(const char *methodName, int val) 168static int write_acpi_int(const char *methodName, int val)
183{ 169{
184 struct acpi_object_list params; 170 struct acpi_object_list params;
@@ -217,7 +203,8 @@ static acpi_status hci_raw(struct toshiba_acpi_dev *dev,
217 results.length = sizeof(out_objs); 203 results.length = sizeof(out_objs);
218 results.pointer = out_objs; 204 results.pointer = out_objs;
219 205
220 status = acpi_evaluate_object(NULL, (char *)dev->method_hci, &params, 206 status = acpi_evaluate_object(dev->acpi_dev->handle,
207 (char *)dev->method_hci, &params,
221 &results); 208 &results);
222 if ((status == AE_OK) && (out_objs->package.count <= HCI_WORDS)) { 209 if ((status == AE_OK) && (out_objs->package.count <= HCI_WORDS)) {
223 for (i = 0; i < out_objs->package.count; ++i) { 210 for (i = 0; i < out_objs->package.count; ++i) {
@@ -836,18 +823,11 @@ static const struct backlight_ops toshiba_backlight_data = {
836 .update_status = set_lcd_status, 823 .update_status = set_lcd_status,
837}; 824};
838 825
839static int __devinit toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev, 826static int __devinit toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
840 char *device_path)
841{ 827{
842 acpi_status status; 828 acpi_status status;
843 int error; 829 int error;
844 830
845 status = acpi_get_handle(NULL, device_path, &dev->handle);
846 if (ACPI_FAILURE(status)) {
847 pr_info("Unable to get notification device\n");
848 return -ENODEV;
849 }
850
851 dev->hotkey_dev = input_allocate_device(); 831 dev->hotkey_dev = input_allocate_device();
852 if (!dev->hotkey_dev) { 832 if (!dev->hotkey_dev) {
853 pr_info("Unable to register input device\n"); 833 pr_info("Unable to register input device\n");
@@ -855,14 +835,14 @@ static int __devinit toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev,
855 } 835 }
856 836
857 dev->hotkey_dev->name = "Toshiba input device"; 837 dev->hotkey_dev->name = "Toshiba input device";
858 dev->hotkey_dev->phys = device_path; 838 dev->hotkey_dev->phys = "toshiba_acpi/input0";
859 dev->hotkey_dev->id.bustype = BUS_HOST; 839 dev->hotkey_dev->id.bustype = BUS_HOST;
860 840
861 error = sparse_keymap_setup(dev->hotkey_dev, toshiba_acpi_keymap, NULL); 841 error = sparse_keymap_setup(dev->hotkey_dev, toshiba_acpi_keymap, NULL);
862 if (error) 842 if (error)
863 goto err_free_dev; 843 goto err_free_dev;
864 844
865 status = acpi_evaluate_object(dev->handle, "ENAB", NULL, NULL); 845 status = acpi_evaluate_object(dev->acpi_dev->handle, "ENAB", NULL, NULL);
866 if (ACPI_FAILURE(status)) { 846 if (ACPI_FAILURE(status)) {
867 pr_info("Unable to enable hotkeys\n"); 847 pr_info("Unable to enable hotkeys\n");
868 error = -ENODEV; 848 error = -ENODEV;
@@ -915,6 +895,8 @@ static int toshiba_acpi_remove(struct acpi_device *acpi_dev, int type)
915static int __devinit toshiba_acpi_add(struct acpi_device *acpi_dev) 895static int __devinit toshiba_acpi_add(struct acpi_device *acpi_dev)
916{ 896{
917 struct toshiba_acpi_dev *dev; 897 struct toshiba_acpi_dev *dev;
898 acpi_status status;
899 acpi_handle handle;
918 u32 hci_result; 900 u32 hci_result;
919 bool bt_present; 901 bool bt_present;
920 int ret = 0; 902 int ret = 0;
@@ -923,27 +905,20 @@ static int __devinit toshiba_acpi_add(struct acpi_device *acpi_dev)
923 pr_info("Toshiba Laptop ACPI Extras version %s\n", 905 pr_info("Toshiba Laptop ACPI Extras version %s\n",
924 TOSHIBA_ACPI_VERSION); 906 TOSHIBA_ACPI_VERSION);
925 907
908 /* simple device detection: look for HCI method */
909 status = acpi_get_handle(acpi_dev->handle, "GHCI", &handle);
910 if (ACPI_FAILURE(status))
911 return -ENODEV;
912
926 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 913 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
927 if (!dev) 914 if (!dev)
928 return -ENOMEM; 915 return -ENOMEM;
929 dev->acpi_dev = acpi_dev; 916 dev->acpi_dev = acpi_dev;
917 dev->method_hci = "GHCI";
930 acpi_dev->driver_data = dev; 918 acpi_dev->driver_data = dev;
931 919
932 /* simple device detection: look for HCI method */ 920 if (toshiba_acpi_setup_keyboard(dev))
933 if (is_valid_acpi_path(TOSH_INTERFACE_1 GHCI_METHOD)) { 921 pr_info("Unable to activate hotkeys\n");
934 dev->method_hci = TOSH_INTERFACE_1 GHCI_METHOD;
935 if (toshiba_acpi_setup_keyboard(dev, TOSH_INTERFACE_1))
936 pr_info("Unable to activate hotkeys\n");
937 } else if (is_valid_acpi_path(TOSH_INTERFACE_2 GHCI_METHOD)) {
938 dev->method_hci = TOSH_INTERFACE_2 GHCI_METHOD;
939 if (toshiba_acpi_setup_keyboard(dev, TOSH_INTERFACE_2))
940 pr_info("Unable to activate hotkeys\n");
941 } else {
942 ret = -ENODEV;
943 goto error;
944 }
945
946 pr_info("HCI method: %s\n", dev->method_hci);
947 922
948 mutex_init(&dev->mutex); 923 mutex_init(&dev->mutex);
949 924