aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/sound/alc5623.txt25
-rw-r--r--sound/soc/codecs/Kconfig2
-rw-r--r--sound/soc/codecs/alc5623.c20
3 files changed, 46 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/sound/alc5623.txt b/Documentation/devicetree/bindings/sound/alc5623.txt
new file mode 100644
index 000000000000..26c86c98d671
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/alc5623.txt
@@ -0,0 +1,25 @@
1ALC5621/ALC5622/ALC5623 audio Codec
2
3Required properties:
4
5 - compatible: "realtek,alc5623"
6 - reg: the I2C address of the device.
7
8Optional properties:
9
10 - add-ctrl: Default register value for Reg-40h, Additional Control
11 Register. If absent or has the value of 0, the
12 register is untouched.
13
14 - jack-det-ctrl: Default register value for Reg-5Ah, Jack Detect
15 Control Register. If absent or has value 0, the
16 register is untouched.
17
18Example:
19
20 alc5621: alc5621@1a {
21 compatible = "alc5621";
22 reg = <0x1a>;
23 add-ctrl = <0x3700>;
24 jack-det-ctrl = <0x4810>;
25 };
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index f0e840137887..5fefaa8c50ef 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -269,7 +269,7 @@ config SND_SOC_AK5386
269 tristate "AKM AK5638 CODEC" 269 tristate "AKM AK5638 CODEC"
270 270
271config SND_SOC_ALC5623 271config SND_SOC_ALC5623
272 tristate 272 tristate "Realtek ALC5623 CODEC"
273 273
274config SND_SOC_ALC5632 274config SND_SOC_ALC5632
275 tristate 275 tristate
diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c
index f500905e9373..50a4825c8e4b 100644
--- a/sound/soc/codecs/alc5623.c
+++ b/sound/soc/codecs/alc5623.c
@@ -23,6 +23,7 @@
23#include <linux/i2c.h> 23#include <linux/i2c.h>
24#include <linux/regmap.h> 24#include <linux/regmap.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/of.h>
26#include <sound/core.h> 27#include <sound/core.h>
27#include <sound/pcm.h> 28#include <sound/pcm.h>
28#include <sound/pcm_params.h> 29#include <sound/pcm_params.h>
@@ -998,8 +999,10 @@ static int alc5623_i2c_probe(struct i2c_client *client,
998{ 999{
999 struct alc5623_platform_data *pdata; 1000 struct alc5623_platform_data *pdata;
1000 struct alc5623_priv *alc5623; 1001 struct alc5623_priv *alc5623;
1002 struct device_node *np;
1001 unsigned int vid1, vid2; 1003 unsigned int vid1, vid2;
1002 int ret; 1004 int ret;
1005 u32 val32;
1003 1006
1004 alc5623 = devm_kzalloc(&client->dev, sizeof(struct alc5623_priv), 1007 alc5623 = devm_kzalloc(&client->dev, sizeof(struct alc5623_priv),
1005 GFP_KERNEL); 1008 GFP_KERNEL);
@@ -1040,6 +1043,16 @@ static int alc5623_i2c_probe(struct i2c_client *client,
1040 if (pdata) { 1043 if (pdata) {
1041 alc5623->add_ctrl = pdata->add_ctrl; 1044 alc5623->add_ctrl = pdata->add_ctrl;
1042 alc5623->jack_det_ctrl = pdata->jack_det_ctrl; 1045 alc5623->jack_det_ctrl = pdata->jack_det_ctrl;
1046 } else {
1047 if (client->dev.of_node) {
1048 np = client->dev.of_node;
1049 ret = of_property_read_u32(np, "add-ctrl", &val32);
1050 if (!ret)
1051 alc5623->add_ctrl = val32;
1052 ret = of_property_read_u32(np, "jack-det-ctrl", &val32);
1053 if (!ret)
1054 alc5623->jack_det_ctrl = val32;
1055 }
1043 } 1056 }
1044 1057
1045 alc5623->id = vid2; 1058 alc5623->id = vid2;
@@ -1081,11 +1094,18 @@ static const struct i2c_device_id alc5623_i2c_table[] = {
1081}; 1094};
1082MODULE_DEVICE_TABLE(i2c, alc5623_i2c_table); 1095MODULE_DEVICE_TABLE(i2c, alc5623_i2c_table);
1083 1096
1097static const struct of_device_id alc5623_of_match[] = {
1098 { .compatible = "realtek,alc5623", },
1099 { }
1100};
1101MODULE_DEVICE_TABLE(of, alc5623_of_match);
1102
1084/* i2c codec control layer */ 1103/* i2c codec control layer */
1085static struct i2c_driver alc5623_i2c_driver = { 1104static struct i2c_driver alc5623_i2c_driver = {
1086 .driver = { 1105 .driver = {
1087 .name = "alc562x-codec", 1106 .name = "alc562x-codec",
1088 .owner = THIS_MODULE, 1107 .owner = THIS_MODULE,
1108 .of_match_table = of_match_ptr(alc5623_of_match),
1089 }, 1109 },
1090 .probe = alc5623_i2c_probe, 1110 .probe = alc5623_i2c_probe,
1091 .remove = alc5623_i2c_remove, 1111 .remove = alc5623_i2c_remove,