linux/drivers/leds/leds-ss4200.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * SS4200-E Hardware API
 * Copyright (c) 2009, Intel Corporation.
 * Copyright IBM Corporation, 2009
 *
 * Author: Dave Hansen <[email protected]>
 */

#define pr_fmt(fmt)

#include <linux/dmi.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/kernel.h>
#include <linux/leds.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/types.h>
#include <linux/uaccess.h>

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

/*
 * ICH7 LPC/GPIO PCI Config register offsets
 */
#define PMBASE
#define GPIO_BASE
#define GPIO_CTRL
#define GPIO_EN

/*
 * The ICH7 GPIO register block is 64 bytes in size.
 */
#define ICH7_GPIO_SIZE

/*
 * Define register offsets within the ICH7 register block.
 */
#define GPIO_USE_SEL
#define GP_IO_SEL
#define GP_LVL
#define GPO_BLINK
#define GPI_INV
#define GPIO_USE_SEL2
#define GP_IO_SEL2
#define GP_LVL2

/*
 * PCI ID of the Intel ICH7 LPC Device within which the GPIO block lives.
 */
static const struct pci_device_id ich7_lpc_pci_id[] =;

MODULE_DEVICE_TABLE(pci, ich7_lpc_pci_id);

static int __init ss4200_led_dmi_callback(const struct dmi_system_id *id)
{}

static bool nodetect;
module_param_named(nodetect, nodetect, bool, 0);
MODULE_PARM_DESC();

/*
 * struct nas_led_whitelist - List of known good models
 *
 * Contains the known good models this driver is compatible with.
 * When adding a new model try to be as strict as possible. This
 * makes it possible to keep the false positives (the model is
 * detected as working, but in reality it is not) as low as
 * possible.
 */
static const struct dmi_system_id nas_led_whitelist[] __initconst =;

/*
 * Base I/O address assigned to the Power Management register block
 */
static u32 g_pm_io_base;

/*
 * Base I/O address assigned to the ICH7 GPIO register block
 */
static u32 nas_gpio_io_base;

/*
 * When we successfully register a region, we are returned a resource.
 * We use these to identify which regions we need to release on our way
 * back out.
 */
static struct resource *gp_gpio_resource;

struct nasgpio_led {};

/*
 * gpio_bit(s) are the ICH7 GPIO bit assignments
 */
static struct nasgpio_led nasgpio_leds[] =;

#define NAS_RECOVERY

static struct nasgpio_led *
led_classdev_to_nasgpio_led(struct led_classdev *led_cdev)
{}

static struct nasgpio_led *get_led_named(char *name)
{}

/*
 * This protects access to the gpio ports.
 */
static DEFINE_SPINLOCK(nasgpio_gpio_lock);

/*
 * There are two gpio ports, one for blinking and the other
 * for power.  @port tells us if we're doing blinking or
 * power control.
 *
 * Caller must hold nasgpio_gpio_lock
 */
static void __nasgpio_led_set_attr(struct led_classdev *led_cdev,
				   u32 port, u32 value)
{}

static void nasgpio_led_set_attr(struct led_classdev *led_cdev,
				 u32 port, u32 value)
{}

static u32 nasgpio_led_get_attr(struct led_classdev *led_cdev, u32 port)
{}

/*
 * There is actual brightness control in the hardware,
 * but it is via smbus commands and not implemented
 * in this driver.
 */
static void nasgpio_led_set_brightness(struct led_classdev *led_cdev,
				       enum led_brightness brightness)
{}

static int nasgpio_led_set_blink(struct led_classdev *led_cdev,
				 unsigned long *delay_on,
				 unsigned long *delay_off)
{}


/*
 * Initialize the ICH7 GPIO registers for NAS usage.  The BIOS should have
 * already taken care of this, but we will do so in a non destructive manner
 * so that we have what we need whether the BIOS did it or not.
 */
static int ich7_gpio_init(struct device *dev)
{}

static void ich7_lpc_cleanup(struct device *dev)
{}

/*
 * The OS has determined that the LPC of the Intel ICH7 Southbridge is present
 * so we can retrive the required operational information and prepare the GPIO.
 */
static struct pci_dev *nas_gpio_pci_dev;
static int ich7_lpc_probe(struct pci_dev *dev,
				    const struct pci_device_id *id)
{}

static void ich7_lpc_remove(struct pci_dev *dev)
{}

/*
 * pci_driver structure passed to the PCI modules
 */
static struct pci_driver nas_gpio_pci_driver =;

static struct led_classdev *get_classdev_for_led_nr(int nr)
{}


static void set_power_light_amber_noblink(void)
{}

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

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

static DEVICE_ATTR_RW(blink);

static struct attribute *nasgpio_led_attrs[] =;
ATTRIBUTE_GROUPS();

static int register_nasgpio_led(int led_nr)
{}

static void unregister_nasgpio_led(int led_nr)
{}
/*
 * module load/initialization
 */
static int __init nas_gpio_init(void)
{}

/*
 * module unload
 */
static void __exit nas_gpio_exit(void)
{}

module_init();
module_exit(nas_gpio_exit);