Linux Audio

Check our new training course

Loading...
v5.9
 1// SPDX-License-Identifier: GPL-2.0
 2/*
 3 * FXOS8700 - NXP IMU, SPI bits
 4 */
 5#include <linux/acpi.h>
 6#include <linux/module.h>
 7#include <linux/mod_devicetable.h>
 8#include <linux/regmap.h>
 9#include <linux/spi/spi.h>
10
11#include "fxos8700.h"
12
13static int fxos8700_spi_probe(struct spi_device *spi)
14{
15	struct regmap *regmap;
16	const struct spi_device_id *id = spi_get_device_id(spi);
17
18	regmap = devm_regmap_init_spi(spi, &fxos8700_regmap_config);
19	if (IS_ERR(regmap)) {
20		dev_err(&spi->dev, "Failed to register spi regmap %d\n",
21			(int)PTR_ERR(regmap));
22		return PTR_ERR(regmap);
23	}
24
25	return fxos8700_core_probe(&spi->dev, regmap, id->name, true);
26}
27
28static const struct spi_device_id fxos8700_spi_id[] = {
29	{"fxos8700", 0},
30	{ }
31};
32MODULE_DEVICE_TABLE(spi, fxos8700_spi_id);
33
34static const struct acpi_device_id fxos8700_acpi_match[] = {
35	{"FXOS8700", 0},
36	{ }
37};
38MODULE_DEVICE_TABLE(acpi, fxos8700_acpi_match);
39
40static const struct of_device_id fxos8700_of_match[] = {
41	{ .compatible = "nxp,fxos8700" },
42	{ }
43};
44MODULE_DEVICE_TABLE(of, fxos8700_of_match);
45
46static struct spi_driver fxos8700_spi_driver = {
47	.probe          = fxos8700_spi_probe,
48	.id_table       = fxos8700_spi_id,
49	.driver = {
50		.acpi_match_table       = ACPI_PTR(fxos8700_acpi_match),
51		.of_match_table         = fxos8700_of_match,
52		.name                   = "fxos8700_spi",
53	},
54};
55module_spi_driver(fxos8700_spi_driver);
56
57MODULE_AUTHOR("Robert Jones <rjones@gateworks.com>");
58MODULE_DESCRIPTION("FXOS8700 SPI driver");
59MODULE_LICENSE("GPL v2");
v6.9.4
 1// SPDX-License-Identifier: GPL-2.0
 2/*
 3 * FXOS8700 - NXP IMU, SPI bits
 4 */
 
 5#include <linux/module.h>
 6#include <linux/mod_devicetable.h>
 7#include <linux/regmap.h>
 8#include <linux/spi/spi.h>
 9
10#include "fxos8700.h"
11
12static int fxos8700_spi_probe(struct spi_device *spi)
13{
14	struct regmap *regmap;
15	const struct spi_device_id *id = spi_get_device_id(spi);
16
17	regmap = devm_regmap_init_spi(spi, &fxos8700_regmap_config);
18	if (IS_ERR(regmap)) {
19		dev_err(&spi->dev, "Failed to register spi regmap %ld\n", PTR_ERR(regmap));
 
20		return PTR_ERR(regmap);
21	}
22
23	return fxos8700_core_probe(&spi->dev, regmap, id->name, true);
24}
25
26static const struct spi_device_id fxos8700_spi_id[] = {
27	{"fxos8700", 0},
28	{ }
29};
30MODULE_DEVICE_TABLE(spi, fxos8700_spi_id);
31
32static const struct acpi_device_id fxos8700_acpi_match[] = {
33	{"FXOS8700", 0},
34	{ }
35};
36MODULE_DEVICE_TABLE(acpi, fxos8700_acpi_match);
37
38static const struct of_device_id fxos8700_of_match[] = {
39	{ .compatible = "nxp,fxos8700" },
40	{ }
41};
42MODULE_DEVICE_TABLE(of, fxos8700_of_match);
43
44static struct spi_driver fxos8700_spi_driver = {
45	.probe          = fxos8700_spi_probe,
46	.id_table       = fxos8700_spi_id,
47	.driver = {
48		.acpi_match_table       = fxos8700_acpi_match,
49		.of_match_table         = fxos8700_of_match,
50		.name                   = "fxos8700_spi",
51	},
52};
53module_spi_driver(fxos8700_spi_driver);
54
55MODULE_AUTHOR("Robert Jones <rjones@gateworks.com>");
56MODULE_DESCRIPTION("FXOS8700 SPI driver");
57MODULE_LICENSE("GPL v2");