[PATCH] osmo-bts[sysmocom/0.3.5-stable]: sysmobts: fully support trx_power_params

daniel gerrit-no-reply at lists.osmocom.org
Tue Feb 14 16:47:58 UTC 2017


Review at  https://gerrit.osmocom.org/1823

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
---
M src/osmo-bts-sysmo/l1_if.c
M src/osmo-bts-sysmo/main.c
M src/osmo-bts-sysmo/sysmobts_vty.c
M src/osmo-bts-sysmo/utils.c
M src/osmo-bts-sysmo/utils.h
5 files changed, 49 insertions(+), 32 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/23/1823/1

diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index 0159607..dc97802 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -51,6 +51,7 @@
 #include <osmo-bts/handover.h>
 #include <osmo-bts/cbch.h>
 #include <osmo-bts/bts_model.h>
+#include <osmo-bts/tx_power.h>
 
 #include <sysmocom/femtobts/superfemto.h>
 #include <sysmocom/femtobts/gsml1prim.h>
@@ -1200,7 +1201,7 @@
 			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)
diff --git a/src/osmo-bts-sysmo/main.c b/src/osmo-bts-sysmo/main.c
index 1150310..cb8d5a6 100644
--- a/src/osmo-bts-sysmo/main.c
+++ b/src/osmo-bts-sysmo/main.c
@@ -47,6 +47,7 @@
 #include <osmo-bts/bts_model.h>
 #include <osmo-bts/pcu_if.h>
 #include <osmo-bts/control_if.h>
+#include <osmo-bts/tx_power.h>
 
 #define SYSMOBTS_RF_LOCK_PATH	"/var/lock/bts_rf_lock"
 
@@ -63,10 +64,46 @@
 static unsigned int dsp_trace = 0x71c00020;
 static int rt_prio = -1;
 
+
+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 femtol1_hdl *fl1h)
+{
+	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_init(struct gsm_bts *bts)
 {
 	struct femtol1_hdl *fl1h;
-	int rc;
+	int rc, i;
 
 	fl1h = l1if_open(bts->c0);
 	if (!fl1h) {
@@ -77,7 +114,14 @@
 
 	bts->c0->role_bts.l1h = fl1h;
 
-	rc = sysmobts_get_nominal_power(bts->c0);
+
+	/* Set power params for each trx */
+	for (i = 0; i < bts->num_trx; i++) {
+		struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, i);
+		fill_trx_power_params(trx, fl1h);
+	}
+
+	rc = get_p_max_out_mdBm(bts->c0);
 	if (rc < 0) {
 		LOGP(DL1C, LOGL_NOTICE, "Cannot determine nominal "
 		     "transmit power. Assuming 23dBm.\n");
diff --git a/src/osmo-bts-sysmo/sysmobts_vty.c b/src/osmo-bts-sysmo/sysmobts_vty.c
index 8b617d7..2d1b57d 100644
--- a/src/osmo-bts-sysmo/sysmobts_vty.c
+++ b/src/osmo-bts-sysmo/sysmobts_vty.c
@@ -546,7 +546,7 @@
 		VTY_NEWLINE);
 	vty_out(vty, "  min-qual-norm %.0f%s", fl1h->min_qual_norm * 10.0f,
 		VTY_NEWLINE);
-	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 a636ae1..be6051a 100644
--- a/src/osmo-bts-sysmo/utils.c
+++ b/src/osmo-bts-sysmo/utils.c
@@ -112,29 +112,3 @@
 	/* 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 58e3324..45908d5 100644
--- a/src/osmo-bts-sysmo/utils.h
+++ b/src/osmo-bts-sysmo/utils.h
@@ -9,6 +9,4 @@
 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

-- 
To view, visit https://gerrit.osmocom.org/1823
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieff75d5becaa80a2097b6e744c75c2d16259c9a4
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: sysmocom/0.3.5-stable
Gerrit-Owner: daniel <dwillmann at sysmocom.de>


More information about the gerrit-log mailing list