Lines Matching refs:ts

50 	struct max7301 *ts = container_of(chip, struct max7301, chip);
59 config = &ts->port_config[offset >> 2];
61 if (ts->input_pullup_active & BIT(offset))
66 mutex_lock(&ts->lock);
71 ret = ts->write(ts->dev, 0x08 + (offset >> 2), *config);
73 mutex_unlock(&ts->lock);
78 static int __max7301_set(struct max7301 *ts, unsigned offset, int value)
81 ts->out_level |= 1 << offset;
82 return ts->write(ts->dev, 0x20 + offset, 0x01);
84 ts->out_level &= ~(1 << offset);
85 return ts->write(ts->dev, 0x20 + offset, 0x00);
92 struct max7301 *ts = container_of(chip, struct max7301, chip);
101 config = &ts->port_config[offset >> 2];
103 mutex_lock(&ts->lock);
108 ret = __max7301_set(ts, offset, value);
111 ret = ts->write(ts->dev, 0x08 + (offset >> 2), *config);
113 mutex_unlock(&ts->lock);
120 struct max7301 *ts = gpiochip_get_data(chip);
126 mutex_lock(&ts->lock);
128 config = (ts->port_config[offset >> 2] >> ((offset & 3) << 1))
134 level = !!(ts->out_level & (1 << offset));
139 level = ts->read(ts->dev, 0x20 + offset) & 0x01;
141 mutex_unlock(&ts->lock);
148 struct max7301 *ts = gpiochip_get_data(chip);
153 mutex_lock(&ts->lock);
155 __max7301_set(ts, offset, value);
157 mutex_unlock(&ts->lock);
160 int __max730x_probe(struct max7301 *ts)
162 struct device *dev = ts->dev;
168 mutex_init(&ts->lock);
169 dev_set_drvdata(dev, ts);
172 ts->write(dev, 0x04, 0x01);
175 ts->input_pullup_active = pdata->input_pullup_active;
176 ts->chip.base = pdata->base;
178 ts->chip.base = -1;
180 ts->chip.label = dev->driver->name;
182 ts->chip.direction_input = max7301_direction_input;
183 ts->chip.get = max7301_get;
184 ts->chip.direction_output = max7301_direction_output;
185 ts->chip.set = max7301_set;
187 ts->chip.ngpio = PIN_NUMBER;
188 ts->chip.can_sleep = true;
189 ts->chip.parent = dev;
190 ts->chip.owner = THIS_MODULE;
204 ts->port_config[i] = 0xAA;
207 ret = max7301_direction_input(&ts->chip, offset);
213 ret = gpiochip_add_data(&ts->chip, ts);
218 mutex_destroy(&ts->lock);
225 struct max7301 *ts = dev_get_drvdata(dev);
228 ts->write(dev, 0x04, 0x00);
229 gpiochip_remove(&ts->chip);
230 mutex_destroy(&ts->lock);