linux/drivers/platform/x86/samsung-laptop.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Samsung Laptop driver
 *
 * Copyright (C) 2009,2011 Greg Kroah-Hartman ([email protected])
 * Copyright (C) 2009,2011 Novell Inc.
 */
#define pr_fmt(fmt)

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/backlight.h>
#include <linux/leds.h>
#include <linux/dmi.h>
#include <linux/platform_device.h>
#include <linux/rfkill.h>
#include <linux/acpi.h>
#include <linux/seq_file.h>
#include <linux/debugfs.h>
#include <linux/ctype.h>
#include <linux/efi.h>
#include <linux/suspend.h>
#include <acpi/video.h>

/*
 * This driver is needed because a number of Samsung laptops do not hook
 * their control settings through ACPI.  So we have to poke around in the
 * BIOS to do things like brightness values, and "special" key controls.
 */

/*
 * We have 0 - 8 as valid brightness levels.  The specs say that level 0 should
 * be reserved by the BIOS (which really doesn't make much sense), we tell
 * userspace that the value is 0 - 7 and then just tell the hardware 1 - 8
 */
#define MAX_BRIGHT


#define SABI_IFACE_MAIN
#define SABI_IFACE_SUB
#define SABI_IFACE_COMPLETE
#define SABI_IFACE_DATA

#define WL_STATUS_WLAN
#define WL_STATUS_BT

/* Structure get/set data using sabi */
struct sabi_data {};

struct sabi_header_offsets {};

struct sabi_commands {};

struct sabi_performance_level {};

struct sabi_config {};

static const struct sabi_config sabi_configs[] =;

/*
 * samsung-laptop/    - debugfs root directory
 *   f0000_segment    - dump f0000 segment
 *   command          - current command
 *   data             - current data
 *   d0, d1, d2, d3   - data fields
 *   call             - call SABI using command and data
 *
 * This allow to call arbitrary sabi commands wihout
 * modifying the driver at all.
 * For example, setting the keyboard backlight brightness to 5
 *
 *  echo 0x78 > command
 *  echo 0x0582 > d0
 *  echo 0 > d1
 *  echo 0 > d2
 *  echo 0 > d3
 *  cat call
 */

struct samsung_laptop_debug {};

struct samsung_laptop;

struct samsung_rfkill {};

struct samsung_laptop {};

struct samsung_quirks {};

static struct samsung_quirks samsung_unknown =;

static struct samsung_quirks samsung_np740u3e =;

static struct samsung_quirks samsung_lid_handling =;

static bool force;
module_param(force, bool, 0);
MODULE_PARM_DESC();

static bool debug;
module_param(debug, bool, 0644);
MODULE_PARM_DESC();

static int sabi_command(struct samsung_laptop *samsung, u16 command,
			struct sabi_data *in,
			struct sabi_data *out)
{}

/* simple wrappers usable with most commands */
static int sabi_set_commandb(struct samsung_laptop *samsung,
			     u16 command, u8 data)
{}

static int read_brightness(struct samsung_laptop *samsung)
{}

static void set_brightness(struct samsung_laptop *samsung, u8 user_brightness)
{}

static int get_brightness(struct backlight_device *bd)
{}

static void check_for_stepping_quirk(struct samsung_laptop *samsung)
{}

static int update_status(struct backlight_device *bd)
{}

static const struct backlight_ops backlight_ops =;

static int seclinux_rfkill_set(void *data, bool blocked)
{}

static const struct rfkill_ops seclinux_rfkill_ops =;

static int swsmi_wireless_status(struct samsung_laptop *samsung,
				 struct sabi_data *data)
{}

static int swsmi_rfkill_set(void *priv, bool blocked)
{}

static void swsmi_rfkill_query(struct rfkill *rfkill, void *priv)
{}

static const struct rfkill_ops swsmi_rfkill_ops =;

static ssize_t get_performance_level(struct device *dev,
				     struct device_attribute *attr, char *buf)
{}

static ssize_t set_performance_level(struct device *dev,
				struct device_attribute *attr, const char *buf,
				size_t count)
{}

static DEVICE_ATTR(performance_level, 0644,
		   get_performance_level, set_performance_level);

static int read_battery_life_extender(struct samsung_laptop *samsung)
{}

static int write_battery_life_extender(struct samsung_laptop *samsung,
				       int enabled)
{}

static ssize_t get_battery_life_extender(struct device *dev,
					 struct device_attribute *attr,
					 char *buf)
{}

static ssize_t set_battery_life_extender(struct device *dev,
					struct device_attribute *attr,
					const char *buf, size_t count)
{}

static DEVICE_ATTR(battery_life_extender, 0644,
		   get_battery_life_extender, set_battery_life_extender);

static int read_usb_charge(struct samsung_laptop *samsung)
{}

static int write_usb_charge(struct samsung_laptop *samsung,
			    int enabled)
{}

static ssize_t get_usb_charge(struct device *dev,
			      struct device_attribute *attr,
			      char *buf)
{}

static ssize_t set_usb_charge(struct device *dev,
			      struct device_attribute *attr,
			      const char *buf, size_t count)
{}

static DEVICE_ATTR(usb_charge, 0644,
		   get_usb_charge, set_usb_charge);

static int read_lid_handling(struct samsung_laptop *samsung)
{}

static int write_lid_handling(struct samsung_laptop *samsung,
			      int enabled)
{}

static ssize_t get_lid_handling(struct device *dev,
				struct device_attribute *attr,
				char *buf)
{}

static ssize_t set_lid_handling(struct device *dev,
				struct device_attribute *attr,
				const char *buf, size_t count)
{}

static DEVICE_ATTR(lid_handling, 0644,
		   get_lid_handling, set_lid_handling);

static struct attribute *platform_attributes[] =;

static int find_signature(void __iomem *memcheck, const char *testStr)
{}

static void samsung_rfkill_exit(struct samsung_laptop *samsung)
{}

static int samsung_new_rfkill(struct samsung_laptop *samsung,
			      struct samsung_rfkill *arfkill,
			      const char *name, enum rfkill_type type,
			      const struct rfkill_ops *ops,
			      int blocked)
{}

static int __init samsung_rfkill_init_seclinux(struct samsung_laptop *samsung)
{}

static int __init samsung_rfkill_init_swsmi(struct samsung_laptop *samsung)
{}

static int __init samsung_rfkill_init(struct samsung_laptop *samsung)
{}

static void samsung_lid_handling_exit(struct samsung_laptop *samsung)
{}

static int __init samsung_lid_handling_init(struct samsung_laptop *samsung)
{}

static int kbd_backlight_enable(struct samsung_laptop *samsung)
{}

static int kbd_backlight_read(struct samsung_laptop *samsung)
{}

static int kbd_backlight_write(struct samsung_laptop *samsung, int brightness)
{}

static void kbd_led_update(struct work_struct *work)
{}

static void kbd_led_set(struct led_classdev *led_cdev,
			enum led_brightness value)
{}

static enum led_brightness kbd_led_get(struct led_classdev *led_cdev)
{}

static void samsung_leds_exit(struct samsung_laptop *samsung)
{}

static int __init samsung_leds_init(struct samsung_laptop *samsung)
{}

static void samsung_backlight_exit(struct samsung_laptop *samsung)
{}

static int __init samsung_backlight_init(struct samsung_laptop *samsung)
{}

static umode_t samsung_sysfs_is_visible(struct kobject *kobj,
					struct attribute *attr, int idx)
{}

static const struct attribute_group platform_attribute_group =;

static void samsung_sysfs_exit(struct samsung_laptop *samsung)
{}

static int __init samsung_sysfs_init(struct samsung_laptop *samsung)
{}

static int samsung_laptop_call_show(struct seq_file *m, void *data)
{}
DEFINE_SHOW_ATTRIBUTE();

static void samsung_debugfs_exit(struct samsung_laptop *samsung)
{}

static void samsung_debugfs_init(struct samsung_laptop *samsung)
{}

static void samsung_sabi_exit(struct samsung_laptop *samsung)
{}

static __init void samsung_sabi_infos(struct samsung_laptop *samsung, int loca,
				      unsigned int ifaceP)
{}

static void __init samsung_sabi_diag(struct samsung_laptop *samsung)
{}

static int __init samsung_sabi_init(struct samsung_laptop *samsung)
{}

static void samsung_platform_exit(struct samsung_laptop *samsung)
{}

static int samsung_pm_notification(struct notifier_block *nb,
				   unsigned long val, void *ptr)
{}

static int __init samsung_platform_init(struct samsung_laptop *samsung)
{}

static struct samsung_quirks *quirks;

static int __init samsung_dmi_matched(const struct dmi_system_id *d)
{}

static const struct dmi_system_id samsung_dmi_table[] __initconst =;
MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);

static struct platform_device *samsung_platform_device;

static int __init samsung_init(void)
{}

static void __exit samsung_exit(void)
{}

module_init();
module_exit(samsung_exit);

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();