summaryrefslogtreecommitdiff
path: root/firmware/drivers
AgeCommit message (Collapse)Author
2020-05-12m66591: Fix out-of-bounds array accessSolomon Peachy
Loop terminator needed a preincrement rather than postincrement, and also used a proper #define instead of a magic number. Change-Id: Iafd6a0dce0304cb94e4f1d04cce46d2ca603507a
2020-04-07Consider sector size when checking cluster sizeStefan Ott
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-06xDuoo X3II and X20 portMarcin Bukat
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
2019-02-07transflective LCDs: fix "first buttonpress enables backlight only"Sebastian Leonhardt
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-01-04Add HAVE_LINEOUT_DETECTION and associated logicSolomon Peachy
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-02Add Xuelin iHIFI 770/770C/800 supportSolomon Peachy
Taken from the xvortex fork (Roman Stolyarov) Ported, rebased, and cleaned up by myself. Change-Id: I7b2bca2d29502f2e4544e42f3d122786dd4b7978
2018-12-25FS#7814 - Enable RTC Alarms on H300, X5, and M5Solomon Peachy
Original patch by Alexander Spyridakis Modified by Steve Bavin and Igor Poretsky Keymap fixes by Marianne Arnold Change-Id: I5a252d97d2b05c533e048931f7354f4261f76499
2018-12-22FS#12610 - Clip+ Ticking Noise Fixed in RadioSolomon Peachy
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-07-28Add cleaned-up xDuoo X3 supportSolomon Peachy
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-25Revert "Ignore truncation in lcd-scroll.c"William Wilgus
This reverts commit 540637ed3334364fe9d1b54cdc96a52f59afda83. Change-Id: I88e71ef47a11818a5acb407ff9c0723d3c197243
2018-07-25Ignore truncation in lcd-scroll.cWilliam Wilgus
Change-Id: Id1008300e58cf12ab920c1023354a74a6d32daae
2018-06-12Cleanup commentMarcin Bukat
Change-Id: If39a5d2f64a9453a9b9b0cf0a2e3ad36027978ff
2018-06-12Agptek Rocker: Initial commitMarcin Bukat
Change-Id: I26b51106c7b1c36a603fba6d521e917d79b5a95b
2018-05-25Fix Remove lcd_scroll_worker from bootloader except remote displays/charcellWilliam Wilgus
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-23Remove lcd_scroll_worker from bootloader except remote displays and charcellWilliam Wilgus
Removes unneeded scrolling fuctionality from bootloaders Change-Id: Iebe308144cc11c9139399702e3dcd1a548cb9831
2017-11-21Convert i.MX31 and AMS target to use RTC interruptMichael Sevakis
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-11-06nwzlinux: add support for radioAmaury Pouly
None of the Sony up to A15 seem to support RDS (they use either Si4702 or Si4708), thus I did not add any code to support RDS. Change-Id: I64838993b9705b36b94665f8470c7a89c772c961
2017-10-26Unify storage threads into oneMichael Sevakis
* 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-10-07sonynwz: add api and debug entries for "acoustic" and "cue/rev" modeAmaury Pouly
We don't really know what those are supposed to do. They seem to change the volume curve but it is not very clear what is the intended purpose. Change-Id: I65f5d18aba139844c23df092277ba17ee8518f96
2017-10-01sonynwza10/a20: enable pcm frequency selectionAmaury Pouly
Change-Id: I335fcdbb652253e777d0d7406545d0d44d98f4f0
2017-09-05Initial commit for the Sony NWZ linux portAmaury Pouly
SUPPORTED SERIES: - NWZ-E450 - NWZ-E460 - NWZ-E470 - NWZ-E580 - NWZ-A10 NOTES: - bootloader makefile convert an extra font to be installed alongside the bootloader since sysfont is way too small - the toolsicon bitmap comes from the Oxygen iconset - touchscreen driver is untested TODO: - implement audio routing driver (pcm is handled by pcm-alsa) - fix playback: it crashes on illegal instruction in DEBUG builds - find out why the browser starts at / instead of /contents - implement radio support - implement return to OF for usb handling - calibrate battery curve (NB: of can report a battery level on a 0-5 scale but probabl don't want to use that ?) - implement simulator build (we need a nice image of the player) - figure out if we can detect jack removal POTENTIAL TODOS: - try to build a usb serial gadget and gdbserver Change-Id: Ic77d71e0651355d47cc4e423a40fb64a60c69a80
2017-04-21RDS: Fix a few goofs in the unicode tableMichael Sevakis
Change-Id: I54c681a9eb3d5e90ee4aeedc3ec5dbd6243cb208
2017-03-12Do some housekeeping with fat.h and SECTOR_SIZEMichael Sevakis
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-12Forgot to remove unused RDS buffers from the ipod remote tuner.Michael Sevakis
Also, use rds_reset() now to clear data on station change since the rds driver internal buffers are used. Change-Id: I043b09d661eeec21617381015347f0bcead4f7d4
2017-02-11Fix warnings and errors from fc9695eMichael Sevakis
* fmradio.c needs an implementation of tuner_get_rds_info() for the sim (kill all the sims). * Some macro bitflags shouldn't be seen unless HAVE_RDS_CAP is defined. Change-Id: Idd00c94ca2fc43cf32f9223aa4530d5a02fb3454
2017-02-11Improve radio RDS driver and frameworkMichael Sevakis
* 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-04Fix dangerous castsAmaury Pouly
On Windows 64-bit, the size of long is 32-bit, thus any pointer to long cast is not valid. In any case, one should use intptr_t and ptrdiff_t when casting to integers. This commit attempts to fix all instances reported by GCC. When relevant, I replaced code by the macros PTR_ADD, ALIGN_UP from system.h Change-Id: I2273b0e8465d3c4689824717ed5afa5ed238a2dc
2017-01-26Move intrinsic RTC implmentation differences to driver filesMichael Sevakis
Some drivers set tm_wday just fine and do not need it coerced to be correct. Others set tm_yday, so don't overwrite what the driver sets; just zero it inside if it can't fill the field. Move calls to set_day_of_week() to the sorts of drivers that presumably required the hammer (FS#11814) in get_time() where the weekday isn't locked to the date. Change-Id: Idd0ded6bfc9d9f48fcc1a6074068164c42fcf24a
2017-01-25AMS: Return ascodec to interrupt-based I2C2 driverMichael Sevakis
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
2017-01-21Fix dumb typo in button.c.Michael Sevakis
Forgot to check a non-freq-scaling target. :) Change-Id: Ib19b1b6ebdb3e4ad595aca37a687f32156290a65
2017-01-21action.c must desist in calling set_cpu_frequency from a tickMichael Sevakis
The function is neither reentrant nor ISR callable. Instead of using a ticked-based timeout, have the button driver provide the unboost after a delay when waiting for a button. HAVE_GUI_BOOST gets immediate boost after dequeuing any message, otherwise the queue has to have at least three messages waiting for it to trigger a boost-- essentially the behavior that existed but now combined in one place. Change-Id: I1d924702840f56a1a65abe41fa92b4e753c4e75a
2017-01-17Do some debug and preparatory work for ramcache and playlistMichael Sevakis
The file system rework introduced incompatibility between dircache and the tagcache ramcache and playlist dircache path caching. This update makes changes to filesystem code to reintegrate all that. It also fixes a couple bugs that were found when vetting all the code. The filestream cache was being reset without regard to the stream even if it was shared in write mode (made work of .playlist_control). Better handling of unmounting gives files a better go at force-closing them without risk to disk integrity. Did some miscellaneous pedantic changes. Improved efficiency of testing a file's existence (a little) since the path parser will be shared between file code and parsing for the sake of finding dircache references, not duplicated as before. This commit doesn't reenable said items just for the sake of keeping changes separate and related. Plan for the next is to enable dircache again for the playlists (easy peasy) and reenable tagcache ramcache but *without* the dircache path caching because it's rather substantial to change in itself. The ramcache will still function without dircache. Change-Id: I7e2a9910b866251fa8333e1275f72fcfc8425d2d
2016-12-12wm8975: document audiohw settingsAmaury Pouly
Change-Id: I0456f85e4ebc821c23e25026fbee3d8cf7526ee7
2016-12-12wm8758: document and fix audiohw settingsAmaury Pouly
It looks like a copy and paste error to me, those were completely wrong. Change-Id: Id6ae025f4216ffccb1a8b8b790916d8b6c4694bd
2016-12-12wm8751: document and fix audiohw settingsAmaury Pouly
Document 3D depth range. Fix mismatch in recording volume: the displayed volume is completely off the chart Change-Id: I4c363f369e5d72f332391a6f96457b4e450404f9
2016-12-12wm8731: document audiohw settingsAmaury Pouly
Change-Id: I78ec26a00a3e14a95c591ac81d96e1b480b9138e
2016-12-12imx233: slightly rework 3D audio settingAmaury Pouly
The old code made the setting appear as 0dB, 1.5dB, 3dB and 4.5dB when in fact it is 0dB, 3dB, 4.5dB and 6dB. This commit clarifies the code and also fix this at the same time. This imx233 3D enhancement is complete crap anyway but now you can satisfy yourself with 6 dB of pure crap, clearly an enhancement. Change-Id: Ia3e088987c1ff0cdde228905ff70f46476a499a2
2016-09-21imx233: fix recording gainAmaury Pouly
For some reason, there was a mismatch between the setting (decibel) and the audiohw code (centicel). This resulted in a gain divided by 10. This may explain why some people experienced low volume with the mic on the fuze+. Change-Id: I138ac18dd93c36f43a7dfce735efc826405c598c
2016-08-29as3543: fix audio gap when switching from dac to line-in/recordingAmaury Pouly
Also clarity parts of the code. The old code suffered from two defects: - it was very unclear because it made changes to whole registers (using as3514_write) instead of fields (using as3514_set/clear/write_masked). Also the routing code was spread accross several functions which made it hard to follow. - it did not properly reroute audio on monitor changes. In particular, the following could happen: when switching from DAC to radio, the code would fail to clear SUM_off, resulting in a weird situation where the main mixer was off (SUM_off) but the headphone where using the main mixer as input. Incredibly this worked anyway (at least on AMSv2 and YP-R0) but resulted in strange volume gaps between DAC and radio mode. Change-Id: I7826835fdb59c21f6483b223883ca9289e85caca
2016-06-01zenxfi3: rewrite mpr121 driverAmaury Pouly
The new driver uses an asynchronous architecture for touch status reading. Change-Id: Ic75a8b91bc47ee16c3af873afde178cd70186376
2016-06-01fuze+: rewrite touchpad driverAmaury Pouly
The old driver was bad in many respect, it had some race conditions, it was using a thread to serialize transfers because of the legacy i2c interface. It also had huge latency (typically 50ms but delays up to 300ms can happen), thus some presses were missed. The new driver takes advantage of the new i2c driver to do everything asynchronously. It also does not need a thread anymore because queueing ensures proper serialization. It provides much better and reliable latency (typically ~2ms). Also fix the debug screen which was horribly broken. The new screen also displays the deadzones. Change-Id: I69b7f99b75053e6b1d3d56beb4453c004fd2076e
2016-05-28imx233: generate register headers using headergen_v2 and update code for itAmaury Pouly
NOTE: this commit does not introduce any change, ideally even the binary should be almost the same. I checked the disassembly by hand and there are only a few differences here and there, mostly the compiler decides to compile very close expressions slightly differently. I tried to run the new code on several targets to make sure and saw no difference. The major syntax changes of the new headers are as follows: - BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once: BF_WR(reg, field1(value1), field2(value2), ...) - BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW - there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply BF_WR with field_V(name) - the old BF_SETV macro has no trivial equivalent and is replaced with its its equivalent for BF_WR(reg_SET, ...) I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the redundant "regs". Final note: the registers were generated using the following command: ./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-04-07Fix (D)EBUG compilationMihail Zenkov
Change-Id: I5cb6d9ec3d14389b03ae43edb15b9c6199df322b
2016-04-05as3525: reverting I2C2 to non-interrupts versionMihail Zenkov
Interrupts version is cause of freeze on USB extraction. Also non-interrupts version much simpler and faster. Change-Id: I30a2993cdcaa85abfba77ca06bfacd5b6b4353e2
2016-02-12as3514: fix bug in volume management on AS3543 targets which are not AS3525v2Amaury Pouly
Some old code made the assumption that CONFIG_CPU == AS3525v2 if and only if HAVE_AS3543, which is not true on targets like the Samsung YP-R0. This fixes several issues on such targets like a huge volume gap between -39dB and -40dB and a volume artificially capped at -72dB instead of -82dB. Change-Id: Ib1c883ac593c0c3ce5e2bf4eb408924ce5f5ad93
2016-02-01AS3543: Fix increasing noise and power consumption if booted through roloMihail Zenkov
Change-Id: I99fe6d09b15689e5dd0179714bbe363aed922d10
2015-10-09Fix (D)EBUG compilation errors on targets using FATCástor Muñoz
Change-Id: I9517f9b470076a6febeafae76d735c2436812e7c
2015-10-07iPod Classic: capture support for CS42L55 codecCástor Muñoz
There are a couple of power saving options that can be selected using defines, they configure the CODEC in a different way than OF does: MONO_MIC: jack microphone is connected to left channel, disabling right channel saves ~1 mW, there is no reason to not to do it. BYPASS_PGA: this option only applies to the line-in, OF does not bypass the PGA and configures it to 0 dB gain. At the beginning, this patch was written based on CODEC datasheet, bypassing PGA because it saves power and incrementes dinamic range ~1dB, i have used this setup for a while without problems. Finally this option was disabled at the last minute, i decided to do it after reviewing the OF and realizing that CS42L55 datasheet recommends to bypass the PGA only if the HW includes a couple of capacitors (see Typical Connection Diagram, Note 4), at this moment i don't know if Classic includes these capacitors (probably not). Anyway, i am not able to tell the difference listening to voice recodings. TODO: - Use variable PGA gain for jack microphone (it is fixed to +12 dB. as OF does). - I am not a fan of having lots of unused #define options, these could be useful for a generic driver but actually this driver is Classic oriented, i am not sure if it could be considered disirable to eliminate them in the final version. Change-Id: I3dadf2341f44d5e13f3847e6c9de4a76cd6f0918
2015-09-24Samsung YHxxx: reduce pop noise on power downSebastian Leonhardt
Change-Id: Ifc82ac1051ed05527393838d8aa93bde65287b5d
2015-06-02AS3543: Fix recording volume setting and voiceMihail Zenkov
Fix regressions introduced by 42219b6e7 Change-Id: I1f3edb5f269f60e9431b45a43c4370836ecac733