linux/drivers/input/keyboard/twl4030_keypad.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * twl4030_keypad.c - driver for 8x8 keypad controller in twl4030 chips
 *
 * Copyright (C) 2007 Texas Instruments, Inc.
 * Copyright (C) 2008 Nokia Corporation
 *
 * Code re-written for 2430SDP by:
 * Syed Mohammed Khasim <[email protected]>
 *
 * Initial Code:
 * Manjunatha G K <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/input.h>
#include <linux/platform_device.h>
#include <linux/mfd/twl.h>
#include <linux/slab.h>
#include <linux/of.h>

/*
 * The TWL4030 family chips include a keypad controller that supports
 * up to an 8x8 switch matrix.  The controller can issue system wakeup
 * events, since it uses only the always-on 32KiHz oscillator, and has
 * an internal state machine that decodes pressed keys, including
 * multi-key combinations.
 *
 * This driver lets boards define what keycodes they wish to report for
 * which scancodes, as part of the "struct twl4030_keypad_data" used in
 * the probe() routine.
 *
 * See the TPS65950 documentation; that's the general availability
 * version of the TWL5030 second generation part.
 */
#define TWL4030_MAX_ROWS
#define TWL4030_MAX_COLS
/*
 * Note that we add space for an extra column so that we can handle
 * row lines connected to the gnd (see twl4030_col_xlate()).
 */
#define TWL4030_ROW_SHIFT
#define TWL4030_KEYMAP_SIZE

struct twl4030_keypad {};

/*----------------------------------------------------------------------*/

/* arbitrary prescaler value 0..7 */
#define PTV_PRESCALER

/* Register Offsets */
#define KEYP_CTRL
#define KEYP_DEB
#define KEYP_LONG_KEY
#define KEYP_LK_PTV
#define KEYP_TIMEOUT_L
#define KEYP_TIMEOUT_H
#define KEYP_KBC
#define KEYP_KBR
#define KEYP_SMS
#define KEYP_FULL_CODE_7_0
#define KEYP_FULL_CODE_15_8
#define KEYP_FULL_CODE_23_16
#define KEYP_FULL_CODE_31_24
#define KEYP_FULL_CODE_39_32
#define KEYP_FULL_CODE_47_40
#define KEYP_FULL_CODE_55_48
#define KEYP_FULL_CODE_63_56
#define KEYP_ISR1
#define KEYP_IMR1
#define KEYP_ISR2
#define KEYP_IMR2
#define KEYP_SIR
#define KEYP_EDR
#define KEYP_SIH_CTRL

/* KEYP_CTRL_REG Fields */
#define KEYP_CTRL_SOFT_NRST
#define KEYP_CTRL_SOFTMODEN
#define KEYP_CTRL_LK_EN
#define KEYP_CTRL_TOE_EN
#define KEYP_CTRL_TOLE_EN
#define KEYP_CTRL_RP_EN
#define KEYP_CTRL_KBD_ON

/* KEYP_DEB, KEYP_LONG_KEY, KEYP_TIMEOUT_x*/
#define KEYP_PERIOD_US(t, prescale)

/* KEYP_LK_PTV_REG Fields */
#define KEYP_LK_PTV_PTV_SHIFT

/* KEYP_{IMR,ISR,SIR} Fields */
#define KEYP_IMR1_MIS
#define KEYP_IMR1_TO
#define KEYP_IMR1_LK
#define KEYP_IMR1_KP

/* KEYP_EDR Fields */
#define KEYP_EDR_KP_FALLING
#define KEYP_EDR_KP_RISING
#define KEYP_EDR_KP_BOTH
#define KEYP_EDR_LK_FALLING
#define KEYP_EDR_LK_RISING
#define KEYP_EDR_TO_FALLING
#define KEYP_EDR_TO_RISING
#define KEYP_EDR_MIS_FALLING
#define KEYP_EDR_MIS_RISING


/*----------------------------------------------------------------------*/

static int twl4030_kpread(struct twl4030_keypad *kp,
		u8 *data, u32 reg, u8 num_bytes)
{}

static int twl4030_kpwrite_u8(struct twl4030_keypad *kp, u8 data, u32 reg)
{}

static inline u16 twl4030_col_xlate(struct twl4030_keypad *kp, u8 col)
{}

static int twl4030_read_kp_matrix_state(struct twl4030_keypad *kp, u16 *state)
{}

static bool twl4030_is_in_ghost_state(struct twl4030_keypad *kp, u16 *key_state)
{}

static void twl4030_kp_scan(struct twl4030_keypad *kp, bool release_all)
{}

/*
 * Keypad interrupt handler
 */
static irqreturn_t do_kp_irq(int irq, void *_kp)
{}

static int twl4030_kp_program(struct twl4030_keypad *kp)
{}

/*
 * Registers keypad device with input subsystem
 * and configures TWL4030 keypad registers
 */
static int twl4030_kp_probe(struct platform_device *pdev)
{}

#ifdef CONFIG_OF
static const struct of_device_id twl4030_keypad_dt_match_table[] =;
MODULE_DEVICE_TABLE(of, twl4030_keypad_dt_match_table);
#endif

/*
 * NOTE: twl4030 are multi-function devices connected via I2C.
 * So this device is a child of an I2C parent, thus it needs to
 * support unplug/replug (which most platform devices don't).
 */

static struct platform_driver twl4030_kp_driver =;
module_platform_driver();

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