SRU: Bug #242169 - HVR950Q takes too long to lock on the first tune

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

SRU: Bug #242169 - HVR950Q takes too long to lock on the first tune

Tim Gardner-6
SRU Justification:

Impact: HVR950Q takes too long to lock on the first tune

Patch: check device hardware state to determine if firmware download is
needed, add module option to load firmware during driver attach

Patch:
http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-hardy-lum.git;a=commit;h=447c1f520e61afdaf3d4265ed60c4049f4ec4ee1

Test Case: see Bug Description

--
Tim Gardner [hidden email]

From 447c1f520e61afdaf3d4265ed60c4049f4ec4ee1 Mon Sep 17 00:00:00 2001
From: Tim Gardner <[hidden email]>
Date: Mon, 23 Jun 2008 12:21:33 -0600
Subject: [PATCH] UBUNTU: xc5000: firmware loading optimizations
 OriginalAuthor: Steven Toth <[hidden email]>, Michael Krufky <[hidden email]>
 OriginalLocation: http://launchpadlibrarian.net/15512715/xc5000-firmware-loading-optimizations-lum.patch
 Bug: #242169

Two changesets from the v4l/dvb master repository, hopefully on their way to 2.6.26.

---

http://linuxtv.org/hg/v4l-dvb/rev/b0a0840dff93

xc5000: check device hardware state to determine if firmware download is needed

From: Steven Toth <[hidden email]>

This patch ensures that the xc5000 will have firmware loaded as needed if the
part is powered down or reset via gpio from the host. An example of this, in
some cases, could be after the system resumes from standby or hibernate modes.

---

http://linuxtv.org/hg/v4l-dvb/rev/5bf12c545be3

xc5000: add module option to load firmware during driver attach

From: Michael Krufky <[hidden email]>

The xc5000 firmware download process can be slow on certain devices.

Add a module option, "init_fw" to perform the firmware download during
xc5000_attach(), which would get the firmware download over with well
before any tune request is made.

When this option is enabled, it will reduce the time it takes to get a
signal lock during the first tune after driver load, but will add a few
seconds to the driver initialization.

Signed-off-by: Michael Krufky <[hidden email]>
Signed-off-by: Tim Gardner <[hidden email]>
---
 ubuntu/media/au0828/xc5000.c      |   37 ++++++++++++++++++++++++++++++-------
 ubuntu/media/au0828/xc5000_priv.h |    1 -
 2 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/ubuntu/media/au0828/xc5000.c b/ubuntu/media/au0828/xc5000.c
index b356408..63b4dba 100644
--- a/ubuntu/media/au0828/xc5000.c
+++ b/ubuntu/media/au0828/xc5000.c
@@ -36,6 +36,10 @@ static int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
 
+static int xc5000_load_fw_on_attach;
+module_param_named(init_fw, xc5000_load_fw_on_attach, int, 0644);
+MODULE_PARM_DESC(init_fw, "Load firmware during driver initialization.");
+
 #define dprintk(level,fmt, arg...) if (debug >= level) \
  printk(KERN_INFO "%s: " fmt, "xc5000", ## arg)
 
@@ -177,6 +181,7 @@ static XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = {
  {"FM Radio-INPUT1",   0x0208, 0x9002}
 };
 
+static int  xc5000_is_firmware_loaded(struct dvb_frontend *fe);
 static int  xc5000_writeregs(struct xc5000_priv *priv, u8 *buf, u8 len);
 static int  xc5000_readregs(struct xc5000_priv *priv, u8 *buf, u8 len);
 static void xc5000_TunerReset(struct dvb_frontend *fe);
@@ -352,7 +357,7 @@ static int xc_SetTVStandard(struct xc5000_priv *priv,
 
 static int xc_shutdown(struct xc5000_priv *priv)
 {
- return 0;
+ return XC_RESULT_SUCCESS;
  /* Fixme: cannot bring tuner back alive once shutdown
  *        without reloading the driver modules.
  *    return xc_write_reg(priv, XREG_POWER_DOWN, 0);
@@ -704,6 +709,25 @@ static int xc5000_set_params(struct dvb_frontend *fe,
  return 0;
 }
 
+static int xc5000_is_firmware_loaded(struct dvb_frontend *fe)
+{
+ struct xc5000_priv *priv = fe->tuner_priv;
+ int ret;
+ u16 id;
+
+ ret = xc5000_readreg(priv, XREG_PRODUCT_ID, &id);
+ if (ret == XC_RESULT_SUCCESS) {
+ if (id == XC_PRODUCT_ID_FW_NOT_LOADED)
+ ret = XC_RESULT_RESET_FAILURE;
+ else
+ ret = XC_RESULT_SUCCESS;
+ }
+
+ dprintk(1, "%s() returns %s id = 0x%x\n", __func__,
+ ret == XC_RESULT_SUCCESS ? "True" : "False", id);
+ return ret;
+}
+
 static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe);
 
 static int xc5000_set_analog_params(struct dvb_frontend *fe,
@@ -712,7 +736,7 @@ static int xc5000_set_analog_params(struct dvb_frontend *fe,
  struct xc5000_priv *priv = fe->tuner_priv;
  int ret;
 
- if(priv->fwloaded == 0)
+ if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS)
  xc_load_fw_and_init_tuner(fe);
 
  dprintk(1, "%s() frequency=%d (in units of 62.5khz)\n",
@@ -827,11 +851,10 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe)
  struct xc5000_priv *priv = fe->tuner_priv;
  int ret = 0;
 
- if (priv->fwloaded == 0) {
+ if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) {
  ret = xc5000_fwupload(fe);
  if (ret != XC_RESULT_SUCCESS)
  return ret;
- priv->fwloaded = 1;
  }
 
  /* Start the tuner self-calibration process */
@@ -871,7 +894,6 @@ static int xc5000_sleep(struct dvb_frontend *fe)
  return -EREMOTEIO;
  }
  else {
- /* priv->fwloaded = 0; */
  return XC_RESULT_SUCCESS;
  }
 }
@@ -952,7 +974,6 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
  cfg->i2c_address);
  printk(KERN_INFO
  "xc5000: Firmware has been loaded previously\n");
- priv->fwloaded = 1;
  break;
  case XC_PRODUCT_ID_FW_NOT_LOADED:
  printk(KERN_INFO
@@ -960,7 +981,6 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
  cfg->i2c_address);
  printk(KERN_INFO
  "xc5000: Firmware has not been loaded previously\n");
- priv->fwloaded = 0;
  break;
  default:
  printk(KERN_ERR
@@ -975,6 +995,9 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
 
  fe->tuner_priv = priv;
 
+ if (xc5000_load_fw_on_attach)
+ xc5000_init(fe);
+
  return fe;
 }
 EXPORT_SYMBOL(xc5000_attach);
diff --git a/ubuntu/media/au0828/xc5000_priv.h b/ubuntu/media/au0828/xc5000_priv.h
index ecebfe4..a72a988 100644
--- a/ubuntu/media/au0828/xc5000_priv.h
+++ b/ubuntu/media/au0828/xc5000_priv.h
@@ -30,7 +30,6 @@ struct xc5000_priv {
  u32 bandwidth;
  u8  video_standard;
  u8  rf_mode;
- u8  fwloaded;
 
  void *devptr;
 };
--
1.5.4.3


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: SRU: Bug #242169 - HVR950Q takes too long to lock on the first tune

Ben Collins-5
On Mon, 2008-06-23 at 12:51 -0600, Tim Gardner wrote:

> SRU Justification:
>
> Impact: HVR950Q takes too long to lock on the first tune
>
> Patch: check device hardware state to determine if firmware download is
> needed, add module option to load firmware during driver attach
>
> Patch:
> http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-hardy-lum.git;a=commit;h=447c1f520e61afdaf3d4265ed60c4049f4ec4ee1
>
> Test Case: see Bug Description

ACK-o-matic


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

Re: SRU: Bug #242169 - HVR950Q takes too long to lock on the first tune

Stefan Bader-2
In reply to this post by Tim Gardner-6
Tim Gardner wrote:

> SRU Justification:
>
> Impact: HVR950Q takes too long to lock on the first tune
>
> Patch: check device hardware state to determine if firmware download is
> needed, add module option to load firmware during driver attach
>
> Patch:
> http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-hardy-lum.git;a=commit;h=447c1f520e61afdaf3d4265ed60c4049f4ec4ee1
>
> Test Case: see Bug Description
>
>
Ack

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team