提交 d47fa531 编写于 作者: A Antti Palosaari 提交者: Mauro Carvalho Chehab

[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: NAntti Palosaari <crope@iki.fi>
Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
上级 eb35cf47
...@@ -24,6 +24,15 @@ ...@@ -24,6 +24,15 @@
#include <media/videobuf2-v4l2.h> #include <media/videobuf2-v4l2.h>
#include <media/videobuf2-vmalloc.h> #include <media/videobuf2-vmalloc.h>
/*
* Used Avago MGA-81563 RF amplifier could be destroyed pretty easily with too
* strong signal or transmitting to bad antenna.
* Set RF gain control to 'grabbed' state by default for sure.
*/
static bool hackrf_enable_rf_gain_ctrl;
module_param_named(enable_rf_gain_ctrl, hackrf_enable_rf_gain_ctrl, bool, 0644);
MODULE_PARM_DESC(enable_rf_gain_ctrl, "enable RX/TX RF amplifier control (warn: could damage amplifier)");
/* HackRF USB API commands (from HackRF Library) */ /* HackRF USB API commands (from HackRF Library) */
enum { enum {
CMD_SET_TRANSCEIVER_MODE = 0x01, CMD_SET_TRANSCEIVER_MODE = 0x01,
...@@ -1451,6 +1460,7 @@ static int hackrf_probe(struct usb_interface *intf, ...@@ -1451,6 +1460,7 @@ static int hackrf_probe(struct usb_interface *intf,
dev_err(dev->dev, "Could not initialize controls\n"); dev_err(dev->dev, "Could not initialize controls\n");
goto err_v4l2_ctrl_handler_free_rx; goto err_v4l2_ctrl_handler_free_rx;
} }
v4l2_ctrl_grab(dev->rx_rf_gain, !hackrf_enable_rf_gain_ctrl);
v4l2_ctrl_handler_setup(&dev->rx_ctrl_handler); v4l2_ctrl_handler_setup(&dev->rx_ctrl_handler);
/* Register controls for transmitter */ /* Register controls for transmitter */
...@@ -1471,6 +1481,7 @@ static int hackrf_probe(struct usb_interface *intf, ...@@ -1471,6 +1481,7 @@ static int hackrf_probe(struct usb_interface *intf,
dev_err(dev->dev, "Could not initialize controls\n"); dev_err(dev->dev, "Could not initialize controls\n");
goto err_v4l2_ctrl_handler_free_tx; goto err_v4l2_ctrl_handler_free_tx;
} }
v4l2_ctrl_grab(dev->tx_rf_gain, !hackrf_enable_rf_gain_ctrl);
v4l2_ctrl_handler_setup(&dev->tx_ctrl_handler); v4l2_ctrl_handler_setup(&dev->tx_ctrl_handler);
/* Register the v4l2_device structure */ /* Register the v4l2_device structure */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册