1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/linux/0200-riscv-sifive-reboot.patch
3 # Copyright (C) 2021 - 2022 The T2 SDE Project
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
8 # This patch file is dual-licensed. It is available under the license the
9 # patched project is licensed under, as long as it is an OpenSource license
10 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
11 # of the GNU General Public License version 2 as used by the T2 SDE.
12 # --- T2-COPYRIGHT-NOTE-END ---
14 --- ./include/linux/mfd/da9063/core.h.orig 2021-07-20 11:58:26.803336163 +0200
15 +++ ./include/linux/mfd/da9063/core.h 2021-07-20 11:59:01.951257914 +0200
18 unsigned int irq_base;
19 struct regmap_irq_chip_data *regmap_irq;
22 + struct notifier_block restart_handler;
25 int da9063_device_init(struct da9063 *da9063, unsigned int irq);
26 --- ./drivers/mfd/da9063-core.c.orig 2021-07-20 12:00:24.843080267 +0200
27 +++ ./drivers/mfd/da9063-core.c 2021-07-20 14:55:59.528014000 +0200
29 #include <linux/mutex.h>
30 #include <linux/mfd/core.h>
31 #include <linux/regmap.h>
32 +#include <linux/reboot.h>
34 #include <linux/mfd/da9063/core.h>
35 #include <linux/mfd/da9063/registers.h>
40 +static int da9063_restart_notify(struct notifier_block *this,
41 + unsigned long mode, void *cmd)
43 + struct da9063 *da9063 = container_of(this, struct da9063, restart_handler);
45 + regmap_write(da9063->regmap, DA9063_REG_PAGE_CON, 0x00);
46 + regmap_write(da9063->regmap, DA9063_AD_REG_ALARM_Y, 0x20);
47 + regmap_write(da9063->regmap, DA9063_AD_REG_SECOND_A, 0x80);
48 + regmap_write(da9063->regmap, DA9063_REG_EVENT_A, 0x4);
49 + regmap_write(da9063->regmap, DA9063_REG_CONTROL_F, 0x2);
54 int da9063_device_init(struct da9063 *da9063, unsigned int irq)
61 + da9063->restart_handler.notifier_call = da9063_restart_notify;
62 + da9063->restart_handler.priority = 129;
63 + ret = register_restart_handler(&da9063->restart_handler);
64 + if (ret) dev_err(da9063->dev, "Failed to register restart handler\n");
65 + else devm_add_action(da9063->dev, (void(*)(void*))unregister_restart_handler, &da9063->restart_handler);