From 7042c96b4a695690a491a6494ec67bf77783a7f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Sat, 20 Mar 2010 17:09:44 +0000 Subject: [PATCH] Clip+: enable sound on "as3514" (as3543 in fact) as3525 comes with a as3517, as3525v2 with a as3543, rename specific registers accordingly Existing problems: FM (line out) doesn't work, volume can't go below a certain point git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25260 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/audio/as3514.c | 24 ++++++++++++++++++++- firmware/export/as3514.h | 3 ++- firmware/target/arm/as3525/usb-drv-as3525.c | 6 +++--- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c index b7c99f433b..b8ef2bf120 100644 --- a/firmware/drivers/audio/as3514.c +++ b/firmware/drivers/audio/as3514.c @@ -7,7 +7,7 @@ * \/ \/ \/ \/ \/ * $Id$ * - * Driver for AS3514 audio codec + * Driver for AS3514 and compatible audio codec * * Copyright (c) 2007 Daniel Ankers * Copyright (c) 2007 Christian Gmeiner @@ -31,6 +31,13 @@ #include "i2s.h" #include "ascodec.h" +/* + * This drivers supports: + * as3514 , as used in the PP targets + * as3517 , as used in the as3525 targets + * as3543 , as used in the as3525v2 targets + */ + /* AMS Sansas based on the AS3525 use the LINE2 input for the analog radio signal instead of LINE1 */ #if CONFIG_CPU == AS3525 @@ -170,9 +177,13 @@ void audiohw_preinit(void) as3514_write(AS3514_AUDIOSET3, AUDIOSET3_HPCM_off); #endif +#if CONFIG_CPU != AS3525v2 /* Mute and disable speaker */ as3514_write(AS3514_LSP_OUT_R, LSP_OUT_R_SP_OVC_TO_256MS | 0x00); as3514_write(AS3514_LSP_OUT_L, LSP_OUT_L_SP_MUTE | 0x00); +#else + as3514_clear(AS3543_DAC_IF, 0x80); +#endif /* Set headphone over-current to 0, Min volume */ as3514_write(AS3514_HPH_OUT_R, @@ -262,8 +273,15 @@ void audiohw_mute(bool mute) { if (mute) { as3514_set(AS3514_HPH_OUT_L, HPH_OUT_L_HP_MUTE); +#if CONFIG_CPU == AS3525v2 + as3514_set(AS3543_DAC_IF, 0x80); +#endif + } else { as3514_clear(AS3514_HPH_OUT_L, HPH_OUT_L_HP_MUTE); +#if CONFIG_CPU == AS3525v2 + as3514_clear(AS3543_DAC_IF, 0x80); +#endif } } @@ -284,6 +302,10 @@ void audiohw_close(void) as3514_clear(AS3514_HPH_OUT_L, HPH_OUT_L_HP_ON); as3514_write(AS3514_AUDIOSET1, 0x0); +#if CONFIG_CPU == AS3525v2 + as3514_set(AS3543_DAC_IF, 0x80); +#endif + /* Allow caps to discharge */ sleep(HZ/4); } diff --git a/firmware/export/as3514.h b/firmware/export/as3514.h index 53851335c8..a9b12de36e 100644 --- a/firmware/export/as3514.h +++ b/firmware/export/as3514.h @@ -46,10 +46,11 @@ extern void audiohw_set_lineout_vol(int vol_l, int vol_r); #define AS3514_DAC_L 0x0f #define AS3514_ADC_R 0x10 #define AS3514_ADC_L 0x11 +#define AS3543_DAC_IF 0x12 /* only in as3543 */ #define AS3514_AUDIOSET1 0x14 #define AS3514_AUDIOSET2 0x15 #define AS3514_AUDIOSET3 0x16 -#define AS3514_USB_UTIL 0x17 /* Only in AS3525 ? */ +#define AS3517_USB_UTIL 0x17 /* only in as3517+ */ #define AS3514_PLLMODE 0x1d #define AS3514_SYSTEM 0x20 diff --git a/firmware/target/arm/as3525/usb-drv-as3525.c b/firmware/target/arm/as3525/usb-drv-as3525.c index 5582eebade..496d434c6e 100644 --- a/firmware/target/arm/as3525/usb-drv-as3525.c +++ b/firmware/target/arm/as3525/usb-drv-as3525.c @@ -122,7 +122,7 @@ void usb_drv_init(void) endpoints[i].busy = false; ascodec_write(AS3514_CVDD_DCDC3, ascodec_read(AS3514_CVDD_DCDC3) | 1<<2); - ascodec_write(AS3514_USB_UTIL, ascodec_read(AS3514_USB_UTIL) & ~(1<<4)); + ascodec_write(AS3517_USB_UTIL, ascodec_read(AS3517_USB_UTIL) & ~(1<<4)); /* PHY part */ CGU_USB = 1<<5 /* enable */ @@ -137,7 +137,7 @@ void usb_drv_init(void) USB_DEV_CTRL |= 0x400; /* soft disconnect */ /* UVDD */ - ascodec_write(AS3514_USB_UTIL, ascodec_read(AS3514_USB_UTIL) | (1<<4)); + ascodec_write(AS3517_USB_UTIL, ascodec_read(AS3517_USB_UTIL) | (1<<4)); sleep(10); //msleep(100) USB_GPIO_CSR = 0x6180000; @@ -199,7 +199,7 @@ void usb_drv_exit(void) VIC_INT_EN_CLEAR = INTERRUPT_USB; CGU_USB &= ~(1<<5); CGU_PERI &= ~CGU_USB_CLOCK_ENABLE; - ascodec_write(AS3514_USB_UTIL, ascodec_read(AS3514_USB_UTIL) & ~(1<<4)); + ascodec_write(AS3517_USB_UTIL, ascodec_read(AS3517_USB_UTIL) & ~(1<<4)); } int usb_drv_port_speed(void)