File: pwm-internal.h

package info (click to toggle)
libpwm 1.0~rc2-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 1,596 kB
  • sloc: sh: 4,443; ansic: 859; makefile: 58
file content (24 lines) | stat: -rw-r--r-- 864 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* SPDX-License-Identifier: LGPL-2.1-only */
/* SPDX-FileCopyrightText: 2023-2025 Uwe Kleine-König <u.kleine-koenig@baylibre.com> */

#include <pwm.h>

#define container_of(ptr, type, member) ({				\
	(type *)((void *)(ptr) - __builtin_offsetof(type, member)); })

struct pwm_chip {
	unsigned int npwm;
	void (*close)(struct pwm_chip *chip);
	struct pwm *(*get_pwm)(struct pwm_chip *chip, unsigned int offset);
	int (*round_waveform)(struct pwm *pwm, struct pwm_waveform *wf);
	int (*set_waveform)(struct pwm *pwm, const struct pwm_waveform *wf);
	int (*set_waveform_exact)(struct pwm *pwm, const struct pwm_waveform *wf);
	int (*get_waveform)(struct pwm *pwm, struct pwm_waveform *wf);
};

struct pwm {
	struct pwm_chip *chip;
};

struct pwm_chip *pwm_chip_cdev_open_by_number(unsigned int num);
struct pwm_chip *pwm_chip_sysfs_open_by_number(unsigned int num);