/drivers/gpu/drm/nouveau/nvkm/subdev/therm/ |
D | fanpwm.c | 44 u32 divs, duty; in nvkm_fanpwm_get() local 47 ret = therm->func->pwm_get(therm, fan->func.line, &divs, &duty); in nvkm_fanpwm_get() 49 divs = max(divs, duty); in nvkm_fanpwm_get() 51 duty = divs - duty; in nvkm_fanpwm_get() 52 return (duty * 100) / divs; in nvkm_fanpwm_get() 63 u32 divs, duty; in nvkm_fanpwm_set() local 74 duty = ((divs * percent) + 99) / 100; in nvkm_fanpwm_set() 76 duty = divs - duty; in nvkm_fanpwm_set() 78 ret = therm->func->pwm_set(therm, fan->func.line, divs, duty); in nvkm_fanpwm_set() 91 u32 divs, duty; in nvkm_fanpwm_create() local [all …]
|
D | fan.c | 39 int duty; in nvkm_fan_update() local 53 duty = fan->get(therm); in nvkm_fan_update() 54 if (duty == target) { in nvkm_fan_update() 60 if (!immediate && duty >= 0) { in nvkm_fan_update() 65 if (duty < target) in nvkm_fan_update() 66 duty = min(duty + 3, target); in nvkm_fan_update() 67 else if (duty > target) in nvkm_fan_update() 68 duty = max(duty - 3, target); in nvkm_fan_update() 70 duty = target; in nvkm_fan_update() 73 nvkm_debug(subdev, "FAN update: %d\n", duty); in nvkm_fan_update() [all …]
|
D | base.c | 44 u16 duty, i; in nvkm_therm_update_trip() local 59 duty = cur_trip->fan_duty; in nvkm_therm_update_trip() 62 duty = 0; in nvkm_therm_update_trip() 66 return duty; in nvkm_therm_update_trip() 74 u16 duty; in nvkm_therm_compute_linear_duty() local 83 duty = (temp - linear_min_temp); in nvkm_therm_compute_linear_duty() 84 duty *= (therm->fan->bios.max_duty - therm->fan->bios.min_duty); in nvkm_therm_compute_linear_duty() 85 duty /= (linear_max_temp - linear_min_temp); in nvkm_therm_compute_linear_duty() 86 duty += therm->fan->bios.min_duty; in nvkm_therm_compute_linear_duty() 87 return duty; in nvkm_therm_compute_linear_duty() [all …]
|
D | gf119.c | 68 gf119_fan_pwm_get(struct nvkm_therm *therm, int line, u32 *divs, u32 *duty) in gf119_fan_pwm_get() argument 77 *duty = nvkm_rd32(device, 0x00e118 + (indx * 8)); in gf119_fan_pwm_get() 82 *duty = nvkm_rd32(device, 0x0200dc) & 0x1fff; in gf119_fan_pwm_get() 90 gf119_fan_pwm_set(struct nvkm_therm *therm, int line, u32 divs, u32 duty) in gf119_fan_pwm_set() argument 98 nvkm_wr32(device, 0x00e118 + (indx * 8), duty | 0x80000000); in gf119_fan_pwm_set() 101 nvkm_wr32(device, 0x0200dc, duty | 0x40000000); in gf119_fan_pwm_set()
|
D | nv40.c | 121 nv40_fan_pwm_get(struct nvkm_therm *therm, int line, u32 *divs, u32 *duty) in nv40_fan_pwm_get() argument 128 *duty = (reg & 0x7fff0000) >> 16; in nv40_fan_pwm_get() 137 *duty = (reg & 0x7fffffff); in nv40_fan_pwm_get() 149 nv40_fan_pwm_set(struct nvkm_therm *therm, int line, u32 divs, u32 duty) in nv40_fan_pwm_set() argument 154 nvkm_mask(device, 0x0010f0, 0x7fff7fff, (duty << 16) | divs); in nv40_fan_pwm_set() 158 nvkm_mask(device, 0x0015f4, 0x7fffffff, duty); in nv40_fan_pwm_set()
|
D | fantog.c | 46 int duty; in nvkm_fantog_update() local 53 duty = !nvkm_gpio_get(gpio, 0, DCB_GPIO_FAN, 0xff); in nvkm_fantog_update() 54 nvkm_gpio_set(gpio, 0, DCB_GPIO_FAN, 0xff, duty); in nvkm_fantog_update() 56 if (percent != (duty * 100)) { in nvkm_fantog_update() 58 if (!duty) in nvkm_fantog_update()
|
D | gm107.c | 34 gm107_fan_pwm_get(struct nvkm_therm *therm, int line, u32 *divs, u32 *duty) in gm107_fan_pwm_get() argument 38 *duty = nvkm_rd32(device, 0x10eb24) & 0x1fff; in gm107_fan_pwm_get() 43 gm107_fan_pwm_set(struct nvkm_therm *therm, int line, u32 divs, u32 duty) in gm107_fan_pwm_set() argument 47 nvkm_wr32(device, 0x10eb14, duty | 0x80000000); in gm107_fan_pwm_set()
|
D | nv50.c | 66 nv50_fan_pwm_get(struct nvkm_therm *therm, int line, u32 *divs, u32 *duty) in nv50_fan_pwm_get() argument 75 *duty = nvkm_rd32(device, 0x00e118 + (id * 8)); in nv50_fan_pwm_get() 83 nv50_fan_pwm_set(struct nvkm_therm *therm, int line, u32 divs, u32 duty) in nv50_fan_pwm_set() argument 91 nvkm_wr32(device, 0x00e118 + (id * 8), duty | 0x80000000); in nv50_fan_pwm_set()
|
/drivers/pwm/ |
D | pwm-renesas-tpu.c | 78 u16 duty; member 179 tpu_pwm_write(pwm, TPU_TGRAn, pwm->duty); in tpu_pwm_timer_start() 183 pwm->channel, pwm->duty, pwm->period); in tpu_pwm_timer_start() 227 pwm->duty = 0; in tpu_pwm_request() 254 u32 duty; in tpu_pwm_config() local 276 duty = clk_rate / prescalers[prescaler] in tpu_pwm_config() 278 if (duty > period) in tpu_pwm_config() 281 duty = 0; in tpu_pwm_config() 286 clk_rate, prescalers[prescaler], period, duty); in tpu_pwm_config() 293 pwm->duty = duty; in tpu_pwm_config() [all …]
|
D | pwm-ntxec.c | 59 int period, int duty) in ntxec_pwm_set_raw_period_and_duty_cycle() argument 76 { NTXEC_REG_DUTY_HIGH, ntxec_reg8(duty >> 8) }, in ntxec_pwm_set_raw_period_and_duty_cycle() 78 { NTXEC_REG_DUTY_LOW, ntxec_reg8(duty) }, in ntxec_pwm_set_raw_period_and_duty_cycle() 88 unsigned int period, duty; in ntxec_pwm_apply() local 95 duty = min_t(u64, state->duty_cycle, period); in ntxec_pwm_apply() 98 duty /= TIME_BASE_NS; in ntxec_pwm_apply() 109 if (state->enabled && duty != 0) { in ntxec_pwm_apply() 110 res = ntxec_pwm_set_raw_period_and_duty_cycle(chip, period, duty); in ntxec_pwm_apply()
|
D | pwm-atmel-tcb.c | 39 unsigned duty; /* PWM duty expressed in clk cycles */ member 102 tcbpwm->duty = 0; in atmel_tcb_pwm_request() 116 &tcbpwm->duty); in atmel_tcb_pwm_request() 120 &tcbpwm->duty); in atmel_tcb_pwm_request() 164 if (tcbpwm->duty == 0) in atmel_tcb_pwm_disable() 221 if (tcbpwm->duty == 0) in atmel_tcb_pwm_enable() 252 if (tcbpwm->duty != tcbpwm->period && tcbpwm->duty > 0) { in atmel_tcb_pwm_enable() 273 tcbpwm->duty); in atmel_tcb_pwm_enable() 277 tcbpwm->duty); in atmel_tcb_pwm_enable() 299 unsigned duty; in atmel_tcb_pwm_config() local [all …]
|
D | pwm-rockchip.c | 41 unsigned long duty; member 85 tmp = readl_relaxed(pc->base + pc->data->regs.duty); in rockchip_pwm_get_state() 105 unsigned long period, duty; in rockchip_pwm_config() local 121 duty = DIV_ROUND_CLOSEST_ULL(div, pc->data->prescaler * NSEC_PER_SEC); in rockchip_pwm_config() 134 writel(duty, pc->base + pc->data->regs.duty); in rockchip_pwm_config() 234 .duty = 0x04, 247 .duty = 0x08, 261 .duty = 0x08, 275 .duty = 0x08,
|
D | pwm-clps711x.c | 67 unsigned int duty; in clps711x_pwm_config() local 72 duty = clps711x_get_duty(pwm, duty_ns); in clps711x_pwm_config() 73 clps711x_pwm_update_val(priv, pwm->hwpwm, duty); in clps711x_pwm_config() 81 unsigned int duty; in clps711x_pwm_enable() local 83 duty = clps711x_get_duty(pwm, pwm_get_duty_cycle(pwm)); in clps711x_pwm_enable() 84 clps711x_pwm_update_val(priv, pwm->hwpwm, duty); in clps711x_pwm_enable()
|
D | pwm-pca9685.c | 135 static void pca9685_pwm_set_duty(struct pca9685 *pca, int channel, unsigned int duty) in pca9685_pwm_set_duty() argument 140 if (duty == 0) { in pca9685_pwm_set_duty() 144 } else if (duty >= PCA9685_COUNTER_RANGE) { in pca9685_pwm_set_duty() 164 off = (on + duty) % PCA9685_COUNTER_RANGE; in pca9685_pwm_set_duty() 367 unsigned long long duty, prescale; in __pca9685_pwm_apply() local 409 duty = PCA9685_COUNTER_RANGE * state->duty_cycle; in __pca9685_pwm_apply() 410 duty = DIV_ROUND_UP_ULL(duty, state->period); in __pca9685_pwm_apply() 411 pca9685_pwm_set_duty(pca, pwm->hwpwm, duty); in __pca9685_pwm_apply() 438 unsigned long long duty; in pca9685_pwm_get_state() local 465 duty = pca9685_pwm_get_duty(pca, pwm->hwpwm); in pca9685_pwm_get_state() [all …]
|
D | pwm-sprd.c | 74 u32 val, duty, prescale; in sprd_pwm_get_state() local 109 duty = val & SPRD_PWM_DUTY_MSK; in sprd_pwm_get_state() 110 tmp = (prescale + 1) * NSEC_PER_SEC * duty; in sprd_pwm_get_state() 123 u32 prescale, duty; in sprd_pwm_config() local 136 duty = duty_ns * SPRD_PWM_MOD_MAX / period_ns; in sprd_pwm_config() 154 sprd_pwm_write(spc, pwm->hwpwm, SPRD_PWM_DUTY, duty); in sprd_pwm_config()
|
D | pwm-dwc.c | 170 u64 duty, period; in dwc_pwm_get_state() local 177 duty = dwc_pwm_readl(dwc, DWC_TIM_LD_CNT(pwm->hwpwm)); in dwc_pwm_get_state() 178 duty += 1; in dwc_pwm_get_state() 179 duty *= DWC_CLK_PERIOD_NS; in dwc_pwm_get_state() 180 state->duty_cycle = duty; in dwc_pwm_get_state() 185 period += duty; in dwc_pwm_get_state()
|
D | pwm-berlin.c | 44 u32 duty; member 95 u32 value, duty, period; in berlin_pwm_config() local 113 duty = cycles; in berlin_pwm_config() 122 berlin_pwm_writel(bpc, pwm->hwpwm, duty, BERLIN_PWM_DUTY); in berlin_pwm_config() 279 channel->duty = berlin_pwm_readl(bpc, i, BERLIN_PWM_DUTY); in berlin_pwm_suspend() 306 berlin_pwm_writel(bpc, i, channel->duty, BERLIN_PWM_DUTY); in berlin_pwm_resume()
|
D | pwm-jz4740.c | 130 unsigned long period, duty; in jz4740_pwm_apply() local 165 duty = tmp; in jz4740_pwm_apply() 167 if (duty >= period) in jz4740_pwm_apply() 168 duty = period - 1; in jz4740_pwm_apply() 182 regmap_write(jz4740->map, TCU_REG_TDHRc(pwm->hwpwm), duty); in jz4740_pwm_apply()
|
/drivers/gpu/drm/nouveau/nvkm/subdev/volt/ |
D | gk104.c | 43 u32 div, duty; in gk104_volt_get() local 46 duty = nvkm_rd32(device, 0x20344); in gk104_volt_get() 48 return bios->base + bios->pwm_range * duty / div; in gk104_volt_get() 56 u32 div, duty; in gk104_volt_set() local 60 duty = DIV_ROUND_UP((uv - bios->base) * div, bios->pwm_range); in gk104_volt_set() 63 nvkm_wr32(device, 0x20344, 0x80000000 | duty); in gk104_volt_set()
|
/drivers/gpu/drm/nouveau/ |
D | nouveau_led.c | 42 u32 div, duty; in nouveau_led_get_brightness() local 45 duty = nvif_rd32(device, 0x61c884) & 0x00ffffff; in nouveau_led_get_brightness() 48 return duty * LED_FULL / div; in nouveau_led_get_brightness() 62 u32 div, duty; in nouveau_led_set_brightness() local 65 duty = value * div / LED_FULL; in nouveau_led_set_brightness() 73 nvif_wr32(device, 0x61c884, 0xc0000000 | duty); in nouveau_led_set_brightness()
|
/drivers/clk/meson/ |
D | sclk-div.c | 125 struct clk_duty *duty) in sclk_div_set_duty_cycle() argument 131 memcpy(&sclk->cached_duty, duty, sizeof(*duty)); in sclk_div_set_duty_cycle() 139 struct clk_duty *duty) in sclk_div_get_duty_cycle() argument 146 duty->num = 1; in sclk_div_get_duty_cycle() 147 duty->den = 2; in sclk_div_get_duty_cycle() 152 duty->num = hi + 1; in sclk_div_get_duty_cycle() 153 duty->den = sclk->cached_div; in sclk_div_get_duty_cycle()
|
/drivers/leds/ |
D | leds-pwm.c | 47 unsigned long long duty = led_dat->pwmstate.period; in led_pwm_set() local 49 duty *= brightness; in led_pwm_set() 50 do_div(duty, max); in led_pwm_set() 53 duty = led_dat->pwmstate.period - duty; in led_pwm_set() 55 led_dat->pwmstate.duty_cycle = duty; in led_pwm_set()
|
/drivers/gpu/drm/amd/pm/powerplay/hwmgr/ |
D | vega20_thermal.c | 121 uint32_t duty100, duty; in vega20_fan_ctrl_get_fan_speed_pwm() local 126 duty = REG_GET_FIELD(RREG32_SOC15(THM, 0, mmCG_THERMAL_STATUS), in vega20_fan_ctrl_get_fan_speed_pwm() 132 tmp64 = (uint64_t)duty * 255; in vega20_fan_ctrl_get_fan_speed_pwm() 144 uint32_t duty; in vega20_fan_ctrl_set_fan_speed_pwm() local 160 duty = (uint32_t)tmp64; in vega20_fan_ctrl_set_fan_speed_pwm() 164 CG_FDO_CTRL0, FDO_STATIC_DUTY, duty)); in vega20_fan_ctrl_set_fan_speed_pwm()
|
/drivers/media/rc/ |
D | ir-rx51.c | 46 int duty, period = DIV_ROUND_CLOSEST(NSEC_PER_SEC, ir_rx51->freq); in init_timing_params() local 48 duty = DIV_ROUND_CLOSEST(ir_rx51->duty_cycle * period, 100); in init_timing_params() 50 pwm_config(pwm, duty, period); in init_timing_params() 176 static int ir_rx51_set_duty_cycle(struct rc_dev *dev, u32 duty) in ir_rx51_set_duty_cycle() argument 180 ir_rx51->duty_cycle = duty; in ir_rx51_set_duty_cycle()
|
/drivers/iio/adc/ |
D | stm32-adc-core.c | 205 int i, div, duty; in stm32h7_adc_clk_sel() local 230 duty = clk_get_scaled_duty_cycle(priv->aclk, 100); in stm32h7_adc_clk_sel() 231 if (duty < 0) in stm32h7_adc_clk_sel() 232 dev_warn(&pdev->dev, "adc clock duty: %d\n", duty); in stm32h7_adc_clk_sel() 246 if (div == 1 && (duty < 49 || duty > 51)) in stm32h7_adc_clk_sel() 261 duty = clk_get_scaled_duty_cycle(priv->bclk, 100); in stm32h7_adc_clk_sel() 262 if (duty < 0) in stm32h7_adc_clk_sel() 263 dev_warn(&pdev->dev, "bus clock duty: %d\n", duty); in stm32h7_adc_clk_sel() 273 if (div == 1 && (duty < 49 || duty > 51)) in stm32h7_adc_clk_sel()
|