/linux-6.12.1/drivers/ata/ |
D | pata_cypress.c | 69 time_16 = clamp_val(t.recover - 1, 0, 15) | in cy82c693_set_piomode() 70 (clamp_val(t.active - 1, 0, 15) << 4); in cy82c693_set_piomode() 71 time_8 = clamp_val(t.act8b - 1, 0, 15) | in cy82c693_set_piomode() 72 (clamp_val(t.rec8b - 1, 0, 15) << 4); in cy82c693_set_piomode() 78 addr |= clamp_val(t.setup - 1, 0, 15); in cy82c693_set_piomode() 88 addr |= (clamp_val(t.setup - 1, 0, 15) << 4); in cy82c693_set_piomode()
|
D | pata_legacy.c | 393 active = clamp_val(t.active, 2, 15); in ht6560a_set_piomode() 394 recover = clamp_val(t.recover, 4, 15); in ht6560a_set_piomode() 427 active = clamp_val(t.active, 2, 15); in ht6560b_set_piomode() 428 recover = clamp_val(t.recover, 2, 16) & 0x0F; in ht6560b_set_piomode() 511 active = clamp_val(t.active, 2, 17) - 2; in opti82c611a_set_piomode() 512 recover = clamp_val(t.recover, 1, 16) - 1; in opti82c611a_set_piomode() 513 setup = clamp_val(t.setup, 1, 4) - 1; in opti82c611a_set_piomode() 590 active = clamp_val(t.active, 2, 17) - 2; in opti82c46x_set_piomode() 591 recover = clamp_val(t.recover, 1, 16) - 1; in opti82c46x_set_piomode() 592 setup = clamp_val(t.setup, 1, 4) - 1; in opti82c46x_set_piomode() [all …]
|
D | pata_amd.c | 86 t = (t & ~(3 << ((3 - dn) << 1))) | ((clamp_val(at.setup, 1, 4) - 1) << ((3 - dn) << 1)); in timing_setup() 91 ((clamp_val(at.act8b, 1, 16) - 1) << 4) | (clamp_val(at.rec8b, 1, 16) - 1)); in timing_setup() 95 ((clamp_val(at.active, 1, 16) - 1) << 4) | (clamp_val(at.recover, 1, 16) - 1)); in timing_setup() 99 t = at.udma ? (0xc0 | (clamp_val(at.udma, 2, 5) - 2)) : 0x03; in timing_setup() 103 t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 2, 10)]) : 0x03; in timing_setup() 107 t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 1, 10)]) : 0x03; in timing_setup() 111 t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 1, 15)]) : 0x03; in timing_setup()
|
D | pata_via.c | 284 setup |= (clamp_val(t.setup, 1, 4) - 1) << shift; in via_do_set_mode() 290 ((clamp_val(t.act8b, 1, 16) - 1) << 4) | (clamp_val(t.rec8b, 1, 16) - 1)); in via_do_set_mode() 292 ((clamp_val(t.active, 1, 16) - 1) << 4) | (clamp_val(t.recover, 1, 16) - 1)); in via_do_set_mode() 298 ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 5) - 2)) : 0x03; in via_do_set_mode() 301 ut = t.udma ? (0xe8 | (clamp_val(t.udma, 2, 9) - 2)) : 0x0f; in via_do_set_mode() 304 ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07; in via_do_set_mode() 307 ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07; in via_do_set_mode()
|
D | pata_ns87410.c | 79 at.active = clamp_val(at.active, 2, 16) - 2; in ns87410_set_piomode() 80 at.setup = clamp_val(at.setup, 1, 4) - 1; in ns87410_set_piomode() 81 at.recover = clamp_val(at.recover, 1, 12) - 1; in ns87410_set_piomode()
|
D | pata_ali.c | 181 t->setup = clamp_val(t->setup, 1, 8) & 7; in ali_program_modes() 182 t->act8b = clamp_val(t->act8b, 1, 8) & 7; in ali_program_modes() 183 t->rec8b = clamp_val(t->rec8b, 1, 16) & 15; in ali_program_modes() 184 t->active = clamp_val(t->active, 1, 8) & 7; in ali_program_modes() 185 t->recover = clamp_val(t->recover, 1, 16) & 15; in ali_program_modes()
|
/linux-6.12.1/drivers/hwmon/ |
D | ina238.c | 227 regval = clamp_val(val, -163, 163); in ina238_write_in() 230 regval = clamp_val(regval, S16_MIN, S16_MAX); in ina238_write_in() 244 regval = clamp_val(val, 0, 102396); in ina238_write_in() 246 regval = clamp_val(regval, 0, S16_MAX); in ina238_write_in() 303 *val = clamp_val(power, 0, LONG_MAX); in ina238_read_power() 317 *val = clamp_val(power, 0, LONG_MAX); in ina238_read_power() 346 regval = clamp_val(val, 0, LONG_MAX); in ina238_write_power() 349 regval = clamp_val(regval >> 8, 0, U16_MAX); in ina238_write_power() 401 regval = clamp_val(regval, S16_MIN, S16_MAX) & 0xfff0; in ina238_write_temp()
|
D | emc1403.c | 450 val = clamp_val(val, -128000, 127000); in emc1403_set_hyst() 452 val = clamp_val(val, 0, 255000); in emc1403_set_hyst() 461 hyst = clamp_val(DIV_ROUND_CLOSEST(hyst, 1000), 0, 127); in emc1403_set_hyst() 463 hyst = clamp_val(DIV_ROUND_CLOSEST(hyst, 1000), 0, 255); in emc1403_set_hyst() 484 val = clamp_val(val, -128000, 127875); in emc1403_set_temp() 486 val = clamp_val(val, 0, 255875); in emc1403_set_temp() 494 val = clamp_val(val, -128000, 127000); in emc1403_set_temp() 496 val = clamp_val(val, 0, 255000); in emc1403_set_temp() 537 return emc1403_set_convrate(data, clamp_val(val, 0, 100000)); in emc1403_chip_write()
|
D | ina2xx.c | 200 interval = clamp_val(interval, 0, 32000); in ina226_interval_to_reg() 313 val = clamp_val(val, 0, SHRT_MAX * data->config->shunt_div); in ina226_alert_to_reg() 315 return clamp_val(val, 0, SHRT_MAX); in ina226_alert_to_reg() 317 val = clamp_val(val, 0, 200000); in ina226_alert_to_reg() 320 return clamp_val(val, 0, USHRT_MAX); in ina226_alert_to_reg() 322 val = clamp_val(val, 0, UINT_MAX - data->power_lsb_uW); in ina226_alert_to_reg() 324 return clamp_val(val, 0, USHRT_MAX); in ina226_alert_to_reg() 326 val = clamp_val(val, INT_MIN / 1000, INT_MAX / 1000); in ina226_alert_to_reg() 329 return clamp_val(val, SHRT_MIN, SHRT_MAX); in ina226_alert_to_reg()
|
D | max6697.c | 290 val = clamp_val(val, -1000000, 1000000); /* prevent underflow */ in max6697_write() 292 val = clamp_val(val, 0, data->type == max6581 ? 255 : 127); in max6697_write() 295 val = clamp_val(val, -1000000, 1000000); /* prevent underflow */ in max6697_write() 297 val = clamp_val(val, 0, data->type == max6581 ? 255 : 127); in max6697_write() 300 val = clamp_val(val, -1000000, 1000000); /* prevent underflow */ in max6697_write() 302 val = clamp_val(val, 0, 255); in max6697_write() 306 val = clamp_val(val, MAX6581_OFFSET_MIN, MAX6581_OFFSET_MAX); in max6697_write()
|
D | amc6821.c | 266 val = DIV_ROUND_CLOSEST(clamp_val(val, -128000, 127000), 1000); in amc6821_temp_write() 483 val = val ? 6000000 / clamp_val(val, 1, 6000000) : 0; in amc6821_fan_write() 484 val = clamp_val(val, 0, 0xffff); in amc6821_fan_write() 600 val = DIV_ROUND_CLOSEST(clamp_val(val, 0, 63000), 1000); in temp_auto_point_temp_store() 601 val = clamp_val(val, 0, min(temps[1], otemps[1])); in temp_auto_point_temp_store() 609 val = clamp_val(val, DIV_ROUND_UP(temps[0], 4) * 4000, 124000); in temp_auto_point_temp_store() 613 temps[2] = clamp_val(temps[2], temps[1] + 1, 255); in temp_auto_point_temp_store() 618 val = clamp_val(val, (temps[1] + 1) * 1000, 255000); in temp_auto_point_temp_store()
|
D | ltc2947-core.c | 625 val = clamp_val(val, TEMP_MIN, TEMP_MAX); in ltc2947_write_temp() 640 val = clamp_val(val, TEMP_MIN, TEMP_MAX); in ltc2947_write_temp() 671 val = clamp_val(val, POWER_MIN, POWER_MAX); in ltc2947_write_power() 676 val = clamp_val(val, POWER_MIN, POWER_MAX); in ltc2947_write_power() 697 val = clamp_val(val, CURRENT_MIN, CURRENT_MAX); in ltc2947_write_curr() 702 val = clamp_val(val, CURRENT_MIN, CURRENT_MAX); in ltc2947_write_curr() 734 val = clamp_val(val, VDVCC_MIN, VDVCC_MAX); in ltc2947_write_in() 740 val = clamp_val(val, VOLTAGE_MIN, VOLTAGE_MAX); in ltc2947_write_in() 746 val = clamp_val(val, VDVCC_MIN, VDVCC_MAX); in ltc2947_write_in() 752 val = clamp_val(val, VOLTAGE_MIN, VOLTAGE_MAX); in ltc2947_write_in()
|
D | lm95245.c | 272 val = clamp_val(val / 1000, 0, 255); in lm95245_write_temp() 278 val = clamp_val(val / 1000, 0, channel ? 255 : 127); in lm95245_write_temp() 290 val = clamp_val(val, -1000000, 1000000); in lm95245_write_temp() 292 val = clamp_val(val, 0, 31); in lm95245_write_temp() 298 val = clamp_val(val, -128000, 127875); in lm95245_write_temp()
|
D | asc7621.c | 181 reqval = clamp_val(reqval, 0, 255); in store_u8() 214 reqval = clamp_val(reqval, 0, param->mask[0]); in store_bitmask() 264 (reqval <= 0 ? 0xffff : clamp_val(5400000 / reqval, 0, 0xfffe)); in store_fan16() 333 reqval = clamp_val(reqval, 0, 0xffff); in store_in8() 337 reqval = clamp_val(reqval, 0, 0xff); in store_in8() 366 reqval = clamp_val(reqval, -127000, 127000); in store_temp8() 422 reqval = clamp_val(reqval, -32000, 31750); in store_temp62() 458 temp = auto_point1 + asc7621_range_map[clamp_val(regval, 0, 15)]; in show_ap2_temp() 479 reqval = clamp_val(reqval, auto_point1 + 2000, auto_point1 + 80000); in store_ap2_temp() 513 return sprintf(buf, "%u\n", map[clamp_val(regval, 0, 15)]); in show_pwm_ac() [all …]
|
D | tmp401.c | 280 temp = clamp_val(temp, -64000, 191000); in tmp401_temp_to_register() 283 temp = clamp_val(temp, 0, 127000); in tmp401_temp_to_register() 372 val = clamp_val(val, -64000, 191000); in tmp401_temp_write() 374 val = clamp_val(val, 0, 127000); in tmp401_temp_write() 381 val = clamp_val(val, temp - 255000, temp); in tmp401_temp_write() 428 val = clamp_val(val, 125, 16000); in tmp401_set_convrate()
|
D | tmp464.c | 283 interval = clamp_val(interval, 125, 16000); in tmp464_set_convrate() 313 val = clamp_val(val, -256000, 256000); /* prevent overflow/underflow */ in tmp464_temp_write() 314 val = clamp_val(temp_from_reg(regval) - val, 0, 255000); in tmp464_temp_write() 319 val = temp_to_limit_reg(clamp_val(val, -255000, 255500)); in tmp464_temp_write() 323 val = temp_to_limit_reg(clamp_val(val, -255000, 255500)); in tmp464_temp_write() 327 val = temp_to_offset_reg(clamp_val(val, -128000, 127937)); in tmp464_temp_write()
|
D | ina209.c | 164 return clamp_val(val, -320, 320) * 100; in ina209_to_reg() 176 return (DIV_ROUND_CLOSEST(clamp_val(val, 0, 32000), 4) << 3) in ina209_to_reg() 187 return (clamp_val(-val, 0, 255) << 8) | (old & 0xff); in ina209_to_reg() 196 return (clamp_val(val, 0, 255) << 8) | (old & 0xff); in ina209_to_reg() 526 clamp_val(40960000 / shunt, 1, 65535)); in ina209_init_client()
|
D | lm95234.c | 116 val = DIV_ROUND_CLOSEST(clamp_val(val, -255000, 255000), 1000); in lm95234_hyst_set() 117 val = clamp_val((int)tcrit - val, 0, 31); in lm95234_hyst_set() 150 val = DIV_ROUND_CLOSEST(clamp_val(val, -64000, 63500), 500); in lm95234_temp_write() 153 val = clamp_val(val, 0, channel == 1 ? 127000 : 255000); in lm95234_temp_write() 159 val = DIV_ROUND_CLOSEST(clamp_val(val, 0, 255000), 1000); in lm95234_temp_write()
|
D | tmp513.c | 266 regval = clamp_val(val, -max_val, max_val); in tmp51x_set_value() 274 val = clamp_val(DIV_ROUND_CLOSEST(val, 4), 0, max_val); in tmp51x_set_value() 278 regval = clamp_val(DIV_ROUND_CLOSEST(val, data->pwr_lsb_uw), 0, in tmp51x_set_value() 286 val = clamp_val(val, MIN_TEMP_LIMIT, MAX_TEMP_LIMIT); in tmp51x_set_value() 291 val = clamp_val(val, 0, MAX_TEMP_HYST); in tmp51x_set_value()
|
D | w83l786ng.c | 75 rpm = clamp_val(rpm, 1, 1000000); in FAN_TO_REG() 76 return clamp_val((1350000 + rpm * div / 2) / (rpm * div), 1, 254); in FAN_TO_REG() 84 #define TEMP_TO_REG(val) (clamp_val(((val) < 0 ? (val) + 0x100 * 1000 \ 94 #define IN_TO_REG(val) (clamp_val((((val) + 4) / 8), 0, 255)) 103 val = clamp_val(val, 1, 128) >> 1; in DIV_TO_REG() 514 val = clamp_val(val, 0, 255); in store_pwm() 599 tol_tmp = clamp_val(val, 0, 15); in store_tolerance()
|
D | vt8231.c | 138 return clamp_val(1310720 / (rpm * div), 1, 255); in FAN_TO_REG() 291 data->in_min[nr] = clamp_val(((val * 958) / 10000) + 3, 0, 255); in in_min_store() 311 data->in_max[nr] = clamp_val(((val * 958) / 10000) + 3, 0, 255); in in_max_store() 358 data->in_min[5] = clamp_val(((val * 958 * 34) / (10000 * 54)) + 3, in in5_min_store() 378 data->in_max[5] = clamp_val(((val * 958 * 34) / (10000 * 54)) + 3, in in5_max_store() 440 data->temp_max[0] = clamp_val((val + 500) / 1000, 0, 255); in temp1_max_store() 458 data->temp_min[0] = clamp_val((val + 500) / 1000, 0, 255); in temp1_max_hyst_store() 506 data->temp_max[nr] = clamp_val(TEMP_MAXMIN_TO_REG(val), 0, 255); in temp_max_store() 526 data->temp_min[nr] = clamp_val(TEMP_MAXMIN_TO_REG(val), 0, 255); in temp_min_store()
|
D | lm63.c | 117 #define TEMP8_TO_REG(val) DIV_ROUND_CLOSEST(clamp_val((val), -128000, \ 119 #define TEMP8U_TO_REG(val) DIV_ROUND_CLOSEST(clamp_val((val), 0, \ 122 #define TEMP11_TO_REG(val) (DIV_ROUND_CLOSEST(clamp_val((val), -128000, \ 124 #define TEMP11U_TO_REG(val) (DIV_ROUND_CLOSEST(clamp_val((val), 0, \ 126 #define HYST_TO_REG(val) DIV_ROUND_CLOSEST(clamp_val((val), 0, 127000), \ 194 return DIV_ROUND_CLOSEST(clamp_val(val, 0, 127500), 500); in lut_temp_to_reg() 196 return DIV_ROUND_CLOSEST(clamp_val(val, 0, 127000), 1000); in lut_temp_to_reg() 398 val = clamp_val(val, 0, 255); in set_pwm1() 682 lm63_set_convrate(data, clamp_val(val, 0, 100000)); in update_interval_store()
|
/linux-6.12.1/drivers/hwmon/pmbus/ |
D | lm25066.c | 394 word = ((s16)word < 0) ? 0 : clamp_val(word, 0, data->rlimit); in lm25066_write_word_data() 398 word = ((s16)word < 0) ? 0 : clamp_val(word, 0, data->rlimit); in lm25066_write_word_data() 404 word = ((s16)word < 0) ? 0 : clamp_val(word, 0, data->rlimit); in lm25066_write_word_data() 412 word = ((s16)word < 0) ? 0 : clamp_val(word, 0, data->rlimit); in lm25066_write_word_data() 419 word = ((s16)word < 0) ? 0 : clamp_val(word, 0, data->rlimit); in lm25066_write_word_data() 427 word = clamp_val(word, 1, LM25066_SAMPLES_FOR_AVG_MAX); in lm25066_write_word_data()
|
D | mp2888.c | 272 word = clamp_val(word, 0, GENMASK(7, 0)); in mp2888_write_word_data() 279 word = clamp_val(word, 0, GENMASK(9, 0)); in mp2888_write_word_data() 286 word = clamp_val(word, 0, GENMASK(9, 0)); in mp2888_write_word_data()
|
/linux-6.12.1/drivers/gpu/drm/sti/ |
D | sti_gdp.c | 644 dst_w = clamp_val(new_plane_state->crtc_w, 0, mode->hdisplay - dst_x); in sti_gdp_atomic_check() 645 dst_h = clamp_val(new_plane_state->crtc_h, 0, mode->vdisplay - dst_y); in sti_gdp_atomic_check() 649 src_w = clamp_val(new_plane_state->src_w >> 16, 0, in sti_gdp_atomic_check() 651 src_h = clamp_val(new_plane_state->src_h >> 16, 0, in sti_gdp_atomic_check() 758 dst_w = clamp_val(newstate->crtc_w, 0, mode->hdisplay - dst_x); in sti_gdp_atomic_update() 759 dst_h = clamp_val(newstate->crtc_h, 0, mode->vdisplay - dst_y); in sti_gdp_atomic_update() 763 src_w = clamp_val(newstate->src_w >> 16, 0, GAM_GDP_SIZE_MAX_WIDTH); in sti_gdp_atomic_update() 764 src_h = clamp_val(newstate->src_h >> 16, 0, GAM_GDP_SIZE_MAX_HEIGHT); in sti_gdp_atomic_update()
|