Path: blob/master/sound/hda/codecs/side-codecs/cs35l56_hda_spi.c
29268 views
// SPDX-License-Identifier: GPL-2.0-only1//2// CS35L56 HDA audio driver SPI binding3//4// Copyright (C) 2023 Cirrus Logic, Inc. and5// Cirrus Logic International Semiconductor Ltd.67#include <linux/module.h>8#include <linux/regmap.h>9#include <linux/spi/spi.h>1011#include "cs35l56_hda.h"1213static int cs35l56_hda_spi_probe(struct spi_device *spi)14{15const struct spi_device_id *id = spi_get_device_id(spi);16struct cs35l56_hda *cs35l56;17int ret;1819cs35l56 = devm_kzalloc(&spi->dev, sizeof(*cs35l56), GFP_KERNEL);20if (!cs35l56)21return -ENOMEM;2223cs35l56->base.dev = &spi->dev;24ret = cs35l56_init_config_for_spi(&cs35l56->base, spi);25if (ret)26return ret;2728#ifdef CS35L56_WAKE_HOLD_TIME_US29cs35l56->base.can_hibernate = true;30#endif3132cs35l56->base.regmap = devm_regmap_init_spi(spi, &cs35l56_regmap_spi);33if (IS_ERR(cs35l56->base.regmap)) {34ret = PTR_ERR(cs35l56->base.regmap);35dev_err(cs35l56->base.dev, "Failed to allocate register map: %d\n",36ret);37return ret;38}3940ret = cs35l56_hda_common_probe(cs35l56, id->driver_data, spi_get_chipselect(spi, 0));41if (ret)42return ret;43ret = cs35l56_irq_request(&cs35l56->base, spi->irq);44if (ret < 0)45cs35l56_hda_remove(cs35l56->base.dev);4647return ret;48}4950static void cs35l56_hda_spi_remove(struct spi_device *spi)51{52cs35l56_hda_remove(&spi->dev);53}5455static const struct spi_device_id cs35l56_hda_spi_id[] = {56{ "cs35l54-hda", 0x3554 },57{ "cs35l56-hda", 0x3556 },58{ "cs35l57-hda", 0x3557 },59{}60};6162static const struct acpi_device_id cs35l56_acpi_hda_match[] = {63{ "CSC3554", 0 },64{ "CSC3556", 0 },65{ "CSC3557", 0 },66{}67};68MODULE_DEVICE_TABLE(acpi, cs35l56_acpi_hda_match);6970static struct spi_driver cs35l56_hda_spi_driver = {71.driver = {72.name = "cs35l56-hda",73.acpi_match_table = cs35l56_acpi_hda_match,74.pm = &cs35l56_hda_pm_ops,75},76.id_table = cs35l56_hda_spi_id,77.probe = cs35l56_hda_spi_probe,78.remove = cs35l56_hda_spi_remove,79};80module_spi_driver(cs35l56_hda_spi_driver);8182MODULE_DESCRIPTION("HDA CS35L56 SPI driver");83MODULE_IMPORT_NS("SND_HDA_SCODEC_CS35L56");84MODULE_IMPORT_NS("SND_SOC_CS35L56_SHARED");85MODULE_AUTHOR("Richard Fitzgerald <[email protected]>");86MODULE_AUTHOR("Simon Trimmer <[email protected]>");87MODULE_LICENSE("GPL");888990