mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
Merge "ODROID-XU4 : s2mps11 manual reset function enable for hardware watchdog." into odroidxu4-4.9.y
This commit is contained in:
62
drivers/regulator/s2mps11.c
Normal file → Executable file
62
drivers/regulator/s2mps11.c
Normal file → Executable file
@@ -1142,6 +1142,64 @@ static int s2mps11_pmic_ethonoff(struct platform_device *pdev, bool onoff)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* for External Watchdog Hardware module */
|
||||
#include <linux/kernel.h>
|
||||
unsigned int external_watchdog = false;
|
||||
unsigned int debounce_time = 3;
|
||||
|
||||
static int __init external_watchdog_enable(char *s)
|
||||
{
|
||||
if (!strcmp(s, "true")) {
|
||||
external_watchdog = true;
|
||||
pr_emerg("s2mps11 : external watchdog enable!\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
__setup("external_watchdog=", external_watchdog_enable);
|
||||
|
||||
static int __init external_watchdog_debounce(char *s)
|
||||
{
|
||||
unsigned long value;
|
||||
|
||||
if (kstrtoul(s, 10, &value) != 0)
|
||||
value = 3;
|
||||
|
||||
debounce_time = value;
|
||||
return 0;
|
||||
}
|
||||
__setup("external_watchdog_debounce=", external_watchdog_debounce);
|
||||
|
||||
/* pmic control register setup for external watch dog board */
|
||||
static int s2mps11_pmic_watchdog_setup(struct sec_pmic_dev *iodev)
|
||||
{
|
||||
unsigned char rdata = 0;
|
||||
|
||||
/* PWRHOLD ctrl = 0*/
|
||||
rdata = 0x0;
|
||||
|
||||
/* Manual reset enable */
|
||||
rdata |= 0x08;
|
||||
|
||||
/* Manual reset 3 sec(default) */
|
||||
if (debounce_time > 2 && debounce_time < 9)
|
||||
rdata |= (debounce_time - 1);
|
||||
else if (debounce_time > 8 && debounce_time < 11)
|
||||
rdata |= (debounce_time - 9);
|
||||
else
|
||||
rdata |= 2;
|
||||
|
||||
if(regmap_update_bits(iodev->regmap_pmic, S2MPS11_REG_CTRL1,
|
||||
0xFF, rdata))
|
||||
pr_err("%s : S2MPS11_REG_CTRL1(w) fail!\n", __func__);
|
||||
else {
|
||||
pr_emerg("%s : external watchdog debounce time = %d sec\n",
|
||||
__func__, debounce_time);
|
||||
pr_emerg("%s : S2MPS11_REG_CTRL1(w:0x%02X) success!\n",
|
||||
__func__, rdata);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int s2mps11_pmic_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
|
||||
@@ -1269,6 +1327,10 @@ common_reg:
|
||||
out:
|
||||
kfree(rdata);
|
||||
|
||||
/* for Exterenal Watchdog board enable */
|
||||
if (external_watchdog)
|
||||
s2mps11_pmic_watchdog_setup(iodev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user