summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/SOURCES11
-rw-r--r--firmware/drivers/wm8731l.c1
-rw-r--r--firmware/drivers/wm8758.c1
-rw-r--r--firmware/drivers/wm8975.c1
-rw-r--r--firmware/export/i2s.h20
-rw-r--r--firmware/export/wmcodec.h1
-rw-r--r--firmware/target/arm/i2s-pp.c95
-rw-r--r--firmware/target/arm/wmcodec-pp.c54
8 files changed, 130 insertions, 54 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 77c257879a..30431d71b2 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -328,6 +328,7 @@ target/arm/sandisk/sansa-e200/backlight-e200.c
328target/arm/sandisk/sansa-e200/usb-e200.c 328target/arm/sandisk/sansa-e200/usb-e200.c
329target/arm/sandisk/sansa-e200/button-e200.c 329target/arm/sandisk/sansa-e200/button-e200.c
330target/arm/sandisk/sansa-e200/power-e200.c 330target/arm/sandisk/sansa-e200/power-e200.c
331target/arm/i2s-pp.c
331#endif /* SIMULATOR */ 332#endif /* SIMULATOR */
332#endif /* SANSA_E200 */ 333#endif /* SANSA_E200 */
333 334
@@ -403,6 +404,7 @@ target/coldfire/iriver/h100/usb-h100.c
403#ifndef SIMULATOR 404#ifndef SIMULATOR
404target/arm/ata-pp5020.c 405target/arm/ata-pp5020.c
405target/arm/wmcodec-pp.c 406target/arm/wmcodec-pp.c
407target/arm/i2s-pp.c
406target/arm/iriver/h10/adc-h10.c 408target/arm/iriver/h10/adc-h10.c
407target/arm/iriver/h10/backlight-h10.c 409target/arm/iriver/h10/backlight-h10.c
408target/arm/iriver/h10/button-h10.c 410target/arm/iriver/h10/button-h10.c
@@ -416,6 +418,7 @@ target/arm/iriver/h10/usb-h10.c
416#ifndef SIMULATOR 418#ifndef SIMULATOR
417target/arm/ata-pp5020.c 419target/arm/ata-pp5020.c
418target/arm/wmcodec-pp.c 420target/arm/wmcodec-pp.c
421target/arm/i2s-pp.c
419target/arm/iriver/h10/adc-h10.c 422target/arm/iriver/h10/adc-h10.c
420target/arm/iriver/h10/backlight-h10.c 423target/arm/iriver/h10/backlight-h10.c
421target/arm/iriver/h10/button-h10.c 424target/arm/iriver/h10/button-h10.c
@@ -445,6 +448,7 @@ target/arm/gigabeat/meg-fx/wmcodec-meg-fx.c
445#ifndef SIMULATOR 448#ifndef SIMULATOR
446target/arm/ata-pp5020.c 449target/arm/ata-pp5020.c
447target/arm/wmcodec-pp.c 450target/arm/wmcodec-pp.c
451target/arm/i2s-pp.c
448target/arm/tatung/tpj1022/adc-tpj1022.c 452target/arm/tatung/tpj1022/adc-tpj1022.c
449target/arm/tatung/tpj1022/backlight-tpj1022.c 453target/arm/tatung/tpj1022/backlight-tpj1022.c
450target/arm/tatung/tpj1022/button-tpj1022.c 454target/arm/tatung/tpj1022/button-tpj1022.c
@@ -459,6 +463,7 @@ target/arm/tatung/tpj1022/usb-tpj1022.c
459drivers/lcd-ipod.c 463drivers/lcd-ipod.c
460drivers/pcf50605.c 464drivers/pcf50605.c
461target/arm/wmcodec-pp.c 465target/arm/wmcodec-pp.c
466target/arm/i2s-pp.c
462target/arm/ata-pp5020.c 467target/arm/ata-pp5020.c
463target/arm/ipod/adc-ipod.c 468target/arm/ipod/adc-ipod.c
464target/arm/ipod/backlight-4g_color.c 469target/arm/ipod/backlight-4g_color.c
@@ -474,6 +479,7 @@ drivers/lcd-ipod.c
474drivers/pcf50605.c 479drivers/pcf50605.c
475target/arm/ata-pp5020.c 480target/arm/ata-pp5020.c
476target/arm/wmcodec-pp.c 481target/arm/wmcodec-pp.c
482target/arm/i2s-pp.c
477target/arm/ipod/adc-ipod.c 483target/arm/ipod/adc-ipod.c
478target/arm/ipod/backlight-4g_color.c 484target/arm/ipod/backlight-4g_color.c
479target/arm/ipod/button-clickwheel.c 485target/arm/ipod/button-clickwheel.c
@@ -488,6 +494,7 @@ drivers/lcd-ipod.c
488drivers/pcf50605.c 494drivers/pcf50605.c
489target/arm/ata-pp5020.c 495target/arm/ata-pp5020.c
490target/arm/wmcodec-pp.c 496target/arm/wmcodec-pp.c
497target/arm/i2s-pp.c
491target/arm/ipod/adc-ipod.c 498target/arm/ipod/adc-ipod.c
492target/arm/ipod/backlight-nano_video.c 499target/arm/ipod/backlight-nano_video.c
493target/arm/ipod/button-clickwheel.c 500target/arm/ipod/button-clickwheel.c
@@ -502,6 +509,7 @@ drivers/lcd-ipodvideo.c
502drivers/pcf50605.c 509drivers/pcf50605.c
503target/arm/ata-pp5020.c 510target/arm/ata-pp5020.c
504target/arm/wmcodec-pp.c 511target/arm/wmcodec-pp.c
512target/arm/i2s-pp.c
505target/arm/ipod/adc-ipod.c 513target/arm/ipod/adc-ipod.c
506target/arm/ipod/backlight-nano_video.c 514target/arm/ipod/backlight-nano_video.c
507target/arm/ipod/button-clickwheel.c 515target/arm/ipod/button-clickwheel.c
@@ -516,6 +524,7 @@ drivers/lcd-ipod.c
516drivers/pcf50605.c 524drivers/pcf50605.c
517target/arm/ata-pp5002.c 525target/arm/ata-pp5002.c
518target/arm/wmcodec-pp.c 526target/arm/wmcodec-pp.c
527target/arm/i2s-pp.c
519target/arm/ipod/adc-ipod.c 528target/arm/ipod/adc-ipod.c
520target/arm/ipod/3g/backlight-3g.c 529target/arm/ipod/3g/backlight-3g.c
521target/arm/ipod/3g/button-3g.c 530target/arm/ipod/3g/button-3g.c
@@ -530,6 +539,7 @@ drivers/lcd-ipod.c
530drivers/pcf50605.c 539drivers/pcf50605.c
531target/arm/ata-pp5020.c 540target/arm/ata-pp5020.c
532target/arm/wmcodec-pp.c 541target/arm/wmcodec-pp.c
542target/arm/i2s-pp.c
533target/arm/ipod/adc-ipod.c 543target/arm/ipod/adc-ipod.c
534target/arm/ipod/backlight-mini1g_mini2g.c 544target/arm/ipod/backlight-mini1g_mini2g.c
535target/arm/ipod/button-mini1g.c 545target/arm/ipod/button-mini1g.c
@@ -544,6 +554,7 @@ drivers/lcd-ipod.c
544drivers/pcf50605.c 554drivers/pcf50605.c
545target/arm/ata-pp5020.c 555target/arm/ata-pp5020.c
546target/arm/wmcodec-pp.c 556target/arm/wmcodec-pp.c
557target/arm/i2s-pp.c
547target/arm/ipod/adc-ipod.c 558target/arm/ipod/adc-ipod.c
548target/arm/ipod/backlight-mini1g_mini2g.c 559target/arm/ipod/backlight-mini1g_mini2g.c
549target/arm/ipod/button-clickwheel.c 560target/arm/ipod/button-clickwheel.c
diff --git a/firmware/drivers/wm8731l.c b/firmware/drivers/wm8731l.c
index 30521339e9..a690aade48 100644
--- a/firmware/drivers/wm8731l.c
+++ b/firmware/drivers/wm8731l.c
@@ -39,6 +39,7 @@
39 39
40#include "wmcodec.h" 40#include "wmcodec.h"
41#include "wm8731l.h" 41#include "wm8731l.h"
42#include "i2s.h"
42 43
43#define IPOD_PCM_LEVEL 0x65 /* -6dB */ 44#define IPOD_PCM_LEVEL 0x65 /* -6dB */
44 45
diff --git a/firmware/drivers/wm8758.c b/firmware/drivers/wm8758.c
index 268df13f07..22bef73e45 100644
--- a/firmware/drivers/wm8758.c
+++ b/firmware/drivers/wm8758.c
@@ -39,6 +39,7 @@
39 39
40#include "wmcodec.h" 40#include "wmcodec.h"
41#include "wm8758.h" 41#include "wm8758.h"
42#include "i2s.h"
42 43
43/* convert tenth of dB volume (-57..6) to master volume register value */ 44/* convert tenth of dB volume (-57..6) to master volume register value */
44int tenthdb2master(int db) 45int tenthdb2master(int db)
diff --git a/firmware/drivers/wm8975.c b/firmware/drivers/wm8975.c
index 7f2f2c4a7d..d2b1fa64b2 100644
--- a/firmware/drivers/wm8975.c
+++ b/firmware/drivers/wm8975.c
@@ -39,6 +39,7 @@
39 39
40#include "wmcodec.h" 40#include "wmcodec.h"
41#include "wm8975.h" 41#include "wm8975.h"
42#include "i2s.h"
42 43
43/* convert tenth of dB volume (-730..60) to master volume register value */ 44/* convert tenth of dB volume (-730..60) to master volume register value */
44int tenthdb2master(int db) 45int tenthdb2master(int db)
diff --git a/firmware/export/i2s.h b/firmware/export/i2s.h
new file mode 100644
index 0000000000..13dba68391
--- /dev/null
+++ b/firmware/export/i2s.h
@@ -0,0 +1,20 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Daniel Ankers
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20void i2s_reset(void);
diff --git a/firmware/export/wmcodec.h b/firmware/export/wmcodec.h
index 1079a80498..d810469d02 100644
--- a/firmware/export/wmcodec.h
+++ b/firmware/export/wmcodec.h
@@ -17,7 +17,6 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20void i2s_reset(void);
21int audiohw_init(void); 20int audiohw_init(void);
22void wmcodec_write(int reg, int data); 21void wmcodec_write(int reg, int data);
23 22
diff --git a/firmware/target/arm/i2s-pp.c b/firmware/target/arm/i2s-pp.c
new file mode 100644
index 0000000000..1485147de8
--- /dev/null
+++ b/firmware/target/arm/i2s-pp.c
@@ -0,0 +1,95 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Portalplayer specific code for I2S
11 *
12 * Based on code from the ipodlinux project - http://ipodlinux.org/
13 * Adapted for Rockbox in December 2005
14 *
15 * Original file: linux/arch/armnommu/mach-ipod/audio.c
16 *
17 * Copyright (c) 2003-2005 Bernard Leach (leachbj@bouncycastle.org)
18 *
19 * All files in this archive are subject to the GNU General Public License.
20 * See the file COPYING in the source tree root for full license agreement.
21 *
22 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
23 * KIND, either express or implied.
24 *
25 ****************************************************************************/
26
27#include "system.h"
28
29/* TODO: Add in PP5002 defs */
30#if CONFIG_CPU == PP5002
31void i2s_reset(void)
32{
33 /* I2S device reset */
34 DEV_RS |= 0x80;
35 DEV_RS &= ~0x80;
36
37 /* I2S controller enable */
38 IISCONFIG |= 1;
39
40 /* BIT.FORMAT [11:10] = I2S (default) */
41 /* BIT.SIZE [9:8] = 24bit */
42 /* FIFO.FORMAT = 24 bit LSB */
43
44 /* reset DAC and ADC fifo */
45 IISFIFO_CFG |= 0x30000;
46}
47#else /* PP502X */
48
49/* Data format on the I2S bus */
50#define FORMAT_MASK (0x3 << 10)
51#define FORMAT_I2S (0x00 << 10)
52/* Other formats not yet known */
53
54/* Data size on I2S bus */
55#define SIZE_MASK (0x3 << 8)
56#define SIZE_16BIT (0x00 << 10)
57/* Other sizes not yet known */
58
59/* Data size/format on I2S FIFO */
60#define FIFO_FORMAT_MASK (0x7 << 4)
61#define FIFO_FORMAT_32LSB (0x03 << 4)
62/* Other formats not yet known */
63
64/* Are we I2S Master or slave? */
65#define I2S_MASTER (0x25)
66
67#define I2S_RESET (0x1 << 31)
68
69/*
70 * Reset the I2S BIT.FORMAT I2S, 16bit, FIFO.FORMAT 32bit
71 */
72void i2s_reset(void)
73{
74 /* I2S soft reset */
75 IISCONFIG |= I2S_RESET;
76 IISCONFIG &= ~I2S_RESET;
77
78 /* BIT.FORMAT */
79 IISCONFIG = ((IISCONFIG & ~FORMAT_MASK) | FORMAT_I2S);
80
81 /* BIT.SIZE */
82 IISCONFIG = ((IISCONFIG & ~SIZE_MASK) | SIZE_16BIT);
83
84 /* FIFO.FORMAT */
85 /* If BIT.SIZE < FIFO.FORMAT low bits will be 0 */
86 IISCONFIG = ((IISCONFIG & ~FIFO_FORMAT_MASK) | FIFO_FORMAT_32LSB);
87
88 /* RX_ATN_LVL=1 == when 12 slots full */
89 /* TX_ATN_LVL=1 == when 12 slots empty */
90 IISFIFO_CFG |= 0x33;
91
92 /* Rx.CLR = 1, TX.CLR = 1 */
93 IISFIFO_CFG |= 0x1100;
94}
95#endif
diff --git a/firmware/target/arm/wmcodec-pp.c b/firmware/target/arm/wmcodec-pp.c
index 8aa862c187..471cd8f4a5 100644
--- a/firmware/target/arm/wmcodec-pp.c
+++ b/firmware/target/arm/wmcodec-pp.c
@@ -23,19 +23,8 @@
23 * KIND, either express or implied. 23 * KIND, either express or implied.
24 * 24 *
25 ****************************************************************************/ 25 ****************************************************************************/
26#include "lcd.h" 26
27#include "cpu.h"
28#include "kernel.h"
29#include "thread.h"
30#include "power.h"
31#include "debug.h"
32#include "system.h" 27#include "system.h"
33#include "sprintf.h"
34#include "button.h"
35#include "string.h"
36#include "file.h"
37#include "buffer.h"
38#include "audio.h"
39 28
40#if CONFIG_CPU == PP5020 29#if CONFIG_CPU == PP5020
41#include "i2c-pp5020.h" 30#include "i2c-pp5020.h"
@@ -51,47 +40,6 @@
51#define I2C_AUDIO_ADDRESS 0x1a 40#define I2C_AUDIO_ADDRESS 0x1a
52#endif 41#endif
53 42
54/*
55 * Reset the I2S BIT.FORMAT I2S, 16bit, FIFO.FORMAT 32bit
56 */
57void i2s_reset(void)
58{
59#if CONFIG_CPU == PP5020
60 /* I2S soft reset */
61 outl(inl(0x70002800) | 0x80000000, 0x70002800);
62 outl(inl(0x70002800) & ~0x80000000, 0x70002800);
63
64 /* BIT.FORMAT [11:10] = I2S (default) */
65 outl(inl(0x70002800) & ~0xc00, 0x70002800);
66 /* BIT.SIZE [9:8] = 16bit (default) */
67 outl(inl(0x70002800) & ~0x300, 0x70002800);
68
69 /* FIFO.FORMAT [6:4] = 32 bit LSB */
70 /* since BIT.SIZ < FIFO.FORMAT low 16 bits will be 0 */
71 outl(inl(0x70002800) | 0x30, 0x70002800);
72
73 /* RX_ATN_LVL=1 == when 12 slots full */
74 /* TX_ATN_LVL=1 == when 12 slots empty */
75 outl(inl(0x7000280c) | 0x33, 0x7000280c);
76
77 /* Rx.CLR = 1, TX.CLR = 1 */
78 outl(inl(0x7000280c) | 0x1100, 0x7000280c);
79#elif CONFIG_CPU == PP5002
80 /* I2S device reset */
81 outl(inl(0xcf005030) | 0x80, 0xcf005030);
82 outl(inl(0xcf005030) & ~0x80, 0xcf005030);
83
84 /* I2S controller enable */
85 outl(inl(0xc0002500) | 0x1, 0xc0002500);
86
87 /* BIT.FORMAT [11:10] = I2S (default) */
88 /* BIT.SIZE [9:8] = 24bit */
89 /* FIFO.FORMAT = 24 bit LSB */
90
91 /* reset DAC and ADC fifo */
92 outl(inl(0xc000251c) | 0x30000, 0xc000251c);
93#endif
94}
95 43
96/* 44/*
97 * Initialise the WM8975 for playback via headphone and line out. 45 * Initialise the WM8975 for playback via headphone and line out.