mirror of
https://github.com/wessel-novacustom/clevo-keyboard.git
synced 2024-11-15 11:43:59 +01:00
Move brightness parameter in preparation for common use
This commit is contained in:
parent
a85ccf9a4e
commit
f90c513aad
|
@ -34,19 +34,7 @@
|
||||||
|
|
||||||
#define KEYBOARD_BRIGHTNESS 0xF4000000
|
#define KEYBOARD_BRIGHTNESS 0xF4000000
|
||||||
|
|
||||||
/* All these COLOR_* macros are never used in the code, don't know why they are
|
#define KB_COLOR_DEFAULT 0xFFFFFF // White
|
||||||
here, maybe for documentation purposes. So won't delete for now */
|
|
||||||
#define COLOR_BLACK 0x000000
|
|
||||||
#define COLOR_RED 0xFF0000
|
|
||||||
#define COLOR_GREEN 0x00FF00
|
|
||||||
#define COLOR_BLUE 0x0000FF
|
|
||||||
#define COLOR_YELLOW 0xFFFF00
|
|
||||||
#define COLOR_MAGENTA 0xFF00FF
|
|
||||||
#define COLOR_CYAN 0x00FFFF
|
|
||||||
#define COLOR_WHITE 0xFFFFFF
|
|
||||||
|
|
||||||
|
|
||||||
#define KB_COLOR_DEFAULT COLOR_WHITE // Default Color: White
|
|
||||||
#define DEFAULT_BLINKING_PATTERN 0
|
#define DEFAULT_BLINKING_PATTERN 0
|
||||||
|
|
||||||
// Submethod IDs for the CLEVO_GET WMI method
|
// Submethod IDs for the CLEVO_GET WMI method
|
||||||
|
@ -128,7 +116,7 @@ struct blinking_pattern_t {
|
||||||
const char *const name;
|
const char *const name;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Param Validators
|
|
||||||
static int blinking_pattern_id_validator(const char *value,
|
static int blinking_pattern_id_validator(const char *value,
|
||||||
const struct kernel_param *blinking_pattern_param);
|
const struct kernel_param *blinking_pattern_param);
|
||||||
static const struct kernel_param_ops param_ops_mode_ops = {
|
static const struct kernel_param_ops param_ops_mode_ops = {
|
||||||
|
@ -136,14 +124,6 @@ static const struct kernel_param_ops param_ops_mode_ops = {
|
||||||
.get = param_get_int,
|
.get = param_get_int,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int brightness_validator(const char *val,
|
|
||||||
const struct kernel_param *brightness_param);
|
|
||||||
static const struct kernel_param_ops param_ops_brightness_ops = {
|
|
||||||
.set = brightness_validator,
|
|
||||||
.get = param_get_int,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Module Parameters
|
|
||||||
static uint param_color_left = KB_COLOR_DEFAULT;
|
static uint param_color_left = KB_COLOR_DEFAULT;
|
||||||
module_param_named(color_left, param_color_left, uint, S_IRUSR);
|
module_param_named(color_left, param_color_left, uint, S_IRUSR);
|
||||||
MODULE_PARM_DESC(color_left, "Color for the Left Region");
|
MODULE_PARM_DESC(color_left, "Color for the Left Region");
|
||||||
|
@ -164,11 +144,6 @@ static ushort param_blinking_pattern = DEFAULT_BLINKING_PATTERN;
|
||||||
module_param_cb(mode, ¶m_ops_mode_ops, ¶m_blinking_pattern, S_IRUSR);
|
module_param_cb(mode, ¶m_ops_mode_ops, ¶m_blinking_pattern, S_IRUSR);
|
||||||
MODULE_PARM_DESC(mode, "Set the keyboard backlight blinking pattern");
|
MODULE_PARM_DESC(mode, "Set the keyboard backlight blinking pattern");
|
||||||
|
|
||||||
static ushort param_brightness = BRIGHTNESS_DEFAULT;
|
|
||||||
module_param_cb(brightness, ¶m_ops_brightness_ops, ¶m_brightness,
|
|
||||||
S_IRUSR);
|
|
||||||
MODULE_PARM_DESC(brightness, "Set the Keyboard Brightness");
|
|
||||||
|
|
||||||
static bool param_state = true;
|
static bool param_state = true;
|
||||||
module_param_named(state, param_state, bool, S_IRUSR);
|
module_param_named(state, param_state, bool, S_IRUSR);
|
||||||
MODULE_PARM_DESC(state,
|
MODULE_PARM_DESC(state,
|
||||||
|
@ -714,6 +689,7 @@ static int clevo_keyboard_probe(struct platform_device *dev)
|
||||||
set_color(REGION_RIGHT, param_color_right);
|
set_color(REGION_RIGHT, param_color_right);
|
||||||
|
|
||||||
set_blinking_pattern(param_blinking_pattern);
|
set_blinking_pattern(param_blinking_pattern);
|
||||||
|
if (param_brightness > BRIGHTNESS_MAX) param_brightness = BRIGHTNESS_DEFAULT;
|
||||||
set_brightness(param_brightness);
|
set_brightness(param_brightness);
|
||||||
set_enabled(param_state);
|
set_enabled(param_state);
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,6 @@
|
||||||
|
|
||||||
#define pr_fmt(fmt) "tuxedo_keyboard" ": " fmt
|
#define pr_fmt(fmt) "tuxedo_keyboard" ": " fmt
|
||||||
|
|
||||||
#include <linux/module.h>
|
|
||||||
#include <linux/kernel.h>
|
|
||||||
#include <linux/acpi.h>
|
|
||||||
#include <linux/dmi.h>
|
|
||||||
#include <linux/platform_device.h>
|
|
||||||
#include <linux/input.h>
|
|
||||||
#include <linux/input/sparse-keymap.h>
|
|
||||||
#include "tuxedo_keyboard_common.h"
|
#include "tuxedo_keyboard_common.h"
|
||||||
#include "clevo_keyboard.h"
|
#include "clevo_keyboard.h"
|
||||||
#include "uniwill_keyboard.h"
|
#include "uniwill_keyboard.h"
|
||||||
|
|
|
@ -21,6 +21,11 @@
|
||||||
#define TUXEDO_KEYBOARD_COMMON_H
|
#define TUXEDO_KEYBOARD_COMMON_H
|
||||||
|
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/acpi.h>
|
||||||
|
#include <linux/dmi.h>
|
||||||
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/input.h>
|
||||||
#include <linux/input/sparse-keymap.h>
|
#include <linux/input/sparse-keymap.h>
|
||||||
|
|
||||||
/* :::: Module specific Constants and simple Macros :::: */
|
/* :::: Module specific Constants and simple Macros :::: */
|
||||||
|
@ -113,4 +118,18 @@ static u32 color_lookup(const struct color_list_t *color_list, const char *color
|
||||||
return found_color;
|
return found_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Common parameters
|
||||||
|
|
||||||
|
static int brightness_validator(const char *val,
|
||||||
|
const struct kernel_param *brightness_param);
|
||||||
|
static const struct kernel_param_ops param_ops_brightness_ops = {
|
||||||
|
.set = brightness_validator,
|
||||||
|
.get = param_get_int,
|
||||||
|
};
|
||||||
|
|
||||||
|
static ushort param_brightness = 0xffff; // Default unset value (higher than max)
|
||||||
|
module_param_cb(brightness, ¶m_ops_brightness_ops, ¶m_brightness,
|
||||||
|
S_IRUSR);
|
||||||
|
MODULE_PARM_DESC(brightness, "Set the Keyboard Brightness");
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in a new issue