Commit graph

10991 commits

Author SHA1 Message Date
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
William Wilgus
15b4d22913 ROLO check for OOM
Splqash failure and return on OOM

Change-Id: I97b8783ba42545e30a5639e8a751d1e6834aebc8
2021-03-04 08:58:34 -05:00
Aidan MacDonald
de53965e3f Third try fixing MIPS cache code
Changing this to be a pure discard operation after discussion on IRC

Change-Id: I62955ae7975fdbbfd9eef376476042a36fe3d95a
2021-03-04 02:47:13 +00:00
Solomon Peachy
b82298ae2c jz4740: Fix incorrect dcache flush in the USB RX DMA code.
Change-Id: I01eff581b16569bda97c55afc7adac897b29e0e3
2021-03-03 21:44:28 -05:00
Aidan MacDonald
8cb4c18310 Really fix the MIPS cache bug this time
In fixing the original bug I tried to optimize discard_dcache_range()
to minimize writeback and inadvertently introduced a second bug, which
typically ends in a TLB refill panic.

It occurs only if the range fits within one cache line, and when both
the start and end of the range are not aligned to a cache line. This
causes ptr to be incremented and end to be decremented, so ptr > end,
and the loop can't terminate.

Change-Id: Ibaac072f1369268d3327d534ad08ef9dcee3db65
2021-03-03 23:57:08 +00:00
Solomon Peachy
0f439bee99 ihifi: use STORAGE_WANTS_ALIGN rather than STORAGE_NEEDS_ALIGN
Change-Id: I39284194d19785e92ca641c85b03d31849b85ec9
2021-03-03 17:05:31 -05:00
Aidan MacDonald
74a3d1f5be Fix MIPS cache operations and enable HAVE_CPU_CACHE_ALIGN on MIPS
- The range-based cache operations on MIPS were broken and only worked
  properly when BOTH the address and size were multiples of the cache
  line size. If this was not the case, the last cache line of the range
  would not be touched!

  Fix is to align start/end pointers to cache lines before iterating.

- To my knowledge all MIPS processors have a cache, so I enabled
  HAVE_CPU_CACHE_ALIGN by default. This also allows mmu-mips.c to use
  the CACHEALIGN_UP/DOWN macros.

- Make jz4760/system-target.h define its cache line size properly.

Change-Id: I1fcd04a59791daa233b9699f04d5ac1cc6bacee7
2021-03-03 20:50:28 +00:00
Aidan MacDonald
aacb0811d9 Rename symbols of FiiO M3K Linux-based port
Mainly a straight replacement of FIIO_M3K -> FIIO_M3K_LINUX.

Change-Id: Id07c84f8150991d1b6851540c2c3f8f67e3f12c2
2021-02-27 23:53:28 +00:00
Christian Soffke
7d7850368e Disable UDMA 2 on iPod4G target
ATA DMA was enabled for all PP502x targets in d118f47 after previously reported instabilities were thought to have been fixed. The iPod 4G target remains unstable when UDMA 2 is enabled. File system corruption will eventually occur even using stock hardware in normal usage, according to both my own experience and that of several other forum users. UDMA 1 appears to be stable.

Change-Id: I8526bad9e879f5dad5174cfe07cd8828d8b72406
2021-02-27 14:38:49 +00:00
Solomon Peachy
b5e6c30a61 USB: Reset poweroff timer for all USB events
Without this, if a device is left plugged in and idle, unplugging it will
trigger an immediate shutdown.

Change-Id: I65caaa0c1473562ec5d0bb776b01d4d222d69965
2020-12-24 00:40:01 -05:00
Solomon Peachy
02119357dc erosq: Enable HAVE_SCROLLWHEEL for saner scroll wheel handling
Basically no longer treat SCROLL_FWD/BACK as "button" events, instead
relying on the scrollwheel hooks to handle things properly.

Change-Id: I9bf18595ab3ca68e912f6dfb1f2eac2544578e73
2020-12-16 14:54:11 -05:00
Franklin Wei
792f05f82a lcd: Wrap anonymous union initializer in braces
GCC 4.9.4 is apparently smart enough to compile this, but 4.4.4 is not.

Change-Id: I186f969cbad4c701936ab738f585efea07421d2e
2020-12-08 14:12:12 -05:00
Solomon Peachy
a5961c944b FS#5320: Keypad hold doesn't let go until scrolling is used (ipod 4g/5g)
Patch by Boris Gjenero

Change-Id: I7df956fb63478bbbe891104faf5ab35096da7576
2020-11-29 08:51:37 -05:00
James Buren
6b3b4df6f6 rockbox: move firmware checksum algorithms into a common header
Before this was just implemented inline wherever it was needed. Now
it is provided as 2 inline functions in a header called checksum.h.
There should be no differences in actual behavior.

Change-Id: I5d756cc01dc6225f5cc8b6af90911a3fc7b57cd5
2020-11-22 05:12:04 +00:00
Solomon Peachy
3027cead01 hosted: Improve buffer underrun handling in the ALSA driver
* Bump internal mix buffer size by 4x, to 1K frames (matching ALSA period)
 * Handle an underrun that occurs when filling the audio buffer
 * Log underruns and make them available in the debug info

Change-Id: I28d56dd35d88851fa167ad92368a5882937a758f
2020-11-18 14:38:12 -05:00
Solomon Peachy
7c87467ba4 configure: Add prompt for USB Serial into the advanced mode
And explicitly disable USB_ENABLE_SERIAL when HAVE_USBSTACK is not define

Change-Id: Ieb4176b02a60eb1b9db81f0b8c69403898a76ca1
2020-11-18 08:50:05 -05:00
Solomon Peachy
0400a391d3 usb: increase the stack size.
It's not large enough on some targets.

(this will be revisited when the USB insertion prompt stuff is moved
 out of the USB helper and over to the main thread)

Change-Id: Iefed2cdf2fbb4ce92569fc5cacbdb479b7d24e61
2020-11-17 06:58:46 -05:00
Solomon Peachy
9c68c69cf0 FS13257: Fix inconsistent defaults in the USB mode selection
Change-Id: I44894d13f070313ad326ce68018556573e35aad9
2020-11-16 17:11:38 +00:00
James Buren
c79ddb6bf4 iriver_flash: update valid bootloaders table
This removes all the pre-release bootloader of version 7 and
replaces them with production releases of version 8. The
pre-releases have their own problems and should be left
behind as they were never officially released.

Change-Id: If96531ba63cf4401d04133bda94735fe94ae4de1
2020-11-16 11:57:18 +00:00
Moshe Piekarski
3ef8455626
Remove some SWCODEC artifacts
Change-Id: I580522bc0ec3bc86c24400625d7d9cde2eea8fc8
2020-11-14 19:20:33 -05:00