linux/drivers/gpio/gpio-eic-sprd.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2018 Spreadtrum Communications Inc.
 * Copyright (C) 2018 Linaro Ltd.
 */

#include <linux/bitops.h>
#include <linux/gpio/driver.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/notifier.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/spinlock.h>

/* EIC registers definition */
#define SPRD_EIC_DBNC_DATA
#define SPRD_EIC_DBNC_DMSK
#define SPRD_EIC_DBNC_IEV
#define SPRD_EIC_DBNC_IE
#define SPRD_EIC_DBNC_RIS
#define SPRD_EIC_DBNC_MIS
#define SPRD_EIC_DBNC_IC
#define SPRD_EIC_DBNC_TRIG
#define SPRD_EIC_DBNC_CTRL0

#define SPRD_EIC_LATCH_INTEN
#define SPRD_EIC_LATCH_INTRAW
#define SPRD_EIC_LATCH_INTMSK
#define SPRD_EIC_LATCH_INTCLR
#define SPRD_EIC_LATCH_INTPOL
#define SPRD_EIC_LATCH_INTMODE

#define SPRD_EIC_ASYNC_INTIE
#define SPRD_EIC_ASYNC_INTRAW
#define SPRD_EIC_ASYNC_INTMSK
#define SPRD_EIC_ASYNC_INTCLR
#define SPRD_EIC_ASYNC_INTMODE
#define SPRD_EIC_ASYNC_INTBOTH
#define SPRD_EIC_ASYNC_INTPOL
#define SPRD_EIC_ASYNC_DATA

#define SPRD_EIC_SYNC_INTIE
#define SPRD_EIC_SYNC_INTRAW
#define SPRD_EIC_SYNC_INTMSK
#define SPRD_EIC_SYNC_INTCLR
#define SPRD_EIC_SYNC_INTMODE
#define SPRD_EIC_SYNC_INTBOTH
#define SPRD_EIC_SYNC_INTPOL
#define SPRD_EIC_SYNC_DATA

/*
 * The digital-chip EIC controller can support maximum 3 banks, and each bank
 * contains 8 EICs.
 */
#define SPRD_EIC_MAX_BANK
#define SPRD_EIC_PER_BANK_NR
#define SPRD_EIC_DATA_MASK
#define SPRD_EIC_BIT(x)
#define SPRD_EIC_DBNC_MASK

/*
 * The Spreadtrum EIC (external interrupt controller) can be used only in
 * input mode to generate interrupts if detecting input signals.
 *
 * The Spreadtrum digital-chip EIC controller contains 4 sub-modules:
 * debounce EIC, latch EIC, async EIC and sync EIC,
 *
 * The debounce EIC is used to capture the input signals' stable status
 * (millisecond resolution) and a single-trigger mechanism is introduced
 * into this sub-module to enhance the input event detection reliability.
 * The debounce range is from 1ms to 4s with a step size of 1ms.
 *
 * The latch EIC is used to latch some special power down signals and
 * generate interrupts, since the latch EIC does not depend on the APB clock
 * to capture signals.
 *
 * The async EIC uses a 32k clock to capture the short signals (microsecond
 * resolution) to generate interrupts by level or edge trigger.
 *
 * The EIC-sync is similar with GPIO's input function, which is a synchronized
 * signal input register.
 */
enum sprd_eic_type {};

struct sprd_eic {};

static ATOMIC_NOTIFIER_HEAD(sprd_eic_irq_notifier);

static struct sprd_eic *to_sprd_eic(struct notifier_block *nb)
{}

struct sprd_eic_variant_data {};

static const char *sprd_eic_label_name[SPRD_EIC_MAX] =;

static const struct sprd_eic_variant_data sc9860_eic_dbnc_data =;

static const struct sprd_eic_variant_data sc9860_eic_latch_data =;

static const struct sprd_eic_variant_data sc9860_eic_async_data =;

static const struct sprd_eic_variant_data sc9860_eic_sync_data =;

static inline void __iomem *sprd_eic_offset_base(struct sprd_eic *sprd_eic,
						 unsigned int bank)
{}

static void sprd_eic_update(struct gpio_chip *chip, unsigned int offset,
			    u16 reg, unsigned int val)
{}

static int sprd_eic_read(struct gpio_chip *chip, unsigned int offset, u16 reg)
{}

static int sprd_eic_request(struct gpio_chip *chip, unsigned int offset)
{}

static void sprd_eic_free(struct gpio_chip *chip, unsigned int offset)
{}

static int sprd_eic_get(struct gpio_chip *chip, unsigned int offset)
{}

static int sprd_eic_direction_input(struct gpio_chip *chip, unsigned int offset)
{}

static void sprd_eic_set(struct gpio_chip *chip, unsigned int offset, int value)
{}

static int sprd_eic_set_debounce(struct gpio_chip *chip, unsigned int offset,
				 unsigned int debounce)
{}

static int sprd_eic_set_config(struct gpio_chip *chip, unsigned int offset,
			       unsigned long config)
{}

static void sprd_eic_irq_mask(struct irq_data *data)
{}

static void sprd_eic_irq_unmask(struct irq_data *data)
{}

static void sprd_eic_irq_ack(struct irq_data *data)
{}

static int sprd_eic_irq_set_type(struct irq_data *data, unsigned int flow_type)
{}

static void sprd_eic_toggle_trigger(struct gpio_chip *chip, unsigned int irq,
				    unsigned int offset)
{}

static void sprd_eic_handle_one_type(struct gpio_chip *chip)
{}

static void sprd_eic_irq_handler(struct irq_desc *desc)
{}

static int sprd_eic_irq_notify(struct notifier_block *nb, unsigned long action,
			       void *data)
{}

static const struct irq_chip sprd_eic_irq =;

static void sprd_eic_unregister_notifier(void *data)
{}

static int sprd_eic_probe(struct platform_device *pdev)
{}

static const struct of_device_id sprd_eic_of_match[] =;
MODULE_DEVICE_TABLE(of, sprd_eic_of_match);

static struct platform_driver sprd_eic_driver =;

module_platform_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();