2019-12-20 16:00:50 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
/*
|
|
|
|
* I2C IIO driver for Bosch BMA400 triaxial acceleration sensor.
|
|
|
|
*
|
|
|
|
* Copyright 2019 Dan Robertson <dan@dlrobertson.com>
|
|
|
|
*
|
|
|
|
* I2C address is either 0x14 or 0x15 depending on SDO
|
|
|
|
*/
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
#include <linux/mod_devicetable.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/regmap.h>
|
|
|
|
|
|
|
|
#include "bma400.h"
|
|
|
|
|
2022-11-18 23:36:25 +01:00
|
|
|
static int bma400_i2c_probe(struct i2c_client *client)
|
2019-12-20 16:00:50 +00:00
|
|
|
{
|
2022-11-18 23:36:25 +01:00
|
|
|
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
2019-12-20 16:00:50 +00:00
|
|
|
struct regmap *regmap;
|
|
|
|
|
|
|
|
regmap = devm_regmap_init_i2c(client, &bma400_regmap_config);
|
|
|
|
if (IS_ERR(regmap)) {
|
|
|
|
dev_err(&client->dev, "failed to create regmap\n");
|
|
|
|
return PTR_ERR(regmap);
|
|
|
|
}
|
|
|
|
|
2022-05-05 19:00:15 +05:30
|
|
|
return bma400_probe(&client->dev, regmap, client->irq, id->name);
|
2019-12-20 16:00:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct i2c_device_id bma400_i2c_ids[] = {
|
2024-05-08 09:29:27 +02:00
|
|
|
{ "bma400" },
|
2019-12-20 16:00:50 +00:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(i2c, bma400_i2c_ids);
|
|
|
|
|
|
|
|
static const struct of_device_id bma400_of_i2c_match[] = {
|
|
|
|
{ .compatible = "bosch,bma400" },
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(of, bma400_of_i2c_match);
|
|
|
|
|
|
|
|
static struct i2c_driver bma400_i2c_driver = {
|
|
|
|
.driver = {
|
|
|
|
.name = "bma400",
|
|
|
|
.of_match_table = bma400_of_i2c_match,
|
|
|
|
},
|
2023-05-15 22:50:48 +02:00
|
|
|
.probe = bma400_i2c_probe,
|
2019-12-20 16:00:50 +00:00
|
|
|
.id_table = bma400_i2c_ids,
|
|
|
|
};
|
|
|
|
|
|
|
|
module_i2c_driver(bma400_i2c_driver);
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Dan Robertson <dan@dlrobertson.com>");
|
|
|
|
MODULE_DESCRIPTION("Bosch BMA400 triaxial acceleration sensor (I2C)");
|
|
|
|
MODULE_LICENSE("GPL");
|
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_BMA400");
|