aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-02-07 19:49:14 +0100
committerHarald Welte <laforge@gnumonks.org>2017-02-14 17:31:27 +0000
commit6b4c6aa375bfe1d49594d8a43345dc6b5df917c3 (patch)
tree44473576d31700938b077e6b493a99cf7f4e94d1
parentc4ac69dcc2bd3825e73f2a026dccc8813dcbe592 (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
-rw-r--r--src/osmo-bts-sysmo/l1_if.c46
-rw-r--r--src/osmo-bts-sysmo/sysmobts_vty.c2
-rw-r--r--src/osmo-bts-sysmo/utils.c26
-rw-r--r--src/osmo-bts-sysmo/utils.h2
4 files changed, 44 insertions, 32 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);
diff --git a/src/osmo-bts-sysmo/sysmobts_vty.c b/src/osmo-bts-sysmo/sysmobts_vty.c
index 330c9ce8..b5940dcf 100644
--- a/src/osmo-bts-sysmo/sysmobts_vty.c
+++ b/src/osmo-bts-sysmo/sysmobts_vty.c
@@ -438,7 +438,7 @@ void bts_model_config_write_bts(struct vty *vty, struct gsm_bts *bts)
void bts_model_config_write_trx(struct vty *vty, struct gsm_bts_trx *trx)
{
- if (trx->nominal_power != sysmobts_get_nominal_power(trx))
+ if (trx->nominal_power != get_p_max_out_mdBm(trx))
vty_out(vty, " nominal-tx-power %d%s", trx->nominal_power,
VTY_NEWLINE);
}
diff --git a/src/osmo-bts-sysmo/utils.c b/src/osmo-bts-sysmo/utils.c
index a636ae15..be6051a8 100644
--- a/src/osmo-bts-sysmo/utils.c
+++ b/src/osmo-bts-sysmo/utils.c
@@ -112,29 +112,3 @@ int sysmobts_select_femto_band(struct gsm_bts_trx *trx, uint16_t arfcn)
/* give up */
return -1;
}
-
-int sysmobts_get_nominal_power(struct gsm_bts_trx *trx)
-{
- struct femtol1_hdl *fl1h = trx_femtol1_hdl(trx);
-
- switch (fl1h->hw_info.model_nr) {
- case 0:
- case 0xffff:
- /* old units have empty flash where the model number is
- * stored in later units */
- case 1002:
- /* 200mW (23 dBm) nominal power */
- return 23;
- case 2050:
- /* 5W(37dBm) per TRX. This could be raiesd to 10W(40dBm)
- * if the second TRX is not used. */
- return 37;
- default:
- LOGP(DL1C, LOGL_ERROR, "Model number %u/0x%x not known.\n",
- fl1h->hw_info.model_nr, fl1h->hw_info.model_nr);
- break;
- }
- return -1;
-}
-
-
diff --git a/src/osmo-bts-sysmo/utils.h b/src/osmo-bts-sysmo/utils.h
index 58e3324f..45908d50 100644
--- a/src/osmo-bts-sysmo/utils.h
+++ b/src/osmo-bts-sysmo/utils.h
@@ -9,6 +9,4 @@ struct gsm_bts_trx;
int band_femto2osmo(GsmL1_FreqBand_t band);
int sysmobts_select_femto_band(struct gsm_bts_trx *trx, uint16_t arfcn);
-
-int sysmobts_get_nominal_power(struct gsm_bts_trx *trx);
#endif