Lines Matching +full:internal +full:- +full:bias +full:- +full:resistor
1 // SPDX-License-Identifier: GPL-2.0+
6 #include <linux/nvmem-consumer.h>
224 /* These macro privides efuse parsing for internal phy. */
371 int bias[16] = {}; in tx_amp_fill_result() local
374 switch (phydev->drv->phy_id) { in tx_amp_fill_result()
380 memcpy(bias, (const void *)vals_9461, sizeof(bias)); in tx_amp_fill_result()
383 memcpy(bias, (const void *)vals_9481, sizeof(bias)); in tx_amp_fill_result()
389 if (buf[i >> 2] + bias[i] > 63) { in tx_amp_fill_result()
391 bias[i] = 0; in tx_amp_fill_result()
398 buf[0] + bias[0])); in tx_amp_fill_result()
402 buf[0] + bias[1])); in tx_amp_fill_result()
406 buf[0] + bias[2])); in tx_amp_fill_result()
410 buf[0] + bias[3])); in tx_amp_fill_result()
415 buf[1] + bias[4])); in tx_amp_fill_result()
419 buf[1] + bias[5])); in tx_amp_fill_result()
423 buf[1] + bias[6])); in tx_amp_fill_result()
427 buf[1] + bias[7])); in tx_amp_fill_result()
432 buf[2] + bias[8])); in tx_amp_fill_result()
436 buf[2] + bias[9])); in tx_amp_fill_result()
440 buf[2] + bias[10])); in tx_amp_fill_result()
444 buf[2] + bias[11])); in tx_amp_fill_result()
449 buf[3] + bias[12])); in tx_amp_fill_result()
453 buf[3] + bias[13])); in tx_amp_fill_result()
457 buf[3] + bias[14])); in tx_amp_fill_result()
461 buf[3] + bias[15])); in tx_amp_fill_result()
482 int bias = 0; in tx_r50_fill_result() local
485 if (phydev->drv->phy_id == MTK_GPHY_ID_MT7988) in tx_r50_fill_result()
486 bias = -1; in tx_r50_fill_result()
488 val = clamp_val(bias + tx_r50_cal_val, 0, 63); in tx_r50_fill_result()
504 return -EINVAL; in tx_r50_fill_result()
531 return -EINVAL; in tx_r50_cal_efuse()
597 ret = -EINVAL; in tx_vcm_cal_sw()
604 phydev_dbg(phydev, "Start TX-VCM SW cal.\n"); in tx_vcm_cal_sw()
605 while ((upper_idx - lower_idx) > 1) { in tx_vcm_cal_sw()
649 /* We calibrate TX-VCM in different logic. Check upper index and then in tx_vcm_cal_sw()
653 ret = upper_ret - lower_ret; in tx_vcm_cal_sw()
664 phydev_dbg(phydev, "TX-VCM SW cal result: 0x%x\n", upper_idx); in tx_vcm_cal_sw()
675 phydev_warn(phydev, "TX-VCM SW cal result at low margin 0x%x\n", in tx_vcm_cal_sw()
681 "TX-VCM SW cal result at high margin 0x%x\n", in tx_vcm_cal_sw()
684 ret = -EINVAL; in tx_vcm_cal_sw()
996 return -EINVAL; in cal_sw()
1026 return -EINVAL; in cal_efuse()
1050 return -EINVAL; in start_cal()
1055 return -EIO; in start_cal()
1068 cell = nvmem_cell_get(&phydev->mdio.dev, "phy-cal-data"); in mt798x_phy_calibration()
1070 if (PTR_ERR(cell) == -EPROBE_DEFER) in mt798x_phy_calibration()
1082 ret = -EINVAL; in mt798x_phy_calibration()
1109 switch (phydev->drv->phy_id) { in mt798x_phy_config_init()
1193 struct mtk_socphy_shared *priv = phydev->shared->priv; in mt7988_phy_led_get_polarity()
1197 polarities = ~(priv->boottrap); in mt7988_phy_led_get_polarity()
1201 if (polarities & BIT(phydev->mdio.addr)) in mt7988_phy_led_get_polarity()
1221 pinctrl = devm_pinctrl_get_select(&phydev->mdio.dev, "gbe-led"); in mt7988_phy_fix_leds_polarities()
1223 dev_err(&phydev->mdio.bus->dev, in mt7988_phy_fix_leds_polarities()
1231 struct device_node *np = dev_of_node(&phydev->mdio.bus->dev); in mt7988_phy_probe_shared()
1232 struct mtk_socphy_shared *shared = phydev->shared->priv; in mt7988_phy_probe_shared()
1241 * In practice this is done using a LED and a resistor pulling the pin in mt7988_phy_probe_shared()
1243 * The detected value at boot time is accessible at run-time using the in mt7988_phy_probe_shared()
1258 shared->boottrap = FIELD_GET(RG_GPIO_MISC_TPBANK0_BOOTMODE, reg); in mt7988_phy_probe_shared()
1269 if (phydev->mdio.addr > 3) in mt7988_phy_probe()
1270 return -EINVAL; in mt7988_phy_probe()
1272 err = devm_phy_package_join(&phydev->mdio.dev, phydev, 0, in mt7988_phy_probe()
1283 shared = phydev->shared->priv; in mt7988_phy_probe()
1284 priv = &shared->priv[phydev->mdio.addr]; in mt7988_phy_probe()
1286 phydev->priv = priv; in mt7988_phy_probe()
1296 * 2. Make sure that TX-VCM calibration works fine in mt7988_phy_probe()
1308 priv = devm_kzalloc(&phydev->mdio.dev, sizeof(struct mtk_socphy_priv), in mt7981_phy_probe()
1311 return -ENOMEM; in mt7981_phy_probe()
1313 phydev->priv = priv; in mt7981_phy_probe()