linux/drivers/gpio/gpio-xlp.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2003-2015 Broadcom Corporation
 * All Rights Reserved
 */

#include <linux/gpio/driver.h>
#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/irqchip/chained_irq.h>
#include <linux/acpi.h>

/*
 * XLP GPIO has multiple 32 bit registers for each feature where each register
 * controls 32 pins. So, pins up to 64 require 2 32-bit registers and up to 96
 * require 3 32-bit registers for each feature.
 * Here we only define offset of the first register for each feature. Offset of
 * the registers for pins greater than 32 can be calculated as following(Use
 * GPIO_INT_STAT as example):
 *
 * offset = (gpio / XLP_GPIO_REGSZ) * 4;
 * reg_addr = addr + offset;
 *
 * where addr is base address of the that feature register and gpio is the pin.
 */
#define GPIO_9XX_BYTESWAP
#define GPIO_9XX_CTRL
#define GPIO_9XX_OUTPUT_EN
#define GPIO_9XX_PADDRV
/*
 * Only for 4 interrupt enable reg are defined for now,
 * total reg available are 12.
 */
#define GPIO_9XX_INT_EN00
#define GPIO_9XX_INT_EN10
#define GPIO_9XX_INT_EN20
#define GPIO_9XX_INT_EN30
#define GPIO_9XX_INT_POL
#define GPIO_9XX_INT_TYPE
#define GPIO_9XX_INT_STAT

/* Interrupt type register mask */
#define XLP_GPIO_IRQ_TYPE_LVL
#define XLP_GPIO_IRQ_TYPE_EDGE

/* Interrupt polarity register mask */
#define XLP_GPIO_IRQ_POL_HIGH
#define XLP_GPIO_IRQ_POL_LOW

#define XLP_GPIO_REGSZ
#define XLP_GPIO_IRQ_BASE
#define XLP_MAX_NR_GPIO

struct xlp_gpio_priv {};

static int xlp_gpio_get_reg(void __iomem *addr, unsigned gpio)
{}

static void xlp_gpio_set_reg(void __iomem *addr, unsigned gpio, int state)
{}

static void xlp_gpio_irq_enable(struct irq_data *d)
{}

static void xlp_gpio_irq_disable(struct irq_data *d)
{}

static void xlp_gpio_irq_mask_ack(struct irq_data *d)
{}

static void xlp_gpio_irq_unmask(struct irq_data *d)
{}

static int xlp_gpio_set_irq_type(struct irq_data *d, unsigned int type)
{}

static struct irq_chip xlp_gpio_irq_chip =;

static void xlp_gpio_generic_handler(struct irq_desc *desc)
{}

static int xlp_gpio_dir_output(struct gpio_chip *gc, unsigned gpio, int state)
{}

static int xlp_gpio_dir_input(struct gpio_chip *gc, unsigned gpio)
{}

static int xlp_gpio_get(struct gpio_chip *gc, unsigned gpio)
{}

static void xlp_gpio_set(struct gpio_chip *gc, unsigned gpio, int state)
{}

static int xlp_gpio_probe(struct platform_device *pdev)
{}

#ifdef CONFIG_ACPI
static const struct acpi_device_id xlp_gpio_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, xlp_gpio_acpi_match);
#endif

static struct platform_driver xlp_gpio_driver =;
module_platform_driver();

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