History

platform/x86: nvidia-wmi-ec-backlight: Move fw interface definitions to a header (v2)

Move the WMI interface definitions to a header, so that the definitions can be shared with drivers/acpi/video_detect.c . Changes in v2: - Add missing Nvidia copyright header - Move WMI_BRIGHTNESS_GUID to nvidia-wmi-ec-backlight.h as well

Hans de Goede committed 4 years ago

Commit 3db2aeb1 parent 5e0e33f3 files · +78 −67Browse files

Unified · Split

3 files
  1. MAINTAINERS +1 −0
  2. drivers/platform/x86/nvidia-wmi-ec-backlight.c +1 −67
  3. include/linux/platform_data/x86/nvidia-wmi-ec-backlight.h +76 −0
MAINTAINERS+1−0
@@ -14526,6 +14526,7 @@ M: Daniel Dadap <ddadap@nvidia.com> · 14525 unmodified lines
14526L: platform-driver-x86@vger.kernel.org14526L: platform-driver-x86@vger.kernel.org
14527S: Supported14527S: Supported
14528F: drivers/platform/x86/nvidia-wmi-ec-backlight.c14528F: drivers/platform/x86/nvidia-wmi-ec-backlight.c
14529F: include/linux/platform_data/x86/nvidia-wmi-ec-backlight.h
14529 14530
14530NVM EXPRESS DRIVER14531NVM EXPRESS DRIVER
14531M: Keith Busch <kbusch@kernel.org>14532M: Keith Busch <kbusch@kernel.org>
drivers/platform/x86/nvidia-wmi-ec-backlight.c+1−67
@@ -7,74 +7,10 @@ · 6 unmodified lines
7#include <linux/backlight.h>7#include <linux/backlight.h>
8#include <linux/mod_devicetable.h>8#include <linux/mod_devicetable.h>
9#include <linux/module.h>9#include <linux/module.h>
10#include <linux/platform_data/x86/nvidia-wmi-ec-backlight.h>
10#include <linux/types.h>11#include <linux/types.h>
11#include <linux/wmi.h>12#include <linux/wmi.h>
12 13
13/**
14 * enum wmi_brightness_method - WMI method IDs
15 * @WMI_BRIGHTNESS_METHOD_LEVEL: Get/Set EC brightness level status
16 * @WMI_BRIGHTNESS_METHOD_SOURCE: Get/Set EC Brightness Source
17 */
18enum wmi_brightness_method {
19 WMI_BRIGHTNESS_METHOD_LEVEL = 1,
20 WMI_BRIGHTNESS_METHOD_SOURCE = 2,
21 WMI_BRIGHTNESS_METHOD_MAX
22};
23
24/**
25 * enum wmi_brightness_mode - Operation mode for WMI-wrapped method
26 * @WMI_BRIGHTNESS_MODE_GET: Get the current brightness level/source.
27 * @WMI_BRIGHTNESS_MODE_SET: Set the brightness level.
28 * @WMI_BRIGHTNESS_MODE_GET_MAX_LEVEL: Get the maximum brightness level. This
29 * is only valid when the WMI method is
30 * %WMI_BRIGHTNESS_METHOD_LEVEL.
31 */
32enum wmi_brightness_mode {
33 WMI_BRIGHTNESS_MODE_GET = 0,
34 WMI_BRIGHTNESS_MODE_SET = 1,
35 WMI_BRIGHTNESS_MODE_GET_MAX_LEVEL = 2,
36 WMI_BRIGHTNESS_MODE_MAX
37};
38
39/**
40 * enum wmi_brightness_source - Backlight brightness control source selection
41 * @WMI_BRIGHTNESS_SOURCE_GPU: Backlight brightness is controlled by the GPU.
42 * @WMI_BRIGHTNESS_SOURCE_EC: Backlight brightness is controlled by the
43 * system's Embedded Controller (EC).
44 * @WMI_BRIGHTNESS_SOURCE_AUX: Backlight brightness is controlled over the
45 * DisplayPort AUX channel.
46 */
47enum wmi_brightness_source {
48 WMI_BRIGHTNESS_SOURCE_GPU = 1,
49 WMI_BRIGHTNESS_SOURCE_EC = 2,
50 WMI_BRIGHTNESS_SOURCE_AUX = 3,
51 WMI_BRIGHTNESS_SOURCE_MAX
52};
53
54/**
55 * struct wmi_brightness_args - arguments for the WMI-wrapped ACPI method
56 * @mode: Pass in an &enum wmi_brightness_mode value to select between
57 * getting or setting a value.
58 * @val: In parameter for value to set when using %WMI_BRIGHTNESS_MODE_SET
59 * mode. Not used in conjunction with %WMI_BRIGHTNESS_MODE_GET or
60 * %WMI_BRIGHTNESS_MODE_GET_MAX_LEVEL mode.
61 * @ret: Out parameter returning retrieved value when operating in
62 * %WMI_BRIGHTNESS_MODE_GET or %WMI_BRIGHTNESS_MODE_GET_MAX_LEVEL
63 * mode. Not used in %WMI_BRIGHTNESS_MODE_SET mode.
64 * @ignored: Padding; not used. The ACPI method expects a 24 byte params struct.
65 *
66 * This is the parameters structure for the WmiBrightnessNotify ACPI method as
67 * wrapped by WMI. The value passed in to @val or returned by @ret will be a
68 * brightness value when the WMI method ID is %WMI_BRIGHTNESS_METHOD_LEVEL, or
69 * an &enum wmi_brightness_source value with %WMI_BRIGHTNESS_METHOD_SOURCE.
70 */
71struct wmi_brightness_args {
72 u32 mode;
73 u32 val;
74 u32 ret;
75 u32 ignored[3];
76};
77
78/**14/**
79 * wmi_brightness_notify() - helper function for calling WMI-wrapped ACPI method15 * wmi_brightness_notify() - helper function for calling WMI-wrapped ACPI method
80 * @w: Pointer to the struct wmi_device identified by %WMI_BRIGHTNESS_GUID16 * @w: Pointer to the struct wmi_device identified by %WMI_BRIGHTNESS_GUID
@@ -191,8 +127,6 @@ static int nvidia_wmi_ec_backlight_probe(struct wmi_device *wdev, const void *ct · 110 unmodified lines
191 return PTR_ERR_OR_ZERO(bdev);127 return PTR_ERR_OR_ZERO(bdev);
192}128}
193 129
194#define WMI_BRIGHTNESS_GUID "603E9613-EF25-4338-A3D0-C46177516DB7"
195
196static const struct wmi_device_id nvidia_wmi_ec_backlight_id_table[] = {130static const struct wmi_device_id nvidia_wmi_ec_backlight_id_table[] = {
197 { .guid_string = WMI_BRIGHTNESS_GUID },131 { .guid_string = WMI_BRIGHTNESS_GUID },
198 { }132 { }
include/linux/platform_data/x86/nvidia-wmi-ec-backlight.h+76−0
@@ -0,0 +1,76 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
4 */
5
6#ifndef __PLATFORM_DATA_X86_NVIDIA_WMI_EC_BACKLIGHT_H
7#define __PLATFORM_DATA_X86_NVIDIA_WMI_EC_BACKLIGHT_H
8
9#define WMI_BRIGHTNESS_GUID "603E9613-EF25-4338-A3D0-C46177516DB7"
10
11/**
12 * enum wmi_brightness_method - WMI method IDs
13 * @WMI_BRIGHTNESS_METHOD_LEVEL: Get/Set EC brightness level status
14 * @WMI_BRIGHTNESS_METHOD_SOURCE: Get/Set EC Brightness Source
15 */
16enum wmi_brightness_method {
17 WMI_BRIGHTNESS_METHOD_LEVEL = 1,
18 WMI_BRIGHTNESS_METHOD_SOURCE = 2,
19 WMI_BRIGHTNESS_METHOD_MAX
20};
21
22/**
23 * enum wmi_brightness_mode - Operation mode for WMI-wrapped method
24 * @WMI_BRIGHTNESS_MODE_GET: Get the current brightness level/source.
25 * @WMI_BRIGHTNESS_MODE_SET: Set the brightness level.
26 * @WMI_BRIGHTNESS_MODE_GET_MAX_LEVEL: Get the maximum brightness level. This
27 * is only valid when the WMI method is
28 * %WMI_BRIGHTNESS_METHOD_LEVEL.
29 */
30enum wmi_brightness_mode {
31 WMI_BRIGHTNESS_MODE_GET = 0,
32 WMI_BRIGHTNESS_MODE_SET = 1,
33 WMI_BRIGHTNESS_MODE_GET_MAX_LEVEL = 2,
34 WMI_BRIGHTNESS_MODE_MAX
35};
36
37/**
38 * enum wmi_brightness_source - Backlight brightness control source selection
39 * @WMI_BRIGHTNESS_SOURCE_GPU: Backlight brightness is controlled by the GPU.
40 * @WMI_BRIGHTNESS_SOURCE_EC: Backlight brightness is controlled by the
41 * system's Embedded Controller (EC).
42 * @WMI_BRIGHTNESS_SOURCE_AUX: Backlight brightness is controlled over the
43 * DisplayPort AUX channel.
44 */
45enum wmi_brightness_source {
46 WMI_BRIGHTNESS_SOURCE_GPU = 1,
47 WMI_BRIGHTNESS_SOURCE_EC = 2,
48 WMI_BRIGHTNESS_SOURCE_AUX = 3,
49 WMI_BRIGHTNESS_SOURCE_MAX
50};
51
52/**
53 * struct wmi_brightness_args - arguments for the WMI-wrapped ACPI method
54 * @mode: Pass in an &enum wmi_brightness_mode value to select between
55 * getting or setting a value.
56 * @val: In parameter for value to set when using %WMI_BRIGHTNESS_MODE_SET
57 * mode. Not used in conjunction with %WMI_BRIGHTNESS_MODE_GET or
58 * %WMI_BRIGHTNESS_MODE_GET_MAX_LEVEL mode.
59 * @ret: Out parameter returning retrieved value when operating in
60 * %WMI_BRIGHTNESS_MODE_GET or %WMI_BRIGHTNESS_MODE_GET_MAX_LEVEL
61 * mode. Not used in %WMI_BRIGHTNESS_MODE_SET mode.
62 * @ignored: Padding; not used. The ACPI method expects a 24 byte params struct.
63 *
64 * This is the parameters structure for the WmiBrightnessNotify ACPI method as
65 * wrapped by WMI. The value passed in to @val or returned by @ret will be a
66 * brightness value when the WMI method ID is %WMI_BRIGHTNESS_METHOD_LEVEL, or
67 * an &enum wmi_brightness_source value with %WMI_BRIGHTNESS_METHOD_SOURCE.
68 */
69struct wmi_brightness_args {
70 u32 mode;
71 u32 val;
72 u32 ret;
73 u32 ignored[3];
74};
75
76#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t