Skip to contentSkip to conversation

gpio: gpio-max665x: add support for the MAX6650-66510 ICs

PATCH New Laszlo Papp 1 participant 1 message Dec 17, 2013 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: gpio-max665x: add support for the MAX6650-66510 ICs

These ICs already have hwmon driver support, but they also have some gpio functionality which this addition tries to address. Later on, there would be an MFD driver added as well.

---
 drivers/gpio/Kconfig        |  14 +++
 drivers/gpio/Makefile       |   2 +
 drivers/gpio/gpio-max6651.c |  97 ++++++++++++++
 drivers/gpio/gpio-max665x.c | 299 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/i2c/max6651.h |  40 ++++++
 5 files changed, 452 insertions(+)
 create mode 100644 drivers/gpio/gpio-max6651.c
 create mode 100644 drivers/gpio/gpio-max665x.c
 create mode 100644 include/linux/i2c/max6651.h
drivers/gpio/Kconfig +14 -0
index 0f04444..aaa23f4 100644
@@ -103,6 +103,9 @@ config GPIO_DA9055
 
 	  If driver is built as a module it will be called gpio-da9055.
 
+config GPIO_MAX665X
+	tristate
+
 config GPIO_MAX730X
 	tristate
 
@@ -381,6 +384,17 @@ config GPIO_ARIZONA
 	help
 	  Support for GPIOs on Wolfson Arizona class devices.
 
+config GPIO_MAX6651
+	tristate "Maxim MAX6651 GPIO pins"
+	depends on I2C
+	select GPIO_MAX665X
+	help
+      Say yes here to support the GPIO functionality for the MAX6651 Fan Speed
+      Regulators and Monitors with SMBus/I2C Compatible Interface IC. It has
+      five GPIO pins that can be set to various functionality, including the
+      regular input and output operations. It has an internal pull-up resistor
+      though within the IC.
+
 config GPIO_MAX7300
 	tristate "Maxim MAX7300 GPIO expander"
 	depends on I2C
drivers/gpio/Makefile +2 -0
index 7971e36..a4d34d6 100644
@@ -37,6 +37,8 @@ obj-$(CONFIG_ARCH_KS8695)	+= gpio-ks8695.o
 obj-$(CONFIG_GPIO_INTEL_MID)	+= gpio-intel-mid.o
 obj-$(CONFIG_ARCH_LPC32XX)	+= gpio-lpc32xx.o
 obj-$(CONFIG_GPIO_LYNXPOINT)	+= gpio-lynxpoint.o
+obj-$(CONFIG_GPIO_MAX665X)	+= gpio-max665x.o
+obj-$(CONFIG_GPIO_MAX6651)	+= gpio-max6651.o
 obj-$(CONFIG_GPIO_MAX730X)	+= gpio-max730x.o
 obj-$(CONFIG_GPIO_MAX7300)	+= gpio-max7300.o
 obj-$(CONFIG_GPIO_MAX7301)	+= gpio-max7301.o
drivers/gpio/gpio-max6651.c new file +97 -0

97 lines not on this page · raw message

drivers/gpio/gpio-max665x.c new file +299 -0

299 lines not on this page · raw message

include/linux/i2c/max6651.h new file +40 -0
new file mode 100644
index 0000000..a0e4c0e
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2013 Laszlo Papp <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Check max665x.c for further details.
+ */
+
+#ifndef LINUX_I2C_MAX6651_H
+#define LINUX_I2C_MAX6651_H
+
+#include <linux/gpio.h>
+
+struct max665x {
+	struct mutex lock;
+	u8 input_pullup_active;
+	struct gpio_chip chip;
+	struct device *dev;
+	int (*write) (struct device *dev, unsigned int reg,
+		      unsigned int value);
+	int (*read) (struct device *dev, unsigned int reg);
+};
+
+struct max665x_platform_data {
+	/* number assigned to the first GPIO */
+	unsigned base;
+	/*
+	 * bitmask controlling the pullup configuration,
+	 *
+     * _note_ the 3 highest bits are unused, because there can be maximum up
+	 * to five gpio pins on the MAX6651 chip (three on MAX6650).
+	 */
+	u8 input_pullup_active;
+};
+
+extern int __max665x_remove(struct device *dev);
+extern int __max665x_probe(struct max665x *ts);
+#endif
Signature · 1 line
1.8.5.1