diff options
author | Antti Palosaari <crope@iki.fi> | 2015-10-23 18:01:31 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-12-18 12:25:29 -0500 |
commit | d47fa5315cca0c7c06b97abfbd77859d5296be2c (patch) | |
tree | 169ae069a33477539096057ab36359b3b8d0b11c | |
parent | eb35cf47c386fa2088580ff4f450abe8a6f9402e (diff) |
[media] hackrf: move RF gain ctrl enable behind module parameter
Used Avago MGA-81563 RF amplifier could be destroyed pretty easily
with too strong signal or transmitting to bad antenna.
Add module parameter 'enable_rf_gain_ctrl' which allows enabling
RF gain control - otherwise, default without the module parameter,
RF gain control is set to 'grabbed' state which prevents setting
value to the control.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | drivers/media/usb/hackrf/hackrf.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c index 84e8a4210e2e..0fe5cb2c260c 100644 --- a/drivers/media/usb/hackrf/hackrf.c +++ b/drivers/media/usb/hackrf/hackrf.c | |||
@@ -24,6 +24,15 @@ | |||
24 | #include <media/videobuf2-v4l2.h> | 24 | #include <media/videobuf2-v4l2.h> |
25 | #include <media/videobuf2-vmalloc.h> | 25 | #include <media/videobuf2-vmalloc.h> |
26 | 26 | ||
27 | /* | ||
28 | * Used Avago MGA-81563 RF amplifier could be destroyed pretty easily with too | ||
29 | * strong signal or transmitting to bad antenna. | ||
30 | * Set RF gain control to 'grabbed' state by default for sure. | ||
31 | */ | ||
32 | static bool hackrf_enable_rf_gain_ctrl; | ||
33 | module_param_named(enable_rf_gain_ctrl, hackrf_enable_rf_gain_ctrl, bool, 0644); | ||
34 | MODULE_PARM_DESC(enable_rf_gain_ctrl, "enable RX/TX RF amplifier control (warn: could damage amplifier)"); | ||
35 | |||
27 | /* HackRF USB API commands (from HackRF Library) */ | 36 | /* HackRF USB API commands (from HackRF Library) */ |
28 | enum { | 37 | enum { |
29 | CMD_SET_TRANSCEIVER_MODE = 0x01, | 38 | CMD_SET_TRANSCEIVER_MODE = 0x01, |
@@ -1451,6 +1460,7 @@ static int hackrf_probe(struct usb_interface *intf, | |||
1451 | dev_err(dev->dev, "Could not initialize controls\n"); | 1460 | dev_err(dev->dev, "Could not initialize controls\n"); |
1452 | goto err_v4l2_ctrl_handler_free_rx; | 1461 | goto err_v4l2_ctrl_handler_free_rx; |
1453 | } | 1462 | } |
1463 | v4l2_ctrl_grab(dev->rx_rf_gain, !hackrf_enable_rf_gain_ctrl); | ||
1454 | v4l2_ctrl_handler_setup(&dev->rx_ctrl_handler); | 1464 | v4l2_ctrl_handler_setup(&dev->rx_ctrl_handler); |
1455 | 1465 | ||
1456 | /* Register controls for transmitter */ | 1466 | /* Register controls for transmitter */ |
@@ -1471,6 +1481,7 @@ static int hackrf_probe(struct usb_interface *intf, | |||
1471 | dev_err(dev->dev, "Could not initialize controls\n"); | 1481 | dev_err(dev->dev, "Could not initialize controls\n"); |
1472 | goto err_v4l2_ctrl_handler_free_tx; | 1482 | goto err_v4l2_ctrl_handler_free_tx; |
1473 | } | 1483 | } |
1484 | v4l2_ctrl_grab(dev->tx_rf_gain, !hackrf_enable_rf_gain_ctrl); | ||
1474 | v4l2_ctrl_handler_setup(&dev->tx_ctrl_handler); | 1485 | v4l2_ctrl_handler_setup(&dev->tx_ctrl_handler); |
1475 | 1486 | ||
1476 | /* Register the v4l2_device structure */ | 1487 | /* Register the v4l2_device structure */ |