* Add 88 new patches to series. tag: orange-pi-5.17-20220409-0454 * Fix the applicability of patches.megous to the v5.17.3 kernel * Fix series.conf. Disable the patch that is not being applied * Add support for sun50i-h6-orangepi-3-lts * Check the applicability in the series * Move to a patches.armbian folder * Bananapro: add AXP209 regulators * fix-gpio-kconfig remove if EXPERT to allow normal build * sunxi-5.17: Remove unused patches
79 lines
2.3 KiB
Diff
79 lines
2.3 KiB
Diff
From 6027fbabb62712ef74d106994255e5b7d3ebd295 Mon Sep 17 00:00:00 2001
|
|
From: Ondrej Jirman <megi@xff.cz>
|
|
Date: Sun, 3 Apr 2022 16:25:10 +0200
|
|
Subject: [PATCH 541/544] 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 7d2e16e588a0..b1e951cbb925 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.34.1
|
|
|