xiaomi-pipa: fix charging status reporting and add stylus charging
Fix PMIC fuel-gauge reporting and wire up stylus charging support. Load the pen-charge notifier early so the touchscreen probes in initramfs. Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/9065>
This commit is contained in:
parent
9daf83d944
commit
ee31f53803
6 changed files with 3189 additions and 10 deletions
|
|
@ -2,7 +2,7 @@
|
|||
maintainer="bluebunny <bluebunny@postmarketos.org>"
|
||||
pkgname=device-xiaomi-pipa
|
||||
pkgdesc="Xiaomi Pad 6"
|
||||
pkgver=9
|
||||
pkgver=10
|
||||
pkgrel=0
|
||||
url="https://postmarketos.org"
|
||||
license="MIT"
|
||||
|
|
@ -77,6 +77,6 @@ sha512sums="
|
|||
d0e8f2e378130130ac72703aed957f7638e2dd75acf4aa421e1b4592c6cb6d296b652db0d9c242be4e56326760ce18d28c1e36ae553d0b7a7f91e12ab0353f22 81-libssc-xiaomi-pipa.rules
|
||||
13c0c6639af2ac7103b2a30612f8a8b4bf1cfd875da527a2bccb786a846d948b3f30f79b01485402bdc9fa2db6c2ab2a449669199fb1e4b425c6604a7fe0eed5 HiFi.conf
|
||||
9ce5336d2815de6dfe8477daa326abf8c79640d3fe519ef1978b18b49e489d70371215d3c0bbfb55068afde4b01b166b0a2a1a8d57b81355e465f542a43e361f deviceinfo
|
||||
a92842d4f9d92af8ca14f4e86c74ea7dec446abd8a2a2b7dccbf6771065d8a7eea7f4a41adbd68647b49f81787a43fdb5b5337df0032ff3fbcb8e88b17f5ebf1 modules-initfs
|
||||
a3f84d9636e907e3434ac952a554b771a083de8b62f2ea525234632b157ec2b5155a73856c01769bafa8fe9468216aea712769ca4d21ce388ba65491e96d2bee modules-initfs
|
||||
007908c49db107dd8289a96049ed4d77a55c7846e21f76fa7f97306df953ccdec7d821cbc7732a3ff7c532285175ebf0d6a4e3f224740ac002b23f3608cbf76d pipa.conf
|
||||
"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
ktz8866
|
||||
nt36523_ts
|
||||
nu1665
|
||||
panel_novatek_nt36532
|
||||
qcom_common
|
||||
qcom_pil_info
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ power: supply: qcom_pm8150b_charger: adds charging control to pm8150b_charger
|
|||
drivers/power/supply/Kconfig | 17 +
|
||||
drivers/power/supply/Makefile | 2 +
|
||||
drivers/power/supply/power_supply_sysfs.c | 1 +
|
||||
drivers/power/supply/qcom_fg.c | 1365 +++++++++++++++++++
|
||||
drivers/power/supply/qcom_fg.c | 1371 +++++++++++++++++++
|
||||
drivers/power/supply/qcom_pm8150b_charger.c | 964 +++++++++++++
|
||||
include/linux/power_supply.h | 1 +
|
||||
7 files changed, 2390 insertions(+)
|
||||
|
|
@ -192,7 +192,7 @@ new file mode 100644
|
|||
index 000000000000..921ef52fcc60
|
||||
--- /dev/null
|
||||
+++ b/drivers/power/supply/qcom_fg.c
|
||||
@@ -0,0 +1,1365 @@
|
||||
@@ -0,0 +1,1371 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-only
|
||||
+/* Copyright (c) 2020, The Linux Foundation. All rights reserved. */
|
||||
+
|
||||
|
|
@ -913,6 +913,12 @@ index 000000000000..921ef52fcc60
|
|||
+ temp = (s16)(readval[1] << 8 | readval[0]);
|
||||
+ *val = div_s64((s64)temp * 488281, 1000);
|
||||
+
|
||||
+ /*
|
||||
+ * The power supply API expects charging batteries to report a
|
||||
+ * positive current, which is inverted from what the PMIC reports.
|
||||
+ */
|
||||
+ *val = -*val;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
|
|
@ -1100,9 +1106,9 @@ index 000000000000..921ef52fcc60
|
|||
+ val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
|
||||
+ break;
|
||||
+ }
|
||||
+ if (temp < 0)
|
||||
+ if (temp > 0)
|
||||
+ val->intval = POWER_SUPPLY_STATUS_CHARGING;
|
||||
+ else if (temp > 0)
|
||||
+ else if (temp < 0)
|
||||
+ val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
|
||||
+ else
|
||||
+ val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ new file mode 100644
|
|||
index 000000000000..83eddb597544
|
||||
--- /dev/null
|
||||
+++ b/drivers/input/touchscreen/nt36523/nt36xxx.c
|
||||
@@ -0,0 +1,1934 @@
|
||||
@@ -0,0 +1,1977 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2010 - 2018 Novatek, Inc.
|
||||
+ * Copyright (C) 2021 XiaoMi, Inc.
|
||||
|
|
@ -106,10 +106,14 @@ index 000000000000..83eddb597544
|
|||
+#include <linux/proc_fs.h>
|
||||
+#include <linux/input/mt.h>
|
||||
+#include <linux/debugfs.h>
|
||||
+#include <linux/notifier.h>
|
||||
+#include <linux/of_irq.h>
|
||||
+
|
||||
+#include "nt36xxx.h"
|
||||
+
|
||||
+extern int pen_charge_state_notifier_register_client(struct notifier_block *nb);
|
||||
+extern int pen_charge_state_notifier_unregister_client(struct notifier_block *nb);
|
||||
+
|
||||
+#if NVT_TOUCH_ESD_PROTECT
|
||||
+#include <linux/jiffies.h>
|
||||
+#endif /* #if NVT_TOUCH_ESD_PROTECT */
|
||||
|
|
@ -1216,6 +1220,30 @@ index 000000000000..83eddb597544
|
|||
+ }
|
||||
+}
|
||||
+
|
||||
+static void nvt_pen_charge_state_change_work(struct work_struct *work)
|
||||
+{
|
||||
+ struct nvt_ts_data *ts = container_of(work, struct nvt_ts_data,
|
||||
+ pen_charge_state_change_work);
|
||||
+
|
||||
+ mutex_lock(&ts->lock);
|
||||
+ disable_pen_input_device(false);
|
||||
+ mutex_unlock(&ts->lock);
|
||||
+}
|
||||
+
|
||||
+static int nvt_pen_charge_state_notifier_call(struct notifier_block *nb,
|
||||
+ unsigned long val, void *v)
|
||||
+{
|
||||
+ struct nvt_ts_data *ts = container_of(nb, struct nvt_ts_data,
|
||||
+ pen_charge_state_notifier);
|
||||
+
|
||||
+ ts->pen_is_charge = !!val;
|
||||
+ NVT_LOG("pen charge state changed: %s\n",
|
||||
+ ts->pen_is_charge ? "charging" : "not charging");
|
||||
+ schedule_work(&ts->pen_charge_state_change_work);
|
||||
+
|
||||
+ return NOTIFY_OK;
|
||||
+}
|
||||
+
|
||||
+int32_t disable_pen_input_device(bool disable) {
|
||||
+ uint8_t buf[8] = {0};
|
||||
+ int32_t ret = 0;
|
||||
|
|
@ -1577,6 +1605,13 @@ index 000000000000..83eddb597544
|
|||
+ }
|
||||
+ INIT_WORK(&ts->resume_work, nvt_resume_work);
|
||||
+ INIT_WORK(&ts->suspend_work, nvt_suspend_work);
|
||||
+ INIT_WORK(&ts->pen_charge_state_change_work, nvt_pen_charge_state_change_work);
|
||||
+ ts->pen_charge_state_notifier.notifier_call = nvt_pen_charge_state_notifier_call;
|
||||
+ ret = pen_charge_state_notifier_register_client(&ts->pen_charge_state_notifier);
|
||||
+ if (ret) {
|
||||
+ NVT_ERR("register pen charge notifier failed. ret=%d\n", ret);
|
||||
+ goto err_register_pen_charge_notifier_failed;
|
||||
+ }
|
||||
+
|
||||
+ bTouchIsAwake = 1;
|
||||
+ NVT_LOG("end\n");
|
||||
|
|
@ -1585,6 +1620,11 @@ index 000000000000..83eddb597544
|
|||
+
|
||||
+ return 0;
|
||||
+
|
||||
+err_register_pen_charge_notifier_failed:
|
||||
+ if (ts->event_wq) {
|
||||
+ destroy_workqueue(ts->event_wq);
|
||||
+ ts->event_wq = NULL;
|
||||
+ }
|
||||
+err_alloc_work_thread_failed:
|
||||
+
|
||||
+#if NVT_TOUCH_ESD_PROTECT
|
||||
|
|
@ -1663,6 +1703,9 @@ index 000000000000..83eddb597544
|
|||
+{
|
||||
+ NVT_LOG("Removing driver...\n");
|
||||
+
|
||||
+ pen_charge_state_notifier_unregister_client(&ts->pen_charge_state_notifier);
|
||||
+ cancel_work_sync(&ts->pen_charge_state_change_work);
|
||||
+
|
||||
+#if NVT_TOUCH_ESD_PROTECT
|
||||
+ if (nvt_esd_check_wq) {
|
||||
+ cancel_delayed_work_sync(&nvt_esd_check_work);
|
||||
|
|
@ -2018,7 +2061,7 @@ new file mode 100644
|
|||
index 000000000000..beb5fc07dd6c
|
||||
--- /dev/null
|
||||
+++ b/drivers/input/touchscreen/nt36523/nt36xxx.h
|
||||
@@ -0,0 +1,266 @@
|
||||
@@ -0,0 +1,267 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2010 - 2018 Novatek, Inc.
|
||||
+ * Copyright (C) 2021 XiaoMi, Inc.
|
||||
|
|
@ -2043,6 +2086,7 @@ index 000000000000..beb5fc07dd6c
|
|||
+#include <drm/drm_panel.h>
|
||||
+#include <linux/delay.h>
|
||||
+#include <linux/input.h>
|
||||
+#include <linux/notifier.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/spi/spi.h>
|
||||
+#include <linux/uaccess.h>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -58,6 +58,7 @@ source="
|
|||
0012-HACK-ASoC-qcom-qdsp6-q6afe-pretend-the-AFE-vote-didn.patch
|
||||
0013-Input-keyboard-add-Xiaomi-Nanosic-803-keyboard.patch
|
||||
0014-UPSTREAM-libbpf-Fix-UAF-in-strset__add_str.patch
|
||||
0016-power-supply-add-nuvolta-rx1665-wireless-charger.patch
|
||||
"
|
||||
builddir="$srcdir/linux-$pkgver"
|
||||
|
||||
|
|
@ -91,8 +92,8 @@ sha512sums="
|
|||
753b53b3f9a240b5838fe1156ad61f2356e2042941e571450492b5c8c46fd32140aede34fd4b074705650bac503deccec20ad9b8caee9d4c5fdc575401c76cc4 linux-7.1.4.tar.xz
|
||||
73fa3eab2ab9e420cd0eb8a366dd928e58ce17fc7c05a2a531b28cca8c0eb6fa0fd0b0708a74d2171e758f7c257095996875f14ea2f2a6fba68b22074fff2765 config-xiaomi-pipa.aarch64
|
||||
cdc7d83d87fe632a3589fdfd117a045f2da0873c1d78ed117b38649b83adee518f099f3dcf7908b1729d75535ba25a1685dc37fd1a5d14c64bbe0d41dd87a2d3 0001-arm64-dts-qcom-sm8250-xiaomi-pipa-Add-device-tree-fo.patch
|
||||
e20fa947eada70ff7a83ad76ecb0402e3a6d4b3d471066065dbe580bd45851a59006c53daf85009e59686a888b24d7f8b27595e7bb49c6f564e29ea70640893e 0002-power-supply-Add-driver-for-Qualcomm-PMIC-fuel-gauge.patch
|
||||
522af2aede3ef917035bfca7c9c24f43407118540c6bbe93bce73bce41066fe83e9f83e848264182188a5f47da2a1b94a84040f192e5af390054fced89a7e1d8 0003-Input-Add-nt36523-touchscreen-driver.patch
|
||||
34eab30dde870322ad10ab7babee8acf7c5da2b2d5d38d5e4f67fad87be4e7d1426950b46c7d7344627ba034643f030b8f4656cbf941bb2f04b1d649530842d3 0002-power-supply-Add-driver-for-Qualcomm-PMIC-fuel-gauge.patch
|
||||
f5132c2e1c6d130843bc98f649609ab3fbec7fb011a608f4aa0a2bbd933962650713e0b6524ee7bcfd62b16cbaa18cb47b8858833f89c62a06a54f920527bf2d 0003-Input-Add-nt36523-touchscreen-driver.patch
|
||||
6db0ea6e585e50054457b0d959efe691c7fcb6d68dc7144b456f7f04f140bd02a422008bfe40680d3d7b799d7192b007d94df97c7288644f2ffd321221d1a881 0004-drm-msm-dsi-change-sync-mode-to-sync-on-DSI0-rather-.patch
|
||||
9ac34413200b8bcb4e8d72441fff9161d0966081e817700127dc607ffcea215a689f4a482663d422b06b4e3e40aa0e11a607efad3310a31a3e81299390e83dc3 0005-drm-msm-dsi-support-DSC-configurations-with-slice_pe.patch
|
||||
cb6265f0dbb4f35753c6cda74a78bebea6aa18294175498556d2cb089ac6c5da26563bd47a50ea531a643cf967dc5bcefe341a951f7af9e2d74f5b832430b242 0006-drm-panel-Add-support-for-Novatek-NT36532-panel.patch
|
||||
|
|
@ -103,4 +104,5 @@ f98be67fa1826cc7f29a5ab07ff6457701701a13fd563bdae1b3eac47c32e74a08be18faeae7a57d
|
|||
c6683c513af7a98269a7a686c6ba24ff9387c4e50968bf0de64c1f4eaa9a01b65e17318a2b9cae52085b3e4afabf47aacc4f6fa5bb1a5d12d92cff1eab7bdd65 0012-HACK-ASoC-qcom-qdsp6-q6afe-pretend-the-AFE-vote-didn.patch
|
||||
f763ecb3c565d2f5c330ad25e8193e89c1de207db8f460b71c17bb7f68e98bec3f4a22e78ac422329db33f139f0fddd0aef6ffa4f8659248c150df951c4a2f19 0013-Input-keyboard-add-Xiaomi-Nanosic-803-keyboard.patch
|
||||
b4fa58b77ea1cf16e594efaaee800ee8790cad4fbe3662bd22d5be71d8cb6fd4fe95f8c9184c0c53c42a46aa3e2999e1053f8e8b532ac1e9c7b9b0fcb674dba9 0014-UPSTREAM-libbpf-Fix-UAF-in-strset__add_str.patch
|
||||
8589f3100677b35e0af9d72d4c44c399248df0dbaec4a9654e2c4eab65acafa1b1f1c52a47ed9df2d3f3dc6f8687c3cee82047ec6e1ebcad9d0e7731608c0688 0016-power-supply-add-nuvolta-rx1665-wireless-charger.patch
|
||||
"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue