linux/drivers/mfd/stmpe.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * ST Microelectronics MFD: stmpe's driver
 *
 * Copyright (C) ST-Ericsson SA 2010
 *
 * Author: Rabin Vincent <[email protected]> for ST-Ericsson
 */

#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/export.h>
#include <linux/kernel.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/of.h>
#include <linux/pm.h>
#include <linux/slab.h>
#include <linux/mfd/core.h>
#include <linux/delay.h>
#include <linux/regulator/consumer.h>
#include "stmpe.h"

/**
 * struct stmpe_platform_data - STMPE platform data
 * @id: device id to distinguish between multiple STMPEs on the same board
 * @blocks: bitmask of blocks to enable (use STMPE_BLOCK_*)
 * @irq_trigger: IRQ trigger to use for the interrupt to the host
 * @autosleep: bool to enable/disable stmpe autosleep
 * @autosleep_timeout: inactivity timeout in milliseconds for autosleep
 */
struct stmpe_platform_data {};

static int __stmpe_enable(struct stmpe *stmpe, unsigned int blocks)
{}

static int __stmpe_disable(struct stmpe *stmpe, unsigned int blocks)
{}

static int __stmpe_reg_read(struct stmpe *stmpe, u8 reg)
{}

static int __stmpe_reg_write(struct stmpe *stmpe, u8 reg, u8 val)
{}

static int __stmpe_set_bits(struct stmpe *stmpe, u8 reg, u8 mask, u8 val)
{}

static int __stmpe_block_read(struct stmpe *stmpe, u8 reg, u8 length,
			      u8 *values)
{}

static int __stmpe_block_write(struct stmpe *stmpe, u8 reg, u8 length,
			const u8 *values)
{}

/**
 * stmpe_enable - enable blocks on an STMPE device
 * @stmpe:	Device to work on
 * @blocks:	Mask of blocks (enum stmpe_block values) to enable
 */
int stmpe_enable(struct stmpe *stmpe, unsigned int blocks)
{}
EXPORT_SYMBOL_GPL();

/**
 * stmpe_disable - disable blocks on an STMPE device
 * @stmpe:	Device to work on
 * @blocks:	Mask of blocks (enum stmpe_block values) to enable
 */
int stmpe_disable(struct stmpe *stmpe, unsigned int blocks)
{}
EXPORT_SYMBOL_GPL();

/**
 * stmpe_reg_read() - read a single STMPE register
 * @stmpe:	Device to read from
 * @reg:	Register to read
 */
int stmpe_reg_read(struct stmpe *stmpe, u8 reg)
{}
EXPORT_SYMBOL_GPL();

/**
 * stmpe_reg_write() - write a single STMPE register
 * @stmpe:	Device to write to
 * @reg:	Register to write
 * @val:	Value to write
 */
int stmpe_reg_write(struct stmpe *stmpe, u8 reg, u8 val)
{}
EXPORT_SYMBOL_GPL();

/**
 * stmpe_set_bits() - set the value of a bitfield in a STMPE register
 * @stmpe:	Device to write to
 * @reg:	Register to write
 * @mask:	Mask of bits to set
 * @val:	Value to set
 */
int stmpe_set_bits(struct stmpe *stmpe, u8 reg, u8 mask, u8 val)
{}
EXPORT_SYMBOL_GPL();

/**
 * stmpe_block_read() - read multiple STMPE registers
 * @stmpe:	Device to read from
 * @reg:	First register
 * @length:	Number of registers
 * @values:	Buffer to write to
 */
int stmpe_block_read(struct stmpe *stmpe, u8 reg, u8 length, u8 *values)
{}
EXPORT_SYMBOL_GPL();

/**
 * stmpe_block_write() - write multiple STMPE registers
 * @stmpe:	Device to write to
 * @reg:	First register
 * @length:	Number of registers
 * @values:	Values to write
 */
int stmpe_block_write(struct stmpe *stmpe, u8 reg, u8 length,
		      const u8 *values)
{}
EXPORT_SYMBOL_GPL();

/**
 * stmpe_set_altfunc()- set the alternate function for STMPE pins
 * @stmpe:	Device to configure
 * @pins:	Bitmask of pins to affect
 * @block:	block to enable alternate functions for
 *
 * @pins is assumed to have a bit set for each of the bits whose alternate
 * function is to be changed, numbered according to the GPIOXY numbers.
 *
 * If the GPIO module is not enabled, this function automatically enables it in
 * order to perform the change.
 */
int stmpe_set_altfunc(struct stmpe *stmpe, u32 pins, enum stmpe_block block)
{}
EXPORT_SYMBOL_GPL();

/*
 * GPIO (all variants)
 */

static struct resource stmpe_gpio_resources[] =;

static const struct mfd_cell stmpe_gpio_cell =;

static const struct mfd_cell stmpe_gpio_cell_noirq =;

/*
 * Keypad (1601, 2401, 2403)
 */

static struct resource stmpe_keypad_resources[] =;

static const struct mfd_cell stmpe_keypad_cell =;

/*
 * PWM (1601, 2401, 2403)
 */
static struct resource stmpe_pwm_resources[] =;

static const struct mfd_cell stmpe_pwm_cell =;

/*
 * STMPE801
 */
static const u8 stmpe801_regs[] =;

static struct stmpe_variant_block stmpe801_blocks[] =;

static struct stmpe_variant_block stmpe801_blocks_noirq[] =;

static int stmpe801_enable(struct stmpe *stmpe, unsigned int blocks,
			   bool enable)
{}

static struct stmpe_variant_info stmpe801 =;

static struct stmpe_variant_info stmpe801_noirq =;

/*
 * Touchscreen (STMPE811 or STMPE610)
 */

static struct resource stmpe_ts_resources[] =;

static const struct mfd_cell stmpe_ts_cell =;

/*
 * ADC (STMPE811)
 */

static struct resource stmpe_adc_resources[] =;

static const struct mfd_cell stmpe_adc_cell =;

/*
 * STMPE811 or STMPE610
 */

static const u8 stmpe811_regs[] =;

static struct stmpe_variant_block stmpe811_blocks[] =;

static int stmpe811_enable(struct stmpe *stmpe, unsigned int blocks,
			   bool enable)
{}

int stmpe811_adc_common_init(struct stmpe *stmpe)
{}
EXPORT_SYMBOL_GPL();

static int stmpe811_get_altfunc(struct stmpe *stmpe, enum stmpe_block block)
{}

static struct stmpe_variant_info stmpe811 =;

/* Similar to 811, except number of gpios */
static struct stmpe_variant_info stmpe610 =;

/*
 * STMPE1600
 * Compared to all others STMPE variant, LSB and MSB regs are located in this
 * order :	LSB   addr
 *		MSB   addr + 1
 * As there is only 2 * 8bits registers for GPMR/GPSR/IEGPIOPR, CSB index is MSB registers
 */

static const u8 stmpe1600_regs[] =;

static struct stmpe_variant_block stmpe1600_blocks[] =;

static int stmpe1600_enable(struct stmpe *stmpe, unsigned int blocks,
			   bool enable)
{}

static struct stmpe_variant_info stmpe1600 =;

/*
 * STMPE1601
 */

static const u8 stmpe1601_regs[] =;

static struct stmpe_variant_block stmpe1601_blocks[] =;

/* supported autosleep timeout delay (in msecs) */
static const int stmpe_autosleep_delay[] =;

static int stmpe_round_timeout(int timeout)
{}

static int stmpe_autosleep(struct stmpe *stmpe, int autosleep_timeout)
{}

/*
 * Both stmpe 1601/2403 support same layout for autosleep
 */
static int stmpe1601_autosleep(struct stmpe *stmpe,
		int autosleep_timeout)
{}

static int stmpe1601_enable(struct stmpe *stmpe, unsigned int blocks,
			    bool enable)
{}

static int stmpe1601_get_altfunc(struct stmpe *stmpe, enum stmpe_block block)
{}

static struct stmpe_variant_info stmpe1601 =;

/*
 * STMPE1801
 */
static const u8 stmpe1801_regs[] =;

static struct stmpe_variant_block stmpe1801_blocks[] =;

static int stmpe1801_enable(struct stmpe *stmpe, unsigned int blocks,
			    bool enable)
{}

static int stmpe_reset(struct stmpe *stmpe)
{}

static struct stmpe_variant_info stmpe1801 =;

/*
 * STMPE24XX
 */

static const u8 stmpe24xx_regs[] =;

static struct stmpe_variant_block stmpe24xx_blocks[] =;

static int stmpe24xx_enable(struct stmpe *stmpe, unsigned int blocks,
			    bool enable)
{}

static int stmpe24xx_get_altfunc(struct stmpe *stmpe, enum stmpe_block block)
{}

static struct stmpe_variant_info stmpe2401 =;

static struct stmpe_variant_info stmpe2403 =;

static struct stmpe_variant_info *stmpe_variant_info[STMPE_NBR_PARTS] =;

/*
 * These devices can be connected in a 'no-irq' configuration - the irq pin
 * is not used and the device cannot interrupt the CPU. Here we only list
 * devices which support this configuration - the driver will fail probing
 * for any devices not listed here which are configured in this way.
 */
static struct stmpe_variant_info *stmpe_noirq_variant_info[STMPE_NBR_PARTS] =;

static irqreturn_t stmpe_irq(int irq, void *data)
{}

static void stmpe_irq_lock(struct irq_data *data)
{}

static void stmpe_irq_sync_unlock(struct irq_data *data)
{}

static void stmpe_irq_mask(struct irq_data *data)
{}

static void stmpe_irq_unmask(struct irq_data *data)
{}

static struct irq_chip stmpe_irq_chip =;

static int stmpe_irq_map(struct irq_domain *d, unsigned int virq,
                                irq_hw_number_t hwirq)
{}

static void stmpe_irq_unmap(struct irq_domain *d, unsigned int virq)
{}

static const struct irq_domain_ops stmpe_irq_ops =;

static int stmpe_irq_init(struct stmpe *stmpe, struct device_node *np)
{}

static int stmpe_chip_init(struct stmpe *stmpe)
{}

static int stmpe_add_device(struct stmpe *stmpe, const struct mfd_cell *cell)
{}

static int stmpe_devices_init(struct stmpe *stmpe)
{}

static void stmpe_of_probe(struct stmpe_platform_data *pdata,
			   struct device_node *np)
{}

/* Called from client specific probe routines */
int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum)
{}

void stmpe_remove(struct stmpe *stmpe)
{}

static int stmpe_suspend(struct device *dev)
{}

static int stmpe_resume(struct device *dev)
{}

EXPORT_GPL_SIMPLE_DEV_PM_OPS();