1 /* SPDX-License-Identifier: GPL-2.0-only */
7 uint32_t board_id(void)
9 static uint32_t id
= UNDEFINED_STRAPPING_ID
;
11 const gpio_t pins
[] = {[2] = GPIO(31), [1] = GPIO(93), [0] = GPIO(33)};
13 if (id
== UNDEFINED_STRAPPING_ID
)
14 id
= gpio_binary_first_base3_value(pins
, ARRAY_SIZE(pins
));
19 /* Some boards/revisions use one GPIO mapping and others use another. There's no real rhyme or
20 reason to it. Don't try to think about it too much... */
21 static bool use_old_pins(void)
23 return ((CONFIG(BOARD_GOOGLE_TROGDOR
) && board_id() < 2) ||
24 CONFIG(BOARD_GOOGLE_LAZOR
) ||
25 (CONFIG(BOARD_GOOGLE_POMPOM
) && board_id() < 1));
28 uint32_t ram_code(void)
30 static uint32_t id
= UNDEFINED_STRAPPING_ID
;
32 const gpio_t old_pins
[] = {[2] = GPIO(13), [1] = GPIO(19), [0] = GPIO(29)};
33 const gpio_t pins
[] = {[2] = GPIO(5), [1] = GPIO(3), [0] = GPIO(1)};
35 if (id
== UNDEFINED_STRAPPING_ID
) {
37 id
= gpio_base2_value(old_pins
, ARRAY_SIZE(old_pins
));
39 id
= gpio_base2_value(pins
, ARRAY_SIZE(pins
));
45 static uint8_t panel_id(void)
47 const gpio_t pins
[] = {[1] = GPIO(11), [0] = GPIO(4)};
49 return gpio_binary_first_base3_value(pins
, ARRAY_SIZE(pins
));
54 static uint32_t id
= UNDEFINED_STRAPPING_ID
;
56 const gpio_t old_pins
[] = {[2] = GPIO(20), [1] = GPIO(90), [0] = GPIO(105)};
57 const gpio_t pins
[] = {[2] = GPIO(2), [1] = GPIO(90), [0] = GPIO(58)};
59 if (id
== UNDEFINED_STRAPPING_ID
) {
61 id
= gpio_binary_first_base3_value(old_pins
, ARRAY_SIZE(old_pins
));
63 id
= gpio_binary_first_base3_value(pins
, ARRAY_SIZE(pins
));
65 if (CONFIG(TROGDOR_HAS_MIPI_PANEL
))
66 id
= panel_id() << 8 | id
;