diff mbox

[08/10] mn88473: check if firmware is already running before loading it

Message ID 1426460275-3766-8-git-send-email-benjamin@southpole.se (mailing list archive)
State New, archived
Headers show

Commit Message

Benjamin Larsson March 15, 2015, 10:57 p.m. UTC
Signed-off-by: Benjamin Larsson <benjamin@southpole.se>
---
 drivers/staging/media/mn88473/mn88473.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Antti Palosaari March 16, 2015, 9:41 p.m. UTC | #1
On 03/16/2015 12:57 AM, Benjamin Larsson wrote:
> Signed-off-by: Benjamin Larsson <benjamin@southpole.se>

Applied!

Antti

> ---
>   drivers/staging/media/mn88473/mn88473.c | 13 ++++++++++++-
>   1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/media/mn88473/mn88473.c b/drivers/staging/media/mn88473/mn88473.c
> index 607ce4d..a23e59e 100644
> --- a/drivers/staging/media/mn88473/mn88473.c
> +++ b/drivers/staging/media/mn88473/mn88473.c
> @@ -196,8 +196,19 @@ static int mn88473_init(struct dvb_frontend *fe)
>
>   	dev_dbg(&client->dev, "\n");
>
> -	if (dev->warm)
> +	/* set cold state by default */
> +	dev->warm = false;
> +
> +	/* check if firmware is already running */
> +	ret = regmap_read(dev->regmap[0], 0xf5, &tmp);
> +	if (ret)
> +		goto err;
> +
> +	if (!(tmp & 0x1)) {
> +		dev_info(&client->dev, "firmware already running\n");
> +		dev->warm = true;
>   		return 0;
> +	}
>
>   	/* request the firmware, this will block and timeout */
>   	ret = request_firmware(&fw, fw_file, &client->dev);
>
Antti Palosaari March 16, 2015, 9:43 p.m. UTC | #2
On 03/16/2015 12:57 AM, Benjamin Larsson wrote:
> Signed-off-by: Benjamin Larsson <benjamin@southpole.se>

Applied!

Antti

> ---
>   drivers/staging/media/mn88473/mn88473.c | 13 ++++++++++++-
>   1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/media/mn88473/mn88473.c b/drivers/staging/media/mn88473/mn88473.c
> index 607ce4d..a23e59e 100644
> --- a/drivers/staging/media/mn88473/mn88473.c
> +++ b/drivers/staging/media/mn88473/mn88473.c
> @@ -196,8 +196,19 @@ static int mn88473_init(struct dvb_frontend *fe)
>
>   	dev_dbg(&client->dev, "\n");
>
> -	if (dev->warm)
> +	/* set cold state by default */
> +	dev->warm = false;
> +
> +	/* check if firmware is already running */
> +	ret = regmap_read(dev->regmap[0], 0xf5, &tmp);
> +	if (ret)
> +		goto err;
> +
> +	if (!(tmp & 0x1)) {
> +		dev_info(&client->dev, "firmware already running\n");
> +		dev->warm = true;
>   		return 0;
> +	}
>
>   	/* request the firmware, this will block and timeout */
>   	ret = request_firmware(&fw, fw_file, &client->dev);
>
diff mbox

Patch

diff --git a/drivers/staging/media/mn88473/mn88473.c b/drivers/staging/media/mn88473/mn88473.c
index 607ce4d..a23e59e 100644
--- a/drivers/staging/media/mn88473/mn88473.c
+++ b/drivers/staging/media/mn88473/mn88473.c
@@ -196,8 +196,19 @@  static int mn88473_init(struct dvb_frontend *fe)
 
 	dev_dbg(&client->dev, "\n");
 
-	if (dev->warm)
+	/* set cold state by default */
+	dev->warm = false;
+
+	/* check if firmware is already running */
+	ret = regmap_read(dev->regmap[0], 0xf5, &tmp);
+	if (ret)
+		goto err;
+
+	if (!(tmp & 0x1)) {
+		dev_info(&client->dev, "firmware already running\n");
+		dev->warm = true;
 		return 0;
+	}
 
 	/* request the firmware, this will block and timeout */
 	ret = request_firmware(&fw, fw_file, &client->dev);