alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
To: han.lu@intel.com
Cc: tiwai@suse.de, vinod.koul@intel.com, alsa-devel@alsa-project.org,
	broonie@kernel.org, pierre-louis.bossart@linux.intel.com
Subject: Re: [PATCH 1/1] Asoc: bytcr-rt5640: add more machine/board information for user space
Date: Tue, 29 Mar 2016 08:05:41 +0100	[thread overview]
Message-ID: <1459235141.8941.4.camel@loki> (raw)
In-Reply-To: <1459233307-12842-1-git-send-email-han.lu@intel.com>

On Tue, 2016-03-29 at 14:35 +0800, han.lu@intel.com wrote:
> From: "Lu, Han" <han.lu@intel.com>
> 
> Add more machine/board information for PA and UCM.
> Previously on ASoc, the card short name, driver name and long name are
> all the same as the machine driver name. On T100TA it looks like:
>   $ cat /proc/asound/cards
>     0 [bytcr-rt5640]: bytcr-rt5640 -  bytcr-rt5640
>                       bytcr-rt5640
> The patch made changes below:
>   driver name --->  machine driver name
>   short name  --->  DMI_PRODUCT_NAME or DMI_BOARD_NAME
>   long name   --->  short name:driver name(:DMI_SYS_VENDOR if applicable)
> And add card component: long name:firmware name. On T100TA it looks like:
>   $ cat /proc/asound/cards
>     0 [T100TA      ]: bytcr-rt5640 -  T100TA
>                       T100TA:bytcr-rt5640:ASUSTek COMPUTER INC.
>   $ amixer -c0 info
>   Card hw:0 'T100TA'/'T100TA:bytcr-rt5640:ASUSTek COMPUTER INC.'
>     Mixer name    : ''
>     Components    : 'T100TA:bytcr-rt5640:ASUSTek COMPUTER INC.:intel/fw_s
>   st_0f28.bin'
>     Controls      : 256
>     Simple ctrls  : 228
> 
> Signed-off-by: Lu, Han <han.lu@intel.com>
> 
> diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
> index 032a2e7..068cd58 100644
> --- a/sound/soc/intel/boards/bytcr_rt5640.c
> +++ b/sound/soc/intel/boards/bytcr_rt5640.c
> @@ -152,6 +152,8 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
>  	{}
>  };
>  
> +static struct snd_soc_card byt_rt5640_card;
> +
>  static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
>  {
>  	int ret;
> @@ -159,6 +161,34 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
>  	struct snd_soc_card *card = runtime->card;
>  	const struct snd_soc_dapm_route *custom_map;
>  	int num_routes;
> +	const char *dmi_name;
> +	char *component;
> +	struct sst_acpi_mach *mach = byt_rt5640_card.dev->platform_data;
> +
> +	/* Add machine/board information for userspace:
> +	 *   card driver name --->  machine driver name
> +	 *   card short name  --->  DMI_PRODUCT_NAME or DMI_BOARD_NAME
> +	 *   card long name   --->  short name:driver name(:DMI_SYS_VENDOR)
> +	 */
> +	card->driver_name = card->name;
> +	dmi_name = dmi_get_system_info(DMI_PRODUCT_NAME);
> +	if (!dmi_name)
> +		dmi_name = dmi_get_system_info(DMI_BOARD_NAME);
> +	if (dmi_name)
> +		card->name = dmi_name;
> +	card->long_name = kstrdup(card->name, GFP_KERNEL)

Best to check here and below whether kstrdup succeeds.

> ;
> +	strcat((char *)card->long_name, ":");
> +	strcat((char *)card->long_name, card->driver_name);
> +	dmi_name = dmi_get_system_info(DMI_SYS_VENDOR);
> +	if (dmi_name) {
> +		strcat((char *)card->long_name, ":");
> +		strcat((char *)card->long_name, dmi_name);
> +	}
> +	/*  card component  --->  long name:firmware name */
> +	component = kstrdup(card->long_name, GFP_KERNEL);
> +	strcat(component, ":");
> +	strcat(component, mach->fw_filename);
> +	snd_component_add(card->snd_card, component);
>  
>  	card->dapm.idle_bias_off = true;
>  

We should probably add this as a core API since a lot of machine drivers
will likely just copy and paste.

Thanks

Liam

      reply	other threads:[~2016-03-29  7:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-29  6:35 [PATCH 1/1] Asoc: bytcr-rt5640: add more machine/board information for user space han.lu
2016-03-29  7:05 ` Liam Girdwood [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1459235141.8941.4.camel@loki \
    --to=liam.r.girdwood@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=han.lu@intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.de \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).