From 072de836f53be56a70cecf70b43ae43b7ce17376 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Mon, 11 Dec 2023 10:08:36 +0000
Subject: [PATCH] mk-rootfs.sh
---
kernel/drivers/input/misc/rk805-pwrkey.c | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/kernel/drivers/input/misc/rk805-pwrkey.c b/kernel/drivers/input/misc/rk805-pwrkey.c
index 9210039..7698217 100644
--- a/kernel/drivers/input/misc/rk805-pwrkey.c
+++ b/kernel/drivers/input/misc/rk805-pwrkey.c
@@ -1,14 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Rockchip RK805 PMIC Power Key driver
*
* Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd
*
* Author: Joseph Chen <chenjh@rock-chips.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
*/
#include <linux/errno.h>
@@ -17,6 +13,7 @@
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
static irqreturn_t pwrkey_fall_irq(int irq, void *_pwr)
@@ -43,7 +40,14 @@
{
struct input_dev *pwr;
int fall_irq, rise_irq;
+ struct device_node *np;
int err;
+
+ np = of_get_child_by_name(pdev->dev.parent->of_node, "pwrkey");
+ if (np && !of_device_is_available(np)) {
+ dev_info(&pdev->dev, "device is disabled\n");
+ return -EINVAL;
+ }
pwr = devm_input_allocate_device(&pdev->dev);
if (!pwr) {
@@ -57,16 +61,12 @@
input_set_capability(pwr, EV_KEY, KEY_POWER);
fall_irq = platform_get_irq(pdev, 0);
- if (fall_irq < 0) {
- dev_err(&pdev->dev, "Can't get fall irq: %d\n", fall_irq);
+ if (fall_irq < 0)
return fall_irq;
- }
rise_irq = platform_get_irq(pdev, 1);
- if (rise_irq < 0) {
- dev_err(&pdev->dev, "Can't get rise irq: %d\n", rise_irq);
+ if (rise_irq < 0)
return rise_irq;
- }
err = devm_request_any_context_irq(&pwr->dev, fall_irq,
pwrkey_fall_irq,
@@ -106,6 +106,7 @@
};
module_platform_driver(rk805_pwrkey_driver);
+MODULE_ALIAS("platform:rk805-pwrkey");
MODULE_AUTHOR("Joseph Chen <chenjh@rock-chips.com>");
MODULE_DESCRIPTION("RK805 PMIC Power Key driver");
MODULE_LICENSE("GPL");
--
Gitblit v1.6.2