[ar71xx] preliminary support for the Ubiquiti RouterStation Pro
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1178-debug-codec-register-setting-sysfs.patch.patch
1 From 79b99f7d65cce0730998a84d2fb615ae5ad0cff5 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Wed, 2 Jul 2008 22:39:01 +0100
4 Subject: [PATCH] debug-codec-register-setting-sysfs.patch
5 Allow direct setting of codec registers for super mega meddling power
6 Signed-off-by: Andy Green <andy@openmoko.com>
7
8 ---
9 sound/soc/soc-core.c | 35 +++++++++++++++++++++++++++++++++++
10 1 files changed, 35 insertions(+), 0 deletions(-)
11
12 diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
13 index 25f7818..9e20333 100644
14 --- a/sound/soc/soc-core.c
15 +++ b/sound/soc/soc-core.c
16 @@ -928,6 +928,38 @@ static ssize_t codec_reg_show(struct device *dev,
17 }
18 static DEVICE_ATTR(codec_reg, 0444, codec_reg_show, NULL);
19
20 +
21 +static ssize_t codec_reg_write(struct device *dev,
22 + struct device_attribute *attr,
23 + const char *buf, size_t count)
24 +{
25 + u32 address;
26 + u32 data;
27 + char * end;
28 + size_t left = count;
29 + struct snd_soc_device *devdata = dev_get_drvdata(dev);
30 + struct snd_soc_codec *codec = devdata->codec;
31 +
32 + address = simple_strtoul(buf, &end, 16);
33 + left -= (int)(end - buf);
34 + while ((*end == ' ') && (left)) {
35 + end++;
36 + left--;
37 + }
38 + if (!left)
39 + return count;
40 + data = simple_strtoul(end, &end, 16);
41 +
42 + printk(KERN_INFO"user writes Codec reg 0x%02X with Data 0x%04X\n",
43 + address, data);
44 +
45 + codec->write(codec, address, data);
46 +
47 + return count;
48 +}
49 +
50 +static DEVICE_ATTR(codec_reg_write, 0644, NULL, codec_reg_write);
51 +
52 /**
53 * snd_soc_new_ac97_codec - initailise AC97 device
54 * @codec: audio codec
55 @@ -1139,6 +1171,9 @@ int snd_soc_register_card(struct snd_soc_device *socdev)
56 err = device_create_file(socdev->dev, &dev_attr_codec_reg);
57 if (err < 0)
58 printk(KERN_WARNING "asoc: failed to add codec sysfs entries\n");
59 + err = device_create_file(socdev->dev, &dev_attr_codec_reg_write);
60 + if (err < 0)
61 + printk(KERN_WARNING "asoc: failed to add codec sysfs entries\n");
62 out:
63 mutex_unlock(&codec->mutex);
64 return ret;
65 --
66 1.5.6.5
67
This page took 0.046739 seconds and 5 git commands to generate.