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

Commit d7a5478a authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

[media] drx-j: be sure to send the powerup command at device open



As drxj_close puts the device in powerdown, we need to power it up
properly at drxj_open.

This is the behavior noticed at the Windows driver.

Acked-by: default avatarDevin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 9e4c509d
Loading
Loading
Loading
Loading
+23 −16
Original line number Diff line number Diff line
@@ -18621,6 +18621,8 @@ ctrl_power_mode(struct drx_demod_instance *demod, enum drx_power_mode *mode)
		default:
			return -EIO;
		}
		ext_attr->standard = DRX_STANDARD_UNKNOWN;
	}
	if (*mode != DRXJ_POWER_DOWN_MAIN_PATH) {
		rc = drxj_dap_write_reg16(dev_addr, SIO_CC_PWD_MODE__A, sio_cc_pwd_mode, 0);
@@ -18634,6 +18636,7 @@ ctrl_power_mode(struct drx_demod_instance *demod, enum drx_power_mode *mode)
			goto rw_error;
		}
		if ((*mode != DRX_POWER_UP)) {
			/* Initialize HI, wakeup key especially before put IC to sleep */
			rc = init_hi(demod);
			if (rc != 0) {
@@ -18648,14 +18651,13 @@ ctrl_power_mode(struct drx_demod_instance *demod, enum drx_power_mode *mode)
				goto rw_error;
			}
		}
		ext_attr->standard = DRX_STANDARD_UNKNOWN;
	}
	common_attr->current_power_mode = *mode;
	return 0;
rw_error:
	return -EIO;
	return rc;
}
#if 0
@@ -19838,7 +19840,7 @@ int drxj_open(struct drx_demod_instance *demod)
	struct drxu_code_info ucode_info;
	struct drx_cfg_mpeg_output cfg_mpeg_output;
	int rc;
	enum drx_power_mode power_mode = DRX_POWER_UP;
	if ((demod == NULL) ||
	    (demod->my_common_attr == NULL) ||
@@ -19856,12 +19858,16 @@ int drxj_open(struct drx_demod_instance *demod)
	ext_attr = (struct drxj_data *) demod->my_ext_attr;
	common_attr = (struct drx_common_attr *) demod->my_common_attr;
	rc = power_up_device(demod);
	rc = ctrl_power_mode(demod, &power_mode);
	if (rc != 0) {
		pr_err("error %d\n", rc);
		goto rw_error;
	}
	common_attr->current_power_mode = DRX_POWER_UP;
	if (power_mode != DRX_POWER_UP) {
		rc = -EINVAL;
		pr_err("failed to powerup device\n");
		goto rw_error;
	}
	/* has to be in front of setIqmAf and setOrxNsuAox */
	rc = get_device_capabilities(demod);
@@ -20797,6 +20803,7 @@ struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c)
	demod->my_common_attr->microcode_file = DRX39XX_MAIN_FIRMWARE;
	demod->my_common_attr->verify_microcode = true;
	demod->my_common_attr->intermediate_freq = 5000;
	demod->my_common_attr->current_power_mode = DRX_POWER_DOWN;
	demod->my_ext_attr = demod_ext_attr;
	((struct drxj_data *)demod_ext_attr)->uio_sma_tx_mode = DRX_UIO_MODE_READWRITE;
	demod->i2c = i2c;