diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-02-07 19:49:14 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-02-14 17:31:27 +0000 |
commit | 6b4c6aa375bfe1d49594d8a43345dc6b5df917c3 (patch) | |
tree | 44473576d31700938b077e6b493a99cf7f4e94d1 /src/osmo-bts-sysmo/l1_if.c | |
parent | c4ac69dcc2bd3825e73f2a026dccc8813dcbe592 (diff) |
sysmobts: fully support trx_power_params
The simplistic approach of sysmobts_get_nominal_power() is insufficient
to cope for devices that have an internal PA. The Actual transceiver
board is driven to a certain level (0..23 dBm typically), and the
external PA must be handled independent of that. Increasing the return
value of sysmobts_get_nominal_power() would result in the sysmoBTS
mainboard attempting to reach a higher power, which is wrong.
This change affects sysmoBTS 1020 and 1100. It causes power-ramping to
be used by default. For 1002 and 2050, no behavior change is expected.
Change-Id: Ieff75d5becaa80a2097b6e744c75c2d16259c9a4
Diffstat (limited to 'src/osmo-bts-sysmo/l1_if.c')
-rw-r--r-- | src/osmo-bts-sysmo/l1_if.c | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c index c0213684..8eb6fcc6 100644 --- a/src/osmo-bts-sysmo/l1_if.c +++ b/src/osmo-bts-sysmo/l1_if.c @@ -51,6 +51,7 @@ #include <osmo-bts/l1sap.h> #include <osmo-bts/msg_utils.h> #include <osmo-bts/dtx_dl_amr_fsm.h> +#include <osmo-bts/tx_power.h> #include <sysmocom/femtobts/superfemto.h> #include <sysmocom/femtobts/gsml1prim.h> @@ -1309,7 +1310,7 @@ int l1if_activate_rf(struct femtol1_hdl *hdl, int on) LOGP(DL1C, LOGL_INFO, "Using external attenuator.\n"); sysp->u.activateRfReq.rfTrx.u8UseExtAtten = 1; sysp->u.activateRfReq.rfTrx.fMaxTxPower = - sysmobts_get_nominal_power(trx); + (float) get_p_trxout_target_mdBm(trx, 0) / 1000; } #endif /* 2.2.0 */ #if SUPERFEMTO_API_VERSION >= SUPERFEMTO_API(3,8,1) @@ -1797,6 +1798,44 @@ int l1if_rf_clock_info_correct(struct femtol1_hdl *fl1h) #endif +static void set_power_param(struct trx_power_params *out, + int trx_p_max_out_dBm, + int int_pa_nominal_gain_dB) +{ + out->trx_p_max_out_mdBm = to_mdB(trx_p_max_out_dBm); + out->pa.nominal_gain_mdB = to_mdB(int_pa_nominal_gain_dB); +} + +static void fill_trx_power_params(struct gsm_bts_trx *trx, + struct phy_instance *pinst) +{ + struct femtol1_hdl *fl1h = pinst->u.sysmobts.hdl; + + switch (fl1h->hw_info.model_nr) { + case 1020: + set_power_param(&trx->power_params, 23, 10); + break; + case 1100: + set_power_param(&trx->power_params, 23, 17); + break; + case 2050: + set_power_param(&trx->power_params, 37, 0); + break; + default: + LOGP(DL1C, LOGL_NOTICE, "Unknown/Unsupported " + "sysmoBTS Model Number %u\n", + fl1h->hw_info.model_nr); + /* fall-through */ + case 0xffff: + /* sysmoBTS 1002 without any setting in EEPROM */ + LOGP(DL1C, LOGL_NOTICE, "Assuming 1002 for sysmoBTS " + "Model number %u\n", fl1h->hw_info.model_nr); + case 1002: + set_power_param(&trx->power_params, 23, 0); + } +} + + int bts_model_phy_link_open(struct phy_link *plink) { struct phy_instance *pinst = phy_instance_by_num(plink, 0); @@ -1812,16 +1851,17 @@ int bts_model_phy_link_open(struct phy_link *plink) return -EIO; } + fill_trx_power_params(pinst->trx, pinst); + bts = pinst->trx->bts; if (pinst->trx == bts->c0) { int rc; - rc = sysmobts_get_nominal_power(bts->c0); + rc = get_p_max_out_mdBm(bts->c0); if (rc < 0) { LOGP(DL1C, LOGL_NOTICE, "Cannot determine nominal " "transmit power. Assuming 23dBm.\n"); } bts->c0->nominal_power = rc; - bts->c0->power_params.trx_p_max_out_mdBm = to_mdB(rc); } phy_link_state_set(plink, PHY_LINK_CONNECTED); |