blob: a2060bd8b9134237649379985a35cd65b8c3c6f0 [file] [log] [blame]
Gregory Beanc34f16b2010-08-10 18:02:27 -07001/*
2 * Driver for the Semtech SX150x I2C GPIO Expanders
3 *
Duy Truong790f06d2013-02-13 16:38:12 -08004 * Copyright (c) 2010, The Linux Foundation. All rights reserved.
Gregory Beanc34f16b2010-08-10 18:02:27 -07005 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and
8 * only version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Gregory Beanc34f16b2010-08-10 18:02:27 -070014 */
15#ifndef __LINUX_I2C_SX150X_H
16#define __LINUX_I2C_SX150X_H
17
18/**
19 * struct sx150x_platform_data - config data for SX150x driver
20 * @gpio_base: The index number of the first GPIO assigned to this
21 * GPIO expander. The expander will create a block of
22 * consecutively numbered gpios beginning at the given base,
23 * with the size of the block depending on the model of the
24 * expander chip.
25 * @oscio_is_gpo: If set to true, the driver will configure OSCIO as a GPO
26 * instead of as an oscillator, increasing the size of the
27 * GP(I)O pool created by this expander by one. The
28 * output-only GPO pin will be added at the end of the block.
29 * @io_pullup_ena: A bit-mask which enables or disables the pull-up resistor
30 * for each IO line in the expander. Setting the bit at
31 * position n will enable the pull-up for the IO at
32 * the corresponding offset. For chips with fewer than
33 * 16 IO pins, high-end bits are ignored.
34 * @io_pulldn_ena: A bit-mask which enables-or disables the pull-down
35 * resistor for each IO line in the expander. Setting the
36 * bit at position n will enable the pull-down for the IO at
37 * the corresponding offset. For chips with fewer than
38 * 16 IO pins, high-end bits are ignored.
39 * @io_open_drain_ena: A bit-mask which enables-or disables open-drain
40 * operation for each IO line in the expander. Setting the
41 * bit at position n enables open-drain operation for
42 * the IO at the corresponding offset. Clearing the bit
43 * enables regular push-pull operation for that IO.
44 * For chips with fewer than 16 IO pins, high-end bits
45 * are ignored.
46 * @io_polarity: A bit-mask which enables polarity inversion for each IO line
47 * in the expander. Setting the bit at position n inverts
48 * the polarity of that IO line, while clearing it results
49 * in normal polarity. For chips with fewer than 16 IO pins,
50 * high-end bits are ignored.
51 * @irq_summary: The 'summary IRQ' line to which the GPIO expander's INT line
52 * is connected, via which it reports interrupt events
53 * across all GPIO lines. This must be a real,
54 * pre-existing IRQ line.
55 * Setting this value < 0 disables the irq_chip functionality
56 * of the driver.
57 * @irq_base: The first 'virtual IRQ' line at which our block of GPIO-based
58 * IRQ lines will appear. Similarly to gpio_base, the expander
59 * will create a block of irqs beginning at this number.
60 * This value is ignored if irq_summary is < 0.
Gregory Bean5affb602010-09-09 16:38:02 -070061 * @reset_during_probe: If set to true, the driver will trigger a full
62 * reset of the chip at the beginning of the probe
63 * in order to place it in a known state.
Gregory Beanc34f16b2010-08-10 18:02:27 -070064 */
65struct sx150x_platform_data {
66 unsigned gpio_base;
67 bool oscio_is_gpo;
68 u16 io_pullup_ena;
69 u16 io_pulldn_ena;
70 u16 io_open_drain_ena;
71 u16 io_polarity;
72 int irq_summary;
73 unsigned irq_base;
Gregory Bean5affb602010-09-09 16:38:02 -070074 bool reset_during_probe;
Gregory Beanc34f16b2010-08-10 18:02:27 -070075};
76
77#endif /* __LINUX_I2C_SX150X_H */