* [PATCH 1/1] Asoc: bytcr-rt5640: add more machine/board information for user space
@ 2016-03-29 6:35 han.lu
2016-03-29 7:05 ` Liam Girdwood
0 siblings, 1 reply; 2+ messages in thread
From: han.lu @ 2016-03-29 6:35 UTC (permalink / raw)
To: broonie, tiwai, vinod.koul, pierre-louis.bossart, liam.r.girdwood,
alsa-devel
Cc: Lu, Han
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);
+ 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;
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 1/1] Asoc: bytcr-rt5640: add more machine/board information for user space
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
0 siblings, 0 replies; 2+ messages in thread
From: Liam Girdwood @ 2016-03-29 7:05 UTC (permalink / raw)
To: han.lu; +Cc: tiwai, vinod.koul, alsa-devel, broonie, pierre-louis.bossart
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-29 7:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).