pwm: Convert period and duty to unsigned int

We don't need a 64 bits value to store nanoseconds

Discused with:	ian, jhibbits
This commit is contained in:
Emmanuel Vadot 2018-12-14 18:37:26 +00:00
parent 8b2de3f0d4
commit 6a9997ed67
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=342087
6 changed files with 19 additions and 19 deletions

View File

@ -87,8 +87,8 @@ struct aw_pwm_softc {
struct resource *res;
uint64_t clk_freq;
uint64_t period;
uint64_t duty;
unsigned int period;
unsigned int duty;
uint32_t flags;
bool enabled;
};
@ -191,7 +191,7 @@ aw_pwm_channel_max(device_t dev, int *nchannel)
}
static int
aw_pwm_channel_config(device_t dev, int channel, uint64_t period, uint64_t duty)
aw_pwm_channel_config(device_t dev, int channel, unsigned int period, unsigned int duty)
{
struct aw_pwm_softc *sc;
uint64_t period_freq, duty_freq;
@ -254,7 +254,7 @@ aw_pwm_channel_config(device_t dev, int channel, uint64_t period, uint64_t duty)
}
static int
aw_pwm_channel_get_config(device_t dev, int channel, uint64_t *period, uint64_t *duty)
aw_pwm_channel_get_config(device_t dev, int channel, unsigned int *period, unsigned int *duty)
{
struct aw_pwm_softc *sc;

View File

@ -46,8 +46,8 @@ METHOD device_t get_bus {
METHOD int channel_config {
device_t dev;
int channel;
uint64_t period;
uint64_t duty;
unsigned int period;
unsigned duty;
};
#
@ -57,8 +57,8 @@ METHOD int channel_config {
METHOD int channel_get_config {
device_t dev;
int channel;
uint64_t *period;
uint64_t *duty;
unsigned int *period;
unsigned int *duty;
};
#

View File

@ -138,7 +138,7 @@ pwmbus_detach(device_t dev)
}
static int
pwmbus_channel_config(device_t bus, int channel, uint64_t period, uint64_t duty)
pwmbus_channel_config(device_t bus, int channel, unsigned int period, unsigned int duty)
{
struct pwmbus_softc *sc;
@ -151,7 +151,7 @@ pwmbus_channel_config(device_t bus, int channel, uint64_t period, uint64_t duty)
}
static int
pwmbus_channel_get_config(device_t bus, int channel, uint64_t *period, uint64_t *duty)
pwmbus_channel_get_config(device_t bus, int channel, unsigned int *period, unsigned int *duty)
{
struct pwmbus_softc *sc;

View File

@ -59,8 +59,8 @@ HEADER {
METHOD int channel_config {
device_t bus;
int channel;
uint64_t period;
uint64_t duty;
unsigned int period;
unsigned int duty;
};
#
@ -70,8 +70,8 @@ METHOD int channel_config {
METHOD int channel_get_config {
device_t bus;
int channel;
uint64_t *period;
uint64_t *duty;
unsigned int *period;
unsigned int *duty;
};
#

View File

@ -35,8 +35,8 @@
struct pwm_state {
int channel;
uint64_t period;
uint64_t duty;
unsigned int period;
unsigned int duty;
uint32_t flags;
bool enable;
};

View File

@ -190,9 +190,9 @@ main(int argc, char *argv[])
}
break;
case PWM_SHOW_CONFIG:
printf("period: %ju\nduty: %ju\nenabled:%d\n",
(uintmax_t) state.period,
(uintmax_t) state.duty,
printf("period: %u\nduty: %u\nenabled:%d\n",
state.period,
state.duty,
state.enable);
break;
case PWM_PERIOD: