return ret;
}
-static int rtl2831_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
+static int rtl28xx_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
{
struct rtl28xxu_req req;
return rtl28xxu_ctrl_msg(d, &req);
}
-static int rtl2831_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val)
+static int rtl28xx_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val)
{
- return rtl2831_wr_regs(d, reg, &val, 1);
+ return rtl28xx_wr_regs(d, reg, &val, 1);
}
-static int rtl2831_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val)
+static int rtl28xx_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val)
{
return rtl2831_rd_regs(d, reg, val, 1);
}
*/
/* GPIO direction */
- ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_DIR, 0x0a);
+ ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_DIR, 0x0a);
if (ret)
goto err;
/* enable as output GPIO0, GPIO2, GPIO4 */
- ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_OUT_EN, 0x15);
+ ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_OUT_EN, 0x15);
if (ret)
goto err;
switch (cmd) {
case FC_FE_CALLBACK_VHF_ENABLE:
/* set output values */
- ret = rtl2831_rd_reg(d, SYS_GPIO_OUT_VAL, &val);
+ ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &val);
if (ret)
goto err;
val |= 0x40; /* set GPIO6 high */
- ret = rtl2831_wr_reg(d, SYS_GPIO_OUT_VAL, val);
+ ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, val);
if (ret)
goto err;
break;
deb_info("%s:\n", __func__);
- ret = rtl2831_rd_reg(adap->dev, SYS_GPIO_DIR, &val);
+ ret = rtl28xx_rd_reg(adap->dev, SYS_GPIO_DIR, &val);
if (ret)
goto err;
val &= 0xbf;
- ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_DIR, val);
+ ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_DIR, val);
if (ret)
goto err;
/* enable as output GPIO3 and GPIO6*/
- ret = rtl2831_rd_reg(adap->dev, SYS_GPIO_OUT_EN, &val);
+ ret = rtl28xx_rd_reg(adap->dev, SYS_GPIO_OUT_EN, &val);
if (ret)
goto err;
val |= 0x48;
- ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_OUT_EN, val);
+ ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_OUT_EN, val);
if (ret)
goto err;
deb_info("%s: onoff=%d\n", __func__, onoff);
- ret = rtl2831_rd_reg(adap->dev, SYS_GPIO_OUT_VAL, &gpio);
+ ret = rtl28xx_rd_reg(adap->dev, SYS_GPIO_OUT_VAL, &gpio);
if (ret)
goto err;
gpio &= (~0x04); /* LED off */
}
- ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_OUT_VAL, gpio);
+ ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_OUT_VAL, gpio);
if (ret)
goto err;
- ret = rtl2831_wr_regs(adap->dev, USB_EPA_CTL, buf, 2);
+ ret = rtl28xx_wr_regs(adap->dev, USB_EPA_CTL, buf, 2);
if (ret)
goto err;
buf[1] = 0x02; /* reset EPA */
}
- ret = rtl2831_wr_regs(adap->dev, USB_EPA_CTL, buf, 2);
+ ret = rtl28xx_wr_regs(adap->dev, USB_EPA_CTL, buf, 2);
if (ret)
goto err;
deb_info("%s: onoff=%d\n", __func__, onoff);
/* demod adc */
- ret = rtl2831_rd_reg(d, SYS_SYS0, &sys0);
+ ret = rtl28xx_rd_reg(d, SYS_SYS0, &sys0);
if (ret)
goto err;
/* tuner power, read GPIOs */
- ret = rtl2831_rd_reg(d, SYS_GPIO_OUT_VAL, &gpio);
+ ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &gpio);
if (ret)
goto err;
deb_info("%s: WR SYS0=%02x GPIO_OUT_VAL=%02x\n", __func__, sys0, gpio);
/* demod adc */
- ret = rtl2831_wr_reg(d, SYS_SYS0, sys0);
+ ret = rtl28xx_wr_reg(d, SYS_SYS0, sys0);
if (ret)
goto err;
/* tuner power, write GPIOs */
- ret = rtl2831_wr_reg(d, SYS_GPIO_OUT_VAL, gpio);
+ ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, gpio);
if (ret)
goto err;
if (onoff) {
/* set output values */
- ret = rtl2831_rd_reg(d, SYS_GPIO_OUT_VAL, &val);
+ ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &val);
if (ret)
goto err;
val |= 0x08;
val &= 0xef;
- ret = rtl2831_wr_reg(d, SYS_GPIO_OUT_VAL, val);
+ ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, val);
if (ret)
goto err;
/* demod_ctl_1 */
- ret = rtl2831_rd_reg(d, SYS_DEMOD_CTL1, &val);
+ ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL1, &val);
if (ret)
goto err;
val &= 0xef;
- ret = rtl2831_wr_reg(d, SYS_DEMOD_CTL1, val);
+ ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL1, val);
if (ret)
goto err;
/* demod control */
/* PLL enable */
- ret = rtl2831_rd_reg(d, SYS_DEMOD_CTL, &val);
+ ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL, &val);
if (ret)
goto err;
/* bit 7 to 1 */
val |= 0x80;
- ret = rtl2831_wr_reg(d, SYS_DEMOD_CTL, val);
+ ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL, val);
if (ret)
goto err;
/* demod HW reset */
- ret = rtl2831_rd_reg(d, SYS_DEMOD_CTL, &val);
+ ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL, &val);
if (ret)
goto err;
/* bit 5 to 0 */
val &= 0xdf;
- ret = rtl2831_wr_reg(d, SYS_DEMOD_CTL, val);
+ ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL, val);
if (ret)
goto err;
- ret = rtl2831_rd_reg(d, SYS_DEMOD_CTL, &val);
+ ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL, &val);
if (ret)
goto err;
val |= 0x20;
- ret = rtl2831_wr_reg(d, SYS_DEMOD_CTL, val);
+ ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL, val);
if (ret)
goto err;
mdelay(5);
/*enable ADC_Q and ADC_I */
- ret = rtl2831_rd_reg(d, SYS_DEMOD_CTL, &val);
+ ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL, &val);
if (ret)
goto err;
val |= 0x48;
- ret = rtl2831_wr_reg(d, SYS_DEMOD_CTL, val);
+ ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL, val);
if (ret)
goto err;
} else {
/* demod_ctl_1 */
- ret = rtl2831_rd_reg(d, SYS_DEMOD_CTL1, &val);
+ ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL1, &val);
if (ret)
goto err;
val |= 0x0c;
- ret = rtl2831_wr_reg(d, SYS_DEMOD_CTL1, val);
+ ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL1, val);
if (ret)
goto err;
/* set output values */
- ret = rtl2831_rd_reg(d, SYS_GPIO_OUT_VAL, &val);
+ ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &val);
if (ret)
goto err;
val |= 0x10;
- ret = rtl2831_wr_reg(d, SYS_GPIO_OUT_VAL, val);
+ ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, val);
if (ret)
goto err;
/* demod control */
- ret = rtl2831_rd_reg(d, SYS_DEMOD_CTL, &val);
+ ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL, &val);
if (ret)
goto err;
val &= 0x37;
- ret = rtl2831_wr_reg(d, SYS_DEMOD_CTL, val);
+ ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL, val);
if (ret)
goto err;
/* init remote controller */
if (!priv->rc_active) {
for (i = 0; i < ARRAY_SIZE(rc_nec_tab); i++) {
- ret = rtl2831_wr_reg(d, rc_nec_tab[i].reg,
+ ret = rtl28xx_wr_reg(d, rc_nec_tab[i].reg,
rc_nec_tab[i].val);
if (ret)
goto err;
rc_keydown(d->rc_dev, rc_code, 0);
- ret = rtl2831_wr_reg(d, SYS_IRRC_SR, 1);
+ ret = rtl28xx_wr_reg(d, SYS_IRRC_SR, 1);
if (ret)
goto err;
/* repeated intentionally to avoid extra keypress */
- ret = rtl2831_wr_reg(d, SYS_IRRC_SR, 1);
+ ret = rtl28xx_wr_reg(d, SYS_IRRC_SR, 1);
if (ret)
goto err;
}
/* init remote controller */
if (!priv->rc_active) {
for (i = 0; i < ARRAY_SIZE(rc_nec_tab); i++) {
- ret = rtl2831_wr_reg(d, rc_nec_tab[i].reg,
+ ret = rtl28xx_wr_reg(d, rc_nec_tab[i].reg,
rc_nec_tab[i].val);
if (ret)
goto err;
priv->rc_active = true;
}
- ret = rtl2831_rd_reg(d, IR_RX_IF, &buf[0]);
+ ret = rtl28xx_rd_reg(d, IR_RX_IF, &buf[0]);
if (ret)
goto err;
if (buf[0] != 0x83)
goto exit;
- ret = rtl2831_rd_reg(d, IR_RX_BC, &buf[0]);
+ ret = rtl28xx_rd_reg(d, IR_RX_BC, &buf[0]);
if (ret)
goto err;
/* TODO: pass raw IR to Kernel IR decoder */
- ret = rtl2831_wr_reg(d, IR_RX_IF, 0x03);
- ret = rtl2831_wr_reg(d, IR_RX_BUF_CTRL, 0x80);
- ret = rtl2831_wr_reg(d, IR_RX_CTRL, 0x80);
+ ret = rtl28xx_wr_reg(d, IR_RX_IF, 0x03);
+ ret = rtl28xx_wr_reg(d, IR_RX_BUF_CTRL, 0x80);
+ ret = rtl28xx_wr_reg(d, IR_RX_CTRL, 0x80);
exit:
return ret;
/* init USB endpoints */
- ret = rtl2831_rd_reg(d, USB_SYSCTL_0, &val);
+ ret = rtl28xx_rd_reg(d, USB_SYSCTL_0, &val);
if (ret)
goto err;
/* enable DMA and Full Packet Mode*/
val |= 0x09;
- ret = rtl2831_wr_reg(d, USB_SYSCTL_0, val);
+ ret = rtl28xx_wr_reg(d, USB_SYSCTL_0, val);
if (ret)
goto err;
/* set EPA maximum packet size to 0x0200 */
- ret = rtl2831_wr_regs(d, USB_EPA_MAXPKT, "\x00\x02\x00\x00", 4);
+ ret = rtl28xx_wr_regs(d, USB_EPA_MAXPKT, "\x00\x02\x00\x00", 4);
if (ret)
goto err;
/* change EPA FIFO length */
- ret = rtl2831_wr_regs(d, USB_EPA_FIFO_CFG, "\x14\x00\x00\x00", 4);
+ ret = rtl28xx_wr_regs(d, USB_EPA_FIFO_CFG, "\x14\x00\x00\x00", 4);
if (ret)
goto err;