1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun #ifndef LINUX_SPI_MAX7301_H 3*4882a593Smuzhiyun #define LINUX_SPI_MAX7301_H 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun #include <linux/gpio.h> 6*4882a593Smuzhiyun 7*4882a593Smuzhiyun /* 8*4882a593Smuzhiyun * Some registers must be read back to modify. 9*4882a593Smuzhiyun * To save time we cache them here in memory 10*4882a593Smuzhiyun */ 11*4882a593Smuzhiyun struct max7301 { 12*4882a593Smuzhiyun struct mutex lock; 13*4882a593Smuzhiyun u8 port_config[8]; /* field 0 is unused */ 14*4882a593Smuzhiyun u32 out_level; /* cached output levels */ 15*4882a593Smuzhiyun u32 input_pullup_active; 16*4882a593Smuzhiyun struct gpio_chip chip; 17*4882a593Smuzhiyun struct device *dev; 18*4882a593Smuzhiyun int (*write)(struct device *dev, unsigned int reg, unsigned int val); 19*4882a593Smuzhiyun int (*read)(struct device *dev, unsigned int reg); 20*4882a593Smuzhiyun }; 21*4882a593Smuzhiyun 22*4882a593Smuzhiyun struct max7301_platform_data { 23*4882a593Smuzhiyun /* number assigned to the first GPIO */ 24*4882a593Smuzhiyun unsigned base; 25*4882a593Smuzhiyun /* 26*4882a593Smuzhiyun * bitmask controlling the pullup configuration, 27*4882a593Smuzhiyun * 28*4882a593Smuzhiyun * _note_ the 4 lowest bits are unused, because the first 4 29*4882a593Smuzhiyun * ports of the controller are not used, too. 30*4882a593Smuzhiyun */ 31*4882a593Smuzhiyun u32 input_pullup_active; 32*4882a593Smuzhiyun }; 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun extern int __max730x_remove(struct device *dev); 35*4882a593Smuzhiyun extern int __max730x_probe(struct max7301 *ts); 36*4882a593Smuzhiyun #endif 37