Lines Matching +full:led +full:- +full:s

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2015-2016 Endless Mobile, Inc.
29 struct led_classdev led; member
57 acpi_status s; in asus_wireless_method() local
59 acpi_handle_debug(handle, "Evaluating method %s, parameter %#x\n", in asus_wireless_method()
66 s = acpi_evaluate_integer(handle, (acpi_string) method, &p, ret); in asus_wireless_method()
67 if (ACPI_FAILURE(s)) in asus_wireless_method()
69 "Failed to eval method %s, param %#x (%d)\n", in asus_wireless_method()
70 method, param, s); in asus_wireless_method()
72 acpi_handle_debug(handle, "%s returned %#llx\n", method, *ret); in asus_wireless_method()
74 return s; in asus_wireless_method()
77 static enum led_brightness led_state_get(struct led_classdev *led) in led_state_get() argument
80 acpi_status s; in led_state_get() local
83 data = container_of(led, struct asus_wireless_data, led); in led_state_get()
84 s = asus_wireless_method(acpi_device_handle(data->adev), "HSWC", in led_state_get()
85 data->hswc_params->status, &ret); in led_state_get()
86 if (ACPI_SUCCESS(s) && ret == data->hswc_params->on) in led_state_get()
97 asus_wireless_method(acpi_device_handle(data->adev), "HSWC", in led_state_update()
98 data->led_state, &ret); in led_state_update()
101 static void led_state_set(struct led_classdev *led, enum led_brightness value) in led_state_set() argument
105 data = container_of(led, struct asus_wireless_data, led); in led_state_set()
106 data->led_state = value == LED_OFF ? data->hswc_params->off : in led_state_set()
107 data->hswc_params->on; in led_state_set()
108 queue_work(data->wq, &data->led_work); in led_state_set()
115 dev_dbg(&adev->dev, "event=%#x\n", event); in asus_wireless_notify()
117 dev_notice(&adev->dev, "Unknown ASHS event: %#x\n", event); in asus_wireless_notify()
120 input_report_key(data->idev, KEY_RFKILL, 1); in asus_wireless_notify()
121 input_sync(data->idev); in asus_wireless_notify()
122 input_report_key(data->idev, KEY_RFKILL, 0); in asus_wireless_notify()
123 input_sync(data->idev); in asus_wireless_notify()
132 data = devm_kzalloc(&adev->dev, sizeof(*data), GFP_KERNEL); in asus_wireless_add()
134 return -ENOMEM; in asus_wireless_add()
135 adev->driver_data = data; in asus_wireless_add()
136 data->adev = adev; in asus_wireless_add()
138 data->idev = devm_input_allocate_device(&adev->dev); in asus_wireless_add()
139 if (!data->idev) in asus_wireless_add()
140 return -ENOMEM; in asus_wireless_add()
141 data->idev->name = "Asus Wireless Radio Control"; in asus_wireless_add()
142 data->idev->phys = "asus-wireless/input0"; in asus_wireless_add()
143 data->idev->id.bustype = BUS_HOST; in asus_wireless_add()
144 data->idev->id.vendor = PCI_VENDOR_ID_ASUSTEK; in asus_wireless_add()
145 set_bit(EV_KEY, data->idev->evbit); in asus_wireless_add()
146 set_bit(KEY_RFKILL, data->idev->keybit); in asus_wireless_add()
147 err = input_register_device(data->idev); in asus_wireless_add()
155 data->hswc_params = (const struct hswc_params *)id->driver_data; in asus_wireless_add()
157 data->wq = create_singlethread_workqueue("asus_wireless_workqueue"); in asus_wireless_add()
158 if (!data->wq) in asus_wireless_add()
159 return -ENOMEM; in asus_wireless_add()
160 INIT_WORK(&data->led_work, led_state_update); in asus_wireless_add()
161 data->led.name = "asus-wireless::airplane"; in asus_wireless_add()
162 data->led.brightness_set = led_state_set; in asus_wireless_add()
163 data->led.brightness_get = led_state_get; in asus_wireless_add()
164 data->led.flags = LED_CORE_SUSPENDRESUME; in asus_wireless_add()
165 data->led.max_brightness = 1; in asus_wireless_add()
166 data->led.default_trigger = "rfkill-none"; in asus_wireless_add()
167 err = devm_led_classdev_register(&adev->dev, &data->led); in asus_wireless_add()
169 destroy_workqueue(data->wq); in asus_wireless_add()
178 if (data->wq) { in asus_wireless_remove()
179 devm_led_classdev_unregister(&adev->dev, &data->led); in asus_wireless_remove()
180 destroy_workqueue(data->wq); in asus_wireless_remove()