* [PATCH v2 3/3] ASoC: cs42l73: Add Device Tree support for CS42L73
@ 2013-10-18 19:30 Brian Austin
2013-10-20 17:30 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Brian Austin @ 2013-10-18 19:30 UTC (permalink / raw)
To: alsa-devel; +Cc: Brian Austin, broonie, lgirdwood
This patch adds support for device tree for the CS42L73 CODEC
Signed-off-by: Brian Austin <brian.austin@cirrus.com>
---
.../devicetree/bindings/sound/cs42l73.txt | 22 ++++++++++++++++
sound/soc/codecs/cs42l73.c | 29 ++++++++++++++++++++--
2 files changed, 49 insertions(+), 2 deletions(-)
create mode 100644 Documentation/devicetree/bindings/sound/cs42l73.txt
diff --git a/Documentation/devicetree/bindings/sound/cs42l73.txt b/Documentation/devicetree/bindings/sound/cs42l73.txt
new file mode 100644
index 0000000..80ae910
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/cs42l73.txt
@@ -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>;
+};
\ No newline at end of file
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c
index 89efc3c..549d5d6 100644
--- a/sound/soc/codecs/cs42l73.c
+++ b/sound/soc/codecs/cs42l73.c
@@ -17,7 +17,7 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
-#include <linux/gpio.h>
+#include <linux/of_gpio.h>
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
@@ -1416,6 +1416,7 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client,
int ret;
unsigned int devid = 0;
unsigned int reg;
+ u32 val32;
cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l73_private),
GFP_KERNEL);
@@ -1431,8 +1432,25 @@ static int cs42l73_i2c_probe(struct i2c_client *i2c_client,
return ret;
}
- if (pdata)
+ if (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);
@@ -1493,6 +1511,12 @@ static int cs42l73_i2c_remove(struct i2c_client *client)
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[] = {
{"cs42l73", 0},
{}
@@ -1504,6 +1528,7 @@ static struct i2c_driver cs42l73_i2c_driver = {
.driver = {
.name = "cs42l73",
.owner = THIS_MODULE,
+ .of_match_table = cs42l73_of_match,
},
.id_table = cs42l73_id,
.probe = cs42l73_i2c_probe,
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 3/3] ASoC: cs42l73: Add Device Tree support for CS42L73
2013-10-18 19:30 [PATCH v2 3/3] ASoC: cs42l73: Add Device Tree support for CS42L73 Brian Austin
@ 2013-10-20 17:30 ` Mark Brown
2013-10-20 22:00 ` Austin, Brian
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2013-10-20 17:30 UTC (permalink / raw)
To: Brian Austin; +Cc: alsa-devel, lgirdwood
[-- Attachment #1.1: Type: text/plain, Size: 373 bytes --]
On Fri, Oct 18, 2013 at 02:30:01PM -0500, Brian Austin wrote:
> This patch adds support for device tree for the CS42L73 CODEC
Applied, thanks, though this really ought to have been sent to the DT
folks.
> + - chgfreq : Charge Pump Frequency values 0x00-0x0F
Can you please send a followup patch explaining what these values mean
(eg, "Value written to register X")?
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 3/3] ASoC: cs42l73: Add Device Tree support for CS42L73
2013-10-20 17:30 ` Mark Brown
@ 2013-10-20 22:00 ` Austin, Brian
2013-10-20 22:10 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Austin, Brian @ 2013-10-20 22:00 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com
> On Oct 20, 2013, at 12:30, "Mark Brown" <broonie@kernel.org> wrote:
>
>> On Fri, Oct 18, 2013 at 02:30:01PM -0500, Brian Austin wrote:
>> This patch adds support for device tree for the CS42L73 CODEC
>
> Applied, thanks, though this really ought to have been sent to the DT
> folks.
>
Ok, so pretty much when it's device tree related it goes there?
>> + - chgfreq : Charge Pump Frequency values 0x00-0x0F
>
> Can you please send a followup patch explaining what these values mean
> (eg, "Value written to register X")?
Thanks, I'll add more explaination
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 3/3] ASoC: cs42l73: Add Device Tree support for CS42L73
2013-10-20 22:00 ` Austin, Brian
@ 2013-10-20 22:10 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2013-10-20 22:10 UTC (permalink / raw)
To: Austin, Brian; +Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com
[-- Attachment #1.1: Type: text/plain, Size: 474 bytes --]
On Sun, Oct 20, 2013 at 10:00:22PM +0000, Austin, Brian wrote:
> > On Oct 20, 2013, at 12:30, "Mark Brown" <broonie@kernel.org> wrote:
> > Applied, thanks, though this really ought to have been sent to the DT
> > folks.
> Ok, so pretty much when it's device tree related it goes there?
Yes, that's the idea - if it updates the binding documents they should
be in the loop. Though it's possble that this will get revised during
the various discussions this week I guess.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-20 22:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-18 19:30 [PATCH v2 3/3] ASoC: cs42l73: Add Device Tree support for CS42L73 Brian Austin
2013-10-20 17:30 ` Mark Brown
2013-10-20 22:00 ` Austin, Brian
2013-10-20 22:10 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).