Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef LINUX_SPI_MAX7301_H
0003 #define LINUX_SPI_MAX7301_H
0004 
0005 #include <linux/gpio/driver.h>
0006 
0007 /*
0008  * Some registers must be read back to modify.
0009  * To save time we cache them here in memory
0010  */
0011 struct max7301 {
0012     struct mutex    lock;
0013     u8      port_config[8]; /* field 0 is unused */
0014     u32     out_level;  /* cached output levels */
0015     u32     input_pullup_active;
0016     struct gpio_chip chip;
0017     struct device *dev;
0018     int (*write)(struct device *dev, unsigned int reg, unsigned int val);
0019     int (*read)(struct device *dev, unsigned int reg);
0020 };
0021 
0022 struct max7301_platform_data {
0023     /* number assigned to the first GPIO */
0024     unsigned    base;
0025     /*
0026      * bitmask controlling the pullup configuration,
0027      *
0028      * _note_ the 4 lowest bits are unused, because the first 4
0029      * ports of the controller are not used, too.
0030      */
0031     u32     input_pullup_active;
0032 };
0033 
0034 extern void __max730x_remove(struct device *dev);
0035 extern int __max730x_probe(struct max7301 *ts);
0036 #endif