Lines Matching +full:pwm +full:- +full:0
1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Copyright (C) 2011-2012 Avionic Design GmbH
12 #include <linux/pwm.h>
21 #include <dt-bindings/pwm/pwm.h>
24 #include <trace/events/pwm.h>
42 start = bitmap_find_next_zero_area(allocated_pwms, MAX_PWMS, 0, in alloc_pwms()
43 count, 0); in alloc_pwms()
46 return -ENOSPC; in alloc_pwms()
56 bitmap_clear(allocated_pwms, chip->base, chip->npwm); in free_pwms()
58 kfree(chip->pwms); in free_pwms()
59 chip->pwms = NULL; in free_pwms()
72 const char *chip_name = dev_name(chip->dev); in pwmchip_find_by_name()
74 if (chip_name && strcmp(chip_name, name) == 0) { in pwmchip_find_by_name()
85 static int pwm_device_request(struct pwm_device *pwm, const char *label) in pwm_device_request() argument
89 if (test_bit(PWMF_REQUESTED, &pwm->flags)) in pwm_device_request()
90 return -EBUSY; in pwm_device_request()
92 if (!try_module_get(pwm->chip->ops->owner)) in pwm_device_request()
93 return -ENODEV; in pwm_device_request()
95 if (pwm->chip->ops->request) { in pwm_device_request()
96 err = pwm->chip->ops->request(pwm->chip, pwm); in pwm_device_request()
98 module_put(pwm->chip->ops->owner); in pwm_device_request()
103 if (pwm->chip->ops->get_state) { in pwm_device_request()
105 * Zero-initialize state because most drivers are unaware of in pwm_device_request()
111 struct pwm_state state = { 0, }; in pwm_device_request()
113 err = pwm->chip->ops->get_state(pwm->chip, pwm, &state); in pwm_device_request()
114 trace_pwm_get(pwm, &state, err); in pwm_device_request()
117 pwm->state = state; in pwm_device_request()
120 pwm->last = pwm->state; in pwm_device_request()
123 set_bit(PWMF_REQUESTED, &pwm->flags); in pwm_device_request()
124 pwm->label = label; in pwm_device_request()
126 return 0; in pwm_device_request()
132 struct pwm_device *pwm; in of_pwm_xlate_with_flags() local
134 if (chip->of_pwm_n_cells < 2) in of_pwm_xlate_with_flags()
135 return ERR_PTR(-EINVAL); in of_pwm_xlate_with_flags()
138 if (args->args_count < 2) in of_pwm_xlate_with_flags()
139 return ERR_PTR(-EINVAL); in of_pwm_xlate_with_flags()
141 if (args->args[0] >= chip->npwm) in of_pwm_xlate_with_flags()
142 return ERR_PTR(-EINVAL); in of_pwm_xlate_with_flags()
144 pwm = pwm_request_from_chip(chip, args->args[0], NULL); in of_pwm_xlate_with_flags()
145 if (IS_ERR(pwm)) in of_pwm_xlate_with_flags()
146 return pwm; in of_pwm_xlate_with_flags()
148 pwm->args.period = args->args[1]; in of_pwm_xlate_with_flags()
149 pwm->args.polarity = PWM_POLARITY_NORMAL; in of_pwm_xlate_with_flags()
151 if (chip->of_pwm_n_cells >= 3) { in of_pwm_xlate_with_flags()
152 if (args->args_count > 2 && args->args[2] & PWM_POLARITY_INVERTED) in of_pwm_xlate_with_flags()
153 pwm->args.polarity = PWM_POLARITY_INVERSED; in of_pwm_xlate_with_flags()
156 return pwm; in of_pwm_xlate_with_flags()
163 struct pwm_device *pwm; in of_pwm_single_xlate() local
165 if (chip->of_pwm_n_cells < 1) in of_pwm_single_xlate()
166 return ERR_PTR(-EINVAL); in of_pwm_single_xlate()
169 if (args->args_count != 1 && args->args_count != 2) in of_pwm_single_xlate()
170 return ERR_PTR(-EINVAL); in of_pwm_single_xlate()
172 pwm = pwm_request_from_chip(chip, 0, NULL); in of_pwm_single_xlate()
173 if (IS_ERR(pwm)) in of_pwm_single_xlate()
174 return pwm; in of_pwm_single_xlate()
176 pwm->args.period = args->args[0]; in of_pwm_single_xlate()
177 pwm->args.polarity = PWM_POLARITY_NORMAL; in of_pwm_single_xlate()
179 if (args->args_count == 2 && args->args[1] & PWM_POLARITY_INVERTED) in of_pwm_single_xlate()
180 pwm->args.polarity = PWM_POLARITY_INVERSED; in of_pwm_single_xlate()
182 return pwm; in of_pwm_single_xlate()
188 if (!chip->dev || !chip->dev->of_node) in of_pwmchip_add()
191 if (!chip->of_xlate) { in of_pwmchip_add()
194 if (of_property_read_u32(chip->dev->of_node, "#pwm-cells", in of_pwmchip_add()
198 chip->of_xlate = of_pwm_xlate_with_flags; in of_pwmchip_add()
199 chip->of_pwm_n_cells = pwm_cells; in of_pwmchip_add()
202 of_node_get(chip->dev->of_node); in of_pwmchip_add()
207 if (chip->dev) in of_pwmchip_remove()
208 of_node_put(chip->dev->of_node); in of_pwmchip_remove()
212 * pwm_set_chip_data() - set private chip data for a PWM
213 * @pwm: PWM device
214 * @data: pointer to chip-specific data
216 * Returns: 0 on success or a negative error code on failure.
218 int pwm_set_chip_data(struct pwm_device *pwm, void *data) in pwm_set_chip_data() argument
220 if (!pwm) in pwm_set_chip_data()
221 return -EINVAL; in pwm_set_chip_data()
223 pwm->chip_data = data; in pwm_set_chip_data()
225 return 0; in pwm_set_chip_data()
230 * pwm_get_chip_data() - get private chip data for a PWM
231 * @pwm: PWM device
233 * Returns: A pointer to the chip-private data for the PWM device.
235 void *pwm_get_chip_data(struct pwm_device *pwm) in pwm_get_chip_data() argument
237 return pwm ? pwm->chip_data : NULL; in pwm_get_chip_data()
243 const struct pwm_ops *ops = chip->ops; in pwm_ops_check()
245 if (!ops->apply) in pwm_ops_check()
248 if (IS_ENABLED(CONFIG_PWM_DEBUG) && !ops->get_state) in pwm_ops_check()
249 dev_warn(chip->dev, in pwm_ops_check()
256 * pwmchip_add() - register a new PWM chip
257 * @chip: the PWM chip to add
259 * Register a new PWM chip.
261 * Returns: 0 on success or a negative error code on failure.
265 struct pwm_device *pwm; in pwmchip_add() local
269 if (!chip || !chip->dev || !chip->ops || !chip->npwm) in pwmchip_add()
270 return -EINVAL; in pwmchip_add()
273 return -EINVAL; in pwmchip_add()
275 chip->pwms = kcalloc(chip->npwm, sizeof(*pwm), GFP_KERNEL); in pwmchip_add()
276 if (!chip->pwms) in pwmchip_add()
277 return -ENOMEM; in pwmchip_add()
281 ret = alloc_pwms(chip->npwm); in pwmchip_add()
282 if (ret < 0) { in pwmchip_add()
284 kfree(chip->pwms); in pwmchip_add()
288 chip->base = ret; in pwmchip_add()
290 for (i = 0; i < chip->npwm; i++) { in pwmchip_add()
291 pwm = &chip->pwms[i]; in pwmchip_add()
293 pwm->chip = chip; in pwmchip_add()
294 pwm->pwm = chip->base + i; in pwmchip_add()
295 pwm->hwpwm = i; in pwmchip_add()
298 list_add(&chip->list, &pwm_chips); in pwmchip_add()
307 return 0; in pwmchip_add()
312 * pwmchip_remove() - remove a PWM chip
313 * @chip: the PWM chip to remove
315 * Removes a PWM chip.
326 list_del_init(&chip->list); in pwmchip_remove()
354 * pwm_request_from_chip() - request a PWM device relative to a PWM chip
355 * @chip: PWM chip
356 * @index: per-chip index of the PWM to request
357 * @label: a literal description string of this PWM
359 * Returns: A pointer to the PWM device at the given index of the given PWM
361 * specified PWM chip or if the PWM device cannot be requested.
367 struct pwm_device *pwm; in pwm_request_from_chip() local
370 if (!chip || index >= chip->npwm) in pwm_request_from_chip()
371 return ERR_PTR(-EINVAL); in pwm_request_from_chip()
374 pwm = &chip->pwms[index]; in pwm_request_from_chip()
376 err = pwm_device_request(pwm, label); in pwm_request_from_chip()
377 if (err < 0) in pwm_request_from_chip()
378 pwm = ERR_PTR(err); in pwm_request_from_chip()
381 return pwm; in pwm_request_from_chip()
385 static void pwm_apply_debug(struct pwm_device *pwm, in pwm_apply_debug() argument
388 struct pwm_state *last = &pwm->last; in pwm_apply_debug()
389 struct pwm_chip *chip = pwm->chip; in pwm_apply_debug()
390 struct pwm_state s1 = { 0 }, s2 = { 0 }; in pwm_apply_debug()
397 if (!chip->ops->get_state) in pwm_apply_debug()
405 err = chip->ops->get_state(chip, pwm, &s1); in pwm_apply_debug()
406 trace_pwm_get(pwm, &s1, err); in pwm_apply_debug()
416 if (s1.enabled && s1.polarity != state->polarity) { in pwm_apply_debug()
417 s2.polarity = state->polarity; in pwm_apply_debug()
418 s2.duty_cycle = s1.period - s1.duty_cycle; in pwm_apply_debug()
425 if (s2.polarity != state->polarity && in pwm_apply_debug()
426 state->duty_cycle < state->period) in pwm_apply_debug()
427 dev_warn(chip->dev, ".apply ignored .polarity\n"); in pwm_apply_debug()
429 if (state->enabled && in pwm_apply_debug()
430 last->polarity == state->polarity && in pwm_apply_debug()
431 last->period > s2.period && in pwm_apply_debug()
432 last->period <= state->period) in pwm_apply_debug()
433 dev_warn(chip->dev, in pwm_apply_debug()
435 state->period, s2.period, last->period); in pwm_apply_debug()
437 if (state->enabled && state->period < s2.period) in pwm_apply_debug()
438 dev_warn(chip->dev, in pwm_apply_debug()
440 state->period, s2.period); in pwm_apply_debug()
442 if (state->enabled && in pwm_apply_debug()
443 last->polarity == state->polarity && in pwm_apply_debug()
444 last->period == s2.period && in pwm_apply_debug()
445 last->duty_cycle > s2.duty_cycle && in pwm_apply_debug()
446 last->duty_cycle <= state->duty_cycle) in pwm_apply_debug()
447 dev_warn(chip->dev, in pwm_apply_debug()
449 state->duty_cycle, state->period, in pwm_apply_debug()
451 last->duty_cycle, last->period); in pwm_apply_debug()
453 if (state->enabled && state->duty_cycle < s2.duty_cycle) in pwm_apply_debug()
454 dev_warn(chip->dev, in pwm_apply_debug()
456 state->duty_cycle, state->period, in pwm_apply_debug()
459 if (!state->enabled && s2.enabled && s2.duty_cycle > 0) in pwm_apply_debug()
460 dev_warn(chip->dev, in pwm_apply_debug()
461 "requested disabled, but yielded enabled with duty > 0\n"); in pwm_apply_debug()
464 err = chip->ops->apply(chip, pwm, &s1); in pwm_apply_debug()
465 trace_pwm_apply(pwm, &s1, err); in pwm_apply_debug()
468 dev_err(chip->dev, "failed to reapply current setting\n"); in pwm_apply_debug()
472 *last = (struct pwm_state){ 0 }; in pwm_apply_debug()
473 err = chip->ops->get_state(chip, pwm, last); in pwm_apply_debug()
474 trace_pwm_get(pwm, last, err); in pwm_apply_debug()
479 if (s1.enabled != last->enabled || in pwm_apply_debug()
480 s1.polarity != last->polarity || in pwm_apply_debug()
481 (s1.enabled && s1.period != last->period) || in pwm_apply_debug()
482 (s1.enabled && s1.duty_cycle != last->duty_cycle)) { in pwm_apply_debug()
483 dev_err(chip->dev, in pwm_apply_debug()
484 ".apply is not idempotent (ena=%d pol=%d %llu/%llu) -> (ena=%d pol=%d %llu/%llu)\n", in pwm_apply_debug()
486 last->enabled, last->polarity, last->duty_cycle, in pwm_apply_debug()
487 last->period); in pwm_apply_debug()
492 * pwm_apply_might_sleep() - atomically apply a new state to a PWM device
493 * @pwm: PWM device
496 int pwm_apply_might_sleep(struct pwm_device *pwm, const struct pwm_state *state) in pwm_apply_might_sleep() argument
510 if (!pwm || !state || !state->period || in pwm_apply_might_sleep()
511 state->duty_cycle > state->period) in pwm_apply_might_sleep()
512 return -EINVAL; in pwm_apply_might_sleep()
514 chip = pwm->chip; in pwm_apply_might_sleep()
516 if (state->period == pwm->state.period && in pwm_apply_might_sleep()
517 state->duty_cycle == pwm->state.duty_cycle && in pwm_apply_might_sleep()
518 state->polarity == pwm->state.polarity && in pwm_apply_might_sleep()
519 state->enabled == pwm->state.enabled && in pwm_apply_might_sleep()
520 state->usage_power == pwm->state.usage_power) in pwm_apply_might_sleep()
521 return 0; in pwm_apply_might_sleep()
523 err = chip->ops->apply(chip, pwm, state); in pwm_apply_might_sleep()
524 trace_pwm_apply(pwm, state, err); in pwm_apply_might_sleep()
528 pwm->state = *state; in pwm_apply_might_sleep()
531 * only do this after pwm->state was applied as some in pwm_apply_might_sleep()
534 pwm_apply_debug(pwm, state); in pwm_apply_might_sleep()
536 return 0; in pwm_apply_might_sleep()
541 * pwm_capture() - capture and report a PWM signal
542 * @pwm: PWM device
546 * Returns: 0 on success or a negative error code on failure.
548 int pwm_capture(struct pwm_device *pwm, struct pwm_capture *result, in pwm_capture() argument
553 if (!pwm || !pwm->chip->ops) in pwm_capture()
554 return -EINVAL; in pwm_capture()
556 if (!pwm->chip->ops->capture) in pwm_capture()
557 return -ENOSYS; in pwm_capture()
560 err = pwm->chip->ops->capture(pwm->chip, pwm, result, timeout); in pwm_capture()
568 * pwm_adjust_config() - adjust the current PWM config to the PWM arguments
569 * @pwm: PWM device
571 * This function will adjust the PWM config to the PWM arguments provided
572 * by the DT or PWM lookup table. This is particularly useful to adapt
575 int pwm_adjust_config(struct pwm_device *pwm) in pwm_adjust_config() argument
580 pwm_get_args(pwm, &pargs); in pwm_adjust_config()
581 pwm_get_state(pwm, &state); in pwm_adjust_config()
584 * If the current period is zero it means that either the PWM driver in pwm_adjust_config()
585 * does not support initial state retrieval or the PWM has not yet in pwm_adjust_config()
589 * duty cycle of 0. in pwm_adjust_config()
592 state.duty_cycle = 0; in pwm_adjust_config()
596 return pwm_apply_might_sleep(pwm, &state); in pwm_adjust_config()
600 * Adjust the PWM duty cycle/period based on the period value provided in pwm_adjust_config()
601 * in PWM args. in pwm_adjust_config()
616 state.duty_cycle = state.period - state.duty_cycle; in pwm_adjust_config()
619 return pwm_apply_might_sleep(pwm, &state); in pwm_adjust_config()
630 if (chip->dev && device_match_fwnode(chip->dev, fwnode)) { in fwnode_to_pwmchip()
637 return ERR_PTR(-EPROBE_DEFER); in fwnode_to_pwmchip()
641 struct pwm_device *pwm) in pwm_device_link_add() argument
647 * No device for the PWM consumer has been provided. It may in pwm_device_link_add()
648 * impact the PM sequence ordering: the PWM supplier may get in pwm_device_link_add()
651 dev_warn(pwm->chip->dev, in pwm_device_link_add()
656 dl = device_link_add(dev, pwm->chip->dev, DL_FLAG_AUTOREMOVE_CONSUMER); in pwm_device_link_add()
659 dev_name(pwm->chip->dev)); in pwm_device_link_add()
660 return ERR_PTR(-EINVAL); in pwm_device_link_add()
667 * of_pwm_get() - request a PWM via the PWM framework
668 * @dev: device for PWM consumer
669 * @np: device node to get the PWM from
672 * Returns the PWM device parsed from the phandle and index specified in the
673 * "pwms" property of a device tree node or a negative error-code on failure.
674 * Values parsed from the device tree are stored in the returned PWM device
677 * If con_id is NULL, the first PWM device listed in the "pwms" property will
678 * be requested. Otherwise the "pwm-names" property is used to do a reverse
679 * lookup of the PWM index. This also means that the "pwm-names" property
680 * becomes mandatory for devices that look up the PWM device via the con_id
683 * Returns: A pointer to the requested PWM device or an ERR_PTR()-encoded
689 struct pwm_device *pwm = NULL; in of_pwm_get() local
693 int index = 0; in of_pwm_get()
697 index = of_property_match_string(np, "pwm-names", con_id); in of_pwm_get()
698 if (index < 0) in of_pwm_get()
702 err = of_parse_phandle_with_args(np, "pwms", "#pwm-cells", index, in of_pwm_get()
711 if (PTR_ERR(chip) != -EPROBE_DEFER) in of_pwm_get()
712 pr_err("%s(): PWM chip not found\n", __func__); in of_pwm_get()
714 pwm = ERR_CAST(chip); in of_pwm_get()
718 pwm = chip->of_xlate(chip, &args); in of_pwm_get()
719 if (IS_ERR(pwm)) in of_pwm_get()
722 dl = pwm_device_link_add(dev, pwm); in of_pwm_get()
725 pwm_put(pwm); in of_pwm_get()
726 pwm = ERR_CAST(dl); in of_pwm_get()
732 * "pwm-names" property if it exists. Otherwise use the name of in of_pwm_get()
736 err = of_property_read_string_index(np, "pwm-names", index, in of_pwm_get()
738 if (err < 0) in of_pwm_get()
739 con_id = np->name; in of_pwm_get()
742 pwm->label = con_id; in of_pwm_get()
747 return pwm; in of_pwm_get()
751 * acpi_pwm_get() - request a PWM via parsing "pwms" property in ACPI
754 * Returns the PWM device parsed from the fwnode and index specified in the
755 * "pwms" property or a negative error-code on failure.
756 * Values parsed from the device tree are stored in the returned PWM device
762 * { <PWM device reference>, <PWM index>, <PWM period> [, <PWM flags>]}}
764 * Returns: A pointer to the requested PWM device or an ERR_PTR()-encoded
769 struct pwm_device *pwm; in acpi_pwm_get() local
774 memset(&args, 0, sizeof(args)); in acpi_pwm_get()
776 ret = __acpi_node_get_property_reference(fwnode, "pwms", 0, 3, &args); in acpi_pwm_get()
777 if (ret < 0) in acpi_pwm_get()
781 return ERR_PTR(-EPROTO); in acpi_pwm_get()
787 pwm = pwm_request_from_chip(chip, args.args[0], NULL); in acpi_pwm_get()
788 if (IS_ERR(pwm)) in acpi_pwm_get()
789 return pwm; in acpi_pwm_get()
791 pwm->args.period = args.args[1]; in acpi_pwm_get()
792 pwm->args.polarity = PWM_POLARITY_NORMAL; in acpi_pwm_get()
795 pwm->args.polarity = PWM_POLARITY_INVERSED; in acpi_pwm_get()
797 return pwm; in acpi_pwm_get()
801 * pwm_add_table() - register PWM device consumers
809 while (num--) { in pwm_add_table()
810 list_add_tail(&table->list, &pwm_lookup_list); in pwm_add_table()
818 * pwm_remove_table() - unregister PWM device consumers
826 while (num--) { in pwm_remove_table()
827 list_del(&table->list); in pwm_remove_table()
835 * pwm_get() - look up and request a PWM device
836 * @dev: device for PWM consumer
840 * a device tree, a PWM chip and a relative index is looked up via a table
843 * Once a PWM chip has been found the specified PWM device will be requested
846 * Returns: A pointer to the requested PWM device or an ERR_PTR()-encoded
853 struct pwm_device *pwm; in pwm_get() local
856 unsigned int best = 0; in pwm_get()
867 pwm = acpi_pwm_get(fwnode); in pwm_get()
868 if (!IS_ERR(pwm) || PTR_ERR(pwm) != -ENOENT) in pwm_get()
869 return pwm; in pwm_get()
879 * If a match is found, the provider PWM chip is looked up by name in pwm_get()
880 * and a PWM device is requested using the PWM device per-chip index. in pwm_get()
889 * Then we take the most specific entry - with the following order in pwm_get()
895 match = 0; in pwm_get()
897 if (p->dev_id) { in pwm_get()
898 if (!dev_id || strcmp(p->dev_id, dev_id)) in pwm_get()
904 if (p->con_id) { in pwm_get()
905 if (!con_id || strcmp(p->con_id, con_id)) in pwm_get()
924 return ERR_PTR(-ENODEV); in pwm_get()
926 chip = pwmchip_find_by_name(chosen->provider); in pwm_get()
930 * the PWM chip lookup. This can be used to work around driver load in pwm_get()
934 if (!chip && chosen->module) { in pwm_get()
935 err = request_module(chosen->module); in pwm_get()
936 if (err == 0) in pwm_get()
937 chip = pwmchip_find_by_name(chosen->provider); in pwm_get()
941 return ERR_PTR(-EPROBE_DEFER); in pwm_get()
943 pwm = pwm_request_from_chip(chip, chosen->index, con_id ?: dev_id); in pwm_get()
944 if (IS_ERR(pwm)) in pwm_get()
945 return pwm; in pwm_get()
947 dl = pwm_device_link_add(dev, pwm); in pwm_get()
949 pwm_put(pwm); in pwm_get()
953 pwm->args.period = chosen->period; in pwm_get()
954 pwm->args.polarity = chosen->polarity; in pwm_get()
956 return pwm; in pwm_get()
961 * pwm_put() - release a PWM device
962 * @pwm: PWM device
964 void pwm_put(struct pwm_device *pwm) in pwm_put() argument
966 if (!pwm) in pwm_put()
971 if (!test_and_clear_bit(PWMF_REQUESTED, &pwm->flags)) { in pwm_put()
972 pr_warn("PWM device already freed\n"); in pwm_put()
976 if (pwm->chip->ops->free) in pwm_put()
977 pwm->chip->ops->free(pwm->chip, pwm); in pwm_put()
979 pwm_set_chip_data(pwm, NULL); in pwm_put()
980 pwm->label = NULL; in pwm_put()
982 module_put(pwm->chip->ops->owner); in pwm_put()
988 static void devm_pwm_release(void *pwm) in devm_pwm_release() argument
990 pwm_put(pwm); in devm_pwm_release()
994 * devm_pwm_get() - resource managed pwm_get()
995 * @dev: device for PWM consumer
998 * This function performs like pwm_get() but the acquired PWM device will
1001 * Returns: A pointer to the requested PWM device or an ERR_PTR()-encoded
1006 struct pwm_device *pwm; in devm_pwm_get() local
1009 pwm = pwm_get(dev, con_id); in devm_pwm_get()
1010 if (IS_ERR(pwm)) in devm_pwm_get()
1011 return pwm; in devm_pwm_get()
1013 ret = devm_add_action_or_reset(dev, devm_pwm_release, pwm); in devm_pwm_get()
1017 return pwm; in devm_pwm_get()
1022 * devm_fwnode_pwm_get() - request a resource managed PWM from firmware node
1023 * @dev: device for PWM consumer
1024 * @fwnode: firmware node to get the PWM from
1027 * Returns the PWM device parsed from the firmware node. See of_pwm_get() and
1030 * Returns: A pointer to the requested PWM device or an ERR_PTR()-encoded
1037 struct pwm_device *pwm = ERR_PTR(-ENODEV); in devm_fwnode_pwm_get() local
1041 pwm = of_pwm_get(dev, to_of_node(fwnode), con_id); in devm_fwnode_pwm_get()
1043 pwm = acpi_pwm_get(fwnode); in devm_fwnode_pwm_get()
1044 if (IS_ERR(pwm)) in devm_fwnode_pwm_get()
1045 return pwm; in devm_fwnode_pwm_get()
1047 ret = devm_add_action_or_reset(dev, devm_pwm_release, pwm); in devm_fwnode_pwm_get()
1051 return pwm; in devm_fwnode_pwm_get()
1060 for (i = 0; i < chip->npwm; i++) { in pwm_dbg_show()
1061 struct pwm_device *pwm = &chip->pwms[i]; in pwm_dbg_show() local
1064 pwm_get_state(pwm, &state); in pwm_dbg_show()
1066 seq_printf(s, " pwm-%-3d (%-20.20s):", i, pwm->label); in pwm_dbg_show()
1068 if (test_bit(PWMF_REQUESTED, &pwm->flags)) in pwm_dbg_show()
1089 s->private = ""; in pwm_seq_start()
1096 s->private = "\n"; in pwm_seq_next()
1110 seq_printf(s, "%s%s/%s, %d PWM device%s\n", (char *)s->private, in pwm_seq_show()
1111 chip->dev->bus ? chip->dev->bus->name : "no-bus", in pwm_seq_show()
1112 dev_name(chip->dev), chip->npwm, in pwm_seq_show()
1113 (chip->npwm != 1) ? "s" : ""); in pwm_seq_show()
1117 return 0; in pwm_seq_show()
1131 debugfs_create_file("pwm", 0444, NULL, NULL, &pwm_debugfs_fops); in pwm_debugfs_init()
1133 return 0; in pwm_debugfs_init()