aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/s5h1411.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/frontends/s5h1411.c')
-rw-r--r--drivers/media/dvb/frontends/s5h1411.c48
1 files changed, 38 insertions, 10 deletions
diff --git a/drivers/media/dvb/frontends/s5h1411.c b/drivers/media/dvb/frontends/s5h1411.c
index d8adf1e32019..6cc4b7a9dd60 100644
--- a/drivers/media/dvb/frontends/s5h1411.c
+++ b/drivers/media/dvb/frontends/s5h1411.c
@@ -585,9 +585,9 @@ static int s5h1411_register_reset(struct dvb_frontend *fe)
585} 585}
586 586
587/* Talk to the demod, set the FEC, GUARD, QAM settings etc */ 587/* Talk to the demod, set the FEC, GUARD, QAM settings etc */
588static int s5h1411_set_frontend(struct dvb_frontend *fe, 588static int s5h1411_set_frontend(struct dvb_frontend *fe)
589 struct dvb_frontend_parameters *p)
590{ 589{
590 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
591 struct s5h1411_state *state = fe->demodulator_priv; 591 struct s5h1411_state *state = fe->demodulator_priv;
592 592
593 dprintk("%s(frequency=%d)\n", __func__, p->frequency); 593 dprintk("%s(frequency=%d)\n", __func__, p->frequency);
@@ -596,13 +596,13 @@ static int s5h1411_set_frontend(struct dvb_frontend *fe,
596 596
597 state->current_frequency = p->frequency; 597 state->current_frequency = p->frequency;
598 598
599 s5h1411_enable_modulation(fe, p->u.vsb.modulation); 599 s5h1411_enable_modulation(fe, p->modulation);
600 600
601 if (fe->ops.tuner_ops.set_params) { 601 if (fe->ops.tuner_ops.set_params) {
602 if (fe->ops.i2c_gate_ctrl) 602 if (fe->ops.i2c_gate_ctrl)
603 fe->ops.i2c_gate_ctrl(fe, 1); 603 fe->ops.i2c_gate_ctrl(fe, 1);
604 604
605 fe->ops.tuner_ops.set_params(fe, p); 605 fe->ops.tuner_ops.set_params(fe);
606 606
607 if (fe->ops.i2c_gate_ctrl) 607 if (fe->ops.i2c_gate_ctrl)
608 fe->ops.i2c_gate_ctrl(fe, 0); 608 fe->ops.i2c_gate_ctrl(fe, 0);
@@ -794,7 +794,36 @@ static int s5h1411_read_snr(struct dvb_frontend *fe, u16 *snr)
794static int s5h1411_read_signal_strength(struct dvb_frontend *fe, 794static int s5h1411_read_signal_strength(struct dvb_frontend *fe,
795 u16 *signal_strength) 795 u16 *signal_strength)
796{ 796{
797 return s5h1411_read_snr(fe, signal_strength); 797 /* borrowed from lgdt330x.c
798 *
799 * Calculate strength from SNR up to 35dB
800 * Even though the SNR can go higher than 35dB,
801 * there is some comfort factor in having a range of
802 * strong signals that can show at 100%
803 */
804 u16 snr;
805 u32 tmp;
806 int ret = s5h1411_read_snr(fe, &snr);
807
808 *signal_strength = 0;
809
810 if (0 == ret) {
811 /* The following calculation method was chosen
812 * purely for the sake of code re-use from the
813 * other demod drivers that use this method */
814
815 /* Convert from SNR in dB * 10 to 8.24 fixed-point */
816 tmp = (snr * ((1 << 24) / 10));
817
818 /* Convert from 8.24 fixed-point to
819 * scale the range 0 - 35*2^24 into 0 - 65535*/
820 if (tmp >= 8960 * 0x10000)
821 *signal_strength = 0xffff;
822 else
823 *signal_strength = tmp / 8960;
824 }
825
826 return ret;
798} 827}
799 828
800static int s5h1411_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) 829static int s5h1411_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
@@ -811,13 +840,13 @@ static int s5h1411_read_ber(struct dvb_frontend *fe, u32 *ber)
811 return s5h1411_read_ucblocks(fe, ber); 840 return s5h1411_read_ucblocks(fe, ber);
812} 841}
813 842
814static int s5h1411_get_frontend(struct dvb_frontend *fe, 843static int s5h1411_get_frontend(struct dvb_frontend *fe)
815 struct dvb_frontend_parameters *p)
816{ 844{
845 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
817 struct s5h1411_state *state = fe->demodulator_priv; 846 struct s5h1411_state *state = fe->demodulator_priv;
818 847
819 p->frequency = state->current_frequency; 848 p->frequency = state->current_frequency;
820 p->u.vsb.modulation = state->current_modulation; 849 p->modulation = state->current_modulation;
821 850
822 return 0; 851 return 0;
823} 852}
@@ -886,10 +915,9 @@ error:
886EXPORT_SYMBOL(s5h1411_attach); 915EXPORT_SYMBOL(s5h1411_attach);
887 916
888static struct dvb_frontend_ops s5h1411_ops = { 917static struct dvb_frontend_ops s5h1411_ops = {
889 918 .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
890 .info = { 919 .info = {
891 .name = "Samsung S5H1411 QAM/8VSB Frontend", 920 .name = "Samsung S5H1411 QAM/8VSB Frontend",
892 .type = FE_ATSC,
893 .frequency_min = 54000000, 921 .frequency_min = 54000000,
894 .frequency_max = 858000000, 922 .frequency_max = 858000000,
895 .frequency_stepsize = 62500, 923 .frequency_stepsize = 62500,