1 // SPDX-License-Identifier: GPL-2.0-only
3 // CS35L56 HDA audio driver SPI binding
5 // Copyright (C) 2023 Cirrus Logic, Inc. and
6 // Cirrus Logic International Semiconductor Ltd.
8 #include <linux/module.h>
9 #include <linux/regmap.h>
10 #include <linux/spi/spi.h>
12 #include "cs35l56_hda.h"
14 static int cs35l56_hda_spi_probe(struct spi_device
*spi
)
16 const struct spi_device_id
*id
= spi_get_device_id(spi
);
17 struct cs35l56_hda
*cs35l56
;
20 cs35l56
= devm_kzalloc(&spi
->dev
, sizeof(*cs35l56
), GFP_KERNEL
);
24 cs35l56
->base
.dev
= &spi
->dev
;
26 #ifdef CS35L56_WAKE_HOLD_TIME_US
27 cs35l56
->base
.can_hibernate
= true;
29 cs35l56
->base
.regmap
= devm_regmap_init_spi(spi
, &cs35l56_regmap_spi
);
30 if (IS_ERR(cs35l56
->base
.regmap
)) {
31 ret
= PTR_ERR(cs35l56
->base
.regmap
);
32 dev_err(cs35l56
->base
.dev
, "Failed to allocate register map: %d\n",
37 ret
= cs35l56_hda_common_probe(cs35l56
, id
->driver_data
, spi_get_chipselect(spi
, 0));
40 ret
= cs35l56_irq_request(&cs35l56
->base
, spi
->irq
);
42 cs35l56_hda_remove(cs35l56
->base
.dev
);
47 static void cs35l56_hda_spi_remove(struct spi_device
*spi
)
49 cs35l56_hda_remove(&spi
->dev
);
52 static const struct spi_device_id cs35l56_hda_spi_id
[] = {
53 { "cs35l54-hda", 0x3554 },
54 { "cs35l56-hda", 0x3556 },
55 { "cs35l57-hda", 0x3557 },
59 static const struct acpi_device_id cs35l56_acpi_hda_match
[] = {
65 MODULE_DEVICE_TABLE(acpi
, cs35l56_acpi_hda_match
);
67 static struct spi_driver cs35l56_hda_spi_driver
= {
69 .name
= "cs35l56-hda",
70 .acpi_match_table
= cs35l56_acpi_hda_match
,
71 .pm
= &cs35l56_hda_pm_ops
,
73 .id_table
= cs35l56_hda_spi_id
,
74 .probe
= cs35l56_hda_spi_probe
,
75 .remove
= cs35l56_hda_spi_remove
,
77 module_spi_driver(cs35l56_hda_spi_driver
);
79 MODULE_DESCRIPTION("HDA CS35L56 SPI driver");
80 MODULE_IMPORT_NS("SND_HDA_SCODEC_CS35L56");
81 MODULE_IMPORT_NS("SND_SOC_CS35L56_SHARED");
82 MODULE_AUTHOR("Richard Fitzgerald <rf@opensource.cirrus.com>");
83 MODULE_AUTHOR("Simon Trimmer <simont@opensource.cirrus.com>");
84 MODULE_LICENSE("GPL");