Commit Graph

87 Commits

Author SHA1 Message Date
Ondrej Jirman f681795424 ENOENT means the i2c userspace device driver is missing 2022-01-17 16:08:27 +01:00
Ondrej Jirman 75b7cdaed2 Add some helpful messages 2022-01-17 16:06:01 +01:00
Ondrej Jirman 13bf8c43ca Update TODO 2022-01-16 17:00:46 +01:00
Ondrej Jirman 3ade80f425 Add support for Pinephone Pro 2022-01-16 17:00:03 +01:00
Ondrej Jirman af4009e3bf Make kmap.h build more resilient
Building with missing php resulted in empty kmap.h
2022-01-15 23:53:04 +01:00
Ondrej Jirman a1978d22ed i2c-charger-ctl doesn't need the INT gpio access, remove it 2022-01-12 13:45:13 +01:00
Ondrej Jirman a4ca2223e1 Compile with -Wall and fix issues this revealed 2022-01-12 13:37:48 +01:00
Ondrej Jirman 457e5658d9 Add missing argument to error reporting functions 2022-01-12 13:37:12 +01:00
Ondrej Jirman 7830c7986f Fix writing charger registers (result detection was broken) 2022-01-12 13:36:47 +01:00
Ondrej Jirman 31c41b7d9e Drop I2C bit functions, to make timing easier to modify
I2C to the charger now has clean 100kHz timing. One read command now takes
400us, and one write command takes 300us to execute.
2021-09-05 02:26:55 +02:00
Ondrej Jirman 78c72fe448 Make register define order less confusing 2021-09-05 02:07:12 +02:00
Ondrej Jirman a049cd5107 Make charger tool read/write data from charger via MCU I2C proxy commands 2021-09-05 02:06:57 +02:00
Ondrej Jirman 21374993b3 Allow to reset to stock firmware from user firmware by holding pine+f+h 2021-09-05 01:58:48 +02:00
Ondrej Jirman 0b280ebc14 Fix I2C bit banging code 2021-09-05 01:57:58 +02:00
Ondrej Jirman bf0c0e9c97 Make i2c flasger reset the app block flag 2021-09-05 01:53:42 +02:00
Ondrej Jirman 574d68aa89 fw: Change to bit-banging I2C implementation for charger comm
New code, compiles, but it's not tested yet!
2021-09-01 00:48:27 +02:00
Ondrej Jirman 4a1abce0eb Update inputd to make it work with the latest firmware API 2021-08-31 19:01:43 +02:00
Ondrej Jirman 62e2ebe7ec Fix keymap generator, drop prototype keymap 2021-08-31 19:00:49 +02:00
Ondrej Jirman f1e3f6dce6 Drop prototype keyboard build 2021-08-31 19:00:18 +02:00
Ondrej Jirman 3c02d41c4b Add final PCB photos/schematics 2021-08-31 15:09:21 +02:00
Ondrej Jirman fa19294d05 Dump option ROM when reading flash over USB 2021-08-31 14:29:50 +02:00
Ondrej Jirman 0e4f426dfb Add bin2pgd tool
This is used by the vendor's flashing tool. It's ROM image + option
ROM image appended (256 bytes).

Option ROM contains some flags and configuration data for the MCU.
Things like oscillator configuration, HW reset pin enable, data EEPROM
enable, etc.
2021-08-31 14:29:21 +02:00
Samuel Holland 246aaaa42e firmware: Statically allocate keys array
Allocating the array on the stack before initializing the stack pointer
does not work.
2021-08-05 21:17:09 -05:00
Samuel Holland 3c6488b99e Disable I2CA in all firmware builds
It is unlikely that any future revision of the hardware will use I2CA.
2021-08-05 21:17:09 -05:00
Samuel Holland 3107546c04 Revert "firmware: Make interrupt signal shorter (10us)"
The longer duration is actually required, likely due to debouncing
applied on the SoC side. Even 50us was unreliable.

This reverts commit 3b723583e7.
2021-08-05 21:17:09 -05:00
Ondrej Jirman ee438569e3 Update TODO 2021-08-05 03:40:40 +02:00
Ondrej Jirman f8b901e832 firmware: Add final/proto-v3 builds 2021-08-05 03:40:07 +02:00
Ondrej Jirman c5c155ca68 firmware: Allow to prevent jump to user fw after powerup by pressing Pine + F + H 2021-08-05 03:33:04 +02:00
Ondrej Jirman b244ab9c9f firmware: Set stack pointer to a correct value 2021-08-05 02:51:51 +02:00
Ondrej Jirman bd58af96d2 Update TODO 2021-08-05 02:29:45 +02:00
Ondrej Jirman c195dabe04 firmware: Whitespace 2021-08-05 02:29:36 +02:00
Ondrej Jirman 15d477f5ba firmware: Fix I2C A forwarding mode
- add charger INT check prior to transaction via P87
- re-route POGO int to P84
- wrong macro name, fix CONFIG_I2C_A=0 mode
2021-08-05 02:29:23 +02:00
Ondrej Jirman c55f0a44d5 firmware: Post-revert fixup 2021-08-05 02:27:39 +02:00
Ondrej Jirman 4e89074513 Revert "firmware: Move more of the USB shutdown control to usb_enable/usb_disable"
This reverts commit 134b4b6a8b.
2021-08-05 00:54:46 +02:00
Ondrej Jirman f0f49c0fbc Revert "firmware: Implement USB enabled/disable control via I2C"
This reverts commit 176a2da7e2.
2021-08-05 00:54:39 +02:00
Ondrej Jirman 7f1655be83 firmware: Don't trigger stop twice in i2c_a_read 2021-08-05 00:50:43 +02:00
Petr Vaněk b3412ee2a4 README.flashing: fix few typos
to user -> to use -- in second paragraph of Flashing over USB section
users stock stock -> uses stock -- in first paragraph of Flashing over I2C section
fiwmare -> firmware -- in second paragraph of Flashing over I2C section
2021-08-02 12:18:34 +02:00
Ondrej Jirman 5bef4c8832 Update TODO and I2C interface description 2021-08-02 12:13:56 +02:00
Ondrej Jirman 5fd891ecc0 firmware: Guard the timer manipulation macro argument 2021-08-02 11:53:31 +02:00
Samuel Holland 394af632aa firmware: Allow to read/write single registers from a charger
This code uses existing system command functionality. The I2C
registers are placed in front of system command register, to
allow for a single transaction proxied I2C A reads/writes.

Not tested, yet.
2021-08-02 11:52:54 +02:00
Ondrej Jirman c3272eb4ef firmware: Drop POLL mode from the register definition
Polling mode was supposed to help with broken keyboard matrix, where
some keys are stuck, but this is handled well by the pre-existing code
already, so there's no need for this.
2021-08-02 10:23:42 +02:00
Ondrej Jirman f7c90f1f74 firmware: Fix compilation issue by moving timer code a bit higher 2021-08-02 10:22:18 +02:00
Samuel Holland 78b438a747 firmware: Rebuild if any source file changes
This catches changes to the stock IVT assembly. Instead of adding that
to the list, use $(wildcard) to be more future-proof.
2021-08-02 10:17:37 +02:00
Samuel Holland 1fd0bac031 firmware: Use REG_SYS macro where appropriate
This shortens a very long line.
2021-08-02 10:17:09 +02:00
Samuel Holland ce6638eb92 firmware: Remove unused variable 2021-08-02 10:14:24 +02:00
Samuel Holland bd32b43065 usb-flasher: Update stock firmware's USB product ID
The third batch of review samples was flashed with a different stock
firmware, and advertised a different product ID.
2021-08-02 10:13:13 +02:00
Samuel Holland bd69a00f7a common: Improve crc8 generation
Start with 0xff instead of 0x00, so the CRC will be nonzero (and length
dependent) for data that is all zeroes.

Remove unnecessary masking, since `crc` is already an 8-bit integer.
2021-08-02 10:13:06 +02:00
Samuel Holland 206b96c1e2 i2c-flasher: Add missing argument to printf 2021-08-02 10:13:01 +02:00
Ondrej Jirman 28ba6fbcfc Update TODO 2021-08-02 10:12:48 +02:00
Ondrej Jirman 3b723583e7 firmware: Make interrupt signal shorter (10us)
This is long enough, comparable to 100kHz I2C speeds.
2021-08-02 10:12:48 +02:00