blob: 433c20e2f46ef9e6b5cc5f5db4d10237e8d7f96b [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Juergen Beisert0c36ec32008-07-21 14:21:34 -07002#ifndef LINUX_SPI_MAX7301_H
3#define LINUX_SPI_MAX7301_H
4
Wolfram Sange9528052010-03-05 13:44:33 -08005#include <linux/gpio.h>
6
7/*
8 * Some registers must be read back to modify.
9 * To save time we cache them here in memory
10 */
11struct max7301 {
12 struct mutex lock;
13 u8 port_config[8]; /* field 0 is unused */
14 u32 out_level; /* cached output levels */
Marc Kleine-Budde4a22b8a2010-08-10 18:02:23 -070015 u32 input_pullup_active;
Wolfram Sange9528052010-03-05 13:44:33 -080016 struct gpio_chip chip;
17 struct device *dev;
18 int (*write)(struct device *dev, unsigned int reg, unsigned int val);
19 int (*read)(struct device *dev, unsigned int reg);
20};
21
Juergen Beisert0c36ec32008-07-21 14:21:34 -070022struct max7301_platform_data {
23 /* number assigned to the first GPIO */
24 unsigned base;
Marc Kleine-Budde4a22b8a2010-08-10 18:02:23 -070025 /*
26 * bitmask controlling the pullup configuration,
27 *
28 * _note_ the 4 lowest bits are unused, because the first 4
29 * ports of the controller are not used, too.
30 */
31 u32 input_pullup_active;
Juergen Beisert0c36ec32008-07-21 14:21:34 -070032};
33
Wolfram Sange9528052010-03-05 13:44:33 -080034extern int __max730x_remove(struct device *dev);
35extern int __max730x_probe(struct max7301 *ts);
Juergen Beisert0c36ec32008-07-21 14:21:34 -070036#endif