aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio
diff options
context:
space:
mode:
authorDinesh Ram <Dinesh.Ram@cern.ch>2013-10-15 11:24:40 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-12-18 03:35:57 -0500
commite26fa6dccf9abb372963b766335611f5eb670891 (patch)
treebb655f9c6b8a966341692ba4311525a1e8c0550f /drivers/media/radio
parentd808f5bc728186ad7415dfaffa3c04d2e73ae027 (diff)
[media] si4713: Bug fix for si4713_tx_tune_power() method in the i2c driver
In the si4713_tx_tune_power() method, the args array element 'power' can take values between SI4713_MIN_POWER and SI4713_MAX_POWER. power = 0 is also valid. All the values (0 > power < SI4713_MIN_POWER) are illegal and hence are all mapped to SI4713_MIN_POWER. Signed-off-by: Dinesh Ram <dinesh.ram@cern.ch> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Tested-by: Eduardo Valentin <edubezval@gmail.com> Acked-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/radio')
-rw-r--r--drivers/media/radio/si4713/si4713.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/media/radio/si4713/si4713.c b/drivers/media/radio/si4713/si4713.c
index 096947c730d0..4931325111c2 100644
--- a/drivers/media/radio/si4713/si4713.c
+++ b/drivers/media/radio/si4713/si4713.c
@@ -555,14 +555,14 @@ static int si4713_tx_tune_freq(struct si4713_device *sdev, u16 frequency)
555} 555}
556 556
557/* 557/*
558 * si4713_tx_tune_power - Sets the RF voltage level between 88 and 115 dBuV in 558 * si4713_tx_tune_power - Sets the RF voltage level between 88 and 120 dBuV in
559 * 1 dB units. A value of 0x00 indicates off. The command 559 * 1 dB units. A value of 0x00 indicates off. The command
560 * also sets the antenna tuning capacitance. A value of 0 560 * also sets the antenna tuning capacitance. A value of 0
561 * indicates autotuning, and a value of 1 - 191 indicates 561 * indicates autotuning, and a value of 1 - 191 indicates
562 * a manual override, which results in a tuning 562 * a manual override, which results in a tuning
563 * capacitance of 0.25 pF x @antcap. 563 * capacitance of 0.25 pF x @antcap.
564 * @sdev: si4713_device structure for the device we are communicating 564 * @sdev: si4713_device structure for the device we are communicating
565 * @power: tuning power (88 - 115 dBuV, unit/step 1 dB) 565 * @power: tuning power (88 - 120 dBuV, unit/step 1 dB)
566 * @antcap: value of antenna tuning capacitor (0 - 191) 566 * @antcap: value of antenna tuning capacitor (0 - 191)
567 */ 567 */
568static int si4713_tx_tune_power(struct si4713_device *sdev, u8 power, 568static int si4713_tx_tune_power(struct si4713_device *sdev, u8 power,
@@ -576,16 +576,16 @@ static int si4713_tx_tune_power(struct si4713_device *sdev, u8 power,
576 * .Third byte = power 576 * .Third byte = power
577 * .Fourth byte = antcap 577 * .Fourth byte = antcap
578 */ 578 */
579 const u8 args[SI4713_TXPWR_NARGS] = { 579 u8 args[SI4713_TXPWR_NARGS] = {
580 0x00, 580 0x00,
581 0x00, 581 0x00,
582 power, 582 power,
583 antcap, 583 antcap,
584 }; 584 };
585 585
586 if (((power > 0) && (power < SI4713_MIN_POWER)) || 586 /* Map power values 1-87 to MIN_POWER (88) */
587 power > SI4713_MAX_POWER || antcap > SI4713_MAX_ANTCAP) 587 if (power > 0 && power < SI4713_MIN_POWER)
588 return -EDOM; 588 args[2] = power = SI4713_MIN_POWER;
589 589
590 err = si4713_send_command(sdev, SI4713_CMD_TX_TUNE_POWER, 590 err = si4713_send_command(sdev, SI4713_CMD_TX_TUNE_POWER,
591 args, ARRAY_SIZE(args), val, 591 args, ARRAY_SIZE(args), val,
@@ -1462,9 +1462,9 @@ static int si4713_probe(struct i2c_client *client,
1462 V4L2_CID_TUNE_PREEMPHASIS, 1462 V4L2_CID_TUNE_PREEMPHASIS,
1463 V4L2_PREEMPHASIS_75_uS, 0, V4L2_PREEMPHASIS_50_uS); 1463 V4L2_PREEMPHASIS_75_uS, 0, V4L2_PREEMPHASIS_50_uS);
1464 sdev->tune_pwr_level = v4l2_ctrl_new_std(hdl, &si4713_ctrl_ops, 1464 sdev->tune_pwr_level = v4l2_ctrl_new_std(hdl, &si4713_ctrl_ops,
1465 V4L2_CID_TUNE_POWER_LEVEL, 0, 120, 1, DEFAULT_POWER_LEVEL); 1465 V4L2_CID_TUNE_POWER_LEVEL, 0, SI4713_MAX_POWER, 1, DEFAULT_POWER_LEVEL);
1466 sdev->tune_ant_cap = v4l2_ctrl_new_std(hdl, &si4713_ctrl_ops, 1466 sdev->tune_ant_cap = v4l2_ctrl_new_std(hdl, &si4713_ctrl_ops,
1467 V4L2_CID_TUNE_ANTENNA_CAPACITOR, 0, 191, 1, 0); 1467 V4L2_CID_TUNE_ANTENNA_CAPACITOR, 0, SI4713_MAX_ANTCAP, 1, 0);
1468 1468
1469 if (hdl->error) { 1469 if (hdl->error) {
1470 rval = hdl->error; 1470 rval = hdl->error;