Commit graph

11040 commits

Author SHA1 Message Date
Solomon Peachy
3ba2f6e5c7 Nuke all TCC77x targets: iAudio 7, Sansa C100, M200(v1-3), Logik DAX
They were never finished, never saw any release ever, and haven't
compiled for the better part of a decade.  Given their HW capabilities [1],
they are not worth trying to fix.

[1] 1-2MB RAM, ~256MB onboard flash, no expandability

Change-Id: I7b2a5806d687114c22156bb0458d4a10a9734190
2021-04-26 07:41:51 -04:00
Aidan MacDonald
77188e41f5 X1000: remove bogus GPIO Z mutex
There's absolutely no way for gpio_config() to get called from two
different threads due to the co-operative threading model, and it
is unsafe to call from IRQ context no matter what we do.

Change-Id: I58f7d1f68c7a414610bb020e26b774cb1015a3b0
2021-04-25 14:27:35 +00:00
Aidan MacDonald
a2dfafb2b2 X1000: disable SFC DMA
Change-Id: Ia33896b4a19da6eaaf3e5c057891ab10d75f31e1
2021-04-25 14:16:12 +00:00
Aidan MacDonald
d6220f618b MIPS: emulate -ffunction-sections with macros in mmu-mips
Using a macro to put each function in its own .icode-based section
allows us to put the functions in IRAM _and_ have linker GC. This
removes a troublesome #ifdef BOOTLOADER_SPL on the X1000 target.

Change-Id: Ia7b59778f5c36b7970dee4280547e434a1f4fc5a
2021-04-25 14:04:38 +00:00
Solomon Peachy
aab72f969f ata: Rework power management behavior a bit
After continued reports of corruption using iFlash adapters, I went
digging for more clues, and this combination of changes seemed to
solve data corruption with the iFlash adapters on the ipod video:

 1) Instead of SLEEP, use STANDBY_IMMEDIATE when we detect drive
    as an SSD or CFA-compliant device.  The latter is technically higher
    power than the former, but what this means in practice is unclear.
 2) Don't check ATA powermanagement flag prior to issuing powermgmt
    commands. This reverts the previous "workaround" for the FC1307A --
    and PM is a mandatory part of the ATA spec for any CFA device.
 3) Prior to issuing SLEEP/STANDBY_IMMEDIATE, issue FLUSH CACHE.  The
    ATA spec says this is redundant for the latter, but says nothing
    about the former.  Either way it is always safe to call first.
 4) Delete all other FC1307A_WORKAROUND code related to powermgmt flags.

Change-Id: I492d06664c097d9bbd5cccfb9f5b516da165b1ee
2021-04-23 13:07:45 +00:00
Aidan MacDonald
79d1b68fe2 FiiO M3K: disable USB DMA
Although data transfer is reliable with DMA, it seems to cause hangs
and lockups during the early stages of connection and it's not clear
what the cause might be.

Change-Id: I9a83089c31d28309f0534dcdedf3c8c8348e6e3d
2021-04-23 00:30:52 +01:00
Aidan MacDonald
75cb8ba8a4 FiiO M3K/X1000: add USB support
This only required a minor patch to the usb-designware driver due
to DMA requiring physical addresses -- on the X1000, these differ
from virtual addresses so we have to do the usual conversion.

Both the mass storage and HID drivers work, but there are a few
issues so this can't be considered 100% stable yet.

- Mass storage might not be detected properly on insertion,
  and USB has to be replugged before it shows up
- HID driver may occasionally panic or hang the machine

Change-Id: Ia3ce7591d5928ec7cbca7953abfef01bdbd873ef
2021-04-21 18:31:55 +00:00
Aidan MacDonald
088ebb5fac Minor enhancements to axp173 driver
- Added register names to reduce usage of magic numbers
- Added function to control max charging current, needed for USB
- Corrected comment about axp173, since FiiO M3K has an axp192

Change-Id: I6604ce8d44e5a2ee84061cf042d17ccc4734ac57
2021-04-21 18:31:55 +00:00
Aidan MacDonald
9313274302 FiiO M3K: fix LCD weirdness when booting via RoLo
Change-Id: I2234a0d1b3095adbcca0bbd060fd5a7e13a895c1
2021-04-21 19:10:34 +01:00
Aidan MacDonald
c71a47f649 Move usb-designware out of ARM target tree
Change-Id: Ic981737976655596ea622b7b4d15a2d841bd993d
2021-04-18 18:45:28 +01:00
Aidan MacDonald
92140752d7 FiiO M3K: disable CPU frequency switching
After conducting some simplistic tests, I found that the power usage
did not appear to be affected by the CPU frequency.

I tested by playing back a 44.1 KHz FLAC file on single track repeat,
and measured current with the AXP173's battery discharge current ADC.
The button and LCD backlights were set to always on. Headphones were
unplugged and the volume was muted to eliminate any influence from
the headphone amp.

On average the current usage was between 78-81 mA at 1008 MHz, 252 MHz,
and 112 MHz. If anything, 1008 MHz drew _less_ current than the lower
frequencies, by about 1-3 mA.

A possible explanation for this, assuming it's not just a bias of the
test, is that the CPU idle state saves so much power that it's better
to maximize the real time that the CPU spends idling. More systematic
testing is needed to confirm this.

Change-Id: I527473e8c4c12bc1e94f8d4e849fecc108022abe
2021-04-17 20:24:36 +00:00
Aidan MacDonald
fceffb7d4a x1000: disable CPU idle stats by default
There's no point including this in normal builds: the stats are not
used for anything, they are not really of interest to anyone except
developers, and add a small overhead to the kernel tick.

Change-Id: I1b4f67cc62d11d634a8cec279dca513dd10eea96
2021-04-17 20:24:21 +00:00
Aidan MacDonald
01d1eb4258 FiiO M3K/X1000: Do system clock initialization in the SPL
Initializing the clocks in the SPL brings Rockbox in line with
how the FiiO M3K's original SPL works. It's likely other X1000
devices do this too.

There was a logic error in the previous setup: the code falsely
assumed that DDR memory would always be running from MPLL, but
it would be switched to APLL by the bootloader. Rockbox would
then try to re-init APLL, albeit with the same parameters. Maybe
this was the cause of the boot hang on some units.

Change-Id: I64064585e491bbdf1e95fe9428c91a9314f2a917
2021-04-17 20:24:07 +00:00
Aidan MacDonald
e123c5d2f2 x1000: don't reset all GPIOs at boot
What we really want is to avoid any interrupts being generated
before the drivers which handle them are properly initialized.
Intead of trashing all GPIOs, search for the problem pins and
fix them, leaving the others alone.

This fixes the M3K's button light flickering on boot and should
stop the M3K from entering a potentially confusing "dead" state
where all the lights are off but the CPU is still on.

Change-Id: I13a6da0f0950190396bff5d6e8c343c668e8fea1
2021-04-17 20:23:47 +00:00
Aidan MacDonald
1b8542490d x1000: Redesign SPL, and allow it to flash the bootloader
SPL is now designed so core X1000 code is in control of the boot,
under the reasonable assumption that the device boots from flash.
It should not be too hard to adapt to other X1000 ports.

The biggest functional change is that the SPL can now read/write
the flash, under the control of a host computer. The SPL relies
on the boot ROM for USB communication, so the host has to execute
the SPL multiple times following a protocol.

Change-Id: I3ffaa00e4bf191e043c9df0e2e64d15193ff42c9
2021-04-17 20:22:49 +00:00
William Wilgus
85fbbd9c7f 16 bit lcd_mono_bitmap
'Bugfix' mono_bitmap_part reads ahead in the buffer,
if the height is <= char bit pixels other memory gets read

Change-Id: I6e0d7a9017e1f9c371ffbd56af149ac20cb82341
2021-04-17 15:33:58 +00:00
Dana Conrad
4dc602dd7f erosq: Tweak volume scale to be approximately correct
Tested on eros q, everything measured from line out,
open circuit.

- volume steps were approximately double the dB they
  were labelled as, so "-2 dB" would result in a change
  of about -4 dB from maximum (0, +6.2dBV)
- maximum volume defining the line out volume only
  changed every 10 values, and then was not close
  to correct- "-10 dB" resulted in -2.5 dB from maximum

This gets the volume dB approximately correct, and
maximum volume correctly sets the line out volume.
I was unable to get odd values in the max volume
to work, so set the step size to 2 instead of one.

For "consumer level" (-10dBV), set to -16.
For "Pro level" (+4dBu -> ~1.8dBV), set to -4.

Change-Id: I898b85d768153579a893b23551019af88f865d21
2021-04-17 12:09:19 +00:00
Solomon Peachy
42dba708e3 hosted: Don't open alsa control device directly
It was just being used as a proxy "yeah, we called hw_init()" so
just use a flag for that directly.

affects rocker, erosq, xduoo x3ii/x20, and fiiom3klinux

Change-Id: I14bd9f8d91f1d6cc8de0982a7426e2a103c6bfce
2021-04-14 01:39:57 +00:00
Solomon Peachy
ec4b5c794e ibasso: Found a reliable way to determine if SD card is present at startup
Change-Id: If02788a50e141cc2e5b1a6cde2df2a5ef5713e30
2021-04-13 14:28:30 +00:00
Solomon Peachy
c0a49d9bdf ibasso: Default to assuming the external SD card is inserted
Detection at startup is proving to be unreliable.  Even if card is not
present at startup, upon insertion it will sort itself out properly.

Change-Id: I9ee90b724c90c530a39264f698c200a48aa72b1d
2021-04-12 21:54:59 +00:00
Solomon Peachy
b6fce99046 ibasso: Implement proper PIVOT_ROOT filesystem access
Including direct use of the external SD card mount

Known issue:  If SD card is inserted at startup, it must be
              ejected and reinserted to be registered.

Change-Id: I5f420160bda32135cbb088c1e8b04b6e3a73018e
2021-04-12 18:19:06 +00:00
Solomon Peachy
bc416ff590 misc: Only include rbpaths.h and string-extra.h in places that need it
(Don't include rbpaths.h in settings.h, or string-extra.h in rbpaths.h)

Build-tested on rocker, erosq, mini2g, nano2g,
                xduoox3, clipzip, dx50, and uisim

Change-Id: If32e9c9910f5c8247a655cb64522b84d6d7ccbb5
2021-04-10 12:08:12 -04:00
Solomon Peachy
1303be3437 ibasso: Get rid of #include "settings.h" in the button code
(It mucks with paths causing the input device open to fail)

Change-Id: I1e8a63d09c229ed9bacbd599a7869e875df21fd2
2021-04-10 10:25:20 -04:00
James Buren
448f98d9c0 pp: fix adc mistake where base 10 was used instead of base 16
Change-Id: I8562af8a11a22cd9edec149b2519ac0205d2b2dc
2021-04-10 01:13:09 +00:00
Solomon Peachy
13dbcab6c0 erosq: When mucking with the clickwheel, ensure we keep the screen awake!
Change-Id: I49d39f301f4b44c2477a657e2af964b97d73cf6b
2021-04-09 19:21:02 -04:00
Solomon Peachy
cd64aa2b10 xduoox3: Global volume_limit now applies to the line output as well
The X3's line out is a bit hot, at ~4.3Vpp, so allow it to be backed off.

(On my X3, backing it off to -6dB brings Vpp down to ~3.4V)

Change-Id: Iea38ef1c6a1b183d0f8fb4eaf2bf9ed6b350a532
2021-04-09 15:54:04 -04:00
Aidan MacDonald
c0a823e2ab x1000: Trim unused cache functions from the SPL build
Change-Id: Ib645d8ff10cfc672de8ac2debaa17d7dd50dfafb
2021-04-09 10:53:36 +00:00
Aidan MacDonald
54b8e9131c Revert "sound: add sound_numdecimals() to round out the sound setting query API"
There is already a sound_numdecimals() function, according to Git
it's been around since 2005. No need to add another one :).

This reverts commit 92a0ab8789.

Change-Id: I533ebf1763dd7a27346842982493d4550f05ad7c
2021-04-09 10:52:02 +00:00
Solomon Peachy
1e2a9a651c erosq: Switch to 32-bit PCM output, and do volume scaling in driver
Should improve audio output quality, especially at lower volumes.

Change-Id: I31c38f05fe4b554b092511f0fe7aaad9f346f6c5
2021-04-08 23:58:49 -04:00
Solomon Peachy
e86d90905b alsa: Fix an #ifdef typo in 54fcb907c1
HAE_ALSA_32BIT -> HAVE_ALSA_32BIT

Change-Id: Icf375d42f6b20e8393b6ffe6d23b3ac96abb571b
2021-04-08 23:10:41 -04:00
Solomon Peachy
54fcb907c1 alsa: instead of per-target tests, use HAVE_ALSA_32BIT
Affects all Sony NWZ (linux) and the fiio m3k linux targets.

Change-Id: I2fcf121bd026103d2b72332a5a52cc2b5e93949f
2021-04-08 23:02:15 -04:00
Solomon Peachy
e17337c9aa ErosQ: fix panic on startup caused by ad55da5f
It turns out #include "settings.h" pulls in rbpaths.h which ends up
remapping open() to the path-mangling rockbox open().

By defining RB_FILESYSTEM_OS we prevent the remap.  My mistake for not
testing this before committing!

Change-Id: I2978eb7b413693c4cb887b7ac7b2457780db7d25
2021-04-08 21:58:08 -04:00
Dana Conrad
ad55da5f87 ErosQ: Set Line Level Output volume
With a full-scale 440Hz tone, the line out voltage
measured approx. 5.8Vpp at the 0 setting. WAY too hot!
(9 dBV, in fact)

For 0.894Vpp (-10 dBV - consumer devices), -18 appears to be
about right for line level signals, but for "pro" equipment
a different level may be desired.

Therefore, the user to cap the line out level by re-using the global
volume limit setting.

Change-Id: I0d1d6482ea95537e9a2d00884eaee2713771c614
2021-04-08 14:37:14 -04:00
Aidan MacDonald
4b26372591 MIPS: make sure to fill 'jr' branch delay slot with 'nop'
Inline assembly in RoLO and the FiiO M3K bootloader used 'jr' to
jump to a newly loaded Rockbox binary, but incorrectly left the
branch delay slot open. That gives GCC an opening to place illegal
instrutions, etc, which might cause an unhandled exception.

Change-Id: Ia7a561fe530e94a41189d25f18a767c448177960
2021-04-07 19:59:57 +01:00
Solomon Peachy
213d372c92 FS#13272: Fix up volume_limit to respect decimilaztion.
Change-Id: Ib0e5ddcd660115f156ddb545e45bbe7da42f9709
2021-04-07 14:38:54 -04:00
amachronic
28c89386af x1000: Improve NAND driver API
- Proper error codes are now returned from all functions. These codes will
  be used by a host-side flash tool for error reporting.

- nand_erase_block() was replaced by nand_erase_bytes(). The caller can't
  know how big an eraseblock is with the current API, so next best thing
  is to verify the correct alignment inside the call and reject the erase
  if it isn't properly aligned.

- Fixed typo in nandcmd_block_erase() which would cause an SFC error to be
  interpreted as success. Yikes.

Change-Id: Id4ac9b44fa7fc2fcb81ff19ba730df78457c0383
2021-04-06 17:27:12 +01:00
amachronic
b5558c1cf9 x1000: place SPL's NAND bounce buffers in DRAM
This frees up 2 KiB in the SPL's memory map, leaving more room for code.

Change-Id: I01bbe2ab2905b2773a8b76d8c53e9f3d55bd040f
2021-04-06 17:27:09 +01:00
amachronic
1b314502c8 Remove a duplicate const
Change-Id: I0e6f4d609eb03155de4cd16aa98cab25f54a6681
2021-04-06 17:27:08 +01:00
Solomon Peachy
74ae18cc8a fiiom3k_linux: Enable HAVE_TOUCHPAD and add in missing bits
Change-Id: I78fa5fdb3648adfaa40f6d5f3c255666a85e2761
2021-04-05 13:57:01 +00:00
James Buren
962d412917 hdd1630/hdd6330: update battery capacities
Ensure the default setting reflects what the service manual says the
official battery capacity is. Change the ranges to reflect what
replacement batteries are actually available.

This range is actually much shorter in reality due to these units
requiring the rarer 3 pin battery type that uses a thermistor. As such
there's only one real replacement battery for each.

So the HDD1630 caps out around 700 mah while the HDD6330 caps out around
680 mah.

Change-Id: I2dbbba83ad2cd6e1d84e3481c4af84a06c45e16b
2021-04-04 13:27:00 +00:00
Solomon Peachy
afec380a0d gigabeats: Fix hang on startup caused by a stack overflow
headphone ADC thread stack was slightly too small.  Bump it up a bit.

(it was _perfectly_ sized for the prior older toolchain+optimization flags...)

Change-Id: I2ca67c2b85c54f879892a31e281d7696f893389c
2021-04-01 20:24:59 -04:00
Solomon Peachy
2f785c7797 PP: More cache invalidation fixes
Take into account the size of the pointer in the loop termination
condition.

Change-Id: Ib4f7625ef143149a0d691a2109bad67aece6241c
2021-04-01 10:57:29 -04:00
Solomon Peachy
9f7f1a841a PP: Use CURRENT_CORE instead of IF_COP_CORE(CPU)
Use of IF_COP_CORE was mistakenly introduced as part of 89acde6af2,
effectively short-circuiting multiple tests resulting in the code
paths always being executed, on both cores.

Use the correct macro, so per-CPU paths are handled properly.

Change-Id: Id346cf759fc1b06b7d56694d7af1f469caf785a4
2021-04-01 08:45:43 -04:00
Solomon Peachy
0b20038d87 FiiO M3K: Hopefully fix the sim build
Change-Id: If5a58a4b3913645068cee95d4553f285eb55d182
2021-04-01 10:54:36 +00:00
William Wilgus
89acde6af2 H10 PP Crash -- Fixed
This appears to finally fix the issue
turns out the status register we were writing was only for the CPU
COP cache flush wiped out the CPU cache
--

Added some defines to cut down on the magic numbers
Added some comments explaining such

Set the address to full 20 bit address
0x1FFFFF which is then left shifted 11 internally --  somewhere around 4GB?

Link explains the cache status bits
https://daniel.haxx.se/sansa/memory_controller.txt

Change-Id: I57b7187c2f71a5b54ce145bf3a21ed492a8993cb
2021-04-01 00:52:57 -04:00
Solomon Peachy
058a9ec945 Add M3K native to the simulator
Change-Id: If3e877d2df189e44076631fd571cf6aa70ce6ca8
2021-03-28 12:08:31 -04:00
Aidan MacDonald
3ec66893e3 New port: FiiO M3K on bare metal
Change-Id: I7517e7d5459e129dcfc9465c6fbd708619888fbe
2021-03-28 00:01:37 +00:00
Solomon Peachy
83fcbedc65 rk27xx: Take advantage of STORAGE_NEEDS_BOUNCE_BUFFER
(And get rid of its custom realignment code)

Change-Id: Iff27d717b870d3db239310421776744ea6863373
2021-03-27 17:18:21 -04:00
Solomon Peachy
961ffa61dd Use STORAGE_NEEDS_BOUNCE_BUFFER instead of STORAGE_NEEDS_ALIGN
Enable its use in the jz47xx MIPS targets.

(accidently committed g#3249 before making these changes)

Change-Id: I1791946f632901f0c7a94b04b009671aa0d71717
2021-03-27 15:02:18 -04:00
Solomon Peachy
c96dc1c886 xduoox3ii: Wrap the remote key detection in USE_REMOTE
Makes it straightforward to disable for debugging or defective hardware

Change-Id: Ie72786f6e9eabf396a05ef8a02e422c34c97691a
2021-03-27 14:43:17 -04:00