Revision d9e48dc2a71a836f17d1febbedb31470f957edb4 authored by Linus Torvalds on 05 December 2019, 19:28:14 UTC, committed by Linus Torvalds on 05 December 2019, 19:28:14 UTC
Pull pwm updates from Thierry Reding: "Various changes and minor fixes across a couple of drivers" * tag 'pwm/for-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm: pwm: stm32: Pass breakinput instead of its values pwm: stm32: Remove clutter from ternary operator pwm: stm32: Validate breakinput data from DT pwm: Update comment on struct pwm_ops::apply pwm: sun4i: Fix incorrect calculation of duty_cycle/period pwm: stm32: Add power management support pwm: stm32: Split breakinput apply routine to ease PM support dt-bindings: pwm-stm32: Document pinctrl sleep state pwm: sun4i: Drop redundant assignment to variable pval dt-bindings: pwm: mediatek: Remove gratuitous compatible string for MT7629
sc27xx-poweroff.c
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2018 Spreadtrum Communications Inc.
* Copyright (C) 2018 Linaro Ltd.
*/
#include <linux/cpu.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/regmap.h>
#include <linux/syscore_ops.h>
#define SC27XX_PWR_PD_HW 0xc2c
#define SC27XX_PWR_OFF_EN BIT(0)
static struct regmap *regmap;
/*
* On Spreadtrum platform, we need power off system through external SC27xx
* series PMICs, and it is one similar SPI bus mapped by regmap to access PMIC,
* which is not fast io access.
*
* So before stopping other cores, we need release other cores' resource by
* taking cpus down to avoid racing regmap or spi mutex lock when poweroff
* system through PMIC.
*/
static void sc27xx_poweroff_shutdown(void)
{
#ifdef CONFIG_PM_SLEEP_SMP
int cpu = smp_processor_id();
freeze_secondary_cpus(cpu);
#endif
}
static struct syscore_ops poweroff_syscore_ops = {
.shutdown = sc27xx_poweroff_shutdown,
};
static void sc27xx_poweroff_do_poweroff(void)
{
regmap_write(regmap, SC27XX_PWR_PD_HW, SC27XX_PWR_OFF_EN);
}
static int sc27xx_poweroff_probe(struct platform_device *pdev)
{
if (regmap)
return -EINVAL;
regmap = dev_get_regmap(pdev->dev.parent, NULL);
if (!regmap)
return -ENODEV;
pm_power_off = sc27xx_poweroff_do_poweroff;
register_syscore_ops(&poweroff_syscore_ops);
return 0;
}
static struct platform_driver sc27xx_poweroff_driver = {
.probe = sc27xx_poweroff_probe,
.driver = {
.name = "sc27xx-poweroff",
},
};
builtin_platform_driver(sc27xx_poweroff_driver);
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...