[PATCH 1/1] Asoc: bytcr-rt5640: add more machine/board information for user space

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Lu, Han" <han.lu@xxxxxxxxx>

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@xxxxxxxxx>

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

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux