2022-09-15 17:44:40 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
/*
|
|
|
|
* cs42l42-i2c.c -- CS42L42 ALSA SoC audio driver for I2C
|
|
|
|
*
|
|
|
|
* Copyright 2016, 2022 Cirrus Logic, Inc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/regmap.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
#include "cs42l42.h"
|
|
|
|
|
|
|
|
static int cs42l42_i2c_probe(struct i2c_client *i2c_client)
|
|
|
|
{
|
|
|
|
struct device *dev = &i2c_client->dev;
|
|
|
|
struct cs42l42_private *cs42l42;
|
|
|
|
struct regmap *regmap;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
cs42l42 = devm_kzalloc(dev, sizeof(*cs42l42), GFP_KERNEL);
|
|
|
|
if (!cs42l42)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
regmap = devm_regmap_init_i2c(i2c_client, &cs42l42_regmap);
|
2022-09-15 17:44:44 +08:00
|
|
|
if (IS_ERR(regmap))
|
|
|
|
return dev_err_probe(&i2c_client->dev, PTR_ERR(regmap),
|
|
|
|
"regmap_init() failed\n");
|
2022-09-15 17:44:40 +08:00
|
|
|
|
2022-09-15 17:44:42 +08:00
|
|
|
cs42l42->devid = CS42L42_CHIP_ID;
|
2022-09-15 17:44:40 +08:00
|
|
|
cs42l42->dev = dev;
|
|
|
|
cs42l42->regmap = regmap;
|
|
|
|
cs42l42->irq = i2c_client->irq;
|
|
|
|
|
|
|
|
ret = cs42l42_common_probe(cs42l42, &cs42l42_soc_component, &cs42l42_dai);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
return cs42l42_init(cs42l42);
|
|
|
|
}
|
|
|
|
|
sound updates for 6.1-rc1
Majority of changes at this PR are ASoC drivers (SOF, Intel, AMD,
Mediatek, Qualcomm, TI, Apple Silicon, etc), while we see a few
small fixes in ALSA / ASoC core side, too.
Here are highlights:
Core:
- A new string helper parse_int_array_user() and cleanups with it
- Continued cleanup of memory allocation helpers
- PCM core optimization and hardening
- Continued ASoC core code cleanups
ASoC:
- Improvements to the SOF IPC4 code, especially around trace
- Support for AMD Rembrant DSPs, AMD Pink Sardine ACP 6.2, Apple
Silicon systems, Everest ES8326, Intel Sky Lake and Kaby Lake,
Mediatek MT8186 support, NXP i.MX8ULP DSPs, Qualcomm SC8280XP,
SM8250 and SM8450 and Texas Instruments SRC4392
HD- and USB-audio:
- Cleanups for unification of hda-ext bus
- HD-audio HDMI codec driver cleanups
- Continued endpoint management fixes for USB-audio
- New quirks as usual
-----BEGIN PGP SIGNATURE-----
iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAmM9dF0OHHRpd2FpQHN1
c2UuZGUACgkQLtJE4w1nLE+ImA//bkD6zgXRwq05zl0UuoNqv1CsI3OeQ6YgIorc
Ca4ebCclS+uQiZo5Yw+qOSvxrEh25y0EG7bB5mKGW8bFFeThaXL1ZF+iVEabWi6G
bMXMtYPQb2fyHlS0Jv9axtCptd8YZVCVgft1CNflvC1cp7qt1FxkCzfEKFuBpNUI
OlU1ErWfY/u+iuxnXF+vUFjZQaN2BNztPLKjOMMv1eAE5MDfPMMP6GH7hvnEeNcZ
zaAfxsJnqHrJrx7o1k1rSEpAeQjHuFJbT9eDV1F7cI2ZH78x8/DrZoxre/BOptX5
+LYopxoVvldukwQQserXZS3g7R0Exbzp43vjmJA1lx/tEQCz4lrDZXXPW2kO7eWR
+v/sVHLrBFDom4Py6NNjytH/aPoC5YvZsMzu9Go8jaiJhKHKfIyyEy8CGfYOSuQv
E/zIHJNXy7rMVNl+o4BCljlDoYIZl9YhJ/BjcEL67nqJqZmTVzgeQ9BXuEWoL0IS
JyuRguBUnvYoFZ9tfYsFeWosSJSqW3ewDMYHV+cRAp3+sMmM4LixNgj1K/s72j3E
yyzEwwfUgnsy3g6L++OOwTay8fztMub7pFH8d0CGJdNVcdfuJB0yIQxaAyEYFjTP
XWDaz20g9ctAolj2WzauHPqsQX9aY2MH19oNX331xVNCcOK6tV10AYDSt3Vpqcey
oH7YASw=
=EWRA
-----END PGP SIGNATURE-----
Merge tag 'sound-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates from Takashi Iwai:
"The majority of changes are ASoC drivers (SOF, Intel, AMD, Mediatek,
Qualcomm, TI, Apple Silicon, etc), while we see a few small fixes in
ALSA / ASoC core side, too.
Here are highlights:
Core:
- A new string helper parse_int_array_user() and cleanups with it
- Continued cleanup of memory allocation helpers
- PCM core optimization and hardening
- Continued ASoC core code cleanups
ASoC:
- Improvements to the SOF IPC4 code, especially around trace
- Support for AMD Rembrant DSPs, AMD Pink Sardine ACP 6.2, Apple
Silicon systems, Everest ES8326, Intel Sky Lake and Kaby Lake,
Mediatek MT8186 support, NXP i.MX8ULP DSPs, Qualcomm SC8280XP,
SM8250 and SM8450 and Texas Instruments SRC4392
HD- and USB-audio:
- Cleanups for unification of hda-ext bus
- HD-audio HDMI codec driver cleanups
- Continued endpoint management fixes for USB-audio
- New quirks as usual"
* tag 'sound-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (422 commits)
ALSA: hda: Fix position reporting on Poulsbo
ALSA: hda/hdmi: Don't skip notification handling during PM operation
ASoC: rockchip: i2s: use regmap_read_poll_timeout_atomic to poll I2S_CLR
ASoC: dt-bindings: Document audio OF graph dai-tdm-slot-num dai-tdm-slot-width props
ASoC: qcom: fix unmet direct dependencies for SND_SOC_QDSP6
ALSA: usb-audio: Fix potential memory leaks
ALSA: usb-audio: Fix NULL dererence at error path
ASoC: mediatek: mt8192-mt6359: Set the driver name for the card
ALSA: hda/realtek: More robust component matching for CS35L41
ASoC: Intel: sof_rt5682: remove SOF_RT1015_SPEAKER_AMP_100FS flag
ASoC: nau8825: Add TDM support
ASoC: core: clarify the driver name initialization
ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe
ASoC: wm5102: Fix PM disable depth imbalance in wm5102_probe
ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe
ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe
ASoC: wcd-mbhc-v2: Revert "ASoC: wcd-mbhc-v2: use pm_runtime_resume_and_get()"
ASoC: mediatek: mt8186: Fix spelling mistake "slect" -> "select"
ALSA: hda/realtek: Add quirk for HP Zbook Firefly 14 G9 model
ALSA: asihpi - Remove unused struct hpi_subsys_response
...
2022-10-06 03:02:07 +08:00
|
|
|
static void cs42l42_i2c_remove(struct i2c_client *i2c_client)
|
2022-09-15 17:44:40 +08:00
|
|
|
{
|
|
|
|
struct cs42l42_private *cs42l42 = dev_get_drvdata(&i2c_client->dev);
|
|
|
|
|
|
|
|
cs42l42_common_remove(cs42l42);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int __maybe_unused cs42l42_i2c_resume(struct device *dev)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = cs42l42_resume(dev);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
cs42l42_resume_restore(dev);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct dev_pm_ops cs42l42_i2c_pm_ops = {
|
|
|
|
SET_SYSTEM_SLEEP_PM_OPS(cs42l42_suspend, cs42l42_i2c_resume)
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct of_device_id __maybe_unused cs42l42_of_match[] = {
|
|
|
|
{ .compatible = "cirrus,cs42l42", },
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(of, cs42l42_of_match);
|
|
|
|
|
|
|
|
static const struct acpi_device_id __maybe_unused cs42l42_acpi_match[] = {
|
|
|
|
{"10134242", 0,},
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(acpi, cs42l42_acpi_match);
|
|
|
|
|
|
|
|
static const struct i2c_device_id cs42l42_id[] = {
|
2024-05-02 15:47:20 +08:00
|
|
|
{"cs42l42"},
|
2022-09-15 17:44:40 +08:00
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
MODULE_DEVICE_TABLE(i2c, cs42l42_id);
|
|
|
|
|
|
|
|
static struct i2c_driver cs42l42_i2c_driver = {
|
|
|
|
.driver = {
|
|
|
|
.name = "cs42l42",
|
|
|
|
.pm = &cs42l42_i2c_pm_ops,
|
|
|
|
.of_match_table = of_match_ptr(cs42l42_of_match),
|
|
|
|
.acpi_match_table = ACPI_PTR(cs42l42_acpi_match),
|
|
|
|
},
|
|
|
|
.id_table = cs42l42_id,
|
2023-04-25 17:57:16 +08:00
|
|
|
.probe = cs42l42_i2c_probe,
|
2022-09-15 17:44:40 +08:00
|
|
|
.remove = cs42l42_i2c_remove,
|
|
|
|
};
|
|
|
|
|
|
|
|
module_i2c_driver(cs42l42_i2c_driver);
|
|
|
|
|
|
|
|
MODULE_DESCRIPTION("ASoC CS42L42 I2C driver");
|
|
|
|
MODULE_AUTHOR("Richard Fitzgerald <rf@opensource.cirrus.com>");
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_IMPORT_NS(SND_SOC_CS42L42_CORE);
|