Commit graph

11010 commits

Author SHA1 Message Date
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
Aidan MacDonald
ea1aef9b82 Have FAT filesystem respect storage buffer alignment on reads
This is just a minor cleanup of Solomon Peachy's code, and using
per-filesystem buffers instead of a single static buffer.

Tested and working on the FiiO M3K.

Change-Id: I3c19e8cc24e2f8aa07668c9d1c6d63364815050a
2021-03-27 14:43:17 -04:00
James Buren
018372bf39 usb: implement macro for initializing USB strings
This uses the new unicode string literal feature that is available
now to greatly simplify the initialization of these special string
types. This makes them much more readable at a quick glance.

Change-Id: Iad8b49aa763486608e3bb7e83fb8abfb48ce0a7b
2021-03-25 13:26:03 -05:00
Solomon Peachy
7652e6f8df rk27xx: Get rid of duplicate STORAGE_WANTS_ALIGN
Change-Id: I278d42858cc33da3710c8ca8f42d14c6d57509ca
2021-03-25 12:23:06 -04:00
Solomon Peachy
d5cc74ebd8 build: Get rid of suplerflous '-Os' references in linker calls
We should be using global optimization flags, and -Os is already our
default.

Change-Id: Iaba511b2b4fa2ee0f1eb1ad28024be954f4c5f03
2021-03-25 12:20:15 -04:00
William Wilgus
3d9d2de34d Revert "lcd framebuffer - Bugfix #2 ensure proper alignment"
This reverts commit 3a5c5edbf6.

Reason for revert:pulling in system.h breaks SDL

:(

Change-Id: Ied5e08de4770aa0da87c14b304480448db349423
2021-03-25 06:34:58 +00:00
William Wilgus
3a5c5edbf6 lcd framebuffer - Bugfix #2 ensure proper alignment
-- apparenty 0x4 aligned doesn't work properly

requires 0x8 alignment at least for the h10 20gb
but enabled for all processors that define MEM_ALIGN_ATTR

Change-Id: I11edaab183b91a6d158f1f439f173b9b699dc914
2021-03-25 00:32:26 -04:00
William Wilgus
ed99b305a9 Revert "lcd framebuffer - Bugfix ensure proper alignment"
This reverts commit ffee661ab7.

Reason for revert: <INSERT REASONING HERE>
iAudio M5  `IRAM' overflowed by 48 bytes

Change-Id: Id808a72c6eacabc562d53eac8acd36b45f678a97
2021-03-24 18:44:35 +00:00
William Wilgus
ffee661ab7 lcd framebuffer - Bugfix ensure proper alignment
-- apparenty 0x4 aligned doesn't work properly

requires 0x8 alignment at least for the h10 20gb
but enabled for all arm processors

assign the default framebuffer to the default_vp as well

Change-Id: I0b76c30f2ddb5d6d2f7c6a132e4081aee58da17b
2021-03-24 18:22:01 +00:00
Aidan MacDonald
94b40ed314 Add asynchronous I2C bus API
The driver core is based off of the i.MX233 I2C implementation and
should work on any platform.

Change-Id: I3b9c15e12a689ef02a51c285be08d29d35e323dc
2021-03-23 15:42:54 +00:00
Aidan MacDonald
4d83f7a192 Call powermgmt_init_target() before polling the battery
In the old position of the call, the first battery reading would
be made before initializing the target's power management code.

If the target needs to initialize before giving a battery reading,
then the first reading would be wrong and the power thread might
inappropriately shut down based on a false zero reading.

The new position avoids forcing special-case logic onto the target
power management code.

Change-Id: I483cfabe30c6881d80a1094fd526fa0065523d19
2021-03-23 03:03:57 +00:00
Aidan MacDonald
55805e13a4 Add new audiohw capability: POWER_MODE_CAP
This allows the user to make use of the DAC's power-saving abilities.
The two modes are "high performance" and "battery saver". This feature
is supported by the AK4376 DAC in the upcoming FiiO M3K port.

The setting is only a manual toggle right now, but in the future it
could be hooked up to the battery level (via another setting) so it
can be toggled automatically when the battery gets too low.

Change-Id: I482af6e2f969fcbdeb3411bd3ff91f866b12d027
2021-03-22 13:00:11 +00:00
Solomon Peachy
10b873c407 xduoox3: In ROLO, allow the ADC to be shut down.
The hang we were seeing was due to IRAM wonkiness. that's fixed.

Change-Id: Ie33a1110639fe51ad540e4e172e41f22f3bf875b
2021-03-17 18:09:40 -04:00
Solomon Peachy
efe493de3d FS13274: Bump max battery capacity for iPod Videos to 3000mAh
3rd party batteries can go this high for users that have performed SSD mods.

Change-Id: Icb34ce08e5ea345bc0fdb555bd3fd8ea9cf9e0d9
2021-03-15 12:17:30 +00:00
Solomon Peachy
92a0ab8789 sound: add sound_numdecimals() to round out the sound setting query API
A necessary prerequisite for fixing FS#13272

Change-Id: Ice288af39a4f08bea376f920d855932bdac69a52
2021-03-14 12:33:49 -04:00
Solomon Peachy
2743bde09b ATA: Increase delay to power-off when device doesn't support ATA SLEEP
The storage subsystem aggressively issues SLEEPNOW events when idle
and power off happened a fixed 2s later.  This turns out to not be
enough time for FC1307A (eg iFlash) adapters to flush outstanding writes.

So, when we detect a lack of PM support, increase the poweroff delay to
5 seconds to compensate for not being able to issue the ATA SLEEP command.

Hopefully this is enough time.  If not, we will have to re-disable PM
entirely when we detect these popular adapters.  Thankfully that is now
just an #ifdef away.

Change-Id: I4112b9acb965973d81f70483bd9d595461c7301c
2021-03-12 10:04:52 -05:00
Caleb Connolly
04c29984ce
ipod6g: increase max battery capacity
It's possible to get up to 3000mAh batteries for this device, although
it requires that you use an iFlash adapter to make enough space.

Signed-off-by: Caleb Connolly <caleb@connolly.tech>
Change-Id: I0d0d02aa30caffcae4a7e8c805516a1266eef359
2021-03-12 14:39:03 +00:00
Solomon Peachy
bd507fc7b4 ATA: When device doesn't support powermgmt, only gate ata sleep command.
The FC1307A ATA->SD chipset (used by the common iFlash adapters)
doesn't support mandatory ATA power management commands, leading to
massive data corruption if they were issued.

A workaround was identified (54629073ae) that basically disabled all of
rockbox's power management code for these adapters, which extends well
beyond the specific ATA commands issued.

This patch moves the gating test to the issuance of the actual SLEEP,
so that the rest of rockbox's PM code can function as intended.  This
allows the device to get powered down when idle, yielding potentially
significant improvements in battery life.

Change-Id: Ia13e2405243fe5efe6f68c3a549ab4933567790b
2021-03-11 19:28:52 +00:00
Solomon Peachy
87e37a4d48 xduoo_x3ii: Improvements in the meymappings!
* PREV/NEXT now swapped so they do what is expected in most contexts
 * List and setting context retains prior behavior
 * Enable the ADC that reads the headset remote and map the keys.
 * As ADC-based remote "events" arrive as press/release pairs,
   delay the button release.

Change-Id: I22d4eac3bfe1573b50eca795cf377bdafdeb5336
2021-03-10 21:35:44 -05:00
Solomon Peachy
7201c3a685 fiiom3klinux: Fix a build warning.
Change-Id: I1355c87d17376422d54b259db2078ea5f886bedb
2021-03-10 19:01:12 -05:00
Solomon Peachy
555299af9f hosted: Consolidate the code that polls the battery charging status
affects all hiby targets, fiiom3k, and ibasso dx50/dx90

As well as deduplicating a small pile of code, this also implements
hysteresis so we're not doing a sysfs read/lookup multiple times
back-to-back every time the power management tick fires.

Change-Id: I2f7672acbb36341becf67e07960c24c681270d09
2021-03-10 18:29:29 -05:00
James Buren
0ba174789b usb_hid: switch Battery Strength to use feature reports
This means we will no longer send them routinely and instead rely on
the HID driver to send them when the host requests it. This also
moves the reporting out of the power management code where it probably
did not belong in the first place.

Change-Id: I9c8420e81897f1f6caaa55ffacc7525589f1ef75
2021-03-10 04:09:46 -06:00
Aidan MacDonald
777f63d529 Move MIPS cache management functions to IRAM
Previously these were placed in DRAM, which is overwritten by RoLo
when it loads a new image, but RoLo must call commit_discard_idcache()
after loading the image.

Change-Id: I5dcc4ca711b774166f83c668695edbcabfab2604
2021-03-09 20:04:30 +00:00
James Buren
f647cde3c7 usb_hid: add support for Battery Strength
This allows rockbox to report its battery status through the
HID Battery Strength method that is available through the
Device Controls usage page.

Change-Id: Ia7a7dd9b9d476dd9df5a5f5becabc5ae823e9a89
2021-03-06 04:15:02 +00:00
Solomon Peachy
56a1e87501 ata: Make ata_disk_is_active() only special-case powermgmt-less devices.
SSDs that respect powermgmt commands should be treated the same, as the
powermgmt commands are an important part of ensuring it's safe to shut
down.

And greatly expand the comment explaining things.

Change-Id: Ia52b99fca802f495422b5ee097390a72dbc28f61
2021-03-04 17:37:51 -05:00
Christian Soffke
be99033cbb Always indicate inactive ata disk if device is solid state or doesn't support power management
Commit 5462907 made sure that SLEEP commands weren't issued on devices that don't support ATA power management commands (e.g. certain CF->SD converters including several iFlash models).

Since Rockbox waits for the disk to become inactive in shutdown_hw(), which won't happen in this case, the OS would previously stall during the shutdown process until a timeout was reached.

Change-Id: I03bb05f6f6401bb8f0da5d0b76bd3f07681fdc06
2021-03-04 16:50:50 -05:00
Aidan MacDonald
fb99d890a8 Fix typo in MIPS cache discard
Change-Id: I6a06e5f3098324d985bd59322755cd68122ec0bf
2021-03-04 19:39:28 +00:00
Solomon Peachy
cbace906c6 mips: Revert to commiting the cache when we're told to discard an unaligned block.
The filesystem API often passes in unaligned receive buffers, and some
code (eg BMP reader) processes data in-place, leading to data loss when
we dropped the cache.

(And document exactly what we're doing, so we don't go through this again
 at $future_date)

Change-Id: If47a7f2148a5a1a43777f0bd3be1bdfe8239e91e
2021-03-04 12:00:15 -05:00
Solomon Peachy
bcee955169 rolo: use audio_hard_stop() instead of audio_stop()
This kills the audio thread entirely, including voice stuff.

Change-Id: Id6fd58a97d5a57285016351bbfd3e843b2f339f2
2021-03-04 09:49:38 -05:00
William Wilgus
a4a5f5f33f Check core max allocations for valid handle
fix rolo warnings

Change-Id: Ia2c669a5517aec54e5b2c0dc5934c88a4f49f2a9
2021-03-04 14:25:58 +00:00
Solomon Peachy
2628155fc9 Clean up places that use #if defined(CPU_ARM | CPU_COLDFIRE | CPU_MIPS)
Since that encompasses _all_ of our native targets in a post-archos world,
either replace it with #if (CONFIG_PLATFORM & PLATFORM_NATIVE) or
delete it altogher as appropriate.

Change-Id: I9128a456e850d5c96a9e05806aad3acd923f90c5
2021-03-04 14:14:33 +00:00