/kernel/linux/linux-6.6/drivers/pwm/ |
H A D | pwm-raspberrypi-poe.c | 8 * - No disable bit, so a disabled PWM is simulated by duty_cycle 0 31 unsigned int duty_cycle; member 92 state->duty_cycle = DIV_ROUND_UP(rpipwm->duty_cycle * RPI_PWM_PERIOD_NS, in raspberrypi_pwm_get_state() 94 state->enabled = !!(rpipwm->duty_cycle); in raspberrypi_pwm_get_state() 104 unsigned int duty_cycle; in raspberrypi_pwm_apply() local 112 duty_cycle = 0; in raspberrypi_pwm_apply() 113 else if (state->duty_cycle < RPI_PWM_PERIOD_NS) in raspberrypi_pwm_apply() 114 duty_cycle = DIV_ROUND_DOWN_ULL(state->duty_cycle * RPI_PWM_MAX_DUT in raspberrypi_pwm_apply() [all...] |
H A D | pwm-visconti.c | 50 u32 period, duty_cycle, pwmc0; in visconti_pwm_apply() local 68 if (state->duty_cycle > period) in visconti_pwm_apply() 69 duty_cycle = period; in visconti_pwm_apply() 71 duty_cycle = state->duty_cycle; in visconti_pwm_apply() 79 duty_cycle /= 1000; in visconti_pwm_apply() 95 duty_cycle >>= pwmc0; in visconti_pwm_apply() 100 writel(duty_cycle, priv->base + PIPGM_PDUT(pwm->hwpwm)); in visconti_pwm_apply() 118 state->duty_cycle = (duty << pwmc0_clk) * NSEC_PER_USEC; in visconti_pwm_get_state()
|
H A D | core.c | 413 * best effort inverted .polarity and fixed .duty_cycle respectively. in pwm_apply_state_debug() 418 s2.duty_cycle = s1.period - s1.duty_cycle; in pwm_apply_state_debug() 426 state->duty_cycle < state->period) in pwm_apply_state_debug() 445 last->duty_cycle > s2.duty_cycle && in pwm_apply_state_debug() 446 last->duty_cycle <= state->duty_cycle) in pwm_apply_state_debug() 449 state->duty_cycle, state->period, in pwm_apply_state_debug() 450 s2.duty_cycle, s in pwm_apply_state_debug() [all...] |
H A D | pwm-cros-ec.c | 35 * @duty_cycle: cached duty cycle 38 u16 duty_cycle; member 162 u16 duty_cycle; in cros_ec_pwm_apply() local 176 duty_cycle = state->enabled ? state->duty_cycle : 0; in cros_ec_pwm_apply() 178 ret = cros_ec_pwm_set_duty(ec_pwm, pwm->hwpwm, duty_cycle); in cros_ec_pwm_apply() 182 channel->duty_cycle = state->duty_cycle; in cros_ec_pwm_apply() 210 * For the case of the initial hardware readout, channel->duty_cycle in cros_ec_pwm_get_state() 213 if (ret == 0 && channel->duty_cycle > in cros_ec_pwm_get_state() [all...] |
H A D | pwm-twl-led.c | 22 * - A request for .duty_cycle = 0 results in an output wave with one active 77 int duty_cycle = DIV_ROUND_UP(duty_ns * TWL4030_LED_MAX, period_ns) + 1; in twl4030_pwmled_config() local 92 if (duty_cycle == 1) in twl4030_pwmled_config() 93 duty_cycle = 2; in twl4030_pwmled_config() 94 else if (duty_cycle > TWL4030_LED_MAX) in twl4030_pwmled_config() 95 duty_cycle = 1; in twl4030_pwmled_config() 99 pwm_config[1] = duty_cycle; in twl4030_pwmled_config() 173 * pwm->state.period && state->duty_cycle == pwm->state.duty_cycle in twl4030_pwmled_apply() 179 state->duty_cycle, stat in twl4030_pwmled_apply() 198 int duty_cycle = (duty_ns * TWL6030_LED_MAX) / period_ns; twl6030_pwmled_config() local [all...] |
H A D | pwm-sl28cpld.c | 75 #define SL28CPLD_PWM_FROM_DUTY_CYCLE(duty_cycle) \ 76 (DIV_ROUND_DOWN_ULL((duty_cycle), NSEC_PER_SEC / SL28CPLD_PWM_CLK)) 110 state->duty_cycle = SL28CPLD_PWM_TO_DUTY_CYCLE(reg); in sl28cpld_pwm_get_state() 115 * might happen that we calculate a duty_cycle greater than the actual in sl28cpld_pwm_get_state() 121 state->duty_cycle = min(state->duty_cycle, state->period); in sl28cpld_pwm_get_state() 153 cycle = SL28CPLD_PWM_FROM_DUTY_CYCLE(state->duty_cycle); in sl28cpld_pwm_apply()
|
H A D | pwm-clk.c | 45 u64 duty_cycle = state->duty_cycle; in pwm_clk_apply() local 61 * We have to enable the clk before setting the rate and duty_cycle, in pwm_clk_apply() 63 * (potentially) different setting. Also setting period and duty_cycle in pwm_clk_apply() 73 duty_cycle = period - duty_cycle; in pwm_clk_apply() 75 return clk_set_duty_cycle(pcchip->clk, duty_cycle, period); in pwm_clk_apply()
|
H A D | pwm-twl.c | 63 int duty_cycle = DIV64_U64_ROUND_UP(duty_ns * TWL_PWM_MAX, period_ns) + 1; in twl_pwm_config() local 78 if (duty_cycle == 1) in twl_pwm_config() 79 duty_cycle = 2; in twl_pwm_config() 80 else if (duty_cycle > TWL_PWM_MAX) in twl_pwm_config() 81 duty_cycle = 1; in twl_pwm_config() 85 pwm_config[1] = duty_cycle; in twl_pwm_config() 297 err = twl_pwm_config(pwm->chip, pwm, state->duty_cycle, state->period); in twl4030_pwm_apply() 322 err = twl_pwm_config(pwm->chip, pwm, state->duty_cycle, state->period); in twl6030_pwm_apply()
|
/kernel/linux/linux-5.10/drivers/pwm/ |
H A D | pwm-cros-ec.c | 30 * @duty_cycle: cached duty cycle 33 u16 duty_cycle; member 120 u16 duty_cycle; in cros_ec_pwm_apply() local 131 duty_cycle = state->enabled ? state->duty_cycle : 0; in cros_ec_pwm_apply() 133 ret = cros_ec_pwm_set_duty(ec_pwm->ec, pwm->hwpwm, duty_cycle); in cros_ec_pwm_apply() 137 channel->duty_cycle = state->duty_cycle; in cros_ec_pwm_apply() 165 * For the case of the initial hardware readout, channel->duty_cycle in cros_ec_pwm_get_state() 168 if (ret == 0 && channel->duty_cycle > in cros_ec_pwm_get_state() [all...] |
H A D | core.c | 492 * best effort inverted .polarity and fixed .duty_cycle respectively. in pwm_apply_state_debug() 497 s2.duty_cycle = s1.period - s1.duty_cycle; in pwm_apply_state_debug() 505 state->duty_cycle < state->period) in pwm_apply_state_debug() 524 last->duty_cycle > s2.duty_cycle && in pwm_apply_state_debug() 525 last->duty_cycle <= state->duty_cycle) in pwm_apply_state_debug() 528 state->duty_cycle, state->period, in pwm_apply_state_debug() 529 s2.duty_cycle, s in pwm_apply_state_debug() [all...] |
H A D | pwm-twl-led.c | 61 int duty_cycle = DIV_ROUND_UP(duty_ns * TWL4030_LED_MAX, period_ns) + 1; in twl4030_pwmled_config() local 76 if (duty_cycle == 1) in twl4030_pwmled_config() 77 duty_cycle = 2; in twl4030_pwmled_config() 78 else if (duty_cycle > TWL4030_LED_MAX) in twl4030_pwmled_config() 79 duty_cycle = 1; in twl4030_pwmled_config() 83 pwm_config[1] = duty_cycle; in twl4030_pwmled_config() 143 int duty_cycle = (duty_ns * TWL6030_LED_MAX) / period_ns; in twl6030_pwmled_config() local 147 on_time = duty_cycle & 0xff; in twl6030_pwmled_config()
|
H A D | pwm-sl28cpld.c | 74 #define SL28CPLD_PWM_FROM_DUTY_CYCLE(duty_cycle) \ 75 (DIV_ROUND_DOWN_ULL((duty_cycle), NSEC_PER_SEC / SL28CPLD_PWM_CLK)) 106 state->duty_cycle = SL28CPLD_PWM_TO_DUTY_CYCLE(reg); in sl28cpld_pwm_get_state() 111 * might happen that we calculate a duty_cycle greater than the actual in sl28cpld_pwm_get_state() 117 state->duty_cycle = min(state->duty_cycle, state->period); in sl28cpld_pwm_get_state() 147 cycle = SL28CPLD_PWM_FROM_DUTY_CYCLE(state->duty_cycle); in sl28cpld_pwm_apply()
|
/kernel/linux/linux-5.10/include/linux/ |
H A D | pwm.h | 54 * @duty_cycle: PWM duty cycle (in nanoseconds) 60 u64 duty_cycle; member 128 pwm->state.duty_cycle = duty; in pwm_set_duty_cycle() 137 return state.duty_cycle; in pwm_get_duty_cycle() 164 * Once the function returns, you can adjust the ->enabled and ->duty_cycle 167 * ->duty_cycle is initially set to zero to avoid cases where the current 168 * ->duty_cycle value exceed the pwm_args->period one, which would trigger 169 * an error if the user calls pwm_apply_state() without adjusting ->duty_cycle 185 state->duty_cycle = 0; in pwm_init_state() 196 * For example if you want to get the duty_cycle expresse 230 pwm_set_relative_duty_cycle(struct pwm_state *state, unsigned int duty_cycle, unsigned int scale) pwm_set_relative_duty_cycle() argument 311 unsigned int duty_cycle; global() member [all...] |
/kernel/linux/linux-6.6/include/linux/ |
H A D | pwm.h | 51 * @duty_cycle: PWM duty cycle (in nanoseconds) 61 u64 duty_cycle; member 135 pwm->state.duty_cycle = duty; in pwm_set_duty_cycle() 144 return state.duty_cycle; in pwm_get_duty_cycle() 171 * Once the function returns, you can adjust the ->enabled and ->duty_cycle 174 * ->duty_cycle is initially set to zero to avoid cases where the current 175 * ->duty_cycle value exceed the pwm_args->period one, which would trigger 176 * an error if the user calls pwm_apply_state() without adjusting ->duty_cycle 192 state->duty_cycle = 0; in pwm_init_state() 204 * For example if you want to get the duty_cycle expresse 238 pwm_set_relative_duty_cycle(struct pwm_state *state, unsigned int duty_cycle, unsigned int scale) pwm_set_relative_duty_cycle() argument 258 unsigned int duty_cycle; global() member [all...] |
/kernel/linux/linux-5.10/drivers/media/rc/ |
H A D | gpio-ir-tx.c | 21 unsigned int duty_cycle; member 30 static int gpio_ir_tx_set_duty_cycle(struct rc_dev *dev, u32 duty_cycle) in gpio_ir_tx_set_duty_cycle() argument 34 gpio_ir->duty_cycle = duty_cycle; in gpio_ir_tx_set_duty_cycle() 103 pulse = DIV_ROUND_CLOSEST(gpio_ir->duty_cycle * (NSEC_PER_SEC / 100), in gpio_ir_tx_modulated() 105 space = DIV_ROUND_CLOSEST((100 - gpio_ir->duty_cycle) * in gpio_ir_tx_modulated() 187 gpio_ir->duty_cycle = 50; in gpio_ir_tx_probe()
|
H A D | pwm-ir-tx.c | 21 unsigned int duty_cycle; member 30 static int pwm_ir_set_duty_cycle(struct rc_dev *dev, u32 duty_cycle) in pwm_ir_set_duty_cycle() argument 34 pwm_ir->duty_cycle = duty_cycle; in pwm_ir_set_duty_cycle() 61 duty = DIV_ROUND_CLOSEST(pwm_ir->duty_cycle * period, 100); in pwm_ir_tx() 99 pwm_ir->duty_cycle = 50; in pwm_ir_probe()
|
H A D | rc-loopback.c | 62 static int loop_set_tx_duty_cycle(struct rc_dev *dev, u32 duty_cycle) in loop_set_tx_duty_cycle() argument 66 if (duty_cycle < 1 || duty_cycle > 99) { in loop_set_tx_duty_cycle() 67 dprintk("invalid duty cycle: %u\n", duty_cycle); in loop_set_tx_duty_cycle() 71 dprintk("setting duty cycle: %u\n", duty_cycle); in loop_set_tx_duty_cycle() 72 lodev->txduty = duty_cycle; in loop_set_tx_duty_cycle()
|
/kernel/linux/linux-6.6/drivers/media/rc/ |
H A D | gpio-ir-tx.c | 21 unsigned int duty_cycle; member 30 static int gpio_ir_tx_set_duty_cycle(struct rc_dev *dev, u32 duty_cycle) in gpio_ir_tx_set_duty_cycle() argument 34 gpio_ir->duty_cycle = duty_cycle; in gpio_ir_tx_set_duty_cycle() 108 pulse = DIV_ROUND_CLOSEST(gpio_ir->duty_cycle * (NSEC_PER_SEC / 100), in gpio_ir_tx_modulated() 110 space = DIV_ROUND_CLOSEST((100 - gpio_ir->duty_cycle) * in gpio_ir_tx_modulated() 189 gpio_ir->duty_cycle = 50; in gpio_ir_tx_probe()
|
H A D | pwm-ir-tx.c | 21 unsigned int duty_cycle; member 30 static int pwm_ir_set_duty_cycle(struct rc_dev *dev, u32 duty_cycle) in pwm_ir_set_duty_cycle() argument 34 pwm_ir->duty_cycle = duty_cycle; in pwm_ir_set_duty_cycle() 64 pwm_set_relative_duty_cycle(&state, pwm_ir->duty_cycle, 100); in pwm_ir_tx() 99 pwm_ir->duty_cycle = 50; in pwm_ir_probe()
|
H A D | rc-loopback.c | 59 static int loop_set_tx_duty_cycle(struct rc_dev *dev, u32 duty_cycle) in loop_set_tx_duty_cycle() argument 63 if (duty_cycle < 1 || duty_cycle > 99) { in loop_set_tx_duty_cycle() 64 dev_dbg(&dev->dev, "invalid duty cycle: %u\n", duty_cycle); in loop_set_tx_duty_cycle() 68 dev_dbg(&dev->dev, "setting duty cycle: %u\n", duty_cycle); in loop_set_tx_duty_cycle() 69 lodev->txduty = duty_cycle; in loop_set_tx_duty_cycle()
|
/kernel/linux/linux-5.10/include/trace/events/ |
H A D | pwm.h | 20 __field(u64, duty_cycle) 28 __entry->duty_cycle = state->duty_cycle; 33 TP_printk("%p: period=%llu duty_cycle=%llu polarity=%d enabled=%d", 34 __entry->pwm, __entry->period, __entry->duty_cycle,
|
/kernel/linux/linux-6.6/include/trace/events/ |
H A D | pwm.h | 20 __field(u64, duty_cycle) 29 __entry->duty_cycle = state->duty_cycle; 35 TP_printk("%p: period=%llu duty_cycle=%llu polarity=%d enabled=%d err=%d", 36 __entry->pwm, __entry->period, __entry->duty_cycle,
|
/kernel/linux/linux-5.10/drivers/leds/ |
H A D | leds-lp3944.c | 130 * @duty_cycle: percentage of a period during which a led is ON 133 u8 duty_cycle) in lp3944_dim_set_dutycycle() 147 if (duty_cycle > LP3944_DUTY_CYCLE_MAX) in lp3944_dim_set_dutycycle() 150 pwm_value = (duty_cycle * 255) / LP3944_DUTY_CYCLE_MAX; in lp3944_dim_set_dutycycle() 229 u8 duty_cycle; in lp3944_led_set_blink() local 247 /* duty_cycle is the percentage of period during which the led is ON */ in lp3944_led_set_blink() 248 duty_cycle = 100 * (*delay_on) / period; in lp3944_led_set_blink() 254 duty_cycle = 100 - duty_cycle; in lp3944_led_set_blink() 267 err = lp3944_dim_set_dutycycle(led->client, LP3944_DIM0, duty_cycle); in lp3944_led_set_blink() 132 lp3944_dim_set_dutycycle(struct i2c_client *client, u8 dim, u8 duty_cycle) lp3944_dim_set_dutycycle() argument [all...] |
/kernel/linux/linux-6.6/drivers/leds/ |
H A D | leds-lp3944.c | 130 * @duty_cycle: percentage of a period during which a led is ON 133 u8 duty_cycle) in lp3944_dim_set_dutycycle() 147 if (duty_cycle > LP3944_DUTY_CYCLE_MAX) in lp3944_dim_set_dutycycle() 150 pwm_value = (duty_cycle * 255) / LP3944_DUTY_CYCLE_MAX; in lp3944_dim_set_dutycycle() 229 u8 duty_cycle; in lp3944_led_set_blink() local 247 /* duty_cycle is the percentage of period during which the led is ON */ in lp3944_led_set_blink() 248 duty_cycle = 100 * (*delay_on) / period; in lp3944_led_set_blink() 254 duty_cycle = 100 - duty_cycle; in lp3944_led_set_blink() 267 err = lp3944_dim_set_dutycycle(led->client, LP3944_DIM0, duty_cycle); in lp3944_led_set_blink() 132 lp3944_dim_set_dutycycle(struct i2c_client *client, u8 dim, u8 duty_cycle) lp3944_dim_set_dutycycle() argument [all...] |
/kernel/linux/linux-6.6/drivers/video/backlight/ |
H A D | pwm_bl.c | 80 u64 duty_cycle; in compute_duty_cycle() local 83 duty_cycle = pb->levels[brightness]; in compute_duty_cycle() 85 duty_cycle = brightness; in compute_duty_cycle() 87 duty_cycle *= state->period - lth; in compute_duty_cycle() 88 do_div(duty_cycle, pb->scale); in compute_duty_cycle() 90 return duty_cycle + lth; in compute_duty_cycle() 104 state.duty_cycle = compute_duty_cycle(pb, brightness, &state); in pwm_backlight_update_status() 113 state.duty_cycle = 0; in pwm_backlight_update_status() 634 state.duty_cycle = 0; in pwm_backlight_remove() 650 state.duty_cycle in pwm_backlight_shutdown() [all...] |