mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-18 09:44:18 +08:00
[media] rtl28xxu: renamed rtl2831_rd/rtl2831_wr to rtl28xx_rd/rtl28xx_wr
Signed-off-by: Thomas Mair <thomas.mair86@googlemail.com> Acked-by: Antti Palosaari <crope@iki.fi> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
5cf6631e52
commit
40a2d3c762
@ -84,7 +84,7 @@ err:
|
||||
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;
|
||||
|
||||
@ -120,12 +120,12 @@ static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
|
||||
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);
|
||||
}
|
||||
@ -312,12 +312,12 @@ static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap)
|
||||
*/
|
||||
|
||||
/* 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;
|
||||
|
||||
@ -409,7 +409,7 @@ static int rtl2832u_fc0012_tuner_callback(struct dvb_usb_device *d,
|
||||
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;
|
||||
|
||||
@ -419,7 +419,7 @@ static int rtl2832u_fc0012_tuner_callback(struct dvb_usb_device *d,
|
||||
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;
|
||||
@ -514,25 +514,25 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
|
||||
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;
|
||||
|
||||
@ -793,7 +793,7 @@ static int rtl2831u_streaming_ctrl(struct dvb_usb_adapter *adap , int onoff)
|
||||
|
||||
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;
|
||||
|
||||
@ -807,11 +807,11 @@ static int rtl2831u_streaming_ctrl(struct dvb_usb_adapter *adap , int onoff)
|
||||
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;
|
||||
|
||||
@ -837,7 +837,7 @@ static int rtl2832u_streaming_ctrl(struct dvb_usb_adapter *adap , int onoff)
|
||||
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;
|
||||
|
||||
@ -855,12 +855,12 @@ static int rtl2831u_power_ctrl(struct dvb_usb_device *d, int onoff)
|
||||
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;
|
||||
|
||||
@ -880,12 +880,12 @@ static int rtl2831u_power_ctrl(struct dvb_usb_device *d, int onoff)
|
||||
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;
|
||||
|
||||
@ -904,107 +904,107 @@ static int rtl2832u_power_ctrl(struct dvb_usb_device *d, int onoff)
|
||||
|
||||
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;
|
||||
|
||||
@ -1043,7 +1043,7 @@ static int rtl2831u_rc_query(struct dvb_usb_device *d)
|
||||
/* 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;
|
||||
@ -1073,12 +1073,12 @@ static int rtl2831u_rc_query(struct dvb_usb_device *d)
|
||||
|
||||
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;
|
||||
}
|
||||
@ -1115,7 +1115,7 @@ static int rtl2832u_rc_query(struct dvb_usb_device *d)
|
||||
/* 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;
|
||||
@ -1123,14 +1123,14 @@ static int rtl2832u_rc_query(struct dvb_usb_device *d)
|
||||
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;
|
||||
|
||||
@ -1139,9 +1139,9 @@ static int rtl2832u_rc_query(struct dvb_usb_device *d)
|
||||
|
||||
/* 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;
|
||||
@ -1346,23 +1346,23 @@ static int rtl28xxu_probe(struct usb_interface *intf,
|
||||
|
||||
|
||||
/* 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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user