[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230104170806.jrb6qnoyk6buzvg5@mercury.elektranox.org>
Date: Wed, 4 Jan 2023 18:08:06 +0100
From: Sebastian Reichel <sebastian.reichel@...labora.com>
To: Yann Sionneau <ysionneau@...ray.eu>
Cc: linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
Clement Leger <clement.leger@...tlin.com>,
Julian Vetter <jvetter@...ray.eu>
Subject: Re: [RFC PATCH 19/25] kvx: power: scall poweroff driver
Hi,
On Tue, Jan 03, 2023 at 05:43:53PM +0100, Yann Sionneau wrote:
> Add a driver to poweroff the Coolidge SoC
> when running under Qemu, ISS or when
> the debugger (jtag-runner) runs on PL0
> to catch the scall.
line length of 41 characters is quite short.
> CC: Sebastian Reichel <sre@...nel.org>
> CC: linux-kernel@...r.kernel.org
> CC: linux-pm@...r.kernel.org
> Co-developed-by: Clement Leger <clement.leger@...tlin.com>
> Signed-off-by: Clement Leger <clement.leger@...tlin.com>
> Co-developed-by: Julian Vetter <jvetter@...ray.eu>
> Signed-off-by: Julian Vetter <jvetter@...ray.eu>
> Signed-off-by: Yann Sionneau <ysionneau@...ray.eu>
> ---
> drivers/power/reset/kvx-scall-poweroff.c | 53 ++++++++++++++++++++++++
> 1 file changed, 53 insertions(+)
> create mode 100644 drivers/power/reset/kvx-scall-poweroff.c
>
> diff --git a/drivers/power/reset/kvx-scall-poweroff.c b/drivers/power/reset/kvx-scall-poweroff.c
> new file mode 100644
> index 000000000000..586d93fbcaed
> --- /dev/null
> +++ b/drivers/power/reset/kvx-scall-poweroff.c
> @@ -0,0 +1,53 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2017 - 2022 Kalray Inc.
> + * Author(s): Clement Leger
> + */
> +
> +#include <linux/pm.h>
> +#include <linux/module.h>
> +#include <linux/of_device.h>
> +#include <linux/platform_device.h>
> +
> +#define SCALL_NUM_EXIT "0xfff"
> +
> +static void kvx_scall_poweroff(void)
> +{
> + register int status asm("r0") = 0;
> +
> + asm volatile ("scall " SCALL_NUM_EXIT "\n\t;;"
> + : /* out */
> + : "r"(status));
> +
> + unreachable();
> +}
> +
> +static int kvx_scall_poweroff_probe(struct platform_device *pdev)
> +{
> + pm_power_off = kvx_scall_poweroff;
> +
> + return 0;
> +}
Please use devm_register_power_off_handler().
-- Sebastian
> +static int kvx_scall_poweroff_remove(struct platform_device *pdev)
> +{
> + if (pm_power_off == kvx_scall_poweroff)
> + pm_power_off = NULL;
> +
> + return 0;
> +}
> +
> +static const struct of_device_id kvx_scall_poweroff_of_match[] = {
> + { .compatible = "kalray,kvx-scall-poweroff" },
> + {}
> +};
> +
> +static struct platform_driver kvx_scall_poweroff_driver = {
> + .probe = kvx_scall_poweroff_probe,
> + .remove = kvx_scall_poweroff_remove,
> + .driver = {
> + .name = "kvx-scall-poweroff",
> + .of_match_table = kvx_scall_poweroff_of_match,
> + },
> +};
> +module_platform_driver(kvx_scall_poweroff_driver);
> --
> 2.37.2
>
>
>
>
>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists