diff mbox series

[V2,1/2] af9035: init i2c already in it930x_frontend_attach

Message ID 77409C7A-37D1-45F1-A188-97FF92C79699@telefonica.net (mailing list archive)
State New, archived
Headers show
Series Add suport for Avermedia TD310 | expand

Commit Message

Jose Alberto Reguero Feb. 20, 2019, 9:36 p.m. UTC
This patch init i2c in it930x_frontend_attach instead of it930x_tuner_attach.

From: Andreas Kemnade <andreas@kemnade.info>
Signed-off-by: Jose Alberto Reguero <jose.alberto.reguero@gmail.com>

Comments

Sean Young Feb. 21, 2019, 9:32 a.m. UTC | #1
On Wed, Feb 20, 2019 at 10:36:04PM +0100, Jose Alberto Reguero wrote:
> This patch init i2c in it930x_frontend_attach instead of it930x_tuner_attach.

This needs to describe why you are moving it. We can see in the patch
that you've moved it.

Something like "we need i2c to be available in it930x_frontend_attach() so
that .. in a later commit".

> 
> From: Andreas Kemnade <andreas@kemnade.info>

We need the original Signed-off-by from Andreas Kemnade here.

> Signed-off-by: Jose Alberto Reguero <jose.alberto.reguero@gmail.com> 
> 
> diff -upr linux/drivers/media/usb/dvb-usb-v2/af9035.c linux.new/drivers/media/usb/dvb-usb-v2/af9035.c
> --- linux/drivers/media/usb/dvb-usb-v2/af9035.c	2018-09-12 07:40:12.000000000 +0200
> +++ linux.new/drivers/media/usb/dvb-usb-v2/af9035.c	2019-02-20 16:45:17.467869437 +0100
> @@ -1218,6 +1218,48 @@ static int it930x_frontend_attach(struct
>  
>  	dev_dbg(&intf->dev, "adap->id=%d\n", adap->id);
>  
> +	/* I2C master bus 2 clock speed 300k */
> +	ret = af9035_wr_reg(d, 0x00f6a7, 0x07);
> +	if (ret < 0)
> +		goto err;
> +
> +	/* I2C master bus 1,3 clock speed 300k */
> +	ret = af9035_wr_reg(d, 0x00f103, 0x07);
> +	if (ret < 0)
> +		goto err;
> +
> +	/* set gpio11 low */
> +	ret = af9035_wr_reg_mask(d, 0xd8d4, 0x01, 0x01);
> +	if (ret < 0)
> +		goto err;
> +
> +	ret = af9035_wr_reg_mask(d, 0xd8d5, 0x01, 0x01);
> +	if (ret < 0)
> +		goto err;
> +
> +	ret = af9035_wr_reg_mask(d, 0xd8d3, 0x01, 0x01);
> +	if (ret < 0)
> +		goto err;
> +
> +	/* Tuner enable using gpiot2_en, gpiot2_on and gpiot2_o (reset) */
> +	ret = af9035_wr_reg_mask(d, 0xd8b8, 0x01, 0x01);
> +	if (ret < 0)
> +		goto err;
> +
> +	ret = af9035_wr_reg_mask(d, 0xd8b9, 0x01, 0x01);
> +	if (ret < 0)
> +		goto err;
> +
> +	ret = af9035_wr_reg_mask(d, 0xd8b7, 0x00, 0x01);
> +	if (ret < 0)
> +		goto err;
> +
> +	msleep(200);
> +
> +	ret = af9035_wr_reg_mask(d, 0xd8b7, 0x01, 0x01);
> +	if (ret < 0)
> +		goto err;
> +
>  	memset(&si2168_config, 0, sizeof(si2168_config));
>  	si2168_config.i2c_adapter = &adapter;
>  	si2168_config.fe = &adap->fe[0];
> @@ -1575,48 +1617,6 @@ static int it930x_tuner_attach(struct dv
>  
>  	dev_dbg(&intf->dev, "adap->id=%d\n", adap->id);
>  
> -	/* I2C master bus 2 clock speed 300k */
> -	ret = af9035_wr_reg(d, 0x00f6a7, 0x07);
> -	if (ret < 0)
> -		goto err;
> -
> -	/* I2C master bus 1,3 clock speed 300k */
> -	ret = af9035_wr_reg(d, 0x00f103, 0x07);
> -	if (ret < 0)
> -		goto err;
> -
> -	/* set gpio11 low */
> -	ret = af9035_wr_reg_mask(d, 0xd8d4, 0x01, 0x01);
> -	if (ret < 0)
> -		goto err;
> -
> -	ret = af9035_wr_reg_mask(d, 0xd8d5, 0x01, 0x01);
> -	if (ret < 0)
> -		goto err;
> -
> -	ret = af9035_wr_reg_mask(d, 0xd8d3, 0x01, 0x01);
> -	if (ret < 0)
> -		goto err;
> -
> -	/* Tuner enable using gpiot2_en, gpiot2_on and gpiot2_o (reset) */
> -	ret = af9035_wr_reg_mask(d, 0xd8b8, 0x01, 0x01);
> -	if (ret < 0)
> -		goto err;
> -
> -	ret = af9035_wr_reg_mask(d, 0xd8b9, 0x01, 0x01);
> -	if (ret < 0)
> -		goto err;
> -
> -	ret = af9035_wr_reg_mask(d, 0xd8b7, 0x00, 0x01);
> -	if (ret < 0)
> -		goto err;
> -
> -	msleep(200);
> -
> -	ret = af9035_wr_reg_mask(d, 0xd8b7, 0x01, 0x01);
> -	if (ret < 0)
> -		goto err;
> -
>  	memset(&si2157_config, 0, sizeof(si2157_config));
>  	si2157_config.fe = adap->fe[0];
>  	si2157_config.if_port = 1;
> 
> -- 
> Enviado desde mi dispositivo Android con K-9 Mail. Por favor, disculpa mi brevedad.
diff mbox series

Patch

diff -upr linux/drivers/media/usb/dvb-usb-v2/af9035.c linux.new/drivers/media/usb/dvb-usb-v2/af9035.c
--- linux/drivers/media/usb/dvb-usb-v2/af9035.c	2018-09-12 07:40:12.000000000 +0200
+++ linux.new/drivers/media/usb/dvb-usb-v2/af9035.c	2019-02-20 16:45:17.467869437 +0100
@@ -1218,6 +1218,48 @@  static int it930x_frontend_attach(struct
 
 	dev_dbg(&intf->dev, "adap->id=%d\n", adap->id);
 
+	/* I2C master bus 2 clock speed 300k */
+	ret = af9035_wr_reg(d, 0x00f6a7, 0x07);
+	if (ret < 0)
+		goto err;
+
+	/* I2C master bus 1,3 clock speed 300k */
+	ret = af9035_wr_reg(d, 0x00f103, 0x07);
+	if (ret < 0)
+		goto err;
+
+	/* set gpio11 low */
+	ret = af9035_wr_reg_mask(d, 0xd8d4, 0x01, 0x01);
+	if (ret < 0)
+		goto err;
+
+	ret = af9035_wr_reg_mask(d, 0xd8d5, 0x01, 0x01);
+	if (ret < 0)
+		goto err;
+
+	ret = af9035_wr_reg_mask(d, 0xd8d3, 0x01, 0x01);
+	if (ret < 0)
+		goto err;
+
+	/* Tuner enable using gpiot2_en, gpiot2_on and gpiot2_o (reset) */
+	ret = af9035_wr_reg_mask(d, 0xd8b8, 0x01, 0x01);
+	if (ret < 0)
+		goto err;
+
+	ret = af9035_wr_reg_mask(d, 0xd8b9, 0x01, 0x01);
+	if (ret < 0)
+		goto err;
+
+	ret = af9035_wr_reg_mask(d, 0xd8b7, 0x00, 0x01);
+	if (ret < 0)
+		goto err;
+
+	msleep(200);
+
+	ret = af9035_wr_reg_mask(d, 0xd8b7, 0x01, 0x01);
+	if (ret < 0)
+		goto err;
+
 	memset(&si2168_config, 0, sizeof(si2168_config));
 	si2168_config.i2c_adapter = &adapter;
 	si2168_config.fe = &adap->fe[0];
@@ -1575,48 +1617,6 @@  static int it930x_tuner_attach(struct dv
 
 	dev_dbg(&intf->dev, "adap->id=%d\n", adap->id);
 
-	/* I2C master bus 2 clock speed 300k */
-	ret = af9035_wr_reg(d, 0x00f6a7, 0x07);
-	if (ret < 0)
-		goto err;
-
-	/* I2C master bus 1,3 clock speed 300k */
-	ret = af9035_wr_reg(d, 0x00f103, 0x07);
-	if (ret < 0)
-		goto err;
-
-	/* set gpio11 low */
-	ret = af9035_wr_reg_mask(d, 0xd8d4, 0x01, 0x01);
-	if (ret < 0)
-		goto err;
-
-	ret = af9035_wr_reg_mask(d, 0xd8d5, 0x01, 0x01);
-	if (ret < 0)
-		goto err;
-
-	ret = af9035_wr_reg_mask(d, 0xd8d3, 0x01, 0x01);
-	if (ret < 0)
-		goto err;
-
-	/* Tuner enable using gpiot2_en, gpiot2_on and gpiot2_o (reset) */
-	ret = af9035_wr_reg_mask(d, 0xd8b8, 0x01, 0x01);
-	if (ret < 0)
-		goto err;
-
-	ret = af9035_wr_reg_mask(d, 0xd8b9, 0x01, 0x01);
-	if (ret < 0)
-		goto err;
-
-	ret = af9035_wr_reg_mask(d, 0xd8b7, 0x00, 0x01);
-	if (ret < 0)
-		goto err;
-
-	msleep(200);
-
-	ret = af9035_wr_reg_mask(d, 0xd8b7, 0x01, 0x01);
-	if (ret < 0)
-		goto err;
-
 	memset(&si2157_config, 0, sizeof(si2157_config));
 	si2157_config.fe = adap->fe[0];
 	si2157_config.if_port = 1;