ASoC: Intel: ACPI-related fixes
Subsystems (3)
cover ASoC: Intel: ACPI-related fixes
Here are 3 patches that were provided earlier on the mailing list or in Bugzilla entries, I rebased and ported them on top of the latest ACPI/KConfig fixes.
Jeremy Cline (1):
ASoC: Replace snd_soc_acpi_check_hid with acpi_dev_present
Pierre-Louis Bossart (2):
ASoC: acpi: fix machine driver selection based on quirk
ASoC: Intel: bytcht_es8316: fix HID handling
include/sound/soc-acpi.h | 3 --- sound/soc/intel/boards/Kconfig | 1 + sound/soc/intel/boards/bytcht_es8316.c | 26 ++++++++++++++++++++++- sound/soc/soc-acpi.c | 38 ++++------------------------------ 4 files changed, 30 insertions(+), 38 deletions(-)
Signature · 1 line
2.14.1
PATCH 1/3 ASoC: acpi: fix machine driver selection based on quirk
The ACPI/machine-driver code refactoring introduced in 4.13 introduced a regression for cases where we need a DMI-based quirk to select the machine driver (the BIOS reports an invalid HID). The fix is just to make sure the results of the quirk are actually used.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=96691
--- sound/soc/soc-acpi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
sound/soc/soc-acpi.c +2 -4
@@ -84,11 +84,9 @@ snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines)for (mach = machines; mach->id[0 ]; mach++) {if (snd_soc_acpi_check_hid (mach->id) == true) { -if (mach->machine_quirk ==NULL ) -return mach; -if (mach->machine_quirk (mach) !=NULL ) -return mach; + mach = mach->machine_quirk (mach); +return mach; } }return NULL ;
Signature · 6 lines
2.14.1 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH 1/3] [PATCH] ASoC: acpi: fix machine driver selection based on quirk
sound/soc/soc-acpi.c snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines) · line 87
Quoted 9 lines · Pierre-Louis Bossart
The ACPI/machine-driver code refactoring introduced in 4.13 introduced a regression for cases where we need a DMI-based quirk to select the machine driver (the BIOS reports an invalid HID). The fix is just to make sure the results of the quirk are actually used.
sound/soc/soc-acpi.c +0
-0for (mach = machines; mach->id[0 ]; mach++) {if (snd_soc_acpi_check_hid (mach->id) == true) {if (mach->machine_quirk (mach) !=NULL )
Just a nit: perhaps use more natural style, i.e. drop " != NULL" part off?
Quoted 5 lines
sound/soc/soc-acpi.c +2
-0+ mach = mach->machine_quirk (mach); +return mach; } }return NULL ;
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Re: [PATCH 1/3] [PATCH] ASoC: acpi: fix machine driver selection based on quirk
Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Pierre-Louis Bossart
The ACPI/machine-driver code refactoring introduced in 4.13 introduced a regression for cases where we need a DMI-based quirk to select the machine driver (the BIOS reports an invalid HID). The fix is just to make sure the results of the quirk are actually used.
Quoted 6 lines
Quoted 3 lines
for (mach = machines; mach->id[0]; mach++) { if (snd_soc_acpi_check_hid(mach->id) == true) { if (mach->machine_quirk(mach) != NULL)Just a nit: perhaps use more natural style, i.e. drop " != NULL" part off?
ok.
Quoted 7 lines
Quoted 6 lines
sound/soc/soc-acpi.c +2
-0+ mach = mach->machine_quirk (mach); +return mach; } }return NULL ;
Re: [PATCH 1/3] [PATCH] ASoC: acpi: fix machine driver selection based on quirk
Quoted 8 lines · Pierre-Louis Bossart
Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Pierre-Louis Bossart
The ACPI/machine-driver code refactoring introduced in 4.13 introduced a regression for cases where we need a DMI-based quirk to select the machine driver (the BIOS reports an invalid HID). The fix is just to make sure the results of the quirk are actually used.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
for (mach = machines; mach->id[0]; mach++) { if (
snd_soc_acpi_check_hid(mach->id)== true) { if (mach->machine_quirk(mach)!= NULL)Just a nit: perhaps use more natural style, i.e. drop " != NULL" part off?
ok.
I found out while testing Andy's patches that there was a merge/copy-paste mistake here which wasn't detected in my tests - not sure how. it should be (as in the initial patch on bugzilla)
if (mach->machine_quirk)
mach = mach->machine_quirk(mach);
Will fix in the next version
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
+ mach =
mach->machine_quirk(mach); + return mach;
}
}
return NULL;
Quoted 4 lines
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH 2/3 ASoC: Replace snd_soc_acpi_check_hid with acpi_dev_present
In reply to Pierre-Louis BossartFrom: Jeremy Cline <[email protected]>
Replace snd_soc_acpi_check_hid() with the generic acpi_dev_present() and remove the now unused snd_soc_acpi_check_hid function. This should have no functional change.
--- include/sound/soc-acpi.h | 3 --- sound/soc/soc-acpi.c | 32 ++------------------------------ 2 files changed, 2 insertions(+), 33 deletions(-)
include/sound/soc-acpi.h +0 -3
@@ -50,9 +50,6 @@ snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],struct snd_soc_acpi_mach *snd_soc_acpi_find_machine (struct snd_soc_acpi_mach *machines); -/* acpi check hid */ -bool snd_soc_acpi_check_hid (const u8 hid[ACPI_ID_LEN ]); -/** * snd_soc_acpi_mach: ACPI-based machine descriptor. Most of the fields are * related to the hardware, except for the firmware and topology file names.
sound/soc/soc-acpi.c +2 -30
@@ -49,41 +49,13 @@ const char *snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN]) }EXPORT_SYMBOL_GPL (snd_soc_acpi_find_name_from_hid); -static acpi_status snd_soc_acpi_mach_match (acpi_handle handle,u32 level, -void *context,void **ret) -{ -unsigned long long sta; -acpi_status status; - - *(bool *)context = true; - status =acpi_evaluate_integer (handle,"_STA" ,NULL , &sta); -if (ACPI_FAILURE (status) || !(sta &ACPI_STA_DEVICE_PRESENT )) - *(bool *)context = false; - -return AE_OK ; -} - -bool snd_soc_acpi_check_hid (const u8 hid[ACPI_ID_LEN ]) -{ -acpi_status status; -bool found = false; - - status =acpi_get_devices (hid, snd_soc_acpi_mach_match, &found,NULL ); - -if (ACPI_FAILURE (status)) -return false; - -return found; -} -EXPORT_SYMBOL_GPL (snd_soc_acpi_check_hid); -struct snd_soc_acpi_mach *snd_soc_acpi_find_machine (struct snd_soc_acpi_mach *machines) {struct snd_soc_acpi_mach *mach;for (mach = machines; mach->id[0 ]; mach++) { -if (snd_soc_acpi_check_hid (mach->id) == true) { +if (acpi_dev_present (mach->id,NULL ,-1 )) {if (mach->machine_quirk (mach) !=NULL ) mach = mach->machine_quirk (mach);return mach;
@@ -161,7 +133,7 @@ struct snd_soc_acpi_mach *snd_soc_acpi_codec_list(void *arg)return mach;for (i =0 ; i < codec_list->num_codecs; i++) { -if (snd_soc_acpi_check_hid (codec_list->codecs[i]) != true) +if (!acpi_dev_present (codec_list->codecs[i],NULL ,-1 ))return NULL ; }
Signature · 1 line
2.14.1
Re: [PATCH 2/3] ASoC: Replace snd_soc_acpi_check_hid with acpi_dev_present
Quoted 6 lines · Pierre-Louis Bossart
From: Jeremy Cline <[email protected]>
Replace
snd_soc_acpi_check_hid()with the genericacpi_dev_present()and remove the now unusedsnd_soc_acpi_check_hidfunction. This shouldhave no functional change.
Nice catch!
Quoted 88 lines
Signed-off-by Jeremy Cline <[email protected]>Signed-off-by Pierre-Louis Bossart <[email protected].com>
--- include/sound/soc-acpi.h | 3 --- sound/soc/soc-acpi.c | 32 ++------------------------------ 2 files changed, 2 insertions(+), 33 deletions(-)include/sound/soc-acpi.h +0
-3@@ -50,9 +50,6 @@ snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN ], struct snd_soc_acpi_mach *snd_soc_acpi_find_machine (struct snd_soc_acpi_mach *machines); -/* acpi check hid */ -bool snd_soc_acpi_check_hid (const u8 hid[ACPI_ID_LEN ]); -/** * snd_soc_acpi_mach: ACPI-based machine descriptor. Most of the fields are
* related to the hardware, except for the firmware and topology file
names.sound/soc/soc-acpi.c +1
-29@@ -49,41 +49,13 @@ const char *snd_soc_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN]) }EXPORT_SYMBOL_GPL (snd_soc_acpi_find_name_from_hid); -static acpi_status snd_soc_acpi_mach_match (acpi_handle handle,u32 level, -void *context,void **ret) -{ -unsigned long long sta; -acpi_status status; - - *(bool *)context = true; - status =acpi_evaluate_integer (handle,"_STA" ,NULL , &sta); -if (ACPI_FAILURE (status) || !(sta &ACPI_STA_DEVICE_PRESENT )) - *(bool *)context = false; - -return AE_OK ; -} - -bool snd_soc_acpi_check_hid (const u8 hid[ACPI_ID_LEN ]) -{ -acpi_status status; -bool found = false; - - status =acpi_get_devices (hid, snd_soc_acpi_mach_match, &found, NULL); - -if (ACPI_FAILURE (status)) -return false; - -return found; -} -EXPORT_SYMBOL_GPL (snd_soc_acpi_check_hid); -struct snd_soc_acpi_mach *snd_soc_acpi_find_machine (struct snd_soc_acpi_mach *machines) {struct snd_soc_acpi_mach *mach;for (mach = machines; mach->id[0 ]; mach++) { -if (snd_soc_acpi_check_hid (mach->id) == true) { +if (acpi_dev_present (mach->id,NULL ,-1 )) {sound/soc/soc-acpi.c +1
-2if (mach->machine_quirk (mach) !=NULL ) mach = mach->machine_quirk (mach);return mach;@@ -161,7 +133,7 @@ struct snd_soc_acpi_mach *snd_soc_acpi_codec_list(void *arg)return mach; for (i = 0; i < codec_list->num_codecs; i++) { -if (snd_soc_acpi_check_hid (codec_list->codecs[i]) != true) + if (!acpi_dev_present(codec_list->codecs[i], NULL, -1)) return NULL; }
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
PATCH 3/3 ASoC: Intel: bytcht_es8316: fix HID handling
In reply to Pierre-Louis BossartSame problem as with previous machine drivers, the codec dai uses a hard-coded name of "i2c-ESSX8316:00" but ACPI provides "i2c-ESSX8316:01" in some systems.
Fix by overriding the hard-coded value with the codec name derived from the HID information
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189261
--- sound/soc/intel/boards/Kconfig | 1 + sound/soc/intel/boards/bytcht_es8316.c | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-)
sound/soc/intel/boards/Kconfig +1 -0
@@ -153,6 +153,7 @@ config SND_SOC_INTEL_BYT_CHT_DA7213_MACH config SND_SOC_INTEL_BYT_CHT_ES8316_MACH tristate "Baytrail & Cherrytrail with ES8316 codec" depends on X86_INTEL_LPSS && I2C && ACPI + select SND_SOC_ACPI select SND_SOC_ES8316 help This adds support for ASoC machine driver for Intel(R) Baytrail &
sound/soc/intel/boards/bytcht_es8316.c +25 -1
@@ -232,15 +232,39 @@ static struct snd_soc_card byt_cht_es8316_card = { .fully_routed = true, }; +static char codec_name[16 ];/* i2c-<HID>:00 with HID being 8 chars */ +static int snd_byt_cht_es8316_mc_probe (struct platform_device *pdev) { -int ret =0 ;struct byt_cht_es8316_private *priv; +struct snd_soc_acpi_mach *mach; +const char *i2c_name =NULL ; +int dai_index =0 ; +int i; +int ret =0 ; priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_ATOMIC );if (!priv)return -ENOMEM ; + mach = (&pdev->dev)->platform_data; +/* fix index of codec dai */ +for (i =0 ; i <ARRAY_SIZE (byt_cht_es8316_dais); i++) { +if (!strcmp (byt_cht_es8316_dais[i].codec_name, +"i2c-ESSX8316:00" )) { + dai_index = i; +break ; + } + } + +/* fixup codec name based on HID */ + i2c_name =snd_soc_acpi_find_name_from_hid (mach->id); +if (i2c_name) { +snprintf (codec_name,sizeof (codec_name), +"%s%s" ,"i2c-" , i2c_name); + byt_cht_es8316_dais[dai_index].codec_name = codec_name; + } +/* register the soc card */ byt_cht_es8316_card.dev = &pdev->dev;snd_soc_card_set_drvdata (&byt_cht_es8316_card, priv);
Signature · 1 line
2.14.1
Re: [PATCH 3/3] ASoC: Intel: bytcht_es8316: fix HID handling
Quoted 3 lines · Pierre-Louis Bossart
Same problem as with previous machine drivers, the codec dai uses a hard-coded name of "i2c-ESSX8316:00" but ACPI provides "i2c-ESSX8316:01" in some systems.
Yeah, that's why using device instances is fragile...
Quoted 3 lines
Fix by overriding the hard-coded value with the codec name derived from the HID information
The patch makes me think about introducing acpi_dev_get_dev_name() and utilize it here since I need something similar to have in one of GPIO drivers.
Quoted 30 lines
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189261
Signed-off-by Pierre-Louis Bossart <[email protected].com>
--- sound/soc/intel/boards/Kconfig | 1 + sound/soc/intel/boards/bytcht_es8316.c | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-)sound/soc/intel/boards/Kconfig +1
-0@@ -153,6 +153,7 @@ config SND_SOC_INTEL_BYT_CHT_DA7213_MACH config SND_SOC_INTEL_BYT_CHT_ES8316_MACH tristate "Baytrail & Cherrytrail with ES8316 codec" depends on X86_INTEL_LPSS && I2C && ACPI + select SND_SOC_ACPI select SND_SOC_ES8316 help This adds support for ASoC machine driver for Intel(R)Baytrail &
sound/soc/intel/boards/bytcht_es8316.c +0
-0
sound/soc/intel/boards/bytcht_es8316.c static struct snd_soc_card byt_cht_es8316_card = · line 237
Quoted 6 lines
sound/soc/intel/boards/bytcht_es8316.c +2
-0@@ -232,15 +232,39 @@ static struct snd_soc_card byt_cht_es8316_card = { .fully_routed = true, }; +static char codec_name[16 ];/* i2c-<HID>:00 with HID being 8 chars */ +
I would rather do use 4 + ACPI_ID_LEN + 3 /* or 1 + 2 */ + 1 and explain each part in the comment above.
Quoted 12 lines
sound/soc/intel/boards/bytcht_es8316.c +5
-1static int snd_byt_cht_es8316_mc_probe (struct platform_device *pdev) { -int ret =0 ;struct byt_cht_es8316_private *priv; +struct snd_soc_acpi_mach *mach; +const char *i2c_name =NULL ; +int dai_index =0 ; +int i; +int ret =0 ; priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_ATOMIC );if (!priv)
sound/soc/intel/boards/bytcht_es8316.c static struct snd_soc_card byt_cht_es8316_card = { · line 257
Quoted 10 lines
sound/soc/intel/boards/bytcht_es8316.c +8
-0return -ENOMEM ; + mach = (&pdev->dev)->platform_data; +/* fix index of codec dai */ +for (i =0 ; i <ARRAY_SIZE (byt_cht_es8316_dais); i++) { +if (!strcmp (byt_cht_es8316_dais[i].codec_name, +"i2c-ESSX8316:00" )) { + dai_index = i; +break ; + }
Perhaps at some point you can do such in more generic (across Intel ASoCs) ?
Quoted 14 lines
sound/soc/intel/boards/bytcht_es8316.c +10
-0+ } + +/* fixup codec name based on HID */ + i2c_name =snd_soc_acpi_find_name_from_hid (mach->id); +if (i2c_name) { +snprintf (codec_name,sizeof (codec_name), +"%s%s" ,"i2c-" , i2c_name); + byt_cht_es8316_dais[dai_index].codec_name = codec_name; + } +/* register the soc card */ sound/soc/intel/boards/bytcht_es8316.c +0
-0byt_cht_es8316_card.dev = &pdev->dev;snd_soc_card_set_drvdata (&byt_cht_es8316_card, priv);
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Re: [PATCH 3/3] ASoC: Intel: bytcht_es8316: fix HID handling
Quoted 8 lines · Andy Shevchenko
Quoted 3 lines · Pierre-Louis Bossart
Same problem as with previous machine drivers, the codec dai uses a hard-coded name of "i2c-ESSX8316:00" but ACPI provides "i2c-ESSX8316:01" in some systems.
Yeah, that's why using device instances is fragile...
Quoted 1 line
Quoted 6 lines
Quoted 2 lines
Fix by overriding the hard-coded value with the codec name derived from the HID information
The patch makes me think about introducing
acpi_dev_get_dev_name()and utilize it here since I need something similar to have in one of GPIO drivers.
we use this: snd_soc_acpi_find_name_from_hid(mach->id)
When I started all this the recommendation was to do all this on the audio side of things, I have no objections to a move of the functionality in acpi.
[snip]
Quoted 10 lines
Quoted 10 lines
sound/soc/intel/boards/bytcht_es8316.c +0
-0@@ -232,15 +232,39 @@ static struct snd_soc_card byt_cht_es8316_card = { .fully_routed = true, };
Quoted 5 lines
sound/soc/intel/boards/bytcht_es8316.c static struct snd_soc_card byt_cht_es8316_card = · line 237
Quoted 2 lines
sound/soc/intel/boards/bytcht_es8316.c +2
-0+static char codec_name[16 ];/* i2c-<HID>:00 with HID being 8 chars */ +I would rather do use 4 +
ACPI_ID_LEN+ 3 /* or 1 + 2 */ + 1 and explain each part in the comment above.
yes we could do this. this is the same code as in other machine drivers, so we should do the replacement across all of them in one shot in a separate patch.
Quoted 15 lines
Quoted 15 lines
sound/soc/intel/boards/bytcht_es8316.c +5
-1static int snd_byt_cht_es8316_mc_probe (struct platform_device *pdev) { -int ret =0 ;struct byt_cht_es8316_private *priv; +struct snd_soc_acpi_mach *mach; +const char *i2c_name =NULL ; +int dai_index =0 ; +int i; +int ret =0 ; priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_ATOMIC );if (!priv)return -ENOMEM ;
Quoted 11 lines
sound/soc/intel/boards/bytcht_es8316.c static struct snd_soc_card byt_cht_es8316_card = { · line 257
Quoted 8 lines
sound/soc/intel/boards/bytcht_es8316.c +8
-0+ mach = (&pdev->dev)->platform_data; +/* fix index of codec dai */ +for (i =0 ; i <ARRAY_SIZE (byt_cht_es8316_dais); i++) { +if (!strcmp (byt_cht_es8316_dais[i].codec_name, +"i2c-ESSX8316:00" )) { + dai_index = i; +break ; + }Perhaps at some point you can do such in more generic (across Intel ASoCs) ?
Not sure what you are hinting at here? Did you mean changing the name of the array? Or adding a helper function to do this?
Re: [PATCH 3/3] ASoC: Intel: bytcht_es8316: fix HID handling
Quoted 12 lines · Pierre-Louis Bossart
Quoted 10 lines · Andy Shevchenko
Quoted 3 lines · Pierre-Louis Bossart
Fix by overriding the hard-coded value with the codec name derived from the HID information
The patch makes me think about introducing
acpi_dev_get_dev_name()and
utilize it here since I need something similar to have in one of GPIO
drivers.
Quoted 5 lines
we use this:
snd_soc_acpi_find_name_from_hid(mach->id)When I started all this the recommendation was to do all this on the audio side of things, I have no objections to a move of the functionality in acpi.
I almost done a patch. I will Cc you for the series.
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
+static char codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */
+I would rather do use 4 +
ACPI_ID_LEN+ 3 /* or 1 + 2 */ + 1 and explain
each part in the comment above.
Quoted 4 lines
yes we could do this. this is the same code as in other machine drivers,
so we should do the replacement across all of them in one shot in a separate patch.
Whatever you prefer, it's minor.
Quoted 12 lines
Quoted 11 lines
sound/soc/intel/boards/bytcht_es8316.c static struct snd_soc_card byt_cht_es8316_card = { · line 257
Quoted 8 lines
sound/soc/intel/boards/bytcht_es8316.c +8
-0+ mach = (&pdev->dev)->platform_data; +/* fix index of codec dai */ +for (i =0 ; i <ARRAY_SIZE (byt_cht_es8316_dais); i++) { +if (!strcmp (byt_cht_es8316_dais[i].codec_name, +"i2c-ESSX8316:00" )) { + dai_index = i; +break ; + }Perhaps at some point you can do such in more generic (across Intel ASoCs) ?
Quoted 3 lines
Not sure what you are hinting at here? Did you mean changing the name of
the array? Or adding a helper function to do this?
Suggestion is to create a helper out of similar for-loops-fix-name in all current users.
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Re: [PATCH 3/3] ASoC: Intel: bytcht_es8316: fix HID handling
Quoted 13 lines · Andy Shevchenko
Quoted 12 lines · Pierre-Louis Bossart
Quoted 10 lines · Andy Shevchenko
Quoted 3 lines · Pierre-Louis Bossart
Fix by overriding the hard-coded value with the codec name derived from the HID information
The patch makes me think about introducing
acpi_dev_get_dev_name()and
utilize it here since I need something similar to have in one of GPIO
drivers.
Quoted 7 lines
Quoted 5 lines
we use this:
snd_soc_acpi_find_name_from_hid(mach->id)When I started all this the recommendation was to do all this on the audio side of things, I have no objections to a move of the functionality in acpi.
I almost done a patch. I will Cc you for the series.
ok. The only concern I have is that this needs to be a somewhat contained change that doesn't depend on all sorts of other ACPI/GPIO changes. We will have to maintain a v4.14-based branch for a very very long time and the simpler we make it for people who back-port or cherry-pick the better.
Quoted 28 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
+static char codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */
+I would rather do use 4 +
ACPI_ID_LEN+ 3 /* or 1 + 2 */ + 1 and explain
each part in the comment above.Quoted 4 lines
yes we could do this. this is the same code as in other machine drivers,
so we should do the replacement across all of them in one shot in a separate patch.Whatever you prefer, it's minor.
Quoted 12 lines
Quoted 11 lines
sound/soc/intel/boards/bytcht_es8316.c static struct snd_soc_card byt_cht_es8316_card = { · line 257
Quoted 8 lines
sound/soc/intel/boards/bytcht_es8316.c +8
-0+ mach = (&pdev->dev)->platform_data; +/* fix index of codec dai */ +for (i =0 ; i <ARRAY_SIZE (byt_cht_es8316_dais); i++) { +if (!strcmp (byt_cht_es8316_dais[i].codec_name, +"i2c-ESSX8316:00" )) { + dai_index = i; +break ; + }Perhaps at some point you can do such in more generic (across Intel ASoCs) ?
Quoted 6 lines
Quoted 3 lines
Not sure what you are hinting at here? Did you mean changing the name of
the array? Or adding a helper function to do this?Suggestion is to create a helper out of similar for-loops-fix-name in all current users.
ok, I'll work on this. Thanks for the suggestion.
Re: [PATCH 3/3] ASoC: Intel: bytcht_es8316: fix HID handling
Quoted 10 lines · Pierre-Louis Bossart
Quoted 9 lines · Andy Shevchenko
Quoted 6 lines · Pierre-Louis Bossart
we use this:
snd_soc_acpi_find_name_from_hid(mach->id)When I started all this the recommendation was to do all this on the
audio side of things, I have no objections to a move of the functionality in acpi.
Quoted 8 lines
Quoted 1 line
I almost done a patch. I will Cc you for the series.
ok. The only concern I have is that this needs to be a somewhat contained change that doesn't depend on all sorts of other ACPI/GPIO changes. We will have to maintain a v4.14-based branch for a very very
long time and the simpler we make it for people who back-port or cherry-pick the better.
Yes, that is how series has been prepared. You basically need two first patches out of three from it. It had been sent already.
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Mark Brown
maintainerApplied "ASoC: Intel: bytcht_es8316: fix HID handling" to the asoc tree
In reply to Pierre-Louis BossartThe patch
ASoC: Intel: bytcht_es8316: fix HID handling
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
3c22a73fb87366851dcf48d852357a6d808921ccMon Sep 17 00:00:00 2001
From: Pierre-Louis Bossart <[email protected]>
Date: Thu, 11 Jan 2018 13:52:08 -0600
Subject: [PATCH] ASoC: Intel: bytcht_es8316: fix HID handling
Same problem as with previous machine drivers, the codec dai uses a hard-coded name of "i2c-ESSX8316:00" but ACPI provides "i2c-ESSX8316:01" in some systems.
Fix by overriding the hard-coded value with the codec name derived from the HID information
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189261
--- sound/soc/intel/boards/Kconfig | 1 + sound/soc/intel/boards/bytcht_es8316.c | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-)
sound/soc/intel/boards/Kconfig +1 -0
@@ -139,6 +139,7 @@ config SND_SOC_INTEL_BYT_CHT_DA7213_MACH config SND_SOC_INTEL_BYT_CHT_ES8316_MACH tristate "Baytrail & Cherrytrail with ES8316 codec" depends on X86_INTEL_LPSS && I2C && ACPI + select SND_SOC_ACPI select SND_SOC_ES8316 help This adds support for ASoC machine driver for Intel(R) Baytrail &
sound/soc/intel/boards/bytcht_es8316.c +25 -1
@@ -232,15 +232,39 @@ static struct snd_soc_card byt_cht_es8316_card = { .fully_routed = true, }; +static char codec_name[16 ];/* i2c-<HID>:00 with HID being 8 chars */ +static int snd_byt_cht_es8316_mc_probe (struct platform_device *pdev) { -int ret =0 ;struct byt_cht_es8316_private *priv; +struct snd_soc_acpi_mach *mach; +const char *i2c_name =NULL ; +int dai_index =0 ; +int i; +int ret =0 ; priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_ATOMIC );if (!priv)return -ENOMEM ; + mach = (&pdev->dev)->platform_data; +/* fix index of codec dai */ +for (i =0 ; i <ARRAY_SIZE (byt_cht_es8316_dais); i++) { +if (!strcmp (byt_cht_es8316_dais[i].codec_name, +"i2c-ESSX8316:00" )) { + dai_index = i; +break ; + } + } + +/* fixup codec name based on HID */ + i2c_name =snd_soc_acpi_find_name_from_hid (mach->id); +if (i2c_name) { +snprintf (codec_name,sizeof (codec_name), +"%s%s" ,"i2c-" , i2c_name); + byt_cht_es8316_dais[dai_index].codec_name = codec_name; + } +/* register the soc card */ byt_cht_es8316_card.dev = &pdev->dev;snd_soc_card_set_drvdata (&byt_cht_es8316_card, priv);
Signature · 1 line
2.15.1