forked from Minki/linux
2dfea3803d
We have several new drivers, most of the time coming with their sub devices drivers: - Austria Microsystem's AS3711 - Nano River's viperboard - TI's TPS80031, AM335x TS/ADC, - Realtek's MMC/memstick card reader - Nokia's retu We also got some notable cleanups and improvements: - tps6586x got converted to IRQ domains. - tps65910 and tps65090 moved to the regmap IRQ API. - STMPE is now Device Tree aware. - A general twl6040 and twl-core cleanup, with moves to the regmap I/O and IRQ APIs and a conversion to the recently added PWM framework. - sta2x11 gained regmap support. Then the rest is mostly tiny cleanups and fixes, among which we have Mark's wm5xxx and wm8xxx patchset. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAABAgAGBQJQznPnAAoJEIqAPN1PVmxKuA8P/0nOJduXFM1c0Gy+DD5DnJnG cXzzeSTV8iO3a3sHIye43QPJ5V2YUR5uxLTUEOo/G7my/MoZ/azeNidkUD3qLVlm wVIq35lcS8dWTZaY7nlpBcWc6e39UB0sEueuJNxyhOv5lnMKdi2tAow5f4vIRQnd Q67/EbrgqdltcOpGmVuCdQcvphvWgy+K65jzbJG5zXs7hGX13Q+M5RnYhx76kc8f TDd0APZ71n5/RyISFSBSu2vfl2kES6o47aMgqqXMEHri6d3puAaXM0rFoMzXg/4G eBdxndN25H7rW7xvt9tuUod2rn1AO7tif5d7jal3Cfj61y3iqKY30yb3OzS9XQXH 9WZ2qDst11zvzQivxIkMGvfRXRfncNLWR4DrBSqVfSbYV2uQj2eS8C6ONwKVMXsQ 5tjNp91PFqN19sWQjIjSMcrNswxgpvdQ9mqFTyOGmISbqrpPSTi+MuO8r9+xTfUF PnzUX2nVOW/i9NcI7uotjzh8jiw6t8XMVHhkehiSYR9hzCb6MaPsFPN4jWq9XA2m 1htCHylNpHqHQ3Mup7Is6j0Li1ahdwfm4lbrgiVEA4t4Mqs5E/Ka+3V8laNAKylW PfCP/VmnJYzmgVTK/qobFNeKzRqR0i4WTL6T7oAxGL87Q4TJaqKpEkXWne8UXV+Q yIbN0fmWfCveCetM+vaf =F790 -----END PGP SIGNATURE----- Merge tag 'mfd-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6 Pull MFS update from Samuel Ortiz: "This is the MFD patch set for the 3.8 merge window. We have several new drivers, most of the time coming with their sub devices drivers: - Austria Microsystem's AS3711 - Nano River's viperboard - TI's TPS80031, AM335x TS/ADC, - Realtek's MMC/memstick card reader - Nokia's retu We also got some notable cleanups and improvements: - tps6586x got converted to IRQ domains. - tps65910 and tps65090 moved to the regmap IRQ API. - STMPE is now Device Tree aware. - A general twl6040 and twl-core cleanup, with moves to the regmap I/O and IRQ APIs and a conversion to the recently added PWM framework. - sta2x11 gained regmap support. Then the rest is mostly tiny cleanups and fixes, among which we have Mark's wm5xxx and wm8xxx patchset." Far amount of annoying but largely trivial conflicts. Many due to __devinit/exit removal, others due to one or two of the new drivers also having come in through another tree. * tag 'mfd-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (119 commits) mfd: tps6507x: Convert to devm_kzalloc mfd: stmpe: Update DT support for stmpe driver mfd: wm5102: Add readback of DSP status 3 register mfd: arizona: Log if we fail to create the primary IRQ domain mfd: tps80031: MFD_TPS80031 needs to select REGMAP_IRQ mfd: tps80031: Add terminating entry for tps80031_id_table mfd: sta2x11: Fix potential NULL pointer dereference in __sta2x11_mfd_mask() mfd: wm5102: Add tuning for revision B mfd: arizona: Defer patch initialistation until after first device boot mfd: tps65910: Fix wrong ack_base register mfd: tps65910: Remove unused data mfd: stmpe: Get rid of irq_invert_polarity mfd: ab8500-core: Fix invalid free of devm_ allocated data mfd: wm5102: Mark DSP memory regions as volatile mfd: wm5102: Correct default for LDO1_CONTROL_2 mfd: arizona: Register haptics devices mfd: wm8994: Make current device behaviour the default mfd: tps65090: MFD_TPS65090 needs to select REGMAP_IRQ mfd: Fix stmpe.c build when OF is not enabled mfd: jz4740-adc: Use devm_kzalloc ...
112 lines
2.6 KiB
C
112 lines
2.6 KiB
C
/*
|
|
* ST Microelectronics MFD: stmpe's i2c client specific driver
|
|
*
|
|
* Copyright (C) ST-Ericsson SA 2010
|
|
* Copyright (C) ST Microelectronics SA 2011
|
|
*
|
|
* License Terms: GNU General Public License, version 2
|
|
* Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
|
|
* Author: Viresh Kumar <viresh.linux@gmail.com> for ST Microelectronics
|
|
*/
|
|
|
|
#include <linux/i2c.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
#include <linux/types.h>
|
|
#include "stmpe.h"
|
|
|
|
static int i2c_reg_read(struct stmpe *stmpe, u8 reg)
|
|
{
|
|
struct i2c_client *i2c = stmpe->client;
|
|
|
|
return i2c_smbus_read_byte_data(i2c, reg);
|
|
}
|
|
|
|
static int i2c_reg_write(struct stmpe *stmpe, u8 reg, u8 val)
|
|
{
|
|
struct i2c_client *i2c = stmpe->client;
|
|
|
|
return i2c_smbus_write_byte_data(i2c, reg, val);
|
|
}
|
|
|
|
static int i2c_block_read(struct stmpe *stmpe, u8 reg, u8 length, u8 *values)
|
|
{
|
|
struct i2c_client *i2c = stmpe->client;
|
|
|
|
return i2c_smbus_read_i2c_block_data(i2c, reg, length, values);
|
|
}
|
|
|
|
static int i2c_block_write(struct stmpe *stmpe, u8 reg, u8 length,
|
|
const u8 *values)
|
|
{
|
|
struct i2c_client *i2c = stmpe->client;
|
|
|
|
return i2c_smbus_write_i2c_block_data(i2c, reg, length, values);
|
|
}
|
|
|
|
static struct stmpe_client_info i2c_ci = {
|
|
.read_byte = i2c_reg_read,
|
|
.write_byte = i2c_reg_write,
|
|
.read_block = i2c_block_read,
|
|
.write_block = i2c_block_write,
|
|
};
|
|
|
|
static int
|
|
stmpe_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
|
|
{
|
|
i2c_ci.data = (void *)id;
|
|
i2c_ci.irq = i2c->irq;
|
|
i2c_ci.client = i2c;
|
|
i2c_ci.dev = &i2c->dev;
|
|
|
|
return stmpe_probe(&i2c_ci, id->driver_data);
|
|
}
|
|
|
|
static int stmpe_i2c_remove(struct i2c_client *i2c)
|
|
{
|
|
struct stmpe *stmpe = dev_get_drvdata(&i2c->dev);
|
|
|
|
return stmpe_remove(stmpe);
|
|
}
|
|
|
|
static const struct i2c_device_id stmpe_i2c_id[] = {
|
|
{ "stmpe610", STMPE610 },
|
|
{ "stmpe801", STMPE801 },
|
|
{ "stmpe811", STMPE811 },
|
|
{ "stmpe1601", STMPE1601 },
|
|
{ "stmpe2401", STMPE2401 },
|
|
{ "stmpe2403", STMPE2403 },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(i2c, stmpe_id);
|
|
|
|
static struct i2c_driver stmpe_i2c_driver = {
|
|
.driver = {
|
|
.name = "stmpe-i2c",
|
|
.owner = THIS_MODULE,
|
|
#ifdef CONFIG_PM
|
|
.pm = &stmpe_dev_pm_ops,
|
|
#endif
|
|
},
|
|
.probe = stmpe_i2c_probe,
|
|
.remove = stmpe_i2c_remove,
|
|
.id_table = stmpe_i2c_id,
|
|
};
|
|
|
|
static int __init stmpe_init(void)
|
|
{
|
|
return i2c_add_driver(&stmpe_i2c_driver);
|
|
}
|
|
subsys_initcall(stmpe_init);
|
|
|
|
static void __exit stmpe_exit(void)
|
|
{
|
|
i2c_del_driver(&stmpe_i2c_driver);
|
|
}
|
|
module_exit(stmpe_exit);
|
|
|
|
MODULE_LICENSE("GPL v2");
|
|
MODULE_DESCRIPTION("STMPE MFD I2C Interface Driver");
|
|
MODULE_AUTHOR("Rabin Vincent <rabin.vincent@stericsson.com>");
|