Commit d7b01b81 authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

Merge tag 'timers-v6.12-rc1' of https://git.linaro.org/people/daniel.lezcano/linux into timers/core

Pull clockevent/clocksource updates from Daniel Lezcano:

  - Add the DT binding for the rk3576 compatible (Detlev Casanova)

  - Use for_each_available_child_of_node_scoped() to remove the
    of_node_put() calls in the loop (Zhang Zekun)

  - Add the ability to register external callbacks for suspend/resume on
    ACPI PM driver and enable to turn it off when suspended (Marek
    Maslanka)

  - Use the devm_clk_get_enabled() variant on the ingenic timer (Huan
    Yang)

  - Add missing iounmap() on errors in msm_dt_timer_init() (Ankit
    Agrawal)

  - Add missing clk_disable_unprepare() in init routine error code path
    on the asm9260 and the cadence_ttc timers (Gaosheng Cui)

  - Use request_percpu_irq() instead of request_irq() in order to fix a
    wrong address space access reported by sparse (Uros Bizjak)

  - Fix comment format for the pmc_core_acpi_pm_timer_suspend_resume()
    function (Marek Maslanka)

Link: https://lore.kernel.org/all/6054852d-975f-4e83-850e-815f263a40c5@linaro.org
parents 79f8b28e 2376d871
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ properties:
              - rockchip,rk3228-timer
              - rockchip,rk3229-timer
              - rockchip,rk3368-timer
              - rockchip,rk3576-timer
              - rockchip,rk3588-timer
              - rockchip,px30-timer
          - const: rockchip,rk3288-timer
+32 −0
Original line number Diff line number Diff line
@@ -25,6 +25,10 @@
#include <asm/io.h>
#include <asm/time.h>

static void *suspend_resume_cb_data;

static void (*suspend_resume_callback)(void *data, bool suspend);

/*
 * The I/O port the PMTMR resides at.
 * The location is detected during setup_arch(),
@@ -58,6 +62,32 @@ u32 acpi_pm_read_verified(void)
	return v2;
}

void acpi_pmtmr_register_suspend_resume_callback(void (*cb)(void *data, bool suspend), void *data)
{
	suspend_resume_callback = cb;
	suspend_resume_cb_data = data;
}
EXPORT_SYMBOL_GPL(acpi_pmtmr_register_suspend_resume_callback);

void acpi_pmtmr_unregister_suspend_resume_callback(void)
{
	suspend_resume_callback = NULL;
	suspend_resume_cb_data = NULL;
}
EXPORT_SYMBOL_GPL(acpi_pmtmr_unregister_suspend_resume_callback);

static void acpi_pm_suspend(struct clocksource *cs)
{
	if (suspend_resume_callback)
		suspend_resume_callback(suspend_resume_cb_data, true);
}

static void acpi_pm_resume(struct clocksource *cs)
{
	if (suspend_resume_callback)
		suspend_resume_callback(suspend_resume_cb_data, false);
}

static u64 acpi_pm_read(struct clocksource *cs)
{
	return (u64)read_pmtmr();
@@ -69,6 +99,8 @@ static struct clocksource clocksource_acpi_pm = {
	.read		= acpi_pm_read,
	.mask		= (u64)ACPI_PM_MASK,
	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
	.suspend	= acpi_pm_suspend,
	.resume		= acpi_pm_resume,
};


+3 −8
Original line number Diff line number Diff line
@@ -1594,7 +1594,6 @@ static int __init arch_timer_mem_of_init(struct device_node *np)
{
	struct arch_timer_mem *timer_mem;
	struct arch_timer_mem_frame *frame;
	struct device_node *frame_node;
	struct resource res;
	int ret = -EINVAL;
	u32 rate;
@@ -1608,33 +1607,29 @@ static int __init arch_timer_mem_of_init(struct device_node *np)
	timer_mem->cntctlbase = res.start;
	timer_mem->size = resource_size(&res);

	for_each_available_child_of_node(np, frame_node) {
	for_each_available_child_of_node_scoped(np, frame_node) {
		u32 n;
		struct arch_timer_mem_frame *frame;

		if (of_property_read_u32(frame_node, "frame-number", &n)) {
			pr_err(FW_BUG "Missing frame-number.\n");
			of_node_put(frame_node);
			goto out;
		}
		if (n >= ARCH_TIMER_MEM_MAX_FRAMES) {
			pr_err(FW_BUG "Wrong frame-number, only 0-%u are permitted.\n",
			       ARCH_TIMER_MEM_MAX_FRAMES - 1);
			of_node_put(frame_node);
			goto out;
		}
		frame = &timer_mem->frame[n];

		if (frame->valid) {
			pr_err(FW_BUG "Duplicated frame-number.\n");
			of_node_put(frame_node);
			goto out;
		}

		if (of_address_to_resource(frame_node, 0, &res)) {
			of_node_put(frame_node);
		if (of_address_to_resource(frame_node, 0, &res))
			goto out;
		}

		frame->cntbase = res.start;
		frame->size = resource_size(&res);

+1 −0
Original line number Diff line number Diff line
@@ -210,6 +210,7 @@ static int __init asm9260_timer_init(struct device_node *np)
			DRIVER_NAME, &event_dev);
	if (ret) {
		pr_err("Failed to setup irq!\n");
		clk_disable_unprepare(clk);
		return ret;
	}

+1 −6
Original line number Diff line number Diff line
@@ -93,14 +93,10 @@ static int __init ingenic_ost_probe(struct platform_device *pdev)
		return PTR_ERR(map);
	}

	ost->clk = devm_clk_get(dev, "ost");
	ost->clk = devm_clk_get_enabled(dev, "ost");
	if (IS_ERR(ost->clk))
		return PTR_ERR(ost->clk);

	err = clk_prepare_enable(ost->clk);
	if (err)
		return err;

	/* Clear counter high/low registers */
	if (soc_info->is64bit)
		regmap_write(map, TCU_REG_OST_CNTL, 0);
@@ -129,7 +125,6 @@ static int __init ingenic_ost_probe(struct platform_device *pdev)
	err = clocksource_register_hz(cs, rate);
	if (err) {
		dev_err(dev, "clocksource registration failed");
		clk_disable_unprepare(ost->clk);
		return err;
	}

Loading