Lines Matching +full:debian +full:- +full:release

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Driver for the CS5535/CS5536 Multi-Function General Purpose Timers (MFGPT)
6 * Copyright (C) 2007 Andres Salomon <dilinger@debian.org>
20 #define DRV_NAME "cs5535-mfgpt"
52 return -EIO; in cs5535_mfgpt_toggle_event()
64 * a problem? -dilinger in cs5535_mfgpt_toggle_event()
67 mask = 1 << (timer->nr + 24); in cs5535_mfgpt_toggle_event()
72 mask = 1 << (timer->nr + shift); in cs5535_mfgpt_toggle_event()
77 mask = 1 << (timer->nr + shift); in cs5535_mfgpt_toggle_event()
81 return -EIO; in cs5535_mfgpt_toggle_event()
104 return -EIO; in cs5535_mfgpt_set_irq()
116 shift = ((cmp == MFGPT_CMP1 ? 0 : 4) + timer->nr % 4) * 4; in cs5535_mfgpt_set_irq()
118 return -EIO; in cs5535_mfgpt_set_irq()
128 return -EIO; in cs5535_mfgpt_set_irq()
131 return -EIO; in cs5535_mfgpt_set_irq()
133 /* All chosen and checked - go for it */ in cs5535_mfgpt_set_irq()
135 return -EIO; in cs5535_mfgpt_set_irq()
152 if (!mfgpt->initialized) in cs5535_mfgpt_alloc_timer()
167 spin_lock_irqsave(&mfgpt->lock, flags); in cs5535_mfgpt_alloc_timer()
172 t = find_first_bit(mfgpt->avail, max); in cs5535_mfgpt_alloc_timer()
173 /* set timer_nr to -1 if no timers available */ in cs5535_mfgpt_alloc_timer()
174 timer_nr = t < max ? (int) t : -1; in cs5535_mfgpt_alloc_timer()
177 if (!test_bit(timer_nr, mfgpt->avail)) in cs5535_mfgpt_alloc_timer()
178 timer_nr = -1; in cs5535_mfgpt_alloc_timer()
182 /* if timer_nr is not -1, it's an available timer */ in cs5535_mfgpt_alloc_timer()
183 __clear_bit(timer_nr, mfgpt->avail); in cs5535_mfgpt_alloc_timer()
184 spin_unlock_irqrestore(&mfgpt->lock, flags); in cs5535_mfgpt_alloc_timer()
192 spin_lock_irqsave(&mfgpt->lock, flags); in cs5535_mfgpt_alloc_timer()
193 __set_bit(timer_nr, mfgpt->avail); in cs5535_mfgpt_alloc_timer()
194 spin_unlock_irqrestore(&mfgpt->lock, flags); in cs5535_mfgpt_alloc_timer()
197 timer->chip = mfgpt; in cs5535_mfgpt_alloc_timer()
198 timer->nr = timer_nr; in cs5535_mfgpt_alloc_timer()
199 dev_info(&mfgpt->pdev->dev, "registered timer %d\n", timer_nr); in cs5535_mfgpt_alloc_timer()
209 * out a way to actually release the hardware timer. See comments below.
219 spin_lock_irqsave(&timer->chip->lock, flags); in cs5535_mfgpt_free_timer()
220 __set_bit(timer->nr, timer->chip->avail); in cs5535_mfgpt_free_timer()
221 spin_unlock_irqrestore(&timer->chip->lock, flags); in cs5535_mfgpt_free_timer()
230 return inw(timer->chip->base + reg + (timer->nr * 8)); in cs5535_mfgpt_read()
237 outw(value, timer->chip->base + reg + (timer->nr * 8)); in cs5535_mfgpt_write()
245 * whether or not this secret MSR can be used to release individual timers.
302 spin_lock_irqsave(&mfgpt->lock, flags); in scan_timers()
307 __set_bit(i, mfgpt->avail); in scan_timers()
311 spin_unlock_irqrestore(&mfgpt->lock, flags); in scan_timers()
319 int err = -EIO, t; in cs5535_mfgpt_probe()
322 dev_err(&pdev->dev, "Bad mfgpt_reset_timers value: %i\n", in cs5535_mfgpt_probe()
336 dev_err(&pdev->dev, "can't fetch device resource info\n"); in cs5535_mfgpt_probe()
340 if (!request_region(res->start, resource_size(res), pdev->name)) { in cs5535_mfgpt_probe()
341 dev_err(&pdev->dev, "can't request region\n"); in cs5535_mfgpt_probe()
345 /* set up the driver-specific struct */ in cs5535_mfgpt_probe()
346 cs5535_mfgpt_chip.base = res->start; in cs5535_mfgpt_probe()
350 dev_info(&pdev->dev, "reserved resource region %pR\n", res); in cs5535_mfgpt_probe()
354 dev_info(&pdev->dev, "%d MFGPT timers available\n", t); in cs5535_mfgpt_probe()