Remove the battery power ADC since it's not used right now,
and seems to fluctuate too rapidly to be of much use.
Change-Id: If115e4e3ce14d4c18ce899f5a889f7f99ab66489
This caused LCD problems on the ErosQ, where the screen would
go white until being put through a sleep/wake cycle. The exact
reason for this isn't obvious, but the problem didn't exist
prior to the AXP driver rewrite.
The two dependent changes,
42999913ba - x1000: Increase USB current limit to 500 mA at all times
90dd2f84a9 - x1000: Correctly limit USB charging current
ended up bringing the USB charging situation back to where it
was prior to the rewrite, so the cleanest option is to revert
the whole lot.
This reverts commit 42999913ba.
This reverts commit 90dd2f84a9.
This reverts commit 2d89143962.
Change-Id: I1cff2bfdd1b189df14bcf8cce42db725caa470d7
The 100 mA USB current limit added in commit 90dd2f84a9
is a problem when booting with a completely dead battery.
Often 100 mA isn't enough to power the player, never mind
charge the battery, so revert to the old behavior of only
limiting charge current.
Given that the original firmware on these devices isn't
following the USB spec to the letter, it's probably not
worth trying to make Rockbox do so unless and until it
causes a real problem - which hasn't happened yet.
Change-Id: I179a08310c226fe01460680c62fd25fd69079256
This problem actually had nothing to do with USB boot; it's
because the cable is plugged in when the USB mode menu item
is selected. The USB thread detected the select button press
and went into charge-only mode (as it usually does when you
hold down a key in Rockbox). This is fixed by having the USB
thread ignore most keys in the bootloader.
USB connect events are delivered via the button queue, and
there were also cases where the connection could be missed
if the event happened within another UI screen. This should
also be fixed.
Change-Id: I077d705a6ac845c8713219eee45d26aa6addfa61
Guard against division by zero and prevent the time_now
value from going negative if the counter drops below zero.
Change-Id: Ia8cadfe76086d6d0200964c1f27bab0be708b135
This method, while far from perfect, is able to make use of
real-time battery usage information and updates frequently
in fine-grained increments. This should make time estimates
a lot more useful than they previously were.
Change-Id: I66c6daba88210f60a27e239fbbcc56869be3b878
The way this was done before was wrong - limiting the charge
current is not enough since the device will draw additional
power to run. Use the AXP192's vbus current limit control to
stay compliant with the USB specification.
Change-Id: I91b84e3480a432e49bec53cf2a17e4e3444404a4
I noticed a few mistakes in the old driver code and it was in
need of an overhaul anyway... I decided to scale things back,
simplify the code and remove most of the debug menus, netting
a nice code size savings.
One new feature is an advanced debug menu which is accessible
by recompiling the code with AXP_EXTRA_DEBUG. It adds quite a
bit of code size and isn't useful other than for development
so it must be manually enabled by editing the source.
Change-Id: I30e17c1194c14823decd726a574ed14451d4cb2d
This reverts commit 6ff1a935b9.
Reason: it created a mismatch between the displayed voltage
and percent since the voltage was unfiltered but percentage
was based off the filtered voltage.
Change-Id: I4cba099f2e1edf0ef7c4e17a32f566aa66f5b933
This allows battery run time to be calculated from the
actual battery usage on the FiiO M3K and Shanling Q1.
This isn't very good for the time being and the estimate
tends to go all over the place due to small variations
in current or voltage.
The Eros Q can support this feature as well, but since
it already has fixed estimates defined and the quality
of the "real time" estimate is low I am not enabling it
there.
Change-Id: Id34a93ee4b7d66f9f7e56ef0f5149f67e8e72039
I've tried to clean up cruft and clarify what's being
done, prior to adding new features. The behavior should
be unchanged.
Change-Id: If8a68b7b48173d283df981a21cdd854b714e7695
Also keeps display from lighting up before shutdown,
which reduces distractions, especially at night and
when the sleep timer is used by allowing the
screen to remain dark.
Change-Id: I1c2d1966f6fb9766532adf01e8828876a871857f
Create a new battery_current() function to report the
the battery's charging/discharging current. Move the
old runcurrent() implementation into it and clean up
some of the related defines.
Change-Id: I7dbe5b6532d291fa72add1cb23b30e3cbac8c3ca
Remove battery_read_info() which is a simple wrapper
function only used by debug screens. Use the polling
functions directly to save a bit of code size.
Change-Id: I2919f78105bab186f6933dc1823f9fa67fe74f3e
- Don't include the 'battery capacity' setting unless the
target allows changing it.
- Clean up the preprocessor conditionals used to check for
variable battery capacity support.
- Don't use a variable for battery capacity unless it is
actually needed.
Change-Id: I3d8a338f107014f2c5098bc0a44ef0cfb4df9356
Give iBasso DX50/DX90 empty adc-target.h headers like all
the other hosted targets to avoid special cases.
Change-Id: Iaae15642fdec4ff18bc9ac01245753135128f676
Rewrite the loop to update the framebuffer by rows rather
than by columns. This should (a) be more efficient on the
majority of targets using horizontal stride framebuffers,
(b) skimp a bit on code size and (c) avoid AddressSanitizer
errors caused by reading past the end of the source buffer.
Change-Id: I238d191d63bfdecd25336fd8879a63d9d6ab7087
Future-proofing against newer versions of GCC/binutils which
are stricter about the use of 'inline' functions in headers.
Change-Id: Id620812ed340f0d790ba6c5b8b5cb1d700acfbbf
This handles the case where the host sends a new setup packet
in the middle of an ongoing control transfer.
Change-Id: I1d2e02467e9b813c9827cc0699cb87a500515e31
The FT6x06 driver used for the Shanling Q1's touchscreen
has been extended to report more than one touch point. It
can also return the gesture detected by the controller,
but this doesn't seem to report anything useful on the Q1.
Multi-touch is only useful in 3x3 grid mode since the Rockbox
button API cannot report more than one touch point.
The FiiO M3K uses the same driver so it's been updated to the
multi-touch API, but functionality is unchanged.
Change-Id: I4de42f44808d6eb902e3da212d8f936b7a5042c7
Touch devices have physical buttons too, and these should be
subject to repeat acceleration. That feature was disabled for
the sake of better touch event responsiveness (apparently).
So, re-enable the acceleration feature & add a special case
to exempt BUTTON_TOUCHSCREEN from acceleration.
Change-Id: I9e097e27457fbd6b824f098e8b325ff35c59dde4
Based on a patch by Amaury Pouly which was based on a patch from Ryan
Hitchman.
I mainly moved the code for polling into the tuner driver so it can be
reused by other targets. I added the CONFIG parameter for the polling
frequency (in ticks) to save energy. Also, I did some minor cleanups.
Change-Id: I95a62e7e1e42c62dbf47ecb27a3b312a42be62aa
All three X1000 native targets turned out to have a very
similar boot configuration and used a nearly identical
makefile. Eliminate this duplication by moving the logic
into the main makefile.
Change-Id: I13044b9675c0abd605b8accdb2fee4f54549b020
Due to how the old control request API worked, the request
pointer (and the pointed-to contents) passed by the driver
must remain valid for the lifetime of the request.
The buffered copy wasn't used consistently anyway, so it
should be safe to just get rid of it.
(This only affects the old API compatibility layer.)
Change-Id: I00294c718a7515a91b84f7c7cae5220c73aa5960
In the old API, usb_core_transfer_complete() would ignore
any completions on EP0. The legacy control API will also
ignore most completions on EP0, but it only did so after
filling in the completion event.
If the driver submits a spurious completion on EP0, then
this could clobber a previously queued completion event.
Fix this by deciding whether to ignore the completion
*before* modifying the event data.
Change-Id: I68526898a96efa594ada4e94bb6851aaaf12e92a
Appears to return 0 until the axp has (presumably) completed
its first real measurement.
Note about erosq: keep the power_inint() delay large to ensure
nothing breaks in the bootloader for the time being.
Change-Id: I444e858207cc401c42f1e6ceacf067ad543d4ff8
The address from the packet needs to be saved before sending
the response -- after the response the request being pointed
to could get overwritten. This used to be done correctly but
I unintentionally broke it when updating the handler to the
new control request API.
Change-Id: I9b11548baf20dce44a82301731405dc8e8f1cef3
Ive seen no ill effects having this disabled on target so
limit it to the sim to stop Address Sanitizer from dumping
on the extra byte read. the bad data is never used AFAICT
since the loop ends
Change-Id: I8cb54e9d1f8fe28747867d861a015edb3dbfa5ff
Because usb_core_legacy_control_request() is called by an
interrupt handler the global variables used to track the
current control request at the very least need to be volatile.
It might also be necessary to disable IRQs but I'm not sure
of that.
Change-Id: I0f0bb86d0ad63734e8d3c73cb1c52fedf5a98120