2019-02-02 13:55:56 -08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2016-04-15 18:06:56 +03:00
|
|
|
/*
|
|
|
|
* BMI160 - Bosch IMU, SPI bits
|
|
|
|
*
|
|
|
|
* Copyright (c) 2016, Intel Corporation.
|
|
|
|
*
|
|
|
|
*/
|
2022-04-14 16:18:04 +03:00
|
|
|
#include <linux/mod_devicetable.h>
|
2016-04-15 18:06:56 +03:00
|
|
|
#include <linux/module.h>
|
2025-05-25 16:25:30 +02:00
|
|
|
#include <linux/pm.h>
|
2016-04-15 18:06:56 +03:00
|
|
|
#include <linux/regmap.h>
|
2016-12-08 15:22:55 +01:00
|
|
|
#include <linux/spi/spi.h>
|
2016-04-15 18:06:56 +03:00
|
|
|
|
|
|
|
#include "bmi160.h"
|
|
|
|
|
|
|
|
static int bmi160_spi_probe(struct spi_device *spi)
|
|
|
|
{
|
|
|
|
struct regmap *regmap;
|
|
|
|
const struct spi_device_id *id = spi_get_device_id(spi);
|
2022-04-14 16:18:04 +03:00
|
|
|
const char *name;
|
2016-04-15 18:06:56 +03:00
|
|
|
|
|
|
|
regmap = devm_regmap_init_spi(spi, &bmi160_regmap_config);
|
|
|
|
if (IS_ERR(regmap)) {
|
2020-03-22 22:53:10 +05:30
|
|
|
dev_err(&spi->dev, "Failed to register spi regmap: %pe\n",
|
|
|
|
regmap);
|
2016-04-15 18:06:56 +03:00
|
|
|
return PTR_ERR(regmap);
|
|
|
|
}
|
2022-04-14 16:18:04 +03:00
|
|
|
|
|
|
|
if (id)
|
|
|
|
name = id->name;
|
|
|
|
else
|
|
|
|
name = dev_name(&spi->dev);
|
|
|
|
|
|
|
|
return bmi160_core_probe(&spi->dev, regmap, name, true);
|
2016-04-15 18:06:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct spi_device_id bmi160_spi_id[] = {
|
2024-05-05 07:36:54 +02:00
|
|
|
{"bmi120", 0},
|
2016-04-15 18:06:56 +03:00
|
|
|
{"bmi160", 0},
|
2025-04-11 15:49:34 -05:00
|
|
|
{ }
|
2016-04-15 18:06:56 +03:00
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(spi, bmi160_spi_id);
|
|
|
|
|
|
|
|
static const struct acpi_device_id bmi160_acpi_match[] = {
|
2024-05-05 07:36:54 +02:00
|
|
|
{"BMI0120", 0},
|
2016-04-15 18:06:56 +03:00
|
|
|
{"BMI0160", 0},
|
2025-04-11 15:49:34 -05:00
|
|
|
{ }
|
2016-04-15 18:06:56 +03:00
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(acpi, bmi160_acpi_match);
|
|
|
|
|
2016-12-08 15:22:55 +01:00
|
|
|
static const struct of_device_id bmi160_of_match[] = {
|
2024-05-05 07:36:54 +02:00
|
|
|
{ .compatible = "bosch,bmi120" },
|
2016-12-08 15:22:55 +01:00
|
|
|
{ .compatible = "bosch,bmi160" },
|
2025-04-11 15:49:34 -05:00
|
|
|
{ }
|
2016-12-08 15:22:55 +01:00
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(of, bmi160_of_match);
|
|
|
|
|
2016-04-15 18:06:56 +03:00
|
|
|
static struct spi_driver bmi160_spi_driver = {
|
|
|
|
.probe = bmi160_spi_probe,
|
|
|
|
.id_table = bmi160_spi_id,
|
|
|
|
.driver = {
|
2022-04-14 16:18:04 +03:00
|
|
|
.acpi_match_table = bmi160_acpi_match,
|
|
|
|
.of_match_table = bmi160_of_match,
|
2016-12-08 15:22:55 +01:00
|
|
|
.name = "bmi160_spi",
|
2025-05-25 16:25:30 +02:00
|
|
|
.pm = pm_ptr(&bmi160_core_pm_ops),
|
2016-04-15 18:06:56 +03:00
|
|
|
},
|
|
|
|
};
|
|
|
|
module_spi_driver(bmi160_spi_driver);
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Daniel Baluta <daniel.baluta@intel.com");
|
|
|
|
MODULE_DESCRIPTION("Bosch BMI160 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_BMI160");
|