Hi!
On Mittwoch, 19. Dezember 2007, Keef Aragon wrote:
> I checked out the archive and found
> https://lists.openezx.org/pipermail/openezx-devel/2007-August/00140
>8.html . I was looking at the driver in svn and can't figure out for
> the life of me how that worked. (Looks like there isn't even a
> write proc for /proc/pcap).
I added one - one that sets thouse four registers. It my very first
kernel code. Ugly - but it seems to set the registers correctly.
Enable with "echo 1 > /proc/pcap".
But just setting them doesn't seem to be enough - i don't get audio on
calls.
What is needed apart of setting this four registers?
Yours,
Simon Neininger
--- linux-2.6.23/arch/arm/mach-pxa/ezx-pcap.c 2007-12-30 05:19:38.475568948 +0100
+++ linux-2.6.23_new/arch/arm/mach-pxa/ezx-pcap.c 2007-12-30 04:43:01.318360095 +0100
@@ -18,6 +18,7 @@
#include <asm/hardware.h>
#include <asm/mach-types.h>
+#include <asm/uaccess.h>
#include <asm/arch/ezx.h>
#include <asm/arch/ssp.h>
@@ -169,6 +170,25 @@
*start = page + (off-begin);
return ((count < begin+len-off) ? count : begin+len-off);
}
+
+int pcap_write_proc(struct file *file, const char __user *userbuffer, unsigned long count, void *data)
+{
+ char *kernel_buffer;
+ int not_copied;
+ kernel_buffer = kmalloc( count, GFP_KERNEL );
+ if( !kernel_buffer ) {
+ return -ENOMEM;
+ }
+ not_copied = copy_from_user( kernel_buffer, userbuffer, count );
+ if ('1' == kernel_buffer[0]) {
+ ezx_pcap_write(PCAP_REG_ST_DAC,0x00000000);
+ ezx_pcap_write(PCAP_REG_TX_AMPS,0x00200910);
+ ezx_pcap_write(PCAP_REG_RX_AMPS,0x0008e901);
+ ezx_pcap_write(PCAP_REG_CODEC,0x00003005);
+ }
+ kfree( kernel_buffer );
+ return count-not_copied;
+}
#endif
void ezx_pcap_vibrator_level(u_int32_t value)
@@ -489,6 +509,7 @@
#ifdef CONFIG_PROC_FS
if((proc_pcap = create_proc_entry("pcap", 0, NULL)))
proc_pcap->read_proc = pcap_read_proc;
+ proc_pcap->write_proc = pcap_write_proc;
#endif
return platform_driver_register(&ezxpcap_driver);