mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-24 02:07:10 +07:00
36edc93958
Based on 1 normalized pattern(s): this file is subject to the terms and conditions of version 2 of the gnu general public license see the file copying in the main directory of this archive for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 55 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190530000436.108941081@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
65 lines
1.5 KiB
C
65 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Freescale MPL115A2 pressure/temperature sensor
|
|
*
|
|
* Copyright (c) 2014 Peter Meerwald <pmeerw@pmeerw.net>
|
|
*
|
|
* (7-bit I2C slave address 0x60)
|
|
*
|
|
* Datasheet: http://www.nxp.com/files/sensors/doc/data_sheet/MPL115A2.pdf
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/i2c.h>
|
|
|
|
#include "mpl115.h"
|
|
|
|
static int mpl115_i2c_init(struct device *dev)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static int mpl115_i2c_read(struct device *dev, u8 address)
|
|
{
|
|
return i2c_smbus_read_word_swapped(to_i2c_client(dev), address);
|
|
}
|
|
|
|
static int mpl115_i2c_write(struct device *dev, u8 address, u8 value)
|
|
{
|
|
return i2c_smbus_write_byte_data(to_i2c_client(dev), address, value);
|
|
}
|
|
|
|
static const struct mpl115_ops mpl115_i2c_ops = {
|
|
.init = mpl115_i2c_init,
|
|
.read = mpl115_i2c_read,
|
|
.write = mpl115_i2c_write,
|
|
};
|
|
|
|
static int mpl115_i2c_probe(struct i2c_client *client,
|
|
const struct i2c_device_id *id)
|
|
{
|
|
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA))
|
|
return -EOPNOTSUPP;
|
|
|
|
return mpl115_probe(&client->dev, id->name, &mpl115_i2c_ops);
|
|
}
|
|
|
|
static const struct i2c_device_id mpl115_i2c_id[] = {
|
|
{ "mpl115", 0 },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(i2c, mpl115_i2c_id);
|
|
|
|
static struct i2c_driver mpl115_i2c_driver = {
|
|
.driver = {
|
|
.name = "mpl115",
|
|
},
|
|
.probe = mpl115_i2c_probe,
|
|
.id_table = mpl115_i2c_id,
|
|
};
|
|
module_i2c_driver(mpl115_i2c_driver);
|
|
|
|
MODULE_AUTHOR("Peter Meerwald <pmeerw@pmeerw.net>");
|
|
MODULE_DESCRIPTION("Freescale MPL115A2 pressure/temperature driver");
|
|
MODULE_LICENSE("GPL");
|