Commit graph

11951 commits

Author SHA1 Message Date
Aidan MacDonald
0f4cc33d26 touchscreen: Increase report rate to 25fps
The touchscreen repeat interval effectively controls the report
rate of the touchscreen to the action code. Touch interactions
are smoother with a faster refresh rate, but the CPU needs to be
fast enough to keep up, or we risk queue overflows.

25fps is the minimum required to appear smooth, and probably all
targets will be able to handle the extra CPU load.

Change-Id: I96dcc80ea2ce8b915ff5682360c2e719b835388d
2025-12-04 07:10:17 -05:00
Aidan MacDonald
9e254acab3 touchscreen: Update action system touch event reporting
Add a cleaner API for reporting touch events and deprecate the old
action_get_touchscreen_press() API. The old API is now emulated by
using the new one internally.

Change-Id: I001378e66f9c81806f134f011420d671954fcde2
2025-12-04 07:10:17 -05:00
Solomon Peachy
fa164f89e0 tools: Detect A-profile ARM cores for hosted and sim builds
The only v7-a targets we have are built using the androidndk (with gcc
4.9) but it is possible to perform "self-hosted" builds for eg the
simulator or the sdlapp.

Where this gets messy is the considerable amount of inline arm
asm we have.

Native builds will need considerably more work to support
v7-a processors, but we have to start somewhere.

(Note that this contains parts of commit 508bfabe8, which had to
 be reverted due to breakage)

Change-Id: Ia1c8e10d21a976c68fdaae58e4d776854b63186c
2025-12-03 22:49:25 -05:00
Solomon Peachy
c26981a9c6 samsungypr0: Fix red in bbcf210c94 due to a merge error
Change-Id: I78b69e67a0f0cd786c79da78245d93838a9142b9
2025-12-03 22:39:33 -05:00
Solomon Peachy
bbcf210c94 Nuke maemo (nokian800/nokian900) and [open]pandora targets
They haven't seen any work since 2013, and likely hasn't compiled in at
least a couple of releases -- not that we ever "released" anything for
these targets.

Futhermore, upstream for both has been effectively dead for about as
long, and there's been no user reports of these being used since 2017
(and even then only in passing).

It isn't worth the effort to triage their current state, much less
uplift into something supportable, while the maintenance burden of
keeping these things in-tree can be demonstrated by the diffstat.

Change-Id: Id93bd450679d1b75e2c74295b3ae1548cd241b24
2025-12-03 20:42:02 -05:00
Aidan MacDonald
c47c075bd3 touchscreen: Fix event reporting in button driver
The way the button driver reported touch events was problematic
and made it impossible to detect if a touch started or if it was
a continuation of an existing touch.

Now, the first detected touch event gets BUTTON_TOUCHSCREEN and
all subsequent touch events while the screen is pressed will get
the BUTTON_REPEAT bit set. When the screen is released the final
event will have the BUTTON_REL bit set.

Change-Id: Ia456a22b2180031555a82231c2af32576bc5f2cb
2025-12-03 20:34:52 -05:00
Solomon Peachy
11163721d6 audio: Fix up final red from a79bdaf462
Change-Id: I8de562516e54e2101746ea54d91461661439bcf5
2025-12-02 22:16:34 -05:00
Solomon Peachy
6bdd3de554 Move hosted codec header files back under firmware/export
This is a partial revert of a79bdaf46

It caused all sorts of build breakages for misc stuff like the dbtool,
which doesn't include any per-target build directories

Change-Id: I493a33c1859706679972e47c96196223415985d9
2025-12-02 20:35:18 -05:00
Solomon Peachy
c2952136c6 audio: Fix up more red from a79bdaf462
Change-Id: Ie6a68f2a14489bc84ddc57b73b37ddb94b7dc0ac
2025-12-02 20:35:18 -05:00
Solomon Peachy
fd6d6c48b4 audio: Fix up most of the red from a79bdaf462
The rest involves some wrangling.

Change-Id: I5459c255677cbacf8cc8b0c28492d27c58971cb1
2025-12-02 20:09:47 -05:00
Solomon Peachy
a79bdaf462 audio: Move hosted audio "codec" drivers into their respective target dirs
They are nearly entirely generic wrappers around ALSA controls, unique
per target, and are ripe for further consolidation.

Change-Id: I05e4a450e3e89e03616906601c4f8fa46200dff5
2025-12-02 18:59:50 -05:00
Aidan MacDonald
806b71b2ed hosted: consolidate sysfs-based battery measurement code
Several hosted targets read their battery state from a fixed
sysfs path. Get rid of the duplicated code by handling this
common case in power-linux.c.

Some targets use non-standard units in sysfs instead of the
typical microvolts / microamps, so allow the scale factors
to be overridden by the target.

Change-Id: I31dc4ffc7a2d2c066d00a74070f9f9849c1663d0
2025-12-01 13:39:04 +00:00
Solomon Peachy
7ffdf50ba5 ibasso: Use generic hosted sysfs accessors
This keeps the enumerated list of sysfs parameters.

Change-Id: Ia63549809490eba02b3f75b3d2f95745636e01a9
2025-11-30 19:21:06 -05:00
Solomon Peachy
9020360f66 hosted: Pull tinyalsa out of ibasso tree so other targets can use it
Change-Id: I85e31a0d0993d3494568abbc05ff9b114d493d75
2025-11-28 19:33:48 -05:00
Solomon Peachy
6314eae268 Fix build regression for Creative ZEN V
Introduced in 297af3a483

Change-Id: I9cf37e27ecdf84b6f0a8b6c8d15b1eae987cedbe
2025-11-28 07:38:40 -05:00
Solomon Peachy
a6538abd16 rk27xx: Use slower memory timings at startup
Our decade+old defaults are reported to trigger a failure on
one user's IHIFI770c and IHIFI960, but work on their HM-603.
Backing CAS latency off from 2 to 3 appears to be sufficient.

What's interesting is that on paper, CL=2 should be easily attainable
due to our max RAM clock of 100MHz, well within the worst-case timings
of the EM639165 SDRAM.

So as an experiment, this code can go back to CL=2 when we change the
CPU+RAM clock speeds.  IF this still proves problematic, it will be
removed.

Change-Id: I4a8cfa0563c076e7f25d9599a19b454f590861cd
2025-11-28 07:18:22 -05:00
Christian Soffke
3307b04eed usb: Shorten debounce interval for USB status by event
The introduction of a debounce interval for USB
status by event (see e75a3fb), often resulted in the
FiiO M3K crashing after disconnecting from USB.
Shortening the interval to 10ms appears to fix this,
or make a crash much less likely at the very least.

Change-Id: Ibf1f02779ab1704d9b1c86d39b21648a3e2c4e9d
2025-11-27 20:55:00 -05:00
Sebastian Leonhardt
297af3a483 Creative ZEN: fix RTC regression
Creative ZEN lost it's time when shutting down.
The bug was introduced with commit 7f282b9280 (g#2601),
followed by e3f6e9d9f6 (g#2616).

I guarded all persistent register writes with wait loops,
as described in the datasheet.

TODO:
test SONY_NWZE360 and SONY_NWZE370 targets

Change-Id: Ib38ab8691fd1c6e8d0771c1e2eca20dfeb6fc87f
2025-11-27 15:04:14 -05:00
Sebastian Leonhardt
69bc230e7d imx233: add HW_RTC_CTRL and HW_RTC_STAT registers to debug screen
Change-Id: Id52f86b26ee039781f44fde639fb8f184c7dc438
2025-11-27 12:36:28 +01:00
Solomon Peachy
7511d7e514 ipod6g: Correct inverted sector shift for CE-ATA operations.
(sector needs to be scaled UP, not DOWN)

Change-Id: I350c6c371b29c5e152d8d35852e55e3eda0d1090
2025-11-24 21:08:01 -05:00
Solomon Peachy
0551c4a780 ipod6g: Scale CE-ATA READ/WRITE sector/counts correctly
Despite the fact that CE-ATA specifies a minimum logical sector size of
4096 bytes, the low-level tranfer command arguments are specified in
units of 512 bytes. So scale the sector count up and the LBA down.

On CE-ATA devies, the partition table and filesytem is formatted with 4K
logical sectors, so this will be safe.

Change-Id: I959f21f9c72a68ac28aa611d06f8517ca77f0a8c
2025-11-23 20:21:06 -05:00
Solomon Peachy
e04ed753e1 ipod6g: Correct double-shift in ata_rw_chunk_internal()
Forgot to do a commit --amend with this fix before pushing

Change-Id: I7f2e4bead7c85b9edbf13992f15c3b93c2b18197
2025-11-20 20:03:22 -05:00
Solomon Peachy
2c53f6122a ipod6g: ceata_rw_multiple_block()'s COUNT is MMC blocks, not sectors
Default MMC block size is 512B, and the DMA block size must equal
the MMC block size.  As we do not negotiate a larger block size,
scale the transfer count up to match the drive's logical sector size.

(CE-ATA mandates a *minimum* sector size of 4K)

Change-Id: I701cbac5c0fa320e8d38ea3333d99257b9b1f560
2025-11-20 19:53:56 -05:00
Solomon Peachy
25b985c319 ipod6g: Correct the DMA transfer size/count for CE-ATA devices
The DMA xfr size was fixed at 512 bytes, but the count was specified
in terms of the logical sector size (ie 4096 bytes).

Make the DMA size line up with the sector size.

Change-Id: Id9d0088b12775223f8d888f21b19e17c97927570
2025-11-20 19:33:15 -05:00
Solomon Peachy
bc7bc4e8ac storage: report physical sector multiplier via storage_get_info()
Show this in in the info dump when we can't find a filesystem to mount
in main() plus in the ipod bootloaders

Change-Id: I3b437ae0032b17f29c0dd94043743f14d2b2f3ad
2025-11-17 08:57:43 -05:00
Solomon Peachy
44b5220f22 ata: Unify more of the ATA drivers into the common code
The goal of this was to have the ipod6g's ata driver report
proper vendor/model information from storage_info()

Change-Id: I64c1aee87c817cac23c90e062333a4ba3545dfaf
2025-11-17 08:29:56 -05:00
Dana Conrad
a1837d2d80 usbaudio: block playback while usbaudio is active
Needed due to us commandeering the AUDIO DSP "channel" for USBAudio.
If/When we add another DSP channel, this can be reverted.

Works, but still goes to a "blank" WPS screen for a split second before
cancelling out.

Change-Id: I5fb8a1e226b4d3e46c86c59d593d807f49d7a35f
2025-11-15 07:38:46 -05:00
Dana Conrad
c533222851 usbaudio: send through dsp (new)
Does not seem to affect UI usability, but allowable DSP loads will vary
based on device and playback sample rate.

To-Do (someday):
- Add dedicated DSP channel
- How to apply DSP settings to above new channel? (UI)
- How to lock out timestretch from being enabled?

Change-Id: Ia24d1055340354e2c32e6008e7e2b03a8e88867d
2025-11-15 07:38:19 -05:00
Dana Conrad
7c4293af64 usbaudio: convert to asynchronous operation
Add feedback not based on samples used, but on buffers filled - idea
being we can do "PID" (someone who has actually implemented Real PID
could probably rewrite the calculation) based on how many buffers
we have filled versus the ideal buffer filled level (16).

Feedback is based on a historical average of the last two feedback
intervals.

This feedback math is done as fixed-point math to keep floats out of core. Note that a couple division operations needed to be strategically staged to avoid overflow or truncation.

Floats are still used for debug screen printout.

Also fixed a typo in the definition of usb_audio_control_request()

Host:
Linux: works
MacOS: works
Windows: Feedback does not work! It appears that Windows may not
         support asynchronous devices at all. Playback may "work",
         but results will vary as the number of buffers filled will
         drift over time.

Change-Id: I027feb16705e6e46c1144b1d08920b53de42cb26
2025-11-15 07:32:05 -05:00
Dana Conrad
9ce66e088e Add USB Audio 1.0 support
Original commit credit to Amaury Pouly, Moshe Piekarski
Pushed across the finish line by Dana Conrad

To enable, see setting under General Settings --> System --> USB-DAC.
On devices with few endpoints, this may not work while HID and/or
mass storage is enabled.

Adds new dedicated mixer channel.

setting usb-dac can have values:
- never (0)
- always (1)
- while_charge_only (2)
- while_mass_storage (3)

Relevant devices are DWC2 and ARC usb controller devices. That being:
x1000 Native targets (m3k, erosqnative, q1, others...?),
sansac200, creativezenxfi2, vibe500, ipodmini2g,
ipod4g, creativezenxfi, creativezenxfi3, sansaview, ipodcolor,
creativezenxfistyle, samsungypz5, sansafuzeplus, iriverh10_5gb,
tatungtpj1022, gigabeats, faketarget, samsungyh820, gogearhdd1630, samsungyh925, ipodmini1g, ipodvideo, creativezenmozaic, sonynwze370, creativezen, gogearsa9200, gogearhdd6330, sonynwze360, sansae200, mrobe100, iriverh10, creativezenv, ipodnano1g, samsungyh920

USB Driver-wise, it should be noted that this patch requires some
slight changes:
- proper blocking on control OUT transfers, to make sure the data is
  received *before* using it, the usb_core should probably use that too
- drivers can now support interface alternate settings
- drivers can be notified of completion by a new fast handler, which
  is called directly from the driver; this is is necessary for
  isochronous transfers because going through the usb queue is way too
  slow

Designware changes:

- enable for USBOTG_DESIGNWARE
- set maxpacketsize to 1023 for ISO endpoints

Change-Id: I570871884a4e4820b4312b203b07701f06ecacc6
2025-11-15 07:30:15 -05:00
Sebastian Leonhardt
9aafbf9ca9 STMP37xx/iMX233: reduce popping noise on power on/off (Version 1)
Version 1: this patch prolongs startup time by 2 seconds, because the
sleep happens early before other threads have started.

The patch is tested on CreativeZEN and Fuze+.

The datasheet was not very helpfull, so some experimentation was needed.
I came to the following conclusions:
* setting HP to ground:
  to prevent popping noises, the headphone output can be set to ground.
  This however must be done before any part of the audioout module is
  powered up (setting HP to ground itself will lead to a pop otherwise).
  This consequently means that HP must NOT be set to ground for powerdown
  sequence!
  Further study showed that setting HP out to ground has no audible benefit,
  controversly not setting/resetting allows for noiseless RoLo-ing.
* headphone amp class A/AB mode:
  initially the HP amp is in class A mode, and should be set to
  class AB before playing audio, as the datasheet mentions.
  If the HP output is set to ground, it must be released BEFORE
  setting class AB! Releasing from ground while in AB mode leads
  to a very loud pop!
* release HP from ground:
  as said before: never release the HP from ground if the HP amp is
  set to class AB mode. Therefore the correct order is to power up the
  headphone amp, wait some time, release HP from ground, and then
  set the amp to class AB mode.
  To prevent pop, some time is needed before releasing the HP from gnd.
  On CreativeZEN 2 sec seems to be ideal; 1 sec have no audible effect,
  1.5 sec softenes the pop to some degree.
* shutting player off
  The popping noise when shutting off is much quieter that on power up,
  so depopping measures are not absolutely necessary.
  However the power off pop can be silenced by inserting a wait time
  after the audioout block is closed and before the rest of the chip
  is powered down. The longer the better, a time of 5 sec practically
  eliminates the pop.

Note that RoLo-ing can still produce noise, because the audio device
is not properly shut down.

Change-Id: Ib20e1d613b346433d2a711c442e303ededc26e78
2025-11-12 16:07:23 -05:00
Mauricio Garrido
3b7dafb117 3ds: 3ds port sources. Second set of two.
This commit adds new files written exclusively for the 3ds port.

Additional comments:

1. Plugins works, but will be enabled in future commits.
2. The port has only been tested on the New 3DS.
3. Not all features of rockbox have been tested so there may be bugs or non-functional features.
4. There is a known issue where a random crash can occur when exiting the app.

Change-Id: I122d0bea9aa604e04fca45ba8287cf79e6110769
2025-10-23 20:09:12 -04:00
Mauricio Garrido
a4de1195cd 3ds: 3ds port sources. First set of two
This commit adds changes to the original rockbox sources.

Note: the port files, functions, folders, etc., will be referred
to as 'ctru' to avoid using the Nintendo name elsewhere.

Change-Id: I0e2d3d4d2a75bd45ea67dc3452eb8d5487cf1f5a
2025-10-23 20:09:09 -04:00
nift4
cd54b4e046 Disabled hotkey for Sony NWZ-E370/E380 targets since actually it is not in use
Patch by Igor B. Poretsky <poretsky@mlbox.ru>

Change-Id: I464948c9fb074910c0296579c650d0297a4a412b
2025-10-21 17:49:59 -04:00
nift4
df3712e708 nwze370: fix bootloader regression I caused
Change-Id: Ia14a9f46b4a6cc393043f59b586457e982472dc0
2025-10-21 23:33:36 +02:00
nift4
b1511738f7 nwze370: improve lcd & backlight
Added lcd inversion
Fix issue where backlight would turn on before first frame rendered
Fix issue where backlight would shortly appear at 100% before PWM is
ready during fade in
Turn off backlight before booting/RoLo/shutdown to avoid it being
enabled on next boot
Fix issue where fade in isn't smooth because brightness levels below 13 were
basically equalivent to off, by removing these brightness levels

Change-Id: I868eae2cbeea52c6af7d09c886958ff46167fe26
2025-10-21 16:54:57 -04:00
Solomon Peachy
60ddb02573 winsim: Fix filesystem access
Corrects a regression introduced in

    a2c10f6189

Change-Id: I9a27a6192ff6a9d1be7829d23d23dbf98b84feae
2025-10-16 18:00:32 -04:00
Solomon Peachy
9aa6a35b3f Fix warnings introduced in prior commit
* #define CONFIG_RTC APPLICATION  (in sim builds)
 * #define CONFIG_STORAGE 0        (in PCTOOL builds)

Change-Id: Iabb77bd0a29ca06a13d1075f1e8cedb00f785c64
2025-10-12 17:20:20 -04:00
Solomon Peachy
0f8f05db29 build: Enforce -Wundef on all targets.
Simulators (and some hosted targets) no longer get a free pass!

This commit includes general fixes for simulator builds, but it
will undoubtedly result in many more warnings that need to be properly
fixed.

Change-Id: I6bb9d3fc4a29ccfe40366c438e058b5dfff0ddc3
2025-10-12 16:12:56 -04:00
Sebastian Leonhardt
a4aaf94af1 fix typo in imx233_power_get_info()
obviously the number should be 14400 (confirmed by datasheet)

Change-Id: I89dbd291a388fdd27575d814dc54609ebc17c964
2025-10-08 11:01:49 +02:00
Solomon Peachy
5a4030cb35 usb: Partial revert of previous commit
...A rebase gone wrong led to a bunch of extra crap in the commit.

Change-Id: Id8f0e33b9fba0949594701fbc574da58e74fa776
2025-10-05 15:56:00 -04:00
Solomon Peachy
43ec77f84c usb: Strip ALL spaces from passthrough ATA serial number
Leading spaces in particular were resulting in Linux warnings/panics, but
to be safe strip out all spaces, including those in the middle.

This was noticed on an ipod6g with the stock hard drive; it reported
a serial number of '            xxxxxxxx', which is technically legal
per ATA specs, but needs to be properly trimmed.

Change-Id: I34309fe64b341caefd5b18f6d0cf539cb97d4a38
2025-10-05 15:48:12 -04:00
Aidan MacDonald
e24deccd00 sound: fix volume change being reported to %mv tag on boot
Setting the last_volume_change time was moved here in
commit 2e08b0f82e ("sound: update global volume state
in sound_set_volume()"); however this also triggers the
%mv tag on boot, as if the user was actively changing
the volume.

Move the last_volume_change update back to the original
call sites to fix this.

Change-Id: I895112cea4315f194f67c27839f1082d67c1ffa9
2025-10-03 10:01:02 +01:00
Aidan MacDonald
b19b95c00f sound: update global volume state in sound_set_volume()
Instead of calling sound_set_volume() and then manually
setting global_status.volume to match, update the global
volume state directly in sound_set_volume(). This makes
things a bit simpler and less error-prone.

Change-Id: I4db4d60ae1a72bd051ef49c90b1ae7f5ba59e535
2025-10-02 14:32:54 -04:00
Sebastian Leonhardt
a7cf86e5c1 Creative ZEN: enable multiboot
defines redirect file name as "rockbox_main.zen"

Change-Id: Ieb0f10492ccf6edfa5652882ec031a7b4e862b04
2025-10-02 08:52:33 -04:00
Sebastian Leonhardt
58ad4ecf54 IMX233: make use of register define for bootdata
(the #define is already there, just unused)

Change-Id: I96d5cfe3ffc87a918eb6cd3e1eca8d9f4c91e13f
2025-10-02 13:06:11 +02:00
Solomon Peachy
1ab63c3d92 ipod: Small cleanup of piezo code on PP502x-based iPods
Basically use proper register names instead of magic values.

PP5002-based ipods (ie ipod1g-3g) use UART1 to drive the piezo vs
PWM of the newer models.

Change-Id: Ia333717a825ac6a0ebf43850fc31fca34178dd88
2025-10-01 20:46:43 -04:00
Aidan MacDonald
b09ce21023 echoplayer: fix incorrect button reporting
Must've been a copy paste error...

Change-Id: I751c529c748037f9afe5d2e4543d3630693d2d21
2025-10-01 18:28:12 +01:00
Solomon Peachy
aef5cec1ad disk: Minor cleanups with respect to virtual<->logical sector mapping
Change-Id: Ib20c73c8afe6cf71165600ace1b2ca4b10de2ae8
2025-09-22 22:12:59 -04:00
Solomon Peachy
d7d80a0c3a misc: Fix up more gcc9 warnings
Change-Id: Ia2f763ca7494c6a93b48bdd347a91f3d1a967f29
2025-09-21 09:03:00 -04:00