Release 4.11 drivers/platform/x86/fujitsu-laptop.c
/*-*-linux-c-*-*/
/*
Copyright (C) 2007,2008 Jonathan Woithe <jwoithe@just42.net>
Copyright (C) 2008 Peter Gruber <nokos@gmx.net>
Copyright (C) 2008 Tony Vroon <tony@linx.net>
Based on earlier work:
Copyright (C) 2003 Shane Spencer <shane@bogomip.com>
Adrian Yee <brewt-fujitsu@brewt.org>
Templated from msi-laptop.c and thinkpad_acpi.c which is copyright
by its respective authors.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
/*
* fujitsu-laptop.c - Fujitsu laptop support, providing access to additional
* features made available on a range of Fujitsu laptops including the
* P2xxx/P5xxx/S6xxx/S7xxx series.
*
* This driver exports a few files in /sys/devices/platform/fujitsu-laptop/;
* others may be added at a later date.
*
* lcd_level - Screen brightness: contains a single integer in the
* range 0..7. (rw)
*
* In addition to these platform device attributes the driver
* registers itself in the Linux backlight control subsystem and is
* available to userspace under /sys/class/backlight/fujitsu-laptop/.
*
* Hotkeys present on certain Fujitsu laptops (eg: the S6xxx series) are
* also supported by this driver.
*
* This driver has been tested on a Fujitsu Lifebook S6410, S7020 and
* P8010. It should work on most P-series and S-series Lifebooks, but
* YMMV.
*
* The module parameter use_alt_lcd_levels switches between different ACPI
* brightness controls which are used by different Fujitsu laptops. In most
* cases the correct method is automatically detected. "use_alt_lcd_levels=1"
* is applicable for a Fujitsu Lifebook S6410 if autodetection fails.
*
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/acpi.h>
#include <linux/dmi.h>
#include <linux/backlight.h>
#include <linux/fb.h>
#include <linux/input.h>
#include <linux/kfifo.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#if IS_ENABLED(CONFIG_LEDS_CLASS)
#include <linux/leds.h>
#endif
#include <acpi/video.h>
#define FUJITSU_DRIVER_VERSION "0.6.0"
#define FUJITSU_LCD_N_LEVELS 8
#define ACPI_FUJITSU_CLASS "fujitsu"
#define ACPI_FUJITSU_BL_HID "FUJ02B1"
#define ACPI_FUJITSU_BL_DRIVER_NAME "Fujitsu laptop FUJ02B1 ACPI brightness driver"
#define ACPI_FUJITSU_BL_DEVICE_NAME "Fujitsu FUJ02B1"
#define ACPI_FUJITSU_LAPTOP_HID "FUJ02E3"
#define ACPI_FUJITSU_LAPTOP_DRIVER_NAME "Fujitsu laptop FUJ02E3 ACPI hotkeys driver"
#define ACPI_FUJITSU_LAPTOP_DEVICE_NAME "Fujitsu FUJ02E3"
#define ACPI_FUJITSU_NOTIFY_CODE1 0x80
/* FUNC interface - command values */
#define FUNC_FLAGS 0x1000
#define FUNC_LEDS 0x1001
#define FUNC_BUTTONS 0x1002
#define FUNC_BACKLIGHT 0x1004
/* FUNC interface - responses */
#define UNSUPPORTED_CMD 0x80000000
/* FUNC interface - status flags */
#define FLAG_RFKILL 0x020
#define FLAG_LID 0x100
#define FLAG_DOCK 0x200
#if IS_ENABLED(CONFIG_LEDS_CLASS)
/* FUNC interface - LED control */
#define FUNC_LED_OFF 0x1
#define FUNC_LED_ON 0x30001
#define KEYBOARD_LAMPS 0x100
#define LOGOLAMP_POWERON 0x2000
#define LOGOLAMP_ALWAYS 0x4000
#define RADIO_LED_ON 0x20
#define ECO_LED 0x10000
#define ECO_LED_ON 0x80000
#endif
/* Hotkey details */
#define KEY1_CODE 0x410
/* codes for the keys in the GIRB register */
#define KEY2_CODE 0x411
#define KEY3_CODE 0x412
#define KEY4_CODE 0x413
#define KEY5_CODE 0x420
#define MAX_HOTKEY_RINGBUFFER_SIZE 100
#define RINGBUFFERSIZE 40
/* Debugging */
#define FUJLAPTOP_DBG_ERROR 0x0001
#define FUJLAPTOP_DBG_WARN 0x0002
#define FUJLAPTOP_DBG_INFO 0x0004
#define FUJLAPTOP_DBG_TRACE 0x0008
#ifdef CONFIG_FUJITSU_LAPTOP_DEBUG
#define vdbg_printk(a_dbg_level, format, arg...) \
do { if (dbg_level & a_dbg_level) \
printk(KERN_DEBUG pr_fmt("%s: " format), __func__, ## arg); \
} while (0)
#else
#define vdbg_printk(a_dbg_level, format, arg...) \
do { } while (0)
#endif
/* Device controlling the backlight and associated keys */
struct fujitsu_bl {
acpi_handle acpi_handle;
struct acpi_device *dev;
struct input_dev *input;
char phys[32];
struct backlight_device *bl_device;
struct platform_device *pf_device;
int keycode1, keycode2, keycode3, keycode4, keycode5;
unsigned int max_brightness;
unsigned int brightness_changed;
unsigned int brightness_level;
};
static struct fujitsu_bl *fujitsu_bl;
static int use_alt_lcd_levels = -1;
static int disable_brightness_adjust = -1;
/* Device used to access hotkeys and other features on the laptop */
struct fujitsu_laptop {
acpi_handle acpi_handle;
struct acpi_device *dev;
struct input_dev *input;
char phys[32];
struct platform_device *pf_device;
struct kfifo fifo;
spinlock_t fifo_lock;
int flags_supported;
int flags_state;
int logolamp_registered;
int kblamps_registered;
int radio_led_registered;
int eco_led_registered;
};
static struct fujitsu_laptop *fujitsu_laptop;
#if IS_ENABLED(CONFIG_LEDS_CLASS)
static enum led_brightness logolamp_get(struct led_classdev *cdev);
static int logolamp_set(struct led_classdev *cdev,
enum led_brightness brightness);
static struct led_classdev logolamp_led = {
.name = "fujitsu::logolamp",
.brightness_get = logolamp_get,
.brightness_set_blocking = logolamp_set
};
static enum led_brightness kblamps_get(struct led_classdev *cdev);
static int kblamps_set(struct led_classdev *cdev,
enum led_brightness brightness);
static struct led_classdev kblamps_led = {
.name = "fujitsu::kblamps",
.brightness_get = kblamps_get,
.brightness_set_blocking = kblamps_set
};
static enum led_brightness radio_led_get(struct led_classdev *cdev);
static int radio_led_set(struct led_classdev *cdev,
enum led_brightness brightness);
static struct led_classdev radio_led = {
.name = "fujitsu::radio_led",
.default_trigger = "rfkill-any",
.brightness_get = radio_led_get,
.brightness_set_blocking = radio_led_set
};
static enum led_brightness eco_led_get(struct led_classdev *cdev);
static int eco_led_set(struct led_classdev *cdev,
enum led_brightness brightness);
static struct led_classdev eco_led = {
.name = "fujitsu::eco_led",
.brightness_get = eco_led_get,
.brightness_set_blocking = eco_led_set
};
#endif
#ifdef CONFIG_FUJITSU_LAPTOP_DEBUG
static u32 dbg_level = 0x03;
#endif
/* Fujitsu ACPI interface function */
static int call_fext_func(int cmd, int arg0, int arg1, int arg2)
{
acpi_status status = AE_OK;
union acpi_object params[4] = {
{ .type = ACPI_TYPE_INTEGER },
{ .type = ACPI_TYPE_INTEGER },
{ .type = ACPI_TYPE_INTEGER },
{ .type = ACPI_TYPE_INTEGER }
};
struct acpi_object_list arg_list = { 4, ¶ms[0] };
unsigned long long value;
acpi_handle handle = NULL;
status = acpi_get_handle(fujitsu_laptop->acpi_handle, "FUNC", &handle);
if (ACPI_FAILURE(status)) {
vdbg_printk(FUJLAPTOP_DBG_ERROR,
"FUNC interface is not present\n");
return -ENODEV;
}
params[0].integer.value = cmd;
params[1].integer.value = arg0;
params[2].integer.value = arg1;
params[3].integer.value = arg2;
status = acpi_evaluate_integer(handle, NULL, &arg_list, &value);
if (ACPI_FAILURE(status)) {
vdbg_printk(FUJLAPTOP_DBG_WARN,
"FUNC 0x%x (args 0x%x, 0x%x, 0x%x) call failed\n",
cmd, arg0, arg1, arg2);
return -ENODEV;
}
vdbg_printk(FUJLAPTOP_DBG_TRACE,
"FUNC 0x%x (args 0x%x, 0x%x, 0x%x) returned 0x%x\n",
cmd, arg0, arg1, arg2, (int)value);
return value;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Tony Vroon | 151 | 66.23% | 1 | 20.00% |
Jonathan Woithe | 70 | 30.70% | 2 | 40.00% |
Rui Zhang | 6 | 2.63% | 1 | 20.00% |
Alan Jenkins | 1 | 0.44% | 1 | 20.00% |
Total | 228 | 100.00% | 5 | 100.00% |
#if IS_ENABLED(CONFIG_LEDS_CLASS)
/* LED class callbacks */
static int logolamp_set(struct led_classdev *cdev,
enum led_brightness brightness)
{
int poweron = FUNC_LED_ON, always = FUNC_LED_ON;
int ret;
if (brightness < LED_HALF)
poweron = FUNC_LED_OFF;
if (brightness < LED_FULL)
always = FUNC_LED_OFF;
ret = call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, poweron);
if (ret < 0)
return ret;
return call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, always);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Tony Vroon | 41 | 50.62% | 1 | 33.33% |
Michał Kępień | 40 | 49.38% | 2 | 66.67% |
Total | 81 | 100.00% | 3 | 100.00% |
static int kblamps_set(struct led_classdev *cdev,
enum led_brightness brightness)
{
if (brightness >= LED_FULL)
return call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_ON);
else
return call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_OFF);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Tony Vroon | 41 | 89.13% | 1 | 50.00% |
Michał Kępień | 5 | 10.87% | 1 | 50.00% |
Total | 46 | 100.00% | 2 | 100.00% |
static int radio_led_set(struct led_classdev *cdev,
enum led_brightness brightness)
{
if (brightness >= LED_FULL)
return call_fext_func(FUNC_FLAGS, 0x5, RADIO_LED_ON, RADIO_LED_ON);
else
return call_fext_func(FUNC_FLAGS, 0x5, RADIO_LED_ON, 0x0);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michał Kępień | 44 | 95.65% | 2 | 66.67% |
Alan Jenkins | 2 | 4.35% | 1 | 33.33% |
Total | 46 | 100.00% | 3 | 100.00% |
static int eco_led_set(struct led_classdev *cdev,
enum led_brightness brightness)
{
int curr;
curr = call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0);
if (brightness >= LED_FULL)
return call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr | ECO_LED_ON);
else
return call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr & ~ECO_LED_ON);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Matej Groma | 62 | 92.54% | 2 | 66.67% |
Michał Kępień | 5 | 7.46% | 1 | 33.33% |
Total | 67 | 100.00% | 3 | 100.00% |
static enum led_brightness logolamp_get(struct led_classdev *cdev)
{
int ret;
ret = call_fext_func(FUNC_LEDS, 0x2, LOGOLAMP_ALWAYS, 0x0);
if (ret == FUNC_LED_ON)
return LED_FULL;
ret = call_fext_func(FUNC_LEDS, 0x2, LOGOLAMP_POWERON, 0x0);
if (ret == FUNC_LED_ON)
return LED_HALF;
return LED_OFF;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Tony Vroon | 48 | 77.42% | 1 | 50.00% |
Michał Kępień | 14 | 22.58% | 1 | 50.00% |
Total | 62 | 100.00% | 2 | 100.00% |
static enum led_brightness kblamps_get(struct led_classdev *cdev)
{
enum led_brightness brightness = LED_OFF;
if (call_fext_func(FUNC_LEDS, 0x2, KEYBOARD_LAMPS, 0x0) == FUNC_LED_ON)
brightness = LED_FULL;
return brightness;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Tony Vroon | 40 | 100.00% | 1 | 100.00% |
Total | 40 | 100.00% | 1 | 100.00% |
static enum led_brightness radio_led_get(struct led_classdev *cdev)
{
enum led_brightness brightness = LED_OFF;
if (call_fext_func(FUNC_FLAGS, 0x4, 0x0, 0x0) & RADIO_LED_ON)
brightness = LED_FULL;
return brightness;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michał Kępień | 39 | 97.50% | 1 | 50.00% |
Alan Jenkins | 1 | 2.50% | 1 | 50.00% |
Total | 40 | 100.00% | 2 | 100.00% |
static enum led_brightness eco_led_get(struct led_classdev *cdev)
{
enum led_brightness brightness = LED_OFF;
if (call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0) & ECO_LED_ON)
brightness = LED_FULL;
return brightness;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Matej Groma | 40 | 100.00% | 2 | 100.00% |
Total | 40 | 100.00% | 2 | 100.00% |
#endif
/* Hardware access for LCD brightness control */
static int set_lcd_level(int level)
{
acpi_status status = AE_OK;
acpi_handle handle = NULL;
vdbg_printk(FUJLAPTOP_DBG_TRACE, "set lcd level via SBLL [%d]\n",
level);
if (level < 0 || level >= fujitsu_bl->max_brightness)
return -EINVAL;
status = acpi_get_handle(fujitsu_bl->acpi_handle, "SBLL", &handle);
if (ACPI_FAILURE(status)) {
vdbg_printk(FUJLAPTOP_DBG_ERROR, "SBLL not present\n");
return -ENODEV;
}
status = acpi_execute_simple_method(handle, NULL, level);
if (ACPI_FAILURE(status))
return -ENODEV;
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Tony Vroon | 81 | 78.64% | 1 | 25.00% |
Jonathan Woithe | 18 | 17.48% | 1 | 25.00% |
Rui Zhang | 2 | 1.94% | 1 | 25.00% |
Alan Jenkins | 2 | 1.94% | 1 | 25.00% |
Total | 103 | 100.00% | 4 | 100.00% |
static int set_lcd_level_alt(int level)
{
acpi_status status = AE_OK;
acpi_handle handle = NULL;
vdbg_printk(FUJLAPTOP_DBG_TRACE, "set lcd level via SBL2 [%d]\n",
level);
if (level < 0 || level >= fujitsu_bl->max_brightness)
return -EINVAL;
status = acpi_get_handle(fujitsu_bl->acpi_handle, "SBL2", &handle);
if (ACPI_FAILURE(status)) {
vdbg_printk(FUJLAPTOP_DBG_ERROR, "SBL2 not present\n");
return -ENODEV;
}
status = acpi_execute_simple_method(handle, NULL, level);
if (ACPI_FAILURE(status))
return -ENODEV;
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 99 | 96.12% | 2 | 50.00% |
Rui Zhang | 2 | 1.94% | 1 | 25.00% |
Alan Jenkins | 2 | 1.94% | 1 | 25.00% |
Total | 103 | 100.00% | 4 | 100.00% |
static int get_lcd_level(void)
{
unsigned long long state = 0;
acpi_status status = AE_OK;
vdbg_printk(FUJLAPTOP_DBG_TRACE, "get lcd level via GBLL\n");
status = acpi_evaluate_integer(fujitsu_bl->acpi_handle, "GBLL", NULL,
&state);
if (ACPI_FAILURE(status))
return 0;
fujitsu_bl->brightness_level = state & 0x0fffffff;
if (state & 0x80000000)
fujitsu_bl->brightness_changed = 1;
else
fujitsu_bl->brightness_changed = 0;
return fujitsu_bl->brightness_level;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 79 | 92.94% | 3 | 60.00% |
Alan Jenkins | 5 | 5.88% | 1 | 20.00% |
Matthew Wilcox | 1 | 1.18% | 1 | 20.00% |
Total | 85 | 100.00% | 5 | 100.00% |
static int get_max_brightness(void)
{
unsigned long long state = 0;
acpi_status status = AE_OK;
vdbg_printk(FUJLAPTOP_DBG_TRACE, "get max lcd level via RBLL\n");
status = acpi_evaluate_integer(fujitsu_bl->acpi_handle, "RBLL", NULL,
&state);
if (ACPI_FAILURE(status))
return -1;
fujitsu_bl->max_brightness = state;
return fujitsu_bl->max_brightness;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 61 | 93.85% | 3 | 60.00% |
Alan Jenkins | 3 | 4.62% | 1 | 20.00% |
Matthew Wilcox | 1 | 1.54% | 1 | 20.00% |
Total | 65 | 100.00% | 5 | 100.00% |
/* Backlight device stuff */
static int bl_get_brightness(struct backlight_device *b)
{
return get_lcd_level();
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 15 | 100.00% | 1 | 100.00% |
Total | 15 | 100.00% | 1 | 100.00% |
static int bl_update_status(struct backlight_device *b)
{
int ret;
if (b->props.power == FB_BLANK_POWERDOWN)
ret = call_fext_func(FUNC_BACKLIGHT, 0x1, 0x4, 0x3);
else
ret = call_fext_func(FUNC_BACKLIGHT, 0x1, 0x4, 0x0);
if (ret != 0)
vdbg_printk(FUJLAPTOP_DBG_ERROR,
"Unable to adjust backlight power, error code %i\n",
ret);
if (use_alt_lcd_levels)
ret = set_lcd_level_alt(b->props.brightness);
else
ret = set_lcd_level(b->props.brightness);
if (ret != 0)
vdbg_printk(FUJLAPTOP_DBG_ERROR,
"Unable to adjust LCD brightness, error code %i\n",
ret);
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Tony Vroon | 77 | 69.37% | 1 | 33.33% |
Jonathan Woithe | 33 | 29.73% | 1 | 33.33% |
Michael Karcher | 1 | 0.90% | 1 | 33.33% |
Total | 111 | 100.00% | 3 | 100.00% |
static const struct backlight_ops fujitsu_bl_ops = {
.get_brightness = bl_get_brightness,
.update_status = bl_update_status,
};
/* Platform LCD brightness device */
static ssize_t
show_max_brightness(struct device *dev,
struct device_attribute *attr, char *buf)
{
int ret;
ret = get_max_brightness();
if (ret < 0)
return ret;
return sprintf(buf, "%i\n", ret);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 47 | 100.00% | 1 | 100.00% |
Total | 47 | 100.00% | 1 | 100.00% |
static ssize_t
show_brightness_changed(struct device *dev,
struct device_attribute *attr, char *buf)
{
int ret;
ret = fujitsu_bl->brightness_changed;
if (ret < 0)
return ret;
return sprintf(buf, "%i\n", ret);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 47 | 97.92% | 1 | 50.00% |
Alan Jenkins | 1 | 2.08% | 1 | 50.00% |
Total | 48 | 100.00% | 2 | 100.00% |
static ssize_t show_lcd_level(struct device *dev,
struct device_attribute *attr, char *buf)
{
int ret;
ret = get_lcd_level();
if (ret < 0)
return ret;
return sprintf(buf, "%i\n", ret);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 47 | 100.00% | 1 | 100.00% |
Total | 47 | 100.00% | 1 | 100.00% |
static ssize_t store_lcd_level(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t count)
{
int level, ret;
if (sscanf(buf, "%i", &level) != 1
|| (level < 0 || level >= fujitsu_bl->max_brightness))
return -EINVAL;
if (use_alt_lcd_levels)
ret = set_lcd_level_alt(level);
else
ret = set_lcd_level(level);
if (ret < 0)
return ret;
ret = get_lcd_level();
if (ret < 0)
return ret;
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 103 | 99.04% | 2 | 66.67% |
Alan Jenkins | 1 | 0.96% | 1 | 33.33% |
Total | 104 | 100.00% | 3 | 100.00% |
static ssize_t
ignore_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
return count;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Tony Vroon | 23 | 85.19% | 1 | 33.33% |
Jonathan Woithe | 4 | 14.81% | 2 | 66.67% |
Total | 27 | 100.00% | 3 | 100.00% |
static ssize_t
show_lid_state(struct device *dev,
struct device_attribute *attr, char *buf)
{
if (!(fujitsu_laptop->flags_supported & FLAG_LID))
return sprintf(buf, "unknown\n");
if (fujitsu_laptop->flags_state & FLAG_LID)
return sprintf(buf, "open\n");
else
return sprintf(buf, "closed\n");
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Tony Vroon | 51 | 79.69% | 2 | 33.33% |
Jonathan Woithe | 7 | 10.94% | 1 | 16.67% |
Alan Jenkins | 6 | 9.38% | 3 | 50.00% |
Total | 64 | 100.00% | 6 | 100.00% |
static ssize_t
show_dock_state(struct device *dev,
struct device_attribute *attr, char *buf)
{
if (!(fujitsu_laptop->flags_supported & FLAG_DOCK))
return sprintf(buf, "unknown\n");
if (fujitsu_laptop->flags_state & FLAG_DOCK)
return sprintf(buf, "docked\n");
else
return sprintf(buf, "undocked\n");
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Tony Vroon | 49 | 76.56% | 2 | 33.33% |
Jonathan Woithe | 9 | 14.06% | 1 | 16.67% |
Alan Jenkins | 6 | 9.38% | 3 | 50.00% |
Total | 64 | 100.00% | 6 | 100.00% |
static ssize_t
show_radios_state(struct device *dev,
struct device_attribute *attr, char *buf)
{
if (!(fujitsu_laptop->flags_supported & FLAG_RFKILL))
return sprintf(buf, "unknown\n");
if (fujitsu_laptop->flags_state & FLAG_RFKILL)
return sprintf(buf, "on\n");
else
return sprintf(buf, "killed\n");
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Tony Vroon | 37 | 57.81% | 2 | 33.33% |
Jonathan Woithe | 21 | 32.81% | 1 | 16.67% |
Alan Jenkins | 6 | 9.38% | 3 | 50.00% |
Total | 64 | 100.00% | 6 | 100.00% |
static DEVICE_ATTR(max_brightness, 0444, show_max_brightness, ignore_store);
static DEVICE_ATTR(brightness_changed, 0444, show_brightness_changed,
ignore_store);
static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level);
static DEVICE_ATTR(lid, 0444, show_lid_state, ignore_store);
static DEVICE_ATTR(dock, 0444, show_dock_state, ignore_store);
static DEVICE_ATTR(radios, 0444, show_radios_state, ignore_store);
static struct attribute *fujitsu_pf_attributes[] = {
&dev_attr_brightness_changed.attr,
&dev_attr_max_brightness.attr,
&dev_attr_lcd_level.attr,
&dev_attr_lid.attr,
&dev_attr_dock.attr,
&dev_attr_radios.attr,
NULL
};
static struct attribute_group fujitsu_pf_attribute_group = {
.attrs = fujitsu_pf_attributes
};
static struct platform_driver fujitsu_pf_driver = {
.driver = {
.name = "fujitsu-laptop",
}
};
static void __init dmi_check_cb_common(const struct dmi_system_id *id)
{
pr_info("Identified laptop model '%s'\n", id->ident);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 19 | 86.36% | 2 | 50.00% |
Joe Perches | 2 | 9.09% | 1 | 25.00% |
Mathias Krause | 1 | 4.55% | 1 | 25.00% |
Total | 22 | 100.00% | 4 | 100.00% |
static int __init dmi_check_cb_s6410(const struct dmi_system_id *id)
{
dmi_check_cb_common(id);
fujitsu_bl->keycode1 = KEY_SCREENLOCK; /* "Lock" */
fujitsu_bl->keycode2 = KEY_HELP; /* "Mobility Center" */
return 1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 31 | 88.57% | 1 | 25.00% |
Alan Jenkins | 2 | 5.71% | 1 | 25.00% |
Axel Lin | 1 | 2.86% | 1 | 25.00% |
Mathias Krause | 1 | 2.86% | 1 | 25.00% |
Total | 35 | 100.00% | 4 | 100.00% |
static int __init dmi_check_cb_s6420(const struct dmi_system_id *id)
{
dmi_check_cb_common(id);
fujitsu_bl->keycode1 = KEY_SCREENLOCK; /* "Lock" */
fujitsu_bl->keycode2 = KEY_HELP; /* "Mobility Center" */
return 1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Tony Vroon | 31 | 88.57% | 1 | 25.00% |
Alan Jenkins | 2 | 5.71% | 1 | 25.00% |
Axel Lin | 1 | 2.86% | 1 | 25.00% |
Mathias Krause | 1 | 2.86% | 1 | 25.00% |
Total | 35 | 100.00% | 4 | 100.00% |
static int __init dmi_check_cb_p8010(const struct dmi_system_id *id)
{
dmi_check_cb_common(id);
fujitsu_bl->keycode1 = KEY_HELP; /* "Support" */
fujitsu_bl->keycode3 = KEY_SWITCHVIDEOMODE; /* "Presentation" */
fujitsu_bl->keycode4 = KEY_WWW; /* "Internet" */
return 1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 37 | 88.10% | 2 | 40.00% |
Alan Jenkins | 3 | 7.14% | 1 | 20.00% |
Mathias Krause | 1 | 2.38% | 1 | 20.00% |
Axel Lin | 1 | 2.38% | 1 | 20.00% |
Total | 42 | 100.00% | 5 | 100.00% |
static const struct dmi_system_id fujitsu_dmi_table[] __initconst = {
{
.ident = "Fujitsu Siemens S6410",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK S6410"),
},
.callback = dmi_check_cb_s6410},
{
.ident = "Fujitsu Siemens S6420",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK S6420"),
},
.callback = dmi_check_cb_s6420},
{
.ident = "Fujitsu LifeBook P8010",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P8010"),
},
.callback = dmi_check_cb_p8010},
{}
};
/* ACPI device for LCD brightness control */
static int acpi_fujitsu_bl_add(struct acpi_device *device)
{
int state = 0;
struct input_dev *input;
int error;
if (!device)
return -EINVAL;
fujitsu_bl->acpi_handle = device->handle;
sprintf(acpi_device_name(device), "%s", ACPI_FUJITSU_BL_DEVICE_NAME);
sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS);
device->driver_data = fujitsu_bl;
fujitsu_bl->input = input = input_allocate_device();
if (!input) {
error = -ENOMEM;
goto err_stop;
}
snprintf(fujitsu_bl->phys, sizeof(fujitsu_bl->phys),
"%s/video/input0", acpi_device_hid(device));
input->name = acpi_device_name(device);
input->phys = fujitsu_bl->phys;
input->id.bustype = BUS_HOST;
input->id.product = 0x06;
input->dev.parent = &device->dev;
input->evbit[0] = BIT(EV_KEY);
set_bit(KEY_BRIGHTNESSUP, input->keybit);
set_bit(KEY_BRIGHTNESSDOWN, input->keybit);
set_bit(KEY_UNKNOWN, input->keybit);
error = input_register_device(input);
if (error)
goto err_free_input_dev;
error = acpi_bus_update_power(fujitsu_bl->acpi_handle, &state);
if (error) {
pr_err("Error reading power state\n");
goto err_unregister_input_dev;
}
pr_info("ACPI: %s [%s] (%s)\n",
acpi_device_name(device), acpi_device_bid(device),
!device->power.state ? "on" : "off");
fujitsu_bl->dev = device;
if (acpi_has_method(device->handle, METHOD_NAME__INI)) {
vdbg_printk(FUJLAPTOP_DBG_INFO, "Invoking _INI\n");
if (ACPI_FAILURE
(acpi_evaluate_object
(device->handle, METHOD_NAME__INI, NULL, NULL)))
pr_err("_INI Method failed\n");
}
if (use_alt_lcd_levels == -1) {
if (acpi_has_method(NULL, "\\_SB.PCI0.LPCB.FJEX.SBL2"))
use_alt_lcd_levels = 1;
else
use_alt_lcd_levels = 0;
vdbg_printk(FUJLAPTOP_DBG_TRACE, "auto-detected usealt as %i\n",
use_alt_lcd_levels);
}
/* do config (detect defaults) */
use_alt_lcd_levels = use_alt_lcd_levels == 1 ? 1 : 0;
disable_brightness_adjust = disable_brightness_adjust == 1 ? 1 : 0;
vdbg_printk(FUJLAPTOP_DBG_INFO,
"config: [alt interface: %d], [adjust disable: %d]\n",
use_alt_lcd_levels, disable_brightness_adjust);
if (get_max_brightness() <= 0)
fujitsu_bl->max_brightness = FUJITSU_LCD_N_LEVELS;
get_lcd_level();
return 0;
err_unregister_input_dev:
input_unregister_device(input);
input = NULL;
err_free_input_dev:
input_free_device(input);
err_stop:
return error;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 334 | 78.77% | 2 | 13.33% |
Alan Jenkins | 47 | 11.08% | 2 | 13.33% |
Len Brown | 18 | 4.25% | 1 | 6.67% |
Bartlomiej Zolnierkiewicz | 7 | 1.65% | 1 | 6.67% |
Axel Lin | 4 | 0.94% | 1 | 6.67% |
Julia Lawall | 4 | 0.94% | 1 | 6.67% |
Joe Perches | 3 | 0.71% | 1 | 6.67% |
Pavel Machek | 2 | 0.47% | 1 | 6.67% |
Rui Zhang | 1 | 0.24% | 1 | 6.67% |
Tony Vroon | 1 | 0.24% | 1 | 6.67% |
Adrian Bunk | 1 | 0.24% | 1 | 6.67% |
Rafael J. Wysocki | 1 | 0.24% | 1 | 6.67% |
Björn Helgaas | 1 | 0.24% | 1 | 6.67% |
Total | 424 | 100.00% | 15 | 100.00% |
static int acpi_fujitsu_bl_remove(struct acpi_device *device)
{
struct fujitsu_bl *fujitsu_bl = acpi_driver_data(device);
struct input_dev *input = fujitsu_bl->input;
input_unregister_device(input);
fujitsu_bl->acpi_handle = NULL;
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 28 | 63.64% | 1 | 33.33% |
Bartlomiej Zolnierkiewicz | 11 | 25.00% | 1 | 33.33% |
Alan Jenkins | 5 | 11.36% | 1 | 33.33% |
Total | 44 | 100.00% | 3 | 100.00% |
/* Brightness notify */
static void acpi_fujitsu_bl_notify(struct acpi_device *device, u32 event)
{
struct input_dev *input;
int keycode;
int oldb, newb;
input = fujitsu_bl->input;
switch (event) {
case ACPI_FUJITSU_NOTIFY_CODE1:
keycode = 0;
oldb = fujitsu_bl->brightness_level;
get_lcd_level();
newb = fujitsu_bl->brightness_level;
vdbg_printk(FUJLAPTOP_DBG_TRACE,
"brightness button event [%i -> %i (%i)]\n",
oldb, newb, fujitsu_bl->brightness_changed);
if (oldb < newb) {
if (disable_brightness_adjust != 1) {
if (use_alt_lcd_levels)
set_lcd_level_alt(newb);
else
set_lcd_level(newb);
}
keycode = KEY_BRIGHTNESSUP;
} else if (oldb > newb) {
if (disable_brightness_adjust != 1) {
if (use_alt_lcd_levels)
set_lcd_level_alt(newb);
else
set_lcd_level(newb);
}
keycode = KEY_BRIGHTNESSDOWN;
}
break;
default:
keycode = KEY_UNKNOWN;
vdbg_printk(FUJLAPTOP_DBG_WARN,
"unsupported event [0x%x]\n", event);
break;
}
if (keycode != 0) {
input_report_key(input, keycode, 1);
input_sync(input);
input_report_key(input, keycode, 0);
input_sync(input);
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 190 | 95.48% | 1 | 33.33% |
Alan Jenkins | 5 | 2.51% | 1 | 33.33% |
Björn Helgaas | 4 | 2.01% | 1 | 33.33% |
Total | 199 | 100.00% | 3 | 100.00% |
/* ACPI device for hotkey handling */
static int acpi_fujitsu_laptop_add(struct acpi_device *device)
{
int result = 0;
int state = 0;
struct input_dev *input;
int error;
int i;
if (!device)
return -EINVAL;
fujitsu_laptop->acpi_handle = device->handle;
sprintf(acpi_device_name(device), "%s",
ACPI_FUJITSU_LAPTOP_DEVICE_NAME);
sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS);
device->driver_data = fujitsu_laptop;
/* kfifo */
spin_lock_init(&fujitsu_laptop->fifo_lock);
error = kfifo_alloc(&fujitsu_laptop->fifo, RINGBUFFERSIZE * sizeof(int),
GFP_KERNEL);
if (error) {
pr_err("kfifo_alloc failed\n");
goto err_stop;
}
fujitsu_laptop->input = input = input_allocate_device();
if (!input) {
error = -ENOMEM;
goto err_free_fifo;
}
snprintf(fujitsu_laptop->phys, sizeof(fujitsu_laptop->phys),
"%s/video/input0", acpi_device_hid(device));
input->name = acpi_device_name(device);
input->phys = fujitsu_laptop->phys;
input->id.bustype = BUS_HOST;
input->id.product = 0x06;
input->dev.parent = &device->dev;
set_bit(EV_KEY, input->evbit);
set_bit(fujitsu_bl->keycode1, input->keybit);
set_bit(fujitsu_bl->keycode2, input->keybit);
set_bit(fujitsu_bl->keycode3, input->keybit);
set_bit(fujitsu_bl->keycode4, input->keybit);
set_bit(fujitsu_bl->keycode5, input->keybit);
set_bit(KEY_TOUCHPAD_TOGGLE, input->keybit);
set_bit(KEY_UNKNOWN, input->keybit);
error = input_register_device(input);
if (error)
goto err_free_input_dev;
error = acpi_bus_update_power(fujitsu_laptop->acpi_handle, &state);
if (error) {
pr_err("Error reading power state\n");
goto err_unregister_input_dev;
}
pr_info("ACPI: %s [%s] (%s)\n",
acpi_device_name(device), acpi_device_bid(device),
!device->power.state ? "on" : "off");
fujitsu_laptop->dev = device;
if (acpi_has_method(device->handle, METHOD_NAME__INI)) {
vdbg_printk(FUJLAPTOP_DBG_INFO, "Invoking _INI\n");
if (ACPI_FAILURE
(acpi_evaluate_object
(device->handle, METHOD_NAME__INI, NULL, NULL)))
pr_err("_INI Method failed\n");
}
i = 0;
while (call_fext_func(FUNC_BUTTONS, 0x1, 0x0, 0x0) != 0
&& (i++) < MAX_HOTKEY_RINGBUFFER_SIZE)
; /* No action, result is discarded */
vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i);
fujitsu_laptop->flags_supported =
call_fext_func(FUNC_FLAGS, 0x0, 0x0, 0x0);
/* Make sure our bitmask of supported functions is cleared if the
RFKILL function block is not implemented, like on the S7020. */
if (fujitsu_laptop->flags_supported == UNSUPPORTED_CMD)
fujitsu_laptop->flags_supported = 0;
if (fujitsu_laptop->flags_supported)
fujitsu_laptop->flags_state =
call_fext_func(FUNC_FLAGS, 0x4, 0x0, 0x0);
/* Suspect this is a keymap of the application panel, print it */
pr_info("BTNI: [0x%x]\n", call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0));
#if IS_ENABLED(CONFIG_LEDS_CLASS)
if (call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) {
result = led_classdev_register(&fujitsu_bl->pf_device->dev,
&logolamp_led);
if (result == 0) {
fujitsu_laptop->logolamp_registered = 1;
} else {
pr_err("Could not register LED handler for logo lamp, error %i\n",
result);
}
}
if ((call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & KEYBOARD_LAMPS) &&
(call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0) == 0x0)) {
result = led_classdev_register(&fujitsu_bl->pf_device->dev,
&kblamps_led);
if (result == 0) {
fujitsu_laptop->kblamps_registered = 1;
} else {
pr_err("Could not register LED handler for keyboard lamps, error %i\n",
result);
}
}
/*
* BTNI bit 24 seems to indicate the presence of a radio toggle
* button in place of a slide switch, and all such machines appear
* to also have an RF LED. Therefore use bit 24 as an indicator
* that an RF LED is present.
*/
if (call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0) & BIT(24)) {
result = led_classdev_register(&fujitsu_bl->pf_device->dev,
&radio_led);
if (result == 0) {
fujitsu_laptop->radio_led_registered = 1;
} else {
pr_err("Could not register LED handler for radio LED, error %i\n",
result);
}
}
/* Support for eco led is not always signaled in bit corresponding
* to the bit used to control the led. According to the DSDT table,
* bit 14 seems to indicate presence of said led as well.
* Confirm by testing the status.
*/
if ((call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & BIT(14)) &&
(call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0) != UNSUPPORTED_CMD)) {
result = led_classdev_register(&fujitsu_bl->pf_device->dev,
&eco_led);
if (result == 0) {
fujitsu_laptop->eco_led_registered = 1;
} else {
pr_err("Could not register LED handler for eco LED, error %i\n",
result);
}
}
#endif
return result;
err_unregister_input_dev:
input_unregister_device(input);
input = NULL;
err_free_input_dev:
input_free_device(input);
err_free_fifo:
kfifo_free(&fujitsu_laptop->fifo);
err_stop:
return error;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 379 | 46.11% | 2 | 8.70% |
Tony Vroon | 193 | 23.48% | 2 | 8.70% |
Michał Kępień | 77 | 9.37% | 3 | 13.04% |
Matej Groma | 75 | 9.12% | 1 | 4.35% |
Alan Jenkins | 38 | 4.62% | 3 | 13.04% |
Len Brown | 18 | 2.19% | 1 | 4.35% |
Joe Perches | 10 | 1.22% | 1 | 4.35% |
Bartlomiej Zolnierkiewicz | 7 | 0.85% | 1 | 4.35% |
Stefani Seibold | 7 | 0.85% | 1 | 4.35% |
Stephen Gildea | 4 | 0.49% | 1 | 4.35% |
Axel Lin | 4 | 0.49% | 1 | 4.35% |
Julia Lawall | 3 | 0.36% | 1 | 4.35% |
Pavel Machek | 2 | 0.24% | 1 | 4.35% |
Björn Helgaas | 2 | 0.24% | 1 | 4.35% |
Rui Zhang | 1 | 0.12% | 1 | 4.35% |
Javier Martinez Canillas | 1 | 0.12% | 1 | 4.35% |
Rafael J. Wysocki | 1 | 0.12% | 1 | 4.35% |
Total | 822 | 100.00% | 23 | 100.00% |
static int acpi_fujitsu_laptop_remove(struct acpi_device *device)
{
struct fujitsu_laptop *fujitsu_laptop = acpi_driver_data(device);
struct input_dev *input = fujitsu_laptop->input;
#if IS_ENABLED(CONFIG_LEDS_CLASS)
if (fujitsu_laptop->logolamp_registered)
led_classdev_unregister(&logolamp_led);
if (fujitsu_laptop->kblamps_registered)
led_classdev_unregister(&kblamps_led);
if (fujitsu_laptop->radio_led_registered)
led_classdev_unregister(&radio_led);
if (fujitsu_laptop->eco_led_registered)
led_classdev_unregister(&eco_led);
#endif
input_unregister_device(input);
kfifo_free(&fujitsu_laptop->fifo);
fujitsu_laptop->acpi_handle = NULL;
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Bartlomiej Zolnierkiewicz | 40 | 37.04% | 1 | 12.50% |
Jonathan Woithe | 34 | 31.48% | 2 | 25.00% |
Michał Kępień | 11 | 10.19% | 1 | 12.50% |
Matej Groma | 11 | 10.19% | 1 | 12.50% |
Alan Jenkins | 10 | 9.26% | 1 | 12.50% |
Javier Martinez Canillas | 1 | 0.93% | 1 | 12.50% |
Stefani Seibold | 1 | 0.93% | 1 | 12.50% |
Total | 108 | 100.00% | 8 | 100.00% |
static void acpi_fujitsu_laptop_press(int keycode)
{
struct input_dev *input = fujitsu_laptop->input;
int status;
status = kfifo_in_locked(&fujitsu_laptop->fifo,
(unsigned char *)&keycode, sizeof(keycode),
&fujitsu_laptop->fifo_lock);
if (status != sizeof(keycode)) {
vdbg_printk(FUJLAPTOP_DBG_WARN,
"Could not push keycode [0x%x]\n", keycode);
return;
}
input_report_key(input, keycode, 1);
input_sync(input);
vdbg_printk(FUJLAPTOP_DBG_TRACE,
"Push keycode into ringbuffer [%d]\n", keycode);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michał Kępień | 89 | 95.70% | 2 | 66.67% |
Alan Jenkins | 4 | 4.30% | 1 | 33.33% |
Total | 93 | 100.00% | 3 | 100.00% |
static void acpi_fujitsu_laptop_release(void)
{
struct input_dev *input = fujitsu_laptop->input;
int keycode, status;
while (true) {
status = kfifo_out_locked(&fujitsu_laptop->fifo,
(unsigned char *)&keycode,
sizeof(keycode),
&fujitsu_laptop->fifo_lock);
if (status != sizeof(keycode))
return;
input_report_key(input, keycode, 0);
input_sync(input);
vdbg_printk(FUJLAPTOP_DBG_TRACE,
"Pop keycode from ringbuffer [%d]\n", keycode);
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michał Kępień | 85 | 95.51% | 2 | 66.67% |
Alan Jenkins | 4 | 4.49% | 1 | 33.33% |
Total | 89 | 100.00% | 3 | 100.00% |
static void acpi_fujitsu_laptop_notify(struct acpi_device *device, u32 event)
{
struct input_dev *input;
int keycode;
unsigned int irb = 1;
int i;
input = fujitsu_laptop->input;
if (event != ACPI_FUJITSU_NOTIFY_CODE1) {
keycode = KEY_UNKNOWN;
vdbg_printk(FUJLAPTOP_DBG_WARN,
"Unsupported event [0x%x]\n", event);
input_report_key(input, keycode, 1);
input_sync(input);
input_report_key(input, keycode, 0);
input_sync(input);
return;
}
if (fujitsu_laptop->flags_supported)
fujitsu_laptop->flags_state =
call_fext_func(FUNC_FLAGS, 0x4, 0x0, 0x0);
i = 0;
while ((irb =
call_fext_func(FUNC_BUTTONS, 0x1, 0x0, 0x0)) != 0
&& (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) {
switch (irb & 0x4ff) {
case KEY1_CODE:
keycode = fujitsu_bl->keycode1;
break;
case KEY2_CODE:
keycode = fujitsu_bl->keycode2;
break;
case KEY3_CODE:
keycode = fujitsu_bl->keycode3;
break;
case KEY4_CODE:
keycode = fujitsu_bl->keycode4;
break;
case KEY5_CODE:
keycode = fujitsu_bl->keycode5;
break;
case 0:
keycode = 0;
break;
default:
vdbg_printk(FUJLAPTOP_DBG_WARN,
"Unknown GIRB result [%x]\n", irb);
keycode = -1;
break;
}
if (keycode > 0)
acpi_fujitsu_laptop_press(keycode);
else if (keycode == 0)
acpi_fujitsu_laptop_release();
}
/* On some models (first seen on the Skylake-based Lifebook
* E736/E746/E756), the touchpad toggle hotkey (Fn+F4) is
* handled in software; its state is queried using FUNC_FLAGS
*/
if ((fujitsu_laptop->flags_supported & BIT(26)) &&
(call_fext_func(FUNC_FLAGS, 0x1, 0x0, 0x0) & BIT(26))) {
keycode = KEY_TOUCHPAD_TOGGLE;
input_report_key(input, keycode, 1);
input_sync(input);
input_report_key(input, keycode, 0);
input_sync(input);
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 143 | 46.28% | 3 | 23.08% |
Michał Kępień | 122 | 39.48% | 4 | 30.77% |
Tony Vroon | 22 | 7.12% | 2 | 15.38% |
Alan Jenkins | 18 | 5.83% | 3 | 23.08% |
Björn Helgaas | 4 | 1.29% | 1 | 7.69% |
Total | 309 | 100.00% | 13 | 100.00% |
/* Initialization */
static const struct acpi_device_id fujitsu_bl_device_ids[] = {
{ACPI_FUJITSU_BL_HID, 0},
{"", 0},
};
static struct acpi_driver acpi_fujitsu_bl_driver = {
.name = ACPI_FUJITSU_BL_DRIVER_NAME,
.class = ACPI_FUJITSU_CLASS,
.ids = fujitsu_bl_device_ids,
.ops = {
.add = acpi_fujitsu_bl_add,
.remove = acpi_fujitsu_bl_remove,
.notify = acpi_fujitsu_bl_notify,
},
};
static const struct acpi_device_id fujitsu_laptop_device_ids[] = {
{ACPI_FUJITSU_LAPTOP_HID, 0},
{"", 0},
};
static struct acpi_driver acpi_fujitsu_laptop_driver = {
.name = ACPI_FUJITSU_LAPTOP_DRIVER_NAME,
.class = ACPI_FUJITSU_CLASS,
.ids = fujitsu_laptop_device_ids,
.ops = {
.add = acpi_fujitsu_laptop_add,
.remove = acpi_fujitsu_laptop_remove,
.notify = acpi_fujitsu_laptop_notify,
},
};
static const struct acpi_device_id fujitsu_ids[] __used = {
{ACPI_FUJITSU_BL_HID, 0},
{ACPI_FUJITSU_LAPTOP_HID, 0},
{"", 0}
};
MODULE_DEVICE_TABLE(acpi, fujitsu_ids);
static int __init fujitsu_init(void)
{
int ret, max_brightness;
if (acpi_disabled)
return -ENODEV;
fujitsu_bl = kzalloc(sizeof(struct fujitsu_bl), GFP_KERNEL);
if (!fujitsu_bl)
return -ENOMEM;
fujitsu_bl->keycode1 = KEY_PROG1;
fujitsu_bl->keycode2 = KEY_PROG2;
fujitsu_bl->keycode3 = KEY_PROG3;
fujitsu_bl->keycode4 = KEY_PROG4;
fujitsu_bl->keycode5 = KEY_RFKILL;
dmi_check_system(fujitsu_dmi_table);
ret = acpi_bus_register_driver(&acpi_fujitsu_bl_driver);
if (ret)
goto fail_acpi;
/* Register platform stuff */
fujitsu_bl->pf_device = platform_device_alloc("fujitsu-laptop", -1);
if (!fujitsu_bl->pf_device) {
ret = -ENOMEM;
goto fail_platform_driver;
}
ret = platform_device_add(fujitsu_bl->pf_device);
if (ret)
goto fail_platform_device1;
ret =
sysfs_create_group(&fujitsu_bl->pf_device->dev.kobj,
&fujitsu_pf_attribute_group);
if (ret)
goto fail_platform_device2;
/* Register backlight stuff */
if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
struct backlight_properties props;
memset(&props, 0, sizeof(struct backlight_properties));
max_brightness = fujitsu_bl->max_brightness;
props.type = BACKLIGHT_PLATFORM;
props.max_brightness = max_brightness - 1;
fujitsu_bl->bl_device = backlight_device_register("fujitsu-laptop",
NULL, NULL,
&fujitsu_bl_ops,
&props);
if (IS_ERR(fujitsu_bl->bl_device)) {
ret = PTR_ERR(fujitsu_bl->bl_device);
fujitsu_bl->bl_device = NULL;
goto fail_sysfs_group;
}
fujitsu_bl->bl_device->props.brightness = fujitsu_bl->brightness_level;
}
ret = platform_driver_register(&fujitsu_pf_driver);
if (ret)
goto fail_backlight;
/* Register laptop driver */
fujitsu_laptop = kzalloc(sizeof(struct fujitsu_laptop), GFP_KERNEL);
if (!fujitsu_laptop) {
ret = -ENOMEM;
goto fail_laptop;
}
ret = acpi_bus_register_driver(&acpi_fujitsu_laptop_driver);
if (ret)
goto fail_laptop1;
/* Sync backlight power status (needs FUJ02E3 device, hence deferred) */
if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
if (call_fext_func(FUNC_BACKLIGHT, 0x2, 0x4, 0x0) == 3)
fujitsu_bl->bl_device->props.power = FB_BLANK_POWERDOWN;
else
fujitsu_bl->bl_device->props.power = FB_BLANK_UNBLANK;
}
pr_info("driver " FUJITSU_DRIVER_VERSION " successfully loaded\n");
return 0;
fail_laptop1:
kfree(fujitsu_laptop);
fail_laptop:
platform_driver_unregister(&fujitsu_pf_driver);
fail_backlight:
backlight_device_unregister(fujitsu_bl->bl_device);
fail_sysfs_group:
sysfs_remove_group(&fujitsu_bl->pf_device->dev.kobj,
&fujitsu_pf_attribute_group);
fail_platform_device2:
platform_device_del(fujitsu_bl->pf_device);
fail_platform_device1:
platform_device_put(fujitsu_bl->pf_device);
fail_platform_driver:
acpi_bus_unregister_driver(&acpi_fujitsu_bl_driver);
fail_acpi:
kfree(fujitsu_bl);
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 286 | 61.64% | 3 | 17.65% |
Alan Jenkins | 47 | 10.13% | 4 | 23.53% |
Matthew Garrett | 40 | 8.62% | 2 | 11.76% |
Tony Vroon | 39 | 8.41% | 1 | 5.88% |
Bartlomiej Zolnierkiewicz | 28 | 6.03% | 1 | 5.88% |
Thomas Renninger | 6 | 1.29% | 1 | 5.88% |
Hans de Goede | 6 | 1.29% | 1 | 5.88% |
Michał Kępień | 5 | 1.08% | 1 | 5.88% |
Joe Perches | 3 | 0.65% | 1 | 5.88% |
Julia Lawall | 2 | 0.43% | 1 | 5.88% |
Michael Karcher | 2 | 0.43% | 1 | 5.88% |
Total | 464 | 100.00% | 17 | 100.00% |
static void __exit fujitsu_cleanup(void)
{
acpi_bus_unregister_driver(&acpi_fujitsu_laptop_driver);
kfree(fujitsu_laptop);
platform_driver_unregister(&fujitsu_pf_driver);
backlight_device_unregister(fujitsu_bl->bl_device);
sysfs_remove_group(&fujitsu_bl->pf_device->dev.kobj,
&fujitsu_pf_attribute_group);
platform_device_unregister(fujitsu_bl->pf_device);
acpi_bus_unregister_driver(&acpi_fujitsu_bl_driver);
kfree(fujitsu_bl);
pr_info("driver unloaded\n");
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 40 | 56.34% | 1 | 12.50% |
Bartlomiej Zolnierkiewicz | 10 | 14.08% | 1 | 12.50% |
Alan Jenkins | 9 | 12.68% | 3 | 37.50% |
Tony Vroon | 7 | 9.86% | 1 | 12.50% |
Stephen Gildea | 3 | 4.23% | 1 | 12.50% |
Joe Perches | 2 | 2.82% | 1 | 12.50% |
Total | 71 | 100.00% | 8 | 100.00% |
module_init(fujitsu_init);
module_exit(fujitsu_cleanup);
module_param(use_alt_lcd_levels, uint, 0644);
MODULE_PARM_DESC(use_alt_lcd_levels,
"Use alternative interface for lcd_levels (needed for Lifebook s6410).");
module_param(disable_brightness_adjust, uint, 0644);
MODULE_PARM_DESC(disable_brightness_adjust, "Disable brightness adjustment .");
#ifdef CONFIG_FUJITSU_LAPTOP_DEBUG
module_param_named(debug, dbg_level, uint, 0644);
MODULE_PARM_DESC(debug, "Sets debug level bit-mask");
#endif
MODULE_AUTHOR("Jonathan Woithe, Peter Gruber, Tony Vroon");
MODULE_DESCRIPTION("Fujitsu laptop extras support");
MODULE_VERSION(FUJITSU_DRIVER_VERSION);
MODULE_LICENSE("GPL");
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jonathan Woithe | 2800 | 51.04% | 8 | 12.70% |
Tony Vroon | 1181 | 21.53% | 4 | 6.35% |
Michał Kępień | 608 | 11.08% | 12 | 19.05% |
Alan Jenkins | 282 | 5.14% | 7 | 11.11% |
Matej Groma | 244 | 4.45% | 2 | 3.17% |
Bartlomiej Zolnierkiewicz | 103 | 1.88% | 1 | 1.59% |
Rui Zhang | 45 | 0.82% | 4 | 6.35% |
Matthew Garrett | 40 | 0.73% | 2 | 3.17% |
Len Brown | 36 | 0.66% | 1 | 1.59% |
Joe Perches | 27 | 0.49% | 1 | 1.59% |
Stephen Gildea | 23 | 0.42% | 1 | 1.59% |
Björn Helgaas | 19 | 0.35% | 2 | 3.17% |
Axel Lin | 13 | 0.24% | 3 | 4.76% |
Hans de Goede | 9 | 0.16% | 1 | 1.59% |
Julia Lawall | 9 | 0.16% | 2 | 3.17% |
Stefani Seibold | 8 | 0.15% | 1 | 1.59% |
Javier Martinez Canillas | 6 | 0.11% | 1 | 1.59% |
Michael Karcher | 6 | 0.11% | 1 | 1.59% |
Mathias Krause | 6 | 0.11% | 1 | 1.59% |
Thomas Renninger | 6 | 0.11% | 1 | 1.59% |
Pavel Machek | 4 | 0.07% | 1 | 1.59% |
Tejun Heo | 3 | 0.05% | 1 | 1.59% |
Matthew Wilcox | 2 | 0.04% | 1 | 1.59% |
Rafael J. Wysocki | 2 | 0.04% | 1 | 1.59% |
Jean Delvare | 2 | 0.04% | 1 | 1.59% |
Adrian Bunk | 1 | 0.02% | 1 | 1.59% |
Lionel Debroux | 1 | 0.02% | 1 | 1.59% |
Total | 5486 | 100.00% | 63 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.