Skip to content

Commit 5dbd0b5

Browse files
committed
Merge remote-tracking branch 'upstream/hx20-hx30' into dh/feature/rorw
2 parents 4bdabec + 38c1b38 commit 5dbd0b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+11126
-56
lines changed

.github/labeler.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ hx20:
66
- board/hx20/*
77
- board/hx20/**/*
88

9+
hx30:
10+
- board/hx30/*
11+
- board/hx30/**/*
12+
913
board-mistake:
10-
- any: ['board/**/*', '!board/hx20/*']
14+
- any: ['board/**/*', '!board/hx20/*', '!board/hx30/*']
1115

1216
mchp:
1317
- chip/mchp/**/*

.github/workflows/hx30.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: build hx30 firmware
2+
3+
on:
4+
push:
5+
branches:
6+
- hx3*
7+
- hx20-hx30*
8+
pull_request:
9+
branches:
10+
- hx20-hx30
11+
workflow_dispatch:
12+
13+
jobs:
14+
build:
15+
name: Build hx30
16+
runs-on: ubuntu-20.04
17+
18+
steps:
19+
- name: install toolchain
20+
run: sudo apt install gcc-arm-none-eabi libftdi1-dev
21+
# Checks out a copy of your repository on the ubuntu-latest machine
22+
- name: Checkout code
23+
uses: actions/checkout@v2
24+
- name: build hx30 board
25+
env:
26+
BOARD: hx30
27+
run: |
28+
make -j BOARD=$BOARD CROSS_COMPILE=arm-none-eabi-
29+
echo Built $BOARD ec
30+
- name: file sha256
31+
run: sha256sum build/hx30/ec.bin
32+
- name: generate artifact version
33+
run: |
34+
echo "VERSIONINFO=$(date -u +'%Y-%m-%d-%H-%M-%S')_$GITHUB_SHA" >> $GITHUB_ENV
35+
36+
- uses: actions/upload-artifact@v2
37+
with:
38+
name: hx30.${{ env.VERSIONINFO }}.bin
39+
path: build/hx30/ec.bin

.github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: lint code in pull request
22

33
on:
44
pull_request:
5-
types: [opened, edited, reopened]
65

76
jobs:
87
build:
@@ -22,6 +21,7 @@ jobs:
2221
- name: checkpatch
2322
run: |
2423
git diff origin/${{ github.base_ref }} | ./checkpatch.pl --mailback --no-tree --ignore MAINTAINERS,FILE_PATH_CHANGES,SPDX_LICENSE_TAG - > checkpatch.txt || true
24+
exit=0
2525
if [ -s checkpatch.txt ]; then
2626
errors=$(cat checkpatch.txt)
2727
errors="${errors//'%'/'%25'}"
@@ -30,7 +30,7 @@ jobs:
3030
echo "::error file=Checkpatch.txt::$errors"
3131
exit=1
3232
fi
33-
if [ ${exit} == 1 ]; then
33+
if [ $exit = 1 ]; then
3434
exit 1;
3535
fi
3636
- name: output

README.md

+18-6
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,30 @@ The Framework Laptop EC code can be built easily outside the Chromium developmen
1616

1717
On Ubuntu you can install the development tools easily.
1818

19-
```
20-
sudo apt install gcc-arm-none-eabi libftdi1-dev
19+
```sh
20+
sudo apt install gcc-arm-none-eabi libftdi1-dev build-essential pkg-config
2121
```
2222

23-
## Framework Laptop EC for Intel 11th Gen Core Processors
23+
## Framework Laptop EC
2424

25-
Building the project
26-
```
25+
The different Framework Laptops are each implemented as their own board:
26+
27+
| Laptop Generation | Board Name |
28+
| --- | --- |
29+
| Intel 11th Gen Core Processors | `hx20` |
30+
| Intel 12th Gen Core Processors | `hx30` |
31+
32+
Building the project - run the command for the processor you have:
33+
34+
```sh
35+
# hx20 (11th Gen)
2736
make BOARD=hx20 CROSS_COMPILE=arm-none-eabi-
37+
38+
# hx30 (12th Gen)
39+
make BOARD=hx30 CROSS_COMPILE=arm-none-eabi-
2840
```
2941

30-
The output artifact is ```build/hx20/ec.bin``` which can be flashed to the EC SPI flash ROM.
42+
The output artifact is `build/hx20/ec.bin` which can be flashed to the EC SPI flash ROM.
3143

3244
### EC Flash configuration
3345

baseboard/fwk/baseboard.c

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* Copyright 2022 The Chromium OS Authors. All rights reserved.
2+
* Use of this source code is governed by a BSD-style license that can be
3+
* found in the LICENSE file.
4+
*/
5+
6+
/* Framework Laptop family-specific configuration */
7+
8+
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
9+
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
10+

baseboard/fwk/baseboard.h

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* Copyright 2022 The Chromium OS Authors. All rights reserved.
2+
* Use of this source code is governed by a BSD-style license that can be
3+
* found in the LICENSE file.
4+
*/
5+
6+
/* Framework Laptop family-specific configuration */
7+
8+
#ifndef __CROS_EC_BASEBOARD_H
9+
#define __CROS_EC_BASEBOARD_H
10+
11+
12+
#endif /* __CROS_EC_BASEBOARD_H */
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright 2022 The Chromium OS Authors. All rights reserved.
3+
* Use of this source code is governed by a BSD-style license that can be
4+
* found in the LICENSE file.
5+
*/
6+
7+
#include "console.h"
8+
#include "chipset.h"
9+
#include "gpio.h"
10+
#include "ec_commands.h"
11+
#include "host_command.h"
12+
#include "host_command_customization.h"
13+
#include "baseboard_host_commands.h"
14+
#include "hooks.h"
15+
#include "keyboard_customization.h"
16+
#include "lid_switch.h"
17+
#include "lpc.h"
18+
#include "power_button.h"
19+
#include "switch.h"
20+
#include "system.h"
21+
#include "task.h"
22+
#include "timer.h"
23+
#include "util.h"
24+
#include "cypress5525.h"
25+
#include "board.h"
26+
#include "ps2mouse.h"
27+
#include "keyboard_8042_sharedlib.h"
28+
#include "diagnostics.h"
29+
#include "driver/als_cm32183.h"
30+
#include "cpu_power.h"
31+
#include "flash_storage.h"
32+
#define CPRINTS(format, args...) cprints(CC_SWITCH, format, ## args)
33+
34+
35+
/*****************************************************************************/
36+
/* Hooks */
37+
38+
static enum ec_status privacy_switches_check(struct host_cmd_handler_args *args)
39+
{
40+
struct ec_response_privacy_switches_check *r = args->response;
41+
42+
/*
43+
* Camera is low when off, microphone is high when off
44+
* Return 0 when off/close and 1 when high/open
45+
*/
46+
r->microphone = !gpio_get_level(GPIO_MIC_SW);
47+
r->camera = gpio_get_level(GPIO_CAM_SW);
48+
49+
CPRINTS("Microphone switch open: %d", r->microphone);
50+
CPRINTS("Camera switch open: %d", r->camera);
51+
52+
args->response_size = sizeof(*r);
53+
54+
return EC_RES_SUCCESS;
55+
56+
}
57+
DECLARE_HOST_COMMAND(EC_CMD_PRIVACY_SWITCHES_CHECK_MODE, privacy_switches_check, EC_VER_MASK(0));
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* Copyright 2022 The Chromium OS Authors. All rights reserved.
2+
* Use of this source code is governed by a BSD-style license that can be
3+
* found in the LICENSE file.
4+
*/
5+
6+
/* host command customization configuration */
7+
8+
#ifndef __BASEBOARD_HOST_COMMANDS_H
9+
#define __BASEBOARD_HOST_COMMANDS_H
10+
11+
#define EC_CMD_PRIVACY_SWITCHES_CHECK_MODE 0x3E14
12+
13+
struct ec_response_privacy_switches_check {
14+
uint8_t microphone;
15+
uint8_t camera;
16+
} __ec_align1;
17+
18+
#endif /* __BASEBOARD_HOST_COMMANDS_H */

board/hx20/battery.c renamed to baseboard/fwk/battery.c

+10
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ static int battery_check_disconnect(void)
9999
return BATTERY_NOT_DISCONNECTED;
100100
}
101101

102+
enum battery_present board_batt_is_present(void)
103+
{
104+
/*
105+
* Due to adc_read_channel() will clear the task event,
106+
* we should get the battery status without read adc channel again.
107+
*/
108+
return batt_pres_prev;
109+
}
110+
102111
enum battery_present battery_is_present(void)
103112
{
104113
enum battery_present batt_pres;
@@ -285,6 +294,7 @@ __override void board_battery_compensate_params(struct batt_params *batt)
285294
* If battery keeps failing for 3 seconds, stop hiding the error and
286295
* report back to host.
287296
*/
297+
288298
if (batt->flags & BATT_FLAG_RESPONSIVE) {
289299
if (batt->flags & BATT_FLAG_BAD_ANY) {
290300
if (timestamp_expired(deadline, NULL))

baseboard/fwk/build.mk

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# -*- makefile -*-
2+
# Copyright 2022 The Chromium OS Authors. All rights reserved.
3+
# Use of this source code is governed by a BSD-style license that can be
4+
# found in the LICENSE file.
5+
#
6+
# Baseboard specific files build
7+
#
8+
9+
baseboard-y=baseboard.o diagnostics.o flash_storage.o
10+
baseboard-$(CONFIG_BATTERY_SMART)+=battery.o
11+
baseboard-$(CONFIG_FANS)+=fan.o
12+
baseboard-$(CONFIG_SYSTEMSERIAL_DEBUG) += system_serial.o
13+
baseboard-$(CONFIG_8042_AUX) += ps2mouse.o
14+
baseboard-$(HAS_TASK_HOSTCMD) += baseboard_host_commands.o
File renamed without changes.
File renamed without changes.
File renamed without changes.

board/hx20/flash_storage.c renamed to baseboard/fwk/flash_storage.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,4 @@ static int cmd_flash_flags(int argc, char **argv)
171171
}
172172
DECLARE_CONSOLE_COMMAND(flashflag, cmd_flash_flags,
173173
"[read/write] i [d]",
174-
"read or write bytes from flags structure");
174+
"read or write bytes from flags structure");

board/hx20/flash_storage.h renamed to baseboard/fwk/flash_storage.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ int flash_storage_get(enum ec_flash_flags_idx idx);
6565
*/
6666
void flash_storage_load_defaults(void);
6767

68-
#endif /* __CROS_EC_FLASHSTORAGE_H */
68+
#endif /* __CROS_EC_FLASHSTORAGE_H */

0 commit comments

Comments
 (0)