linux/drivers/gpio/gpio-ts5500.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Digital I/O driver for Technologic Systems TS-5500
 *
 * Copyright (c) 2012 Savoir-faire Linux Inc.
 *	Vivien Didelot <[email protected]>
 *
 * Technologic Systems platforms have pin blocks, exposing several Digital
 * Input/Output lines (DIO). This driver aims to support single pin blocks.
 * In that sense, the support is not limited to the TS-5500 blocks.
 * Actually, the following platforms have DIO support:
 *
 * TS-5500:
 *   Documentation: https://docs.embeddedts.com/TS-5500
 *   Blocks: DIO1, DIO2 and LCD port.
 *
 * TS-5600:
 *   Documentation: https://docs.embeddedts.com/TS-5600
 *   Blocks: LCD port (identical to TS-5500 LCD).
 */

#include <linux/bitops.h>
#include <linux/gpio/driver.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>

/* List of supported Technologic Systems platforms DIO blocks */
enum ts5500_blocks {};

struct ts5500_priv {};

/*
 * Hex 7D is used to control several blocks (e.g. DIO2 and LCD port).
 * This flag ensures that the region has been requested by this driver.
 */
static bool hex7d_reserved;

/*
 * This structure is used to describe capabilities of DIO lines,
 * such as available directions and connected interrupt (if any).
 */
struct ts5500_dio {};

#define TS5500_DIO_IN_OUT(vaddr, vbit, caddr, cbit)

#define TS5500_DIO_IN(addr, bit)

#define TS5500_DIO_IN_IRQ(addr, bit, _irq)

#define TS5500_DIO_OUT(addr, bit)

/*
 * Input/Output DIO lines are programmed in groups of 4. Their values are
 * available through 4 consecutive bits in a value port, whereas the direction
 * of these 4 lines is driven by only 1 bit in a control port.
 */
#define TS5500_DIO_GROUP(vaddr, vbitfrom, caddr, cbit)

/*
 * TS-5500 DIO1 block
 *
 *  value    control  dir    hw
 *  addr bit addr bit in out irq name     pin offset
 *
 *  0x7b  0  0x7a  0  x   x      DIO1_0   1   0
 *  0x7b  1  0x7a  0  x   x      DIO1_1   3   1
 *  0x7b  2  0x7a  0  x   x      DIO1_2   5   2
 *  0x7b  3  0x7a  0  x   x      DIO1_3   7   3
 *  0x7b  4  0x7a  1  x   x      DIO1_4   9   4
 *  0x7b  5  0x7a  1  x   x      DIO1_5   11  5
 *  0x7b  6  0x7a  1  x   x      DIO1_6   13  6
 *  0x7b  7  0x7a  1  x   x      DIO1_7   15  7
 *  0x7c  0  0x7a  5  x   x      DIO1_8   4   8
 *  0x7c  1  0x7a  5  x   x      DIO1_9   6   9
 *  0x7c  2  0x7a  5  x   x      DIO1_10  8   10
 *  0x7c  3  0x7a  5  x   x      DIO1_11  10  11
 *  0x7c  4           x          DIO1_12  12  12
 *  0x7c  5           x      7   DIO1_13  14  13
 */
static const struct ts5500_dio ts5500_dio1[] =;

/*
 * TS-5500 DIO2 block
 *
 *  value    control  dir    hw
 *  addr bit addr bit in out irq name     pin offset
 *
 *  0x7e  0  0x7d  0  x   x      DIO2_0   1   0
 *  0x7e  1  0x7d  0  x   x      DIO2_1   3   1
 *  0x7e  2  0x7d  0  x   x      DIO2_2   5   2
 *  0x7e  3  0x7d  0  x   x      DIO2_3   7   3
 *  0x7e  4  0x7d  1  x   x      DIO2_4   9   4
 *  0x7e  5  0x7d  1  x   x      DIO2_5   11  5
 *  0x7e  6  0x7d  1  x   x      DIO2_6   13  6
 *  0x7e  7  0x7d  1  x   x      DIO2_7   15  7
 *  0x7f  0  0x7d  5  x   x      DIO2_8   4   8
 *  0x7f  1  0x7d  5  x   x      DIO2_9   6   9
 *  0x7f  2  0x7d  5  x   x      DIO2_10  8   10
 *  0x7f  3  0x7d  5  x   x      DIO2_11  10  11
 *  0x7f  4           x      6   DIO2_13  14  12
 */
static const struct ts5500_dio ts5500_dio2[] =;

/*
 * TS-5500 LCD port used as DIO block
 * TS-5600 LCD port is identical
 *
 *  value    control  dir    hw
 *  addr bit addr bit in out irq name    pin offset
 *
 *  0x72  0  0x7d  2  x   x      LCD_0   8   0
 *  0x72  1  0x7d  2  x   x      LCD_1   7   1
 *  0x72  2  0x7d  2  x   x      LCD_2   10  2
 *  0x72  3  0x7d  2  x   x      LCD_3   9   3
 *  0x72  4  0x7d  3  x   x      LCD_4   12  4
 *  0x72  5  0x7d  3  x   x      LCD_5   11  5
 *  0x72  6  0x7d  3  x   x      LCD_6   14  6
 *  0x72  7  0x7d  3  x   x      LCD_7   13  7
 *  0x73  0               x      LCD_EN  5   8
 *  0x73  6           x          LCD_WR  6   9
 *  0x73  7           x      1   LCD_RS  3   10
 */
static const struct ts5500_dio ts5500_lcd[] =;

static inline void ts5500_set_mask(u8 mask, u8 addr)
{}

static inline void ts5500_clear_mask(u8 mask, u8 addr)
{}

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

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

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

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

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

static int ts5500_enable_irq(struct ts5500_priv *priv)
{}

static void ts5500_disable_irq(struct ts5500_priv *priv)
{}

static int ts5500_dio_probe(struct platform_device *pdev)
{}

static void ts5500_dio_remove(struct platform_device *pdev)
{}

static const struct platform_device_id ts5500_dio_ids[] =;
MODULE_DEVICE_TABLE(platform, ts5500_dio_ids);

static struct platform_driver ts5500_dio_driver =;

module_platform_driver();

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