2019-05-28 09:57:06 -07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2016-10-13 22:06:04 +02:00
|
|
|
/*
|
|
|
|
* STMicroelectronics hts221 spi driver
|
|
|
|
*
|
|
|
|
* Copyright 2016 STMicroelectronics Inc.
|
|
|
|
*
|
|
|
|
* Lorenzo Bianconi <lorenzo.bianconi@st.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/spi/spi.h>
|
|
|
|
#include <linux/slab.h>
|
2018-01-08 23:12:30 +01:00
|
|
|
#include <linux/regmap.h>
|
2016-10-13 22:06:04 +02:00
|
|
|
|
2018-01-08 23:12:30 +01:00
|
|
|
#include "hts221.h"
|
2016-10-13 22:06:04 +02:00
|
|
|
|
2018-01-08 23:12:30 +01:00
|
|
|
#define HTS221_SPI_READ BIT(7)
|
|
|
|
#define HTS221_SPI_AUTO_INCREMENT BIT(6)
|
2016-10-13 22:06:04 +02:00
|
|
|
|
2018-01-08 23:12:30 +01:00
|
|
|
static const struct regmap_config hts221_spi_regmap_config = {
|
|
|
|
.reg_bits = 8,
|
|
|
|
.val_bits = 8,
|
|
|
|
.write_flag_mask = HTS221_SPI_AUTO_INCREMENT,
|
|
|
|
.read_flag_mask = HTS221_SPI_READ | HTS221_SPI_AUTO_INCREMENT,
|
2016-10-13 22:06:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static int hts221_spi_probe(struct spi_device *spi)
|
|
|
|
{
|
2018-01-08 23:12:30 +01:00
|
|
|
struct regmap *regmap;
|
|
|
|
|
|
|
|
regmap = devm_regmap_init_spi(spi, &hts221_spi_regmap_config);
|
|
|
|
if (IS_ERR(regmap)) {
|
2020-03-13 12:49:55 +02:00
|
|
|
dev_err(&spi->dev, "Failed to register spi regmap %ld\n",
|
|
|
|
PTR_ERR(regmap));
|
2018-01-08 23:12:30 +01:00
|
|
|
return PTR_ERR(regmap);
|
|
|
|
}
|
|
|
|
|
2017-12-30 00:33:04 +01:00
|
|
|
return hts221_probe(&spi->dev, spi->irq,
|
2018-01-08 23:12:30 +01:00
|
|
|
spi->modalias, regmap);
|
2016-10-13 22:06:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct of_device_id hts221_spi_of_match[] = {
|
|
|
|
{ .compatible = "st,hts221", },
|
2025-04-11 15:49:34 -05:00
|
|
|
{ }
|
2016-10-13 22:06:04 +02:00
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(of, hts221_spi_of_match);
|
|
|
|
|
|
|
|
static const struct spi_device_id hts221_spi_id_table[] = {
|
|
|
|
{ HTS221_DEV_NAME },
|
2025-04-11 15:49:34 -05:00
|
|
|
{ }
|
2016-10-13 22:06:04 +02:00
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(spi, hts221_spi_id_table);
|
|
|
|
|
|
|
|
static struct spi_driver hts221_driver = {
|
|
|
|
.driver = {
|
|
|
|
.name = "hts221_spi",
|
2022-06-04 17:12:20 +01:00
|
|
|
.pm = pm_sleep_ptr(&hts221_pm_ops),
|
2020-03-13 12:49:54 +02:00
|
|
|
.of_match_table = hts221_spi_of_match,
|
2016-10-13 22:06:04 +02:00
|
|
|
},
|
|
|
|
.probe = hts221_spi_probe,
|
|
|
|
.id_table = hts221_spi_id_table,
|
|
|
|
};
|
|
|
|
module_spi_driver(hts221_driver);
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Lorenzo Bianconi <lorenzo.bianconi@st.com>");
|
|
|
|
MODULE_DESCRIPTION("STMicroelectronics hts221 spi driver");
|
|
|
|
MODULE_LICENSE("GPL v2");
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 15:59:47 +01:00
|
|
|
MODULE_IMPORT_NS("IIO_HTS221");
|