x86/speculation/mds: Fix documentation typo
[linux/fpc-iii.git] / drivers / iio / pressure / mpl115_i2c.c
blob1a29be462f6e15c2c01819d6503ee9f7c9da3113
1 /*
2 * Freescale MPL115A2 pressure/temperature sensor
4 * Copyright (c) 2014 Peter Meerwald <pmeerw@pmeerw.net>
6 * This file is subject to the terms and conditions of version 2 of
7 * the GNU General Public License. See the file COPYING in the main
8 * directory of this archive for more details.
10 * (7-bit I2C slave address 0x60)
12 * Datasheet: http://www.nxp.com/files/sensors/doc/data_sheet/MPL115A2.pdf
15 #include <linux/module.h>
16 #include <linux/i2c.h>
18 #include "mpl115.h"
20 static int mpl115_i2c_init(struct device *dev)
22 return 0;
25 static int mpl115_i2c_read(struct device *dev, u8 address)
27 return i2c_smbus_read_word_swapped(to_i2c_client(dev), address);
30 static int mpl115_i2c_write(struct device *dev, u8 address, u8 value)
32 return i2c_smbus_write_byte_data(to_i2c_client(dev), address, value);
35 static const struct mpl115_ops mpl115_i2c_ops = {
36 .init = mpl115_i2c_init,
37 .read = mpl115_i2c_read,
38 .write = mpl115_i2c_write,
41 static int mpl115_i2c_probe(struct i2c_client *client,
42 const struct i2c_device_id *id)
44 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA))
45 return -EOPNOTSUPP;
47 return mpl115_probe(&client->dev, id->name, &mpl115_i2c_ops);
50 static const struct i2c_device_id mpl115_i2c_id[] = {
51 { "mpl115", 0 },
52 { }
54 MODULE_DEVICE_TABLE(i2c, mpl115_i2c_id);
56 static struct i2c_driver mpl115_i2c_driver = {
57 .driver = {
58 .name = "mpl115",
60 .probe = mpl115_i2c_probe,
61 .id_table = mpl115_i2c_id,
63 module_i2c_driver(mpl115_i2c_driver);
65 MODULE_AUTHOR("Peter Meerwald <pmeerw@pmeerw.net>");
66 MODULE_DESCRIPTION("Freescale MPL115A2 pressure/temperature driver");
67 MODULE_LICENSE("GPL");