mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
ASoC: cs42l73: Add Device Tree support for CS42L73
This patch adds support for device tree for the CS42L73 CODEC Signed-off-by: Brian Austin <brian.austin@cirrus.com> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
f9ca060680
commit
7b09eea529
2 changed files with 49 additions and 2 deletions
22
Documentation/devicetree/bindings/sound/cs42l73.txt
Normal file
22
Documentation/devicetree/bindings/sound/cs42l73.txt
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
CS42L73 audio CODEC
|
||||||
|
|
||||||
|
Required properties:
|
||||||
|
|
||||||
|
- compatible : "cirrus,cs42l73"
|
||||||
|
|
||||||
|
- reg : the I2C address of the device for I2C
|
||||||
|
|
||||||
|
Optional properties:
|
||||||
|
|
||||||
|
- reset_gpio : a GPIO spec for the reset pin.
|
||||||
|
- chgfreq : Charge Pump Frequency values 0x00-0x0F
|
||||||
|
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
codec: cs42l73@4a {
|
||||||
|
compatible = "cirrus,cs42l73";
|
||||||
|
reg = <0x4a>;
|
||||||
|
reset_gpio = <&gpio 10 0>;
|
||||||
|
chgfreq = <0x05>;
|
||||||
|
};
|
|
@ -17,7 +17,7 @@
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/gpio.h>
|
#include <linux/of_gpio.h>
|
||||||
#include <linux/pm.h>
|
#include <linux/pm.h>
|
||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
|
@ -1416,6 +1416,7 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client,
|
||||||
int ret;
|
int ret;
|
||||||
unsigned int devid = 0;
|
unsigned int devid = 0;
|
||||||
unsigned int reg;
|
unsigned int reg;
|
||||||
|
u32 val32;
|
||||||
|
|
||||||
cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l73_private),
|
cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l73_private),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
@ -1431,8 +1432,25 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pdata)
|
if (pdata) {
|
||||||
cs42l73->pdata = *pdata;
|
cs42l73->pdata = *pdata;
|
||||||
|
} else {
|
||||||
|
pdata = devm_kzalloc(&i2c_client->dev,
|
||||||
|
sizeof(struct cs42l73_platform_data),
|
||||||
|
GFP_KERNEL);
|
||||||
|
if (!pdata) {
|
||||||
|
dev_err(&i2c_client->dev, "could not allocate pdata\n");
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
if (i2c_client->dev.of_node) {
|
||||||
|
if (of_property_read_u32(i2c_client->dev.of_node,
|
||||||
|
"chgfreq", &val32) >= 0)
|
||||||
|
pdata->chgfreq = val32;
|
||||||
|
}
|
||||||
|
pdata->reset_gpio = of_get_named_gpio(i2c_client->dev.of_node,
|
||||||
|
"reset-gpio", 0);
|
||||||
|
cs42l73->pdata = *pdata;
|
||||||
|
}
|
||||||
|
|
||||||
i2c_set_clientdata(i2c_client, cs42l73);
|
i2c_set_clientdata(i2c_client, cs42l73);
|
||||||
|
|
||||||
|
@ -1493,6 +1511,12 @@ static int cs42l73_i2c_remove(struct i2c_client *client)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct of_device_id cs42l73_of_match[] = {
|
||||||
|
{ .compatible = "cirrus,cs42l73", },
|
||||||
|
{},
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(of, cs42l73_of_match);
|
||||||
|
|
||||||
static const struct i2c_device_id cs42l73_id[] = {
|
static const struct i2c_device_id cs42l73_id[] = {
|
||||||
{"cs42l73", 0},
|
{"cs42l73", 0},
|
||||||
{}
|
{}
|
||||||
|
@ -1504,6 +1528,7 @@ static struct i2c_driver cs42l73_i2c_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "cs42l73",
|
.name = "cs42l73",
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
|
.of_match_table = cs42l73_of_match,
|
||||||
},
|
},
|
||||||
.id_table = cs42l73_id,
|
.id_table = cs42l73_id,
|
||||||
.probe = cs42l73_i2c_probe,
|
.probe = cs42l73_i2c_probe,
|
||||||
|
|
Loading…
Reference in a new issue