Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 670ef05f authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab
Browse files

[media] rtl28xxu: correct reg access routine name prefixes



Use rtl28xxu_ prefix for all register access routine names.

Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 723abfd7
Loading
Loading
Loading
Loading
+50 −50
Original line number Original line Diff line number Diff line
@@ -62,7 +62,7 @@ static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req)
	return ret;
	return ret;
}
}


static int rtl28xx_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
static int rtl28xxu_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
{
{
	struct rtl28xxu_req req;
	struct rtl28xxu_req req;


@@ -80,7 +80,7 @@ static int rtl28xx_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
	return rtl28xxu_ctrl_msg(d, &req);
	return rtl28xxu_ctrl_msg(d, &req);
}
}


static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
static int rtl28xxu_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
{
{
	struct rtl28xxu_req req;
	struct rtl28xxu_req req;


@@ -98,17 +98,17 @@ static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
	return rtl28xxu_ctrl_msg(d, &req);
	return rtl28xxu_ctrl_msg(d, &req);
}
}


static int rtl28xx_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val)
static int rtl28xxu_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val)
{
{
	return rtl28xx_wr_regs(d, reg, &val, 1);
	return rtl28xxu_wr_regs(d, reg, &val, 1);
}
}


static int rtl28xx_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val)
static int rtl28xxu_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val)
{
{
	return rtl2831_rd_regs(d, reg, val, 1);
	return rtl28xxu_rd_regs(d, reg, val, 1);
}
}


static int rtl28xx_wr_reg_mask(struct dvb_usb_device *d, u16 reg, u8 val,
static int rtl28xxu_wr_reg_mask(struct dvb_usb_device *d, u16 reg, u8 val,
		u8 mask)
		u8 mask)
{
{
	int ret;
	int ret;
@@ -116,7 +116,7 @@ static int rtl28xx_wr_reg_mask(struct dvb_usb_device *d, u16 reg, u8 val,


	/* no need for read if whole reg is written */
	/* no need for read if whole reg is written */
	if (mask != 0xff) {
	if (mask != 0xff) {
		ret = rtl28xx_rd_reg(d, reg, &tmp);
		ret = rtl28xxu_rd_reg(d, reg, &tmp);
		if (ret)
		if (ret)
			return ret;
			return ret;


@@ -125,7 +125,7 @@ static int rtl28xx_wr_reg_mask(struct dvb_usb_device *d, u16 reg, u8 val,
		val |= tmp;
		val |= tmp;
	}
	}


	return rtl28xx_wr_reg(d, reg, val);
	return rtl28xxu_wr_reg(d, reg, val);
}
}


/* I2C */
/* I2C */
@@ -274,12 +274,12 @@ static int rtl2831u_read_config(struct dvb_usb_device *d)
	 */
	 */


	/* GPIO direction */
	/* GPIO direction */
	ret = rtl28xx_wr_reg(d, SYS_GPIO_DIR, 0x0a);
	ret = rtl28xxu_wr_reg(d, SYS_GPIO_DIR, 0x0a);
	if (ret)
	if (ret)
		goto err;
		goto err;


	/* enable as output GPIO0, GPIO2, GPIO4 */
	/* enable as output GPIO0, GPIO2, GPIO4 */
	ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_EN, 0x15);
	ret = rtl28xxu_wr_reg(d, SYS_GPIO_OUT_EN, 0x15);
	if (ret)
	if (ret)
		goto err;
		goto err;


@@ -361,11 +361,11 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
	dev_dbg(&d->intf->dev, "\n");
	dev_dbg(&d->intf->dev, "\n");


	/* enable GPIO3 and GPIO6 as output */
	/* enable GPIO3 and GPIO6 as output */
	ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_DIR, 0x00, 0x40);
	ret = rtl28xxu_wr_reg_mask(d, SYS_GPIO_DIR, 0x00, 0x40);
	if (ret)
	if (ret)
		goto err;
		goto err;


	ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x48, 0x48);
	ret = rtl28xxu_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x48, 0x48);
	if (ret)
	if (ret)
		goto err;
		goto err;


@@ -483,15 +483,15 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
	/* probe slave demod */
	/* probe slave demod */
	if (dev->tuner == TUNER_RTL2832_R828D) {
	if (dev->tuner == TUNER_RTL2832_R828D) {
		/* power on MN88472 demod on GPIO0 */
		/* power on MN88472 demod on GPIO0 */
		ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x01, 0x01);
		ret = rtl28xxu_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x01, 0x01);
		if (ret)
		if (ret)
			goto err;
			goto err;


		ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_DIR, 0x00, 0x01);
		ret = rtl28xxu_wr_reg_mask(d, SYS_GPIO_DIR, 0x00, 0x01);
		if (ret)
		if (ret)
			goto err;
			goto err;


		ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x01, 0x01);
		ret = rtl28xxu_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x01, 0x01);
		if (ret)
		if (ret)
			goto err;
			goto err;


@@ -679,7 +679,7 @@ static int rtl2832u_fc0012_tuner_callback(struct dvb_usb_device *d,
	switch (cmd) {
	switch (cmd) {
	case FC_FE_CALLBACK_VHF_ENABLE:
	case FC_FE_CALLBACK_VHF_ENABLE:
		/* set output values */
		/* set output values */
		ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &val);
		ret = rtl28xxu_rd_reg(d, SYS_GPIO_OUT_VAL, &val);
		if (ret)
		if (ret)
			goto err;
			goto err;


@@ -689,7 +689,7 @@ static int rtl2832u_fc0012_tuner_callback(struct dvb_usb_device *d,
			val |= 0x40; /* set GPIO6 high */
			val |= 0x40; /* set GPIO6 high */




		ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, val);
		ret = rtl28xxu_wr_reg(d, SYS_GPIO_OUT_VAL, val);
		if (ret)
		if (ret)
			goto err;
			goto err;
		break;
		break;
@@ -724,7 +724,7 @@ static int rtl2832u_tua9001_tuner_callback(struct dvb_usb_device *d,
		else
		else
			val = (0 << 4);
			val = (0 << 4);


		ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, val, 0x10);
		ret = rtl28xxu_wr_reg_mask(d, SYS_GPIO_OUT_VAL, val, 0x10);
		if (ret)
		if (ret)
			goto err;
			goto err;
		break;
		break;
@@ -734,7 +734,7 @@ static int rtl2832u_tua9001_tuner_callback(struct dvb_usb_device *d,
		else
		else
			val = (0 << 1);
			val = (0 << 1);


		ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, val, 0x02);
		ret = rtl28xxu_wr_reg_mask(d, SYS_GPIO_OUT_VAL, val, 0x02);
		if (ret)
		if (ret)
			goto err;
			goto err;
		break;
		break;
@@ -1109,11 +1109,11 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
		break;
		break;
	case TUNER_RTL2832_TUA9001:
	case TUNER_RTL2832_TUA9001:
		/* enable GPIO1 and GPIO4 as output */
		/* enable GPIO1 and GPIO4 as output */
		ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_DIR, 0x00, 0x12);
		ret = rtl28xxu_wr_reg_mask(d, SYS_GPIO_DIR, 0x00, 0x12);
		if (ret)
		if (ret)
			goto err;
			goto err;


		ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x12, 0x12);
		ret = rtl28xxu_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x12, 0x12);
		if (ret)
		if (ret)
			goto err;
			goto err;


@@ -1234,23 +1234,23 @@ static int rtl28xxu_init(struct dvb_usb_device *d)
	dev_dbg(&d->intf->dev, "\n");
	dev_dbg(&d->intf->dev, "\n");


	/* init USB endpoints */
	/* init USB endpoints */
	ret = rtl28xx_rd_reg(d, USB_SYSCTL_0, &val);
	ret = rtl28xxu_rd_reg(d, USB_SYSCTL_0, &val);
	if (ret)
	if (ret)
		goto err;
		goto err;


	/* enable DMA and Full Packet Mode*/
	/* enable DMA and Full Packet Mode*/
	val |= 0x09;
	val |= 0x09;
	ret = rtl28xx_wr_reg(d, USB_SYSCTL_0, val);
	ret = rtl28xxu_wr_reg(d, USB_SYSCTL_0, val);
	if (ret)
	if (ret)
		goto err;
		goto err;


	/* set EPA maximum packet size to 0x0200 */
	/* set EPA maximum packet size to 0x0200 */
	ret = rtl28xx_wr_regs(d, USB_EPA_MAXPKT, "\x00\x02\x00\x00", 4);
	ret = rtl28xxu_wr_regs(d, USB_EPA_MAXPKT, "\x00\x02\x00\x00", 4);
	if (ret)
	if (ret)
		goto err;
		goto err;


	/* change EPA FIFO length */
	/* change EPA FIFO length */
	ret = rtl28xx_wr_regs(d, USB_EPA_FIFO_CFG, "\x14\x00\x00\x00", 4);
	ret = rtl28xxu_wr_regs(d, USB_EPA_FIFO_CFG, "\x14\x00\x00\x00", 4);
	if (ret)
	if (ret)
		goto err;
		goto err;


@@ -1268,12 +1268,12 @@ static int rtl2831u_power_ctrl(struct dvb_usb_device *d, int onoff)
	dev_dbg(&d->intf->dev, "onoff=%d\n", onoff);
	dev_dbg(&d->intf->dev, "onoff=%d\n", onoff);


	/* demod adc */
	/* demod adc */
	ret = rtl28xx_rd_reg(d, SYS_SYS0, &sys0);
	ret = rtl28xxu_rd_reg(d, SYS_SYS0, &sys0);
	if (ret)
	if (ret)
		goto err;
		goto err;


	/* tuner power, read GPIOs */
	/* tuner power, read GPIOs */
	ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &gpio);
	ret = rtl28xxu_rd_reg(d, SYS_GPIO_OUT_VAL, &gpio);
	if (ret)
	if (ret)
		goto err;
		goto err;


@@ -1299,17 +1299,17 @@ static int rtl2831u_power_ctrl(struct dvb_usb_device *d, int onoff)
	dev_dbg(&d->intf->dev, "WR SYS0=%02x GPIO_OUT_VAL=%02x\n", sys0, gpio);
	dev_dbg(&d->intf->dev, "WR SYS0=%02x GPIO_OUT_VAL=%02x\n", sys0, gpio);


	/* demod adc */
	/* demod adc */
	ret = rtl28xx_wr_reg(d, SYS_SYS0, sys0);
	ret = rtl28xxu_wr_reg(d, SYS_SYS0, sys0);
	if (ret)
	if (ret)
		goto err;
		goto err;


	/* tuner power, write GPIOs */
	/* tuner power, write GPIOs */
	ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, gpio);
	ret = rtl28xxu_wr_reg(d, SYS_GPIO_OUT_VAL, gpio);
	if (ret)
	if (ret)
		goto err;
		goto err;


	/* streaming EP: stall & reset */
	/* streaming EP: stall & reset */
	ret = rtl28xx_wr_regs(d, USB_EPA_CTL, epa_ctl, 2);
	ret = rtl28xxu_wr_regs(d, USB_EPA_CTL, epa_ctl, 2);
	if (ret)
	if (ret)
		goto err;
		goto err;


@@ -1330,27 +1330,27 @@ static int rtl2832u_power_ctrl(struct dvb_usb_device *d, int onoff)


	if (onoff) {
	if (onoff) {
		/* GPIO3=1, GPIO4=0 */
		/* GPIO3=1, GPIO4=0 */
		ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x08, 0x18);
		ret = rtl28xxu_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x08, 0x18);
		if (ret)
		if (ret)
			goto err;
			goto err;


		/* suspend? */
		/* suspend? */
		ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL1, 0x00, 0x10);
		ret = rtl28xxu_wr_reg_mask(d, SYS_DEMOD_CTL1, 0x00, 0x10);
		if (ret)
		if (ret)
			goto err;
			goto err;


		/* enable PLL */
		/* enable PLL */
		ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x80, 0x80);
		ret = rtl28xxu_wr_reg_mask(d, SYS_DEMOD_CTL, 0x80, 0x80);
		if (ret)
		if (ret)
			goto err;
			goto err;


		/* disable reset */
		/* disable reset */
		ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x20, 0x20);
		ret = rtl28xxu_wr_reg_mask(d, SYS_DEMOD_CTL, 0x20, 0x20);
		if (ret)
		if (ret)
			goto err;
			goto err;


		/* streaming EP: clear stall & reset */
		/* streaming EP: clear stall & reset */
		ret = rtl28xx_wr_regs(d, USB_EPA_CTL, "\x00\x00", 2);
		ret = rtl28xxu_wr_regs(d, USB_EPA_CTL, "\x00\x00", 2);
		if (ret)
		if (ret)
			goto err;
			goto err;


@@ -1359,17 +1359,17 @@ static int rtl2832u_power_ctrl(struct dvb_usb_device *d, int onoff)
			goto err;
			goto err;
	} else {
	} else {
		/* GPIO4=1 */
		/* GPIO4=1 */
		ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x10, 0x10);
		ret = rtl28xxu_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x10, 0x10);
		if (ret)
		if (ret)
			goto err;
			goto err;


		/* disable PLL */
		/* disable PLL */
		ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x00, 0x80);
		ret = rtl28xxu_wr_reg_mask(d, SYS_DEMOD_CTL, 0x00, 0x80);
		if (ret)
		if (ret)
			goto err;
			goto err;


		/* streaming EP: set stall & reset */
		/* streaming EP: set stall & reset */
		ret = rtl28xx_wr_regs(d, USB_EPA_CTL, "\x10\x02", 2);
		ret = rtl28xxu_wr_regs(d, USB_EPA_CTL, "\x10\x02", 2);
		if (ret)
		if (ret)
			goto err;
			goto err;
	}
	}
@@ -1409,7 +1409,7 @@ static int rtl28xxu_frontend_ctrl(struct dvb_frontend *fe, int onoff)
	else
	else
		val = 0x00; /* disable ADC */
		val = 0x00; /* disable ADC */


	ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, val, 0x48);
	ret = rtl28xxu_wr_reg_mask(d, SYS_DEMOD_CTL, val, 0x48);
	if (ret)
	if (ret)
		goto err;
		goto err;


@@ -1453,7 +1453,7 @@ static int rtl2831u_rc_query(struct dvb_usb_device *d)
	/* init remote controller */
	/* init remote controller */
	if (!dev->rc_active) {
	if (!dev->rc_active) {
		for (i = 0; i < ARRAY_SIZE(rc_nec_tab); i++) {
		for (i = 0; i < ARRAY_SIZE(rc_nec_tab); i++) {
			ret = rtl28xx_wr_reg(d, rc_nec_tab[i].reg,
			ret = rtl28xxu_wr_reg(d, rc_nec_tab[i].reg,
					rc_nec_tab[i].val);
					rc_nec_tab[i].val);
			if (ret)
			if (ret)
				goto err;
				goto err;
@@ -1461,7 +1461,7 @@ static int rtl2831u_rc_query(struct dvb_usb_device *d)
		dev->rc_active = true;
		dev->rc_active = true;
	}
	}


	ret = rtl2831_rd_regs(d, SYS_IRRC_RP, buf, 5);
	ret = rtl28xxu_rd_regs(d, SYS_IRRC_RP, buf, 5);
	if (ret)
	if (ret)
		goto err;
		goto err;


@@ -1483,12 +1483,12 @@ static int rtl2831u_rc_query(struct dvb_usb_device *d)


		rc_keydown(d->rc_dev, RC_TYPE_NEC, rc_code, 0);
		rc_keydown(d->rc_dev, RC_TYPE_NEC, rc_code, 0);


		ret = rtl28xx_wr_reg(d, SYS_IRRC_SR, 1);
		ret = rtl28xxu_wr_reg(d, SYS_IRRC_SR, 1);
		if (ret)
		if (ret)
			goto err;
			goto err;


		/* repeated intentionally to avoid extra keypress */
		/* repeated intentionally to avoid extra keypress */
		ret = rtl28xx_wr_reg(d, SYS_IRRC_SR, 1);
		ret = rtl28xxu_wr_reg(d, SYS_IRRC_SR, 1);
		if (ret)
		if (ret)
			goto err;
			goto err;
	}
	}
@@ -1544,7 +1544,7 @@ static int rtl2832u_rc_query(struct dvb_usb_device *d)
		};
		};


		for (i = 0; i < ARRAY_SIZE(init_tab); i++) {
		for (i = 0; i < ARRAY_SIZE(init_tab); i++) {
			ret = rtl28xx_wr_reg_mask(d, init_tab[i].reg,
			ret = rtl28xxu_wr_reg_mask(d, init_tab[i].reg,
					init_tab[i].val, init_tab[i].mask);
					init_tab[i].val, init_tab[i].mask);
			if (ret)
			if (ret)
				goto err;
				goto err;
@@ -1553,27 +1553,27 @@ static int rtl2832u_rc_query(struct dvb_usb_device *d)
		dev->rc_active = true;
		dev->rc_active = true;
	}
	}


	ret = rtl28xx_rd_reg(d, IR_RX_IF, &buf[0]);
	ret = rtl28xxu_rd_reg(d, IR_RX_IF, &buf[0]);
	if (ret)
	if (ret)
		goto err;
		goto err;


	if (buf[0] != 0x83)
	if (buf[0] != 0x83)
		goto exit;
		goto exit;


	ret = rtl28xx_rd_reg(d, IR_RX_BC, &buf[0]);
	ret = rtl28xxu_rd_reg(d, IR_RX_BC, &buf[0]);
	if (ret)
	if (ret)
		goto err;
		goto err;


	len = buf[0];
	len = buf[0];


	/* read raw code from hw */
	/* read raw code from hw */
	ret = rtl2831_rd_regs(d, IR_RX_BUF, buf, len);
	ret = rtl28xxu_rd_regs(d, IR_RX_BUF, buf, len);
	if (ret)
	if (ret)
		goto err;
		goto err;


	/* let hw receive new code */
	/* let hw receive new code */
	for (i = 0; i < ARRAY_SIZE(refresh_tab); i++) {
	for (i = 0; i < ARRAY_SIZE(refresh_tab); i++) {
		ret = rtl28xx_wr_reg_mask(d, refresh_tab[i].reg,
		ret = rtl28xxu_wr_reg_mask(d, refresh_tab[i].reg,
				refresh_tab[i].val, refresh_tab[i].mask);
				refresh_tab[i].val, refresh_tab[i].mask);
		if (ret)
		if (ret)
			goto err;
			goto err;
@@ -1603,7 +1603,7 @@ static int rtl2832u_get_rc_config(struct dvb_usb_device *d,
{
{
	/* disable IR interrupts in order to avoid SDR sample loss */
	/* disable IR interrupts in order to avoid SDR sample loss */
	if (rtl28xxu_disable_rc)
	if (rtl28xxu_disable_rc)
		return rtl28xx_wr_reg(d, IR_RX_IE, 0x00);
		return rtl28xxu_wr_reg(d, IR_RX_IE, 0x00);


	/* load empty to enable rc */
	/* load empty to enable rc */
	if (!rc->map_name)
	if (!rc->map_name)