Commit Graph

110 Commits

Author SHA1 Message Date
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
Ondrej Jirman 2fbc2e057e firmware: Implement scanning block
This allows to disable the keyboard. The firmware will never scan
for keys pressed in this mode, and it will powerdown the MCU most of the
time.
2021-08-02 10:12:48 +02:00
Ondrej Jirman 41418cdc14 firmware: Jump to stock firmware sooner after powerup
Signed-off-by: Ondrej Jirman <megous@megous.com>
2021-08-02 10:12:48 +02:00
Ondrej Jirman 176a2da7e2 firmware: Implement USB enabled/disable control via I2C 2021-08-02 10:05:43 +02:00
Ondrej Jirman 134b4b6a8b firmware: Move more of the USB shutdown control to usb_enable/usb_disable
- make sure USB resources are re-enabled before jumping to bootloader
- make sure all USB resources are disabled prior to jumping to user fw
2021-08-02 10:03:48 +02:00
Ondrej Jirman cea046008f Increase the default flashing area size to 0x2000
This does two things:
- more reasonable default because stock firmware size is larger than
  the previous default
- it will overwrite 0x3fff with 0xff, so that after flashing stock
  firmware the user firmware is automatically disabled
2021-06-28 15:36:58 +02:00
Ondrej Jirman 6a5fe581b9 Implement flashing over I2C and user/stock firmware support
I2C register layout changed a bit to make various operations easier
to implement in FW and for the user.

Flashing/debugging tools now share more code. Firmware is now more
configurable (it's now possible to compile-out various features).

Self-testing for column-shorts is implemented.

Firmware is optimized for low power consumption.
2021-06-28 15:09:47 +02:00
Ondrej Jirman 201b84d70e Update link to kernel driver 2021-06-20 13:16:55 +02:00
Ondrej Jirman 2a2ce1429c Update the i2c interface spec 2021-06-20 01:48:34 +02:00
Ondrej Jirman f0b5f8cb68 And another update of the I2C spec 2021-06-19 21:42:52 +02:00
Ondrej Jirman 2185fdaae5 Update I2C spec 2021-06-19 21:23:03 +02:00
Ondrej Jirman 541c1ae17a Add I2C interface specification 2021-06-19 21:15:38 +02:00
Ondrej Jirman 04ca071b09 Fixup/document I2C 2021-06-19 02:51:23 +02:00
Ondrej Jirman fbfa245ad4 Allow to use debug printing from interrupt handlers 2021-06-19 02:50:34 +02:00
Ondrej Jirman 2725248532 Add USB stack for easier printf() based debugging of the firmware 2021-06-18 19:43:11 +02:00
Ondrej Jirman f7857f94ab Add the latest binary build of the firmware 2021-06-18 18:31:28 +02:00
Ondrej Jirman c8d8eef090 Fix key release change detection in polling mode 2021-06-18 18:28:56 +02:00
Ondrej Jirman 93687e1b04 Add flashing help file 2021-06-18 18:26:58 +02:00
Ondrej Jirman cea3dfb502 Add link to Samuel's kernel driver 2021-06-18 18:20:19 +02:00
Ondrej Jirman 212dea4914 Tidy up the flashing tool 2021-06-18 18:20:16 +02:00
Ondrej Jirman c1d2adfc96 Update TODO 2021-06-17 11:40:08 +02:00
Ondrej Jirman a739b4b856 Add reaped URB error checking 2021-06-17 11:16:58 +02:00
Ondrej Jirman c8736296c3 Update TODO 2021-06-16 18:19:34 +02:00
Ondrej Jirman a6f823612a Build kmap.h as part of a build process 2021-06-16 17:19:38 +02:00
Ondrej Jirman dba6fb37c1 Add sticky fn/pine mode (press fn+esc or pine+esc to enter, esc to exit it)
In sticky mode, fn or pine key acts as stuck.
2021-06-16 17:02:02 +02:00
Ondrej Jirman ff7e733636 Disable workaround for my broken prototype by default 2021-06-16 16:49:51 +02:00
Ondrej Jirman a2ff7e6e98 Add uinput daemon that creates an input device for the keyboard 2021-06-16 16:47:59 +02:00
Ondrej Jirman b9b02a5e73 Update some comments 2021-06-16 14:44:18 +02:00