1 // SPDX-License-Identifier: GPL-2.0
3 * CS40L50 Advanced Haptic Driver with waveform memory,
4 * integrated DSP, and closed-loop algorithms
6 * Copyright 2024 Cirrus Logic, Inc.
8 * Author: James Ogletree <james.ogletree@cirrus.com>
11 #include <linux/mfd/cs40l50.h>
12 #include <linux/spi/spi.h>
14 static int cs40l50_spi_probe(struct spi_device
*spi
)
16 struct cs40l50
*cs40l50
;
18 cs40l50
= devm_kzalloc(&spi
->dev
, sizeof(*cs40l50
), GFP_KERNEL
);
22 spi_set_drvdata(spi
, cs40l50
);
24 cs40l50
->dev
= &spi
->dev
;
25 cs40l50
->irq
= spi
->irq
;
27 cs40l50
->regmap
= devm_regmap_init_spi(spi
, &cs40l50_regmap
);
28 if (IS_ERR(cs40l50
->regmap
))
29 return dev_err_probe(cs40l50
->dev
, PTR_ERR(cs40l50
->regmap
),
30 "Failed to initialize register map\n");
32 return cs40l50_probe(cs40l50
);
35 static void cs40l50_spi_remove(struct spi_device
*spi
)
37 struct cs40l50
*cs40l50
= spi_get_drvdata(spi
);
39 cs40l50_remove(cs40l50
);
42 static const struct spi_device_id cs40l50_id_spi
[] = {
46 MODULE_DEVICE_TABLE(spi
, cs40l50_id_spi
);
48 static const struct of_device_id cs40l50_of_match
[] = {
49 { .compatible
= "cirrus,cs40l50" },
52 MODULE_DEVICE_TABLE(of
, cs40l50_of_match
);
54 static struct spi_driver cs40l50_spi_driver
= {
57 .of_match_table
= cs40l50_of_match
,
58 .pm
= pm_ptr(&cs40l50_pm_ops
),
60 .id_table
= cs40l50_id_spi
,
61 .probe
= cs40l50_spi_probe
,
62 .remove
= cs40l50_spi_remove
,
64 module_spi_driver(cs40l50_spi_driver
);
66 MODULE_DESCRIPTION("CS40L50 SPI Driver");
67 MODULE_AUTHOR("James Ogletree, Cirrus Logic Inc. <james.ogletree@cirrus.com>");
68 MODULE_LICENSE("GPL");