OST timer fix (7a5130a277) causes a boot failure on some units,
the battery voltage reading needs more time to stabilize.
Change-Id: Ic4a9ba90a16fab8ac6d27dbbe7af381f7c810f8f
The battery stabilization delay call seems to need to be
about 170 at minimum now, let's do 190 for safety (+20ms).
Change-Id: Ifd0248891abe827dfcc3e6baf48cc5bef0d0cc1c
It turns out the prescaler fields in OST_CTRL are 2 bits wide,
not 3. The programming manual (as usual) is ambiguous and its
diagram shows 2-bit wide fields, but the bit positions in the
text give a 3-bit wide field. Ingenic's Linux code and my own
testing shows that they are, in fact, 2 bits wide.
This caused the OST2 divisor to be 16 instead of 4; the OST1
divisor was correct. This means that all udelay/mdelay calls
took 4x longer than they should've. After this change the OST2
prescaler will be 4, as intended, and udelay/mdelay calls will
wait for the intended duration.
Change-Id: I2ac0a9190f49b59a840c649bf586131f5f9fde82
Write -1 to AIC_DR to initialize the "last sample"
to -1 in order to prevent power-on clicks.
It appears necessary to completely fill the FIFO,
otherwise I was able to get a click out of it, however
uncommon it was.
Not only does this prevent a click when first
playing a song after power-on, but it also seems to prevent
any click at all when powering on - previously, a small
click may have been heard when first booting.
Change-Id: I2b81c2fa6af9809ef1c354d7a08ca8f9893a7690
Previously it used the last sample, which turns out to be broken.
The AIC appears to send out a random non-zero sample continously
after boot -- probably because the last sample is uninitialized by
the hardware. Disabling playback is supposed to make it send zero
samples irregardless of the LSMP bit according to the docs, but it
doesn't seem to work this way.
- Change eliminates the white noise heard on the M3K after boot.
- Change has no adverse effects on the Q1.
- Leave Eros Q on the old setting since sending zeros exacerbates
clicking due to DAC's automute feature.
Change-Id: I9996793fc34f4475b19700d076b11505353b3836
Adjust the battery scale to be a little better. I've set
the 100% (discharge) point to be where the battery sags to
when it is done charging but still plugged in.
Not quite sure how best to set the charge scale, it's just
equal to the discharge scale for now.
Change-Id: I9a2730c0b2051300af9eeddb4f67164f38a29002
IMHO the current name is somewhat misleading:
- usb_drv_send() is blocking and we have usb_drv_send_nonblocking()
for the non-blocking case. This inconsistent naming can only
promote confusion. (And what would we call a blocking receive?)
- Other hardware abstraction APIs in Rockbox are usually blocking:
storage, LCD, backlight, audio... in other words, blocking is the
default expected behavior, with non-blocking calls being a rarity.
Change-Id: I05b41088d09eab582697674f4f06fdca0c8950af
What works:
- LCD: 16-bit RGB565
- all buttons, including scrollwheel
- SD Card
- Battery level and charging/not charging status
- USB
- audio
- sample rate switching
- HP / LO detect, with "safe" fixed LO volume -
LO volume will only be put to user-defined max volume
if headphones are not present.
- rtc
- Plugins build, tried a couple and they seem OK
- Bootloader, installable to nand via usbboot
What doesn't work:
- Dual Boot
- power on/off has intermittent, low volume audio click
(sometimes it's completely silent, sometimes there's
a click)
- Audio uses 16-bit volume scaling, so clicking/popping
is pretty bad at lower volumes - need 32 bit volume
scaling, 24 bit I2S data
- USB HID keys not yet defined
- no jztool support
Unknowns:
- Stereo Switch pins: Direction select, AC_DC
(probably not even hooked up)
- What is the actual purpose of the Stereo Swtich?
- How does the bluetooth module connect?
"Someday" stuff:
- get LCD working at higher bit depth
- Bluetooth
Change-Id: I70dda8fc092c6e3f4352f2245e4164193f803c33
- Audio playback works
- Touchscreen and buttons work
- Bootloader works and is capable of dual boot
- Plugins are working
- Cabbiev2 theme has been ported
- Stable for general usage
Thanks to Marc Aarts for porting Cabbiev2 and plugin bitmaps.
There's a few minor known issues:
- Bootloader must be installed manually using 'usbboot' as there is
no support in jztool yet.
- Keymaps may be lacking, need further testing and feedback.
- Some plugins may not be fully adapted to the screen size and could
benefit from further tweaking.
- LCD shows abnormal effects under some circumstances: for example,
after viewing a mostly black screen an afterimage appears briefly
when going back to a brightly-lit screen. Sudden power-off without
proper shutdown of the backlight causes a "dissolving" effect.
- CW2015 battery reporting driver is buggy, and disabled for now.
Battery reporting is currently voltage-based using the AXP192.
Change-Id: I635e83f02a880192c5a82cb0861ad3a61c137c3a
Debounce logic now handles both removal and insertion and verifies
the detection is stable for 100ms before taking any action.
This solves the bootloader "file not found" issue on the Shanling Q1.
It seems a false removal event was generated, causing the filesystem
to be automatically unmounted. Probably this is due to some transient
noise at boot. Delays didn't solve the problem, probably because the
bogus hotplug event was queued, and normal mdelay() would simply delay
event delivery.
Change-Id: I8b03fb3550309f5a7ab4be0be7465a3dab2d3450
This streamlines the boot code a bit and reduces target specific
boilerplate. The clock init hack used by the bootloader has been
"standardized" and works for the main Rockbox binary now, so you
can boot rockbox.bin over USB without special hacks.
Change-Id: I7c1fac37df5a45873583ce6818eaedb9f71a782b
This new design saves on binary size and stack usage. The API is
also block- and page-based, requiring awareness of the chip layout
to use properly. Out-of-band areas are also exposed for reading
and writing.
The byte-oriented routines are kept for compatibility with the
existing installer and SPL.
Change-Id: Iaacc694d2f651ab74d45330e0434ee778a0d91bc
- Missing mutex unlock in nand_open()
- SET_FEATURE command incorrectly issued as a read operation
- Inverted protection bits, not sure how that happened...
- Block erase skipped ahead by a wrong amount, causing erases
spanning multiple blocks to erase the wrong blocks
This code was buggy as hell... it's in need of a major overhaul.
It's not very flexible or reliable, and access to the flash is
useful during development of a new port, even if not useful once
the port is complete.
Change-Id: Ib85ee7453beab9657e3d19798ebaa09174b3649e
Allows for the i2c boilerplate to be shared between the M3K and
Shanling Q1 ports. M3K-specific quirks remain in button-fiiom3k.
Change-Id: I8879b603cefc16416bb200f1c484ca916d935c6a
I had hoped this would fix FS#13297, but no luck. Might as well
do this change anyway, because it's the "right" thing to do.
Change-Id: I55819c881d2141dd565e1c1f21460578c9114ff6
Avoids having to #define the names of GPIO pin interrupt handlers,
as they can now be set at runtime instead.
Change-Id: Ib5da1bdb475ff7b64280fe7cdd00adab63389152
The GPIO API was pretty clunky and pin settings were decentralized,
making it hard to see what was happening and making GPIO stuff look
like a mess, frankly.
Instead of passing clunky (port, pin) pairs everywhere, GPIOs are now
identified with a single int. The extra overhead should be minimal as
GPIO configuration is generally not on a performance-critical path.
Pin assignments are now mostly consolidated in gpio-target.h and put
in various tables so gpio_init() can assign most pins at boot time.
Most drivers no longer need to touch GPIOs and basic pin I/O stuff
can happen without config since pins are put into the right state.
IRQ pins still need to be configured manually before use.
Change-Id: Ic5326284b0b2a2f613e9e76a41cb50e24af3aa47
- Use unsigned bitfields in 'lcd_tgt_config'
- Set DTIMES when using an 8-bit bus width
- Allow using DMA big-endian mode
- Provide an #ifdef to avoid stopping DMA in the middle of a frame
- Correctly #ifdef LCD sleep code when target does not implement it
Change-Id: I327c6b05223638b876d5ab62cb6e48f82e6d5fa5
- Change busy loop to wait on the timer flag instead of hoping to
catch the timer at exactly the right moment... unsurprisingly,
that did not work well with higher frequency PWM outputs.
- Put GPIO data into a dedicated const array.
Change-Id: I2a920ed265c192da197a18c7242f3205d11636d3
The old name was a bit misleading. AXP173 is sort of the lowest common
denominator of a series of related chips. The M3K uses an AXP192 which
has a few extra features vs. the AXP173.
New voltage regulator stuff was added for the sake of the Shanling Q1
native port (that player also uses an AXP192).
Change-Id: Id0c162c23094bb03d13fae2d6c332e3047968d6e
- Drop obsolete NAND patch script (it's simpler to use 'dd' directly)
- Remove an outdated comment
- Fix missing 'void' in a function definition
- Reset the poweroff timer when we poke the backlight
Change-Id: I752624386f30ac95f41a731d2b6be837e12275a9
Some audiohw API calls are shared between playback and recording,
eg. frequency settings. Implementing these in the DAC driver won't
work for the M3K, as it uses a separate codec for microphone input.
Change-Id: Ieb0a267f8a81b9e2bbf0bbca951c5778f8dcd203
I think this covers everything now, although some fields are missing
enum values. Those can be added in if and when they are needed.
Change-Id: Ib1a94ba9c9a5949b6a038f8c1a49786823fae58f
- Add support for skip and seek while the player is locked.
(Thanks to @bahus for the suggestion)
- Fix touch zones because the down button zone ended up being
a lot smaller than expected due to the touchpad's wonkiness.
Also added a visual display of the touchpad to its debug menu.
- Fixes the pictureflow keymap because it was mostly unusable.
Change-Id: Ic0da4f8df3613ff7828ce1cb940ed9e77ada3281
SPL and UCL-compressed bootloader are now packed into one output,
bootloader.m3k, eliminating the separate SPL build phase.
The Rockbox bootloader now has a recovery menu, accessible by
holding VOL+ when booting, that lets you back up, restore, and
update the bootloader from the device.
Change-Id: I642c6e5fb83587a013ab2fbfd1adab439561ced2
- Removed unnecessary layers of generic code
- Software ECC is gone since we don't need it now (and maybe not ever)
- Removed bounce buffering, so callers must now align buffers
Change-Id: I33fbac9d9d12a4657980b8618c7d62bfa91e2ea0
This overwrote the first 2 instructions of crt0 in the bootloader!
I'm really not sure how this *didn't* cause a fatal exception.
This address isn't special as far as I know, so just move it to the
TCSM by making it a static variable.
Change-Id: I58e1486804aeb2b68325e8de2aa1874c97abef19
The abiflags data is only used to communicate ABI information to a
program loader -- you can see what info is stored with readelf -A.
Dropping it shaves 24 bytes off of every binary (including plugins).
Change-Id: Iae78eeffe5c840ff67717707fb94821d24aac8ec
There's absolutely no way for gpio_config() to get called from two
different threads due to the co-operative threading model, and it
is unsafe to call from IRQ context no matter what we do.
Change-Id: I58f7d1f68c7a414610bb020e26b774cb1015a3b0