summaryrefslogtreecommitdiffstats
path: root/target/linux/s3c24xx/patches-2.6.26/1158-debug-codec-register-setting-sysfs.patch.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/s3c24xx/patches-2.6.26/1158-debug-codec-register-setting-sysfs.patch.patch')
-rwxr-xr-xtarget/linux/s3c24xx/patches-2.6.26/1158-debug-codec-register-setting-sysfs.patch.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/target/linux/s3c24xx/patches-2.6.26/1158-debug-codec-register-setting-sysfs.patch.patch b/target/linux/s3c24xx/patches-2.6.26/1158-debug-codec-register-setting-sysfs.patch.patch
new file mode 100755
index 0000000000..3e4455a33c
--- /dev/null
+++ b/target/linux/s3c24xx/patches-2.6.26/1158-debug-codec-register-setting-sysfs.patch.patch
@@ -0,0 +1,67 @@
+From 048fc250b2e3b27c80e9442e5a34a82f698da9d6 Mon Sep 17 00:00:00 2001
+From: Andy Green <andy@openmoko.com>
+Date: Fri, 25 Jul 2008 23:06:11 +0100
+Subject: [PATCH] debug-codec-register-setting-sysfs.patch
+ Allow direct setting of codec registers for super mega meddling power
+ Signed-off-by: Andy Green <andy@openmoko.com>
+
+---
+ sound/soc/soc-core.c | 35 +++++++++++++++++++++++++++++++++++
+ 1 files changed, 35 insertions(+), 0 deletions(-)
+
+diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
+index e148db9..67223fe 100644
+--- a/sound/soc/soc-core.c
++++ b/sound/soc/soc-core.c
+@@ -935,6 +935,38 @@ static ssize_t codec_reg_show(struct device *dev,
+ }
+ static DEVICE_ATTR(codec_reg, 0444, codec_reg_show, NULL);
+
++
++static ssize_t codec_reg_write(struct device *dev,
++ struct device_attribute *attr,
++ const char *buf, size_t count)
++{
++ u32 address;
++ u32 data;
++ char * end;
++ size_t left = count;
++ struct snd_soc_device *devdata = dev_get_drvdata(dev);
++ struct snd_soc_codec *codec = devdata->codec;
++
++ address = simple_strtoul(buf, &end, 16);
++ left -= (int)(end - buf);
++ while ((*end == ' ') && (left)) {
++ end++;
++ left--;
++ }
++ if (!left)
++ return count;
++ data = simple_strtoul(end, &end, 16);
++
++ printk(KERN_INFO"user writes Codec reg 0x%02X with Data 0x%04X\n",
++ address, data);
++
++ codec->write(codec, address, data);
++
++ return count;
++}
++
++static DEVICE_ATTR(codec_reg_write, 0644, NULL, codec_reg_write);
++
+ /**
+ * snd_soc_new_ac97_codec - initailise AC97 device
+ * @codec: audio codec
+@@ -1150,6 +1182,9 @@ int snd_soc_register_card(struct snd_soc_device *socdev)
+
+ mutex_unlock(&codec->mutex);
+
++ err = device_create_file(socdev->dev, &dev_attr_codec_reg_write);
++ if (err < 0)
++ printk(KERN_WARNING "asoc: failed to add codec sysfs entries\n");
+ out:
+ return ret;
+ }
+--
+1.5.6.3
+