mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-15 06:55:13 +08:00
fda8d26e61
Based on 1 normalized pattern(s): licensed under the gpl 2 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 135 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Reviewed-by: Steve Winslow <swinslow@gmail.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190528170026.071193225@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
68 lines
1.7 KiB
C
68 lines
1.7 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* STMicroelectronics uvis25 spi driver
|
|
*
|
|
* Copyright 2017 STMicroelectronics Inc.
|
|
*
|
|
* Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
#include <linux/spi/spi.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/regmap.h>
|
|
|
|
#include "st_uvis25.h"
|
|
|
|
#define UVIS25_SENSORS_SPI_READ BIT(7)
|
|
#define UVIS25_SPI_AUTO_INCREMENT BIT(6)
|
|
|
|
static const struct regmap_config st_uvis25_spi_regmap_config = {
|
|
.reg_bits = 8,
|
|
.val_bits = 8,
|
|
.read_flag_mask = UVIS25_SENSORS_SPI_READ | UVIS25_SPI_AUTO_INCREMENT,
|
|
.write_flag_mask = UVIS25_SPI_AUTO_INCREMENT,
|
|
};
|
|
|
|
static int st_uvis25_spi_probe(struct spi_device *spi)
|
|
{
|
|
struct regmap *regmap;
|
|
|
|
regmap = devm_regmap_init_spi(spi, &st_uvis25_spi_regmap_config);
|
|
if (IS_ERR(regmap)) {
|
|
dev_err(&spi->dev, "Failed to register spi regmap %d\n",
|
|
(int)PTR_ERR(regmap));
|
|
return PTR_ERR(regmap);
|
|
}
|
|
|
|
return st_uvis25_probe(&spi->dev, spi->irq, regmap);
|
|
}
|
|
|
|
static const struct of_device_id st_uvis25_spi_of_match[] = {
|
|
{ .compatible = "st,uvis25", },
|
|
{},
|
|
};
|
|
MODULE_DEVICE_TABLE(of, st_uvis25_spi_of_match);
|
|
|
|
static const struct spi_device_id st_uvis25_spi_id_table[] = {
|
|
{ ST_UVIS25_DEV_NAME },
|
|
{},
|
|
};
|
|
MODULE_DEVICE_TABLE(spi, st_uvis25_spi_id_table);
|
|
|
|
static struct spi_driver st_uvis25_driver = {
|
|
.driver = {
|
|
.name = "st_uvis25_spi",
|
|
.pm = &st_uvis25_pm_ops,
|
|
.of_match_table = of_match_ptr(st_uvis25_spi_of_match),
|
|
},
|
|
.probe = st_uvis25_spi_probe,
|
|
.id_table = st_uvis25_spi_id_table,
|
|
};
|
|
module_spi_driver(st_uvis25_driver);
|
|
|
|
MODULE_AUTHOR("Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>");
|
|
MODULE_DESCRIPTION("STMicroelectronics uvis25 spi driver");
|
|
MODULE_LICENSE("GPL v2");
|