Commit Graph

11211 Commits

Author SHA1 Message Date
Moshe Piekarski 12f3ed1699 make the plugin API frambuffer agnostic
Change-Id: I5abdc231093054c517ff53b9a456997e440e3f6e
2020-10-26 12:28:48 -04:00
Solomon Peachy 845e5a4f03 sonynwz: A10 and A20 series support high bitrates
Change-Id: I6b33368ed5d7800b79dafbb736e6ed079accbd25
2020-10-26 07:42:48 -04:00
James Buren c5d7cd5f9f h300: add support for ROM image generation
Change-Id: I6e0985de370609bae98ba6eab487bf43eb4191b6
2020-10-26 01:37:42 +00:00
Solomon Peachy 28b9c8bfeb rocker: Disable mute-on-pause, due to a platform kernel bug.
In short, the display fading back in after a pause resuming interferes
with the audio codec, causing BadThings(tm) that cannot be recovered from

This really is just avoiding a known trigger; there's no guarantee this
condition won't occur under random circumstances during normal use,
and there's no good way to work around this from within rockbox.

I suspect the underlying problem is that both the display control and
codec control share an i2c bus, but the kernel drivers implementing them
isn't using proper linux bus access/locking.

Change-Id: Id4f56f9cb269ed74aac2f041146b3630cef09030
2020-10-26 01:07:59 +00:00
James Buren bde72efa30 coldfire: make the RAM and ROM image locations configurable by macros
Change-Id: Ie27e39c34947b0391be621dafb8711c44e863a1c
2020-10-26 01:07:14 +00:00
James Buren 129001909d h300: enable support for iriver_flash
This also modifies the configuration file to include macros
defined in the H100 / H120 implementation.

Change-Id: Iae845889c98661ec548c04fc57e733dcc346c0f1
2020-10-26 01:07:14 +00:00
Solomon Peachy 39a0d8bf86 x3ii/x20/rocker: Fix volume scaling.
Change-Id: Ie70d709b4c18f16cdd67aa05d9183b4ace2e66b4
2020-10-26 00:12:54 +00:00
Solomon Peachy 49c4577fa6 Get rid of another vestigal SH remnant in the rom linker script
Change-Id: Id7509ad4affc4d72fbfdd11b39a404ad54c76f1b
2020-10-26 00:12:54 +00:00
Solomon Peachy d4a80ce94b pcm-alsa: fix red.
Change-Id: Id8d5442b0b3eb4ce3c20d1c9d24f07b5378cc22f
2020-10-25 08:38:24 -04:00
Solomon Peachy 4afd1f9aa6 hosted: Document HW capabilities of audio drivers
One surprise:  X3ii is capable of 384KHz playback

Change-Id: I0cc88637c81a21d54979e82b2941fe14de933d4d
2020-10-25 00:42:41 -04:00
Solomon Peachy e7a492ef55 hosted: alsa: Fix two bugs when recording
Change-Id: Ib97857874676ea4aa8f04d44e048de8465a4da4f
2020-10-25 00:42:37 -04:00
Solomon Peachy ec2a34b321 pcm_mixer: Fix an idle frame calculation bug introduced in 2e708c48c5
Resulted in playback sometimes hanging after switching tracks

Change-Id: I3d7a3c131cf547206ec536d9818c5060113f2b11
2020-10-24 02:00:50 +00:00
William Wilgus d78a37676e ClipPlus BOOTLOADER DONT FIT!
REMOVED FROM ALL NATIVE BOOTLOADERS:
finish removing the text scrolling
pare down printf to a minimal subset (%c %s %l %d %u and %x(%p))
remove diacritic and rtl language support

GOAL 134000

START 135305

CURRENT 133700

SUCCESS! (ASSUMING IT WORKS -- UNESTED)

Change-Id: Ic3f6ac1dc260578f581ee53458b3e5bb47d313ec
2020-10-23 20:38:59 -04:00
Solomon Peachy a8aa8403ad samsungyp: Enable recording feature. No idea if it works. :D
Change-Id: I48952f0551aaf1023f084e0be18354970d2492ed
2020-10-23 17:49:07 -04:00
Solomon Peachy 46e357f1bb ALSA: Further rework:
* Get rid of non-async (ie tick task) mode due to inherent brokenness
 * Get rid of nonblock mode; we never write if buffers aren't sufficient
 * Move driver init into pcm_open() instead of pcm_init()
 * Much better underrun handling
 * Better error handling in some situations
 * Add in recording functionality
 * Use smaller audio buffers to avoid glitching
 * Don't start audio buffer with silence
 * Allow device name to be overridden by target

Recording portions based on work done by Lorenzo Miori in g#633

Change-Id: I0197bdc1749c28109eb79def1e6a3e1d62d8cef3
2020-10-23 17:48:51 -04:00
William Wilgus 3a7a46d1c0 Hosted targets Fix timer cycle calculation overflow
at 1 GHZ the intermediate calculation for cycles overflows 32 bits
this makes timer fail even with sensible values
solution divide both sides by 100

Change-Id: I18a4054c2d06fb72531d5496bba562f71b03984f
2020-10-23 15:35:11 +00:00
Solomon Peachy 02c5dd3641 fiio: Another bugfix in the mute code.
Change-Id: I165f4871fa79fb5759d2f0833c543edd5f1ce779
2020-10-22 13:16:20 -04:00
Solomon Peachy 97b8692b65 fiio: add in a missing audiohw_mute() call.
Change-Id: I837dcb81b8814573fe947d6c7cfa10ff651689d0
2020-10-22 16:14:16 +00:00
Solomon Peachy 884d8922e3 hosted: Allow ALSA driver to switch output device at runtime
* Allow output device name to be specified
 * Set hw/swparams prior to actual playback start, not at init
 * If told to open a new device, cleanly close down old one.

Change-Id: Ib97310ec23588136c031466ee9c22312ab0f9f5a
2020-10-21 13:24:47 +00:00
Solomon Peachy 6b13437aff Add UI Simulator for Eros Q / K series
Change-Id: I9ffc101bd904b3f0e2d6a86a43fb1ae3fda73a19
2020-10-21 13:24:01 +00:00
Solomon Peachy 6834d1a02f xduoox20: Start unmuted, as the least-worst option
Change-Id: Ie85d9df0f861315dfc9d767218d86115420aa9d7
2020-10-20 17:07:48 -04:00
Amaury Pouly 08513103c6 nwzstools: add NW-A820 nvp nodes
Change-Id: Iab79eb0c9b0bbf8fb7622f5630f385d56878507a
2020-10-18 22:34:16 +02:00
Solomon Peachy 6a94f1e995 sonynwz: Properly support multidrive, with hotswap of the SD card
Change-Id: I7eb8efb0986a395d5ffbcc06a54bb680e0b59e9d
2020-10-18 10:19:42 -04:00
Solomon Peachy 5f75c493e3 xduoox20: Remove a duplicate config option
Change-Id: Ieeacc8b42d2a4d1c647cfa3b0d00f90fe98af0ed
2020-10-17 22:52:48 -04:00
Solomon Peachy edbdefa09a hosted: Drop a bootloader version string in /etc, and report it in debug menu
Change-Id: I4d72d7800dbff56619898b6bc9d0f81a6c561598
2020-10-17 21:40:40 -04:00
Solomon Peachy b1e21bbd7a hosted: Consolidate common config of hiby-based units into a common header
* Enabled MULTIDRIVE and ROOTFS_HOTPLUG for full hotswap!
   (Requires updated bootloader/integration!)

Change-Id: I7dad1f8d375e087c36fce37bec3e9184602ede50
2020-10-17 20:45:41 -04:00
Solomon Peachy 6f9a157fca hosted: Fix USB mounting code to work with HAVE_MULTIDRIVE enabled
Change-Id: I48944c28903db117d3d883a5e777cafe5d055600
2020-10-17 18:38:49 -04:00
Solomon Peachy f3ec58c05b hosted: Support hot-swappable internal and external storage
Change-Id: I321e9da4d5087dbd91194e6faa35cd4a685a0495
2020-10-17 18:38:49 -04:00
Solomon Peachy d8d37ffdb8 Define a USB storage type, and hook it up for hosted targets
Change-Id: I56363c989139c7edf0b2c67b0aac9ef1adfacba2
2020-10-17 18:38:49 -04:00
Solomon Peachy 0a4a920029 hosted: ROLO: Fixes for PIVOT_ROOT targets
Change-Id: I4888bd5db6f8a419d312c6b017f676ba6c749d89
2020-10-17 18:38:46 -04:00
Solomon Peachy 012908e064 hosted: Fix HAVE_MULTIDRIVE to work properly with PIVOT_ROOT
Change-Id: Ibc97de5c345e88c19ad8ba8c05fefebbada08790
2020-10-17 17:10:52 -04:00
Solomon Peachy a68fc3b6c2 xduoox3ii/erosq: Fix CPU frequency declared in header
(108 MHz -> 1008 MHz)

Change-Id: I2baf416689e2afb68948609e226df8c5feeecc4a
2020-10-17 17:10:52 -04:00
Solomon Peachy 13f5e123f9 samsung yp-r0/r1: use os-native opendir() in the low-level driver code
Fixes blank LCD on both R0/R1 and the PMU on the R1

Change-Id: I356907676f7a0a009897fd4895bf78c1022b71d1
2020-10-17 14:37:15 -04:00
Solomon Peachy 0e667ff5b0 sonynwz: use os-native opendir() in the low-level input driver code
instead of the rockbox opendir() wrapper.

Change-Id: I06e8c2d7997c7cc3d507f06659d46cdfd6a02ce3
2020-10-17 14:22:02 -04:00
Solomon Peachy ce40ef42ff hosted: Make sure we don't call mixer/etc controls when we're not ready
(Might fix the rocker crash-on-shutdown bug)

Change-Id: Id375fc5053adef18d7ec812bdba36ee002e706ef
2020-10-16 20:34:18 -04:00
Solomon Peachy c6d2a0358f hosted: open input device as read-only.
Change-Id: I4dcd98f45f41fe06a0a75a2a0dd45c753c2cf365
2020-10-16 14:37:01 -04:00
Solomon Peachy 2e07223690 m3k: Fixes for the M3K.
* Cannot turn off the LCD directly (have to rely on backlight)
 * Only insmod/rmmod the usb gadget modules if state changes

Change-Id: I9ea90177d496cd035ada93e04a93a7c6f2e84706
2020-10-15 14:11:41 -04:00
Solomon Peachy 82787709bd update the hibi patcher script to handle initial m3k stuff
Change-Id: I63ed8443952888da3dafb23ff6e7daf9c7aca574
2020-10-15 13:31:28 -04:00
Solomon Peachy 0cde20fadb xduoox3: Disable the DAC's digital de-emphasis filter.
Whether or not this is correct depends on how the source material was
mastered, digitized, and/or encoded.  There is no setting appropriate
for everything.

Eventually I'd like to make this configurable, but I'd want to have it
shared with more than one target first.

Change-Id: I20a0eff4b3dc2517c33db49d4f72e85bf81d1ca6
2020-10-15 13:30:48 -04:00
Solomon Peachy d544ce46a7 hosted: Unify the USB code for the hiby-based players.
* Specify exported USB VID/PID in target config header
 * Don't fail if the sd filesystem has already been remounted
   (ie due to platform hotplug)

Change-Id: Ifd2dae0c4f15086bf2bf89eb093018b3c4d2b75d
2020-10-15 10:18:16 -04:00
Solomon Peachy 4873a1ac61 fiiom3k: Temporarily disable filter rolloff programming
(Hardware control isn't wired into ALSA properly)

Change-Id: Iac537d2d90a6119b8c002cd38a558a4ebb3321eb
2020-10-15 07:43:14 -04:00
Solomon Peachy 1b449abf39 erosq: Add battery discharge curve and initial runtime estimation.
(playing mp3 with headphones inserted lasted just over 13 hours)

Change-Id: Id610f911811eafd914db20000ae860c75e0d8a93
2020-10-14 08:37:00 -04:00
Solomon Peachy 19d45c9257 Work around wonky inline asm issue with creativezenvm build.
The right thing here probably to just not bother at all, as this
bootloader can't launch rockbox yet anyway.

Change-Id: I62bd22353b6adc9dbe35b94f3b60a6a67348356a
2020-10-13 21:48:23 -04:00
Solomon Peachy 26bebd77ab Fix more red.
Change-Id: Id1a45b420f8eb70a25010b058822b78f80db33d8
2020-10-13 19:45:03 -04:00
Solomon Peachy 09785a8499 fix more yellow
Change-Id: I74bad58707d05ea167169d4315c05eb0cd1c8b7b
2020-10-13 17:23:56 -04:00
Solomon Peachy b94db707fb Fix more warnings.
Change-Id: Ib3a9fc622a46b1fc72e94dcbc6d29d2e430cd81b
2020-10-13 15:48:31 -04:00
Solomon Peachy 431caa4311 imx31: Work around an apparently not-quite-kosher abuse of CPP
(we were trying to foward-declare functions from within static
 initializer context.  GCC no longer accepts this)

Change-Id: I58f316ecc84c8ab45fffc054955727a55714b0a3
2020-10-13 15:48:31 -04:00
Solomon Peachy f8bd54d575 iaudiox5: Fix red, due to slightly bogus asm
Change-Id: I6ebcda3452d4244b5e2d1a9bbeb9fff9a9456388
2020-10-13 14:18:35 -04:00
Solomon Peachy 4a3d046545 Fix a pile of yellow in the bootloader
Change-Id: Ia89a33bbb13683566e421ac2a002baa20cdb07de
2020-10-13 13:37:21 -04:00
Solomon Peachy e91f89a410 xduoox3ii: Update battery curve.
Change-Id: I2cc04d696631ba887fa8943d94360f902bf12e85
2020-10-13 16:01:55 +00:00
Solomon Peachy 688575368c rocker: Fix red introduced in 01dc81c
Change-Id: I08169395702b74f8ea6cd939520c69745ae8b876
2020-10-12 11:48:07 -04:00
Solomon Peachy 17244177ee hosted: Fix a corner case in umuting the x3ii and erosq
Change-Id: I3ffc3b82c6137bab3f27cd87ccc57c2f03a1d401
2020-10-12 11:46:05 -04:00
Solomon Peachy 078c34e951 hosted: More PCM muting work
* Track mute state, only call hw if actual change is needed
 * Don't unmute in audiohw_postinit()
 * sample rate tracking fixes
 * erosq:  Don't start up muted

Change-Id: I004f787a4b7ea73c16b6ec9818ec29a12c89f46b
2020-10-12 15:33:32 +00:00
Solomon Peachy 01dc81cd94 rolo: hosted: Make display output non-glitchy
Change-Id: I63d6a28d67fa56d3541aaa121356c8ff2ce10bbe
2020-10-12 11:16:15 -04:00
Solomon Peachy 141e91ef1f Hosted PCM: Rework auto-muting code a bit
* If AUDIOHW_MUTE_ON_PAUSE, no meaningful change
     * Unconditionally unmute on playback start
     * xduoox3ii:  Mute on sample rate change
     * rocker/xduoo:  Stay muted after startup

    This avoids the nasty "pop" on startup, without doing
    the full mute-on-pause stuff that causes unacceptable
    dropouts on the X3ii.

Change-Id: I2e3ee0bb8094e288f37a0acada86a80016ce5cac
2020-10-12 13:40:37 +00:00
Solomon Peachy 135b3f6416 Fix inverted test that made SDL_APP unhappy
Change-Id: I18a51ddd0fa7fd0afda938c732fadce4cd87c262
2020-10-11 18:35:55 -04:00
Solomon Peachy e1bc36ca31 Turn on ROLO for M3K too
Change-Id: I7e1b2168a70605c5a138d83fd69e847fd02af4a4
2020-10-11 18:34:04 -04:00
Solomon Peachy db6f21e295 hosted: sanitize handling of HOME_DIR
* HOME_DIR is now either "/" or special "<HOME>"
   * target-specific "home dir path" is defined solely by PIVOT_ROOT
 * PIVOT_ROOT path is now defined in toplevel config files
 * Make Samsung YP-R0/R1 and SONY_NWZ use PIVOT_ROOT too
 * Do not prepend PIVOT_ROOT path if the path already has it!
 * Do not play these games for __PCTOOL__ builds

Change-Id: I3d51ad902a5f9cafe45ba15ba654f30f1ec6113a
2020-10-11 17:47:34 -04:00
Solomon Peachy 2a471e288c New port: AIGO EROS Q / EROS K
The Q and K have a slightly different case, but the hardware under the
shell is completely identical.

These models are rebadged versions:

 * Hifiwalker H2   (== Q)
 * AGPTek H3       (== K)
 * Surfans F20     (== K)

Other notes:

  * Significant improvements in the shared Hiby-platform launcher/loader
    * SD card can theoretically be hot-swapped now
    * Support external USB mass storage!
  * Some consolidation of Hiby-platform targets
  * Some consolidation of plugin keymaps

Todo/known issues:

 * Keymaps need to be gone over properly
 * Convert to HAVE_SCROLLWHEEL?

Change-Id: I5a8a4f22c38a5b69392ca7c0a8ad8c4e07d9523c
2020-10-11 16:37:17 -04:00
Solomon Peachy 6533d983ca hosted: Add ROLO support for hosted targets
Change-Id: I2d46a63ee8225a9d9d77dd80a06c418af78c260c
2020-10-11 14:18:42 +00:00
Amaury Pouly 76fbb33adf nwztools: fix MW-WM1/A30 KAS, fix KAS length
Split WM1A/WM1Z because they don't have the same KAS. On newer devices, the KAS
is actually 64 bytes, not 60. The strange thing is that "get_dnk_nvp kas" returns
60 bytes whereas "get_dnk_prop kas" returns 64, not sure why.

Change-Id: I944d3d838209ba58388439af0cdf5d7c74f1f7fc
2020-10-11 13:08:03 +02:00
Solomon Peachy 5cfd3ae4e6 hosted: Use O_CLOEXEC for all open() and "e" for fopen() calls
This way we'll automatically close the files upon exec()

Change-Id: Ic0daca8fb56432830de4a2f4a86a77337121ecc7
2020-10-11 01:47:03 -04:00
Solomon Peachy 4b10aacbc2 xduoox3ii/x20: headphones take precedence over line out
so if both are plugged in, assume headphones (and respect volume)

Change-Id: Ia77ae6d484ac61f6a2b4cd51a991f59de239cfa6
2020-10-09 20:52:43 -04:00
Solomon Peachy 6c6642e8d5 m3k: Fix red bootloader build
Change-Id: I3a6e9e6222e6219484c6903325c985bff8af39ef
2020-10-09 19:54:49 -04:00
Solomon Peachy aabc8aca47 New port: FiiO M3K
Most credit goes to:  Roman Skylarov
Additional integration and refactoring by myself.

 *** COMPLETELY UNTESTED ***

Change-Id: Ia64c36d92e0214c6b15f7a868df286f8113ea27b
2020-10-09 12:41:18 -04:00
Solomon Peachy 4231c2c83f codecs: Add support for the 'VTX' ZX Spectrum chiptunes format.
This codec requires floating point.

Original author:  Peter Sovietov
Ported to Rockbox:  Roman Skylarov
Further integration and bugfixes:  Solomon Peachy

Change-Id: I781ecd3592dfcdbbc694063334350342534f1d6c
2020-10-09 11:39:25 -04:00
Solomon Peachy 88b2a45b5f xduoox3ii/x20: Define a sane BUTTON_LEFT/RIGHT alias
Change-Id: If11dfa50aeb8cb8b80de730c494d81a9e87880c4
2020-10-09 12:15:43 +00:00
Solomon Peachy 7a1bf01541 Undo the hacks that allowed targets without LEFT/RIGHT (UP/DN) to build.
Replaced them with warnings until they are fixed *PROPERLY*

Change-Id: I4425200e60f8b5224262a54f105b974cec471d22
2020-10-08 20:30:08 -04:00
Solomon Peachy dc81f96fd1 Don't compile audio codecs into native bootloader builds.
Change-Id: I0b2cc143572bf88423bdf7647cee0af567aee684
2020-10-08 19:20:50 -04:00
Moshe Piekarski 2e2e899869
more DEBUG build fixes
Change-Id: I4ae2b79f53ce59c37ccc9ef06f5ebd145e988763
2020-10-07 00:01:07 -05:00
Solomon Peachy 914114fd21 FS13241: Get rid of the hacky hold switch emulation on the X3ii & X20
It doesn't work properly and interferes with the power button in the keymap.

Rework WPS keymap a bit to make single-tap power emulate lock.

Change-Id: I9d9b9b4adcea3764e6e427f484e051c9bab9d13b
2020-10-05 22:55:08 +00:00
Solomon Peachy f3ae48f552 hosted: control buttonlights along with the display backlight.
Change-Id: I03385db46e94ca1bb6a4e35c89f630145c9d40e5
2020-10-03 20:12:31 -04:00
Solomon Peachy 7642184fd9 alsa: Refactor pcm_dma_apply_settings_nolock()
Change-Id: I32190e6987afca99b24197ca7ae2853053062d30
2020-10-03 20:12:31 -04:00
Solomon Peachy 1916aca7f3 imx233: Enable 96/192K playback for all imx233 targets that have room
Change-Id: Ief00cc9243af3168f0c088520936137b64f3b581
2020-10-03 16:56:19 -04:00
Solomon Peachy c1d4bf290c coldfire: Fix iAudio M5 build
Change-Id: Iecbcfa16918be3abfaab0936a0dae9c9ed48933e
2020-10-03 16:56:19 -04:00
Solomon Peachy d5167b1221 coldfire: Allow building when 88KHz audio is disabled
Change-Id: Ieeacf591ad4233428dca99c347043e61abae1d1f
2020-10-03 15:57:38 -04:00
Solomon Peachy 2b358ffa7f Disable 88/96KHz from targets that lack the IRAM to hold the mix buffers
Change-Id: I67b15d4c517a74a23639f8659acbc89022c264b5
2020-10-03 15:27:30 -04:00
Solomon Peachy 2e708c48c5 pcm: Dynamically-size the mixer buffer at higher audio bitrates.
Basically, existing sizes apply for <= 48KHz audio. Up to 96K,
we double the mix buffer.  up to 192K, we double it again.

Will help reduce the interrupt load and overall latency, keeping it
roughtly constant as a function of time, regardless of bitrate.

(It is acutally a fixed-size buffer, statically-allocated to handle the
 worst-case bitrate the player supports. However, at runtime if we are
 using a lower bitrate we will only use a portion of it in order to keep
 latancies down)

Change-Id: I61ca23180a86502732b0903fe9691c1a8c2aeaea
2020-10-03 14:19:17 -04:00
Solomon Peachy d4a620e85a alsa: introduce AUDIOHW_MUTE_ON_PAUSE, and have rocker use it.
Change-Id: I1edbb8e71a9c73baaeecb01b66cbee6c3f7b5f8f
2020-10-03 14:41:40 +00:00
Solomon Peachy d18157608d xduoo codec cleanups
Change-Id: I6c3437bde2d9f781a02ffc6b3a83148b9a7af872
2020-10-03 14:41:21 +00:00
Solomon Peachy 1824f8b103 xduoox3ii/x20: Rework the mute control to actually function properly.
(By switching the output away from the audio jacks)

Change-Id: Ib8511c9d45029bba038dc4d1d187174d56cb3043
2020-10-03 04:13:13 +00:00
Solomon Peachy 90c30bc7ef alsa: Explicitly mute the output when we stop playing, and unmute after playback starts
Allows us to avoid hearing the codec powering on and off.

Change-Id: Idaaff437932009952ed248be97eedf54cb4cf28e
2020-10-03 04:12:51 +00:00
Solomon Peachy c7eceea183 alsa: Handle underruns when starting a new stream
Unsure why this is happening, but now we detect and recover errors at
startup.

Also clean up the mismash of printf(), DEBUGF(), etc in favor of panicf() for the really serious stuff and logf() for everything else.

Change-Id: I9aaa620d55d556645c9a6d108541b987983b32a8
2020-10-03 01:04:53 +00:00
Solomon Peachy b0e1b245b4 alsa: Use larger playback buffers for higher bitrates
(existing ones apply up to 48KHz, scale up linearly to 192KHz)

Change-Id: Iac32d49b8073b63a5d40fd21f41437e6051cb8de
2020-10-02 09:50:38 -04:00
Solomon Peachy 90af40e90c imx233: Hardware codec supports up to 192KHz. Make it so!
Change-Id: If08a1d244f28092a5d5332d666fb9afdc78f35a9
2020-10-02 09:50:38 -04:00
Solomon Peachy 9892e468d5 hosted: Don't use O_SYNC for the framebuffer handle.
Change-Id: Iff4b1947fe053313d677b894c78250760aaef967
2020-10-02 09:48:59 -04:00
Solomon Peachy b5cb99a7bf For backlights that have a wide control, support skipping steps.
the rocker, x3ii, and x20 now take advantage of this, and fades
are far faster now.

Change-Id: Iceb1a5a6c1d1389c3fdb859b32016b5114a80a22
2020-10-02 02:45:43 +00:00
Solomon Peachy 9ee618e889 hosted: Fix overzealous spamming of backlight and lcd enable
This caused random delays in LCD activity, and also caused key inputs to go nuts

Change-Id: Ie483c86f7461455308f8c5f8999df313521c6b55
2020-10-02 02:24:42 +00:00
Solomon Peachy f4f3255edf xduoox3: Work out clocks for 176/192KHz support.
Note:  PCM mix buffer sizes are _way_ too small for these high bitrates

(We really need to make the mixer stuff use dynamic buffer sizes based
 on the bitrate.  Maybe pre-allocate a max size based on upper bitrate limit,
 but use only part of it at lower bitrates?  So we can have sane latency..)

Change-Id: Id7b4afd73dba7f1ffb84b2e1c016859fae5d6835
2020-10-01 17:30:22 -04:00
Solomon Peachy db22dae2f9 fix more red.
Change-Id: If5fee31d633e5f75272ba85f5293ad01b1ce573a
2020-10-01 16:39:37 -04:00
Solomon Peachy a96eb1a7f7 Fix warnings and errors introduced in b030bf5
Change-Id: I23966b6a79c0d2cbab2e01c649c1b991f460d8ad
2020-10-01 16:08:20 -04:00
Solomon Peachy b030bf5885 xduoox3ii/x20: Proper lineout detection and volume mangling.
hotplugging hp and lineout works, without blowing out eardrums.

Change-Id: I2df5c7a618bb2d1d77d416548d45dff9cfc619db
2020-10-01 15:41:30 -04:00
Solomon Peachy 6d47dc9a88 fix some of the red introduced in e43726d
Change-Id: Id1abb0dd11f8a8e79a80fc54e58a5a22706a03ad
2020-10-01 12:55:52 -04:00
Solomon Peachy e43726df2c hosted pcm-alsa improvements
* xduoo x3ii/x20:  Better line out support
 * less granular volume settings (too many steps before)
 * Better handling of swiching sample rates
 * Log actual sample rate in debug menu

Most credit goes to Roman Stolyarov
Additional integration [re]work by myself

Change-Id: I63af3740678cf2ed3170f61534e1029c81826bb6
2020-10-01 11:56:57 -04:00
Solomon Peachy 021b55735b hosted: fix shutdown crash in framebuffer code.
Change-Id: I78315b81ab8df0408abc64d5edb6af37db568ad7
2020-10-01 14:01:21 +00:00
Solomon Peachy 0a7b23097a Hosted: Improvements in the LCD code. (Roman Stolyarov)
* Kill LCD when turning off the backlight
 * Fix logic errors in lcd_enable() calls
 * Use ioctls instead of sysfs to twiddle lcd enable

Change-Id: I6864ff63d87b747ac48719b0f4ba2de00333a1d3
2020-10-01 12:49:39 +00:00
Solomon Peachy 1cd004ff5b pcm: Missed a file for the 192/176K playback.
Change-Id: Ie9b5299bfb074604db5a9ac340f67c5ed75aa926
2020-09-30 22:03:34 -04:00
Solomon Peachy 01650b8bc9 audio: Add support for 192 and 176KHz playback
* SAMPR_CAPS_ALL -> SAMPR_CAPS_ALL_48/96/192
 * All targets claiming SAMPR_CAPS_ALL now get appropriate subset
 * No need to explicitly define HAVE_PLAY_FREQ
 * Rates that are a multiple of 44 or 48KHz can be used for playback

Inspired by a patch by Roman Stolyarov, but substantially rewritten by myself.

Change-Id: Iaca7363521b1cb9921e047ba1004d3cbe9c9c23e
2020-09-30 21:37:11 -04:00
Solomon Peachy ff408fd717 Leave HOME_DIR out of default recording and playlist paths
The hosted filesystem code will automatically prepend HOME_DIR.

Change-Id: I36a76e51637ab2bb68353f8eb9ffac25ca75bad1
2020-09-30 18:56:54 +00:00
Solomon Peachy 977a03a1a4 fix x20 and yp-r1 builds.
Change-Id: Ifc6638c2ed6bc862ded389f1b81f30c7a0419ec0
2020-09-28 22:26:59 -04:00
Solomon Peachy 0fe7db2460 xduoo: x3ii and x20 also have their CPUs clocked at 1008 MHz.
Change-Id: I59fbd1edc934a6e2b2323e13b4efc3cc1caad903
2020-09-28 21:17:39 -04:00
Solomon Peachy ae58b5aafe xduoox20: UI Simulator support
Change-Id: I2a03cea07fbad9fb5862ca69e4cfca2e8ca6b17f
2020-09-28 21:12:52 -04:00
Solomon Peachy 43980bb877 rocker: CPU is actually running at 1008MHz, not 532.
Change-Id: If5204574cb604d1ea82f0863d300468bedcf541d
2020-09-29 00:37:11 +00:00
Solomon Peachy 7719010ed7 hosted: Slightly cleaner shutdown; kill the display first.
Change-Id: I620d7afb2eb0556cde07c7828b134b13892e6db4
2020-09-29 00:27:49 +00:00
Solomon Peachy fd2e65e94d rocker: Increase the long-press shutdown delay a bit.
Change-Id: Ief64f3d39556efa7de7df32eb7613a29a466a02e
2020-09-29 00:27:27 +00:00
Solomon Peachy e404026308 jz4760: Implement USB DMA RX
Can be disabled at runtime by setting hold switch.

Boosts sysbench sequential write performance by 34-58%

Change-Id: I060c9d7dddc1b448f18aa46af8f8aff046e07843
2020-09-18 17:48:31 -04:00
William Wilgus 2df3a5b04c Headphone / lineout pause/resume #FS13237
Allow Lineout to behave like headphone port in regards to
plug/unplug pause/resume

Change-Id: I9cb2c9c40e0bdf3bf7e1e272164acd343f6b3850
2020-09-18 00:22:52 +00:00
Solomon Peachy ec413f7692 jz4760: Heavily rework USB driver to add working DMA support
* DMA Bulk IN (ie our TX) results in sequential transfers 33-68% faster.
 * DMA Bulk OUT (ie RX) is mostly stripped out due to complete brokenness.
 * Interrupt and control endpoints remain PIO-driven.

Other improvements:

1) Use consistent endpoint references (no magic numbers)
2) Greatly enhanced logging
3) DMA support can be compiled out completely
4) Setting lockswitch will disable all DMA operations at runtime
5) Much more robust error checking and recovery

Change-Id: I57b82e655e55ced0dfe289e379b0b61d8fe443b4
2020-09-17 11:26:04 -04:00
William Wilgus a66b908801 Xduoo X3 add headphone and lineout status to IO Ports debug menu
Change-Id: I9caf55c1249625dff7e437158afd20a526fa7499
2020-09-17 11:22:40 -04:00
William Wilgus 3c2b6809d9 Xduoo X3 no ADC after ROLO
Speachy suggested we don't shut down the adc on ROLO
this fixes the random adc drop out on ROLO

Change-Id: Ife7d679ce51a6f767963210ee650815f1de12223
2020-09-13 13:29:00 -04:00
William Wilgus c62493e98a Xduoo X3 Add tree scrolling FS#13240, Emulate Multibutton presses
Fixes deficiencies with the button system on the X3

  The x3 has an interesting button layout.
  Multiple key presses are NOT supported unless
  [BUTTON_POWER] is one of the combined keys

  As you can imagine this causes problems as the power button takes
  precedence in the button system and initiates a shutdown if the
  key is held too long
  instead of BUTTON_POWER use BUTTON_PWRALT in combination with other keys
  IF using as a prerequsite button then BUTTON_POWER should be used

  Multiple buttons are emulated by button_read_device but there are a few
  caveats to be aware of:

  Button Order Matters!
   different keys have different priorities, higher priority keys 'overide'
   the lower priority keys
  VOLUP[7] VOLDN[6] PREV[5] NEXT[4] PLAY[3] OPTION[2] HOME[1]

  There will be no true release or repeat events, the user can let off the
   button pressed initially and it will still continue to appear to be
   pressed as long as the second key is held

Tree scrolling is PLAY+NEXT or PLAY+PREV

Change-Id: I88dfee1c70a6a99659e8227f5becacc50cc43910
2020-09-13 16:23:24 +00:00
William Wilgus e18c2f3001 XduooX3 LCD tweaks #2
Group commands for a bit more speed

bitdelay was not being inlined
lower bitdelay to 12 cycles

Clean-up magic numbers

Change-Id: Ifeb57a5532807a598f1ec5e1c55f03e4aa1e133f
2020-09-08 14:37:46 +00:00
William Wilgus af24ff1fc3 XduooX3 Gpio reconfigure button system #2
Fix issue with first battery sample taking 30 seconds

Clean up code

Change-Id: If2437d241e0ab4e3d23b141f5d853b6cf3209b07
2020-09-06 11:06:54 +00:00
Solomon Peachy 53142ae9f5 jz4760: Fix and re-enable the hardware udelay() timer
Change-Id: I591b4f023776b3501fce03e08bfc87a355f4c69b
2020-09-06 02:09:21 +00:00
Solomon Peachy 2dadb8c7d6 jz4760: Use a #define for the timer id, not a raw number
Change-Id: Ic31267a2ae82beede72100c1cc5ddf7211aa0abe
2020-09-06 00:27:07 +00:00
Solomon Peachy d015165bc5 mips: Convert 'nop' to 'ssnop' -- for future-proofing
Change-Id: I17625f4d56a1f5205887cb47668a2dcb628053f4
2020-09-05 22:18:26 +00:00
Solomon Peachy 90a4f28c27 jz47xx: Audio path tweaks:
* Increase audio buffer size to better handle IRQ latency (256->2048)
 * Ensure DMA engine is idle prior to starting transfers
 * Set AIC to repeat last sample in case of underflows

Change-Id: I9c45c20481ee072e5882b7586fb7d50bd8ef2f35
2020-09-04 15:57:00 -04:00
William Wilgus 48a2b80c77 Xduoo Gpio fix bug
Change-Id: I76eda59a391a408d1a6642497d8cc4aeb93a0da1
2020-09-03 16:06:16 -04:00
Solomon Peachy 0cb162a76b mips: Heavily rework DMA & caching code
Based on code originally written by Amaury Pouly (g#1789, g#1791, g#1527)
but rebased and heavily updated.

Change-Id: Ic794abb5e8d89feb4b88fc3abe854270fb28db70
2020-09-03 15:34:28 -04:00
William Wilgus 1ae8213a64 XduooX3 Gpio reconfigure button system
only check button values with adc when buttons are actually pressed

battery level check frequency is now around 30 seconds
switched to polling for the battery voltage w/ timeout

Ifdef functions Allow BACK OPTION PLAY to be the first of a two key combo

Change-Id: Icb48d62ac8d82b4dc931df5e1c5b4a84a9a69772
2020-09-03 18:19:47 +00:00
Solomon Peachy 546212a977 jz4760: Dial down PIXCLK as low as possible
We don't use it on the X3.  Should we ever get another jz4760 target
we can revisit this.

Change-Id: I591d02c7e47b35424b3c96b776b31a38e3c8ceee
2020-09-02 13:39:05 -04:00
Solomon Peachy f913829d06 xduoox3: Disable the LCD and MSC0 clocks as we don't use them
Change-Id: If2261aed464fcbe3ea1f036dd18376fa8ff42e69
2020-09-02 16:59:13 +00:00
William Wilgus 1a8939cc3d XduooX3 Slow down greylib framerate
halves cpu usage

Change-Id: I3797b01ecd2f7615acfed53a77d8a1f51e947c8b
2020-09-02 16:57:05 +00:00
William Wilgus 35371df671 XduooX3 Debug Menu -- HW_info
add scrolling for clocks and such

moved to a switch based structure..  this ends up a lot cleaner

Change-Id: I940506c4b8dc73f0b776d20810780527cbf7e0d4
2020-09-02 16:38:43 +00:00
Solomon Peachy bb6fc21244 mips: use .set push/pop in asm code
Change-Id: I3e7bc7ffb8d6d0c5d18a6ab38b1a270559a62fb9
2020-09-02 08:29:04 -04:00
Solomon Peachy a7ebd92ec8 jz4760: use SYSFONT in the hw info debug screen, and restore old font
Change-Id: I0c2df20a8c87f7a5bdf25d59904d32806171a544
2020-08-31 13:40:49 -04:00
Solomon Peachy 56b49b3074 fonts: Use '08-Rockfont' as FONT_SYSFIXED on targets with 128x64 screens
..It's already the default UI font on those targets

Change-Id: If8cb44da650d19882e4bd4b641af2f4fa59c1cd1
2020-08-31 13:32:24 -04:00
William Wilgus 790a5bb0ca Xduoo_x3 Boot Fix red from debug menu changes
Change-Id: I1a84cf28f8a3416d661a8e2e4dd31c9e86f50ba0
2020-08-31 02:45:09 -04:00
William Wilgus 63e6aec260 xduooX3 debug menu add GPIO IO Ports
Change-Id: I6ca9f005e412240235354b9369bcc3f4a4ad256f
2020-08-31 03:07:17 +00:00
Solomon Peachy 748133cf9d xduoox3: Fix bootloader build
Change-Id: Ia2f2dba4a263c82aebc7fab9da4ad69ef90565ea
2020-08-30 21:56:11 -04:00
Solomon Peachy 8dadce5c4c jz4760: Explicitly disable UARTs at startup
(Bootloader uses UART1, and leaves it running when it hands it off to us)

Change-Id: Icde1d713574582f18e9f91b5c95f3917fe324b74
2020-08-30 21:36:26 -04:00
William Wilgus 06e9abc428 XduooX3 Tweak LCD drive strength and slew
Change-Id: Ic5ee9e700a0c8acffc39b51cedc24ff44d230fd3
2020-08-30 17:26:43 -04:00
Solomon Peachy e06ab68166 xduoox3: Use correct "ms_clk" divider for SADC and be smarter with polling
Change-Id: Ibbbcd9fd1e7e2cfa896678cccaa00296c86c2c62
2020-08-30 01:45:15 -04:00
Solomon Peachy cc5b0439a8 jz4760: Prioritize Audio DMA and TCU0 (systick) above all others
(And loop in the IRQ handler to make sure we catch everything!)

Change-Id: I813272c69e981fdc214ec28448ced403ad366ea0
2020-08-30 01:45:15 -04:00
Solomon Peachy b01e9295e4 jz4760: Revert back to the delay loop udelay()
... the timer-based version used the same timer as our os tick!

Change-Id: Id84b308bfa1145cb8806e1029f2ca26159fb71e1
2020-08-30 01:45:15 -04:00
Solomon Peachy 733821b592 jz4760: Rework IRQ priorities, make audio the highest.
(it was effectively the _lowest_ prior to this.  wtf?)

Change-Id: I6905c5ba0d87a5e14aeae5d5b79f8f515ac5b806
2020-08-29 21:26:49 +00:00
Solomon Peachy 3dc4f817de jz4760: Disable dynamic clocking entirely.
Back off to 480MHz [max] clock, bus/mem clock of 120MHz.

576 is unstable on at least one unit, and 528 still glitches.

Change-Id: I020e48532524e739f3bfa42bed570381ccd34959
2020-08-29 14:59:46 -04:00
William Wilgus 3867f0b959 XduooX3 Sources WS changes
Change-Id: I17ae59e7ef0440756527ce50ab30f8bf34f79007
2020-08-29 10:14:03 -04:00
Solomon Peachy 6296b220e5 cs4398: Change default volume to -25 dB (from 0 dB)
Change-Id: Iac216951b6f21bd83bb1d529e231bbb3e0aa0da6
2020-08-29 08:51:35 -04:00
William Wilgus 31a1a29004 Xduoo X3 Tweak LCD settings
Adds contrast setting which actually sets the drive voltage

Change-Id: I173238e2efe9e50c6ef4cda9bf991e7ee5568ff5
2020-08-29 04:31:37 +00:00
Solomon Peachy 5e335f5c33 jz4760: do the MSC (ie SD) clocking setup when we change PLL0
Change-Id: Ia17b1d7069af507c3f029bcaed0f65e7e97df275
2020-08-29 00:29:25 -04:00
Solomon Peachy fc7eb3b2a3 xduoox3: When not using dynamic clocks, use max cpu
Change-Id: I789bb4eccc5b663156f5d1b7cd5d291b60ccb18d
2020-08-29 02:53:06 +00:00
Solomon Peachy a2b77446c2 xduoox3: enable HAVE_GUI_BOOST
Change-Id: I719057b3539d6fb80cef10238a13c5071def1be5
2020-08-28 21:16:24 +00:00
Solomon Peachy 4a6d8e91bb jz4740: Timer not re-enabled properly
(same fix as g#2703 for the jz4760)

Change-Id: Ic6467d9e6085e3057528b6d1a08b7c07e9dceab4
2020-08-28 15:19:07 +00:00
William Wilgus 77019c2c3c Xduoo_X3 Fix timer_set_period fail to reenable
when timer_set_period is called timer is stopped but never reenabled

Change-Id: I5cfc7a2d5620ff998005e013952b25f1e0a52754
2020-08-28 11:11:03 -04:00
Solomon Peachy 1aee168398 jz4760: Pull non-PLL init out of pll0_init() code.
So it only gets called once, at system startup.

Change-Id: I4c191519009e80dfb118065391295c88a014d25a
2020-08-28 10:41:41 -04:00
William Wilgus 5fb4c74bfb Xduoo X3 - Grey scale lib update
greylib on the xduoo x3 now matches the rest of the 1bit targets

Change-Id: I2685869da6734404356552cc9f4ed5f59ebd6650
2020-08-27 14:33:23 +00:00
Solomon Peachy a52eb1d8cc xduoox3: Include curves for both battery types
There is no way to detect this at runtime so it is a user setting

Change-Id: Ibc5b87312238c59e3678d512af27e3a3bcb9a58a
2020-08-26 18:18:02 +00:00
Solomon Peachy f4bf27c26e jz4760: fix the new udelay() to use _micro_seconds, not milliseconds
Change-Id: I4877b1c8e4a95259b5ade126e28458b65fbd3c4b
2020-08-26 11:56:04 -04:00
Solomon Peachy f791df1375 xduoox3: Update battery discharge curve and runtime estimates
(Brand new unit lasted one minute shy of 12 hours!)

Change-Id: I0330f43065412d432a45b555bb310f943eb526e7
2020-08-26 08:34:07 -04:00
Solomon Peachy 6920c089af jz4740: SD clock sequencing changes.
* Don't stop clock before switching speeds
 * Don't stop clock prior to transactions
 * Stop clock at the end of transactions

Will result in slightly better performance and some power saving when
we're not actively using the SD peripheral.

Change-Id: I1c82476cad97137b1469900645ecf7bb0887119a
2020-08-25 14:01:44 -04:00
Solomon Peachy 0aa2197d93 jz4760: SD driver enhancements:
* Check to see if clock is [not] running prior to [en|dis]abling it
 * Stop clock _prior_ to resetting controller
 * Stop clock after transaction is completed, not before initiating it
 * Use controller's low power mode (disables clocks when idle)
 * Fix, and enable, interrupt-driven DMA transfers
 * Fixes for full interrupt-driven operation  (WIP, still broken)

Change-Id: I723ffa6450fc85f97898c8a8b3e538ae31c4858e
2020-08-25 12:07:50 -04:00
Solomon Peachy 1b31101fdd jz4740: Fix potential deadlock in SD init code.
There's a code path that calls sd_init_device() while we hold sd_mtx, but
sd_init_device() tries to obtain the mutex while doing its work.

Change-Id: I882c595e9e7cd2224b1db0d413925668628476e9
2020-08-25 08:19:10 -04:00
Solomon Peachy 63ef81de31 jz4760: Give each SD interface its own DMA channel, semaphore, and mutex
* Allows both SD interfaces to have requests in flight simultaneously
 * Fixed a deadlock in the hotswap code
 * Ensure TX DMA is idle before initiating a request (bug due to a typo)

Change-Id: I988fa29df5f8e41fc6bbdcc517db89842003b34d
2020-08-25 12:16:33 +00:00
Solomon Peachy 6099767a18 SDL: If our eventloop fails, log the reason!
Change-Id: I028eb118b7da2701b54fce639ee0dbbb1e5a85bc
2020-08-24 21:21:33 -04:00
Solomon Peachy c7cbd494eb FS#13154: Don't discard return code in storage_init()
Change-Id: If84f8a2e35172be4b2ae7cd105b3975b587acd6c
2020-08-24 14:37:23 -04:00
William Wilgus f850bbbbc4 Revert root_redirect :(
This reverts commit 31fc46ded6.

Change-Id: Ia78618c0e8b25ca65f7c8ae0db1cb9c9b321bad9
2020-08-20 21:54:00 -04:00
William Wilgus bd744059cf Multiboot Firmware Root Redirect
Firmware now includes rudimentary redirect functionality
but this only supports /.rockbox in the root of the device

This patch allows loading external drive and directory into root namespace

Root Redirects can now be put into different folders
For instance placing '/_test' into SD1/rockbox_main.<playername>
will redirect to /<1>/_test/.rockbox

Debug menu>Bootdata now has root directory listed in addition to RAW Bootdata

Redirect root work from Michael Sevakis g#1556

Redirect will be updated if code refactor is ever done

Requires Multiboot bootloader (already in main)

Change-Id: I697b3d0499f85e789c3020bc2133fbe0023f72a2
2020-08-20 19:19:55 -04:00
William Wilgus 5ef28cccf9 Allow mounting of any directory as the root directory.
Provide definitions for the macros:
* RB_ROOT_VOL_HIDDEN(v) to exclude certain items from the root.
* RB_ROOT_CONTENTS to return a string with the name of the
directory to mount in the root.

Defaults are in export/rbpaths.h

It's a bit much for those that don't need the full functionality.
Some conditional define can cut it back a lot to cut out things only
needed if alternate root mounts are required. I'm just not bothering
yet. The basic concept would be applied to all targets to keep file
code from forking too much.

Change-Id: I90b5c0a1c949283d3102c16734b0b6ac73901a30
2020-08-20 23:08:57 +00:00
William Wilgus 31fc46ded6 Revert g#1612
Change-Id: Ia971919ecb1690875c916c62ced04bccf99c5aee
2020-08-20 19:04:05 -04:00
Johannes Rauh da190727e7 Enable boot from SD for Sansa e200
Change-Id: I0940f2cd5fc914d6d5061b5798b1a636009649b7
2020-08-19 19:17:01 -04:00
Solomon Peachy a9ac2d0ba3 jz4760: Use HW timer for more a more accurate udelay()
(More specifically, use the SoC's "OS Timer", slaved to the main XTAL so
 it doesn't matter how the main CPU is clocked)

Change-Id: I799561ac823ff7f659a05144cf03b6a13d57ea7b
2020-08-12 23:03:33 -04:00
Solomon Peachy 4d9f190cab xduoox3: Fix build when disabling adjustable cpu freq
Change-Id: Ia8526ad81d7a9744972d9c4fb394e61175ad2391
2020-08-12 20:43:46 -04:00
Solomon Peachy ae18cac2a9 Enable full sample rate sets for X3ii, X20, and Rocker
Change-Id: I89e139efb8a7662afaaabec360e6579907f8d025
2020-08-09 17:00:27 -04:00
Solomon Peachy 491b696669 Fix HOME_DIR path for Rocker, X3ii, and X20
Prevented plugins from accessing their config files properly

Change-Id: Ic3b115aaa9168fa30b98607aeacb1a12b5498a5f
2020-08-09 17:00:27 -04:00
Solomon Peachy 92d66f761f Un-hardcode 44.1KHz settings from ALSA and iBasso PCM code
Change-Id: I69a69dabc799f360b73b1cf252645bd4cde13715
2020-08-09 19:53:13 +00:00
Solomon Peachy 08c4b708ae jz4760: Move 11/22/44/88KHz back onto the PLL
PLL1 clock for those frequencies has been dropped from 508 to 169.5 MHz,
so it's still a respectable reduction.

(I'm not sure how/why it ever worked with the XTAL source, but it did,
 and was off by an audible amount)

Change-Id: I614d87e7dfdfe9210702b9c646d3863c06d6780b
2020-08-08 22:29:29 -04:00
William Wilgus d7b9eb6b63 ROLO - Enable multiboot firmware
I never added multiboot awareness to ROLO

When a new firmware file was loaded [Bootdata] would not be
copied to the new instance resulting in the firmware
running off the internal drive till next reboot

Bootloaders shares the rb-loader code but should not be
affected by the removal of static from write_bootdata()

Change-Id: Iccb18eebeee5c59f9534df51eb6826876c441762
2020-08-08 02:41:13 -04:00
Solomon Peachy b3a0187416 jz4760: Major clocking improvements for audio PLL
* for <= 48KHz, BCLK must be 256*freq  (ie bdiv = 4)
 * for <= 96KHz, BCLK must be 128*freq  (ie bdiv = 2)
 * for 11/22/44/88 KHz, disable PLL1 and run off XTAL
 * cut PLL1 with 12/24/48/98 KHz audio from 516->86MHz
 * cut PLL1 with 8/16/32/64 KHz audio from 426->106.5MHz

This should result in significant power savings for
common 44.1KHz audio playback, and pretty good savings
for everything else.

As an added bonus:

 * enable de-emphasis filters at 32, 44.1, and 48 KHz

Change-Id: Ie59067cd46c47e62abf4a32c53519efad104d6c8
2020-08-07 15:55:31 -04:00
Solomon Peachy eb0e41c1cc jz4760: Support dynamic reclocking!
default/low speed is 192 MHz, Max is 576

Downclock PCLK/MCLK/etc to 96MHz to save a bit of juice

Honestly the high speed could be dialed down to, eg 384
as this thing is so bloody fast..

Change-Id: Ie65597c74290f1603e65f69dae8e75b59c8ba0b4
2020-08-07 11:42:45 -04:00
Solomon Peachy 62146ed735 jz4760: Fixes in PLL calculation and reporting
Change-Id: I890c661fbff549de5a224d90e3fbda34c71b3a7e
2020-08-07 11:42:45 -04:00
Solomon Peachy 89c7a4e393 xduoox3: Enable HAVE_PLAY_FREQ
This way the player can natively play back 48KHz audio

Change-Id: I1d525ec7cb5540062b9e13489d3b53479e68435f
2020-08-07 03:44:18 +00:00
Solomon Peachy e0bb30a1bd xduoox3: Set PLL0 to 480MHz, not 492.
PLL0 Needs to be a multiple of 48MHz for sane USB operation!

(Indeed, "typical" clock for this part is 528, but that seems a
 waste of power)

Also fixes a minor bugaboo in the jz4670 usb divisor calculation
that won't matter until we enable reclocking

Change-Id: I40b1fd1ae48871e50885981ccc8b01feb711b9a5
2020-08-07 03:44:01 +00:00
Solomon Peachy f554c78734 jz4760: Don't enable PLL1 until we need audio.
Change-Id: I6320ee9ac809da93c80e571d45f01e22c5bd1c40
2020-08-07 03:43:43 +00:00
Solomon Peachy 7ab063a157 jz7460: debugging improvements
Change-Id: Ie03609ebe8bff51eed26e3781fe2b8663cc49e3a
2020-08-07 03:43:43 +00:00
Solomon Peachy 5d1d431b97 FS#9295: Detect external power supply for ipod 1st & 2nd gen (Mark Fawcus)
Change-Id: I7b64c37ead60152c8a12556cfa344e225abc1980
2020-08-06 09:28:28 -04:00
Moshe Piekarski e3f6e9d9f6 imx233: rtc: generalize PERSISTENT0 fix
Change-Id: Id8452055534df239dcf5e535943ee918a93ec10c
2020-07-28 22:37:26 +00:00
MichaelRey fbe557d432 Fix IPod 3G USB Recognition Problem
Allow IPod 3rd generation to recognize when USB is connected and reboot into disk mode.
This problem is listed at the bottom of the Ipod status page https://www.rockbox.org/wiki/IpodStatus

Change-Id: I8f32afd065d3a91cddc56fe63454bd082bfa29b9
2020-07-28 01:13:48 +00:00
Solomon Peachy 5e72616618 FS#8778: Fix iPod 1G scroll wheel not being enabled (Mark Fawcus and Rune Pade)
They confirmed it worked in the original ticket.

Change-Id: I949f119554a1e8bbdd0e4160c104cbc4aa2bd17d
2020-07-28 01:07:45 +00:00
Moshe Piekarski 7f282b9280 imx233: rtc: Initialize PERSISTENT0 register
Prevents the rtc from breaking on power removal

Change-Id: I1e434285ccc27d864d2fd9454993d02cae32711d
2020-07-27 21:03:39 +00:00
Solomon Peachy a84176122c Fix two variable-set-but-not-used warnings
(found using -Os with gcc494 on the nano2g)

Change-Id: If0deee3e3cde50e6bf5aff595bebc0f134dcc393
2020-07-24 23:26:15 -04:00
Solomon Peachy 658026e626 [4/4] Remove HAVE_LCD_BITMAP, as it's now the only choice.
Note:  I left behind lcd_bitmap in features.txt, because removing it
would require considerable work in the manual and the translations.

Change-Id: Ia8ca7761f610d9332a0d22a7d189775fb15ec88a
2020-07-24 21:20:13 +00:00
Solomon Peachy 8cb555460f [3/4] Completely remove HWCODEC support
'swcodec' is now always set (and recording_swcodec for recording-capable
units) in feature.txt so the manual and language strings don't need to
all be fixed up.

Change-Id: Ib2c9d5d157af8d33653e2d4b4a12881b9aa6ddb0
2020-07-24 21:20:13 +00:00
Solomon Peachy 0c4f89370d [2/4] get rid of HAVE_LCD_CHARCELLS
HAVE_LCD_BITMAP is now redundant.

lcd_bitmap is always-on in features.txt so manual and lang strings
don't have to change

Change-Id: I08eeb20de48099ffc2dc23782711af368c2ec794
2020-07-24 21:20:13 +00:00
Solomon Peachy 092c340a20 [1/4] Remove SH support and all archos targets
This removes all code specific to SH targets

Change-Id: I7980523785d2596e65c06430f4638eec74a06061
2020-07-24 21:20:13 +00:00
Solomon Peachy 2b9c85a41b storage: Clean up storage_xxxx macros when STORAGE_MULTI is not set
Change-Id: I1652eac1743f4b8b84da08ea5a6d04ac7e17e21d
2020-07-16 23:23:25 -04:00
Solomon Peachy ff8cca70a4 imx233: rtc: Explicitly clear the soft reset bit when initializing
If we come up and the RTC is in a reset state, we need to release that
before trying to initialze anything else.  (See IMX23RM 23.8.1 and 39.3.10)

Change-Id: I1820ab771ba81f7d428d07040b7d188d9f688127
2020-07-15 18:29:49 +00:00
Solomon Peachy 650eaa39c4 rk27xx: rename 'start' to '__start'
Change-Id: I3c5bbbc952222e840e82171431ba996a6a5d298b
2020-07-15 14:18:09 -04:00
Solomon Peachy c54170e8f6 mips: Adjust stack sizes
Main/IRQ  from:   7.5/0.75   to:  7.25/1.0

With the reduction of the opus codec stack usage, giving the IRQ stack
some additional breathing room is now possible.

Change-Id: Id0cd3747fcaab70e2360667ac8c1a97ba7234ccf
2020-07-15 11:43:39 -04:00
William Wilgus 8577d5aea3 Buflib_init Bugfix Minsize
when buflib_init is called with a buffer smaller than
sizeof(union buflib_data); size will be zero
Later when the alloc fails buflib will keep try to free items
in order to satisify the request this crashes in the sim
I suspect this behavior holds true on device as well
but I havent verified this as of yet.

patch adds minimal overhead to the buflib and panics when the size is too small

Change-Id: I46e510367fc1cac19ce01ee6f92d8cf0d65ef914
2020-07-15 13:29:21 +00:00
Igor B. Poretsky 30fb53d47f Enabled hotkey for Sansa Clip players
Change-Id: Ic0fb331415bf0cc0fce5916befce64f4a41c46ee
2020-07-14 12:42:16 +00:00
Solomon Peachy 54629073ae ATA: Make sure "hard disk" supports power management
The FC-1307 CF->SD converter that is the basis of a lot of ATA->CF
devices (including several iflash iFlash models) claims to not support
ATA power management commands.

Rockbox unconditionally issues those commands as support is mandated by
the ATA spec.  This patch checks the capability bit, and if it's not
supported, does not attempt to put the ATA subsystem to sleep.

It is not clear if the problems lie with the SLEEP commands or the wakeup
process, but who knows where else the FC1307 violates the ATA specs, and
reliability is much more important than power savings.

Change-Id: I8b539c579d0449a8a3cfa63cdd1387db990fe820
2020-07-11 22:17:13 -04:00
Solomon Peachy 7249fabe63 fat: Validate FS Info Sector signature when attempting to mount volume
The "try to mount as superfloppy" fails with some partitioning layouts
because sector 0 can have a mostly-valid FAT32 signature.  However, in
all dumps I've looked at, sector 0's fsinfo offset value points at a place
which lacks the fsinfo signature.

Resolves FS#13213, no known regressions.

Change-Id: Ib323d35cca6ca54e11aca6ba77041bf33a05a277
2020-07-11 18:23:46 -04:00
LiveboxAndy 77f8c9c9f1 Update to allow the Apple Radio Remote to function on iPod Video 5G.
This was broken when the major update to iap was comitted.
ia-lingo7.c created and various iap related files modified.
On 4G, 6G and Nano 1/2Gen iPods the remote will function
even though the radio won't.
Tested on 4G Greyscale, 4G Color, 4G Photo, 4G Mini 1st Gen,
4G Mini 2Gen, Nano 1G, Nano 2G, Video 5G, Video 5.5G

Change-Id: Ia74e3d07d9ab5edc6da8eafa96801ede722be331
2020-07-09 18:02:07 +00:00
Amaury Pouly 278a76b3a6 add some documentation in usb.h and usb_drv.h
Change-Id: Icd39ee5c017fc219144b33ef96b0df85c5d430da
2020-07-09 14:09:10 +00:00
Solomon Peachy 65a91333ef FS#12082: Add Tuner support to the Nano2G (Bertrik Sikken)
(The serial portions of the patch were already present, this just pulls
 in the tuner enablements)

Change-Id: I8090e318f34835769ac0a56d7a48b9250631eb4f
2020-07-09 13:24:14 +00:00
Solomon Peachy c79f658125 ATA: In picking PIO modes, word 64 is only valid if word 53 bit 1 is set.
Change-Id: I0a7681be7d703c1baa7f8bd7b5e31f04f20f299d
2020-07-08 17:08:08 +00:00
Solomon Peachy c0276c8352 yp-r1: Fix some of the simulator build issues.
Change-Id: I167b801acaff9d36f3fd2fa57ba295d05816c60d
2020-07-07 18:34:28 +00:00
Solomon Peachy 7381e8bd4d yp-r0: Silence a build warning in simulator build.
Change-Id: I024b6393d778261da151c9756ed38230054b0e7b
2020-07-07 18:34:14 +00:00
Lorenzo Miori 03e6cbec8f Samsung YP-R0/YP-R1: use Linux i2c-dev for radio chip access
Linux offers the high-level i2c-dev driver to directly access the
i2c bus(ses) on the system. This system device is used to get rid
of the (rather silly) radio chip kernel module for ypr0 target and
correctly enables radio access also for the ypr1 target.
fm-radio chip is located on i2c-0 bus on the ypr0 target while it
is located on i2c-1 bus on the ypr1 target.
Power-up (RST) pin is also handled for both targets, which is wired
to another GPIO of the i.MX 37 platform.
Additionally, this patch simplifies the RDS low-level handling by
exploiting the Si4709 debug interface which comes with a mutex
protection as free bonus.

Change-Id: I839282bec4a27ad0ad8403c5a8dd86963b77e1bf
2020-07-07 16:50:42 +00:00
Lorenzo Miori b1c72afd4d Samsung YP-R0: fix simulator build
Protect source code files which are not meant to be built on simulator builds.

Change-Id: I81ad440d8f86e9eda27807e6b71647ced5071b44
2020-07-07 16:50:19 +00:00
Solomon Peachy 4fa57d7661 sdl: Get rid of duplicate instantiation of 'button_queue'
(Caused a build failure under GCC10's stricter '-fno-common' default)

Change-Id: I7d49c630771e8294e2ad8c740a4ada136a6befd7
2020-07-06 18:16:19 +00:00
Solomon Peachy 2d57bfba36 portalplayer: Fix three set-but-not-used warnings.
(They show up when building with gcc494)

Change-Id: Id5e2bccf18114ed78a557ac1b369f46b4f07d042
2020-07-05 17:15:57 +00:00
Solomon Peachy 495c8e2a69 imx31: Fix regression in bootloader caused by cd9906
Change-Id: I1b561c9136a727f49e02e53798e46ef9197a3958
2020-07-05 04:52:29 +00:00
Solomon Peachy 8105d7659f imx233: Fix bootloader link regression caused by cd9906
Change-Id: I6341069aa3855a8a3ea9ed021c27aaa742cab698
2020-07-05 04:17:17 +00:00
Solomon Peachy cd9906847b arm: Fix PortalPlayer linker scripts with binutils 2.21+
For reasons that are still unclear, the 'ncbss' region was overlapping
the "audiobuffer" when linked with 2.21, but okay with 2.20.

Fixed it by making the audiobuffer explcitly use the current position
instead of relying on it being implicit.

With this change, portalplayer-based targets generate working binaries
when built with binutils 2.21 or newer.

This bug also theoretically affects imx233/imx31 targets as they
also have NOCACHE_BASE games in their linker scripts, but I lack
access to one to test with.

Change-Id: Idb38ab20f03599b9ed3d4bc0eafe519f38677438
2020-07-05 03:34:30 +00:00
Solomon Peachy 905e19905b ARM: Rejigger the asm corelock functions
This appears to solve _some_ of the crashes experienced when using
gcc494 on the multicore PP targets (eg most older ipods).

(With this change, the asm vs plain-C versions behave identically)

corelock_lock(), corelock_unlock(), and corelock_trylock() were declared
with the 'naked' attribute.  However, naked functions are only allowed
to have 'Basic Asm' components, and we used some extended asm, but
without declaring clobbered registers, making assumptions about register
arguments, and also directly returned to the caller via asm code.

This is what the GCC docs have to say about this stuff:

"While using extended asm or a mixture of basic asm and C code may
 appear to work, they cannot be depended upon to work reliably and are
 not supported."

Change-Id: I79a9c4895584f9af365e6c2387595e9c45d89c7d
2020-07-03 21:36:41 +00:00
Moshe Piekarski 7fb438b06c Try mounting as "superfloppy" first
This allows for a superfloppy that has MBR-like data in the BPB.
this solves FS#12294 while allowing arbitrary partition types.

Change-Id: I53880fe7dd53e5015f5f15be0ddba11105fcd778
2020-06-30 21:11:52 +00:00
Moshe Piekarski 0d24a7176e Also remove the fat_partition_types array.
If we aren't going to check for the partition type, we don't need the array of
known FAT partition types.

Original Author:    Torne Wuff <torne@wolfpuppy.org.uk>

Change-Id: I558d4287189408c513dfbca49e13906cdb7918b1
2020-06-30 21:11:52 +00:00
Moshe Piekarski a2b8204718 Allow any partition type, not just known FAT types.
Instead of only mounting partitions with a FAT partition type, try any
partition that isn't type 0 (unallocated) or 5 (extended). This makes it easier
to reformat SDXC cards which have the exFAT partition type, and also brings us
in line with pretty much every other OS at this point. Anything with a
valid-looking FAT superblock will get mounted.

original author:    Torne Wuff <torne@wolfpuppy.org.uk>

Change-Id: I3ea8d437a79f9da270f9d119cc670e472331a9da
2020-06-30 21:11:52 +00:00
Franklin Wei a65a341a00 button: allow disabling software poweroff
On some devices, the button driver allows a "software poweroff" by long-
pressing a certain key. This behavior is inconvnient when that button needs
to be held down for other purposes, such as moving the cursor in rockpaint
or sgt-untangle.

This patch allows selectively disabling the software poweroff (enabled by
default) from both core and plugin code.

Change-Id: I7580752888ae5c7c7c5eb1be5966e3d67f17d4b4
2020-06-27 13:27:40 -04:00
Solomon Peachy 58cb467583 xduoox3ii: Add UI Simulator bitmap, keymap, and fix offsets.
Change-Id: I8e322b93653cb43b010dfd5c0f566ea1c4c7b7ff
2020-06-12 15:31:30 +00:00
Solomon Peachy 2434b6ca25 misc: Remove all 'twiki' references in favor of up-to-date 'wiki' links.
(This migration happened over a decade ago!)

Change-Id: Ib396414a16f2d763e549af49e3f3b03047dab49c
2020-06-07 01:38:55 +00:00
Sylvain Saubier 1224919f3a Comment details, typos
Change-Id: I71a283b8e705ad8b9274858bc3cde19d25fc7253
2020-05-24 14:31:15 +02:00
Solomon Peachy ea9ed2f9e8 cowond2: Disable internal NAND storage; use only the SD card.
This allows the player to be usable.

Slightly adapted from:

 https://forums.rockbox.org/index.php/topic,10164.msg245357.html#msg245357

Change-Id: I7bdd681b132cac4c82e3ba6aabe74169645eee4c
2020-05-24 13:37:04 +02:00
William Wilgus a8ae936f8c Sansa AMS add Minimum Clocks for I2c IDE SDSLOT SSP
This patch doesn't implement them just defines them

Change-Id: I1762152c3c683cc68bcedac5923c536316441613
2020-05-23 16:00:15 +02:00
William Wilgus 4f49d21992 Sansa AMS set I2C properly
Change-Id: I95c93933487c4260a7aa43ebed273ab2c05e55c1
2020-05-23 15:44:20 +02:00
William Wilgus 6ed38c89ae Sansa Clip+ set lcd SSP properly
Change-Id: I152f038954ac1649b30dd17c3e6332e4d756502c
2020-05-23 15:03:58 +02:00
William Wilgus 084aa9c1fd Sansa ClipZip set lcd SSP properly
Change-Id: Ice62dfa7f266ee4369793777a39e675bceae1831
2020-05-23 14:44:34 +02:00
Solomon Peachy f0ac5d123f m66591: Fix out-of-bounds array access
Loop terminator needed a preincrement rather than postincrement, and
also used a proper #define instead of a magic number.

Change-Id: Iafd6a0dce0304cb94e4f1d04cce46d2ca603507a
2020-05-12 21:52:40 +02:00
Solomon Peachy 83d8b25fda filesystem: don't PIVOT_ROOT for checkps and simulator builds for hiby targets
Change-Id: I297cbfb60aa18c0895b27ffa787ef6fb9440e03c
2020-05-03 15:31:52 +02:00
William Wilgus 4382d3f5ed ClipZip LCD Corruption Backlight fix
User reported LCD screen corruption via forum in 3.14 and 3.15
turning backlight off and back on seems to fix the issue
http://forums.rockbox.org/index.php/topic,53192.0.html

Change-Id: Id0b34d2f9b77e79ab0ecabace331f0b203184724
2020-04-17 06:53:33 +02:00
Solomon Peachy 683abd77d2 Fix checkwps build for dx50 & dx90 targets
Their codec headers weren't in the right place.

Change-Id: Iae16c10defc937cc227afd8992ff45cd6d664898
2020-04-14 08:15:19 +02:00
Solomon Peachy a820a98361 obsolete: Nuke the very-incomplete Archos AV300 target
It's even missing a config header file.  Just shoot it in the head.

Change-Id: I4c5cdb4fb63361a4e4fc893e93d73d3890fe17df
2020-04-13 22:06:22 +02:00
Solomon Peachy 2ad6c3438e RTC: Add stub support RTC alarms on hosted targets
No targets are enabled, but the hosted Hiby-based targets could have this
feature enabled if they weren't so buggy:

 * No generic way to determine wakeup reason under Linux
 * No generic way to be asynchronously notified if the alarm is
   triggered when we're already awake
 * Shutting down may clobber RTC wakeup (driver/etc dependent)
 * Rocker's kernel's RTC driver has some 24h clock and timezone-related
   issues.

So, the infrastructure is arguably useful, but the only applicable
hardware I have is pathologically brain-dead.

Change-Id: Ie1aa38e72b831c8a0695ff684f260e514eef9710
2020-04-11 12:07:47 -04:00
Solomon Peachy 6984a7ce15 RTC: Add support RTC alarms on hosted targets
Only AGPTeck Rocker is enabled for now, and it doesn't work properly:

 * No generic way to determine wakeup reason under Linux
 * No generic way to be asynchronously notified if the alarm is
   triggered when we're already awake
 * Shutting down may clobber RTC wakeup (driver/etc dependent)

And finally:

 * AGPTek kernel's RTC driver has some 24h clock and
   some timezone-related issues.

So, the infrastructure is arguably useful, but the only applicable
hardware I have is pathologically brain-dead.

Change-Id: Iac6a26a9b6e4efec5d0b3030b87f456eb23fc01d
2020-04-11 18:02:26 +02:00
Solomon Peachy 5cdfe30e79 hiby: Use HAVE_LCD_ENABLE instead of HAVE_LCD_SLEEP
Change-Id: I93819f5ecaad9101a711a0cca626570c7aef0e57
2020-04-08 16:36:43 +02:00
Solomon Peachy 53b93ea6a6 hiby: Refactor X3ii/X20 and Rocker LCD code
Once some missing power optimization stuff was added to the X3ii code,
they were completely identical.

Change-Id: I68e4db5e270e8ff22f91e521616a054bd7baa95d
2020-04-08 15:56:06 +02:00
Stefan Ott 63bf8e4acd Consider sector size when checking cluster size
On file systems with 2048 bytes per cluster, the bpb_secperclus value
gets multiplied by 4 when the meta data is loaded. This patch changes
the sanity check to consider (and reverse) that multiplication before
checking the cluster size.

Signed-off-by: Stefan Ott <stefan@ott.net>
2020-04-07 00:20:13 +02:00
Marcin Bukat 180cef835b xDuoo X3II and X20 port
Provided by Roman Stolyarov
Integration, Refactoring, and Upstreaming by Solomon Peachy

X3II confirmed working by forum tester, X20 is nearly identical.

This includes bootloader, main firmware, and the flash image patcher.

Eventual Todo:

 * Further refactor AGPTek Rocker & xduoo hiby bootloaders
 * Further refactor AGPTek Rocker & xduoo hosted platform code

Change-Id: I34a674051d368efcc75d1d18c725971fe46c3eee
2020-04-06 18:15:41 +02:00
Solomon Peachy a463f68abb checkwps: #undef CONFIG_STORAGE_MULTI for __PCTOOL__ builds
Fixes checkwps build on xDuooX3  (only target that uses it!)

Change-Id: I4dfe095338c938f88a2791351c82f310d0531ad7
2020-04-05 21:17:01 +02:00
Solomon Peachy 87a40552fb simulator: Fix sim build for sdl/hosted targets
Change-Id: I39a7be7cf0ace47cd4aba2a01d9450e1ba41cb7b
2020-04-05 20:55:14 +02:00
Solomon Peachy ee3894f285 threads: Move stack_size to end of struct thread (followup to f19ffe2)
Makes the structure more compact.

Fixes the build failure on the m68k M5 target

Change-Id: If17b872f4923d3a52b344e3c59ed6f870d5a7725
2020-04-05 15:55:38 +02:00
Solomon Peachy 191ffe272b Threading: Use 'size_t' for stack size in core threading code
For some reason it was defined as 'unsigned short' but all arguments to
the threading functions and other structs used size_t.  The SDL plugin
tried to allocate a 2MB stack and this resulted in much badness.

This is a _very_ old bug, and might be responsible for countless subtle
bugs!

Change-Id: I8b7fd79a10c21e3ab524a89b4d40d9afa4fab638
2020-04-05 05:47:04 +02:00
Solomon Peachy 5bd86eb4b4 pp502x: Don't fill the cache starting from address 0x0
The pp502x cache init code tries to flush the cache by reading
a block of DRAM.  Change the starting point from 0x0 to 0x1000
so the compiler doesn't helpfully insert an undefined instruction
to deliberately crash the target.

(This behavior is intentional on the part of GCC, and was triggered
 by using -Os with my experimental 4.9.4 toolchain)

Change-Id: I2d2719615a1164a035f3dac8a56dd3737bbab1d5
2020-04-04 23:07:04 +02:00
Solomon Peachy 6450cbbdca headers: Don't blindly include <inttypes.h> in files used by ASM
Causes things to go boom with newer toolchains.

Change-Id: Ibd00edc9ea16aae8115b63ebce08ac920b0608a2
2020-03-29 00:49:06 +01:00
Amaury Pouly 44fb7f384e sonynwz/scsitools: add NWZ-S610 series
Change-Id: I8977e1bcc805df463f7b08f11be889368db4eab2
2020-01-29 13:25:56 +01:00
Amaury Pouly d6c9303c75 sonynwz/scsitools: add support for NW-A56
Change-Id: I07e57218638ef62c0e4bf92833add6c3ba7bdcd8
2020-01-12 17:59:02 +01:00
William Wilgus 8794b95a72 Fix As3525 SD unused parameter warning
Change-Id: I0a4bbcf94e9cadf43a822c1cb2f2dad3bd4f7588
2019-12-30 23:41:46 -06:00
William Wilgus 9f336217c2 Sansa AS3525V1 Sd Interface implement powersave mode
This patch cleans up the sd driver for the V1 sansas
powersave implemented for the sd interface

Change-Id: I3d864f7aa304cf792cc65fa4ff06c1e52fbed329
2019-12-31 05:57:38 +01:00
William Wilgus 9cfdbdb355 MultiBoot_Firmware Fix red for bootloaders
Change-Id: I0446258d1f14f5423cca55de04abf545a92c61cf
2019-11-15 05:05:20 -06:00
William Wilgus 62e5a3076c MultiBoot_Firmware
Stop gap till I get a chance to work on the root folder stuff

Makes whatever volume marked by bootdata.boot_volume
the base or root volume, mounts all other volumes after
the specified boot volume.
Has the effect of swapping the SD card to the slot for internal
and Internal storage is mounted as the Sd-card.

Does not honor root redirect -- uses .rockbox folder in the root of boot volume

Change-Id: I0f786aa0c8721e21cba607366775be3e3c0cf474
2019-11-15 11:26:56 +01:00
William Wilgus 1da2708a7c Fix timer Agptek Rocker (other hosted players)
on timer_unregister callbacks are not removed

It seems (at least on the Rocker) timers continue to fire (for a bit??)

Now we store the registered callback in the sigev structure and check
that the callback matches the one registered when the timer is created.

This should stop the possible case of a new timer getting spurious callbacks
We also now NULL the callbacks on un-register which should stop the segfaults

Added some notes to timer.c and timer.h

Change-Id: Ia155c3a4e4af89f474d55ed845560ccc1fab85aa
2019-10-17 21:19:00 +02:00
Franklin Wei 3d6d90382e iPod Classic: enable IRAM1 in bootloader
7442742 ("iPod Classic: disable IRAM1") was causing subsequent ipod6g
bootloader builds to result in a completely black screen upon
installation, with recovery only possible with a reflash through DFU
mode.

IRAM1 is re-enabled for bootloader only.

Change-Id: I92d489c91f81cad55d66a8647c1e61a45f468770
2019-10-13 23:23:32 -04:00
Solomon Peachy 5b23c9eb0a Introduce HW_SAMPR_MIN_GE_22 macro
Gives us the lowest HW sample rate that's >= 22KHz.

Needed because some targets that don't support 22K support 11K or 8K, so
HW_SAMPR_MIN will give us much lower quality than is acceptable.

Take advantage of this new macro in the SDL, MIDI, and MIKMOD plugins,
and implement a crude "fast enough" test to enable higher sample rates
on more capable targets.

Change-Id: I6ad38026fb3410c62da028e78512e027729bb851
2019-08-08 22:37:30 +02:00
Sebastian Leonhardt d3a3a41b0f Remove "HAVE_TRANSFLECTIVE_LCD" from iPod 6G config
The screen content is only poorly visible without backlight, it's not
really usable this way.
Removing HAVE_TRANSFLECTIVE_LCD also fixes the "flashing screen"
issue that appeared on some models when "lcd_awake()" is called.

Change-Id: I3ba954c944077a32016820462f782dc27a31f8d8
2019-08-01 23:10:57 +02:00
Solomon Peachy 349e111c81 Revert "cleanup: Remove HAVE_MULTIVOLUME from targets with HAVE_MULTIDRIVE"
This reverts commit a89bf68e88.

HAVE_MULTIVOLUME && HAVE_MULTIDRIVE implicitly means "allow 4 volumes
per drive" whereas the normal MULTIDRIVE behavior is to only allow 1
volume per drive.
2019-07-31 17:22:58 +02:00
Solomon Peachy a89bf68e88 cleanup: Remove HAVE_MULTIVOLUME from targets with HAVE_MULTIDRIVE
The latter always enables the former.

There are no remaining HAVE_MULTIVOLUME users in-tree.

Change-Id: I0f4fd03a6ffed5c0eb3fb5f916f671bd199f1c8e
2019-07-30 04:32:05 +02:00
Solomon Peachy bad461a9ce Correct MODEL_NUMBERs used by xDuoo X3, and IHIFI 770, 770C, and 800.
This should correct ROLO operation on all targets.

Change-Id: Icefbf1af83fd756283a0f6c78ba2370fe41f4473
2019-07-29 17:03:26 -04:00
Solomon Peachy 83963fcb15 XduooX3: Uncomment code that prevented hotswap from working.
Change-Id: I5efec00e60aacf05166407ad43b9d63340e18967
2019-07-29 11:14:41 -04:00
Solomon Peachy 51fe1b6705 volume_ismounted is gated by HAVE_DIRCACHE rather than HAVE_MULTIVOLUME
Should fix the various sim builds.

Change-Id: I1dc5e8228698afb32c84ada2aa916e52e19f49d7
2019-07-28 15:27:04 +02:00
LiveboxAndy d462d26ff0 Fix issue with building the UI Simulator for Windows
Addition of rtc support for AGPtEK ROCKER broke building the UI Simulator
for Windows. This patch removes the rtc support if building UI Simulator for
Windows.
2019-07-26 20:11:33 -04:00
William Wilgus 3834094172 Fix Red -- sound_current #_2
Change-Id: Iae31a5fd414708b4a222ba0b05b5828a8e0d19af
2019-07-25 08:49:11 -05:00
William Wilgus b5b43a0fef Fix Red -- sound_current
Remove dependency on settings.g for bootloader

ifdef out AUDIOHW_HAVE_EQ Settings these should be indexing the
global_settings.hw_eq_bands[AUDIOHW_EQ_BAND_NUM] struct

Change-Id: I1d1a8556ef88ce43397b600261696dacdf372034
2019-07-25 08:03:18 -05:00
William Wilgus 5f9d1f59d3 Add sound_current to plugin api
Adds:
	sound_current(int setting)
		returns the current sound setting from global_settings
		complements sound_max, sound_min and sound_default

Change-Id: I35bd893753c958f808492906fe533edc51d5d57c
2019-07-25 00:48:40 -05:00
Franklin Wei b0e9bb1b91 Limit float formatting to only targets building Quake
The Quake plugin is the only code that actually relies on float
formatting. Because Quake only runs on targets with huge memory
anyway, limiting their formatting to just those targets will minimize
the increased memory use in the core.

Change-Id: Icdbe26ec6ede564861cc01ac4add76a12b00ecd5
2019-07-19 23:20:56 -04:00
Michael Sevakis b70fecf21d Add proper float formatting to vuprintf
Wanted to see how gnarly it is to do.

Big number handling could be done with better algorithms
since it can get a bit slow with large integers or tiny
fractions with many lead zeros when only a few digits are
needed.

Anyway, it supports %e, %E, %f, %F, %g and %G. No %a or long
double support seems warranted at the moment.

Assumes IEEE 754 double format but it's laid out to be able to
replace a function to handle others if needed.

Tested in a driver program that has a duplicate vuprintf and
the content was pasted in once it looked sound enough to put
up a patch.

Change-Id: I6dae8624d3208e644c88e36e6a17d8fc9144f988
2019-07-19 22:07:41 -04:00
Frank Gevaerts b0de98ad3b Put -lfirmware in CORE_LIBS, to fix -thumb builds
For unknown reasons, -thumb builds need -lfirmware after -lrbcodec (but
still before -lunwarminder)i. Other builds are still happy if we do that.
Including it via CORE_LIBS instead of explicitly achieves that.

Change-Id: Id69e4a0c042f90f71cfd9a72202ce4d8ef6a4181
2019-07-19 15:16:37 +02:00
William Wilgus 5264a6eac1 Fix Truncation warning cpufreq-linux.c->cpufreq_available_governors
limit cpu identifer to 0xFFFF

Change-Id: I6fb170aa7ce32b7b5c0366bbd689878bb5069be8
2019-07-10 07:09:00 +02:00
Franklin Wei 439a0d1d91 rbendian.h: fall back to generic swap macros
Change-Id: If85086c0fd6b22d50759b16d2545e1798832d12c
2019-07-09 11:20:55 -04:00
Sebastian Leonhardt 3e504c3dcd Fix reversal of "always/never" in "LCD setting > Sleep (After Backlight Off)"
The bug was introduced in a06d9c8.
The patch also fixes some (more or less) related obsolete comments.

Change-Id: I5e491d64574c37cdbc46b146d7cfc555d86b9a11
2019-06-27 14:19:05 +02:00
Solomon Peachy 1e076a7be8 jz7460: Disable IRQ-driven DMA transfers.
This greatly increases the stability of SD card write operations.

(I suspect the underlying problem is not IRQ operation itself, instead
 being exacerbated by it..)

Change-Id: Ia00f0656abd4b3cb0b1b5fc9db7c1b6a02847956
2019-06-02 13:09:19 +02:00
Marcin Bukat e85a3ba518 Agptek rocker: do not update display when not active
Change-Id: I963a9098b82a09aed8050123932a128f2d08dee0
2019-05-31 15:17:33 +02:00
Amaury Pouly 063ff294a2 nwztools: add DMP-Z1 to the database
This is one of those fancy gold-plated devices. Of course it breaks my scripts
that were nicely expecting every device to start with NW.

Change-Id: I161320f620f65f4f92c2650d192b26a9831eeb9d
2019-04-22 23:45:33 +02:00
Sebastian Leonhardt 168e242498 Fix the fix
Change-Id: I54b97fd0c208f775e4ee22cf8499f1da423ebc39
2019-02-08 00:52:37 +01:00
Sebastian Leonhardt 26e0c64e34 Fix red and remove duplicated function declaration
Change-Id: I5fed7fdad077eedfc1e36fbd9e1669f11b90288d
2019-02-08 00:04:20 +01:00
Sebastian Leonhardt e662ae4e9e Add YH820 current usage for runtime estimation
Change-Id: If50d7e6db3077853dfba438d9765cdb3513f2910
2019-02-07 23:07:19 +01:00
Sebastian Leonhardt 053c4d0593 transflective LCDs: fix "first buttonpress enables backlight only"
This should be done even if the backlight is set to "always off",
i.e. if the LCD is sleeping, a button press should be "eaten"
and just wake up the LCD.

Change-Id: I3946bdbbdc81f23eae3f47423123cefa275e0afc
2019-02-07 22:56:39 +01:00
Sebastian Leonhardt 666405f346 Simulator: improve simulation of transflective screens
This patch simulates the three possible states of a transflective
LCD: backlight on (bright screen as usual), backlight off (dimmed
screen) and LCD off (black screen).
Makes use of already defined 'BACKLIGHT_OFF_ALPHA'.

Change-Id: I9b0fc79b8d50c29e024ba1e6d9c2501119a7e0e0
2019-02-07 22:52:07 +01:00
Sebastian Leonhardt 287685932e Fix lcd not waking up when backlight is always off
This patch is relevant for targets with a transflective display.
If the backlight was set to "always off" (e.g. to use the lcd
in a pure passive way), and the sleep timer ran off, the LCD
would stay disabled and didn't wake up when a button is pressed.

Change-Id: I0a157c7f421d9fc4c7d8ba903f2cf93f6cef51d0
2019-02-07 22:10:52 +01:00
Sebastian Leonhardt 03e63da316 YH820: implement LCD sleep
use sleep setting to keep transflective LCD active without backlight

Change-Id: Iccd97e956d5e4a2a22abc90d15e9123782126ecb
2019-02-07 20:04:19 +01:00
Solomon Peachy d24edc605b Add HAVE_LINEOUT_DETECTION and associated logic
This allows targets to automatically switch audio settings when the
line out is plugged/unplugged.

Only hooked up on the xDuoo X3, but there are other potential users.

Change-Id: Ic46a329bc955cca2e2ad0335ca16295eab24ad59
2019-01-04 23:52:42 +01:00
William Wilgus 976831e667 Buflib add range checks blocks and crc_slot raise panic if out of range
Change-Id: I81df5c145a8cb003827a5423f484f70333e2472e
2019-01-04 06:47:20 +01:00
Solomon Peachy 52ed74aad0 mips: Adjust main & irq stack sizes to fit in IRAM on all targets
New amounts:

7.50K main stack
0.75K irq stack

Prior values of 8K+1K overflowed IRAM by ~660 bytes on Onda 7x7 targets,
but worked on the xDuoo X3.

(The discrepancy is due to the Onda targets having more LCD code shoved
 into IRAM.)

Change-Id: I16fcfae3c5f3e36db688dfa9167b620584e79df8
2019-01-02 19:52:05 -05:00
Solomon Peachy 36a50dd00f mips: Use a separate IRQ stack & optimize IRQ handling a little
Should prevent the IRQ-related stack overflows seen on MIPS targets.

Change-Id: I447336ef3fe37e11b3276a78ba220ce64c2f87f5
2019-01-02 23:30:04 +01:00
Solomon Peachy d4942cc74c Add Xuelin iHIFI 770/770C/800 support
Taken from the xvortex fork (Roman Stolyarov)
Ported, rebased, and cleaned up by myself.

Change-Id: I7b2bca2d29502f2e4544e42f3d122786dd4b7978
2019-01-02 08:10:01 -05:00
Solomon Peachy 88cae9d13d Coldfire: Don't clobber alwarm wakeup signal in dualboot mode
(See FS#7814 for details)

Change-Id: I6a09a8dfe1abc3a396ca8afe1dbbf1d203c7e3e2
2019-01-01 23:30:44 -05:00
Solomon Peachy 7e7ca0c858 Fix Xduoo X3 bootloader build, and silence all warnings.
Also enable USB bootloader mode

Change-Id: I73224c2e694b9941993c89a114b48d2a907e0dfb
2019-01-02 05:01:50 +01:00
Solomon Peachy 9b3f22ac3a FS#7814 - Enable RTC Alarms on H300, X5, and M5
Original patch by Alexander Spyridakis
Modified by Steve Bavin and Igor Poretsky
Keymap fixes by Marianne Arnold

Change-Id: I5a252d97d2b05c533e048931f7354f4261f76499
2018-12-25 08:51:33 -05:00
Solomon Peachy eee3f0ce79 FS#12610 - Clip+ Ticking Noise Fixed in Radio
Patch taken from Igor Poretsky's tree.

Original clip-radio-tick.patch modified to acts only when screen is
deemed, or when recording, in order to preserve indicators
functionality.

Change-Id: I62afb24a0dad7ad2ecc9272c24810b37f032408d
2018-12-22 20:12:10 -05:00
William Wilgus a06d9c85f7 Auto-Ranging Time Formatting For Menus (hh:mm:ss:mss)
Unifies time formatting in settings_list.c allows time format to
display as HH:MM:SS.MSS or any consecutive combination thereof
(hh:mm:ss, mm:ss, mm:ss.mss, ss.mss, hh, mm, ss ,mss)
works in INT and TABLE settings with the addition of flag 'F_TIME_SETTING'

Time is auto-ranged dependent on value

Adds talk_time_intervals to allow time values to be spoken similar to
display format:  x Hours, x Minutes, x Seconds, x Milliseconds

Table lookups merged or removed from recording, clip meter and lcd timeout
-String_Choice replaced with TABLE_SETTING or INT_SETTING for these
functions as well, cleaned-up cfg_vals that get saved to cfgfile

RTL Languages ARE supported

Negative values ARE supported

Backlight on/off are now Always and Never to share formatter with LCD
Timeout

Added flag to allow ranged units to be locked to a minimum index

Added flag to allow leading zero to be supressed from the largest unit

merged talk_time_unit() and talk_time_intervals()

optimized time_split()

optimized format_time_auto()

Backlight time-out list same as original

Change-Id: I59027c62d3f2956bd16fdcc1a48b2ac32c084abd
2018-12-22 12:27:21 -06:00
William Wilgus 0f5f5c3390 Fix Sim & checkwps for newer distros
__builtin found fix for rbendian.h
tools/configure defines SIM_USE_BYTESWAP_H if byteswap.h is found in
/usr/include/ maybe there is a better mechanism for this

Change-Id: I4d004e68313e8b32aa5587582be36bc459fdaf6b
2018-12-08 03:19:14 -06:00
William Wilgus 9450689483 Fix Sim for newer distros
__builtin found fix for rbendian.h
tools/configure defines SIM_USE_BYTESWAP_H if byteswap.h is found in
/usr/include/ maybe there is a better mechanism for this

genshortcut.sh is a simple script to make .desktop shortcut files
several newer distros don't allow you to run the simulator from the
file manager, this or perhaps a different method can probably be
included while building a sim at a later date.

for now it can be run manually like so:
similar to ../tools/configure
run from your simulator folder
../tools/genshortcut.sh exepath shortname icon
ex. ../tools/genshortcut.sh ./rockboxui clip+sim music-app

Change-Id: Ia05d3a9349b27c5968a4a7a68b2eb480e60faec3
2018-12-07 21:04:30 +01:00
Marcin Bukat 4e8ef17a8b More keymap refinements
Change-Id: If3ae6ece7848b143088d5f9ec8c00ed593d59ed2
2018-12-06 15:15:26 +01:00
Amaury Pouly 110e3b43a0 sonynwz: add NW-A57 and NW-ZX300G to the database
Change-Id: I9bbfa56c5b2d79568de5443f1098d724c4beda6a
2018-11-30 15:37:10 +01:00
Amaury Pouly 110fd2cae6 Add the NWZ-A844 to the database
For some reason even Sony didn't have it in its list...

Change-Id: I26de6071e5887cc7c6ebb695ea333c7b3d1b50db
2018-11-30 15:37:10 +01:00
William Wilgus de6618a271 Fix vuprintf fix possible %s buffer over-read
when precision is not specified memchr recieved -1 for count
count is unsigned so it looks in a potentially very large area
for a terminator and returns this whole area if \0 is not found

Instead we should use memchr when precision is specified
and if precision is not specified use strlen

Fixes 60+Mb Config.cfg files

Change-Id: Ic4d1439334588f999c9071235430c42df2af5cc4
2018-11-10 02:47:19 +01:00
Solomon Peachy 74dd276fe1 debug: Wrap rb_backtrace with HAVE_RB_BACKTRACE instead of CPU_ARM
Basically, preparation for a non-ARM backtrace support.

Change-Id: Icfd09fbc65a98f859e2a19f8d1111827a262a969
2018-11-09 02:32:39 +01:00
Amaury Pouly 0120ecd651 sonynwz: add nvp map for NW-A50 series
Change-Id: I49f3399552721e515cc01021c2e0aa28c781ec28
2018-10-29 15:10:24 +01:00
Amaury Pouly 8a4cb5e619 sonynwz: add NW-A55 to database
Change-Id: I59861119c59490f586b3c6ed32a1c41df8b3d365
2018-10-29 13:29:39 +01:00
William Wilgus 7c2295ea46 Diacritic.c add newline to EOF
Change-Id: Ide8934fa267bfb745fc397cdb7450f3ac0453174
2018-10-18 08:03:20 -04:00
William Wilgus b977b77fb7 Optimize is_diacritic
is_diacritic is used for pretty much all of the text display sizing
Timing here matters, so important it uses a
priority buffer in order to cut down on searching the database.

This patch is verified functionally equlivalent but
saves 80 bytes and is ~20% faster for the clip+ I tested it on

Several things were done:

Optimizing the copy loop for the priority buffer

Globbing some operations together

but the main one has to do with the database structure its self
--
Rather than a bit packed struct it combines the lower 8 bytes into
one value [info] and uses flags to access the values instead

Change-Id: I475073419b647639ef1eeaa3b9213e4e1067c0db
2018-10-18 13:29:32 +02:00
Solomon Peachy d2cef81bba mips: fix some compile warnings.
Change-Id: Ia5e83702313c1c184480290d3b0e6a66f01b7277
2018-10-09 22:35:37 -04:00
Solomon Peachy 71abdf5d82 mips: jz4740: JZ4740 does not have a MSC clock source select.
Change-Id: Ic2af37d92bcb8b6b35684f113eb8e392fc2eb609
2018-10-09 11:37:43 -04:00
Solomon Peachy 3e209f34e4 misc: Fix some assorted compiler warnings
Change-Id: Ibc4aac79e6fce92ad4414ed50122c2d4d6295f89
2018-09-28 11:53:15 -04:00
Solomon Peachy a454b7f9ef jz4760: Lots of stability fixes to the USB driver.
It actually works for transferring data now!

Igor Poretsky gets full credit for this patch.

Change-Id: I247c70fdf45e590b4699b9b8668bbdab7bc3ef03
2018-09-20 21:11:40 -04:00
Solomon Peachy a26c1c1459 xduoo_x3: Disable keypress IRQ since we poll for keypresses.
Change-Id: Ieab5f864751cf798b62c4e89e670acf7ade756ab
2018-09-20 19:38:58 -04:00
Solomon Peachy 640ada0389 jz4760: Enhancements and fixes to SD driver.
* Fully Interrupt-driven, with proper task yielding
 * Much more robust error handling
 * Eliminate duplicate code
 * Pile of bugfixes

 (Much of this adapted from Igor Poretsky's tree)

Change-Id: I46006412323cba2088b70094635d62a241be1d7e
2018-09-20 19:38:25 -04:00
Solomon Peachy 8edf4052c7 jz7460: Silence codec when changing playback frequency/mode
Silences some annoying clicks.

Change-Id: I3d32d4b33c0ccc61877e10f5af97fe05084d66e5
2018-09-20 18:59:19 -04:00
Solomon Peachy 1020897794 jz7640: SD driver improvements:
* Better multidrive support
 * Common slot1/slot2 handling code

Change-Id: Id0aed90cbba4246fdc71b42e03f016f8060d258a
2018-09-20 18:59:19 -04:00
Solomon Peachy 679a0bd193 jz74x0: MSC clock needs to be divided from PLL clock.
Change-Id: I0cf2f0d55e0859f896afef289e833935d7c5a599
2018-09-20 18:59:19 -04:00
Solomon Peachy 72820d8b2d jz4760: Greatly enhance debug code and silence some compilation warnings.
Change-Id: I1746d67c818ad099edea83e6242ffd5c79be0000
2018-09-20 18:59:19 -04:00
Solomon Peachy 08ab3aea4f Get rid of the last remnants of HAVE_FUNCTIONAL_MODE
Change-Id: I4f9339019884aceedc8c9d0ab779a2e32ace0288
Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
2018-09-20 22:03:03 +02:00
Solomon Peachy 3671f923eb Xduoo_X3: Update target configuration
Change-Id: Ibc6b204357524550a0d6fa917e7d074ec2e52773
2018-09-20 22:02:28 +02:00
Solomon Peachy be801c61bb mips: Update the MIPS threading code
Taken from Amaury Pouly's Fiio X1 patches in gerrit.

   Xduoo X3 no longer panics on startup

Change-Id: I4c2dee832306755b9e496084cb47fb61f804af20
2018-09-07 09:55:12 +02:00
Marcin Bukat 734be0d6aa MIPS: fix memset()
swr/swl instructions used for word aligning were wrong. This
made memset() terribly broken. I can't imagine how it went
uncaught for soooo long. Spotted by Solomon Peachy.

I run unit tests for alignments 0,1,2,3
size 1, 2, 3, 4, 5, 63, 64, 65, 127, 128, 129;
and fill pattern 0x00 and other (since 0 is special case in this
implementation).

Change-Id: I513a10734335fe97734c10ab5a6c3e3fb3f4687a
2018-09-07 09:43:05 +02:00
Cástor Muñoz 7442742208 iPod Classic: disable IRAM1
On Classic, IRAM1 (second 128Kb of a total of 256KB available IRAM) is
slower than DRAM. Codecs that actually are using regions of IRAM1 runs
faster when DRAM is used, so IRAM1 is disabled and only IRAM0 remains
enabled: 48KB for core and 80KB for codecs/plugins.

The next test_codec results shows how decode time is decreased:

file           boosted     unboosted
*.ra           ~1.5%       ~0.5%
*.mpc          ~21%        ~4.5%
*.ogg          ~0.5%       ~0%
nero_he*.m4a   ~8%         ~1%
nero*.m4a      ~25%        ~7%
wmapro*.wma    ~4.5%       ~0%
wma*.wma       ~25%        ~7%

In addition there is a small power save when IRAM1 HW is disabled.

Change-Id: I102adee11458e82037f23076d5d5956e23235de8
2018-07-30 18:50:27 -04:00
Cástor Muñoz 8f38f85fbd Workaround for usb_storage_init_connection() panic
For s5l8701, s5l8702 and as3525v2 targets.

The crash occurs when USB is inserted or extracted while the playlist
is being loaded or updated (it could take a few seconds for huge
playlists), at this point all buflib memory is allocated and not freed
before usb_starage_init_connection() is executed.

This workaround mitigates this panic by using static memory for USB
buffers, so this memory cannot be used for other tasks, in addition
the problem still persist when playlist load is 'paused' by USB
insertion and then updated after USB extraction.

Change-Id: Iff1db5a949361fd543e0b494924d1f2906c84b5e
2018-07-30 17:54:51 -04:00
Franklin Wei 210881ca35 Remove leftover merge conflict marker
Change-Id: Ie34657fe652d3613429d3fa233faac9608a8b826
2018-07-29 12:23:28 -04:00
William Wilgus d8bd356e56 Revert "As3525 v1/v2 Add power savings menu"
This reverts commit 6f0320a953.

Change-Id: I7425d422a4a0af7a49e9194cfe0bb55d431bc401
2018-07-28 17:35:07 +02:00
William Wilgus 16f10e2abd Revert "Fix Red on PowerSave in Simulator"
This reverts commit 568b81202e.

Change-Id: I2af42cd53d0ce490bf96c68288e9fbde034c0069
2018-07-28 17:34:31 +02:00
Michael Giacomelli c75aac8424 Slightly raise voltage on FuzeV2 devices.
Some devices seem to have trouble accessing the storage at lower voltages.
2018-07-28 11:05:59 -04:00
Solomon Peachy 0662793ca0 Add cleaned-up xDuoo X3 support
Cleaned up, rebased, and forward-ported from the xvortex fork.

(original credit to vsoftster@gmail.com)

Change-Id: Ibcc023a0271ea81e901450a88317708c2683236d
Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
2018-07-28 10:56:31 -04:00
William Wilgus 8fb1740a78 Fix scroll_engine truncation
fix one off error

Change-Id: I9b3b23c9f6c36107e73e511d8cb1bc5cd987e765
2018-07-28 15:36:13 +02:00
William Wilgus 568b81202e Fix Red on PowerSave in Simulator
Change-Id: Ic5d9de230efceabc2c428e5c78fa6596a5a34840
2018-07-28 14:55:52 +02:00
William Wilgus 6f0320a953 As3525 v1/v2 Add power savings menu
Allow user to select cpu undervolt

There have been quite a few issues across the SANSA AMS line related
to CPU undervolting while most players show greatly increased runtime
some crash.
Rather than constanly upping the voltage we now have a
setting with a safe value for all players and the option for lower voltages

I plan to add a few other options here later such as disk
timings and maybe some other clocks/experimental settings

Added: Disk Low speed option for AS3525v2 devices cuts
	frequency to 12 MHz from 24 MHz
Added: Disk Low speed option for AS3525v1 devices cuts
        frequency to 15.5 MHz from 31 MHz

Added: I2c Low Speed AS3525 devices, should be bigger improvement for v1 devices

Fixed: Debug menu for AS3525v2 No SDSLOT frequency,
	Showed IDE freq though it is unused

Added: DBOP and SSP underclocking affects display on v1/v2 respectively

Fixed: debug menu now has SSP frequency, and SSP_CPSR

Update: made settings menu more generic

Update: cleaned up code

Added: Clip v1 & Fuze v1 didn't have HAVE_ADJUSTABLE_CPU_VOLTAGE.
	not sure why but,  waiting on testing to confirm

Added: C200v2 and E200v2 devices and HAVE_ADJUSTABLE_CPU_VOLTAGE.

Fixed: v1 devices don't like display timing set lower (dbop)
       v1 devices don't have a divider set for ssp (causes divide by 0)

Fixed: ClipZip display lags with Max SSP divider changed from 0xFE to 0x32

Fixed: v1 devices didn't work properly with highspeed sd cards
	Added code from http://gerrit.rockbox.org/r/#/c/1704/
	Added powersave and IDE interface enable/disable

Added: V2 devices now have powersave enabled on sd interface

Update: cleaned up code, lang defines, added manual entries

Update ssp clock mechanism added calculated ssp divider to clipzip

Update turn display clock off when clip+ turns off display

Fixed: clipzip wrong register for SSP clock

Change-Id: I04137682243be92f0f8d8bf1cfa54fbb1965559b
TODO: add other players?
2018-07-27 23:56:32 +02:00
William Wilgus dcd71e66bd Optimize lcd-ssd1303 driver (clip series)
Saves 100+ bytes (50 of it in iram), saves a bit of power

Internal LCD clock decreased but with added efficiency of drawing routines
loses only around 2 Hz on the scanrate (~75Hz) while fps is slightly increased

Column offsets are now calculated outside the loops saving a few instructions

Passing a LCD_NOP command after lcd_update turns off Data/Cmd# gpio
saving a bit more power

Added a function lcd_write_cmd_triple() that allows 3 commands to be sent at once
when enabled with LCD_USE_FIFO_FOR_COMMANDS it sends them back to back without
checking FIFO status in between or sending to thhe D/C# Gpio.
Makes an assumption about the FIFO being large enough to
accept 3 commands after being emptied which should be the case on the
clipv1, clipv2, clipplus. I have only enabled it for the clip plus
as thats the only device I have to test it on.

On clip+ the SSP clock is now turned off when screen is off

Change-Id: Ib5fd24697bfe4ac8b8ee017361e789e4a7910d21
2018-07-26 04:23:28 +02:00
William Wilgus 056d4b0ec0 Update AS3525 v1/v2 debug menu; add scrolling and missing frequencies
On the clip zip most debug menu items get cut off and there is
no way to read most of the debug menu items.

This patch makes the menu button scroll the text 1 character
to the right with each press and the center (select) button
re-aligns the text

Adds SSP frequency(v2) & register
Adds SD slot frequency(v2)

Change-Id: If4705d6790e25061931ca654062e22fc2e0a6f16
2018-07-26 04:00:28 +02:00
William Wilgus ff7d2bdee1 Fix lcd-scroll.c truncation warnings
Change-Id: I312ec7ad06fde5b2f9747661cd2d4ffcb4cbf755
2018-07-25 20:53:17 +02:00
William Wilgus 1054b5748c Revert "Ignore truncation in lcd-scroll.c"
This reverts commit 540637ed33.

Change-Id: I88e71ef47a11818a5acb407ff9c0723d3c197243
2018-07-25 20:41:48 +02:00
William Wilgus 540637ed33 Ignore truncation in lcd-scroll.c
Change-Id: Id1008300e58cf12ab920c1023354a74a6d32daae
2018-07-25 19:56:53 +02:00
William Wilgus c15af64452 AMS v1/v2: Fix I2C2_CSPR debug menu entry
I2c controller needs to be enabled in order to read CSPR0, CSPR1
registers function sets CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE
and only clears if it wasn't previously enabled

Use divider set in register to calculate frequency rather than
hard coded divider

Change-Id: I54ecc0c1859e906c00f4c2ae8ae2424a4619df98
2018-07-25 06:03:44 +02:00
William Wilgus 6a568761c8 CLIPPLUS -- Remove un-needed handling for power button button button_read_device()
switching GPIOB in order to read GPIOD96)
(power button) is apparently unneeded

Change-Id: I1fbf13f67f938806086754cdd5e389ef6746ae5f
2018-07-25 06:01:56 +02:00
Michael Sevakis 19b2964d78 AMS v1/v2: Remove sd_enabled as an externally-visible variable.
Also removes the sd_enable() function call. It was only used in
the debug screen on AMSv1 and not used at all on AMS v2.

For v1,obtain debug info in a struture passed to a dedicated
debug info function so that enabling and disabling the controller
isn't racy.

Change-Id: I7c44693bc2df5a1f16168b05b3abfe622f9584ce
2018-07-04 15:20:47 +02:00
Marcin Bukat 8742f6f0e2 Agptek: Fix headphones detection
Change-Id: Id43bfee7357eef8dda6a617c1207b930f3ea90a0
2018-06-28 09:52:59 +02:00
Marcin Bukat 971001d141 Agptek: Fix support for empty strings in sysfs helper functions
Change-Id: Id5573059da2b454f5336b3cebce7c09a83a7826f
2018-06-28 09:52:59 +02:00
Marcin Bukat 28cfeed4c1 Agptek Rocker: Add missing lcd_set_active(true) in lcd_init_device()
This should fix problem introduced in 5c015ad resulting
in not updating screen properly in wps.

Change-Id: Ie36b6edfcfc7d425c84381402adae79d77fcc92f
2018-06-20 21:17:08 +02:00
Marcin Bukat 203e4adb1e Agptek Rocker: Slightly tweak build procedure
In bootloader build create stripped binary bootloader.rocker

Change-Id: Id67bebe82251fac22ad905ad3d49525691816746
2018-06-14 11:02:18 +02:00
Marcin Bukat 5c015ada90 Agptek Rocker: Implement lcd_enable()
In theory this should slightly improve battery life.

Change-Id: Iaf55beb7dbc20e7562017958aeb0386459d49a31
2018-06-14 10:03:07 +02:00
Marcin Bukat f2075a5709 Add XRGB8888 native format
This got lost somehow during Agptek port merge

Change-Id: Ie84463ba523d2307466b49354867117e7393a440
2018-06-12 13:25:12 +02:00
Marcin Bukat 0e48cb7768 Silence warnings
Change-Id: Ied5ad7d3c193427892b681f95b44fcac5af0e16e
2018-06-12 13:09:31 +02:00
Marcin Bukat 32e8028a04 Cleanup comment
Change-Id: If39a5d2f64a9453a9b9b0cf0a2e3ad36027978ff
2018-06-12 13:02:47 +02:00
Marcin Bukat 307ea8382e Fix merge errors which broke sony linux targets
Change-Id: Ic0c618c6e2034609d1964bb3e9ff96c7a7cf1d40
2018-06-12 12:50:09 +02:00
Marcin Bukat 71dc1a789a Fix MIPS threading code to compile with older compiler
Official rockbox mips gcc is old and doesn't support
symbolic register names in inline assembly

Change-Id: If67230d06e28ccf31b0f8f8e1b622275fed3f6ff
2018-06-12 12:41:03 +02:00
Marcin Bukat 9be14c014f Fix merge error
Change-Id: If1b5258bb86e477ac4cb1adb95f6c887a2ef8810
2018-06-12 11:44:01 +02:00
Marcin Bukat 7f4d183f17 Fix ipod classic build
Change-Id: I55a2849bd1a22b40c0f75dcaeac481866f7dbf61
2018-06-12 11:19:24 +02:00
Marcin Bukat c0bdbb43ea Agptek Rocker: Callibrate power discharge/charge curve
Thanks 'elakir' and 'pechenyh' rockbox forum users for performing
battery bench.

Change-Id: I25d350deaa805a9ecdc236f81f0ad127a169de52
2018-06-12 10:31:16 +02:00
Marcin Bukat a81391b623 Agptek Rocker: Fix saving time in hwclock
Rocker is configured with CST (China Standard Time) timezone
which is UTC+8. Time in RTC is stored in UTC.

Change-Id: Ib9c03e0f0a1d3ea3a69f238cb083809ea9386e2a
2018-06-12 10:31:16 +02:00
Marcin Bukat fbaa97496f Agptek Rocker: Implement RTC support
Add define in config file to enable RTC support in rockbox,
Fix time_menu.c to include radio.h only when tuner is present
Implement time setting function on linux (was empty stub)

Not tested.

Change-Id: I40e6c4a6c1b66ada9cf4e698e502e221d0fc44df
2018-06-12 10:31:15 +02:00
Marcin Bukat 937589ca3a Agptek Rocker: Add bass, treble and balance controls
Change-Id: Ib84620850bbdc81afbdfff1610a0be7eab4f0ac0
2018-06-12 10:31:15 +02:00
Marcin Bukat 7692558674 Agptek Rocker: Implement USB mass storage driver
Agptek uses composite android driver.

Change-Id: Iece188ad640f3dfd24c171946c14da4c3516b6d5
2018-06-12 10:31:15 +02:00
Marcin Bukat d5889b3d94 Agptek Rocker: Make simulator compile and run
There are some things to fix left but at least it starts
and you can navigate.

Change-Id: I76084bfc50334deeb55f46a10e97b5d6639815ac
2018-06-12 10:31:15 +02:00
Marcin Bukat 0538ba3d59 Agptek Rocker: Restrict root directory to SD only
Actual / of underlying linux OS should not be available to user.
I am still not sure if implementation is correct. It doesn't
perform any relative path sandboxing for example.

Change-Id: Ic577a10f3947f6e950e2c4d03173f9f207395eb7
2018-06-12 10:31:15 +02:00
Marcin Bukat d55680993d Agptek Rocker: Initial commit
Change-Id: I26b51106c7b1c36a603fba6d521e917d79b5a95b
2018-06-12 10:31:14 +02:00
William Wilgus 1f63604e2c Fuze PLUS Fix lcd_update_rect()
Lcd_update rect was hanging during horizontal screen update x = 238 and width = 2
which was within the bounds of the screen, this seems to be a weird corner case
but more testing needs done.

Update_rect now properly bounded between 0 - screen w/h
--Cleaned up code

Pixels in x are now multiples of 4.

Datasheet states:
-------------------------------------------------------------------------------------------
WORD_LENGTH=0 implies the input frame buffer is RGB 16 bits per pixel.
DATA_FORMAT_16_BIT field indicates if the pixels are in RGB 555 or RGB 565 format.
Limitations:
— BYTE_PACKING_FORMAT [3:0] should be 0x3 or 0xC if there is only one pixel per word.
— If there are two pixels per word, BYTE_PACKING_FORMAT [3:0] should be 0xF and
H_COUNT will be restricted to be a multiple of 2 pixels.

and

WORD_LENGTH=3 indicates that the input frame-buffer is RGB 24 bits per pixel (RGB 888). If
BYTE_PACKING_FORMAT [3:0] is 0x7, it indicates that there is only one pixel per 32-bit word
and there is no restriction on H_COUNT.
Limitations:
— If BYTE_PACKING_FORMAT [3:0] is 0xF, it indicates that the pixels are packed, i.e. there
are 4 pixels in 3 words or 12 bytes. In that case, H_COUNT must be a multiple of 4 pixels.
-------------------------------------------------------------------------------------------

We are using 16 bits per pixel and byte_packing = 0xF but device crashes with multiple of 2 pixels

Behaviour can be verified with plugin - oscilloscope, Horizontal mode device hangs as indicator
reaches right of screen

Change-Id: I1445f5334f4e7fe59304c65c76b47d0daa0614b2
2018-05-25 22:48:01 +02:00
William Wilgus 038a10220e Fix Remove lcd_scroll_worker from bootloader except remote displays/charcell
This patch was supposed to only remove scroll worker from devices without
remote displays, the build system said otherwise

Change-Id: I240db89ee6b55818dbd2567338515b53ebe09300
fixed: conditional define
2018-05-25 19:16:45 +02:00
William Wilgus 0999a22ef8 Remove lcd_scroll_worker from bootloader except remote displays and charcell
Removes unneeded scrolling fuctionality from bootloaders

Change-Id: Iebe308144cc11c9139399702e3dcd1a548cb9831
2018-05-23 00:37:27 +01:00
Michael Giacomelli 0b2f5187a3 Don't enable full vuprintf file in bootloader. Saves ~2KB packed space when patching clip+ OF.
Change-Id: Ie03714778918bfb4a1087f60534d60ff349a8330
2018-05-23 00:07:57 +01:00
Michael Giacomelli 56803c80d0 Add battery calibration for Sony NWZ A10. 2018-04-20 20:14:46 +01:00
Sebastian Leonhardt 0486e5b93e Zen XFi2: Enable Plugins
Keymaps aren't tested, there may be room for improvement.


Change-Id: I6b8fe697899b241ea6e96f4fe446d88671ad7818
2018-04-03 11:34:01 +02:00