Commit graph

5285 commits

Author SHA1 Message Date
Solomon Peachy
f3026cd072 xduoox3: Try to distinguish between "USB Plugged in" and "Charging"
Change-Id: I1879dbe6a95df215afa32012a72e1431c03a8653
2024-11-02 20:54:17 -04:00
Solomon Peachy
51ba8b3eee erosqhosted: Support HW volume control on rev2+ hardware
This also adds hwrev info to the debug output.

Change-Id: Ia75218cacb8f756a23a77334ea6ab69ac3b20d10
2024-11-01 14:12:31 -04:00
Solomon Peachy
0a11b06d93 ata: Correct parsing of the logical sector size in the IDENTIFY DEVICE
....It's specified in 16-bit words, not bytes.  So multiply it by 2.

(This hasn't been a problem in practice as everything uses 512B logical
 sectors so far..)

Change-Id: I0b1abd0f6184330f0b7f5c000c5ad547038f7c95
2024-10-31 21:51:42 -04:00
Solomon Peachy
e829ea9a5e ata: Rework how flushing, sleeping, and power off interacts
* FLUSH_EXT is used if featureflag is set and we are using LBA48
   (unconditionally used for CE-ATA on ipod6g)
 * FLUSH is used if featureflag is set (ATA6+) or if device claims to be ATA5+

 * Rename ata_disk_can_power_off() to ata_disk_can_sleep() as that is
   what it actually tests for.  Only use it to gate issuing the
   STANDBY IMMEDIATE command.
 * Restore behavior of ata_disk_is_active() to return 1 if drive is
   "spinning" or powered up.
 * Allow poweroff if drive claims PM support OR we are able to issue
   FLUSH/FLUSH_EXT commands.

 * Added ata_flush() to explicitly trigger a flush operation, and hook it
   up to storage_flush() in the device shutdown path. (Flushes were
   only previously used in the storage device power management path)

 * After issuing all settings, re-issue IDENTIFY_DEVICE to make sure
   it reflects everything we've enabled.

 * Update manual section on Flash/SSD mods.

Change-Id: I6770a54ef3a87f4c47120bcb96c944a6652f1bf4
2024-10-31 12:51:54 -04:00
Amaury Pouly
9bd13865b7 imx233: make clkctrl code aware of hbus fractional divider
This is just to display the frequency correctly in the debug menu and prepare
for future use of said divider

Change-Id: Ib4c80ec71b3300bdf17edf6cc590229f7640d0f5
2024-10-27 10:46:28 -04:00
Solomon Peachy
3951fbf9d2 ATA: Restrict to UDMA2 if we don't detect an "80-pin" cable
Change-Id: I55861065741f3365491445f1f3f5b0041f33e1c6
2024-10-26 15:09:10 -04:00
Solomon Peachy
563da70139 ipod6g: Reworking the bespoke ATA driver
ipod6g was configured with SECTOR_SIZE of 4096, but this ATA driver
unconditionally translated these to 512B operations on the actual
storage device.

Rockbox's storage layer already has robust support for "logical sectors
larger than physical storage sectors" through use of
MAX_LOG_SECTOR_SIZE.  So switch to that mechanism, allowing the ipod6g
ATA driver to be simplified.

If we want to support drives with physical sector sizes > 512B, then
we need to port the MAX_PHYS_SECTOR_SIZE logic from the primary ATA driver.

Additional changes:

 * Simplify MWDMA/UDMA selection logic
 * Report CE-ATA mode in debug menu
 * Use LBA48 commands only if drive is over 128GiB.
 * Drop default sleep/poweroff time from 20s to 7s (matching main ATA driver)

Finally, the bulk of the changes are the first phase of a badly needed
style cleanup that made reading this driver a lot harder than it should
be. I intend to split this into a separate patch.

Change-Id: I2feca9fd319c8d6cfb3c2610208970428d2fa947
2024-10-17 20:30:37 -04:00
Solomon Peachy
cda2f90e10 nano2g: Work around GCC9 warning in the FTL code.
As far as I can tell it's a false positive.

Change-Id: Ib4f993c717d673e53f1ec70b9f4701acc0ca6f27
2024-10-14 08:56:12 -04:00
Christian Soffke
152ec1946c ipod 4g/color: Fix unresponsive buttons after booting
The iPod 4g and color always ignored the very first
button press after booting, i.e. you needed to either
press another button or scroll for a bit first.

Not sure whether any other PP iPods exhibit the same
behavior, although it is not reproducible on an iPod
video.

This patch basically copies the code from FS#5230
that fixed unresponsive buttons whenever the HOLD
switch was turned off (committed as a5961c944b).

Change-Id: I8d3444094e5d000e0f8e30e39a23f054abeeb0f5
2024-10-13 11:36:33 +02:00
Solomon Peachy
38211e627d AS3525: Get rid of duplicate 'const' in a single definition
(Another GCC9-produced warning)

Change-Id: I9fd1ec692faded8afc52d7f3e522bc7198366dc5
2024-10-12 15:09:18 -04:00
Solomon Peachy
6cb0bc3468 coldfire: Silence a warning generated by GCC >= 9
Basically, there are weak aliases for all possible IRQ handlers,
pointing at a NORETURN function. GCC complains that the aliases
don't have the same attribute, but that's actually what we want.

Change-Id: I7f877e00193ed457589c8442db82e93ddea0d60a
2024-10-12 13:54:22 -04:00
Christian Soffke
8b9ef7cf8d sdl: Remove SDL_RENDERER_ACCELERATED flag
The flag would apparently make hardware accelerated
rendering  mandatory. SDL2 will still attempt to use
hardware acceleration, if the flag is missing.

Change-Id: Icfdcad90591d2a5003a1540f2a669c7e54dcfc3b
2024-10-11 22:57:37 -04:00
Solomon Peachy
edbcf0b0f4 erosq: Initial PM support for "hw4" variant
(They renamed the battery from 'battery' to 'axp_battery')

Change-Id: Ic42c31e1d5c01eafc3fe01b144d9f22d88933e04
2024-10-10 10:12:29 -04:00
Solomon Peachy
0222ed3639 simulator: Fix SDL2 simulator build of touchscreen-based targets
(cowond2, mrobe500, vx747, shanlingq1, zenxfi2)

Change-Id: Iae68fbf80300d0268f3027ca97b06f6c64170a48
2024-10-07 12:05:42 -04:00
Solomon Peachy
7927423e34 SDL: Migrate to SDL2
Incorporates large portions of g#5879 g#5282 g#5285 g#5286 g#5287

Differences from the above patches:

 * Removed all MacOS-specific stuff
 * Removed support for SDL1 entirely
 * Properly implement mousewheel support
 * Bumped up minimum stack size for sigalstack threading
 * Check for overflow before enqueing scrollwheel events

Tested on:

 * sdl application (Linux)
 * Simulator (x86_64, Linux) -- xduoox3/ipod4g/sansafuze
 * Simulator (i686, Windows) -- xduoox3
 * Simulator (arm64, Linux)

Change-Id: Ia3012dd1be123feb2888798a42d5b7cc149f382b
2024-10-06 12:05:53 -04:00
Solomon Peachy
2f3b9ab68a tms320dm320: Correct a warning with newer toolchains
Change-Id: Ic9d745b9117ee50d82f4c71e07753bf71afc559e
2024-10-06 09:30:32 -04:00
Christian Soffke
bc56e9a9dc SDL: Don't apply settings when starting DMA playback
This seems to be redundant since it
already happens in pcm.c

Change-Id: Ib27d1a225758e5f2919446ceb6de4a038abfa062
2024-09-21 15:14:54 -04:00
Solomon Peachy
e0df9952fd ata: Alter ata_is_active() when drive doesn't support power management
Due to the heisenberg principle, we don't want to check the battery
level when the ATA drive is "spun up".

Unfortunately some ATA devices *cough most SD adapters cough* don't
support mandatory ATA power management commands like flushing caches and
(safely) shutting down so we have to leave them "spinning".

This leads to us never updating our battery status with these
out-of-spec devices.  Work around this issue by having is_active() always
return false if that's what we have.

Change-Id: I629f3fdbc7e5cffb0a4d546c80cb5fca8529c0e6
2024-09-18 08:26:14 -04:00
Dana Conrad
a5462d6192 erosqnative: Give erosqnative_v3 its own target ID and modelname
This is needed so "make clean; make reconf" will work correctly.

Change-Id: Ife13e59ac6054f04f7095aa2263ec64595eeb3a2
2024-09-08 12:29:03 -04:00
Dana Conrad
878e29396c ErosQNative: Add v3 LCD support, conditional on bootloader
bootloader passes the player version to rockbox for LCD init changes

Credit ZappBranigan2972 on forums for original changes
Credit Bilgus for devicedata additions

Change-Id: Ia2ca493edef49b7457e84dc19b05397dc915fa5a
2024-09-02 13:29:43 -04:00
William Wilgus
a2cc7546d8 Add DeviceData to bootloaders
same vein as bootdata but for devices that need to pass info back to a
running firmware

Change-Id: I0cdcdc0475804dfbbee415ab487104ae8fc8ac69
2024-09-02 13:29:43 -04:00
Dana Conrad
5ddfdf6e2f ErosQNative: Set extra ES9018K2M options
Set number of FSR edges required for DPLL/ASRC lock
Set DPLL bandwidth larger

Both should help prevent dropouts, especially with
sample rates >=96khz

Credit to ZappBranigan2972 on the forums

Change-Id: I55a90d44ac7fcec5894377e32cdadad66bb05610
2024-08-21 08:57:50 -04:00
Solomon Peachy
05354e1bef Hopefully fix the remaining red from 15e52374
(imx233, ipodnano2g, !multidrive hosted/sims)

Change-Id: I9c89887078f9f50d3aac73f468ac323699e1fd1f
2024-08-12 15:20:13 -04:00
Solomon Peachy
15e5237469 storage: 64-bit sector offsets
* Create new 'sector_t' type alias:
    * uint64_t for all targets with HAVE_LBA48 or HAVE_SDUC
    * unsigned long for the everything else
 * Alter all storage APIs to use sector_t instead of 'unsigned long'
 * Alter Volume/Partition/storage info structures to use sector_t
 * Disk cache converted to sector_t
 * ATA Core:
    * convert to using sector_t for sector addresses and drive sizes
    * Always fill out upper 16 bits of LBA48 addresses
    * IDENTIFY INFO is fixed at 512 bytes, not SECTOR_SIZE
 * USB mass storage:
    * convert to using sector_t for sector addesses and drive sizes
    * Implement READ_16/WRITE_16 for LBA48 addresses
 * Convert FAT code to use sector_t for all sector references
 * output_dyn_value() now accepts int64_t instead of 'int'
 * Corrected "rockbox info" to work for (MULTIVOLUME & !MULTIDRIVE)
 * Better reporting of disk and (logical+physical) sector sizes in debug info
 * Detect SDUC cards and report on storage debug_info screen

To-do: SDUC

 * Refactor SD core to remove duplicate code in every driver
   * Card probe and init state machine
 * Implement core SDUC support
   * SD2.0 needs to be 2.0+ (fixed for jz47xx and x1000)
   * Host and Card ID (ACMD41)
   * 32-bit addressing for all read/write/erase operations (CMD22)
 * ADD SDUC to target device drivers, defining HAVE_SDUC as appropriate

Change-Id: Ib0138781a0081664d11511037685503df1b93608
2024-08-12 14:23:44 -04:00
Dana Conrad
ef9490f683 ErosQNative: Debounce jack detection and make Line-Out default
Making line-out default output should allow detection to work
correctly. Headphone detection should work whether or not
headphone is currently the active output due to the
low impedance (relatively) of the headphones. Line-Out sinks
will likely be high impedance, so we need the output
as a pull-down for detection.

Debounce detection to prevent false triggers due to voltage swings
during playback.

Change-Id: If5e497d900330f64d0f49a135e953ee6b0499668
2024-07-30 11:39:47 -04:00
Solomon Peachy
87ef6bb9e1 hosted: Don't unconditionally pull in mv.h on hosted environments
It causes some conflicts in plugins with the upcoming 64-bit storage enablement

Change-Id: Ia8615c5266c2b29216a05a8d85c3da5186c98d1c
2024-07-19 18:42:11 -04:00
Solomon Peachy
942e013eac pp5020: Cache the result of the is_ssd check.
...So we don't look it up on every write.

Change-Id: I85b0abe5032a60588535b401cc719661601807ee
2024-07-16 17:35:53 -04:00
Solomon Peachy
27a0cda6ac PP5020: Unconditionally use stock PIO timings
The SSD detection heuristic is flawed, and when it fails
(due to very crappy CF->SD adapters) we end up corrupting things.

So let's give up a slight amount of performance on the original hard
drives (which are aging out anyway) in favor of guaranteeing safety.

Change-Id: Id92583a6b9ae6ec543b91b3e0f8f28b57ac38cb0
2024-07-16 17:35:53 -04:00
Solomon Peachy
9c53fa1b0a pp5020: It's okay to use DMA reads on non-SSDs
Fixes a regression introduced in 4b423e21f6

Change-Id: Ief4a4a562840524b98ad5988999bac87586dec41
2024-07-16 13:37:14 -04:00
Solomon Peachy
c51a9821e7 rk27xx: Fix simulator errors brought upon by HAVE_MULTIDRIVE but not HAVE_HOTSWAP
Change-Id: I0171d01dfffbb936e8041c0e2fc5207c620ddce3
2024-07-07 16:02:38 -04:00
Solomon Peachy
5a2bd580cd Hopefully fix the last of the stragglers.
* xDuoo X3 fix some warnings due to an incorrect #ifdef
 * stub storage_removeable() and storage_present() for non-HOTSWAP builds
 * sim_trigger_external() is gated by HOTSWAP, not MULTIDRIVE

Change-Id: I38f14fdfeba13957899c378051d49afc2e8245e5
2024-07-07 15:13:53 -04:00
Solomon Peachy
1528b44349 More red fixes
Change-Id: If22cdb286edac47b08b158bee6910ba7a539b041
2024-07-07 14:47:07 -04:00
Solomon Peachy
f37b5a8349 Fix the remaining red in red from ea80d1cc9ca
Notably:

  * double-paste in ihifi760 config.h
  * jz4740 ATA & SD drivers used MULTIVOLUME instead of MULTIDRIVE
  * Simulators implicitly rely on HAVE_HOTSWAP

Change-Id: I44fc7f98f0f6df366f016567c330f87e9f3ca6a6
2024-07-07 12:29:19 -04:00
Solomon Peachy
181fe7530a Fix most of the (extensive) red in ea80d1cc9ca
Change-Id: Ie494df80caa222423a52977031920d54bd058c3c
2024-07-07 12:05:18 -04:00
Solomon Peachy
80b9127727 Revert "jx47xx: Rename crt0 'init' sections to 'startup'"
This reverts commit 83bb89d0b8.

...It breaks the jz47xx bootloaders.
2024-07-03 16:51:58 -04:00
Solomon Peachy
e55618d07a hosted: Minor corrections to the linux framebuffer driver.
* Query variable info _before_ mmaping the framebuffer
 * Sanity-check the resolution/bitdepth, and if it doens't match
   try to set it to what we want.

This is functionally a no-op.

Change-Id: I087ff81775d8f63bf7846b7fef19f6fc36c1cc84
2024-07-01 09:51:50 -04:00
Solomon Peachy
5f26f21ab2 samsungypr0/1: Minor improvements to framebuffer driver.
* Distinct error codes for all failures
 * Corrected some comments and error messages

The ypr0/r1 target should be switched over to the generic lcd-linuxfb
driver, but that will come later.

Change-Id: Idc3867a96db7e431847473708712f88dd2725a96
2024-07-01 09:50:33 -04:00
Vencislav Atanasov
4691152f92 Add SysCfg viewer for iPod 6G in the debug menu
Change-Id: I4e142f40777c7f8ae58f2b46fc6a3ec4f12aa530
2024-06-24 21:00:25 -04:00
William Wilgus
c6473f4e7f [Fix Yellow] imx233_debug fix yellow
Change-Id: I2d04340a8383edd03350045085188d2191e41526
2024-06-05 20:03:02 -04:00
William Wilgus
c96d728d81 [coverity] debug-imx233.c dbg_hw_info_audio() use strlcat, fix snprintf call
technically this isn't currently causing any issue but
coverity correctly identified the potential for buffer ovfl

Change-Id: I4af462c9860c44f22d05b5b2b4c685364823d395
2024-06-05 19:16:07 -04:00
William Wilgus
74552d5404 [coverity] RFC ata-imx31.c UDMA mode timing tables out of bounds reads
mode only goes 0-4 the original commit mixed up the index and mode
bad stuff must happen but its been here for 16 years

Change-Id: I7e69f4e2574029a6bc3cea76e8803d2d0357d9e2
2024-06-05 19:00:15 -04:00
Roman Artiukhin
2109d524e8 samsung yp-r0: Fix displaying non-Latin filenames on SD card
Supply iocharset=utf8 mount option. Otherwise, cyrillic symbols appear as question marks.

Change-Id: Ibf40a15ff429cfe2bf6e7970330870505e2470b7
2024-06-04 19:29:19 -04:00
William Wilgus
82dcf32736 [BugFix] headphone should be removed on first toggle
Change-Id: I10a77f210896a9ec317f9cbc7de21dccabafe426
2024-06-02 17:09:24 -04:00
William Wilgus
aca41be3ca [Feature] Simulator add headphone and lineout toggling
Change-Id: I0b019414643e5c9037c0128093488da49e1a4c0d
2024-05-30 12:12:29 -04:00
Aidan MacDonald
e37cd0f2f5 x1000: Enable NOCROSSREFS_TO()
Start enforcing the correctness of references to the .init section.

Change-Id: I507891a25be9cccff4cf8ec13fdc799b73c75176
2024-05-08 22:14:10 -04:00
Solomon Peachy
1957237a46 Fix red in 8c86fb6da0 (ipod5g only)
Change-Id: Idf6a488728b0187779bc4a9232c7e7e9400afeec
2024-05-08 22:03:59 -04:00
Solomon Peachy
8c86fb6da0 arm: Use -masm-syntax-unified when compiling with gcc8 or newer
Annoyingly, this makes all of the '.S' files we compile get treated as
divided syntax, so we need to make the syntax in them explicit.

Change-Id: I56a3916b7b24c84a1214a5d6bc4ed4d651f002cf
2024-05-08 21:45:42 -04:00
William Wilgus
efcea66280 Revert "readdir_r use in tagcache.check_dir, ft_load"
This reverts commit 0c737d3b2e.

Reason for revert: Not really a concern as open_stream returns an independent buffer since g#566

Change-Id: Idbd2f4a7cc2ea6362b7714629469eeb7b3d19b3b
2024-05-02 13:38:32 -04:00
William Wilgus
0c737d3b2e readdir_r use in tagcache.check_dir, ft_load
Change-Id: Ibcde39ed247e100dd47ae877fb2a3625bbb38d8b
2024-05-02 09:33:29 -04:00
Solomon Peachy
aa7357861a ipod6g: Issue a FLUSH_CACHE[_EXT] command if device can't sleep.
Additionally, synchronize with the standard ATA driver's feature table

 * Acoustic management set to quietest
 * Set power mode to lowest w/o standby

Change-Id: I12e64354d4c946228e9a55fc8da2114127d08d28
2024-04-26 07:28:01 -04:00