Commit graph

124 commits

Author SHA1 Message Date
Solomon Peachy
418169aff8 Revert "Remove YUV blitting functions and LCD modes"
This reverts commit fe6aa21e9e.

Change-Id: I8bb1e5d6c52ed1478002d2140ef494ec5d62b8e3
2022-10-13 11:08:06 -04:00
Aidan MacDonald
fe6aa21e9e Remove YUV blitting functions and LCD modes
None of this is needed now that mpegplayer is gone.

Change-Id: I360366db8513e4d988021e8d7b7d8eb09930efb8
2022-10-03 13:30:01 +01:00
William Wilgus
79864c6ec2 add const to const * strings
I don't think this will amke any difference except maybe for hosted ports

Change-Id: I84f898aea92a6963901a6d889dd18b63f24c9a41
2022-05-03 23:00:58 -04:00
Aidan MacDonald
e532714d1f pcm: Remove unused function pcm_play_dma_get_peak_buffer()
Change-Id: Ifd20fb14a22489cdb99154c01f69809a1e70d0c5
2021-07-25 14:07:41 +00:00
Solomon Peachy
00440f2137 ipod6g:: Get rid of magic command numbers in ata driver
Use CMD_* macros instead.  Makes the code a bit easier to follow.

No functional change.

Change-Id: Ieb3d8f6fcca503421d3067aafbd0011a908368e0
2021-06-04 01:03:51 +00:00
Moshe Piekarski
b895fb6643 Add tm->yday to RTC ports missing it
Change-Id: I86882262bafb8d06f925aabb87ebd1b5dcb0cd53
2021-05-12 10:52:03 +00:00
Solomon Peachy
388adff3cc pcm: Further cleanup of unused bits of the PCM ACPI:
* pcm_get_bytes_remaining()
 * pcm_calculate_peaks()
 * pcm_get_peak_buffer()

Nothing in-tree uses these at all (except for the lua plugin wrapper)

Change-Id: I971b7beed6760250c8b1ce58f401a601e1e2d585
2020-11-12 15:59:09 +00:00
Solomon Peachy
fe2d52cc7d pcm: Get rid of pcm_play_pause() and associated APIs
Nothing in the core has used it for some time.  It's exported to the
plugin API but the last plugins to use it were switched to the mixer API
back in 2011.

This allows us to get rid of pcm_play_dma_pause() from all audio drivers

Change-Id: Ic3fa02592316f84963e41d792d1cabb436d1ff6b
2020-10-31 01:18:27 +00:00
Solomon Peachy
4a3d046545 Fix a pile of yellow in the bootloader
Change-Id: Ia89a33bbb13683566e421ac2a002baa20cdb07de
2020-10-13 13:37:21 -04: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
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
Michael Sevakis
1654efc313 Unify storage threads into one
* 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-26 14:35:41 -04:00
Cástor Muñoz
3fffff90e2 ipod6g: some fixes for recording
- Fix broken recording from jack microphone.
- Fix recording hardware detection on models that do not support
  the jack microphone.
- Enable monitor mode when recording.

Change-Id: Ib79a2746f2d75f74cf6667d33bc9ed6512bbc8a9
2017-04-16 00:37:45 +02:00
Cástor Muñoz
1ba5ef716d ipod6g: rename some target files
As preparation to add new targets to the s5l8702 directory,
rename files as:

s5l8702/ipod6g/*-ipod6g.c -> s5l8702/ipod6g/*-6g.c

Change-Id: I0cd03d6bcf39b2aa198235f9014cb6948bbafcd5
2017-03-03 22:50:38 +01:00
Cástor Muñoz
882921efb6 ipod6g: bootloader v1
- dual boot
- USB mode
- battery trap

Change-Id: I8586cfeb21ee63f45ab965430725225fdfc4212d
2017-02-09 20:47:16 +01:00
Michael Sevakis
58b849c451 Move intrinsic RTC implmentation differences to driver files
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-26 23:07:49 -05:00
Cástor Muñoz
954d934ad2 iPod Classic: fix small bug on PCM record
On PCM record initialization, an unknown clockgate is enabled instead
of the I2S clockgate. This bug does not produce incorrect functionallity
because the right clockgate is already enabled on PCM playback
initialization.

Change-Id: I97a3a4a6f12131e492c1431359a0a976b68014be
2017-01-13 05:06:15 +01:00
Cástor Muñoz
7083110f81 iPod Classic: NOR support for bootloader
- NOR driver (based on emCORE)
- read/write IM3 images
- read 'flsh' files

Change-Id: Ie0654e0d298affc0f47ed64b823767118bd1aa3f
2016-08-19 00:15:59 +02:00
Cástor Muñoz
bf89c757dd iPod Classic: hardware AES and SHA1 for bootloader
Based on emCORE.

Low level functions that do not depend on Rockbox kernel,
intended to be used by the bootloader, dualboot-installer,
RB drivers or other .dfu tools.

Change-Id: I3c616ded42260c6626bda23b7e580791981df61d
2016-08-19 00:15:44 +02:00
Cástor Muñoz
57a44854e3 iPod Classic: SPI driver for bootloader
Based on emCORE.

Low level functions that do not depend on Rockbox kernel,
intended to be used by the bootloader, dualboot-installer,
RB drivers or other .dfu tools.

Change-Id: Iad369627b55bf1778eab437424072f1a653e4db6
2016-08-19 00:15:36 +02:00
Cástor Muñoz
578525b463 iPod Classic: rework on I2C driver
- Some rewrite with the intent to get ride of these random errors
  appearing on some builds/devices (not much noticeable on RB but
  can ruin bootloader builds).
- Error handling (ACK).
- IIC clock increased to be the same as in OF.

Change-Id: Idf8cfa3c230a0a61ec9c879bf6f0ea8b061a4607
2016-08-12 14:17:46 +02:00
Cástor Muñoz
adbd2969e6 iPod Classic: ADC updates
Add code to read USB D+/D- and accessory ADCs, it is shown in HW
debug menu, might be useful in future for RB and/or the bootloader
to identify external USB chargers.

Change-Id: Ia48ca5e06bb7ddc52bb55abedde6734653ce8dba
2016-08-12 14:17:46 +02:00
Cástor Muñoz
3c5aa754de iPod Classic: use the new USB DesignWare driver
Change-Id: I36aabb5cb9cfe2d8c4f8fbcea944efec58ef9671
2016-08-02 04:57:50 +02:00
Cástor Muñoz
28920ec5cc iPod Classic: fix typos / cosmetic
Change-Id: Ic6552dea4b300032875097ef0b885a4ae059f4bc
2016-05-28 15:48:02 +02:00
Cástor Muñoz
9e284c11b1 iPod Classic: i2c updates
Change-Id: Ib516f3f52cf619fb44dc1bb6982b635c49f53a8f
2016-05-26 09:06:30 +02:00
Cástor Muñoz
daee722455 iPod Classic: use PMU interrupts to detect USB and FW
Change-Id: I9be733e1a943ddeb99335d362f81f74879eeb94b
2016-05-26 09:06:30 +02:00
Cástor Muñoz
f6ed4f8306 iPod Classic: use PMU interrupts to detect accessories
- Speed auto detection is launched when an accessory is inserted,
  so the user doesn't need to modify settings to use accessories
  that operates at different speeds (or when the same accessory is
  unplugged and plugged again).

- UART controller is disabled when no accessory is inserted, not
  much powersave but everything counts.

Change-Id: If20c3617c2a87b6277fd7e0270031030c44fa953
2016-05-26 09:05:44 +02:00
Cástor Muñoz
98bd2231ec iPod Classic: introduce PMU interrupts
PMU interrupts are used to detect USB Vbus, wall adaptor, accessories
and holdswitch. A thread is needed to poll the PMU throught I2C, ATM
it does nothing but showing the state of the inputs on the HW debug
menu, funcionallity for each individual input will be added in next
patches.

Change-Id: If93bf2044d1052729237a7fd1431c8493e09f1c7
2016-05-25 12:45:34 +02:00
Cástor Muñoz
88caf222ed iPod Classic: rework on external interrupts
Change-Id: I5be450adeb12b16070d9bfa31503e2ef350b2981
2016-05-25 12:44:55 +02:00
Cástor Muñoz
3f17745930 iPod Classic: HW initialization for RB
Do not rely on a bootloader initializing the HW, RB initializes
and configures GPIO, I2C, and PMU at startup.

Change-Id: If7f856b1f345f63de584aa4e4fc22d130cd66c80
2016-05-25 12:23:47 +02:00
Cástor Muñoz
e863f9a0ce iPod Classic: piezo support for bootloader
Low level functions that do not depend on Rockbox kernel,
intended to be used by the bootloader, dualboot-installer,
RB drivers or other .dfu tools.

Change-Id: If80214d26e505265ace19d9704f1e1300f98b2f4
2016-05-25 10:59:44 +02:00
Cástor Muñoz
9c032ba61a iPod Classic: LCD init sequences for bootloader
Change-Id: I27b7d5fea3164df8d85f7d431dc5301e8cee123d
2016-05-25 10:59:44 +02:00
Cástor Muñoz
1aefd9ea41 iPod Classic: HW preliminary initialization for bootloader
When the bootloader starts, most of HW never has been initialized.
This patch includes all code needed to perform the preliminary
initialization on SYSCON, GPIO, i2c, and MIU.

The code is based on emCORE and OF reverse engineering, ported to
C for readability.

Change-Id: I9ecf2c3e8b1b636241a211dbba8735137accd05c
2016-05-25 10:59:31 +02:00
Cástor Muñoz
b8a237dca2 iPod Classic: wait for ATA power down on device shutdown
Change-Id: I5d3d19d6d0c937e11e28b99f34d729631051ab93
2016-05-15 23:43:00 +02:00
Cástor Muñoz
52a6db3a36 iPod Classic: optimize UDMA timming for ATA drives
This patch optimizes UDMA timings to increase write transfer rate on
ATA bus, these transfers are clocked by HCLK, tDVS+tDVH is modified to
decrease Tcyctyp (typical write cycle period). This is not overclocking,
we meet the ATA standar, the settings used by OF are not well optimized
for each UDMA mode, we will never know but probably this was due some
documentation issue.

ATA_UDMA_TIME register is documented on s3c6400 datasheet, information
included in s5l8700 datasheet is wrong or not valid for s5l8702.

From ATA specs, (Minimum, Maximum) values in nanoseconds:

             UDMA 0      UDMA 1      UDMA 2      UDMA 3      UDMA 4
 tACKENV     (20, 70)    (20, 70)    (20, 70)    (20, 55)    (20, 55)
 tRP         (160, --)   (125, --)   (100, --)   (100, --)   (100, --)
 tSS         (50, --)    (50, --)    (50, --)    (50, --)    (50, --)
 tDVS        (70, --)    (48, --)    (31, --)    (20, --)    (6.7, --)
 tDVH        (6.2, --)   (6.2, --)   (6.2, --)   (6.2, --)   (6.2, --)
 tDVS+tDVH   (120, --)   (80, --)    (60, --)    (45, --)    (30, --)

 Tcyc = tDVS+tDVH
 WR[bytes/s] = 1/Tcyc[s] * 2[bytes]

On Classic (boosted):
 HClk = 108 MHz. -> T = ~9.26 ns.

Old values (used by OF):
 UDMA  ATA_UDMA_TIME  tACK  tRP    tSS   tDVS  tDVH  Tcyc   WR(MB/s)
 0     0x5071152      27.8  166.7  55.6  74.1  55.6  129.7  15.4
 1     0x3050a52      27.8  101.8  55.6  55.6  37     92.6  21.6
 2     0x3030a52      27.8  101.8  55.6  37    37     74    27
 3     0x2020a52      27.8  101.8  55.6  27.8  27.8   55.6  36
 4     0x2010a52      27.8  101.8  55.6  18.5  27.8   46.3  43.2

New values:
 UDMA  ATA_UDMA_TIME  tACK  tRP    tSS   tDVS  tDVH  Tcyc   WR(MB/s)
 0     0x4071152      27.8  166.7  55.6  74.1  46.3  120.4  16.6
 1     0x2050d52      27.8  129.6  55.6  55.6  27.8   83.4  24
 2     0x2030a52      27.8  101.8  55.6  37    27.8   64.8  30.9
 3     0x1020a52      27.8  101.8  55.6  27.8  18.5   46.3  43.2
 4     0x1010a52      27.8  101.8  55.6  18.5  18.5   37    54

To verify that the settings are correct, a write-to-cache test was
performed using emCORE, the measured transfer rate (WRm) is compared
against the theoric transfer rate (WR) at 108 Mhz for the old and
the new UDMA4 settings (iPod 160, HDD Toshiba MK1634GAL):

 UDMA  ATA_UDMA_TIME  Tcyc(ns)  WR(MB/s)  WRm(MB/s)  RDm(MB/s)
 4     0x2010a52      46.3      43.2      42.9       59.8
 4     0x1010a52      37        54        53.5       59.8

Notes:
 - The new UDMA4 settings increases ~25% the ATA transfer rate for
   cached-writes. The real HDD write speed is limited by the internal
   transfer rate (depends on cilinder, for the MK1634GAL it is 276 to
   573 Mbits/s). Sequential write benchmark using diskdump on USB are
   ~8% faster.
 - Read transfers are clocked by the device, it depends on UDMA mode
   selected and are not affected by HClk or ATA_UDMA_TIME settings.
   Read-from-cache tests results (RDm) using HClk=108 and HClk=54 for
   UDMA4 are 59.8 MB/s on MK1634GAL.
 - Minimum HClk is limited by tACKENV specs, using current settings
   it is 54 MHz for UDMA4,UDMA3 and 43 MHz for UDMA2,UDMA1,UDMA0.

Change-Id: I61d67060410752518a59e1ff08072b21747ca997
2016-05-15 22:57:12 +02:00
Cástor Muñoz
201f57171a iPod Classic: remove ATA_HAVE_BBT
Change-Id: I45e26a413c13e401164a01996b0b4c6788096a7f
2016-05-15 21:47:22 +02:00
Cástor Muñoz
dbcde01835 iPod Classic: remove emCORE HDD endianess warning
Change-Id: I91aa2dca7e748fe043c16014661985c42ab84b1a
2016-05-15 21:38:37 +02:00
Cástor Muñoz
469d645390 iPod Classic: prepare i2c and PMU for bootloader
When the bootloader starts only IRAM is available, the first task is to
ask the PMU to verify if the iPod has previously been hibernated by OF.
Due to memory limitations, the kernel cannot be used on this stage.

This patch modifies I2C and PMU low level functions to not to depend
on kernel (removes mutexes, and uses HW timer instead of current_tick),
actual kernel functions are modified to be 'mutexed' wrappers of the new
functions.

Change-Id: I7cef9e95dedaf176dc0659315f3dc33166d5b116
2016-05-15 21:16:54 +02:00
Cástor Muñoz
44ce4eebd6 iPOd Classic: skip emCORE HDD endianness warning for bootloader
Change-Id: I274511cc1061c396a0642e8496d46a3b9c1228d3
2016-05-15 21:16:54 +02:00
Cástor Muñoz
8fb67f48ab iPod Classic: updates for uc8702 driver
- Small rework on the UC8702 UART controller to make it compatible with
  other s5l870x SOCs. Files moved and renamed, many conditional code
  added to deal with capabilities and 'features' of the different CPUs.

- A couple of optimizacions that should not affect the functionality.

Change-Id: I705169f7e8b18d5d1da642f81ffc31c4089780a6
2016-05-13 23:21:42 +02:00
Michael Sparmann
bc56811a0e iPod Nano 2G and Classic: Fix power and charging detection.
This should allow FireWire charging to work on these devices.
It also adds charging state detection on the iPod Classic.

(cherry picked from commit fa86fec4fb)

On Classic (and probably Nano 2G), it seems that the 100/500mA limit
applies only to USB chargers, when FW is connected it supplies all the
power (even if USB is also connected) and USB current limit does not
affect to FW charging, therefore the limit is only set when USB is
connected.

Change-Id: I7c6bab1b6a0f295367999c45faeda6085c3fb091
Signed-off-by: Cástor Muñoz <cmvidal@gmail.com>
2016-02-14 15:42:54 +01:00
Cástor Muñoz
929be521d4 iPod Classic: fix buffer alignment on HDD driver
Read/write buffers who are aligned to 16 were not re-aligned to 32 as
it should be. Althrough USB storage and buffering are always passing
buffers aligned to 32, a few unaligned buffers are being received from
other tasks, so this patch could solve some rare random issues.

Also fixes DMA configuration for HDDs that support any MDMA mode but
only UDMA0 (probably will never happen).

Change-Id: I00219ae434205681c69293fc563e0526224c9adf
2016-02-14 15:19:31 +01:00
Cástor Muñoz
3216f390c5 iPod Classic: fix build when ATA_HAVE_BBT is not defined
Change-Id: I186c24259cc28941ef21c54ae9ba23c1ba77133e
2016-02-14 15:19:03 +01:00
Cástor Muñoz
e9497dbf6d iPod Classic: ATA SMART updates
- Add description for attributes supported by Samsung HS081HA (80Gb)
  and HS161JQ (CEATA 160Gb).
- Show error code when ata_read_smart() fails.

Change-Id: I618cc4f37d139fc90f596e2cf3a751346b27deb6
2016-02-14 15:17:42 +01:00
Cástor Muñoz
e2f943f229 iPod Classic: revert "set initial USB current limit to 500mA"
Reverts commit ead38dbc9d

It was introduced as a temporal workaround to avoid the endless restart
loop when battery is low, but really it is useless. The bootloader should
ensure that there is enough power to launch Rockbox even in the worst
scenario.

Change-Id: Iabebed40c9241af915c16c3c6c4d3c6deef7680e
2016-01-29 19:39:03 +01:00
Cástor Muñoz
4605df1e3c iPod Classic: remove uninteresting info in HW debug screen
CPU type and frequency of the PLLs are fixed and have no interest
at this moment.

Change-Id: I9524127add872908c062a5cfa2fca348a03e846e
2016-01-29 19:28:22 +01:00
Cástor Muñoz
a953964167 iPod Classic: fix wake-up from power-off on USB insert
Change-Id: I57897aa1bb98b652bc6c953680bf548648f5915b
2016-01-12 14:24:54 +01:00
Cástor Muñoz
9e24d5df1a iPod Classic: update documentation on PMU target
Change-Id: I936889872f83521731e81a972657086a357bb5eb
2016-01-12 14:24:44 +01:00
Cástor Muñoz
00bda90a21 iPod Classic: add non-cached memory region
Configures uncached memory region and adds some defines for misc HW,
for compability with the bootloader and other future use, current
functionality should not be affected.

Change-Id: I390e79bea1aef5b10dfbc72ad327d7fe438ec6f5
2015-12-17 10:52:49 +01:00
Cástor Muñoz
ead38dbc9d iPod Classic: set initial USB current limit to 500mA
Change-Id: Ie56951457e45da04d8e93b53f5cc8f80f9a69de3
2015-12-17 10:09:07 +01:00