Path: blob/master/sound/hda/codecs/side-codecs/cs35l41_hda_spi.c
26481 views
// SPDX-License-Identifier: GPL-2.01//2// CS35l41 HDA SPI driver3//4// Copyright 2021 Cirrus Logic, Inc.5//6// Author: Lucas Tanure <[email protected]>78#include <linux/mod_devicetable.h>9#include <linux/module.h>10#include <linux/spi/spi.h>1112#include "cs35l41_hda.h"1314static int cs35l41_hda_spi_probe(struct spi_device *spi)15{16const char *device_name;1718/*19* Compare against the device name so it works for SPI, normal ACPI20* and for ACPI by serial-multi-instantiate matching cases.21*/22if (strstr(dev_name(&spi->dev), "CSC3551"))23device_name = "CSC3551";24else25return -ENODEV;2627return cs35l41_hda_probe(&spi->dev, device_name, spi_get_chipselect(spi, 0), spi->irq,28devm_regmap_init_spi(spi, &cs35l41_regmap_spi), SPI);29}3031static void cs35l41_hda_spi_remove(struct spi_device *spi)32{33cs35l41_hda_remove(&spi->dev);34}3536static const struct spi_device_id cs35l41_hda_spi_id[] = {37{ "cs35l41-hda", 0 },38{}39};40MODULE_DEVICE_TABLE(spi, cs35l41_hda_spi_id);4142static const struct acpi_device_id cs35l41_acpi_hda_match[] = {43{ "CSC3551", 0 },44{}45};46MODULE_DEVICE_TABLE(acpi, cs35l41_acpi_hda_match);4748static struct spi_driver cs35l41_spi_driver = {49.driver = {50.name = "cs35l41-hda",51.acpi_match_table = cs35l41_acpi_hda_match,52.pm = &cs35l41_hda_pm_ops,53},54.id_table = cs35l41_hda_spi_id,55.probe = cs35l41_hda_spi_probe,56.remove = cs35l41_hda_spi_remove,57};58module_spi_driver(cs35l41_spi_driver);5960MODULE_DESCRIPTION("HDA CS35L41 driver");61MODULE_IMPORT_NS("SND_HDA_SCODEC_CS35L41");62MODULE_AUTHOR("Lucas Tanure <[email protected]>");63MODULE_LICENSE("GPL");646566