Home
last modified time | relevance | path

Searched full:prescale (Results 1 – 25 of 105) sorted by relevance

12345

/linux-6.12.1/drivers/iio/adc/
Dqcom-vadc-common.c305 const struct u32_fract *prescale,
309 const struct u32_fract *prescale,
313 const struct u32_fract *prescale,
317 const struct u32_fract *prescale,
321 const struct u32_fract *prescale,
325 const struct u32_fract *prescale,
329 const struct u32_fract *prescale,
409 const struct u32_fract *prescale, in qcom_vadc_scale_volt() argument
417 voltage *= prescale->denominator; in qcom_vadc_scale_volt()
418 result = div64_s64(voltage, prescale->numerator); in qcom_vadc_scale_volt()
[all …]
/linux-6.12.1/drivers/pwm/
Dpwm-rz-mtu3.c69 * @prescale: MTU3 prescale
79 u8 prescale[RZ_MTU3_MAX_HW_CHANNELS]; member
116 u8 prescale; in rz_mtu3_pwm_calculate_prescale() local
119 * Supported prescale values are 1, 4, 16 and 64. in rz_mtu3_pwm_calculate_prescale()
120 * TODO: Support prescale values 2, 8, 32, 256 and 1024. in rz_mtu3_pwm_calculate_prescale()
124 prescale = 3; in rz_mtu3_pwm_calculate_prescale()
126 prescale = (fls(prescaled_period_cycles) + 1) / 2; in rz_mtu3_pwm_calculate_prescale()
128 return prescale; in rz_mtu3_pwm_calculate_prescale()
282 u8 prescale, val; in rz_mtu3_pwm_get_state() local
295 prescale = FIELD_GET(RZ_MTU3_TCR_TPCS, val); in rz_mtu3_pwm_get_state()
[all …]
Dpwm-microchip-core.c134 u8 prescale, u8 period_steps) in mchp_core_pwm_calc_duty() argument
141 * step_in_ns = (prescale * NSEC_PER_SEC) / clk_rate in mchp_core_pwm_calc_duty()
144 tmp = (((u64)prescale) + 1) * NSEC_PER_SEC; in mchp_core_pwm_calc_duty()
185 u16 *prescale, u16 *period_steps) in mchp_core_pwm_calc_period() argument
190 * Calculate the period cycles and prescale values. in mchp_core_pwm_calc_period()
193 * (prescale + 1) * (period_steps + 1) in mchp_core_pwm_calc_period()
203 * The prescale and period_steps registers operate similarly to in mchp_core_pwm_calc_period()
213 *prescale = MCHPCOREPWM_PRESCALE_MAX; in mchp_core_pwm_calc_period()
221 * prescale & period_steps values. in mchp_core_pwm_calc_period()
229 * to calculate prescale actually calculates its upper bound. in mchp_core_pwm_calc_period()
[all …]
Dpwm-sprd.c76 u32 val, duty, prescale; in sprd_pwm_get_state() local
99 * The period length is (PRESCALE + 1) * MOD counter steps. in sprd_pwm_get_state()
100 * The duty cycle length is (PRESCALE + 1) * DUTY counter steps. in sprd_pwm_get_state()
102 * period_ns = NSEC_PER_SEC * (prescale + 1) * mod / clk_rate in sprd_pwm_get_state()
103 * duty_ns = NSEC_PER_SEC * (prescale + 1) * duty / clk_rate in sprd_pwm_get_state()
106 prescale = val & SPRD_PWM_PRESCALE_MSK; in sprd_pwm_get_state()
107 tmp = (prescale + 1) * NSEC_PER_SEC * SPRD_PWM_MOD_MAX; in sprd_pwm_get_state()
112 tmp = (prescale + 1) * NSEC_PER_SEC * duty; in sprd_pwm_get_state()
127 u32 prescale, duty; in sprd_pwm_config() local
132 * The period length is (PRESCALE + 1) * MOD counter steps. in sprd_pwm_config()
[all …]
Dpwm-bcm-iproc.c75 u32 value, prescale; in iproc_pwmc_get_state() local
97 prescale = value >> IPROC_PWM_PRESCALE_SHIFT(pwm->hwpwm); in iproc_pwmc_get_state()
98 prescale &= IPROC_PWM_PRESCALE_MAX; in iproc_pwmc_get_state()
100 multi = NSEC_PER_SEC * (prescale + 1); in iproc_pwmc_get_state()
116 unsigned long prescale = IPROC_PWM_PRESCALE_MIN; in iproc_pwmc_apply() local
124 * Find period count, duty count and prescale to suit duty_cycle and in iproc_pwmc_apply()
127 * period_ns = 10^9 * (PRESCALE + 1) * PC / PWM_CLK_RATE in iproc_pwmc_apply()
128 * duty_ns = 10^9 * (PRESCALE + 1) * DC / PWM_CLK_RATE in iproc_pwmc_apply()
130 * PC = (PWM_CLK_RATE * period_ns) / (10^9 * (PRESCALE + 1)) in iproc_pwmc_apply()
131 * DC = (PWM_CLK_RATE * duty_ns) / (10^9 * (PRESCALE + 1)) in iproc_pwmc_apply()
[all …]
Dpwm-imx-tpm.c70 u8 prescale; member
93 u32 rate, prescale, period_count, clock_unit; in pwm_imx_tpm_round_state() local
100 prescale = 0; in pwm_imx_tpm_round_state()
102 prescale = ilog2(clock_unit) + 1 - PWM_IMX_TPM_MOD_WIDTH; in pwm_imx_tpm_round_state()
104 if ((!FIELD_FIT(PWM_IMX_TPM_SC_PS, prescale))) in pwm_imx_tpm_round_state()
106 p->prescale = prescale; in pwm_imx_tpm_round_state()
108 period_count = (clock_unit + ((1 << prescale) >> 1)) >> prescale; in pwm_imx_tpm_round_state()
114 tmp = (u64)period_count << prescale; in pwm_imx_tpm_round_state()
142 u32 rate, val, prescale; in pwm_imx_tpm_get_state() local
151 prescale = FIELD_GET(PWM_IMX_TPM_SC_PS, val); in pwm_imx_tpm_get_state()
[all …]
Dpwm-spear.c80 unsigned long prescale = PWMCR_MIN_PRESCALE, pv, dc; in spear_pwm_config() local
84 * Find pv, dc and prescale to suit duty_ns and period_ns. This is done in spear_pwm_config()
87 * period_ns = 10^9 * (PRESCALE + 1) * PV / PWM_CLK_RATE in spear_pwm_config()
88 * duty_ns = 10^9 * (PRESCALE + 1) * DC / PWM_CLK_RATE in spear_pwm_config()
90 * PV = (PWM_CLK_RATE * period_ns) / (10^9 * (PRESCALE + 1)) in spear_pwm_config()
91 * DC = (PWM_CLK_RATE * duty_ns) / (10^9 * (PRESCALE + 1)) in spear_pwm_config()
96 div *= 1 + prescale; in spear_pwm_config()
108 * prescale and recalculate pv and dc. in spear_pwm_config()
111 if (++prescale > PWMCR_MAX_PRESCALE) in spear_pwm_config()
127 prescale << PWMCR_PRESCALE_SHIFT); in spear_pwm_config()
Dpwm-bcm-kona.c23 * 2) Changes to prescale, duty, period, and polarity do not take effect until
105 unsigned long prescale = PRESCALE_MIN, pc, dc; in kona_pwmc_config() local
109 * Find period count, duty count and prescale to suit duty_ns and in kona_pwmc_config()
112 * period_ns = 10^9 * (PRESCALE + 1) * PC / PWM_CLK_RATE in kona_pwmc_config()
113 * duty_ns = 10^9 * (PRESCALE + 1) * DC / PWM_CLK_RATE in kona_pwmc_config()
115 * PC = (PWM_CLK_RATE * period_ns) / (10^9 * (PRESCALE + 1)) in kona_pwmc_config()
116 * DC = (PWM_CLK_RATE * duty_ns) / (10^9 * (PRESCALE + 1)) in kona_pwmc_config()
123 div *= 1 + prescale; in kona_pwmc_config()
135 /* Otherwise, increase prescale and recalculate pc and dc */ in kona_pwmc_config()
136 if (++prescale > PRESCALE_MAX) in kona_pwmc_config()
[all …]
Dpwm-pxa.c64 * period_ns = 10^9 * (PRESCALE + 1) * (PV + 1) / PWM_CLK_RATE
65 * duty_ns = 10^9 * (PRESCALE + 1) * DC / PWM_CLK_RATE
72 unsigned long period_cycles, prescale, pv, dc; in pxa_pwm_config() local
84 prescale = (period_cycles - 1) / 1024; in pxa_pwm_config()
85 pv = period_cycles / (prescale + 1) - 1; in pxa_pwm_config()
87 if (prescale > 63) in pxa_pwm_config()
95 writel(prescale | PWMCR_SD, pc->mmio_base + offset + PWMCR); in pxa_pwm_config()
Dpwm-vt8500.c77 unsigned long period_cycles, prescale, pv, dc; in vt8500_pwm_config() local
94 prescale = (period_cycles - 1) / 4096; in vt8500_pwm_config()
95 pv = period_cycles / (prescale + 1) - 1; in vt8500_pwm_config()
99 if (prescale > 1023) { in vt8500_pwm_config()
108 writel(prescale, vt8500->base + REG_SCALAR(pwm->hwpwm)); in vt8500_pwm_config()
Dpwm-sti.c118 unsigned int *prescale) in sti_pwm_get_prescale() argument
131 * prescale = ((period_ns * clk_rate) / (10^9 * (max_pwm_cnt + 1)) - 1 in sti_pwm_get_prescale()
143 *prescale = ps; in sti_pwm_get_prescale()
161 unsigned int ncfg, value, prescale = 0; in sti_pwm_config() local
197 ret = sti_pwm_get_prescale(pc, period_ns, &prescale); in sti_pwm_config()
201 value = prescale & PWM_PRESCALE_LOW_MASK; in sti_pwm_config()
207 value = (prescale & PWM_PRESCALE_HIGH_MASK) >> 4; in sti_pwm_config()
231 dev_dbg(dev, "prescale:%u, period:%i, duty:%i, value:%u\n", in sti_pwm_config()
232 prescale, period_ns, duty_ns, value); in sti_pwm_config()
Dpwm-pca9685.c27 * that is enabled is allowed to change the prescale register.
29 * prescale setting as the one set by the first requested channel.
372 unsigned long long duty, prescale; in __pca9685_pwm_apply() local
378 prescale = DIV_ROUND_CLOSEST_ULL(PCA9685_OSC_CLOCK_MHZ * state->period, in __pca9685_pwm_apply()
380 if (prescale < PCA9685_PRESCALE_MIN || prescale > PCA9685_PRESCALE_MAX) { in __pca9685_pwm_apply()
391 if (prescale != val) { in __pca9685_pwm_apply()
408 pca9685_write_reg(chip, PCA9685_PRESCALE, prescale); in __pca9685_pwm_apply()
445 /* Calculate (chip-wide) period from prescale value */ in pca9685_pwm_get_state()
Dpwm-imx27.c222 unsigned long period_cycles, duty_cycles, prescale; in pwm_imx27_apply() local
235 prescale = period_cycles / 0x10000 + 1; in pwm_imx27_apply()
237 period_cycles /= prescale; in pwm_imx27_apply()
241 duty_cycles /= prescale; in pwm_imx27_apply()
275 cr = MX3_PWMCR_PRESCALER_SET(prescale) | in pwm_imx27_apply()
/linux-6.12.1/drivers/clocksource/
Dingenic-sysost.c96 unsigned int prescale; in ingenic_ost_percpu_timer_recalc_rate() local
98 prescale = readl(ost_clk->ost->base + info->ostccr_reg); in ingenic_ost_percpu_timer_recalc_rate()
100 prescale = FIELD_GET(OSTCCR_PRESCALE1_MASK, prescale); in ingenic_ost_percpu_timer_recalc_rate()
102 return parent_rate >> (prescale * 2); in ingenic_ost_percpu_timer_recalc_rate()
110 unsigned int prescale; in ingenic_ost_global_timer_recalc_rate() local
112 prescale = readl(ost_clk->ost->base + info->ostccr_reg); in ingenic_ost_global_timer_recalc_rate()
114 prescale = FIELD_GET(OSTCCR_PRESCALE2_MASK, prescale); in ingenic_ost_global_timer_recalc_rate()
116 return parent_rate >> (prescale * 2); in ingenic_ost_global_timer_recalc_rate()
121 u8 prescale; in ingenic_ost_get_prescale() local
123 for (prescale = 0; prescale < 2; prescale++) in ingenic_ost_get_prescale()
[all …]
Dtimer-cadence-ttc.c58 #define PRESCALE_EXPONENT 11 /* 2 ^ PRESCALE_EXPONENT = PRESCALE */
59 #define PRESCALE 2048 /* The exponent must match this */ macro
221 DIV_ROUND_CLOSEST(ttce->ttc.freq, PRESCALE * HZ)); in ttc_set_periodic()
378 err = clocksource_register_hz(&ttccs->cs, ttccs->ttc.freq / PRESCALE); in ttc_setup_clocksource()
386 ttccs->ttc.freq / PRESCALE); in ttc_setup_clocksource()
404 clockevents_update_freq(&ttcce->ce, ndata->new_rate / PRESCALE); in ttc_rate_change_clockevent_cb()
471 ttcce->ttc.freq / PRESCALE, 1, 0xfffe); in ttc_setup_clockevent()
/linux-6.12.1/drivers/clk/ingenic/
Dtcu.c159 unsigned int prescale; in ingenic_tcu_recalc_rate() local
162 ret = regmap_read(tcu_clk->tcu->map, info->tcsr_reg, &prescale); in ingenic_tcu_recalc_rate()
165 prescale = (prescale & TCU_TCSR_PRESCALE_MASK) >> TCU_TCSR_PRESCALE_LSB; in ingenic_tcu_recalc_rate()
167 return parent_rate >> (prescale * 2); in ingenic_tcu_recalc_rate()
172 u8 prescale; in ingenic_tcu_get_prescale() local
174 for (prescale = 0; prescale < 5; prescale++) in ingenic_tcu_get_prescale()
175 if ((rate >> (prescale * 2)) <= req_rate) in ingenic_tcu_get_prescale()
176 return prescale; in ingenic_tcu_get_prescale()
185 u8 prescale; in ingenic_tcu_determine_rate() local
192 prescale = ingenic_tcu_get_prescale(rate, req->rate); in ingenic_tcu_determine_rate()
[all …]
/linux-6.12.1/drivers/watchdog/
Drealtek_otto_wdt.c10 * - Base prescale of (2 << 25), providing tick duration T_0: 168ms @ 200MHz
11 * - PRESCALE: logarithmic prescaler adding a factor of {1, 2, 4, 8}
12 * - Phase 1: Times out after (PHASE1 + 1) × PRESCALE × T_0
14 * - Phase 2: starts after phase 1, times out after (PHASE2 + 1) × PRESCALE × T_0
107 static int otto_wdt_tick_ms(struct otto_wdt_ctrl *ctrl, int prescale) in otto_wdt_tick_ms() argument
109 return DIV_ROUND_CLOSEST(1 << (25 + prescale), ctrl->clk_rate_khz); in otto_wdt_tick_ms()
133 unsigned int prescale; in otto_wdt_determine_timeouts() local
138 prescale = prescale_next; in otto_wdt_determine_timeouts()
139 if (prescale > OTTO_WDT_PRESCALE_MAX) in otto_wdt_determine_timeouts()
142 tick_ms = otto_wdt_tick_ms(ctrl, prescale); in otto_wdt_determine_timeouts()
[all …]
/linux-6.12.1/drivers/i2c/busses/
Di2c-kempld.c226 long prescale; in kempld_i2c_device_init() local
240 prescale = pld->pld_clock / (bus_frequency * 5) - 1000; in kempld_i2c_device_init()
242 prescale = pld->pld_clock / (bus_frequency * 4) - 3000; in kempld_i2c_device_init()
244 if (prescale < 0) in kempld_i2c_device_init()
245 prescale = 0; in kempld_i2c_device_init()
248 prescale_corr = prescale / 1000; in kempld_i2c_device_init()
249 if (prescale % 1000 >= 500) in kempld_i2c_device_init()
Di2c-imx-lpi2c.c209 u8 prescale, filt, sethold, datavd; in lpi2c_imx_config() local
223 for (prescale = 0; prescale <= 7; prescale++) { in lpi2c_imx_config()
224 clk_cycle = clk_rate / ((1 << prescale) * lpi2c_imx->bitrate) in lpi2c_imx_config()
232 if (prescale > 7) in lpi2c_imx_config()
235 /* set MCFGR1: PINCFG, PRESCALE, IGNACK */ in lpi2c_imx_config()
240 temp = prescale | pincfg << 24; in lpi2c_imx_config()
/linux-6.12.1/arch/powerpc/platforms/52xx/
Dmpc52xx_gpt.c388 u32 prescale; in mpc52xx_gpt_do_start() local
417 * Note: the prescale register is '1' based, not '0' based. ie. a in mpc52xx_gpt_do_start()
420 * around and divides by 0x10000. That is why prescale must be in mpc52xx_gpt_do_start()
422 prescale = (clocks >> 16) + 1; in mpc52xx_gpt_do_start()
423 do_div(clocks, prescale); in mpc52xx_gpt_do_start()
425 pr_err("calculation error; prescale:%x clocks:%llx\n", in mpc52xx_gpt_do_start()
426 prescale, clocks); in mpc52xx_gpt_do_start()
438 out_be32(&gpt->regs->count, prescale << 16 | clocks); in mpc52xx_gpt_do_start()
492 u64 prescale; in mpc52xx_gpt_timer_period() local
499 prescale = period >> 16; in mpc52xx_gpt_timer_period()
[all …]
/linux-6.12.1/drivers/gpu/drm/radeon/
Dradeon_i2c.c234 u32 prescale = 0; in radeon_get_i2c_prescale() local
260 prescale = m | (n << 8); in radeon_get_i2c_prescale()
268 prescale = (((sclk * 10)/(4 * 128 * 100) + 1) << 8) + 128; in radeon_get_i2c_prescale()
283 prescale = (127 << 8) + ((sclk * 10) / (4 * 127 * i2c_clock)); in radeon_get_i2c_prescale()
285 prescale = (((sclk * 10)/(4 * 128 * 100) + 1) << 8) + 128; in radeon_get_i2c_prescale()
314 return prescale; in radeon_get_i2c_prescale()
329 u32 prescale; in r100_hw_i2c_xfer() local
337 prescale = radeon_get_i2c_prescale(rdev); in r100_hw_i2c_xfer()
339 reg = ((prescale << RADEON_I2C_PRESCALE_SHIFT) | in r100_hw_i2c_xfer()
582 u32 prescale; in r500_hw_i2c_xfer() local
[all …]
/linux-6.12.1/drivers/spi/
Dspi-fsl-lpspi.c92 u8 prescale; member
281 temp |= fsl_lpspi->config.prescale << 27; in fsl_lpspi_set_cmd()
320 u8 prescale; in fsl_lpspi_set_bitrate() local
339 for (prescale = 0; prescale <= prescale_max; prescale++) { in fsl_lpspi_set_bitrate()
340 scldiv = div / (1 << prescale) - 2; in fsl_lpspi_set_bitrate()
342 fsl_lpspi->config.prescale = prescale; in fsl_lpspi_set_bitrate()
353 dev_dbg(fsl_lpspi->dev, "perclk=%d, speed=%d, prescale=%d, scldiv=%d\n", in fsl_lpspi_set_bitrate()
354 perclk_rate, config.speed_hz, prescale, scldiv); in fsl_lpspi_set_bitrate()
/linux-6.12.1/drivers/comedi/drivers/
Ddt3000.c344 unsigned int divider, base, prescale; in dt3k_ns_to_timer() local
349 for (prescale = 0; prescale < 16; prescale++) { in dt3k_ns_to_timer()
350 base = timer_base * (prescale + 1); in dt3k_ns_to_timer()
365 return (prescale << 16) | (divider); in dt3k_ns_to_timer()
369 prescale = 15; in dt3k_ns_to_timer()
370 base = timer_base * (prescale + 1); in dt3k_ns_to_timer()
373 return (prescale << 16) | (divider); in dt3k_ns_to_timer()
/linux-6.12.1/Documentation/devicetree/bindings/display/
Dcirrus,clps711x-fb.txt12 - ac-prescale : LCD AC bias frequency. This frequency is the required
31 ac-prescale = <17>;
/linux-6.12.1/drivers/input/keyboard/
Dep93xx_keypad.c65 u16 prescale; member
136 val |= (keypad->prescale << KEY_INIT_PRSCL_SHIFT) & KEY_INIT_PRSCL_MASK; in ep93xx_keypad_config()
231 device_property_read_u16(dev, "cirrus,prescale", &keypad->prescale); in ep93xx_keypad_probe()

12345