path: root/firmware/target/arm/as3525
AgeCommit message (Collapse)AuthorFilesLines
2020-05-23Sansa AMS add Minimum Clocks for I2c IDE SDSLOT SSPWilliam Wilgus1-7/+28
This patch doesn't implement them just defines them Change-Id: I1762152c3c683cc68bcedac5923c536316441613
2020-05-23Sansa AMS set I2C properlyWilliam Wilgus1-5/+18
Change-Id: I95c93933487c4260a7aa43ebed273ab2c05e55c1
2020-05-23Sansa Clip+ set lcd SSP properlyWilliam Wilgus1-1/+15
Change-Id: I152f038954ac1649b30dd17c3e6332e4d756502c
2020-05-23Sansa ClipZip set lcd SSP properlyWilliam Wilgus1-1/+16
Change-Id: Ice62dfa7f266ee4369793777a39e675bceae1831
2020-04-17ClipZip LCD Corruption Backlight fixWilliam Wilgus1-3/+5
User reported LCD screen corruption via forum in 3.14 and 3.15 turning backlight off and back on seems to fix the issue,53192.0.html Change-Id: Id0b34d2f9b77e79ab0ecabace331f0b203184724
2019-12-30Fix As3525 SD unused parameter warningWilliam Wilgus1-2/+3
Change-Id: I0a4bbcf94e9cadf43a822c1cb2f2dad3bd4f7588
2019-12-31Sansa AS3525V1 Sd Interface implement powersave modeWilliam Wilgus1-30/+65
This patch cleans up the sd driver for the V1 sansas powersave implemented for the sd interface Change-Id: I3d864f7aa304cf792cc65fa4ff06c1e52fbed329
2018-07-28Revert "As3525 v1/v2 Add power savings menu"William Wilgus8-309/+51
This reverts commit 6f0320a9535bc1aa81d83fa879ac14d5ee603658. Change-Id: I7425d422a4a0af7a49e9194cfe0bb55d431bc401
2018-07-28Revert "Fix Red on PowerSave in Simulator"William Wilgus1-2/+0
This reverts commit 568b81202ebd24a3f7e9efe0558b5f6beed05b44. Change-Id: I2af42cd53d0ce490bf96c68288e9fbde034c0069
2018-07-28Slightly raise voltage on FuzeV2 devices.Michael Giacomelli1-0/+3
Some devices seem to have trouble accessing the storage at lower voltages.
2018-07-28Fix Red on PowerSave in SimulatorWilliam Wilgus1-0/+2
Change-Id: Ic5d9de230efceabc2c428e5c78fa6596a5a34840
2018-07-27As3525 v1/v2 Add power savings menuWilliam Wilgus8-51/+309
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 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-26Optimize lcd-ssd1303 driver (clip series)William Wilgus5-82/+228
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-26Update AS3525 v1/v2 debug menu; add scrolling and missing frequenciesWilliam Wilgus1-192/+188
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-25AMS v1/v2: Fix I2C2_CSPR debug menu entryWilliam Wilgus3-20/+32
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-25CLIPPLUS -- Remove un-needed handling for power button button ↵William Wilgus1-7/+9
button_read_device() switching GPIOB in order to read GPIOD96) (power button) is apparently unneeded Change-Id: I1fbf13f67f938806086754cdd5e389ef6746ae5f
2018-07-04AMS v1/v2: Remove sd_enabled as an externally-visible variable.Michael Sevakis4-42/+29
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
2017-11-21Convert i.MX31 and AMS target to use RTC interruptMichael Sevakis2-9/+53
Instead of checking ticks, set a sticky dirty flag that indicates that the RTC needs to be read. This gives a timely update and more accurate readout without actually reading the RTC until it changes. The implementation should atomically read the flag and clear it. Setting the flag would typically happen in an RTC tick ISR. Change-Id: I6fd325f22845029a485c502c884812d3676026ea
2017-10-30AMS: Convert ascodec_endofch() to use bit mod function's return value.Michael Sevakis1-8/+1
It cleans up the code and it was the initial inspiring reason to change them. Change-Id: I299499117b8a12d93d13d6563683bab89ab80555
2017-10-26Unify storage threads into oneMichael Sevakis2-282/+182
* Editing a bunch of drivers' thread routines in order to implement a new feature is tedious. * No matter the number of storage drivers, they share one thread. No extra threads needed for CONFIG_STORAGE_MULTI. * Each has an event callback called by the storage thread. * A default callback is provided to fake sleeping in order to trigger idle callbacks. It could also do other default processing. Changes to it will be part of driver code without editing each one. * Drivers may sleep and wake as they please as long as they give a low pulse on their storage bit to ask to go into sleep mode. Idle callback is called on its behalf and driver immediately put into sleep mode. * Drivers may indicate they are to continue receiving events in USB mode, otherwise they receve nothing until disconnect (they do receive SYS_USB_DISCONNECTED no matter what). * Rework a few things to keep the callback implementation sane and maintainable. ata.c was dreadful with all those bools; make it a state machine and easier to follow. Remove last_user_activity; it has no purpose that isn't served by keeping the disk active through last_disk_activity instead. * Even-out stack sizes partly because of a lack of a decent place to define them by driver or SoC or whatever; it doesn't seem too critical to do that anyway. Many are simply too large while at least one isn't really adequate. They may be individually overridden if necessary (figure out where). The thread uses the greatest size demanded. Newer file code is much more frugal with stack space. I barely see use crack 50% after idle callbacks (usually mid-40s). Card insert/eject doesn't demand much. * No forcing of idle callbacks. If it isn't necessary for one or more non-disk storage types, it really isn't any more necessary for disk storage. Besides, it makes the whole thing easier to implement. Change-Id: Id30c284d82a8af66e47f2cfe104c52cbd8aa7215
2017-06-14Slightly increase CVDD2 on AMSv2.Michael Giacomelli1-2/+2
At least one person found an SD card that wouldn't work at 2.7v. Change-Id: I84001f07acc9ce36c71165706cce28c2899ac6bf
2017-03-12Do some housekeeping with fat.h and SECTOR_SIZEMichael Sevakis2-2/+2
Many includes of fat.h are pointless. Some includes are just for SECTOR_SIZE. Add a file 'firmware/include/fs_defines.h' for that and to define tuneable values that were scattered amongst various headers. Remove some local definitions of SECTOR_SIZE since they have to be in agreement with the rest of the fs code anyway. (We'll see what's in fact pointless in a moment ;) Change-Id: I9ba183bf58bd87f5c45eba7bd675c7e2c1c18ed5
2017-02-11Improve radio RDS driver and frameworkMichael Sevakis1-7/+1
* Remove unused bits like the radio event and simplify basic radio interface. It can be more self-contained with rds.h only required by radio and tuner code. * Add post-processing to text a-la Silicon Labs AN243. The chip's error correction can only do so much; additional checks are highly recommended. Simply testing for two identical messages in a row is extremely effective and I've never seen corrupted text since doing that, even with mediocre reception. Groups segments must arrive in order, not randomly; logic change only accepts them in order, starting at 0. Time readout was made a bit better but really we'd need to use verbose mode and ensure that no errors were seen during receiving of time and more checks would be need to have a stable PI. The text is the important bit anyway. * Time out of stale text. * Text is no longer updated until a complete group has been received, as is specified in the standard. Perhaps go back to scrolling text lines in the radio screen? * Add proper character conversion to UTF-8. Only the default G0 table for the moment. The other two could be added in. * Add variants "RDS_CFG_PROCESS" and "RDS_CFG_PUSH" to allow the option for processed RDS data to be pushed to the driver and still do proper post-processing (only text conversion for now for the latter). Change-Id: I4d83f8b2e89a209a5096d15ec266477318c66925
2017-02-07Slightly increase CVDD1 for Clip ZipMihail Zenkov1-1/+1
Change-Id: Ic784c72a643546c8e31affa820f701eb7982b7c7
2017-01-27sd-as3525v2: simplify logic and cleanupMihail Zenkov1-75/+33
Remove "low power mode clocking" as we stop clocking by hands after each transfer. Remove CGU_IDE and CGU_MEMSTICK as we don't use them. Simplify logic in sd_transfer_sectors. Change-Id: I120396d7ec5c99c62f3a746306aa8edd8686e08a
2017-01-25AMS: Return ascodec to interrupt-based I2C2 driverMichael Sevakis4-123/+536
1. Slightly revised and regularized internal interface. Callback is used for read and write to provide completion signal instead of having two mechanisms. 2. Lower overhead for asynchronous or alterate completion callbacks. We now only init what is required by the transfer. A couple unneeded structure members were also nixed. 3. Fixes a bug that would neglect a semaphore wait if pumping the I2C interrupts in a loop when not in thread state or interrupts are masked. 4. Corrects broken initialization order by defining KDEV_INIT, which makes kernel_init() call kernel_device_init() to initialize additional devices _after_ the kernel, threading and synchronization objects are safe to use. 5. Locking set_cpu_frequency has to be done at the highest level in system.c to ensure the boost counter and the frequency are both set in agreement. Reconcile the locking inteface between PP and AMS (the only two currently using locking there) to keep it clean. Now works fine with voltages in GIT HEAD on my Fuze v2, type 0. Previously, everything crashed and died instantly. action.c calling set_cpu_frequency from a tick was part of it. The rest may have been related to 3. and 4. Honestly, I'm not certain! Testing by Mihail Zenkov indicates it solves our problems. This will get the developer builds running again after the kernel assert code push. Change-Id: Ie245994fb3e318dd5ef48e383ce61fdd977224d4
2016-08-15as3525v2: use the new USB DesignWare driverCástor Muñoz2-0/+76
Targets: sansaclipplus, samsaclipv2, sansaclipzip, sansafuzev2. Change-Id: I7773528a4e26707dd33fe9cb8948750d49570701
2016-08-11Increase CVDD1 only for Clip+ version 0Mihail Zenkov1-1/+4
Change-Id: I839ba2191a5c52ef6f58fd4a273db628b690a05c
2016-08-10Increase CVDD1 for Clip+ to prevent ATA errorMihail Zenkov1-1/+3
Change-Id: I0424d02196a6c5fb6d0185b007df5ece24b10b82
2016-04-05as3525: reverting I2C2 to non-interrupts versionMihail Zenkov2-361/+109
Interrupts version is cause of freeze on USB extraction. Also non-interrupts version much simpler and faster. Change-Id: I30a2993cdcaa85abfba77ca06bfacd5b6b4353e2
2016-04-04Fix checking for CONFIG_CHARGINGMihail Zenkov1-2/+2
Change-Id: I53b9a129679fd7b322770025106ef92033226d2a
2016-03-27Enable voltage scaling on AMSv2.Michael Giacomelli1-2/+2
Voltage is reduced when the CPU is unboosted, resulting in a large reduction in power consumption. In analogy with the AMSv1 voltage scaling code (currently disabled due to problems with SD cards), I have defined a config file option to enable/disable it. Change-Id: Ia89c31ec06dd012354b4d53435e7b5b36243b206
2016-03-27AMSv2: additional delay for voltage scalingMihail Zenkov1-4/+7
We need additional delay since ascodec_write_pmu() working faster in non-interrupts version of I2C2. Change-Id: If4af3e42b3c8e8214baa36e54353b8adb527552d
2016-03-27AMSv2: DBOP frequency divided by 2Mihail Zenkov1-3/+4
After setting new PCLK (96 Mhz) we have too high DBOP (96 / 16 = 6 MHz). According to datasheet DBOP should be maximum 4 MHz. Change-Id: I1cbec054f41a76a6f18eadccb902c5b174ad6e3a
2016-03-24Slightly increase VDD2 on AMSv2.Michael Giacomelli1-2/+2
The old value was unstable on some devices. Change-Id: I016906ec076384589bef9ece6156e0ee7b31609a
2016-03-18sd-as3525v2: prevent DTO error and DMA problemsMihail Zenkov1-7/+12
We should check sd_wait_for_tran_state() after transfering to prevent data timeout error. Also we should disable DMA channel manually. Should be used with g#1270, without it freezes still can occur on data transfering. Change-Id: If8c6e5547ab14d66237bccf65f83affc7a346e5e
2016-03-18sd-as3525v2: exit with error if transfer failureMihail Zenkov1-0/+3
Change-Id: Ic94cf7d3e058a876bbafdb5a35f26f240e1384fd
2016-03-18sd-as3525v2: Limit number of retryMihail Zenkov1-1/+1
With current setting we spend few minutes for reading one sector if we have data timeout error. With new setting system (linux) show error after ~10 seconds. Change-Id: Id3922acb2ea146c6ea2f89f26206df9488e6ee4e
2016-01-21Enable frequency scaling on AMSv2 devices.Mihail Zenkov2-46/+23
Voltage scaling is not yet enabled, but will follow once we are sure these changes are stable. Preliminary testing suggests a large increase in battery life, which will be further improved by voltage scaling. Patch by Mihail Zenkov with help from myself and others on the forums. Change-Id: I171d20bbee19a48c13cd14efb0d023883cc8c687
2016-01-18Make sure the system is boosted before enabling USB hardware.Michael Giacomelli1-2/+5
Change-Id: Ib44d29384f359dff24f0ce012667d9ce93328dc2
2016-01-18Increase button delays in preperation for frequency scaling.Michael Giacomelli1-2/+3
When run at lower clock speeds, delays seem to need to be a little longer in absolute time. Change-Id: I5373f43094302e6fa3f0a79126e54cfccd90f5a4
2016-01-18Change the clipv2 button driver to use fixed delays rather than processor ↵Michael Giacomelli1-4/+2
cycle counting. Also introduce a new delay needed for frequency scaling. Change-Id: I575a503a8ca44358fcd5512fd951fe9c7bbde31c
2015-06-01AMS: Change DMA transfer size for audio.Mihail Zenkov1-1/+1
Slightly reduces power consumption due to DMA overhead. Change-Id: I8576e9e243ce13a71cde710c3a726dce19bafb97
2015-04-09AMS: Fix pop-clicks noise on play/stop.Mihail Zenkov1-14/+2
This noise itroduced by starting/stopping I2SO MCLK. Enable MCLK permanently fix it. Change-Id: I6d9c51e5ea5bca13026833d2bfdda49d94c6b723
2015-03-16Fix a race condition in as3525 I2C driver caused by stacked ISRs.Michael Sevakis1-17/+25
It was possible for interrupts of higher priority than the current IRQ level to attempt to restart the interface while it was still active on a transfer. The list modification also wasn't protected within the I2C ISR itself. Change-Id: I70635c307a1443bba6801c588cf1efde299db9a4
2015-01-12Get rid of stupid _backlight_* function namesMarcin Bukat17-83/+83
_remote_backlight_* and _buttonlight_* are cleaned as well Change-Id: I73653752831bbe170c26ba95d3bc04c2e3a5cf30
2015-01-08Get rid of USE_ROCKBOX_USBAmaury Pouly1-1/+1
Except for unfinished or experimental ports, it isthe case that USE_ROCKBOX_USB and HAVE_USBSTACK are both defined or both undefined. Furthermore, it is a leftover of some early developments on the USB stack and doesn't make sense anymore. Change-Id: Ic87a865b6bb4c7c9a8d45d1f0bb0f2fb536b8cad Reviewed-on: Reviewed-by: Amaury Pouly <>
2014-09-29Fix compilation on amsv1.Michael Giacomelli1-0/+2
Change-Id: Ie8fb5cacacd6f875c7b0063fdea1c1865941f1bd
2014-09-28Add various additional AS3525v2 SOC voltages to the debug screen.Michael Giacomelli1-2/+41
Change-Id: I8c110771f73f5248e949b027fbe1c281c6b1f6f7 Reviewed-on: Reviewed-by: Michael Giacomelli <> Tested: Michael Giacomelli <>
2014-09-28Don't enable the current sink for the Clip Zip backlight until its actually ↵Mihail Zenkov1-5/+4
needed. Patch by Mihail Zenkov who measured a modest increase in power consumption with the current sink enabled. Change-Id: Ib1c1639318de35d449ca51a9bd480005cb6a2ee0 Reviewed-on: Reviewed-by: Michael Giacomelli <> Tested: Michael Giacomelli <>