mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-21 19:53:59 +08:00
a84ef0d181
Add support for Freescale MMA7455L/MMA7456L 3-axis in 10-bit mode for I2C and SPI bus. This rather simple driver that currently doesn't support all the hardware features of MMA7455L/MMA7456L. Tested on Embedded Artist's LPC4357 Dev Kit with MMA7455L on I2C bus. Data sheets for the two devices can be found here: http://cache.freescale.com/files/sensors/doc/data_sheet/MMA7455L.pdf http://cache.freescale.com/files/sensors/doc/data_sheet/MMA7456L.pdf Signed-off-by: Joachim Eastwood <manabian@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
53 lines
1.3 KiB
C
53 lines
1.3 KiB
C
/*
|
|
* IIO accel SPI driver for Freescale MMA7455L 3-axis 10-bit accelerometer
|
|
* Copyright 2015 Joachim Eastwood <manabian@gmail.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/regmap.h>
|
|
#include <linux/spi/spi.h>
|
|
|
|
#include "mma7455.h"
|
|
|
|
static int mma7455_spi_probe(struct spi_device *spi)
|
|
{
|
|
const struct spi_device_id *id = spi_get_device_id(spi);
|
|
struct regmap *regmap;
|
|
|
|
regmap = devm_regmap_init_spi(spi, &mma7455_core_regmap);
|
|
if (IS_ERR(regmap))
|
|
return PTR_ERR(regmap);
|
|
|
|
return mma7455_core_probe(&spi->dev, regmap, id->name);
|
|
}
|
|
|
|
static int mma7455_spi_remove(struct spi_device *spi)
|
|
{
|
|
return mma7455_core_remove(&spi->dev);
|
|
}
|
|
|
|
static const struct spi_device_id mma7455_spi_ids[] = {
|
|
{ "mma7455", 0 },
|
|
{ "mma7456", 0 },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(spi, mma7455_spi_ids);
|
|
|
|
static struct spi_driver mma7455_spi_driver = {
|
|
.probe = mma7455_spi_probe,
|
|
.remove = mma7455_spi_remove,
|
|
.id_table = mma7455_spi_ids,
|
|
.driver = {
|
|
.name = "mma7455-spi",
|
|
},
|
|
};
|
|
module_spi_driver(mma7455_spi_driver);
|
|
|
|
MODULE_AUTHOR("Joachim Eastwood <manabian@gmail.com>");
|
|
MODULE_DESCRIPTION("Freescale MMA7455L SPI accelerometer driver");
|
|
MODULE_LICENSE("GPL v2");
|