Rockbox Technical Forums

Support and General Use => Hardware => Topic started by: Avalon on October 15, 2009, 11:44:13 AM

Title: Fuze and Griffin Dock line out
Post by: Avalon on October 15, 2009, 11:44:13 AM
Hi,

I have an 8Gb Fuze V1 with 4Gb microsd installed and Rockboz is working great on it for mp3s.

I also have a Griffin dock with a line out that works great when in the sansa OS mode.  When I switch to Rockbox OS, I do not get an output on the line out.

Is there a setting to correct this, or does this require a firmware modification? 
Title: Re: Fuze and Griffin Dock line out
Post by: saratoga on October 15, 2009, 11:52:49 AM
You will need to add support for line out to the AMS audio driver.
Title: Re: Fuze and Griffin Dock line out
Post by: Avalon on November 01, 2009, 10:48:34 PM
I wish that I could write the code. 

When in the Fuze is connected to the dock, it automatically turns on in Sansa OS with the line out enabled.  If I hold the select button while inserting the Fuze in the dock, it stays in Rockbox mode, but the line out is not enabled.

This is not a selection in the OS, but looks like the line out is enabled when voltage is applied to the appropriate connector pins.  For those of us who connect the Fuze to stereo systems, etc, the use of the dock capability would be a great feature to have.

Is there any chance that this would be built into the Rockbox OS or Fuze build? 
Title: Re: Fuze and Griffin Dock line out
Post by: saratoga on November 01, 2009, 11:02:14 PM
I'm sure someone will figure it out eventually.  In the mean time if you want to make that more likely you could check the debug menu's "View IO Ports screen" and see if any of the GPIO pins change values when you plug/unplug the dock.  If they do, maybe whatever pin the dock flips is a GPIO pin.
Title: Re: Fuze and Griffin Dock line out
Post by: Avalon on November 03, 2009, 04:18:29 PM
First of all, thankyou very much for getting back to me.

I checked the View IO Ports Screen and found that the following changed:

Fuze not in dock:
GPIOA  = E2
DBOP_DIN=8843

FUZE docked:
GPIOA = EA (bit 4 change)
DBOP_DIN=8A43

Nothing else changed and this is consistently repeatable.

Does this mean that there is hope?

My guess is that in the FUZE OS, the line out is always enabled but requires the voltage to be applied for it to work.

If that is the case, then if the correct register is written to in the Rockbox startup to enable the line out, then the dock would work when the Fuze is attached.

I hope that this helps and thanks again for the response.
Title: Re: Fuze and Griffin Dock line out
Post by: mc2739 on November 03, 2009, 06:25:29 PM
Fuze not in dock:
GPIOA  = E2
DBOP_DIN=8843

FUZE docked:
GPIOA = EA (bit 4 change)
DBOP_DIN=8A43

The GPIOA change is actually bit 3 and is the bit we currently use to detect the attachment of the USB cable.  The DBOP_DIN bit is probably the one we need to look into further.  That bit does not change upon attachment of the USB cable (at least on the e200v2 - most likely the Fuze is the same).
Title: Re: Fuze and Griffin Dock line out
Post by: saratoga on November 03, 2009, 06:48:14 PM
First of all, thankyou very much for getting back to me.

I checked the View IO Ports Screen and found that the following changed:

Fuze not in dock:
GPIOA  = E2
DBOP_DIN=8843

FUZE docked:
GPIOA = EA (bit 4 change)
DBOP_DIN=8A43

Nothing else changed and this is consistently repeatable.

http://www.rockbox.org/wiki/SansaAMSHardwareMappings

According to that, GPIOA[3] is USB inserted.  Does your dock also have USB?  Does the pin change even when the USB cable isn't hooked up to a computer?


My guess is that in the FUZE OS, the line out is always enabled but requires the voltage to be applied for it to work.

If that is the case, then if the correct register is written to in the Rockbox startup to enable the line out, then the dock would work when the Fuze is attached.


Its disabled by default.  We can enable it, but without a way to detect that the dock is in theres no way to know when to enable it.

DBOP_DIN9 is unassigned currently.  Maybe thats how you tell if theres a USB or USB + dock. 
Title: Re: Fuze and Griffin Dock line out
Post by: kugel. on November 03, 2009, 06:56:13 PM
Interesting find. I'd like to know what the DBOP pin means exactly.


Just for the line out/Dock, I assume checking the GPIOA pin would be sufficient for enabling line out. Unless we cannot have headphones and lineout at the same time (?).
Title: Re: Fuze and Griffin Dock line out
Post by: Avalon on November 03, 2009, 10:47:38 PM
The griffin dock I have has a line out (to stereo) and a mini usb connector.  You can connect the usb to a computer or to a usb charger.

The description I gave of the pin change when connecting the Fuze was with the usb connected to a charger (120V to usb). 

When using the Sansa OS, when the Fuze is plugged into the dock, the Fuze turns on and the line out is enabled.  If the Fuze is already on in Sansa mode, when it is plugged into the dock, it stays powered up and again the line out works.  If the Fuze is in Rockbox mode and is plugged into the dock with the select button depressed, the Fuze stays in Rockbox mode, but the line out is not enabled.

It appears that the USB voltage is sensed and used to both turn on the Fuze in Sansa mode and enable the line out.

In Rockbox mode, the requirement would seem to be to sense the USB voltage and turn on the line out.  When the usb voltage is removed, to turn off the line out.  Perhaps, just permanently enabling it would be fine if that did not drain the battery.  The usb voltage I am referring to in this case is used for charging the Fuze.

I believe that this is the pinout for the Fuze connector:
1 - power
2 - power
3 - ground
4 - usb d+
5 - usb d-
6 - ground
7 - power via 47k resistor
13 - ground
18 - ground
20 - ground
27 - audio out right
28 - audio out left
29 - audio common

When pin 7 is pulled to +5V by the dock, the audio out lines are activated.  I understand that the external power source is required to drive the line outs.

Based on forum discussions, the Rockboxed E200 either activates the audio outs when inserted in the dock or the audi outs are permanently enabled.  I haven't confirmed this because I do not own an E200, but the dock pinout is compatible with Fuze and E200.

As a final note, the dock does not allow headphone use and line out at the same time since both connectors are on the bottom of the Fuze.  You cannot physically attach the Fuze to the dock with a headphone connector attached. 
Title: Re: Fuze and Griffin Dock line out
Post by: skinsman on November 16, 2009, 12:42:27 AM
Quote
"Based on forum discussions, the Rockboxed E200 either activates the audio outs when inserted in the dock or the audi outs are permanently enabled.  I haven't confirmed this because I do not own an E200, but the dock pinout is compatible with Fuze and E200."

I've got an e200v1 and an e200v2 (AMS) along with a couple of Griffin PowerDocks.  I've been using RockBox on the e200v1 for a while successfully with the dock - audio through the dock is active but is affected by the volume control.  Interestingly the audio works whether power is applied to the dock or not.  This is different to the original firmware which had audio unaffected by the volume control AND the audio works only when power is applied to the dock.

I've just tried RockBox on my e200v2 (AMS) and found audio through the dock doesn't work.  I guess that's to be expected given what you're seeing with the Fuze.  I hope a patch for this will be available soon!  Let me know if I can help with testing or whatever.
Title: Re: Fuze and Griffin Dock line out
Post by: Avalon on November 16, 2009, 09:42:22 AM
That is interesting and thankyou for the E200 input.

With the Sansa OS, the dock outputs constant levels unaffected by the Fuze volume control.  The level iappears to be much better than the Fuze headphone output for feeding into amplifiers, etc. and maintains the charge at 100%.

It looks as if the E200V2 and FuzeV1 behave similarly when connected to the dock.  Since the Sansa OS allows the dock to work, the hardware is there....a firmware mod is required.

If anyone has the coding ability to do it and has a look, there is a change that would be an improvement over the Sansa OS:

If the line out is enabled for the E200V2 and FuzeV1 via the Griffin Dock, it would be an improvement over the Sansa firmware if there is a selection for volume control via the Fuze/E200V2 or just constant line out.

If this was provided, the dock could be used for
1. constant level out for input to amplifiers, etc and
2. for headphone output with volume control if selected.

Both would allow charging while playing and provide the required output for both applications.  The latter would be great for using the dock in the office or any fixed setting.

I really hope that someone does pick this up and has a go at the code.

Thks
Title: Re: Fuze and Griffin Dock line out
Post by: Avalon on January 13, 2010, 06:06:42 AM
Regarding the questions regarding whether line out and headphone connectors can be enabled at the same time:

1.  When the Fuze is connected to a dock or computer USB, It is being charged and powered by an external source.  For that reason, there should be no drain on the battery and power consumption should not be a concern if both outputs are enabled. 

2.  It is my understanding that the line out and headphone out are two separate outputs.   If so, they do not affect each other if both are enabled.

For these reasons, it would seem logical that if the Fuze is connected to a USB or other power source, then both outputs could be enabled.  If not connected to an external power source, then only the headphone out would be enabled.

I am making this suggestion to hopefully reduce the complexity of any code changes.  if anyone knows of any reason why this would not work, please indicate.

In my case, when I use the Griffin dock, the headphone output is not accessible since it is located on the bottom of the Fuze and blocked by the base.  Therefore, if headphone out is enabled with the line out, there is no issue anyway.  However, if both outputs were accessible and enabled, I do not believe that it presents any problems since an external power source is applied anyway.
Title: Re: Fuze and Griffin Dock line out
Post by: gglul on March 03, 2010, 09:24:54 AM
Hi,

I have a Sansa E200v2. I tried to enable the Audio Line Out and the Speaker Out in the AS3525 by the firmware, but nothing appeared on pins 27, 28 & 29 of the dock connector.

I assume, we need to enable some GPIO / DBOP in order to activate some HW outside the AS3525 which will then make the audio towards the dock connector...

 :'(

Does anybody have a schematic of the sansa showing how the components are connected to each other and to the external interfaces?


Many Thanks,
Gglul
Title: Re: Fuze and Griffin Dock line out
Post by: saratoga on March 03, 2010, 01:45:23 PM
I assume, we need to enable some GPIO / DBOP in order to activate some HW outside the AS3525 which will then make the audio towards the dock connector...

I don't think theres anything else to activate.  Can you post a diff of what you enabled?

Does anybody have a schematic of the sansa showing how the components are connected to each other and to the external interfaces?

I guess you could take apart the player and use a DMM to figure out where the dock pins go, but I don't think anyone has.


Many Thanks,
Gglul
[/quote]
Title: Re: Fuze and Griffin Dock line out
Post by: gglul on March 03, 2010, 05:53:24 PM
Hi,

I found my mistake in my code which I put into the procedure:
Code: [Select]
void audiohw_mute(bool mute)When the Line Out is muted then I need to clear the LINE_OUT_L_LO_SES_DM_SE_ST bits and when it is not muted then I need to set them. However, I put this in the other way, so the Line Out was always muted...

Code: [Select]
void audiohw_mute(bool mute)
{
    if (mute) {
        as3514_set(AS3514_HPH_OUT_L, HPH_OUT_L_HP_MUTE);
        as3514_clear(AS3514_LINE_OUT_L, LINE_OUT_L_LO_SES_DM_SE_ST);
    } else {
        as3514_clear(AS3514_HPH_OUT_L, HPH_OUT_L_HP_MUTE);
        as3514_set(AS3514_LINE_OUT_L, LINE_OUT_L_LO_SES_DM_SE_ST);
    }
}

After correcting this in Patch-1 the Line Out just works fine!  ;)



Many Thanks,
Glgul


==========================

Hi,

I'm not so much an expert in patching, but here is what I have done.

The settings and register details of the Audio Line Out / Speaker Out can be found on page (129-130) / (134-137) & 148-149 of the technical description of the AS3525.

I downloaded the source code from SVN (R24777) and I identified the /firmware/drivers/audio/as3514.c as containing the procedures & functions to handle the audio settings (audio driver).

Here are the patches that I tried:

Patch-1:

Code: [Select]
Index: as3514.c
===================================================================
--- as3514.c (revision 24777)
+++ as3514.c (working copy)
@@ -151,8 +151,8 @@
 
     /* Set ADC off, mixer on, DAC on, line out off, line in off, mic off */
 
-    /* Turn on SUM, DAC */
-    as3514_write(AS3514_AUDIOSET1, AUDIOSET1_DAC_on | AUDIOSET1_SUM_on);
+    /* Turn on line out, DAC, SUM */
+    as3514_write(AS3514_AUDIOSET1, AUDIOSET1_LOUT_on | AUDIOSET1_DAC_on | AUDIOSET1_SUM_on);
 
     /* Set BIAS on, DITH on, AGC on, IBR_DAC max, LSP_LP on, IBR_LSP min */
     as3514_write(AS3514_AUDIOSET2,
@@ -250,6 +250,8 @@
 #endif
     as3514_write_masked(AS3514_HPH_OUT_R, hph_r, AS3514_VOL_MASK);
     as3514_write_masked(AS3514_HPH_OUT_L, hph_l, AS3514_VOL_MASK);
+    as3514_write_masked(AS3514_LINE_OUT_R, hph_r, AS3514_VOL_MASK);
+    as3514_write_masked(AS3514_LINE_OUT_L, hph_l, AS3514_VOL_MASK);
 }
 
 void audiohw_set_lineout_vol(int vol_l, int vol_r)
@@ -262,8 +264,10 @@
 {
     if (mute) {
         as3514_set(AS3514_HPH_OUT_L, HPH_OUT_L_HP_MUTE);
+        as3514_set(AS3514_LINE_OUT_L, LINE_OUT_L_LO_SES_DM_SE_ST);
     } else {
         as3514_clear(AS3514_HPH_OUT_L, HPH_OUT_L_HP_MUTE);
+        as3514_clear(AS3514_LINE_OUT_L, LINE_OUT_L_LO_SES_DM_SE_ST);
     }
 }
 

Patch-2:


Code: [Select]
Index: as3514.c
===================================================================
--- as3514.c (revision 24777)
+++ as3514.c (working copy)
@@ -151,8 +151,8 @@
 
     /* Set ADC off, mixer on, DAC on, line out off, line in off, mic off */
 
-    /* Turn on SUM, DAC */
-    as3514_write(AS3514_AUDIOSET1, AUDIOSET1_DAC_on | AUDIOSET1_SUM_on);
+    /* Turn on line out, DAC, SUM */
+    as3514_write(AS3514_AUDIOSET1, AUDIOSET1_LOUT_on | AUDIOSET1_DAC_on | AUDIOSET1_SUM_on);
 
     /* Set BIAS on, DITH on, AGC on, IBR_DAC max, LSP_LP on, IBR_LSP min */
     as3514_write(AS3514_AUDIOSET2,
@@ -170,9 +170,9 @@
     as3514_write(AS3514_AUDIOSET3, AUDIOSET3_HPCM_off);
 #endif
 
-    /* Mute and disable speaker */
+    /* Power up speaker stage & mute 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);
+    as3514_write(AS3514_LSP_OUT_L, LSP_OUT_L_SP_MUTE | LSP_OUT_L_SP_ON | 0x00);
 
     /* Set headphone over-current to 0, Min volume */
     as3514_write(AS3514_HPH_OUT_R,
@@ -250,6 +250,11 @@
 #endif
     as3514_write_masked(AS3514_HPH_OUT_R, hph_r, AS3514_VOL_MASK);
     as3514_write_masked(AS3514_HPH_OUT_L, hph_l, AS3514_VOL_MASK);
+//    as3514_write_masked(AS3514_LINE_OUT_R, hph_r, AS3514_VOL_MASK);
+//    as3514_write_masked(AS3514_LINE_OUT_L, hph_l, AS3514_VOL_MASK);
+    as3514_write_masked(AS3514_LSP_OUT_R, hph_r, AS3514_VOL_MASK);
+    as3514_write_masked(AS3514_LSP_OUT_L, hph_l, AS3514_VOL_MASK);
+
 }
 
 void audiohw_set_lineout_vol(int vol_l, int vol_r)
@@ -262,8 +267,12 @@
 {
     if (mute) {
         as3514_set(AS3514_HPH_OUT_L, HPH_OUT_L_HP_MUTE);
+//        as3514_set(AS3514_LINE_OUT_L, LINE_OUT_L_LO_SES_DM_SE_ST);
+ as3514_set(AS3514_LSP_OUT_L, LSP_OUT_L_SP_MUTE);
     } else {
         as3514_clear(AS3514_HPH_OUT_L, HPH_OUT_L_HP_MUTE);
+//        as3514_clear(AS3514_LINE_OUT_L, LINE_OUT_L_LO_SES_DM_SE_ST);
+        as3514_clear(AS3514_LSP_OUT_L, LSP_OUT_L_SP_MUTE);
     }
 }
 

Please, I would appreciate your feedback.

Many Thanks,
Gglul
Title: Re: Fuze and Griffin Dock line out
Post by: j8048188 on March 10, 2010, 09:51:30 AM
Ggul: If you post the working patch in Flyspray, it may be accepted.
I don't see any patches with any work done, so you should create a new one.
Best of luck!
Title: Re: Fuze and Griffin Dock line out
Post by: saratoga on March 10, 2010, 10:33:20 AM
Post the patch to FS (cleaned up and working since I have no way to test it) with your real name and I'll commit it then add you to the credits.

Edit:  Also would you be willing to test if DBOP_DIN pin method works for enabling line out with your dock?  Read pin 9 and use that to enable or disable power to the line out amplifier.  That way we won't waste power on the line out when its not being used.
Title: Re: Fuze and Griffin Dock line out
Post by: bertrik on March 10, 2010, 02:25:44 PM
It would be nice indeed if LINE OUT could be enabled only on with a dock attached.

Maybe we can use a mechanism similar to the headphones insertion detection to enable/disable LINE OUT?
Title: Re: Fuze and Griffin Dock line out
Post by: saratoga on March 11, 2010, 12:23:20 PM
The DBOP and GPIO pins change when a dock is inserted, so checking them should be enough. Although first I'd be happy with a working patch that just leaves it on all the time.
Title: Re: Fuze and Griffin Dock line out
Post by: sanmigel on May 05, 2010, 03:57:58 AM
Hi! Does any progress in line out on Fuze rockbox?
Title: Re: Fuze and Griffin Dock line out
Post by: saratoga on May 05, 2010, 05:21:18 PM
Hi! Does any progress in line out on Fuze rockbox?

I'm sure if theres progress, someone will mention it.
Title: Re: Fuze and Griffin Dock line out
Post by: orbidia on May 17, 2010, 03:26:20 AM
I could definately use line out from the fuze for a portable setup with an external amp and a diy line out cable.

It sounds like gglul figured it out and it works on the fuze v1 at least. I guess gglul's "patch 2" is the one to use.

Is this difficult to post to flyspray and get this in one of the builds? Sounds like the code is done and just waiting to be added...
Title: Re: Fuze and Griffin Dock line out
Post by: OldOne on June 28, 2010, 02:15:59 PM
There is a patch on flyspray to enable for E200v2 as well as Fuze v1. Work is being done  on the Fuze v2.  #11367

Link Below
http://www.rockbox.org/tracker/task/11367?project=1&type=4&order=dateopened&sort=desc
Title: Re: Fuze and Griffin Dock line out
Post by: mc2739 on June 28, 2010, 04:18:38 PM
Line out for the e200v2 is enabled as of r27162.  This should also work for the Fuzev1, but has not been tested.

Be sure to connect the dock after booting Rockbox. Connecting the dock with power off will boot into the OF.

For the c200v2 and Fuzev2 we still need to determine how to detect when the dock is connected.
Title: Re: Fuze and Griffin Dock line out
Post by: Avalon on June 29, 2010, 11:34:13 AM
I have tested on a Fuze V1 and it works! 

Many thanks to the developers.  This is a very useful feature.

I have found one problem which may be a setting I am not aware of.  My Fuze powers down while docked after about 10 minutes.  I have changed the idle timeout to off with no change.  Does anyone know why this is happening?  

A couple of observations:

1. As indicated, the Fuze must be in RockBox mode before connecting.

2. When the Fuze is connected it displays the "USB Keyboard Mode: Multimedia" message, pauses the current track and reverts to the main menu.  You must select "Resume Playback" to continue with the current track.
 
3. When connected to the dock, the Fuze appears to provide the true line out since there is no volume control at the Fuze.  I checked this by disconnecting the playing Fuze from the dock and connecting it to the dock output cable.  To get the same volume level, the Fuze volume had to be set to the 6dB maximum level. 

4. I could not check to see if the headphone output is enabled when connected to the dock because I have to remove the headphones to connect to the dock.  However, this is not a consideration for me since the dock keeps the Fuze fully charged. 

Thks again!!

Title: Re: Fuze and Griffin Dock line out
Post by: mc2739 on June 30, 2010, 06:39:55 PM
I have found one problem which may be a setting I am not aware of.  My Fuze powers down while docked after about 10 minutes.  I have changed the idle timeout to off with no change.  Does anyone know why this is happening?

I am not sure what is going on here.  This does not happen with my e200v2.  I have had it playing music through the dock connection and just sitting idle while connected for more than an hour each without shutting off.

One thing you might try is to reset your settings to default.  This can be done through the Settings -> Manage Settings menu.  You may want to save a copy of your .rockbox/config.cfg file so that you can restore your settings if the reset does not help.
Title: Re: Fuze and Griffin Dock line out
Post by: Avalon on July 01, 2010, 03:11:08 PM
I don't know what was going on either.

I reset the settings to default, selected the theme I use and put back my normal settings.....everything is working perfectly!

I ran the Fuze V1 in the dock for 3 hours and counting with no problems.

Thanks for the suggestion!
Title: Re: Fuze and Griffin Dock line out
Post by: Avalon on August 03, 2010, 07:48:13 AM
I recently installed the new boot firmware and r27578-100726 to check out the USB function.  It works great for connecting to my PC (XP)...thanks to the developers.  This greatly improves access to the Fuze.

Since the USB interface is now supported, is the docking modification discussed in this thread affected?

I am asking this because, it appears that my Fuze V1 does not work properly when powered down and inserted into the dock.  The following outlines what I have seen.

__________________________

If I connect to the dock (Griffin) with RockBox running, it works fine. 

If I connect while the Fuze is powered down, it boots up in RockBox mode as it should, but it will not resume playback.  If I try to select another album, the database initialization menu is displayed.  If I then disconnect from the dock the Fuze will resume playback, but the current playlist is corrupted (E**) and tracks are skipped.

It seems that by connecting to the dock, the fuze database access is corrupted in some way.

I found that this occurs when directory cache is enabled.  When I turn off directory cache, everything seems to work fine.  This is an inconvenience for me because the database initialization is much faster with directory cache enabled.

Has anyone else seen this....any comments?
Title: Re: Fuze and Griffin Dock line out
Post by: mc2739 on August 03, 2010, 06:41:49 PM
I am asking this because, it appears that my Fuze V1 does not work properly when powered down and inserted into the dock.

You need to download the latest version of mkamsboot (v1.4) and the latest bootloader (v2.0 for the Fuze v1).  The links to the files and the installation instructions can be found on the SansaAMS (http://www.rockbox.org/wiki/SansaAMS) wiki page in the Manual installation section.
Title: Re: Fuze and Griffin Dock line out
Post by: Avalon on August 04, 2010, 09:10:39 AM
Perhaps I was not clear.  As I indicated, I have installed the new boot firmware as of July 31, 2010.  I don't know what version of mkamsboot or the bootloader, but both were downloaded from the SansaAMS wiki page on July 31, 2010.  I used these to generate the new boot firmware.

I went back over some older posts and found the suggestion to clear the config file to reset it.  I did that and the problem is fixed.

Thanks for the feedback.

Title: Re: Fuze and Griffin Dock line out
Post by: Avalon on August 17, 2010, 05:54:49 PM
Just an update on the Fuze V1 used with the Griffin Dock.

I have used it extensively and as far as I can tell, it works perfectly!!!

The only difference with the E200 series is that the Fuze V1 outputs a constant line out level independent of volume adjustment while the E200 series output changes with volume adjustment.  Since Griffin Sansa Docks (without remote) can be picked up for under $10, this is really very convenient for inputting to stereos and other amplifiers.

This is a great feature and I would like to thank all who contributed.
Title: Re: Fuze and Griffin Dock line out
Post by: gurenko on August 17, 2010, 06:36:31 PM
Hi!
there are any news about dock line out for fuze v2 in rockbox?
thank you.
Title: Re: Fuze and Griffin Dock line out
Post by: mc2739 on August 17, 2010, 07:11:46 PM
The only difference with the E200 series is that the Fuze V1 outputs a constant line out level independent of volume adjustment while the E200 series output changes with volume adjustment. 

Thus is true only with the e200v1.  The e200v2 has a constant line out level.


Hi!
there are any news about dock line out for fuze v2 in rockbox?
thank you.

Before support for the Fuze v2 can be added, it needs to be determined how to detect a dock attachment.  This is necessary on the Fuze v2 since the headphones need to be disabled so that the line out can be enabled.
Title: Re: Fuze and Griffin Dock line out
Post by: gurenko on August 19, 2010, 03:47:45 AM
hi!
and there's not possible a manual option for disable headphone and enable dock line out?
it would be a temporaly solution during determinating how to detect dock attachment.

thanks.
Title: Re: Fuze and Griffin Dock line out
Post by: saratoga on August 19, 2010, 02:27:17 PM
hi!
and there's not possible a manual option for disable headphone and enable dock line out?
it would be a temporaly solution during determinating how to detect dock attachment.

Its probably not much more or less effort to just figure out how the OF detects the line out.  But if you want to take a shot at it, go for it.
Title: Re: Fuze and Griffin Dock line out
Post by: Avalon on August 19, 2010, 04:36:07 PM
Hi, I'm not a developer, but at the beginning of this subject post, I provided the bit changes via the View IO Ports Screen for GPIOA  and DBOP_DIN. 

It was very easy to check these with the Fuze V1 in the dock and out.  If that helped in establishing the code for the Fuze V1, then the same may be true for the V2. 

If one of the software gurus could offer some advice here, you may be able to move this along.  The code is written for the V1, so the V2 may not require as great a modification.  I don't have a V2, so I can't help.
Title: Re: Fuze and Griffin Dock line out
Post by: ccfreak2k on September 19, 2010, 12:38:14 AM
Hi!
there are any news about dock line out for fuze v2 in rockbox?
thank you.

Before support for the Fuze v2 can be added, it needs to be determined how to detect a dock attachment.  This is necessary on the Fuze v2 since the headphones need to be disabled so that the line out can be enabled.
It seems to me that the easiest way to do this is to enable it when power is applied since it's likely that if the user wants line-level audio they'll have a powered dock. The actual enable could be delayed while Rockbox figures out if it's a real USB connection or just power. The only problem case I can think of is if line-level audio is desired without power available.

EDIT: I have a Fuze v2, so I can offer some help here.
Title: Re: Fuze and Griffin Dock line out
Post by: funman on September 19, 2010, 01:12:34 AM
Read the post above yours and report the changes you see in View IO Ports screen (in debug menu) when plugging a dock
Title: Re: Fuze and Griffin Dock line out
Post by: ccfreak2k on September 19, 2010, 01:37:49 AM
Read the post above yours and report the changes you see in View IO Ports screen (in debug menu) when plugging a dock
Did just that earlier:

Unplugged:

Code: [Select]
GPIOA: A5/65/25/E5 DIR: 21
GPIOB: FE          DIR: 3F
GPIOC: 00          DIR: 00
GPIOD: 9F          DIR: 00

[CP15]
CP15: 0x0005107D

Plugged USB:

Code: [Select]
GPIOA: AD/6D/2D/ED DIR: 21
GPIOB: FE          DIR: 3F
GPIOC: 00          DIR: 00
GPIOD: 9F          DIR: 00

[CP15]
CP15: 0x0005107D

Plugged Wall:

Code: [Select]
GPIOA: AD/6D/2D/ED DIR: 21
GPIOB: FE          DIR: 3F
GPIOC: 00          DIR: 00
GPIOD: 9F          DIR: 00

[CP15]
CP15: 0x0005107D

GPIOA bit 3 is high when power is applied, and bits 6/7 of GPIOA changed based on scrollwheel movement, but I don't know the pattern. Everything else doesn't seem to change at all. As for DBOP, I couldn't find any references to it.

EDIT: I should probably point out that the "dock" I have in my car (which works as expected in OF) doesn't have any values other than those for USB/wall.
Title: Re: Fuze and Griffin Dock line out
Post by: saratoga on September 19, 2010, 02:29:43 AM
Read the post above yours and report the changes you see in View IO Ports screen (in debug menu) when plugging a dock
Did just that earlier:

Unplugged:

Code: [Select]
GPIOA: A5/65/25/E5 DIR: 21
GPIOB: FE          DIR: 3F
GPIOC: 00          DIR: 00
GPIOD: 9F          DIR: 00

[CP15]
CP15: 0x0005107D

Plugged USB:

Code: [Select]
GPIOA: AD/6D/2D/ED DIR: 21
GPIOB: FE          DIR: 3F
GPIOC: 00          DIR: 00
GPIOD: 9F          DIR: 00

[CP15]
CP15: 0x0005107D

Plugged Wall:

Code: [Select]
GPIOA: AD/6D/2D/ED DIR: 21
GPIOB: FE          DIR: 3F
GPIOC: 00          DIR: 00
GPIOD: 9F          DIR: 00

[CP15]
CP15: 0x0005107D

GPIOA bit 3 is high when power is applied, and bits 6/7 of GPIOA changed based on scrollwheel movement, but I don't know the pattern. Everything else doesn't seem to change at all. As for DBOP, I couldn't find any references to it.


This is in line with what other people have reported, so my guess is that some other pin is used to detect the dock connection (perhaps over DBOP which i believe is currently thought to be unused on the fuzev2?).  Unfortunately, whatever pin it is, we apparently do not print it on the debug screen, so it'll take a bit more work for someone to find it. 
Title: Re: Fuze and Griffin Dock line out
Post by: funman on September 19, 2010, 02:56:57 AM
Currently we don't read on DBOP because all the buttons can be read on GPIO but it should work easily.

Unfortunately I don't have my fuzev2 to test.

ccfreak2k can you make your own build and try patches?

EDIT: when you plug the dock, is the charging icon present?
Title: Re: Fuze and Griffin Dock line out
Post by: ccfreak2k on September 19, 2010, 03:42:17 AM
ccfreak2k can you make your own build and try patches?
I don't have the toolchain installed on any of my computers. Will the VMWare image work?

EDIT: Tried VMWare image, didn't work, presumably because of the switch to EABI that happened at some point.

EDIT: when you plug the dock, is the charging icon present?
Charge icon does appear when plugged in.
Title: Re: Fuze and Griffin Dock line out
Post by: saratoga on September 19, 2010, 01:09:22 PM
EDIT: Tried VMWare image, didn't work, presumably because of the switch to EABI that happened at some point.

If you run 'sudo tools/rockboxdev.sh' from the root of your source code check out it should upgrade your image to EABI.
Title: Re: Fuze and Griffin Dock line out
Post by: ccfreak2k on September 19, 2010, 07:22:32 PM
Looks like the virtual machine ran out of space while compiling the toolchain, so I'm going to just use my Slackware box for compiles. Set up a seperate user with its own copy of the toolchain and made what seems to be a working build, so I should be all set.
Title: Re: Fuze and Griffin Dock line out
Post by: hynpin on March 09, 2011, 12:30:25 PM
Found out that:

LOD for FUZE has got jumper between pin #7 and #22.
Line-out is activated by 3V on pin #7.

Hope this will help  ;)
Title: Re: Fuze and Griffin Dock line out
Post by: saratoga on March 09, 2011, 12:35:05 PM
Found out that:

LOD for FUZE has got jumper between pin #7 and #22.
Line-out is activated by 3V on pin #7.

Hope this will help  ;)

This thread is actually about how to detect that jumper.  

Edit:  see this post:  http://forums.rockbox.org/index.php/topic,22942.msg157862.html#msg157862
Title: Re: Fuze and Griffin Dock line out
Post by: bilditup1 on March 09, 2011, 06:16:42 PM
'Unfortunately, whatever pin it is, we apparently do not print it on the debug screen, so it'll take a bit more work for someone to find it.'

How can this be done? How do you know how to display a pin whose name you don't know/cannot see? I'll try to look at it later tonight (though I have no experience with rb development).
Title: Re: Fuze and Griffin Dock line out
Post by: soap on March 18, 2011, 12:23:53 PM
How can this be done? How do you know how to display a pin whose name you don't know/cannot see? I'll try to look at it later tonight (though I have no experience with rb development).

Perhaps come onto IRC (we offer a web-client) and talk to funman about it.  Last he posted in this thread he said he did not have a fuze on hand but was willing to offer a patch to add to the debug screen.  ccfreak2k appeared to be willing to take him up on that, but has not come back with a working build environment.  Perhaps you could get with funman, and build some test builds to:  A - get the debug screen showing what needs showed, and B - find out if indeed the line-out dock can be detected.

EDIT:
funman is not in IRC very often.  ;)  Try expressing interest and intent in the thread. 
Title: Re: Fuze and Griffin Dock line out
Post by: tenfoot on March 21, 2011, 09:16:29 AM
I've got a fuze v2 that I'd like to get working with line out and I have a build environment for testing patches etc so I'm willing to test the extra debug info.

I've been using a custom patch to enable the line out when the volume's turned to the max setting, but keep getting deafened as I switch between the two modes!  I'll post it here if anyone's interested
Title: Re: Fuze and Griffin Dock line out
Post by: psgarcha92 on March 22, 2011, 07:26:59 AM
Post it, ofcourse.
its working with the Fuze v2 right?
hell yeah post it.
Title: Re: Fuze and Griffin Dock line out
Post by: tenfoot on March 24, 2011, 04:25:28 PM
Here's my patch.  It's by no means the correct solution for this, but it works for me...
Title: Re: Fuze and Griffin Dock line out
Post by: Chronon on March 24, 2011, 04:29:36 PM
Thank you, but it would be much better to put it on the tracker. 
Title: Re: Fuze and Griffin Dock line out
Post by: tenfoot on April 19, 2011, 04:31:49 PM
I've put an updated version of this patch on the tracker at: http://www.rockbox.org/tracker/task/12074

Instead of using the max volume setting to enable the lineout, I've added a lineout setting - this can be added to the quickscreen so it's quite easy to switch between headphones and lineout.

I decided to change from the max volume setting as you get a loud burst when switching back to headphone mode before you can get back to a sane level.  Also I found I kept knocking it off lineout mode when changing tracks.
Title: Re: Fuze and Griffin Dock line out
Post by: bertrik on April 19, 2011, 04:57:50 PM
From a technical point of view, I think we should use a system message to be picked up by the default event handler in apps/misc.c when a dock gets connected or disconnected. Something like either a SYS_DOCK_CONNECTION message, with an associated boolean data item that indicates connection or disconnection, or alternatively two messages (SYS_DOCK_CONNECTED and SYS_DOCK_DISCONNECTED). This is analogous to how we handle headphone detection and charger detection.
For the fuze v1, we could detect dock (dis)connection in the button handler interrupt.
After catching SYS_DOCK_CONNECTION could we could then poke the audio hardware to set the proper audio routing and set volumes appropriately through one or more audiohw_XXX calls.
Title: Re: Fuze and Griffin Dock line out
Post by: zenki on April 21, 2011, 02:32:18 AM
Thanks for the update..
by the way I noticed from the last patch, that although this enables lineout in RB, the output volume to my amp is lower than the official FW.

Perhaps it's related to the volume scale of RB?
Anyway, the difference may be small but it makes me think the lineout from RB is not exactly the full output that the Fuze can handle..
Title: Re: Fuze and Griffin Dock line out
Post by: ardeeon on April 22, 2011, 09:33:23 PM
with this kind of patches, is it safe to say that we will see Line-Out to be fully supported on fuze v2?
Title: Re: Fuze and Griffin Dock line out
Post by: moxill on October 25, 2011, 10:10:50 PM
I just want to pass on a big up to tenfoot, you made me a very happy camper.  I can now hook my fuze up to my SET amp.  The sound from my sansa(s) is really clean, I can forget the usb dac for a while.

It took me a few minutes to find the LO setting:
Settings>General Settings>System>Line Out
And yes there is a little popping when toggling between on/off, so probs best not to do that live.
I made a DIY line out so I can fit both headphones and the LO cable at the same time.  I can confirm this patch shunts the headphone volume for those that were curious / concerned about battery life. 

Fuze/Clip + Yuin PK3 is still by far the cheapest ticket to audio nirvana, but now I can drive my Grados with my headphone amp using Rockbox in all its gapless glory.  This patch seals the deal, time to invest in a new fuze, the battery in mine is about cooked.
Title: Re: Fuze and Griffin Dock line out
Post by: esm on December 02, 2011, 09:48:00 PM
Quote
Unfortunately, whatever pin it is, we apparently do not print it on the debug screen, so it'll take a bit more work for someone to find it. 

Hi. Rockbox newbie here. I just bought a Fuze v2 + Griffin iTrip car adapter, and discovered this problem. tenfoot's lineout patch helps, but not quite enough. I would like Rockbox to automatically detect, on powerup, that it is connected to a car adapter (not a USB host) and that it should 1) boot itself, not the original FW, and 2) enable lineout automatically.

Working with the source and the 1.13 revision of the AS3525 datasheet, I've instrumented debug-as3525.c to print what I thought were some likely candidates: ENRD0-2, some USB_[IO]EP[0-3]_{CTRL,STS}, GPIO[A-D]_IS and _MIS. No joy. ENRD0 flips from 0x00 to 0x28 when plugged in to the Griffin, as expected, but that's indistinguishable from computer USB.

Can anyone suggest other registers to monitor? Other things to try? I am highly motivated to fix this. Thanks in advance.
Title: Re: Fuze and Griffin Dock line out
Post by: saratoga on December 03, 2011, 01:30:18 PM
Booting into the original firmware is actually by design since USB is very unstable in rockbox on your player.you can disable that by editing mkamsboot and flashing a new bootloader. Be careful though a bad flash will brick your player.

Regarding line out, I always thought it was detrctedbby one of the dbop in pins like the buttons and wheel on the first fuze.
Title: Re: Fuze and Griffin Dock line out
Post by: esm on December 03, 2011, 02:21:38 PM
Booting into the original firmware is actually by design since USB is very unstable in rockbox on your player.

Understood. To clarify my earlier post, I don't necessarily want to boot in USB mass storage mode. I want Rockbox to detect the car adapter. I.e. "I sense USB (bit 3). Now: if connected to computer, boot into original FW (current behavior). If connected to car adapter, boot into Rockbox (music mode, not USB mode) and enable line out".

Quote
Regarding line out, I always thought it was detected by one of the dbop in pins

Will check those as soon as I have time. Thanks for the suggestion.
Title: Re: Fuze and Griffin Dock line out
Post by: saratoga on December 03, 2011, 04:22:39 PM
Booting into the original firmware is actually by design since USB is very unstable in rockbox on your player.

Understood. To clarify my earlier post, I don't necessarily want to boot in USB mass storage mode. I want Rockbox to detect the car adapter.

I don't think its possible to detect if its a charger or USB at that point. We're basically just patching the sandisk bootloader, so we have no hope of getting the USB controller working and checking if anything is listening on the wire.   Once USB is working, this won't matter though, since we'll always boot into rockbox.  On the Fuze v1 car adapter mode works fine for this reason.

Quote
Regarding line out, I always thought it was detected by one of the dbop in pins

Will check those as soon as I have time. Thanks for the suggestion.

FWIW I don't remember if we have the fuzev2 setup to read from DBOP, but the fuze v1 does, so you could probably look at that.  ITs not the same processor, but fairly similar. 
Title: Re: Fuze and Griffin Dock line out
Post by: esm on December 03, 2011, 04:49:43 PM
I don't think its possible to detect if its a charger or USB at that point. [...] we have no hope of getting the USB controller working and checking if anything is listening on the wire.

Oh. I interpret that as: the difference between the car adapter plug and the Fuze-to-computer plug is a protocol one, not a difference in the connectors themselves. Is that the case?
Title: Re: Fuze and Griffin Dock line out
Post by: saratoga on December 03, 2011, 05:05:24 PM
I don't think its possible to detect if its a charger or USB at that point. [...] we have no hope of getting the USB controller working and checking if anything is listening on the wire.

Oh. I interpret that as: the difference between the car adapter plug and the Fuze-to-computer plug is a protocol one, not a difference in the connectors themselves. Is that the case?

I think all you have is a GPIO pin on the power supply line, and the USB controller.  So short of powering up the USB controller and checking to see if its errored out while connecting, theres no good way to figure out if a voltage on the power line is from a charger or an actual USB host.

(At least I'm pretty sure.  Its possible theres some way to get the usb controller or PMU ADC to measure an impedance or something across the USB data lines, but I don't recall seeing anything about that.  Even if there is you probably can't safely access them from within the sandisk bootloader)
Title: Re: Fuze and Griffin Dock line out
Post by: esm on December 03, 2011, 05:28:32 PM
[...] So short of powering up the USB controller and checking to see if its errored out while connecting, theres no good way to figure out if a voltage on the power line is from a charger or an actual USB host.

Foo. Okay... sounds like I was on a wild-goose chase. Thank you for setting me straight. I'll read up on the USB patch thread, see if there's something I can test or help with there.
Title: Re: Fuze and Griffin Dock line out
Post by: saratoga on December 03, 2011, 05:31:10 PM
[...] So short of powering up the USB controller and checking to see if its errored out while connecting, theres no good way to figure out if a voltage on the power line is from a charger or an actual USB host.

Foo. Okay... sounds like I was on a wild-goose chase. Thank you for setting me straight. I'll read up on the USB patch thread, see if there's something I can test or help with there.

If you just want to use that adapter, its probably enough to disable booting to the OF on USB insertion (you can still do it manually with the button key), and then apply that patch to force line out on all the time. 

That said if you're interested in figuring out how to autodetect line out, that would be great too.
Title: Re: Fuze and Griffin Dock line out
Post by: esm on December 07, 2011, 09:14:51 PM
New datapoint. I built r31159 + USB enabled (manually in sansafuzev2.h) + lineout patch. Here is the promising behavior I notice:


tenfoot's wonderful lineout patch works, sort of: it does not seem to survive a restart (the Yes setting does, but actual lineout functionality does not) so there's no actual sound until I navigate to Settings > General Settings > System > Line Out and then press Select ("Yes" is already highlighted). I think it should be possible to enable/disable Line Out by sensing USB. I hope to look into that this weekend as time allows.
Title: Re: Fuze and Griffin Dock line out
Post by: saratoga on December 07, 2011, 09:31:51 PM
Just checking for external power will mess up charging during playback (i.e with an AC adapter).

Edit:  I guess that might be good enough for you though if you just want to hack together car mode.
Title: Re: Fuze and Griffin Dock line out
Post by: esm on December 22, 2011, 10:45:27 AM
Just checking for external power will mess up charging during playback [...] I guess that might be good enough for you though.

For my purposes, it is. But it obviously isn't acceptable for production code.

I'm still willing and able to fiddle with this thing, build/test custom images, to try to get this working properly. It's just that I'm out of ideas on what to check for.
Title: Re: Fuze and Griffin Dock line out
Post by: chyron8472 on May 11, 2012, 07:50:02 PM
sorry to necro, but is there a recent update on this?

I purchased iTrip Auto for my Fuze, and it works fine with OF but there is no sound with Rockbox.


I have Rockbox v.3.11.2 with a Fuze v2; OF v.2.03.33a

EDIT: oddly enough, my wife's rockboxed Fuze works fine and it's a v1 (OF v.1.02.31a) with Rockbox 3.9.1



Why doesn't my rockboxed v2 work?
Title: Re: Fuze and Griffin Dock line out
Post by: saratoga on May 11, 2012, 09:55:45 PM
sorry to necro, but is there a recent update on this?

I purchased iTrip Auto for my Fuze, and it works fine with OF but there is no sound with Rockbox.


I have Rockbox v.3.11.2 with a Fuze v2; OF v.2.03.33a

EDIT: oddly enough, my wife's rockboxed Fuze works fine and it's a v1 (OF v.1.02.31a) with Rockbox 3.9.1



Why doesn't my rockboxed v2 work?

The thing being discussed in this thread is how to make it work on the fuze v2.