Lines Matching full:counter
8 #include <linux/counter.h>
46 * @preset: array of Counter Register states
57 static int i8254_count_read(struct counter_device *const counter, struct counter_count *const count, in i8254_count_read() argument
60 struct i8254 *const priv = counter_priv(counter); in i8254_count_read()
84 static int i8254_function_read(struct counter_device *const counter, in i8254_function_read() argument
96 static int i8254_action_read(struct counter_device *const counter, in i8254_action_read() argument
101 struct i8254 *const priv = counter_priv(counter); in i8254_action_read()
125 static int i8254_count_ceiling_read(struct counter_device *const counter, in i8254_count_ceiling_read() argument
128 struct i8254 *const priv = counter_priv(counter); in i8254_count_ceiling_read()
134 /* Rate Generator decrements 0 by one and the counter "wraps around" */ in i8254_count_ceiling_read()
141 /* Square Wave Mode decrements 0 by two and the counter "wraps around" */ in i8254_count_ceiling_read()
156 static int i8254_count_mode_read(struct counter_device *const counter, in i8254_count_mode_read() argument
160 const struct i8254 *const priv = counter_priv(counter); in i8254_count_mode_read()
187 static int i8254_count_mode_write(struct counter_device *const counter, in i8254_count_mode_write() argument
191 struct i8254 *const priv = counter_priv(counter); in i8254_count_mode_write()
221 /* Counter Register is cleared when the counter is programmed */ in i8254_count_mode_write()
232 static int i8254_count_floor_read(struct counter_device *const counter, in i8254_count_floor_read() argument
235 struct i8254 *const priv = counter_priv(counter); in i8254_count_floor_read()
241 /* counter is always reloaded after 1, but 0 is a possible reload value */ in i8254_count_floor_read()
245 /* counter is always reloaded after 2 for even preset values */ in i8254_count_floor_read()
258 static int i8254_count_preset_read(struct counter_device *const counter, in i8254_count_preset_read() argument
261 const struct i8254 *const priv = counter_priv(counter); in i8254_count_preset_read()
268 static int i8254_count_preset_write(struct counter_device *const counter, in i8254_count_preset_write() argument
271 struct i8254 *const priv = counter_priv(counter); in i8254_count_preset_write()
304 /* Initialize each counter to Mode 0 */ in i8254_init_hw()
392 I8254_COUNT(0, "Counter 0"), I8254_COUNT(1, "Counter 1"), I8254_COUNT(2, "Counter 2"),
396 * devm_i8254_regmap_register - Register an i8254 Counter device
397 * @dev: device that is registering this i8254 Counter device
400 * Registers an Intel 8254 Programmable Interval Timer Counter device. Returns 0 on success and
406 struct counter_device *counter; in devm_i8254_regmap_register() local
416 counter = devm_counter_alloc(dev, sizeof(*priv)); in devm_i8254_regmap_register()
417 if (!counter) in devm_i8254_regmap_register()
419 priv = counter_priv(counter); in devm_i8254_regmap_register()
422 counter->name = dev_name(config->parent); in devm_i8254_regmap_register()
423 counter->parent = config->parent; in devm_i8254_regmap_register()
424 counter->ops = &i8254_ops; in devm_i8254_regmap_register()
425 counter->counts = i8254_counts; in devm_i8254_regmap_register()
426 counter->num_counts = ARRAY_SIZE(i8254_counts); in devm_i8254_regmap_register()
427 counter->signals = i8254_signals; in devm_i8254_regmap_register()
428 counter->num_signals = ARRAY_SIZE(i8254_signals); in devm_i8254_regmap_register()
436 err = devm_counter_add(dev, counter); in devm_i8254_regmap_register()
438 return dev_err_probe(dev, err, "Failed to add counter\n"); in devm_i8254_regmap_register()
447 MODULE_IMPORT_NS(COUNTER);