Lines Matching refs:priv

30 static int tda10071_wr_regs(struct tda10071_priv *priv, u8 reg, u8 *val,
37 .addr = priv->cfg.i2c_address,
47 ret = i2c_transfer(priv->i2c, msg, 1);
58 static int tda10071_rd_regs(struct tda10071_priv *priv, u8 reg, u8 *val,
65 .addr = priv->cfg.i2c_address,
70 .addr = priv->cfg.i2c_address,
77 ret = i2c_transfer(priv->i2c, msg, 2);
89 static int tda10071_wr_reg(struct tda10071_priv *priv, u8 reg, u8 val)
91 return tda10071_wr_regs(priv, reg, &val, 1);
95 static int tda10071_rd_reg(struct tda10071_priv *priv, u8 reg, u8 *val)
97 return tda10071_rd_regs(priv, reg, val, 1);
101 int tda10071_wr_reg_mask(struct tda10071_priv *priv, u8 reg, u8 val, u8 mask)
108 ret = tda10071_rd_regs(priv, reg, &tmp, 1);
117 return tda10071_wr_regs(priv, reg, &val, 1);
121 int tda10071_rd_reg_mask(struct tda10071_priv *priv, u8 reg, u8 *val, u8 mask)
126 ret = tda10071_rd_regs(priv, reg, &tmp, 1);
143 static int tda10071_cmd_execute(struct tda10071_priv *priv,
149 if (!priv->warm) {
155 ret = tda10071_wr_regs(priv, 0x00, cmd->args, cmd->len);
160 ret = tda10071_wr_reg(priv, 0x1f, 1);
166 ret = tda10071_rd_reg(priv, 0x1f, &tmp);
189 struct tda10071_priv *priv = fe->demodulator_priv;
194 if (!priv->warm) {
220 ret = tda10071_cmd_execute(priv, &cmd);
233 struct tda10071_priv *priv = fe->demodulator_priv;
238 if (!priv->warm) {
265 ret = tda10071_cmd_execute(priv, &cmd);
278 struct tda10071_priv *priv = fe->demodulator_priv;
283 if (!priv->warm) {
297 ret = tda10071_rd_reg_mask(priv, 0x47, &tmp, 0x01);
311 ret = tda10071_wr_reg_mask(priv, 0x47, 0x00, 0x01);
324 ret = tda10071_cmd_execute(priv, &cmd);
337 struct tda10071_priv *priv = fe->demodulator_priv;
342 if (!priv->warm) {
351 ret = tda10071_rd_reg_mask(priv, 0x47, &tmp, 0x02);
366 ret = tda10071_rd_reg(priv, 0x46, &tmp);
378 ret = tda10071_cmd_execute(priv, &cmd);
382 ret = tda10071_rd_regs(priv, cmd.len, reply->msg, reply->msg_len);
395 struct tda10071_priv *priv = fe->demodulator_priv;
400 if (!priv->warm) {
422 ret = tda10071_rd_reg_mask(priv, 0x47, &tmp, 0x01);
436 ret = tda10071_wr_reg_mask(priv, 0x47, 0x00, 0x01);
444 ret = tda10071_cmd_execute(priv, &cmd);
456 struct tda10071_priv *priv = fe->demodulator_priv;
462 if (!priv->warm) {
467 ret = tda10071_rd_reg(priv, 0x39, &tmp);
480 priv->fe_status = *status;
490 struct tda10071_priv *priv = fe->demodulator_priv;
494 if (!priv->warm || !(priv->fe_status & FE_HAS_LOCK)) {
500 ret = tda10071_rd_regs(priv, 0x3a, buf, 2);
515 struct tda10071_priv *priv = fe->demodulator_priv;
520 if (!priv->warm || !(priv->fe_status & FE_HAS_LOCK)) {
529 ret = tda10071_cmd_execute(priv, &cmd);
534 ret = tda10071_rd_reg(priv, 0x50, &tmp);
554 struct tda10071_priv *priv = fe->demodulator_priv;
559 if (!priv->warm || !(priv->fe_status & FE_HAS_LOCK)) {
560 *ber = priv->ber = 0;
565 switch (priv->delivery_system) {
577 *ber = priv->ber = 0;
581 ret = tda10071_rd_reg(priv, reg, &tmp);
585 if (priv->meas_count[i] == tmp) {
587 *ber = priv->ber;
590 priv->meas_count[i] = tmp;
597 ret = tda10071_cmd_execute(priv, &cmd);
601 ret = tda10071_rd_regs(priv, cmd.len, buf, len);
605 if (priv->delivery_system == SYS_DVBS) {
607 priv->ucb += (buf[4] << 8) | buf[5];
611 priv->ber = *ber;
621 struct tda10071_priv *priv = fe->demodulator_priv;
624 if (!priv->warm || !(priv->fe_status & FE_HAS_LOCK)) {
631 *ucblocks = priv->ucb;
641 struct tda10071_priv *priv = fe->demodulator_priv;
652 priv->delivery_system = SYS_UNDEFINED;
654 if (!priv->warm) {
743 ret = tda10071_wr_reg(priv, 0x81, div);
747 ret = tda10071_wr_reg(priv, 0xe3, div);
767 ret = tda10071_cmd_execute(priv, &cmd);
771 priv->delivery_system = c->delivery_system;
781 struct tda10071_priv *priv = fe->demodulator_priv;
786 if (!priv->warm || !(priv->fe_status & FE_HAS_LOCK)) {
791 ret = tda10071_rd_regs(priv, 0x30, buf, 5);
824 ret = tda10071_rd_regs(priv, 0x52, buf, 3);
838 struct tda10071_priv *priv = fe->demodulator_priv;
858 { 0x88, priv->cfg.pll_multiplier, 0x3f },
903 ret = tda10071_rd_reg(priv, 0x51, &tmp);
909 priv->warm = 1;
912 ret = tda10071_wr_reg_mask(priv, tab[i].reg,
922 ret = tda10071_cmd_execute(priv, &cmd);
927 priv->warm = 0;
930 ret = request_firmware(&fw, fw_file, priv->i2c->dev.parent);
941 ret = tda10071_wr_reg_mask(priv, tab2[i].reg,
948 ret = tda10071_wr_reg(priv, 0xe0, 0x7f);
952 ret = tda10071_wr_reg(priv, 0xf7, 0x81);
956 ret = tda10071_wr_reg(priv, 0xf8, 0x00);
960 ret = tda10071_wr_reg(priv, 0xf9, 0x00);
973 remaining -= (priv->cfg.i2c_wr_max - 1)) {
975 if (len > (priv->cfg.i2c_wr_max - 1))
976 len = (priv->cfg.i2c_wr_max - 1);
978 ret = tda10071_wr_regs(priv, 0xfa,
988 ret = tda10071_wr_reg(priv, 0xf7, 0x0c);
992 ret = tda10071_wr_reg(priv, 0xe0, 0x00);
1000 ret = tda10071_rd_reg(priv, 0x51, &tmp);
1009 priv->warm = 1;
1014 ret = tda10071_cmd_execute(priv, &cmd);
1018 ret = tda10071_rd_regs(priv, cmd.len, buf, 4);
1026 ret = tda10071_rd_regs(priv, 0x81, buf, 2);
1031 cmd.args[0x01] = ((priv->cfg.xtal / 1000) >> 8) & 0xff;
1032 cmd.args[0x02] = ((priv->cfg.xtal / 1000) >> 0) & 0xff;
1035 cmd.args[0x05] = priv->cfg.pll_multiplier;
1036 cmd.args[0x06] = priv->cfg.spec_inv;
1039 ret = tda10071_cmd_execute(priv, &cmd);
1059 ret = tda10071_cmd_execute(priv, &cmd);
1065 cmd.args[0x02] = priv->cfg.ts_mode;
1070 ret = tda10071_cmd_execute(priv, &cmd);
1074 ret = tda10071_wr_reg_mask(priv, 0xf0, 0x01, 0x01);
1090 ret = tda10071_cmd_execute(priv, &cmd);
1099 ret = tda10071_cmd_execute(priv, &cmd);
1114 struct tda10071_priv *priv = fe->demodulator_priv;
1130 if (!priv->warm) {
1139 ret = tda10071_cmd_execute(priv, &cmd);
1144 ret = tda10071_wr_reg_mask(priv, tab[i].reg, tab[i].val,
1168 struct tda10071_priv *priv = fe->demodulator_priv;
1169 kfree(priv);
1176 struct tda10071_priv *priv = NULL;
1179 /* allocate memory for the internal priv */
1180 priv = kzalloc(sizeof(struct tda10071_priv), GFP_KERNEL);
1181 if (priv == NULL) {
1186 /* setup the priv */
1187 priv->i2c = i2c;
1188 memcpy(&priv->cfg, config, sizeof(struct tda10071_config));
1191 ret = tda10071_rd_reg(priv, 0xff, &tmp);
1196 ret = tda10071_rd_reg(priv, 0xdd, &tmp);
1201 ret = tda10071_rd_reg(priv, 0xfe, &tmp);
1206 memcpy(&priv->fe.ops, &tda10071_ops, sizeof(struct dvb_frontend_ops));
1207 priv->fe.demodulator_priv = priv;
1209 return &priv->fe;
1212 kfree(priv);