mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-20 11:13:58 +08:00
ASoC: alc5623: Add device tree binding
Let the ALC5623 codec be instantiated from DT. Add a simple binding for the additional control register and the jack detect register. Also, add a prompt to the Kconfig entry for this CODEC, so that it can be selected. Since kirkwood-t5325.c will no longer be used, we need to be able to enable the CODEC in the mvebu_v5_defconfig etc. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Acked-by: Jason Cooper <jason@lakedaemon.net> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
c9eaa447e7
commit
7d6d478f38
25
Documentation/devicetree/bindings/sound/alc5623.txt
Normal file
25
Documentation/devicetree/bindings/sound/alc5623.txt
Normal file
@ -0,0 +1,25 @@
|
||||
ALC5621/ALC5622/ALC5623 audio Codec
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible: "realtek,alc5623"
|
||||
- reg: the I2C address of the device.
|
||||
|
||||
Optional properties:
|
||||
|
||||
- add-ctrl: Default register value for Reg-40h, Additional Control
|
||||
Register. If absent or has the value of 0, the
|
||||
register is untouched.
|
||||
|
||||
- jack-det-ctrl: Default register value for Reg-5Ah, Jack Detect
|
||||
Control Register. If absent or has value 0, the
|
||||
register is untouched.
|
||||
|
||||
Example:
|
||||
|
||||
alc5621: alc5621@1a {
|
||||
compatible = "alc5621";
|
||||
reg = <0x1a>;
|
||||
add-ctrl = <0x3700>;
|
||||
jack-det-ctrl = <0x4810>;
|
||||
};
|
@ -269,7 +269,7 @@ config SND_SOC_AK5386
|
||||
tristate "AKM AK5638 CODEC"
|
||||
|
||||
config SND_SOC_ALC5623
|
||||
tristate
|
||||
tristate "Realtek ALC5623 CODEC"
|
||||
|
||||
config SND_SOC_ALC5632
|
||||
tristate
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/of.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/pcm_params.h>
|
||||
@ -998,8 +999,10 @@ static int alc5623_i2c_probe(struct i2c_client *client,
|
||||
{
|
||||
struct alc5623_platform_data *pdata;
|
||||
struct alc5623_priv *alc5623;
|
||||
struct device_node *np;
|
||||
unsigned int vid1, vid2;
|
||||
int ret;
|
||||
u32 val32;
|
||||
|
||||
alc5623 = devm_kzalloc(&client->dev, sizeof(struct alc5623_priv),
|
||||
GFP_KERNEL);
|
||||
@ -1040,6 +1043,16 @@ static int alc5623_i2c_probe(struct i2c_client *client,
|
||||
if (pdata) {
|
||||
alc5623->add_ctrl = pdata->add_ctrl;
|
||||
alc5623->jack_det_ctrl = pdata->jack_det_ctrl;
|
||||
} else {
|
||||
if (client->dev.of_node) {
|
||||
np = client->dev.of_node;
|
||||
ret = of_property_read_u32(np, "add-ctrl", &val32);
|
||||
if (!ret)
|
||||
alc5623->add_ctrl = val32;
|
||||
ret = of_property_read_u32(np, "jack-det-ctrl", &val32);
|
||||
if (!ret)
|
||||
alc5623->jack_det_ctrl = val32;
|
||||
}
|
||||
}
|
||||
|
||||
alc5623->id = vid2;
|
||||
@ -1081,11 +1094,18 @@ static const struct i2c_device_id alc5623_i2c_table[] = {
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, alc5623_i2c_table);
|
||||
|
||||
static const struct of_device_id alc5623_of_match[] = {
|
||||
{ .compatible = "realtek,alc5623", },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, alc5623_of_match);
|
||||
|
||||
/* i2c codec control layer */
|
||||
static struct i2c_driver alc5623_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "alc562x-codec",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = of_match_ptr(alc5623_of_match),
|
||||
},
|
||||
.probe = alc5623_i2c_probe,
|
||||
.remove = alc5623_i2c_remove,
|
||||
|
Loading…
Reference in New Issue
Block a user