diff mbox series

[3/4] firmware: cs_dsp: Merge wmfw format log message into INFO message

Message ID 20240709145156.268074-4-rf@opensource.cirrus.com
State New
Headers show
Series firmware: cs_dsp: Some small coding improvements | expand

Commit Message

Richard Fitzgerald July 9, 2024, 2:51 p.m. UTC
Log the WMFW file format version with the INFO_TEST message.

The behaviour of firmware controls depends on the WMFW format version,
so this is useful information to log for debugging. But there's no
need to use a separate log line just for this value.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
 drivers/firmware/cirrus/cs_dsp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Charles Keepax July 9, 2024, 3:33 p.m. UTC | #1
On Tue, Jul 09, 2024 at 03:51:55PM +0100, Richard Fitzgerald wrote:
> Log the WMFW file format version with the INFO_TEST message.
> 
> The behaviour of firmware controls depends on the WMFW format version,
> so this is useful information to log for debugging. But there's no
> need to use a separate log line just for this value.
> 
> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
> ---
>  drivers/firmware/cirrus/cs_dsp.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/firmware/cirrus/cs_dsp.c b/drivers/firmware/cirrus/cs_dsp.c
> index 1bc2e0b6d40b..141a6c9d6737 100644
> --- a/drivers/firmware/cirrus/cs_dsp.c
> +++ b/drivers/firmware/cirrus/cs_dsp.c
> @@ -1502,7 +1502,6 @@ static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware,
>  		goto out_fw;
>  	}
>  
> -	cs_dsp_info(dsp, "Firmware version: %d\n", header->ver);
>  	dsp->fw_ver = header->ver;
>  
>  	if (header->core != dsp->type) {
> @@ -1552,7 +1551,7 @@ static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware,
>  		case WMFW_INFO_TEXT:
>  		case WMFW_NAME_TEXT:
>  			region_name = "Info/Name";
> -			cs_dsp_info(dsp, "%s: %.*s\n", file,
> +			cs_dsp_info(dsp, "%s (rev %d): %.*s\n", file, dsp->fw_ver,
>  				    min(le32_to_cpu(region->len), 100), region->data);

Are we sure on this one? I don't think a WMFW is required to
include an INFO/NAME block so it is now possible for this to not
get printed. Granted I have not seen one that doesn't include
at least one of these blocks but it isn't required. I think I
would lean towards keening the separate print personally.

Thanks,
Charles
Richard Fitzgerald July 10, 2024, 9:09 a.m. UTC | #2
On 09/07/2024 16:33, Charles Keepax wrote:
> On Tue, Jul 09, 2024 at 03:51:55PM +0100, Richard Fitzgerald wrote:
>> Log the WMFW file format version with the INFO_TEST message.
>>
>> The behaviour of firmware controls depends on the WMFW format version,
>> so this is useful information to log for debugging. But there's no
>> need to use a separate log line just for this value.
>>
>> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
>> ---
>>   drivers/firmware/cirrus/cs_dsp.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/firmware/cirrus/cs_dsp.c b/drivers/firmware/cirrus/cs_dsp.c
>> index 1bc2e0b6d40b..141a6c9d6737 100644
>> --- a/drivers/firmware/cirrus/cs_dsp.c
>> +++ b/drivers/firmware/cirrus/cs_dsp.c
>> @@ -1502,7 +1502,6 @@ static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware,
>>   		goto out_fw;
>>   	}
>>   
>> -	cs_dsp_info(dsp, "Firmware version: %d\n", header->ver);
>>   	dsp->fw_ver = header->ver;
>>   
>>   	if (header->core != dsp->type) {
>> @@ -1552,7 +1551,7 @@ static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware,
>>   		case WMFW_INFO_TEXT:
>>   		case WMFW_NAME_TEXT:
>>   			region_name = "Info/Name";
>> -			cs_dsp_info(dsp, "%s: %.*s\n", file,
>> +			cs_dsp_info(dsp, "%s (rev %d): %.*s\n", file, dsp->fw_ver,
>>   				    min(le32_to_cpu(region->len), 100), region->data);
> 
> Are we sure on this one? I don't think a WMFW is required to
> include an INFO/NAME block so it is now possible for this to not
> get printed. Granted I have not seen one that doesn't include
> at least one of these blocks but it isn't required. I think I
> would lean towards keening the separate print personally.
> 
> Thanks,
> Charles

The specification says that the first INFO block is mandatory, but
specifications can change so I don't mind leaving it on its own line.

I've just noticed a typo in the commit description (INFO_TEST should be
INFO_TEXT) so I want to send a V2 chain anyway.
diff mbox series

Patch

diff --git a/drivers/firmware/cirrus/cs_dsp.c b/drivers/firmware/cirrus/cs_dsp.c
index 1bc2e0b6d40b..141a6c9d6737 100644
--- a/drivers/firmware/cirrus/cs_dsp.c
+++ b/drivers/firmware/cirrus/cs_dsp.c
@@ -1502,7 +1502,6 @@  static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware,
 		goto out_fw;
 	}
 
-	cs_dsp_info(dsp, "Firmware version: %d\n", header->ver);
 	dsp->fw_ver = header->ver;
 
 	if (header->core != dsp->type) {
@@ -1552,7 +1551,7 @@  static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware,
 		case WMFW_INFO_TEXT:
 		case WMFW_NAME_TEXT:
 			region_name = "Info/Name";
-			cs_dsp_info(dsp, "%s: %.*s\n", file,
+			cs_dsp_info(dsp, "%s (rev %d): %.*s\n", file, dsp->fw_ver,
 				    min(le32_to_cpu(region->len), 100), region->data);
 			break;
 		case WMFW_ALGORITHM_DATA: