armbian_build/patch/kernel/archive/sunxi-5.16/patches.megous/misc-modem-power-GPIO-debugging-API.patch
The-going f80117f21c
Recycling of megous v5.16.4 patches (#3449)
* Recycling of megous v5.16.4 patches

The patches were sorted as far as possible. Some patches are renamed
according to their place of application. The length of the patch name
has been changed to improve readability using
the `git format-patch --filename-max-length=75` method.

The folder containing the patches will have the name `patches.name`
and the corresponding file `series.name` for the convenience
of processing and moving them upstream. But the control file remains
`series.conf`.


Signed-off-by: The-going <48602507+The-going@users.noreply.github.com>

* Add a series of armbian patches for 5.16

Signed-off-by: The-going <48602507+The-going@users.noreply.github.com>

* Remove patches whose fixes are already in the kernel

Signed-off-by: The-going <48602507+The-going@users.noreply.github.com>
2022-02-02 11:03:44 +01:00

72 lines
2.0 KiB
Diff

From dec31b39b9b72e2f76244b4227be83b05aed440b Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megous@megous.com>
Date: Thu, 3 Dec 2020 20:00:41 +0100
Subject: [PATCH 123/446] misc: modem-power: GPIO debugging API
Signed-off-by: Ondrej Jirman <megous@megous.com>
---
drivers/misc/modem-power.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/drivers/misc/modem-power.c b/drivers/misc/modem-power.c
index 4cb0a335e..c43e00cc7 100644
--- a/drivers/misc/modem-power.c
+++ b/drivers/misc/modem-power.c
@@ -1300,12 +1300,45 @@ static ssize_t hard_reset_store(struct device *dev,
return len;
}
+static ssize_t debug_pins_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t len)
+{
+ struct mpwr_dev *mpwr = platform_get_drvdata(to_platform_device(dev));
+ unsigned val;
+ int ret;
+
+ if (test_bit(MPWR_F_BLOCKED, mpwr->flags))
+ return -EPERM;
+
+ ret = kstrtouint(buf, 16, &val);
+ if (ret)
+ return ret;
+
+ gpiod_direction_output(mpwr->host_ready_gpio, val & BIT(0));
+ gpiod_direction_output(mpwr->enable_gpio, val & BIT(1));
+ gpiod_direction_output(mpwr->dtr_gpio, val & BIT(2));
+ gpiod_direction_output(mpwr->rts_gpio, val & BIT(3));
+
+ return len;
+}
+
+static ssize_t debug_pins_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct mpwr_dev *mpwr = platform_get_drvdata(to_platform_device(dev));
+
+ return scnprintf(buf, PAGE_SIZE, "CTS=%u RI=%u\n",
+ gpiod_get_value(mpwr->cts_gpio), gpiod_get_value(mpwr->wakeup_gpio));
+}
+
static DEVICE_ATTR_RW(powered);
static DEVICE_ATTR_WO(powered_blocking);
static DEVICE_ATTR_RO(killswitched);
static DEVICE_ATTR_RO(is_busy);
static DEVICE_ATTR_RO(help);
static DEVICE_ATTR_WO(hard_reset);
+static DEVICE_ATTR_RW(debug_pins);
static struct attribute *mpwr_attrs[] = {
&dev_attr_powered.attr,
@@ -1314,6 +1347,7 @@ static struct attribute *mpwr_attrs[] = {
&dev_attr_is_busy.attr,
&dev_attr_help.attr,
&dev_attr_hard_reset.attr,
+ &dev_attr_debug_pins.attr,
NULL,
};
--
2.31.1