aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/oxygen_io.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2008-09-22 03:04:43 -0400
committerClemens Ladisch <clemens@ladisch.de>2008-09-22 03:04:43 -0400
commit397b1dcc449082ce3f720c548da9c59db01cb739 (patch)
treea5295eabb214f913cd931c50b079c81b8086e577 /sound/pci/oxygen/oxygen_io.c
parentdbbbd6744439d95d2b0dc23c5cdca2c477377f76 (diff)
ALSA: oxygen: add UART I/O functions
Add functions to allow model drivers to communicate with external chips by doing I/O with the not-used-for-MIDI UART. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/pci/oxygen/oxygen_io.c')
-rw-r--r--sound/pci/oxygen/oxygen_io.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/sound/pci/oxygen/oxygen_io.c b/sound/pci/oxygen/oxygen_io.c
index 83f135f80df4..deba7389aec3 100644
--- a/sound/pci/oxygen/oxygen_io.c
+++ b/sound/pci/oxygen/oxygen_io.c
@@ -20,6 +20,7 @@
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/sched.h> 21#include <linux/sched.h>
22#include <sound/core.h> 22#include <sound/core.h>
23#include <sound/mpu401.h>
23#include <asm/io.h> 24#include <asm/io.h>
24#include "oxygen.h" 25#include "oxygen.h"
25 26
@@ -232,3 +233,23 @@ void oxygen_write_i2c(struct oxygen *chip, u8 device, u8 map, u8 data)
232 device | OXYGEN_2WIRE_DIR_WRITE); 233 device | OXYGEN_2WIRE_DIR_WRITE);
233} 234}
234EXPORT_SYMBOL(oxygen_write_i2c); 235EXPORT_SYMBOL(oxygen_write_i2c);
236
237static void _write_uart(struct oxygen *chip, unsigned int port, u8 data)
238{
239 if (oxygen_read8(chip, OXYGEN_MPU401 + 1) & MPU401_TX_FULL)
240 msleep(1);
241 oxygen_write8(chip, OXYGEN_MPU401 + port, data);
242}
243
244void oxygen_reset_uart(struct oxygen *chip)
245{
246 _write_uart(chip, 1, MPU401_RESET);
247 _write_uart(chip, 1, MPU401_ENTER_UART);
248}
249EXPORT_SYMBOL(oxygen_reset_uart);
250
251void oxygen_write_uart(struct oxygen *chip, u8 data)
252{
253 _write_uart(chip, 0, data);
254}
255EXPORT_SYMBOL(oxygen_write_uart);