History

platform: arm64: add Lenovo Yoga C630 WOS EC driver

Lenovo Yoga C630 WOS is a laptop using Snapdragon 850 SoC. Like many laptops it uses an embedded controller (EC) to perform various platform operations, including, but not limited, to Type-C port control or power supply handlng. Add the driver for the EC, that creates devices for UCSI and power supply devices.

Dmitry Baryshkov committed 2 years ago

Commit 5e5f2f91 parent 59584484 files · +350 −0Browse files

Showing the changes to include/linux/platform_data (1 of 4 files). Show all

Unified · Split

include/linux/platform_data/lenovo-yoga-c630.h+44−0
@@ -0,0 +1,44 @@
1+// SPDX-License-Identifier: GPL-2.0-only
2+/*
3+ * Copyright (c) 2022-2024, Linaro Ltd
4+ * Authors:
5+ * Bjorn Andersson
6+ * Dmitry Baryshkov
7+ */
8+
9+#ifndef _LENOVO_YOGA_C630_DATA_H
10+#define _LENOVO_YOGA_C630_DATA_H
11+
12+struct yoga_c630_ec;
13+struct notifier_block;
14+
15+#define YOGA_C630_MOD_NAME "lenovo_yoga_c630"
16+
17+#define YOGA_C630_DEV_UCSI "ucsi"
18+#define YOGA_C630_DEV_PSY "psy"
19+
20+int yoga_c630_ec_read8(struct yoga_c630_ec *ec, u8 addr);
21+int yoga_c630_ec_read16(struct yoga_c630_ec *ec, u8 addr);
22+
23+int yoga_c630_ec_register_notify(struct yoga_c630_ec *ec, struct notifier_block *nb);
24+void yoga_c630_ec_unregister_notify(struct yoga_c630_ec *ec, struct notifier_block *nb);
25+
26+#define YOGA_C630_UCSI_WRITE_SIZE 8
27+#define YOGA_C630_UCSI_CCI_SIZE 4
28+#define YOGA_C630_UCSI_DATA_SIZE 16
29+#define YOGA_C630_UCSI_READ_SIZE (YOGA_C630_UCSI_CCI_SIZE + YOGA_C630_UCSI_DATA_SIZE)
30+
31+u16 yoga_c630_ec_ucsi_get_version(struct yoga_c630_ec *ec);
32+int yoga_c630_ec_ucsi_write(struct yoga_c630_ec *ec,
33+ const u8 req[YOGA_C630_UCSI_WRITE_SIZE]);
34+int yoga_c630_ec_ucsi_read(struct yoga_c630_ec *ec,
35+ u8 resp[YOGA_C630_UCSI_READ_SIZE]);
36+
37+#define LENOVO_EC_EVENT_USB 0x20
38+#define LENOVO_EC_EVENT_UCSI 0x21
39+#define LENOVO_EC_EVENT_HPD 0x22
40+#define LENOVO_EC_EVENT_BAT_STATUS 0x24
41+#define LENOVO_EC_EVENT_BAT_INFO 0x25
42+#define LENOVO_EC_EVENT_BAT_ADPT_STATUS 0x37
43+
44+#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t