diff --git a/sys/dev/pwm/pwmc.c b/sys/dev/pwm/pwmc.c index 06ec1926fe26..a0621ebf32ab 100644 --- a/sys/dev/pwm/pwmc.c +++ b/sys/dev/pwm/pwmc.c @@ -71,18 +71,12 @@ pwm_ioctl(struct cdev *dev, u_long cmd, caddr_t data, struct pwmc_softc *sc; struct pwm_state state; device_t bus; - u_int nchannel; int rv = 0; sc = dev->si_drv1; bus = device_get_parent(sc->dev); switch (cmd) { - case PWMMAXCHANNEL: - nchannel = 0; - rv = PWMBUS_CHANNEL_COUNT(bus, &nchannel); - bcopy(&nchannel, data, sizeof(nchannel)); - break; case PWMSETSTATE: bcopy(data, &state, sizeof(state)); rv = PWMBUS_CHANNEL_CONFIG(bus, sc->chan, diff --git a/sys/dev/pwm/pwmc.h b/sys/dev/pwm/pwmc.h index 05832a9f318c..333243e941a7 100644 --- a/sys/dev/pwm/pwmc.h +++ b/sys/dev/pwm/pwmc.h @@ -34,7 +34,6 @@ #define PWM_POLARITY_INVERTED (1 << 0) struct pwm_state { - u_int channel; u_int period; u_int duty; uint32_t flags; @@ -45,9 +44,8 @@ struct pwm_state { * ioctls */ -#define PWMMAXCHANNEL _IOWR('G', 0, int) -#define PWMGETSTATE _IOWR('G', 1, struct pwm_state) -#define PWMSETSTATE _IOWR('G', 2, struct pwm_state) +#define PWMGETSTATE _IOWR('G', 0, struct pwm_state) +#define PWMSETSTATE _IOWR('G', 1, struct pwm_state) #endif /* _PWM_H_ */ diff --git a/usr.sbin/pwm/pwm.8 b/usr.sbin/pwm/pwm.8 index 9417c9525864..ec204547dc5e 100644 --- a/usr.sbin/pwm/pwm.8 +++ b/usr.sbin/pwm/pwm.8 @@ -31,23 +31,18 @@ .Sh SYNOPSIS .Nm .Op Fl f Ar device -.Fl c Ar channel .Fl E .Nm .Op Fl f Ar device -.Fl c Ar channel .Fl D .Nm .Op Fl f Ar device -.Fl c Ar channel .Fl C .Nm .Op Fl f Ar device -.Fl c Ar channel .Fl p Ar period .Nm .Op Fl f Ar device -.Fl c Ar channel .Fl d Ar duty .Sh DESCRIPTION The @@ -55,9 +50,7 @@ The utility can be used to configure pwm controllers. .Pp The options are as follow: -.Bl -tag -width "-c channel" -.It Fl c Ar channel -Channel number to operate on. +.Bl -tag -width "-f device" .It Fl f Ar device Device to operate on. If not specified, diff --git a/usr.sbin/pwm/pwm.c b/usr.sbin/pwm/pwm.c index 3d3de2018979..371cf283200d 100644 --- a/usr.sbin/pwm/pwm.c +++ b/usr.sbin/pwm/pwm.c @@ -66,11 +66,11 @@ static void usage(void) { fprintf(stderr, "Usage:\n"); - fprintf(stderr, "\tpwm [-f dev] -c channel -E\n"); - fprintf(stderr, "\tpwm [-f dev] -c channel -D\n"); - fprintf(stderr, "\tpwm [-f dev] -c channel -C\n"); - fprintf(stderr, "\tpwm [-f dev] -c channel -p period\n"); - fprintf(stderr, "\tpwm [-f dev] -c channel -d duty\n"); + fprintf(stderr, "\tpwm [-f dev] -E\n"); + fprintf(stderr, "\tpwm [-f dev] -D\n"); + fprintf(stderr, "\tpwm [-f dev] -C\n"); + fprintf(stderr, "\tpwm [-f dev] -p period\n"); + fprintf(stderr, "\tpwm [-f dev] -d duty\n"); exit(1); } @@ -79,21 +79,19 @@ main(int argc, char *argv[]) { struct pwm_state state; int fd; - u_int channel, nchannels; int period, duty; int action, ch; cap_rights_t right_ioctl; - const unsigned long pwm_ioctls[] = {PWMGETSTATE, PWMSETSTATE, PWMMAXCHANNEL}; + const unsigned long pwm_ioctls[] = {PWMGETSTATE, PWMSETSTATE}; char *percent; bool setname; action = 0; setname = false; fd = -1; - channel = -1u; period = duty = -1; - while ((ch = getopt(argc, argv, "f:c:EDCp:d:")) != -1) { + while ((ch = getopt(argc, argv, "f:EDCp:d:")) != -1) { switch (ch) { case 'E': if (action) @@ -124,15 +122,13 @@ main(int argc, char *argv[]) if (*percent != '\0' && *percent != '%') usage(); break; - case 'c': - if (channel != -1u) - usage(); - channel = strtoul(optarg, NULL, 10); - break; case 'f': setname = true; set_device_name(optarg); break; + case '?': + usage(); + break; } } @@ -167,19 +163,7 @@ main(int argc, char *argv[]) goto fail; } - /* Check if the channel is correct */ - if (ioctl(fd, PWMMAXCHANNEL, &nchannels) == -1) { - fprintf(stderr, "ioctl: %s\n", strerror(errno)); - goto fail; - } - if (channel > nchannels) { - fprintf(stderr, "pwm controller only support %d channels\n", - nchannels); - goto fail; - } - /* Fill the common args */ - state.channel = channel; if (ioctl(fd, PWMGETSTATE, &state) == -1) { fprintf(stderr, "Cannot get current state of the pwm controller\n"); goto fail;