Path: blob/master/sound/hda/codecs/side-codecs/cs35l41_hda_i2c.c
26481 views
// SPDX-License-Identifier: GPL-2.01//2// CS35l41 HDA I2C 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/i2c.h>1112#include "cs35l41_hda.h"1314static int cs35l41_hda_i2c_probe(struct i2c_client *clt)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(&clt->dev), "CLSA0100"))23device_name = "CLSA0100";24else if (strstr(dev_name(&clt->dev), "CLSA0101"))25device_name = "CLSA0101";26else if (strstr(dev_name(&clt->dev), "CSC3551"))27device_name = "CSC3551";28else29return -ENODEV;3031return cs35l41_hda_probe(&clt->dev, device_name, clt->addr, clt->irq,32devm_regmap_init_i2c(clt, &cs35l41_regmap_i2c), I2C);33}3435static void cs35l41_hda_i2c_remove(struct i2c_client *clt)36{37cs35l41_hda_remove(&clt->dev);38}3940static const struct i2c_device_id cs35l41_hda_i2c_id[] = {41{ "cs35l41-hda" },42{}43};4445static const struct acpi_device_id cs35l41_acpi_hda_match[] = {46{"CLSA0100", 0 },47{"CLSA0101", 0 },48{"CSC3551", 0 },49{}50};51MODULE_DEVICE_TABLE(acpi, cs35l41_acpi_hda_match);5253static struct i2c_driver cs35l41_i2c_driver = {54.driver = {55.name = "cs35l41-hda",56.acpi_match_table = cs35l41_acpi_hda_match,57.pm = &cs35l41_hda_pm_ops,58},59.id_table = cs35l41_hda_i2c_id,60.probe = cs35l41_hda_i2c_probe,61.remove = cs35l41_hda_i2c_remove,62};63module_i2c_driver(cs35l41_i2c_driver);6465MODULE_DESCRIPTION("HDA CS35L41 driver");66MODULE_IMPORT_NS("SND_HDA_SCODEC_CS35L41");67MODULE_AUTHOR("Lucas Tanure <[email protected]>");68MODULE_LICENSE("GPL");697071