Compare commits
5 Commits
4b51ff1cf5
...
kindle-pw3
| Author | SHA1 | Date | |
|---|---|---|---|
| 90358030ad | |||
| 804ce77a86 | |||
| 9c61d889a0 | |||
| b496c40170 | |||
| e18fd1b573 |
@@ -492,131 +492,3 @@ CONFIG_MAGIC_SYSRQ=y
|
|||||||
CONFIG_DEBUG_FS=y
|
CONFIG_DEBUG_FS=y
|
||||||
# CONFIG_SLUB_DEBUG is not set
|
# CONFIG_SLUB_DEBUG is not set
|
||||||
# CONFIG_FTRACE is not set
|
# CONFIG_FTRACE is not set
|
||||||
<<<<<<< HEAD:arch/arm/configs/wario_defconfig
|
|
||||||
=======
|
|
||||||
CONFIG_FB=y
|
|
||||||
|
|
||||||
# Net stuff
|
|
||||||
CONFIG_TUN=m
|
|
||||||
CONFIG_WIREGUARD=m
|
|
||||||
CONFIG_USB_USBNET=m
|
|
||||||
|
|
||||||
CONFIG_NF_CONNTRACK=m
|
|
||||||
CONFIG_NF_CONNTRACK_ZONES=y
|
|
||||||
CONFIG_NF_CONNTRACK_TIMEOUT=y
|
|
||||||
CONFIG_NF_CONNTRACK_LABELS=y
|
|
||||||
CONFIG_NF_CONNTRACK_FTP=m
|
|
||||||
CONFIG_NF_CONNTRACK_SIP=m
|
|
||||||
CONFIG_NF_CT_NETLINK=m
|
|
||||||
CONFIG_NF_CT_NETLINK_TIMEOUT=m
|
|
||||||
CONFIG_NF_TABLES=m
|
|
||||||
CONFIG_NF_TABLES_INET=y
|
|
||||||
CONFIG_NF_TABLES_NETDEV=y
|
|
||||||
CONFIG_NFT_CT=m
|
|
||||||
CONFIG_NFT_LOG=m
|
|
||||||
CONFIG_NFT_LIMIT=m
|
|
||||||
CONFIG_NFT_MASQ=m
|
|
||||||
CONFIG_NFT_REDIR=m
|
|
||||||
CONFIG_NFT_NAT=m
|
|
||||||
CONFIG_NFT_TUNNEL=m
|
|
||||||
CONFIG_NFT_COMPAT=m
|
|
||||||
CONFIG_NFT_SOCKET=m
|
|
||||||
CONFIG_NFT_TPROXY=m
|
|
||||||
CONFIG_NFT_SYNPROXY=m
|
|
||||||
CONFIG_NFT_FWD_NETDEV=m
|
|
||||||
CONFIG_NETFILTER_XTABLES=m
|
|
||||||
CONFIG_NETFILTER_XT_TARGET_LOG=m
|
|
||||||
CONFIG_NETFILTER_XT_NAT=m
|
|
||||||
CONFIG_NETFILTER_XT_TARGET_NFLOG=m
|
|
||||||
CONFIG_NETFILTER_XT_TARGET_MASQUERADE=m
|
|
||||||
CONFIG_NETFILTER_XT_TARGET_TEE=m
|
|
||||||
CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
|
|
||||||
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m
|
|
||||||
CONFIG_IP6_NF_FILTER=m
|
|
||||||
CONFIG_IP6_NF_IPTABLES=m
|
|
||||||
CONFIG_IP6_NF_MANGLE=m
|
|
||||||
CONFIG_IP6_NF_RAW=m
|
|
||||||
CONFIG_IP6_NF_TARGET_REJECT=m
|
|
||||||
CONFIG_IP_NF_FILTER=m
|
|
||||||
CONFIG_IP_NF_IPTABLES=m
|
|
||||||
CONFIG_IP_NF_MANGLE=m
|
|
||||||
CONFIG_IP_NF_NAT=m
|
|
||||||
CONFIG_IP_NF_TARGET_MASQUERADE=m
|
|
||||||
CONFIG_IP_NF_TARGET_REJECT=m
|
|
||||||
CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
|
|
||||||
CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
|
|
||||||
CONFIG_NETFILTER_XT_MATCH_MARK=m
|
|
||||||
CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
|
|
||||||
CONFIG_NETFILTER_XT_TARGET_MARK=m
|
|
||||||
CONFIG_NFT_FIB_IPV4=m
|
|
||||||
CONFIG_NFT_REJECT=m
|
|
||||||
CONFIG_NFT_REJECT_NETDEV=m
|
|
||||||
|
|
||||||
# Crypto
|
|
||||||
|
|
||||||
CONFIG_MD=y
|
|
||||||
CONFIG_BLK_DEV_DM=m
|
|
||||||
CONFIG_DM_CRYPT=m
|
|
||||||
CONFIG_CRYPTO_CBC=y
|
|
||||||
CONFIG_CRYPTO_CTS=m
|
|
||||||
CONFIG_CRYPTO_ECB=y
|
|
||||||
CONFIG_CRYPTO_LRW=m
|
|
||||||
CONFIG_CRYPTO_PCBC=m
|
|
||||||
CONFIG_CRYPTO_DES=m
|
|
||||||
CONFIG_CRYPTO_XTS=m
|
|
||||||
CONFIG_CRYPTO_XCBC=m
|
|
||||||
CONFIG_CRYPTO_MD5=y
|
|
||||||
CONFIG_CRYPTO_MICHAEL_MIC=y
|
|
||||||
CONFIG_CRYPTO_RMD128=m
|
|
||||||
CONFIG_CRYPTO_RMD160=m
|
|
||||||
CONFIG_CRYPTO_RMD256=m
|
|
||||||
CONFIG_CRYPTO_RMD320=m
|
|
||||||
CONFIG_CRYPTO_SHA256=y
|
|
||||||
CONFIG_CRYPTO_TGR192=m
|
|
||||||
CONFIG_CRYPTO_WP512=m
|
|
||||||
CONFIG_KEY_DH_OPERATIONS=y
|
|
||||||
|
|
||||||
# Tolino Shine 2 HD stuff
|
|
||||||
CONFIG_MFD_NTXEC=y
|
|
||||||
CONFIG_PWM_NTXEC=m
|
|
||||||
CONFIG_TOUCHSCREEN_ZFORCE=m
|
|
||||||
CONFIG_BRCMFMAC=m
|
|
||||||
CONFIG_BRCMFMAC_SDIO=y
|
|
||||||
|
|
||||||
# commonly found in other readers
|
|
||||||
CONFIG_TOUCHSCREEN_EKTF2127=m
|
|
||||||
CONFIG_RTC_DRV_NTXEC=m
|
|
||||||
CONFIG_MFD_SY7636=m
|
|
||||||
CONFIG_REGULATOR_SY7636=m
|
|
||||||
CONFIG_SENSORS_SY7636=m
|
|
||||||
CONFIG_MFD_JD9930=m
|
|
||||||
CONFIG_REGULATOR_JD9930=m
|
|
||||||
CONFIG_SENSORS_JD9930=m
|
|
||||||
CONFIG_GPIO_BD71815=m
|
|
||||||
CONFIG_GPIO_BD71828=m
|
|
||||||
CONFIG_MFD_ROHM_BD71828=y
|
|
||||||
CONFIG_RTC_DRV_BD70528=m
|
|
||||||
CONFIG_REGULATOR_BD71815=m
|
|
||||||
CONFIG_REGULATOR_BD71828=y
|
|
||||||
CONFIG_COMMON_CLK_BD718XX=m
|
|
||||||
CONFIG_MWIFIEX=m
|
|
||||||
CONFIG_MWIFIEX_SDIO=m
|
|
||||||
CONFIG_TOUCHSCREEN_EDT_FT5X06=m
|
|
||||||
|
|
||||||
# BT (found in clara2e)
|
|
||||||
CONFIG_BT_AOSPEXT=y
|
|
||||||
CONFIG_BT_BNEP=m
|
|
||||||
CONFIG_BT_HCIBTSDIO=m
|
|
||||||
CONFIG_BT_HCIBTUSB=m
|
|
||||||
CONFIG_BT_HCIBTUSB_MTK=y
|
|
||||||
CONFIG_BT_HCIUART_BCSP=y
|
|
||||||
CONFIG_BT_HCIUART_LL=y
|
|
||||||
CONFIG_BT_HCIUART=m
|
|
||||||
CONFIG_BT_HCIUART_MRVL=y
|
|
||||||
CONFIG_BT_HIDP=m
|
|
||||||
CONFIG_BT_HS=y
|
|
||||||
CONFIG_BT_LEDS=y
|
|
||||||
CONFIG_BT=m
|
|
||||||
CONFIG_BT_MSFTEXT=y
|
|
||||||
CONFIG_BT_NXPUART=m
|
|
||||||
CONFIG_BT_RFCOMM=m
|
|
||||||
|
|||||||
@@ -267,6 +267,36 @@ config TOUCHSCREEN_CYTTSP_SPI
|
|||||||
To compile this driver as a module, choose M here: the
|
To compile this driver as a module, choose M here: the
|
||||||
module will be called cyttsp_spi.
|
module will be called cyttsp_spi.
|
||||||
|
|
||||||
|
config TOUCHSCREEN_CYTTSP4_CORE
|
||||||
|
tristate "Cypress TrueTouch Gen4 Touchscreen Driver"
|
||||||
|
help
|
||||||
|
Core driver for Cypress TrueTouch(tm) Standard Product
|
||||||
|
Generation4 touchscreen controllers.
|
||||||
|
|
||||||
|
Say Y here if you have a Cypress Gen4 touchscreen.
|
||||||
|
|
||||||
|
If unsure, say N.
|
||||||
|
|
||||||
|
To compile this driver as a module, choose M here.
|
||||||
|
|
||||||
|
config TOUCHSCREEN_CYTTSP4_I2C
|
||||||
|
tristate "support I2C bus connection"
|
||||||
|
depends on TOUCHSCREEN_CYTTSP4_CORE && I2C
|
||||||
|
help
|
||||||
|
Say Y here if the touchscreen is connected via I2C bus.
|
||||||
|
|
||||||
|
To compile this driver as a module, choose M here: the
|
||||||
|
module will be called cyttsp4_i2c.
|
||||||
|
|
||||||
|
config TOUCHSCREEN_CYTTSP4_SPI
|
||||||
|
tristate "support SPI bus connection"
|
||||||
|
depends on TOUCHSCREEN_CYTTSP4_CORE && SPI_MASTER
|
||||||
|
help
|
||||||
|
Say Y here if the touchscreen is connected via SPI bus.
|
||||||
|
|
||||||
|
To compile this driver as a module, choose M here: the
|
||||||
|
module will be called cyttsp4_spi.
|
||||||
|
|
||||||
config TOUCHSCREEN_CYTTSP5
|
config TOUCHSCREEN_CYTTSP5
|
||||||
tristate "Cypress TrueTouch Gen5 Touchscreen Driver"
|
tristate "Cypress TrueTouch Gen5 Touchscreen Driver"
|
||||||
depends on I2C
|
depends on I2C
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ obj-$(CONFIG_TOUCHSCREEN_CY8CTMA140) += cy8ctma140.o
|
|||||||
obj-$(CONFIG_TOUCHSCREEN_CY8CTMG110) += cy8ctmg110_ts.o
|
obj-$(CONFIG_TOUCHSCREEN_CY8CTMG110) += cy8ctmg110_ts.o
|
||||||
obj-$(CONFIG_TOUCHSCREEN_CYTTSP_CORE) += cyttsp_core.o
|
obj-$(CONFIG_TOUCHSCREEN_CYTTSP_CORE) += cyttsp_core.o
|
||||||
obj-$(CONFIG_TOUCHSCREEN_CYTTSP_I2C) += cyttsp_i2c.o
|
obj-$(CONFIG_TOUCHSCREEN_CYTTSP_I2C) += cyttsp_i2c.o
|
||||||
|
obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_CORE) += cyttsp4_core.o
|
||||||
|
obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_I2C) += cyttsp4_i2c.o
|
||||||
|
obj-$(CONFIG_TOUCHSCREEN_CYTTSP4_SPI) += cyttsp4_spi.o
|
||||||
obj-$(CONFIG_TOUCHSCREEN_CYTTSP_SPI) += cyttsp_spi.o
|
obj-$(CONFIG_TOUCHSCREEN_CYTTSP_SPI) += cyttsp_spi.o
|
||||||
obj-$(CONFIG_TOUCHSCREEN_CYTTSP5) += cyttsp5.o
|
obj-$(CONFIG_TOUCHSCREEN_CYTTSP5) += cyttsp5.o
|
||||||
obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o
|
obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o
|
||||||
|
|||||||
2180
drivers/input/touchscreen/cyttsp4_core.c
Normal file
2180
drivers/input/touchscreen/cyttsp4_core.c
Normal file
File diff suppressed because it is too large
Load Diff
446
drivers/input/touchscreen/cyttsp4_core.h
Normal file
446
drivers/input/touchscreen/cyttsp4_core.h
Normal file
@@ -0,0 +1,446 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
/*
|
||||||
|
* cyttsp4_core.h
|
||||||
|
* Cypress TrueTouch(TM) Standard Product V4 Core driver module.
|
||||||
|
* For use with Cypress Txx4xx parts.
|
||||||
|
* Supported parts include:
|
||||||
|
* TMA4XX
|
||||||
|
* TMA1036
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 Cypress Semiconductor
|
||||||
|
*
|
||||||
|
* Contact Cypress Semiconductor at www.cypress.com <ttdrivers@cypress.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _LINUX_CYTTSP4_CORE_H
|
||||||
|
#define _LINUX_CYTTSP4_CORE_H
|
||||||
|
|
||||||
|
#include <linux/device.h>
|
||||||
|
#include <linux/err.h>
|
||||||
|
#include <linux/input.h>
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/limits.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/stringify.h>
|
||||||
|
#include <linux/types.h>
|
||||||
|
#include <linux/platform_data/cyttsp4.h>
|
||||||
|
#include <linux/of_gpio.h>
|
||||||
|
|
||||||
|
#define CY_REG_BASE 0x00
|
||||||
|
|
||||||
|
#define CY_POST_CODEL_WDG_RST 0x01
|
||||||
|
#define CY_POST_CODEL_CFG_DATA_CRC_FAIL 0x02
|
||||||
|
#define CY_POST_CODEL_PANEL_TEST_FAIL 0x04
|
||||||
|
|
||||||
|
#define CY_NUM_BTN_PER_REG 4
|
||||||
|
|
||||||
|
/* touch record system information offset masks and shifts */
|
||||||
|
#define CY_BYTE_OFS_MASK 0x1F
|
||||||
|
#define CY_BOFS_MASK 0xE0
|
||||||
|
#define CY_BOFS_SHIFT 5
|
||||||
|
|
||||||
|
#define CY_TMA1036_TCH_REC_SIZE 6
|
||||||
|
#define CY_TMA4XX_TCH_REC_SIZE 9
|
||||||
|
#define CY_TMA1036_MAX_TCH 0x0E
|
||||||
|
#define CY_TMA4XX_MAX_TCH 0x1E
|
||||||
|
|
||||||
|
#define CY_NORMAL_ORIGIN 0 /* upper, left corner */
|
||||||
|
#define CY_INVERT_ORIGIN 1 /* lower, right corner */
|
||||||
|
|
||||||
|
/* helpers */
|
||||||
|
#define GET_NUM_TOUCHES(x) ((x) & 0x1F)
|
||||||
|
#define IS_LARGE_AREA(x) ((x) & 0x20)
|
||||||
|
#define IS_BAD_PKT(x) ((x) & 0x20)
|
||||||
|
#define IS_BOOTLOADER(hst_mode, reset_detect) \
|
||||||
|
((hst_mode) & 0x01 || (reset_detect) != 0)
|
||||||
|
#define IS_TMO(t) ((t) == 0)
|
||||||
|
|
||||||
|
|
||||||
|
enum cyttsp_cmd_bits {
|
||||||
|
CY_CMD_COMPLETE = (1 << 6),
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Timeout in ms. */
|
||||||
|
#define CY_WATCHDOG_TIMEOUT 1000
|
||||||
|
|
||||||
|
#define CY_MAX_PRINT_SIZE 512
|
||||||
|
#ifdef VERBOSE_DEBUG
|
||||||
|
#define CY_MAX_PRBUF_SIZE PIPE_BUF
|
||||||
|
#define CY_PR_TRUNCATED " truncated..."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum cyttsp4_ic_grpnum {
|
||||||
|
CY_IC_GRPNUM_RESERVED,
|
||||||
|
CY_IC_GRPNUM_CMD_REGS,
|
||||||
|
CY_IC_GRPNUM_TCH_REP,
|
||||||
|
CY_IC_GRPNUM_DATA_REC,
|
||||||
|
CY_IC_GRPNUM_TEST_REC,
|
||||||
|
CY_IC_GRPNUM_PCFG_REC,
|
||||||
|
CY_IC_GRPNUM_TCH_PARM_VAL,
|
||||||
|
CY_IC_GRPNUM_TCH_PARM_SIZE,
|
||||||
|
CY_IC_GRPNUM_RESERVED1,
|
||||||
|
CY_IC_GRPNUM_RESERVED2,
|
||||||
|
CY_IC_GRPNUM_OPCFG_REC,
|
||||||
|
CY_IC_GRPNUM_DDATA_REC,
|
||||||
|
CY_IC_GRPNUM_MDATA_REC,
|
||||||
|
CY_IC_GRPNUM_TEST_REGS,
|
||||||
|
CY_IC_GRPNUM_BTN_KEYS,
|
||||||
|
CY_IC_GRPNUM_TTHE_REGS,
|
||||||
|
CY_IC_GRPNUM_NUM
|
||||||
|
};
|
||||||
|
|
||||||
|
enum cyttsp4_int_state {
|
||||||
|
CY_INT_NONE,
|
||||||
|
CY_INT_IGNORE = (1 << 0),
|
||||||
|
CY_INT_MODE_CHANGE = (1 << 1),
|
||||||
|
CY_INT_EXEC_CMD = (1 << 2),
|
||||||
|
CY_INT_AWAKE = (1 << 3),
|
||||||
|
};
|
||||||
|
|
||||||
|
enum cyttsp4_mode {
|
||||||
|
CY_MODE_UNKNOWN,
|
||||||
|
CY_MODE_BOOTLOADER = (1 << 1),
|
||||||
|
CY_MODE_OPERATIONAL = (1 << 2),
|
||||||
|
CY_MODE_SYSINFO = (1 << 3),
|
||||||
|
CY_MODE_CAT = (1 << 4),
|
||||||
|
CY_MODE_STARTUP = (1 << 5),
|
||||||
|
CY_MODE_LOADER = (1 << 6),
|
||||||
|
CY_MODE_CHANGE_MODE = (1 << 7),
|
||||||
|
CY_MODE_CHANGED = (1 << 8),
|
||||||
|
CY_MODE_CMD_COMPLETE = (1 << 9),
|
||||||
|
};
|
||||||
|
|
||||||
|
enum cyttsp4_sleep_state {
|
||||||
|
SS_SLEEP_OFF,
|
||||||
|
SS_SLEEP_ON,
|
||||||
|
SS_SLEEPING,
|
||||||
|
SS_WAKING,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum cyttsp4_startup_state {
|
||||||
|
STARTUP_NONE,
|
||||||
|
STARTUP_QUEUED,
|
||||||
|
STARTUP_RUNNING,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define CY_NUM_REVCTRL 8
|
||||||
|
struct cyttsp4_cydata {
|
||||||
|
u8 ttpidh;
|
||||||
|
u8 ttpidl;
|
||||||
|
u8 fw_ver_major;
|
||||||
|
u8 fw_ver_minor;
|
||||||
|
u8 revctrl[CY_NUM_REVCTRL];
|
||||||
|
u8 blver_major;
|
||||||
|
u8 blver_minor;
|
||||||
|
u8 jtag_si_id3;
|
||||||
|
u8 jtag_si_id2;
|
||||||
|
u8 jtag_si_id1;
|
||||||
|
u8 jtag_si_id0;
|
||||||
|
u8 mfgid_sz;
|
||||||
|
u8 cyito_idh;
|
||||||
|
u8 cyito_idl;
|
||||||
|
u8 cyito_verh;
|
||||||
|
u8 cyito_verl;
|
||||||
|
u8 ttsp_ver_major;
|
||||||
|
u8 ttsp_ver_minor;
|
||||||
|
u8 device_info;
|
||||||
|
u8 mfg_id[];
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct cyttsp4_test {
|
||||||
|
u8 post_codeh;
|
||||||
|
u8 post_codel;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct cyttsp4_pcfg {
|
||||||
|
u8 electrodes_x;
|
||||||
|
u8 electrodes_y;
|
||||||
|
u8 len_xh;
|
||||||
|
u8 len_xl;
|
||||||
|
u8 len_yh;
|
||||||
|
u8 len_yl;
|
||||||
|
u8 res_xh;
|
||||||
|
u8 res_xl;
|
||||||
|
u8 res_yh;
|
||||||
|
u8 res_yl;
|
||||||
|
u8 max_zh;
|
||||||
|
u8 max_zl;
|
||||||
|
u8 panel_info0;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct cyttsp4_tch_rec_params {
|
||||||
|
u8 loc;
|
||||||
|
u8 size;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
#define CY_NUM_TCH_FIELDS 7
|
||||||
|
#define CY_NUM_EXT_TCH_FIELDS 3
|
||||||
|
struct cyttsp4_opcfg {
|
||||||
|
u8 cmd_ofs;
|
||||||
|
u8 rep_ofs;
|
||||||
|
u8 rep_szh;
|
||||||
|
u8 rep_szl;
|
||||||
|
u8 num_btns;
|
||||||
|
u8 tt_stat_ofs;
|
||||||
|
u8 obj_cfg0;
|
||||||
|
u8 max_tchs;
|
||||||
|
u8 tch_rec_size;
|
||||||
|
struct cyttsp4_tch_rec_params tch_rec_old[CY_NUM_TCH_FIELDS];
|
||||||
|
u8 btn_rec_size; /* btn record size (in bytes) */
|
||||||
|
u8 btn_diff_ofs; /* btn data loc, diff counts */
|
||||||
|
u8 btn_diff_size; /* btn size of diff counts (in bits) */
|
||||||
|
struct cyttsp4_tch_rec_params tch_rec_new[CY_NUM_EXT_TCH_FIELDS];
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct cyttsp4_sysinfo_ptr {
|
||||||
|
struct cyttsp4_cydata *cydata;
|
||||||
|
struct cyttsp4_test *test;
|
||||||
|
struct cyttsp4_pcfg *pcfg;
|
||||||
|
struct cyttsp4_opcfg *opcfg;
|
||||||
|
struct cyttsp4_ddata *ddata;
|
||||||
|
struct cyttsp4_mdata *mdata;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct cyttsp4_sysinfo_data {
|
||||||
|
u8 hst_mode;
|
||||||
|
u8 reserved;
|
||||||
|
u8 map_szh;
|
||||||
|
u8 map_szl;
|
||||||
|
u8 cydata_ofsh;
|
||||||
|
u8 cydata_ofsl;
|
||||||
|
u8 test_ofsh;
|
||||||
|
u8 test_ofsl;
|
||||||
|
u8 pcfg_ofsh;
|
||||||
|
u8 pcfg_ofsl;
|
||||||
|
u8 opcfg_ofsh;
|
||||||
|
u8 opcfg_ofsl;
|
||||||
|
u8 ddata_ofsh;
|
||||||
|
u8 ddata_ofsl;
|
||||||
|
u8 mdata_ofsh;
|
||||||
|
u8 mdata_ofsl;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
enum cyttsp4_tch_abs { /* for ordering within the extracted touch data array */
|
||||||
|
CY_TCH_X, /* X */
|
||||||
|
CY_TCH_Y, /* Y */
|
||||||
|
CY_TCH_P, /* P (Z) */
|
||||||
|
CY_TCH_T, /* TOUCH ID */
|
||||||
|
CY_TCH_E, /* EVENT ID */
|
||||||
|
CY_TCH_O, /* OBJECT ID */
|
||||||
|
CY_TCH_W, /* SIZE */
|
||||||
|
CY_TCH_MAJ, /* TOUCH_MAJOR */
|
||||||
|
CY_TCH_MIN, /* TOUCH_MINOR */
|
||||||
|
CY_TCH_OR, /* ORIENTATION */
|
||||||
|
CY_TCH_NUM_ABS
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cyttsp4_touch {
|
||||||
|
int abs[CY_TCH_NUM_ABS];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cyttsp4_tch_abs_params {
|
||||||
|
size_t ofs; /* abs byte offset */
|
||||||
|
size_t size; /* size in bits */
|
||||||
|
size_t max; /* max value */
|
||||||
|
size_t bofs; /* bit offset */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cyttsp4_sysinfo_ofs {
|
||||||
|
size_t chip_type;
|
||||||
|
size_t cmd_ofs;
|
||||||
|
size_t rep_ofs;
|
||||||
|
size_t rep_sz;
|
||||||
|
size_t num_btns;
|
||||||
|
size_t num_btn_regs; /* ceil(num_btns/4) */
|
||||||
|
size_t tt_stat_ofs;
|
||||||
|
size_t tch_rec_size;
|
||||||
|
size_t obj_cfg0;
|
||||||
|
size_t max_tchs;
|
||||||
|
size_t mode_size;
|
||||||
|
size_t data_size;
|
||||||
|
size_t map_sz;
|
||||||
|
size_t max_x;
|
||||||
|
size_t x_origin; /* left or right corner */
|
||||||
|
size_t max_y;
|
||||||
|
size_t y_origin; /* upper or lower corner */
|
||||||
|
size_t max_p;
|
||||||
|
size_t cydata_ofs;
|
||||||
|
size_t test_ofs;
|
||||||
|
size_t pcfg_ofs;
|
||||||
|
size_t opcfg_ofs;
|
||||||
|
size_t ddata_ofs;
|
||||||
|
size_t mdata_ofs;
|
||||||
|
size_t cydata_size;
|
||||||
|
size_t test_size;
|
||||||
|
size_t pcfg_size;
|
||||||
|
size_t opcfg_size;
|
||||||
|
size_t ddata_size;
|
||||||
|
size_t mdata_size;
|
||||||
|
size_t btn_keys_size;
|
||||||
|
struct cyttsp4_tch_abs_params tch_abs[CY_TCH_NUM_ABS];
|
||||||
|
size_t btn_rec_size; /* btn record size (in bytes) */
|
||||||
|
size_t btn_diff_ofs;/* btn data loc ,diff counts, (Op-Mode byte ofs) */
|
||||||
|
size_t btn_diff_size;/* btn size of diff counts (in bits) */
|
||||||
|
};
|
||||||
|
|
||||||
|
enum cyttsp4_btn_state {
|
||||||
|
CY_BTN_RELEASED,
|
||||||
|
CY_BTN_PRESSED,
|
||||||
|
CY_BTN_NUM_STATE
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cyttsp4_btn {
|
||||||
|
bool enabled;
|
||||||
|
int state; /* CY_BTN_PRESSED, CY_BTN_RELEASED */
|
||||||
|
int key_code;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cyttsp4_sysinfo {
|
||||||
|
bool ready;
|
||||||
|
struct cyttsp4_sysinfo_data si_data;
|
||||||
|
struct cyttsp4_sysinfo_ptr si_ptrs;
|
||||||
|
struct cyttsp4_sysinfo_ofs si_ofs;
|
||||||
|
struct cyttsp4_btn *btn; /* button states */
|
||||||
|
u8 *btn_rec_data; /* button diff count data */
|
||||||
|
u8 *xy_mode; /* operational mode and status regs */
|
||||||
|
u8 *xy_data; /* operational touch regs */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cyttsp4_mt_data {
|
||||||
|
struct cyttsp4_mt_platform_data *pdata;
|
||||||
|
struct cyttsp4_sysinfo *si;
|
||||||
|
struct input_dev *input;
|
||||||
|
struct mutex report_lock;
|
||||||
|
bool is_suspended;
|
||||||
|
char phys[NAME_MAX];
|
||||||
|
int num_prv_tch;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cyttsp4 {
|
||||||
|
struct device *dev;
|
||||||
|
struct mutex system_lock;
|
||||||
|
struct mutex adap_lock;
|
||||||
|
enum cyttsp4_mode mode;
|
||||||
|
enum cyttsp4_sleep_state sleep_state;
|
||||||
|
enum cyttsp4_startup_state startup_state;
|
||||||
|
int int_status;
|
||||||
|
wait_queue_head_t wait_q;
|
||||||
|
int irq;
|
||||||
|
struct work_struct startup_work;
|
||||||
|
struct work_struct watchdog_work;
|
||||||
|
struct timer_list watchdog_timer;
|
||||||
|
struct cyttsp4_sysinfo sysinfo;
|
||||||
|
void *exclusive_dev;
|
||||||
|
int exclusive_waits;
|
||||||
|
atomic_t ignore_irq;
|
||||||
|
bool invalid_touch_app;
|
||||||
|
struct cyttsp4_mt_data md;
|
||||||
|
struct cyttsp4_platform_data *pdata;
|
||||||
|
struct cyttsp4_core_platform_data *cpdata;
|
||||||
|
const struct cyttsp4_bus_ops *bus_ops;
|
||||||
|
u8 *xfer_buf;
|
||||||
|
#ifdef VERBOSE_DEBUG
|
||||||
|
u8 pr_buf[CY_MAX_PRBUF_SIZE];
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cyttsp4_bus_ops {
|
||||||
|
u16 bustype;
|
||||||
|
int (*write)(struct device *dev, u8 *xfer_buf, u16 addr, u8 length,
|
||||||
|
const void *values);
|
||||||
|
int (*read)(struct device *dev, u8 *xfer_buf, u16 addr, u8 length,
|
||||||
|
void *values);
|
||||||
|
};
|
||||||
|
|
||||||
|
enum cyttsp4_hst_mode_bits {
|
||||||
|
CY_HST_TOGGLE = (1 << 7),
|
||||||
|
CY_HST_MODE_CHANGE = (1 << 3),
|
||||||
|
CY_HST_MODE = (7 << 4),
|
||||||
|
CY_HST_OPERATE = (0 << 4),
|
||||||
|
CY_HST_SYSINFO = (1 << 4),
|
||||||
|
CY_HST_CAT = (2 << 4),
|
||||||
|
CY_HST_LOWPOW = (1 << 2),
|
||||||
|
CY_HST_SLEEP = (1 << 1),
|
||||||
|
CY_HST_RESET = (1 << 0),
|
||||||
|
};
|
||||||
|
|
||||||
|
/* abs settings */
|
||||||
|
#define CY_IGNORE_VALUE 0xFFFF
|
||||||
|
|
||||||
|
/* abs signal capabilities offsets in the frameworks array */
|
||||||
|
enum cyttsp4_sig_caps {
|
||||||
|
CY_SIGNAL_OST,
|
||||||
|
CY_MIN_OST,
|
||||||
|
CY_MAX_OST,
|
||||||
|
CY_FUZZ_OST,
|
||||||
|
CY_FLAT_OST,
|
||||||
|
CY_NUM_ABS_SET /* number of signal capability fields */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* abs axis signal offsets in the framworks array */
|
||||||
|
enum cyttsp4_sig_ost {
|
||||||
|
CY_ABS_X_OST,
|
||||||
|
CY_ABS_Y_OST,
|
||||||
|
CY_ABS_P_OST,
|
||||||
|
CY_ABS_W_OST,
|
||||||
|
CY_ABS_ID_OST,
|
||||||
|
CY_ABS_MAJ_OST,
|
||||||
|
CY_ABS_MIN_OST,
|
||||||
|
CY_ABS_OR_OST,
|
||||||
|
CY_NUM_ABS_OST /* number of abs signals */
|
||||||
|
};
|
||||||
|
|
||||||
|
enum cyttsp4_flags {
|
||||||
|
CY_FLAG_NONE = 0x00,
|
||||||
|
CY_FLAG_HOVER = 0x04,
|
||||||
|
CY_FLAG_FLIP = 0x08,
|
||||||
|
CY_FLAG_INV_X = 0x10,
|
||||||
|
CY_FLAG_INV_Y = 0x20,
|
||||||
|
CY_FLAG_VKEYS = 0x40,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum cyttsp4_object_id {
|
||||||
|
CY_OBJ_STANDARD_FINGER,
|
||||||
|
CY_OBJ_LARGE_OBJECT,
|
||||||
|
CY_OBJ_STYLUS,
|
||||||
|
CY_OBJ_HOVER,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum cyttsp4_event_id {
|
||||||
|
CY_EV_NO_EVENT,
|
||||||
|
CY_EV_TOUCHDOWN,
|
||||||
|
CY_EV_MOVE, /* significant displacement (> act dist) */
|
||||||
|
CY_EV_LIFTOFF, /* record reports last position */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* x-axis resolution of panel in pixels */
|
||||||
|
#define CY_PCFG_RESOLUTION_X_MASK 0x7F
|
||||||
|
|
||||||
|
/* y-axis resolution of panel in pixels */
|
||||||
|
#define CY_PCFG_RESOLUTION_Y_MASK 0x7F
|
||||||
|
|
||||||
|
/* x-axis, 0:origin is on left side of panel, 1: right */
|
||||||
|
#define CY_PCFG_ORIGIN_X_MASK 0x80
|
||||||
|
|
||||||
|
/* y-axis, 0:origin is on top side of panel, 1: bottom */
|
||||||
|
#define CY_PCFG_ORIGIN_Y_MASK 0x80
|
||||||
|
|
||||||
|
static inline int cyttsp4_adap_read(struct cyttsp4 *ts, u16 addr, int size,
|
||||||
|
void *buf)
|
||||||
|
{
|
||||||
|
return ts->bus_ops->read(ts->dev, ts->xfer_buf, addr, size, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int cyttsp4_adap_write(struct cyttsp4 *ts, u16 addr, int size,
|
||||||
|
const void *buf)
|
||||||
|
{
|
||||||
|
return ts->bus_ops->write(ts->dev, ts->xfer_buf, addr, size, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern struct cyttsp4 *cyttsp4_probe(const struct cyttsp4_bus_ops *ops,
|
||||||
|
struct device *dev, u16 irq, size_t xfer_buf_size);
|
||||||
|
extern int cyttsp4_remove(struct cyttsp4 *ts);
|
||||||
|
|
||||||
|
extern const struct dev_pm_ops cyttsp4_pm_ops;
|
||||||
|
|
||||||
|
#endif /* _LINUX_CYTTSP4_CORE_H */
|
||||||
178
drivers/input/touchscreen/cyttsp4_i2c.c
Normal file
178
drivers/input/touchscreen/cyttsp4_i2c.c
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
/*
|
||||||
|
* cyttsp_i2c.c
|
||||||
|
* Cypress TrueTouch(TM) Standard Product (TTSP) I2C touchscreen driver.
|
||||||
|
* For use with Cypress Txx4xx parts.
|
||||||
|
* Supported parts include:
|
||||||
|
* TMA4XX
|
||||||
|
* TMA1036
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
|
||||||
|
* Copyright (C) 2012 Javier Martinez Canillas <javier@dowhile0.org>
|
||||||
|
* Copyright (C) 2013 Cypress Semiconductor
|
||||||
|
*
|
||||||
|
* Contact Cypress Semiconductor at www.cypress.com <ttdrivers@cypress.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "cyttsp4_core.h"
|
||||||
|
|
||||||
|
#include <linux/i2c.h>
|
||||||
|
#include <linux/input.h>
|
||||||
|
#include <linux/delay.h>
|
||||||
|
|
||||||
|
#define CYTTSP4_I2C_DATA_SIZE (3 * 256)
|
||||||
|
|
||||||
|
static int cyttsp4_i2c_read_block_data(struct device *dev, u8 *xfer_buf,
|
||||||
|
u16 addr, u8 length, void *values)
|
||||||
|
{
|
||||||
|
struct i2c_client *client = to_i2c_client(dev);
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
xfer_buf[0] = addr;
|
||||||
|
rc = i2c_master_send(client, xfer_buf, 1);
|
||||||
|
if (rc < 0)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
rc = i2c_master_recv(client, values, length);
|
||||||
|
return rc < 0 ? rc : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int cyttsp4_i2c_write_block_data(struct device *dev, u8 *xfer_buf,
|
||||||
|
u16 addr, u8 length, const void *values)
|
||||||
|
{
|
||||||
|
struct i2c_client *client = to_i2c_client(dev);
|
||||||
|
|
||||||
|
xfer_buf[0] = addr;
|
||||||
|
memcpy(&xfer_buf[1], values, length);
|
||||||
|
return i2c_master_send(client, xfer_buf, length + 1) < 0 ? -EIO : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct cyttsp4_bus_ops cyttsp4_i2c_bus_ops = {
|
||||||
|
.bustype = BUS_I2C,
|
||||||
|
.write = cyttsp4_i2c_write_block_data,
|
||||||
|
.read = cyttsp4_i2c_read_block_data,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const int16_t cyttsp4_abs[] = {
|
||||||
|
ABS_MT_POSITION_X, 0, 758, 0, 0,
|
||||||
|
ABS_MT_POSITION_Y, 0, 1024, 0, 0,
|
||||||
|
ABS_MT_PRESSURE, 0, 255, 0, 0,
|
||||||
|
ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0,
|
||||||
|
ABS_MT_TRACKING_ID, 0, 15, 0, 0,
|
||||||
|
CY_IGNORE_VALUE, 0, 255, 0, 0,
|
||||||
|
CY_IGNORE_VALUE, 0, 255, 0, 0,
|
||||||
|
CY_IGNORE_VALUE, -128, 127, 0, 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct touch_framework cyttsp4_framework = {
|
||||||
|
.abs = cyttsp4_abs,
|
||||||
|
.size = ARRAY_SIZE(cyttsp4_abs),
|
||||||
|
.enable_vkeys = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int cyttsp4_xres(struct cyttsp4_core_platform_data *pdata,
|
||||||
|
struct device *dev)
|
||||||
|
{
|
||||||
|
int rst_gpio = pdata->rst_gpio;
|
||||||
|
|
||||||
|
gpio_set_value(rst_gpio, 1);
|
||||||
|
msleep(20);
|
||||||
|
gpio_set_value(rst_gpio, 0);
|
||||||
|
msleep(40);
|
||||||
|
gpio_set_value(rst_gpio, 1);
|
||||||
|
msleep(20);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int cyttsp4_i2c_probe(struct i2c_client *client)
|
||||||
|
{
|
||||||
|
struct cyttsp4_platform_data *pdata;
|
||||||
|
struct cyttsp4_core_platform_data *core_pdata;
|
||||||
|
struct cyttsp4_mt_platform_data *mt_pdata;
|
||||||
|
struct gpio_desc *irq_desc, *rst_desc;
|
||||||
|
struct cyttsp4 *ts;
|
||||||
|
|
||||||
|
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
|
||||||
|
dev_err(&client->dev, "I2C functionality not Supported\n");
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
|
||||||
|
core_pdata = devm_kzalloc(&client->dev, sizeof(*core_pdata), GFP_KERNEL);
|
||||||
|
mt_pdata = devm_kzalloc(&client->dev, sizeof(*mt_pdata), GFP_KERNEL);
|
||||||
|
if (!pdata || !core_pdata || !mt_pdata)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
irq_desc = devm_gpiod_get(&client->dev, "irq", GPIOD_IN);
|
||||||
|
if (IS_ERR(irq_desc))
|
||||||
|
return PTR_ERR(irq_desc);
|
||||||
|
|
||||||
|
rst_desc = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH);
|
||||||
|
if (IS_ERR(rst_desc))
|
||||||
|
return PTR_ERR(rst_desc);
|
||||||
|
|
||||||
|
core_pdata->irq_gpio = desc_to_gpio(irq_desc);
|
||||||
|
core_pdata->rst_gpio = desc_to_gpio(rst_desc);
|
||||||
|
mt_pdata->inp_dev_name = CYTTSP4_MT_NAME;
|
||||||
|
|
||||||
|
|
||||||
|
mt_pdata->frmwrk = &cyttsp4_framework;
|
||||||
|
|
||||||
|
pdata->core_pdata = core_pdata;
|
||||||
|
pdata->mt_pdata = mt_pdata;
|
||||||
|
client->dev.platform_data = pdata;
|
||||||
|
|
||||||
|
/* Reset the touch controller */
|
||||||
|
gpiod_set_value(rst_desc, 1);
|
||||||
|
msleep(20);
|
||||||
|
gpiod_set_value(rst_desc, 0);
|
||||||
|
msleep(40);
|
||||||
|
gpiod_set_value(rst_desc, 1);
|
||||||
|
msleep(20);
|
||||||
|
|
||||||
|
core_pdata->xres = cyttsp4_xres;
|
||||||
|
|
||||||
|
ts = cyttsp4_probe(&cyttsp4_i2c_bus_ops, &client->dev, client->irq,
|
||||||
|
CYTTSP4_I2C_DATA_SIZE);
|
||||||
|
|
||||||
|
return PTR_ERR_OR_ZERO(ts);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void cyttsp4_i2c_remove(struct i2c_client *client)
|
||||||
|
{
|
||||||
|
struct cyttsp4 *ts = i2c_get_clientdata(client);
|
||||||
|
|
||||||
|
cyttsp4_remove(ts);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CYTTSP4_I2C_NAME "cyttsp4_i2c_adapter"
|
||||||
|
|
||||||
|
static const struct i2c_device_id cyttsp4_i2c_id[] = {
|
||||||
|
{ CYTTSP4_I2C_NAME, 0 },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
|
MODULE_DEVICE_TABLE(i2c, cyttsp4_i2c_id);
|
||||||
|
|
||||||
|
static const struct of_device_id cyttsp4_of_match[] = {
|
||||||
|
{ .compatible = "cypress,cyttsp4-i2c", },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(of, cyttsp4_of_match);
|
||||||
|
|
||||||
|
static struct i2c_driver cyttsp4_i2c_driver = {
|
||||||
|
.driver = {
|
||||||
|
.name = CYTTSP4_I2C_NAME,
|
||||||
|
.of_match_table = cyttsp4_of_match,
|
||||||
|
.pm = &cyttsp4_pm_ops,
|
||||||
|
},
|
||||||
|
.probe = cyttsp4_i2c_probe,
|
||||||
|
.remove = cyttsp4_i2c_remove,
|
||||||
|
.id_table = cyttsp4_i2c_id,
|
||||||
|
};
|
||||||
|
|
||||||
|
module_i2c_driver(cyttsp4_i2c_driver);
|
||||||
|
|
||||||
|
MODULE_LICENSE("GPL");
|
||||||
|
MODULE_DESCRIPTION("Cypress TrueTouch(R) Standard Product (TTSP) I2C driver");
|
||||||
|
MODULE_AUTHOR("Cypress");
|
||||||
187
drivers/input/touchscreen/cyttsp4_spi.c
Normal file
187
drivers/input/touchscreen/cyttsp4_spi.c
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
/*
|
||||||
|
* Source for:
|
||||||
|
* Cypress TrueTouch(TM) Standard Product (TTSP) SPI touchscreen driver.
|
||||||
|
* For use with Cypress Txx4xx parts.
|
||||||
|
* Supported parts include:
|
||||||
|
* TMA4XX
|
||||||
|
* TMA1036
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
|
||||||
|
* Copyright (C) 2012 Javier Martinez Canillas <javier@dowhile0.org>
|
||||||
|
* Copyright (C) 2013 Cypress Semiconductor
|
||||||
|
*
|
||||||
|
* Contact Cypress Semiconductor at www.cypress.com <ttdrivers@cypress.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "cyttsp4_core.h"
|
||||||
|
|
||||||
|
#include <linux/delay.h>
|
||||||
|
#include <linux/input.h>
|
||||||
|
#include <linux/spi/spi.h>
|
||||||
|
|
||||||
|
#define CY_SPI_WR_OP 0x00 /* r/~w */
|
||||||
|
#define CY_SPI_RD_OP 0x01
|
||||||
|
#define CY_SPI_BITS_PER_WORD 8
|
||||||
|
#define CY_SPI_A8_BIT 0x02
|
||||||
|
#define CY_SPI_WR_HEADER_BYTES 2
|
||||||
|
#define CY_SPI_RD_HEADER_BYTES 1
|
||||||
|
#define CY_SPI_CMD_BYTES 2
|
||||||
|
#define CY_SPI_SYNC_BYTE 0
|
||||||
|
#define CY_SPI_SYNC_ACK 0x62 /* from TRM *A protocol */
|
||||||
|
#define CY_SPI_DATA_SIZE (2 * 256)
|
||||||
|
|
||||||
|
#define CY_SPI_DATA_BUF_SIZE (CY_SPI_CMD_BYTES + CY_SPI_DATA_SIZE)
|
||||||
|
|
||||||
|
static int cyttsp_spi_xfer(struct device *dev, u8 *xfer_buf,
|
||||||
|
u8 op, u16 reg, u8 *buf, int length)
|
||||||
|
{
|
||||||
|
struct spi_device *spi = to_spi_device(dev);
|
||||||
|
struct spi_message msg;
|
||||||
|
struct spi_transfer xfer[2];
|
||||||
|
u8 *wr_buf = &xfer_buf[0];
|
||||||
|
u8 rd_buf[CY_SPI_CMD_BYTES];
|
||||||
|
int retval;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (length > CY_SPI_DATA_SIZE) {
|
||||||
|
dev_err(dev, "%s: length %d is too big.\n",
|
||||||
|
__func__, length);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(wr_buf, 0, CY_SPI_DATA_BUF_SIZE);
|
||||||
|
memset(rd_buf, 0, CY_SPI_CMD_BYTES);
|
||||||
|
|
||||||
|
wr_buf[0] = op + (((reg >> 8) & 0x1) ? CY_SPI_A8_BIT : 0);
|
||||||
|
if (op == CY_SPI_WR_OP) {
|
||||||
|
wr_buf[1] = reg & 0xFF;
|
||||||
|
if (length > 0)
|
||||||
|
memcpy(wr_buf + CY_SPI_CMD_BYTES, buf, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(xfer, 0, sizeof(xfer));
|
||||||
|
spi_message_init(&msg);
|
||||||
|
|
||||||
|
/*
|
||||||
|
We set both TX and RX buffers because Cypress TTSP
|
||||||
|
requires full duplex operation.
|
||||||
|
*/
|
||||||
|
xfer[0].tx_buf = wr_buf;
|
||||||
|
xfer[0].rx_buf = rd_buf;
|
||||||
|
switch (op) {
|
||||||
|
case CY_SPI_WR_OP:
|
||||||
|
xfer[0].len = length + CY_SPI_CMD_BYTES;
|
||||||
|
spi_message_add_tail(&xfer[0], &msg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CY_SPI_RD_OP:
|
||||||
|
xfer[0].len = CY_SPI_RD_HEADER_BYTES;
|
||||||
|
spi_message_add_tail(&xfer[0], &msg);
|
||||||
|
|
||||||
|
xfer[1].rx_buf = buf;
|
||||||
|
xfer[1].len = length;
|
||||||
|
spi_message_add_tail(&xfer[1], &msg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
dev_err(dev, "%s: bad operation code=%d\n", __func__, op);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
retval = spi_sync(spi, &msg);
|
||||||
|
if (retval < 0) {
|
||||||
|
dev_dbg(dev, "%s: spi_sync() error %d, len=%d, op=%d\n",
|
||||||
|
__func__, retval, xfer[1].len, op);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* do not return here since was a bad ACK sequence
|
||||||
|
* let the following ACK check handle any errors and
|
||||||
|
* allow silent retries
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rd_buf[CY_SPI_SYNC_BYTE] != CY_SPI_SYNC_ACK) {
|
||||||
|
dev_dbg(dev, "%s: operation %d failed\n", __func__, op);
|
||||||
|
|
||||||
|
for (i = 0; i < CY_SPI_CMD_BYTES; i++)
|
||||||
|
dev_dbg(dev, "%s: test rd_buf[%d]:0x%02x\n",
|
||||||
|
__func__, i, rd_buf[i]);
|
||||||
|
for (i = 0; i < length; i++)
|
||||||
|
dev_dbg(dev, "%s: test buf[%d]:0x%02x\n",
|
||||||
|
__func__, i, buf[i]);
|
||||||
|
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int cyttsp_spi_read_block_data(struct device *dev, u8 *xfer_buf,
|
||||||
|
u16 addr, u8 length, void *data)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
rc = cyttsp_spi_xfer(dev, xfer_buf, CY_SPI_WR_OP, addr, NULL, 0);
|
||||||
|
if (rc)
|
||||||
|
return rc;
|
||||||
|
else
|
||||||
|
return cyttsp_spi_xfer(dev, xfer_buf, CY_SPI_RD_OP, addr, data,
|
||||||
|
length);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int cyttsp_spi_write_block_data(struct device *dev, u8 *xfer_buf,
|
||||||
|
u16 addr, u8 length, const void *data)
|
||||||
|
{
|
||||||
|
return cyttsp_spi_xfer(dev, xfer_buf, CY_SPI_WR_OP, addr, (void *)data,
|
||||||
|
length);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct cyttsp4_bus_ops cyttsp_spi_bus_ops = {
|
||||||
|
.bustype = BUS_SPI,
|
||||||
|
.write = cyttsp_spi_write_block_data,
|
||||||
|
.read = cyttsp_spi_read_block_data,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int cyttsp4_spi_probe(struct spi_device *spi)
|
||||||
|
{
|
||||||
|
struct cyttsp4 *ts;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
/* Set up SPI*/
|
||||||
|
spi->bits_per_word = CY_SPI_BITS_PER_WORD;
|
||||||
|
spi->mode = SPI_MODE_0;
|
||||||
|
error = spi_setup(spi);
|
||||||
|
if (error < 0) {
|
||||||
|
dev_err(&spi->dev, "%s: SPI setup error %d\n",
|
||||||
|
__func__, error);
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
ts = cyttsp4_probe(&cyttsp_spi_bus_ops, &spi->dev, spi->irq,
|
||||||
|
CY_SPI_DATA_BUF_SIZE);
|
||||||
|
|
||||||
|
return PTR_ERR_OR_ZERO(ts);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void cyttsp4_spi_remove(struct spi_device *spi)
|
||||||
|
{
|
||||||
|
struct cyttsp4 *ts = spi_get_drvdata(spi);
|
||||||
|
cyttsp4_remove(ts);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct spi_driver cyttsp4_spi_driver = {
|
||||||
|
.driver = {
|
||||||
|
.name = CYTTSP4_SPI_NAME,
|
||||||
|
.pm = &cyttsp4_pm_ops,
|
||||||
|
},
|
||||||
|
.probe = cyttsp4_spi_probe,
|
||||||
|
.remove = cyttsp4_spi_remove,
|
||||||
|
};
|
||||||
|
|
||||||
|
module_spi_driver(cyttsp4_spi_driver);
|
||||||
|
|
||||||
|
MODULE_LICENSE("GPL");
|
||||||
|
MODULE_DESCRIPTION("Cypress TrueTouch(R) Standard Product (TTSP) SPI driver");
|
||||||
|
MODULE_AUTHOR("Cypress");
|
||||||
|
MODULE_ALIAS("spi:cyttsp4");
|
||||||
@@ -916,6 +916,20 @@ config MFD_MAX77693
|
|||||||
additional drivers must be enabled in order to use the functionality
|
additional drivers must be enabled in order to use the functionality
|
||||||
of the device.
|
of the device.
|
||||||
|
|
||||||
|
config MFD_MAX77696
|
||||||
|
tristate "Maxim MAX77696 PMIC Support"
|
||||||
|
depends on I2C
|
||||||
|
depends on OF
|
||||||
|
select MFD_CORE
|
||||||
|
select REGMAP_I2C
|
||||||
|
help
|
||||||
|
Say Y here to add support for Maxim Semiconductor MAX77696
|
||||||
|
Power Management ICs. This is the core multifunction
|
||||||
|
driver for interacting with the device. The module name is
|
||||||
|
'max77696'. Additional drivers can be enabled in order to use
|
||||||
|
the following functionalities of the device: GPIO, regulator,
|
||||||
|
charger, LED.
|
||||||
|
|
||||||
config MFD_MAX77705
|
config MFD_MAX77705
|
||||||
tristate "Maxim MAX77705 PMIC Support"
|
tristate "Maxim MAX77705 PMIC Support"
|
||||||
depends on I2C
|
depends on I2C
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ obj-$(CONFIG_MFD_MAX77620) += max77620.o
|
|||||||
obj-$(CONFIG_MFD_MAX77650) += max77650.o
|
obj-$(CONFIG_MFD_MAX77650) += max77650.o
|
||||||
obj-$(CONFIG_MFD_MAX77686) += max77686.o
|
obj-$(CONFIG_MFD_MAX77686) += max77686.o
|
||||||
obj-$(CONFIG_MFD_MAX77693) += max77693.o
|
obj-$(CONFIG_MFD_MAX77693) += max77693.o
|
||||||
|
obj-$(CONFIG_MFD_MAX77696) += max77696.o
|
||||||
obj-$(CONFIG_MFD_MAX77705) += max77705.o
|
obj-$(CONFIG_MFD_MAX77705) += max77705.o
|
||||||
obj-$(CONFIG_MFD_MAX77714) += max77714.o
|
obj-$(CONFIG_MFD_MAX77714) += max77714.o
|
||||||
obj-$(CONFIG_MFD_MAX77843) += max77843.o
|
obj-$(CONFIG_MFD_MAX77843) += max77843.o
|
||||||
|
|||||||
84
drivers/mfd/max77696.c
Normal file
84
drivers/mfd/max77696.c
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
//
|
||||||
|
// Copyright (C) 2026 smallsoalr
|
||||||
|
// Author: smallsolar <solarcene@protonmail.com>
|
||||||
|
//
|
||||||
|
// Core MFD driver for MAXIM 77696 power-supply.
|
||||||
|
|
||||||
|
#include <linux/i2c.h>
|
||||||
|
#include <linux/interrupt.h>
|
||||||
|
#include <linux/mfd/core.h>
|
||||||
|
#include <linux/mfd/max77696.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/of.h>
|
||||||
|
#include <linux/regmap.h>
|
||||||
|
|
||||||
|
static const struct mfd_cell max77696_cells[] = {
|
||||||
|
{
|
||||||
|
.name = "max77696-regulator",
|
||||||
|
.of_compatible = "maxim,max77696-regulator",
|
||||||
|
}, {
|
||||||
|
.name = "max77696-epd",
|
||||||
|
.of_compatible = "maxim,max77696-epd",
|
||||||
|
}, {
|
||||||
|
.name = "max77696-wled",
|
||||||
|
.of_compatible = "maxim,max77696-wled",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct regmap_config max77696_regmap_config = {
|
||||||
|
.name = "max77696",
|
||||||
|
.reg_bits = 8,
|
||||||
|
.val_bits = 8,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int max77696_i2c_probe(struct i2c_client *client)
|
||||||
|
{
|
||||||
|
struct max77696 *chip;
|
||||||
|
unsigned int val;
|
||||||
|
int rv;
|
||||||
|
|
||||||
|
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
|
||||||
|
if (!chip)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
chip->dev = &client->dev;
|
||||||
|
i2c_set_clientdata(client, chip);
|
||||||
|
|
||||||
|
chip->regmap = devm_regmap_init_i2c(client, &max77696_regmap_config);
|
||||||
|
if (IS_ERR(chip->regmap)) {
|
||||||
|
dev_err(chip->dev, "Unable to initialise I2C Regmap\n");
|
||||||
|
return PTR_ERR(chip->regmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
rv = regmap_read(chip->regmap, MAX77696_REG_CID, &val);
|
||||||
|
if (rv) {
|
||||||
|
dev_err(chip->dev, "Unable to read Chip ID\n");
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
dev_info(chip->dev, "Chip Detected ID: 0x%02x\n", val);
|
||||||
|
|
||||||
|
return devm_mfd_add_devices(chip->dev, PLATFORM_DEVID_NONE,
|
||||||
|
max77696_cells, ARRAY_SIZE(max77696_cells),
|
||||||
|
NULL, 0, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct of_device_id max77696_of_match[] = {
|
||||||
|
{ .compatible = "maxim,max77696" },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(of, max77696_of_match);
|
||||||
|
|
||||||
|
static struct i2c_driver max77696_i2c_driver = {
|
||||||
|
.driver = {
|
||||||
|
.name = "max77696",
|
||||||
|
.of_match_table = max77696_of_match,
|
||||||
|
},
|
||||||
|
.probe = max77696_i2c_probe,
|
||||||
|
};
|
||||||
|
module_i2c_driver(max77696_i2c_driver);
|
||||||
|
|
||||||
|
MODULE_DESCRIPTION("MAXIM 77696 multi-function core driver");
|
||||||
|
MODULE_AUTHOR("smallsolar <solarcene@protonmail.com>");
|
||||||
|
MODULE_LICENSE("GPL v2");
|
||||||
@@ -747,6 +747,12 @@ config REGULATOR_MAX77693
|
|||||||
and one current regulator 'CHARGER'. This is suitable for
|
and one current regulator 'CHARGER'. This is suitable for
|
||||||
Exynos-4x12 (MAX77693) or Exynos5433 (MAX77843) SoC chips.
|
Exynos-4x12 (MAX77693) or Exynos5433 (MAX77843) SoC chips.
|
||||||
|
|
||||||
|
config REGULATOR_MAX77696
|
||||||
|
tristate "Maxim 77696 regulator"
|
||||||
|
depends on MFD_MAX77696 || COMPILE_TEST
|
||||||
|
help
|
||||||
|
This driver controls a Maxim 77693/77843 regulators via I2C bus.
|
||||||
|
|
||||||
config REGULATOR_MAX77802
|
config REGULATOR_MAX77802
|
||||||
tristate "Maxim 77802 regulator"
|
tristate "Maxim 77802 regulator"
|
||||||
depends on MFD_MAX77686 || COMPILE_TEST
|
depends on MFD_MAX77686 || COMPILE_TEST
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ obj-$(CONFIG_REGULATOR_MAX20086) += max20086-regulator.o
|
|||||||
obj-$(CONFIG_REGULATOR_MAX20411) += max20411-regulator.o
|
obj-$(CONFIG_REGULATOR_MAX20411) += max20411-regulator.o
|
||||||
obj-$(CONFIG_REGULATOR_MAX77686) += max77686-regulator.o
|
obj-$(CONFIG_REGULATOR_MAX77686) += max77686-regulator.o
|
||||||
obj-$(CONFIG_REGULATOR_MAX77693) += max77693-regulator.o
|
obj-$(CONFIG_REGULATOR_MAX77693) += max77693-regulator.o
|
||||||
|
obj-$(CONFIG_REGULATOR_MAX77696) += max77696-epd.o
|
||||||
obj-$(CONFIG_REGULATOR_MAX77802) += max77802-regulator.o
|
obj-$(CONFIG_REGULATOR_MAX77802) += max77802-regulator.o
|
||||||
obj-$(CONFIG_REGULATOR_MAX77826) += max77826-regulator.o
|
obj-$(CONFIG_REGULATOR_MAX77826) += max77826-regulator.o
|
||||||
obj-$(CONFIG_REGULATOR_MAX77857) += max77857-regulator.o
|
obj-$(CONFIG_REGULATOR_MAX77857) += max77857-regulator.o
|
||||||
|
|||||||
236
drivers/regulator/max77696-epd.c
Normal file
236
drivers/regulator/max77696-epd.c
Normal file
@@ -0,0 +1,236 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
/*
|
||||||
|
* MAX77696 EPD (E-Paper Display) power supply driver
|
||||||
|
*
|
||||||
|
* Drives the EPD regulator block of the MAX77696 PMIC.
|
||||||
|
* Registers DISPLAY, VCOM and V3P3 regulators needed by
|
||||||
|
* the i.MX6SL EPDC driver.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2026 smallsolar <solarcene@protonmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/i2c.h>
|
||||||
|
#include <linux/regmap.h>
|
||||||
|
#include <linux/mfd/max77696.h>
|
||||||
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/regulator/driver.h>
|
||||||
|
#include <linux/regulator/machine.h>
|
||||||
|
#include <linux/regulator/of_regulator.h>
|
||||||
|
#include <linux/gpio/consumer.h>
|
||||||
|
#include <linux/of.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/delay.h>
|
||||||
|
|
||||||
|
enum {
|
||||||
|
MAX77696_EPD_DISPLAY,
|
||||||
|
MAX77696_EPD_VCOM,
|
||||||
|
MAX77696_EPD_V3P3,
|
||||||
|
MAX77696_EPD_NUM_REGS,
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* max77696_epd_vcom_enable - enable VCOM with fault detection and retry.
|
||||||
|
*
|
||||||
|
* EPDINT (0x62) is read-to-clear: a single read both samples and clears
|
||||||
|
* the fault bit, so no separate clear step is needed.
|
||||||
|
*
|
||||||
|
* Called by the regulator core as the .enable op for VCOM only.
|
||||||
|
* DISPLAY and V3P3 use the generic regmap enable op.
|
||||||
|
*/
|
||||||
|
static int max77696_vcom_enable(struct regulator_dev *rdev)
|
||||||
|
{
|
||||||
|
|
||||||
|
struct max77696 *chip = rdev_get_drvdata(rdev);
|
||||||
|
struct regmap *regmap = chip->regmap;
|
||||||
|
struct device *dev = chip->dev;
|
||||||
|
|
||||||
|
unsigned int val;
|
||||||
|
int i, ret;
|
||||||
|
|
||||||
|
for (i = 0; i < MAX77696_EPD_VCOM_FAULT_RETRIES; i++) {
|
||||||
|
/* Enable VCOM via the standard regmap bit */
|
||||||
|
ret = regulator_enable_regmap(rdev);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(dev, "VCOM enable failed (attempt %d): %d\n",
|
||||||
|
i + 1, ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
msleep(MAX77696_EPD_VCOM_SETTLE_MS);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read EPDINT. This is read-to-clear, so a single read
|
||||||
|
* both samples and clears the fault status.
|
||||||
|
*/
|
||||||
|
ret = regmap_read(regmap, EPDINT_REG, &val);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(dev, "EPDINT read failed: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(val & EPDINT_VCOM_FAULT)) {
|
||||||
|
if (i > 0)
|
||||||
|
dev_info(dev,
|
||||||
|
"VCOM stable after %d attempt(s)\n",
|
||||||
|
i + 1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dev_warn(chip->dev,
|
||||||
|
"VCOM fault detected (EPDINT=0x%02x), "
|
||||||
|
"retrying (%d/%d)\n",
|
||||||
|
val, i + 1, MAX77696_EPD_VCOM_FAULT_RETRIES);
|
||||||
|
|
||||||
|
ret = regulator_disable_regmap(rdev);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(dev, "VCOM disable (for retry) failed: %d\n",
|
||||||
|
ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
msleep(MAX77696_EPD_VCOM_RETRY_DELAY_MS);
|
||||||
|
}
|
||||||
|
|
||||||
|
dev_err(dev,
|
||||||
|
"VCOM failed to stabilise after %d attempts; "
|
||||||
|
"last EPDINT=0x%02x\n",
|
||||||
|
MAX77696_EPD_VCOM_FAULT_RETRIES, val);
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct regulator_ops max77696_regmap_ops = {
|
||||||
|
.enable = regulator_enable_regmap,
|
||||||
|
.disable = regulator_disable_regmap,
|
||||||
|
.is_enabled = regulator_is_enabled_regmap,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct regulator_ops max77696_vcom_ops = {
|
||||||
|
.enable = max77696_vcom_enable,
|
||||||
|
.disable = regulator_disable_regmap,
|
||||||
|
.is_enabled = regulator_is_enabled_regmap,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct regulator_desc max77696_regs[] = {
|
||||||
|
[MAX77696_EPD_DISPLAY] = {
|
||||||
|
.name = "DISPLAY",
|
||||||
|
.of_match = "DISPLAY",
|
||||||
|
.regulators_node = "regulators",
|
||||||
|
.id = MAX77696_EPD_DISPLAY,
|
||||||
|
.ops = &max77696_regmap_ops,
|
||||||
|
.type = REGULATOR_VOLTAGE,
|
||||||
|
.owner = THIS_MODULE,
|
||||||
|
.enable_reg = EPDCNFG_REG,
|
||||||
|
.enable_mask = EPDCNFG_EPDEN,
|
||||||
|
},
|
||||||
|
[MAX77696_EPD_VCOM] = {
|
||||||
|
.name = "VCOM",
|
||||||
|
.of_match = "VCOM",
|
||||||
|
.regulators_node = "regulators",
|
||||||
|
.id = MAX77696_EPD_VCOM,
|
||||||
|
.ops = &max77696_vcom_ops, /* fault-aware enable */
|
||||||
|
.type = REGULATOR_VOLTAGE,
|
||||||
|
.owner = THIS_MODULE,
|
||||||
|
.enable_reg = EPDCNFG_REG,
|
||||||
|
.enable_mask = EPDCNFG_VCOMEN,
|
||||||
|
},
|
||||||
|
[MAX77696_EPD_V3P3] = {
|
||||||
|
.name = "V3P3",
|
||||||
|
.of_match = "V3P3",
|
||||||
|
.regulators_node = "regulators",
|
||||||
|
.id = MAX77696_EPD_V3P3,
|
||||||
|
.ops = &max77696_regmap_ops,
|
||||||
|
.type = REGULATOR_VOLTAGE,
|
||||||
|
.owner = THIS_MODULE,
|
||||||
|
.enable_reg = EPDCNFG_REG,
|
||||||
|
.enable_mask = EPDCNFG_SSHVDDH,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int max77696_regulator_probe(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
|
||||||
|
struct max77696 *chip = dev_get_drvdata(pdev->dev.parent);
|
||||||
|
struct regulator_config config = { };
|
||||||
|
struct regulator_dev *rdev;
|
||||||
|
|
||||||
|
unsigned int vcom_val, vcomr_val, lsw4;
|
||||||
|
|
||||||
|
int i, ret;
|
||||||
|
|
||||||
|
config.dev = &pdev->dev;
|
||||||
|
config.regmap = chip->regmap;
|
||||||
|
config.driver_data = chip;
|
||||||
|
|
||||||
|
|
||||||
|
dev_info(&pdev->dev, "of_node = %pOF\n", pdev->dev.of_node);
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(max77696_regs); i++) {
|
||||||
|
rdev = devm_regulator_register(&pdev->dev, &max77696_regs[i], &config);
|
||||||
|
|
||||||
|
if (IS_ERR(rdev))
|
||||||
|
return dev_err_probe(chip->dev, PTR_ERR(rdev),
|
||||||
|
"register %s failed\n",
|
||||||
|
max77696_regs[i].name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set VCOM to its factory-calibrated voltage. Written unconditionally
|
||||||
|
* at probe, independent of enable state, matching the vendor driver's
|
||||||
|
* behaviour of voltage being a separate concern from enable/disable.
|
||||||
|
*/
|
||||||
|
ret = regmap_update_bits(chip->regmap, EPDVCOMR_REG, EPDVCOMR_VCOMR, EPDVCOMR_VCOMR);
|
||||||
|
if (ret)
|
||||||
|
return dev_err_probe(chip->dev, ret, "failed to set VCOMR\n");
|
||||||
|
|
||||||
|
ret = regmap_write(chip->regmap, EPDVCOM_REG, VCOM_CAL_REG_VALUE);
|
||||||
|
if (ret)
|
||||||
|
return dev_err_probe(chip->dev, ret, "failed to set VCOM calibration\n");
|
||||||
|
|
||||||
|
|
||||||
|
regmap_read(chip->regmap, EPDVCOM_REG, &vcom_val);
|
||||||
|
regmap_read(chip->regmap, EPDVCOMR_REG, &vcomr_val);
|
||||||
|
dev_info(chip->dev, "VCOM readback: EPDVCOM=0x%02x EPDVCOMR=0x%02x\n",
|
||||||
|
vcom_val, vcomr_val & EPDVCOMR_VCOMR);
|
||||||
|
|
||||||
|
/* Enable LSW4 (DISP_GATED) — gates 3.3V to panel logic on Muscat WFO.
|
||||||
|
* LSW4 = DISP_GATED-old per board-mx6sl_wario.c MAX77696_VREG_CONSUMERS.
|
||||||
|
*/
|
||||||
|
ret = regmap_update_bits(chip->regmap, LSW4_CNTRL_REG, LSW4_OUTLS, LSW4_OUTLS);
|
||||||
|
if (ret)
|
||||||
|
return dev_err_probe(chip->dev, ret, "failed to enable LSW4 (DISP_GATED)\n");
|
||||||
|
|
||||||
|
/* Verify LSW4 enable latched */
|
||||||
|
regmap_read(chip->regmap, LSW4_CNTRL_REG, &lsw4);
|
||||||
|
dev_info(chip->dev, "LSW4: 0x%02x\n", lsw4);
|
||||||
|
|
||||||
|
dev_info(chip->dev, "MAX77696 v0.8 EPD regulators registered (VCOM=%d uV)\n",
|
||||||
|
(VCOM_CAL_REG_VALUE + 0xFF) * 9985);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct of_device_id max77696_regulator_of_match[] = {
|
||||||
|
{ .compatible = "maxim,max77696-epd" },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(of, max77696_regulator_of_match);
|
||||||
|
|
||||||
|
static const struct platform_device_id max77696_regulator_id[] = {
|
||||||
|
{ "max77696-epd", 0 },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(platform, max77696_regulator_id);
|
||||||
|
|
||||||
|
static struct platform_driver max77696_regulator_driver = {
|
||||||
|
.driver = {
|
||||||
|
.name = "max77696-epd",
|
||||||
|
.of_match_table = max77696_regulator_of_match,
|
||||||
|
},
|
||||||
|
.probe = max77696_regulator_probe,
|
||||||
|
.id_table = max77696_regulator_id,
|
||||||
|
};
|
||||||
|
module_platform_driver(max77696_regulator_driver);
|
||||||
|
|
||||||
|
MODULE_LICENSE("GPL v2");
|
||||||
|
MODULE_DESCRIPTION("MAX77696 EPD power supply driver");
|
||||||
|
MODULE_AUTHOR("smallsolar");
|
||||||
@@ -262,6 +262,12 @@ config BACKLIGHT_DA9052
|
|||||||
help
|
help
|
||||||
Enable the Backlight Driver for DA9052-BC and DA9053-AA/Bx PMICs.
|
Enable the Backlight Driver for DA9052-BC and DA9053-AA/Bx PMICs.
|
||||||
|
|
||||||
|
config BACKLIGHT_MAX77696
|
||||||
|
tristate "Backlight driver for MAX77696"
|
||||||
|
depends on MFD_MAX77696 || COMPILE_TEST
|
||||||
|
help
|
||||||
|
Enable driver for MAX77696 Front WLEDs (Kindle PW3).
|
||||||
|
|
||||||
config BACKLIGHT_MAX8925
|
config BACKLIGHT_MAX8925
|
||||||
tristate "Backlight driver for MAX8925"
|
tristate "Backlight driver for MAX8925"
|
||||||
depends on MFD_MAX8925
|
depends on MFD_MAX8925
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o
|
|||||||
obj-$(CONFIG_BACKLIGHT_LP8788) += lp8788_bl.o
|
obj-$(CONFIG_BACKLIGHT_LP8788) += lp8788_bl.o
|
||||||
obj-$(CONFIG_BACKLIGHT_LV5207LP) += lv5207lp.o
|
obj-$(CONFIG_BACKLIGHT_LV5207LP) += lv5207lp.o
|
||||||
obj-$(CONFIG_BACKLIGHT_MAX8925) += max8925_bl.o
|
obj-$(CONFIG_BACKLIGHT_MAX8925) += max8925_bl.o
|
||||||
|
obj-$(CONFIG_BACKLIGHT_MAX77696) += max77696-wled.o
|
||||||
obj-$(CONFIG_BACKLIGHT_MP3309C) += mp3309c.o
|
obj-$(CONFIG_BACKLIGHT_MP3309C) += mp3309c.o
|
||||||
obj-$(CONFIG_BACKLIGHT_MT6370) += mt6370-backlight.o
|
obj-$(CONFIG_BACKLIGHT_MT6370) += mt6370-backlight.o
|
||||||
obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o
|
obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o
|
||||||
|
|||||||
201
drivers/video/backlight/max77696-wled.c
Normal file
201
drivers/video/backlight/max77696-wled.c
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
/*
|
||||||
|
* MAX77696 WLED Backlight Driver
|
||||||
|
*
|
||||||
|
* Controls the WLED boost regulator block of the MAX77696 PMIC,
|
||||||
|
* used as the frontlight driver on the Amazon Kindle Paperwhite 3
|
||||||
|
* (Wario/Muscat platform).
|
||||||
|
*
|
||||||
|
* Register map (from vendor kernel):
|
||||||
|
* 0x6C LEDBST_CNTRL1 — bit 7 = LED1EN (boost + LED enable)
|
||||||
|
* 0x6D LED1CURRENT_1 — bits 11:4 of 12-bit current DAC (MSB)
|
||||||
|
* 0x6E LED1CURRENT_2 — bits 3:0 of 12-bit current DAC (LSB)
|
||||||
|
*
|
||||||
|
* Brightness is a 12-bit value (0–4095). The stock driver uses
|
||||||
|
* DUET_FL_LEVEL12_MID = 240 as the default brightness on Muscat WFO.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2026 smallsolar <solarcene@protonmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/backlight.h>
|
||||||
|
#include <linux/i2c.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/of.h>
|
||||||
|
#include <linux/regmap.h>
|
||||||
|
#include <linux/mfd/max77696.h>
|
||||||
|
#include <linux/platform_device.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Default brightness on probe: DUET_FL_LEVEL12_MID from vendor
|
||||||
|
* frontlight.h. Matches the stock kernel's initial setting on
|
||||||
|
* Muscat WFO (KPW3). Set to 0 to start with backlight off.
|
||||||
|
*/
|
||||||
|
#define MAX77696_BL_DEFAULT_BRIGHTNESS 240
|
||||||
|
|
||||||
|
struct max77696_bl {
|
||||||
|
struct regmap *regmap;
|
||||||
|
struct device *dev;
|
||||||
|
int brightness;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* max77696_bl_set - write brightness to hardware.
|
||||||
|
*
|
||||||
|
* Brightness is a 12-bit value split across two registers:
|
||||||
|
* LED1CURRENT_1 = bits 11:4 (upper 8 bits)
|
||||||
|
* LED1CURRENT_2 = bits 3:0 (lower 4 bits)
|
||||||
|
*
|
||||||
|
* At brightness=0, disable the boost converter (LED1EN=0).
|
||||||
|
* At brightness>0, write current registers then enable (LED1EN=1).
|
||||||
|
* This matches the sequence in the vendor max77696_bl_set().
|
||||||
|
*/
|
||||||
|
static int max77696_bl_set(struct max77696_bl *bl, int brightness)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
brightness = clamp(brightness,
|
||||||
|
MAX77696_BL_MIN_BRIGHTNESS,
|
||||||
|
MAX77696_BL_MAX_BRIGHTNESS);
|
||||||
|
|
||||||
|
if (brightness == MAX77696_BL_MIN_BRIGHTNESS) {
|
||||||
|
/* Disable boost converter */
|
||||||
|
ret = regmap_update_bits(bl->regmap, LEDBST_CNTRL1_REG,
|
||||||
|
LEDBST_CNTRL1_LED1EN, 0);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
bl->brightness = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Write 12-bit brightness: MSB in LED1CURRENT_1, LSB in LED1CURRENT_2 */
|
||||||
|
ret = regmap_write(bl->regmap, LED1CURRENT_1_REG,
|
||||||
|
(brightness >> 4) & 0xFF);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ret = regmap_write(bl->regmap, LED1CURRENT_2_REG,
|
||||||
|
brightness & 0x0F);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
/* Enable boost converter */
|
||||||
|
ret = regmap_update_bits(bl->regmap, LEDBST_CNTRL1_REG,
|
||||||
|
LEDBST_CNTRL1_LED1EN, LEDBST_CNTRL1_LED1EN);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
bl->brightness = brightness;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int max77696_bl_update_status(struct backlight_device *bd)
|
||||||
|
{
|
||||||
|
struct max77696_bl *bl = bl_get_data(bd);
|
||||||
|
int brightness = backlight_get_brightness(bd);
|
||||||
|
|
||||||
|
return max77696_bl_set(bl, brightness);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int max77696_bl_get_brightness(struct backlight_device *bd)
|
||||||
|
{
|
||||||
|
struct max77696_bl *bl = bl_get_data(bd);
|
||||||
|
unsigned int msb, lsb, enabled;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = regmap_read(bl->regmap, LEDBST_CNTRL1_REG, &enabled);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
if (!(enabled & LEDBST_CNTRL1_LED1EN))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
ret = regmap_read(bl->regmap, LED1CURRENT_1_REG, &msb);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ret = regmap_read(bl->regmap, LED1CURRENT_2_REG, &lsb);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
return (msb << 4) | (lsb & 0x0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct backlight_ops max77696_bl_ops = {
|
||||||
|
.options = BL_CORE_SUSPENDRESUME,
|
||||||
|
.update_status = max77696_bl_update_status,
|
||||||
|
.get_brightness = max77696_bl_get_brightness,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int max77696_bl_probe(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct max77696 *chip = dev_get_drvdata(pdev->dev.parent);
|
||||||
|
|
||||||
|
struct device *dev = &pdev->dev;
|
||||||
|
struct max77696_bl *bl;
|
||||||
|
struct backlight_device *bd;
|
||||||
|
struct backlight_properties props = {
|
||||||
|
.type = BACKLIGHT_RAW,
|
||||||
|
.max_brightness = MAX77696_BL_MAX_BRIGHTNESS,
|
||||||
|
.brightness = MAX77696_BL_DEFAULT_BRIGHTNESS,
|
||||||
|
};
|
||||||
|
u32 brightness;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
bl = devm_kzalloc(dev, sizeof(*bl), GFP_KERNEL);
|
||||||
|
if (!bl)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
bl->regmap = chip->regmap;
|
||||||
|
bl->dev = dev;
|
||||||
|
|
||||||
|
/* Allow DT override of default brightness */
|
||||||
|
if (!of_property_read_u32(dev->of_node, "default-brightness", &brightness))
|
||||||
|
props.brightness = clamp_t(u32, brightness,
|
||||||
|
MAX77696_BL_MIN_BRIGHTNESS,
|
||||||
|
MAX77696_BL_MAX_BRIGHTNESS);
|
||||||
|
|
||||||
|
bd = devm_backlight_device_register(dev, "max77696-wled", dev, bl,
|
||||||
|
&max77696_bl_ops, &props);
|
||||||
|
if (IS_ERR(bd))
|
||||||
|
return dev_err_probe(dev, PTR_ERR(bd),
|
||||||
|
"backlight device register failed\n");
|
||||||
|
|
||||||
|
platform_set_drvdata(pdev, bd);
|
||||||
|
|
||||||
|
/* Apply initial brightness */
|
||||||
|
ret = max77696_bl_set(bl, props.brightness);
|
||||||
|
if (ret)
|
||||||
|
return dev_err_probe(dev, ret,
|
||||||
|
"failed to set initial brightness\n");
|
||||||
|
|
||||||
|
dev_info(dev, "MAX77696 WLED backlight registered (brightness=%d/%d)\n",
|
||||||
|
props.brightness, MAX77696_BL_MAX_BRIGHTNESS);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct of_device_id max77696_bl_of_match[] = {
|
||||||
|
{ .compatible = "maxim,max77696-wled" },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(of, max77696_bl_of_match);
|
||||||
|
|
||||||
|
static const struct platform_device_id max77696_bl_id[] = {
|
||||||
|
{ "max77696-wled", 0 },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(platform, max77696_bl_id);
|
||||||
|
|
||||||
|
static struct platform_driver max77696_bl_driver = {
|
||||||
|
.driver = {
|
||||||
|
.name = "max77696-wled",
|
||||||
|
.of_match_table = max77696_bl_of_match,
|
||||||
|
},
|
||||||
|
.probe = max77696_bl_probe,
|
||||||
|
.id_table = max77696_bl_id,
|
||||||
|
};
|
||||||
|
module_platform_driver(max77696_bl_driver);
|
||||||
|
|
||||||
|
MODULE_LICENSE("GPL");
|
||||||
|
MODULE_DESCRIPTION("MAX77696 WLED Backlight Driver");
|
||||||
|
MODULE_AUTHOR("smallsolar");
|
||||||
87
include/linux/mfd/max77696.h
Normal file
87
include/linux/mfd/max77696.h
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2026 smallsolar
|
||||||
|
* Author: smallsolar
|
||||||
|
*
|
||||||
|
* Common definitions for MAXIM 77696 charger/power-supply.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MAX77696_H
|
||||||
|
#define MAX77696_H
|
||||||
|
|
||||||
|
#include <linux/bits.h>
|
||||||
|
|
||||||
|
struct max77696 {
|
||||||
|
struct regmap *regmap;
|
||||||
|
struct device *dev;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MAX77696_REG_CID 0x0
|
||||||
|
|
||||||
|
#define EPDCNFG_REG 0x60
|
||||||
|
#define EPDCNFG_EPDEN BIT(7)
|
||||||
|
#define EPDCNFG_VCOMEN BIT(6)
|
||||||
|
#define EPDCNFG_SSHVDDH BIT(1)
|
||||||
|
|
||||||
|
#define EPDVCOM_REG 0x64
|
||||||
|
#define EPDVCOMR_REG 0xB4
|
||||||
|
#define EPDVCOMR_VCOMR BIT(0)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* EPDINT (0x62) — interrupt/fault status register.
|
||||||
|
* Bit 6 (0x40): VCOM fault. Set when VCOM rail fails to reach
|
||||||
|
* target voltage. Cleared on read (read-to-clear behaviour confirmed
|
||||||
|
* from stock kernel: max77696_epd_isr() does a single regmap_read
|
||||||
|
* of EPDINT and acts on the result without a separate clear step).
|
||||||
|
*
|
||||||
|
* The stock driver retries up to MAX77696_EPD_VCOM_FAULT_RETRIES
|
||||||
|
* times with a fixed inter-retry delay before giving up.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define EPDINT_REG 0x62
|
||||||
|
#define EPDINT_VCOM_FAULT BIT(6)
|
||||||
|
#define MAX77696_EPD_VCOM_FAULT_RETRIES 5
|
||||||
|
#define MAX77696_EPD_VCOM_SETTLE_MS 100
|
||||||
|
#define MAX77696_EPD_VCOM_RETRY_DELAY_MS 100
|
||||||
|
|
||||||
|
/*
|
||||||
|
* VCOM is a factory-calibrated, per-panel value (Amazon's stock driver
|
||||||
|
* reads it from a dedicated SPI NOR flash chip on the panel module —
|
||||||
|
* see panel_flash_spi / panel_get_vcom_str() in the vendor 3.0.35 kernel,
|
||||||
|
* drivers/video/mxc/mxc_epdc_fb_lab126.c). Mainline has no driver for
|
||||||
|
* that SPI flash yet, so this value is hardcoded from a one-time read
|
||||||
|
* via the stock firmware's sysfs:
|
||||||
|
* /sys/devices/platform/imx-i2c.0/i2c-0/0-003c/max77696-epd.0/vcom_microvolt
|
||||||
|
* = 2476280 (µV magnitude; VCOM is a negative bias, per
|
||||||
|
* reg_data[MAX77696_EPD_ID_EPDVCOM].neg_sign in the vendor
|
||||||
|
* drivers/regulator/max77696-epd.c).
|
||||||
|
*
|
||||||
|
* Register encoding (from vendor max77696_epd_vcom_set_voltage()):
|
||||||
|
* step_uV = 9985, value = round(target_uV / step_uV)
|
||||||
|
* if (value >= 0xFF) { value -= 0xFF; EPDVCOMR.VCOMR = 1 }
|
||||||
|
* else EPDVCOMR.VCOMR = 0
|
||||||
|
* EPDVCOM = (u8)value
|
||||||
|
*
|
||||||
|
* 2476280 / 9985 = 248 exactly (248 * 9985 = 2476280, no rounding loss).
|
||||||
|
* 248 < 0xFF, so VCOMR stays 0 and only EPDVCOM needs writing.
|
||||||
|
*
|
||||||
|
* THIS VALUE IS SPECIFIC TO THE PANEL THIS WAS CALIBRATED AGAINST.
|
||||||
|
* Do not reuse on a different physical unit without re-reading its own
|
||||||
|
* factory calibration first.
|
||||||
|
*/
|
||||||
|
#define VCOM_CAL_REG_VALUE 0x0B
|
||||||
|
|
||||||
|
#define LSW4_CNTRL_REG 0x5F
|
||||||
|
#define LSW4_OUTLS BIT(0)
|
||||||
|
|
||||||
|
/* WLED register addresses */
|
||||||
|
#define LEDBST_CNTRL1_REG 0x6C
|
||||||
|
#define LEDBST_CNTRL1_LED1EN BIT(7) /* boost + LED enable */
|
||||||
|
|
||||||
|
#define LED1CURRENT_1_REG 0x6D /* bits 11:4 of brightness (MSB) */
|
||||||
|
#define LED1CURRENT_2_REG 0x6E /* bits 3:0 of brightness (LSB) */
|
||||||
|
|
||||||
|
#define MAX77696_BL_MAX_BRIGHTNESS 0xFFF /* 12-bit DAC */
|
||||||
|
#define MAX77696_BL_MIN_BRIGHTNESS 0
|
||||||
|
|
||||||
|
#endif /* MAX77696_H */
|
||||||
62
include/linux/platform_data/cyttsp4.h
Normal file
62
include/linux/platform_data/cyttsp4.h
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
/*
|
||||||
|
* Header file for:
|
||||||
|
* Cypress TrueTouch(TM) Standard Product (TTSP) touchscreen drivers.
|
||||||
|
* For use with Cypress Txx3xx parts.
|
||||||
|
* Supported parts include:
|
||||||
|
* CY8CTST341
|
||||||
|
* CY8CTMA340
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
|
||||||
|
* Copyright (C) 2012 Javier Martinez Canillas <javier@dowhile0.org>
|
||||||
|
*
|
||||||
|
* Contact Cypress Semiconductor at www.cypress.com (kev@cypress.com)
|
||||||
|
*/
|
||||||
|
#ifndef _CYTTSP4_H_
|
||||||
|
#define _CYTTSP4_H_
|
||||||
|
|
||||||
|
#define CYTTSP4_MT_NAME "cyttsp4_mt"
|
||||||
|
#define CYTTSP4_I2C_NAME "cyttsp4_i2c_adapter"
|
||||||
|
#define CYTTSP4_SPI_NAME "cyttsp4_spi_adapter"
|
||||||
|
|
||||||
|
#define CY_TOUCH_SETTINGS_MAX 32
|
||||||
|
|
||||||
|
struct touch_framework {
|
||||||
|
const uint16_t *abs;
|
||||||
|
uint8_t size;
|
||||||
|
uint8_t enable_vkeys;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct cyttsp4_mt_platform_data {
|
||||||
|
struct touch_framework *frmwrk;
|
||||||
|
unsigned short flags;
|
||||||
|
char const *inp_dev_name;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct touch_settings {
|
||||||
|
const uint8_t *data;
|
||||||
|
uint32_t size;
|
||||||
|
uint8_t tag;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct cyttsp4_core_platform_data {
|
||||||
|
int irq_gpio;
|
||||||
|
int rst_gpio;
|
||||||
|
int level_irq_udelay;
|
||||||
|
int (*xres)(struct cyttsp4_core_platform_data *pdata,
|
||||||
|
struct device *dev);
|
||||||
|
int (*init)(struct cyttsp4_core_platform_data *pdata,
|
||||||
|
int on, struct device *dev);
|
||||||
|
int (*power)(struct cyttsp4_core_platform_data *pdata,
|
||||||
|
int on, struct device *dev, atomic_t *ignore_irq);
|
||||||
|
int (*irq_stat)(struct cyttsp4_core_platform_data *pdata,
|
||||||
|
struct device *dev);
|
||||||
|
struct touch_settings *sett[CY_TOUCH_SETTINGS_MAX];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cyttsp4_platform_data {
|
||||||
|
struct cyttsp4_core_platform_data *core_pdata;
|
||||||
|
struct cyttsp4_mt_platform_data *mt_pdata;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* _CYTTSP4_H_ */
|
||||||
Reference in New Issue
Block a user