Skip to content

Commit d7b01b8

Browse files
committed
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/[email protected]
2 parents 79f8b28 + 2376d87 commit d7b01b8

File tree

17 files changed

+129
-21
lines changed

17 files changed

+129
-21
lines changed

Documentation/devicetree/bindings/timer/rockchip,rk-timer.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ properties:
2424
- rockchip,rk3228-timer
2525
- rockchip,rk3229-timer
2626
- rockchip,rk3368-timer
27+
- rockchip,rk3576-timer
2728
- rockchip,rk3588-timer
2829
- rockchip,px30-timer
2930
- const: rockchip,rk3288-timer

drivers/clocksource/acpi_pm.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
#include <asm/io.h>
2626
#include <asm/time.h>
2727

28+
static void *suspend_resume_cb_data;
29+
30+
static void (*suspend_resume_callback)(void *data, bool suspend);
31+
2832
/*
2933
* The I/O port the PMTMR resides at.
3034
* The location is detected during setup_arch(),
@@ -58,6 +62,32 @@ u32 acpi_pm_read_verified(void)
5862
return v2;
5963
}
6064

65+
void acpi_pmtmr_register_suspend_resume_callback(void (*cb)(void *data, bool suspend), void *data)
66+
{
67+
suspend_resume_callback = cb;
68+
suspend_resume_cb_data = data;
69+
}
70+
EXPORT_SYMBOL_GPL(acpi_pmtmr_register_suspend_resume_callback);
71+
72+
void acpi_pmtmr_unregister_suspend_resume_callback(void)
73+
{
74+
suspend_resume_callback = NULL;
75+
suspend_resume_cb_data = NULL;
76+
}
77+
EXPORT_SYMBOL_GPL(acpi_pmtmr_unregister_suspend_resume_callback);
78+
79+
static void acpi_pm_suspend(struct clocksource *cs)
80+
{
81+
if (suspend_resume_callback)
82+
suspend_resume_callback(suspend_resume_cb_data, true);
83+
}
84+
85+
static void acpi_pm_resume(struct clocksource *cs)
86+
{
87+
if (suspend_resume_callback)
88+
suspend_resume_callback(suspend_resume_cb_data, false);
89+
}
90+
6191
static u64 acpi_pm_read(struct clocksource *cs)
6292
{
6393
return (u64)read_pmtmr();
@@ -69,6 +99,8 @@ static struct clocksource clocksource_acpi_pm = {
6999
.read = acpi_pm_read,
70100
.mask = (u64)ACPI_PM_MASK,
71101
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
102+
.suspend = acpi_pm_suspend,
103+
.resume = acpi_pm_resume,
72104
};
73105

74106

drivers/clocksource/arm_arch_timer.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,7 +1594,6 @@ static int __init arch_timer_mem_of_init(struct device_node *np)
15941594
{
15951595
struct arch_timer_mem *timer_mem;
15961596
struct arch_timer_mem_frame *frame;
1597-
struct device_node *frame_node;
15981597
struct resource res;
15991598
int ret = -EINVAL;
16001599
u32 rate;
@@ -1608,33 +1607,29 @@ static int __init arch_timer_mem_of_init(struct device_node *np)
16081607
timer_mem->cntctlbase = res.start;
16091608
timer_mem->size = resource_size(&res);
16101609

1611-
for_each_available_child_of_node(np, frame_node) {
1610+
for_each_available_child_of_node_scoped(np, frame_node) {
16121611
u32 n;
16131612
struct arch_timer_mem_frame *frame;
16141613

16151614
if (of_property_read_u32(frame_node, "frame-number", &n)) {
16161615
pr_err(FW_BUG "Missing frame-number.\n");
1617-
of_node_put(frame_node);
16181616
goto out;
16191617
}
16201618
if (n >= ARCH_TIMER_MEM_MAX_FRAMES) {
16211619
pr_err(FW_BUG "Wrong frame-number, only 0-%u are permitted.\n",
16221620
ARCH_TIMER_MEM_MAX_FRAMES - 1);
1623-
of_node_put(frame_node);
16241621
goto out;
16251622
}
16261623
frame = &timer_mem->frame[n];
16271624

16281625
if (frame->valid) {
16291626
pr_err(FW_BUG "Duplicated frame-number.\n");
1630-
of_node_put(frame_node);
16311627
goto out;
16321628
}
16331629

1634-
if (of_address_to_resource(frame_node, 0, &res)) {
1635-
of_node_put(frame_node);
1630+
if (of_address_to_resource(frame_node, 0, &res))
16361631
goto out;
1637-
}
1632+
16381633
frame->cntbase = res.start;
16391634
frame->size = resource_size(&res);
16401635

drivers/clocksource/asm9260_timer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ static int __init asm9260_timer_init(struct device_node *np)
210210
DRIVER_NAME, &event_dev);
211211
if (ret) {
212212
pr_err("Failed to setup irq!\n");
213+
clk_disable_unprepare(clk);
213214
return ret;
214215
}
215216

drivers/clocksource/ingenic-ost.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,10 @@ static int __init ingenic_ost_probe(struct platform_device *pdev)
9393
return PTR_ERR(map);
9494
}
9595

96-
ost->clk = devm_clk_get(dev, "ost");
96+
ost->clk = devm_clk_get_enabled(dev, "ost");
9797
if (IS_ERR(ost->clk))
9898
return PTR_ERR(ost->clk);
9999

100-
err = clk_prepare_enable(ost->clk);
101-
if (err)
102-
return err;
103-
104100
/* Clear counter high/low registers */
105101
if (soc_info->is64bit)
106102
regmap_write(map, TCU_REG_OST_CNTL, 0);
@@ -129,7 +125,6 @@ static int __init ingenic_ost_probe(struct platform_device *pdev)
129125
err = clocksource_register_hz(cs, rate);
130126
if (err) {
131127
dev_err(dev, "clocksource registration failed");
132-
clk_disable_unprepare(ost->clk);
133128
return err;
134129
}
135130

drivers/clocksource/jcore-pit.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static int jcore_pit_local_init(unsigned cpu)
120120

121121
static irqreturn_t jcore_timer_interrupt(int irq, void *dev_id)
122122
{
123-
struct jcore_pit *pit = this_cpu_ptr(dev_id);
123+
struct jcore_pit *pit = dev_id;
124124

125125
if (clockevent_state_oneshot(&pit->ced))
126126
jcore_pit_disable(pit);
@@ -168,9 +168,8 @@ static int __init jcore_pit_init(struct device_node *node)
168168
return -ENOMEM;
169169
}
170170

171-
err = request_irq(pit_irq, jcore_timer_interrupt,
172-
IRQF_TIMER | IRQF_PERCPU,
173-
"jcore_pit", jcore_pit_percpu);
171+
err = request_percpu_irq(pit_irq, jcore_timer_interrupt,
172+
"jcore_pit", jcore_pit_percpu);
174173
if (err) {
175174
pr_err("pit irq request failed: %d\n", err);
176175
free_percpu(jcore_pit_percpu);

drivers/clocksource/timer-cadence-ttc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ static int __init ttc_setup_clockevent(struct clk *clk,
435435
&ttcce->ttc.clk_rate_change_nb);
436436
if (err) {
437437
pr_warn("Unable to register clock notifier.\n");
438-
goto out_kfree;
438+
goto out_clk_unprepare;
439439
}
440440

441441
ttcce->ttc.freq = clk_get_rate(ttcce->ttc.clk);
@@ -465,13 +465,15 @@ static int __init ttc_setup_clockevent(struct clk *clk,
465465
err = request_irq(irq, ttc_clock_event_interrupt,
466466
IRQF_TIMER, ttcce->ce.name, ttcce);
467467
if (err)
468-
goto out_kfree;
468+
goto out_clk_unprepare;
469469

470470
clockevents_config_and_register(&ttcce->ce,
471471
ttcce->ttc.freq / PRESCALE, 1, 0xfffe);
472472

473473
return 0;
474474

475+
out_clk_unprepare:
476+
clk_disable_unprepare(ttcce->ttc.clk);
475477
out_kfree:
476478
kfree(ttcce);
477479
return err;

drivers/clocksource/timer-qcom.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ static int __init msm_dt_timer_init(struct device_node *np)
233233
}
234234

235235
if (of_property_read_u32(np, "clock-frequency", &freq)) {
236+
iounmap(cpu0_base);
236237
pr_err("Unknown frequency\n");
237238
return -EINVAL;
238239
}
@@ -243,7 +244,11 @@ static int __init msm_dt_timer_init(struct device_node *np)
243244
freq /= 4;
244245
writel_relaxed(DGT_CLK_CTL_DIV_4, source_base + DGT_CLK_CTL);
245246

246-
return msm_timer_init(freq, 32, irq, !!percpu_offset);
247+
ret = msm_timer_init(freq, 32, irq, !!percpu_offset);
248+
if (ret)
249+
iounmap(cpu0_base);
250+
251+
return ret;
247252
}
248253
TIMER_OF_DECLARE(kpss_timer, "qcom,kpss-timer", msm_dt_timer_init);
249254
TIMER_OF_DECLARE(scss_timer, "qcom,scss-timer", msm_dt_timer_init);

drivers/platform/x86/intel/pmc/adl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ const struct pmc_reg_map adl_reg_map = {
295295
.ppfear_buckets = CNP_PPFEAR_NUM_ENTRIES,
296296
.pm_cfg_offset = CNP_PMC_PM_CFG_OFFSET,
297297
.pm_read_disable_bit = CNP_PMC_READ_DISABLE_BIT,
298+
.acpi_pm_tmr_ctl_offset = SPT_PMC_ACPI_PM_TMR_CTL_OFFSET,
299+
.acpi_pm_tmr_disable_bit = SPT_PMC_BIT_ACPI_PM_TMR_DISABLE,
298300
.ltr_ignore_max = ADL_NUM_IP_IGN_ALLOWED,
299301
.lpm_num_modes = ADL_LPM_NUM_MODES,
300302
.lpm_num_maps = ADL_LPM_NUM_MAPS,

drivers/platform/x86/intel/pmc/cnp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ const struct pmc_reg_map cnp_reg_map = {
200200
.ppfear_buckets = CNP_PPFEAR_NUM_ENTRIES,
201201
.pm_cfg_offset = CNP_PMC_PM_CFG_OFFSET,
202202
.pm_read_disable_bit = CNP_PMC_READ_DISABLE_BIT,
203+
.acpi_pm_tmr_ctl_offset = SPT_PMC_ACPI_PM_TMR_CTL_OFFSET,
204+
.acpi_pm_tmr_disable_bit = SPT_PMC_BIT_ACPI_PM_TMR_DISABLE,
203205
.ltr_ignore_max = CNP_NUM_IP_IGN_ALLOWED,
204206
.etr3_offset = ETR3_OFFSET,
205207
};

0 commit comments

Comments
 (0)