Lines Matching refs:btc

89 static int can_update_sample_point(const struct can_bittiming_const *btc,  in can_update_sample_point()  argument
101 tseg2 = clamp(tseg2, btc->tseg2_min, btc->tseg2_max); in can_update_sample_point()
103 if (tseg1 > btc->tseg1_max) { in can_update_sample_point()
104 tseg1 = btc->tseg1_max; in can_update_sample_point()
126 const struct can_bittiming_const *btc) in can_calc_bittiming() argument
153 for (tseg = (btc->tseg1_max + btc->tseg2_max) * 2 + 1; in can_calc_bittiming()
154 tseg >= (btc->tseg1_min + btc->tseg2_min) * 2; tseg--) { in can_calc_bittiming()
161 brp = (brp / btc->brp_inc) * btc->brp_inc; in can_calc_bittiming()
162 if ((brp < btc->brp_min) || (brp > btc->brp_max)) in can_calc_bittiming()
176 can_update_sample_point(btc, sample_point_nominal, tseg / 2, &tseg1, &tseg2, &sample_point_error); in can_calc_bittiming()
205 bt->sample_point = can_update_sample_point(btc, sample_point_nominal, best_tseg, in can_calc_bittiming()
216 if (!bt->sjw || !btc->sjw_max) { in can_calc_bittiming()
220 if (bt->sjw > btc->sjw_max) in can_calc_bittiming()
221 bt->sjw = btc->sjw_max; in can_calc_bittiming()
236 const struct can_bittiming_const *btc) in can_calc_bittiming() argument
250 const struct can_bittiming_const *btc) in can_fixup_bittiming() argument
259 if (bt->sjw > btc->sjw_max || in can_fixup_bittiming()
260 tseg1 < btc->tseg1_min || tseg1 > btc->tseg1_max || in can_fixup_bittiming()
261 bt->phase_seg2 < btc->tseg2_min || bt->phase_seg2 > btc->tseg2_max) in can_fixup_bittiming()
265 if (btc->brp_inc > 1) in can_fixup_bittiming()
266 do_div(brp64, btc->brp_inc); in can_fixup_bittiming()
269 if (btc->brp_inc > 1) in can_fixup_bittiming()
270 brp64 *= btc->brp_inc; in can_fixup_bittiming()
273 if (bt->brp < btc->brp_min || bt->brp > btc->brp_max) in can_fixup_bittiming()
303 const struct can_bittiming_const *btc, in can_get_bittiming() argument
315 if (!bt->tq && bt->bitrate && btc) in can_get_bittiming()
316 err = can_calc_bittiming(dev, bt, btc); in can_get_bittiming()
317 else if (bt->tq && !bt->bitrate && btc) in can_get_bittiming()
318 err = can_fixup_bittiming(dev, bt, btc); in can_get_bittiming()