Lines Matching +full:spare +full:- +full:regs

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) ST-Ericsson SA 2010
5 * Author: Hanumath Prasad <hanumath.prasad@stericsson.com> for ST-Ericsson
6 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
22 * enum tc3589x_version - indicates the TC3589x version
38 * tc3589x_reg_read() - read a single TC3589x register
46 ret = i2c_smbus_read_byte_data(tc3589x->i2c, reg); in tc3589x_reg_read()
48 dev_err(tc3589x->dev, "failed to read reg %#x: %d\n", in tc3589x_reg_read()
56 * tc3589x_reg_write() - write a single TC3589x register
65 ret = i2c_smbus_write_byte_data(tc3589x->i2c, reg, data); in tc3589x_reg_write()
67 dev_err(tc3589x->dev, "failed to write reg %#x: %d\n", in tc3589x_reg_write()
75 * tc3589x_block_read() - read multiple TC3589x registers
85 ret = i2c_smbus_read_i2c_block_data(tc3589x->i2c, reg, length, values); in tc3589x_block_read()
87 dev_err(tc3589x->dev, "failed to read regs %#x: %d\n", in tc3589x_block_read()
95 * tc3589x_block_write() - write multiple TC3589x registers
106 ret = i2c_smbus_write_i2c_block_data(tc3589x->i2c, reg, length, in tc3589x_block_write()
109 dev_err(tc3589x->dev, "failed to write regs %#x: %d\n", in tc3589x_block_write()
117 * tc3589x_set_bits() - set the value of a bitfield in a TC3589x register
127 mutex_lock(&tc3589x->lock); in tc3589x_set_bits()
139 mutex_unlock(&tc3589x->lock); in tc3589x_set_bits()
162 .name = "tc3589x-gpio",
165 .of_compatible = "toshiba,tc3589x-gpio",
171 .name = "tc3589x-keypad",
174 .of_compatible = "toshiba,tc3589x-keypad",
190 int virq = irq_find_mapping(tc3589x->domain, bit); in tc3589x_irq()
212 struct tc3589x *tc3589x = d->host_data; in tc3589x_irq_map()
237 tc3589x->domain = irq_domain_add_simple( in tc3589x_irq_init()
241 if (!tc3589x->domain) { in tc3589x_irq_init()
242 dev_err(tc3589x->dev, "Failed to create irqdomain\n"); in tc3589x_irq_init()
243 return -ENOSYS; in tc3589x_irq_init()
262 dev_err(tc3589x->dev, "unknown manufacturer: %#x\n", manf); in tc3589x_chip_init()
263 return -EINVAL; in tc3589x_chip_init()
266 dev_info(tc3589x->dev, "manufacturer: %#x, version: %#x\n", manf, ver); in tc3589x_chip_init()
270 * also spare the GPIO module for any pin initialization in tc3589x_chip_init()
271 * done during pre-kernel boot in tc3589x_chip_init()
287 unsigned int blocks = tc3589x->pdata->block; in tc3589x_device_init()
290 ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_gpio, in tc3589x_device_init()
292 0, tc3589x->domain); in tc3589x_device_init()
294 dev_err(tc3589x->dev, "failed to add gpio child\n"); in tc3589x_device_init()
297 dev_info(tc3589x->dev, "added gpio block\n"); in tc3589x_device_init()
301 ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_keypad, in tc3589x_device_init()
303 0, tc3589x->domain); in tc3589x_device_init()
305 dev_err(tc3589x->dev, "failed to keypad child\n"); in tc3589x_device_init()
308 dev_info(tc3589x->dev, "added keypad block\n"); in tc3589x_device_init()
331 struct device_node *np = dev->of_node; in tc3589x_of_probe()
338 return ERR_PTR(-ENOMEM); in tc3589x_of_probe()
342 return ERR_PTR(-ENODEV); in tc3589x_of_probe()
343 *version = (enum tc3589x_version) of_id->data; in tc3589x_of_probe()
346 if (of_device_is_compatible(child, "toshiba,tc3589x-gpio")) in tc3589x_of_probe()
347 pdata->block |= TC3589x_BLOCK_GPIO; in tc3589x_of_probe()
348 if (of_device_is_compatible(child, "toshiba,tc3589x-keypad")) in tc3589x_of_probe()
349 pdata->block |= TC3589x_BLOCK_KEYPAD; in tc3589x_of_probe()
358 struct device_node *np = i2c->dev.of_node; in tc3589x_probe()
359 struct tc3589x_platform_data *pdata = dev_get_platdata(&i2c->dev); in tc3589x_probe()
365 pdata = tc3589x_of_probe(&i2c->dev, &version); in tc3589x_probe()
367 dev_err(&i2c->dev, "No platform data or DT found\n"); in tc3589x_probe()
372 version = id->driver_data; in tc3589x_probe()
375 if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA in tc3589x_probe()
377 return -EIO; in tc3589x_probe()
379 tc3589x = devm_kzalloc(&i2c->dev, sizeof(struct tc3589x), in tc3589x_probe()
382 return -ENOMEM; in tc3589x_probe()
384 mutex_init(&tc3589x->lock); in tc3589x_probe()
386 tc3589x->dev = &i2c->dev; in tc3589x_probe()
387 tc3589x->i2c = i2c; in tc3589x_probe()
388 tc3589x->pdata = pdata; in tc3589x_probe()
394 tc3589x->num_gpio = 20; in tc3589x_probe()
401 tc3589x->num_gpio = 24; in tc3589x_probe()
415 ret = request_threaded_irq(tc3589x->i2c->irq, NULL, tc3589x_irq, in tc3589x_probe()
419 dev_err(tc3589x->dev, "failed to request IRQ: %d\n", ret); in tc3589x_probe()
425 dev_err(tc3589x->dev, "failed to add child devices\n"); in tc3589x_probe()
436 mfd_remove_devices(tc3589x->dev); in tc3589x_remove()
443 struct i2c_client *client = tc3589x->i2c; in tc3589x_suspend()
447 if (!device_may_wakeup(&client->dev)) in tc3589x_suspend()
457 struct i2c_client *client = tc3589x->i2c; in tc3589x_resume()
461 if (!device_may_wakeup(&client->dev)) in tc3589x_resume()