* sunxi-6.0: initial state: add megous patches to series * sunxi-6.0: Switch to v6.0.1 * wifi: Limit the version 6.0 for Realtek 88x2cs chipsets * Adjust kernel configs * Remove not needed patches * Adjust broken patches Co-authored-by: Igor <igor@armbian.com>
79 lines
2.3 KiB
Diff
79 lines
2.3 KiB
Diff
From 26d56481005261e53cad3cb64443f49131c0aca4 Mon Sep 17 00:00:00 2001
|
|
From: Ondrej Jirman <megi@xff.cz>
|
|
Date: Sun, 3 Apr 2022 16:25:10 +0200
|
|
Subject: [PATCH 369/486] input: pinephone-keyboard: Add support for VBAT
|
|
regulator
|
|
|
|
This needs to be enabled for stable usage. If not, the keyboard
|
|
MCU may be browning out when phone's VBAT is low.
|
|
|
|
Signed-off-by: Ondrej Jirman <megi@xff.cz>
|
|
---
|
|
drivers/input/keyboard/pinephone-keyboard.c | 22 +++++++++++++++++++++
|
|
1 file changed, 22 insertions(+)
|
|
|
|
diff --git a/drivers/input/keyboard/pinephone-keyboard.c b/drivers/input/keyboard/pinephone-keyboard.c
|
|
index 7d2e16e58..b1e951cbb 100644
|
|
--- a/drivers/input/keyboard/pinephone-keyboard.c
|
|
+++ b/drivers/input/keyboard/pinephone-keyboard.c
|
|
@@ -8,6 +8,7 @@
|
|
#include <linux/input/matrix_keypad.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/module.h>
|
|
+#include <linux/regulator/consumer.h>
|
|
|
|
#define DRV_NAME "pinephone-keyboard"
|
|
|
|
@@ -139,6 +140,7 @@ static const struct matrix_keymap_data ppkb_default_keymap_data = {
|
|
|
|
struct pinephone_keyboard {
|
|
struct i2c_adapter adapter;
|
|
+ struct regulator *vbat_supply;
|
|
struct input_dev *input;
|
|
unsigned short *fn_keymap;
|
|
u8 crc_table[CRC8_TABLE_SIZE];
|
|
@@ -371,6 +373,11 @@ static int ppkb_probe(struct i2c_client *client)
|
|
|
|
i2c_set_clientdata(client, ppkb);
|
|
|
|
+ ppkb->vbat_supply = devm_regulator_get(dev, "vbat");
|
|
+ if (IS_ERR(ppkb->vbat_supply))
|
|
+ return dev_err_probe(dev, PTR_ERR(ppkb->vbat_supply),
|
|
+ "Failed to get vbat_supply\n");
|
|
+
|
|
i2c_bus = of_get_child_by_name(dev->of_node, "i2c-bus");
|
|
if (i2c_bus) {
|
|
ppkb->adapter.owner = THIS_MODULE;
|
|
@@ -426,6 +433,20 @@ static int ppkb_probe(struct i2c_client *client)
|
|
if (ret)
|
|
return dev_err_probe(dev, ret, "Failed to request IRQ\n");
|
|
|
|
+ ret = regulator_enable(ppkb->vbat_supply);
|
|
+ if (ret)
|
|
+ return dev_err_probe(dev, ret,
|
|
+ "Failed to enable keyboard vbat supply\n");
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static int ppkb_remove(struct i2c_client *client)
|
|
+{
|
|
+ struct pinephone_keyboard *ppkb = i2c_get_clientdata(client);
|
|
+
|
|
+ regulator_disable(ppkb->vbat_supply);
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
@@ -437,6 +458,7 @@ MODULE_DEVICE_TABLE(of, ppkb_of_match);
|
|
|
|
static struct i2c_driver ppkb_driver = {
|
|
.probe_new = ppkb_probe,
|
|
+ .remove = ppkb_remove,
|
|
.driver = {
|
|
.name = DRV_NAME,
|
|
.of_match_table = ppkb_of_match,
|
|
--
|
|
2.35.3
|
|
|