All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] ASoC: Intel: bytcr_rt5651: Remove is_valleyview helper
@ 2018-07-01 18:36 Hans de Goede
  2018-07-01 18:36 ` [PATCH v2 2/3] ASoC: Intel: bytcr_rt5651: Move getting of codec_dev into probe() Hans de Goede
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Hans de Goede @ 2018-07-01 18:36 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Carlo Caione

Remove is_valleyview helper, this is not necessary, we can simply call
x86_match_cpu() directly instead.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index ba2753e0e12a..80f47a45cb10 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -28,6 +28,7 @@
 #include <linux/dmi.h>
 #include <linux/slab.h>
 #include <asm/cpu_device_id.h>
+#include <asm/intel-family.h>
 #include <asm/platform_sst_audio.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -680,17 +681,10 @@ static char byt_rt5651_codec_aif_name[12]; /*  = "rt5651-aif[1|2]" */
 static char byt_rt5651_cpu_dai_name[10]; /*  = "ssp[0|2]-port" */
 static char byt_rt5651_long_name[40]; /* = "bytcr-rt5651-*-mic[-swapped-hp]" */
 
-static bool is_valleyview(void)
-{
-	static const struct x86_cpu_id cpu_ids[] = {
-		{ X86_VENDOR_INTEL, 6, 55 }, /* Valleyview, Bay Trail */
-		{}
-	};
-
-	if (!x86_match_cpu(cpu_ids))
-		return false;
-	return true;
-}
+static const struct x86_cpu_id baytrail_cpu_ids[] = {
+	{ X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_SILVERMONT1 }, /* Valleyview */
+	{}
+};
 
 struct acpi_chan_package {   /* ACPICA seems to require 64 bit integers */
 	u64 aif_value;       /* 1: AIF1, 2: AIF2 */
@@ -741,7 +735,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	 * swap SSP0 if bytcr is detected
 	 * (will be overridden if DMI quirk is detected)
 	 */
-	if (is_valleyview()) {
+	if (x86_match_cpu(baytrail_cpu_ids)) {
 		struct sst_platform_info *p_info = mach->pdata;
 		const struct sst_res_info *res_info = p_info->res_info;
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/3] ASoC: Intel: bytcr_rt5651: Move getting of codec_dev into probe()
  2018-07-01 18:36 [PATCH v2 1/3] ASoC: Intel: bytcr_rt5651: Remove is_valleyview helper Hans de Goede
@ 2018-07-01 18:36 ` Hans de Goede
  2018-07-10 18:16   ` Applied "ASoC: Intel: bytcr_rt5651: Move getting of codec_dev into probe()" to the asoc tree Mark Brown
  2018-07-01 18:36 ` [PATCH v2 3/3] ASoC: Intel: bytcr_rt5651: Add support for externar amplifier enable GPIO Hans de Goede
  2018-07-10 18:16 ` Applied "ASoC: Intel: bytcr_rt5651: Remove is_valleyview helper" to the asoc tree Mark Brown
  2 siblings, 1 reply; 8+ messages in thread
From: Hans de Goede @ 2018-07-01 18:36 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Carlo Caione

Move the getting of the codec_dev, to add device-props to it, out of
byt_rt5651_add_codec_device_props() and into its caller,
snd_byt_rt5651_mc_probe().

This is a preparation patch for adding support for an external amplifier
enable GPIO, which requires further accesses to the codec_dev.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 80f47a45cb10..d920725ce603 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -403,15 +403,10 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
  * Note this MUST be called before snd_soc_register_card(), so that the props
  * are in place before the codec component driver's probe function parses them.
  */
-static int byt_rt5651_add_codec_device_props(const char *i2c_dev_name)
+static int byt_rt5651_add_codec_device_props(struct device *i2c_dev)
 {
 	struct property_entry props[MAX_NO_PROPS] = {};
-	struct device *i2c_dev;
-	int ret, cnt = 0;
-
-	i2c_dev = bus_find_device_by_name(&i2c_bus_type, NULL, i2c_dev_name);
-	if (!i2c_dev)
-		return -EPROBE_DEFER;
+	int cnt = 0;
 
 	props[cnt++] = PROPERTY_ENTRY_U32("realtek,jack-detect-source",
 				BYT_RT5651_JDSRC(byt_rt5651_quirk));
@@ -425,10 +420,7 @@ static int byt_rt5651_add_codec_device_props(const char *i2c_dev_name)
 	if (byt_rt5651_quirk & BYT_RT5651_DMIC_EN)
 		props[cnt++] = PROPERTY_ENTRY_BOOL("realtek,dmic-en");
 
-	ret = device_add_properties(i2c_dev, props);
-	put_device(i2c_dev);
-
-	return ret;
+	return device_add_properties(i2c_dev, props);
 }
 
 static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
@@ -696,6 +688,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	const char * const mic_name[] = { "dmic", "in1", "in12" };
 	struct byt_rt5651_private *priv;
 	struct snd_soc_acpi_mach *mach;
+	struct device *codec_dev;
 	const char *i2c_name = NULL;
 	const char *hp_swapped;
 	bool is_bytcr = false;
@@ -731,6 +724,11 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 		"%s%s", "i2c-", i2c_name);
 	byt_rt5651_dais[dai_index].codec_name = byt_rt5651_codec_name;
 
+	codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL,
+					    byt_rt5651_codec_name);
+	if (!codec_dev)
+		return -EPROBE_DEFER;
+
 	/*
 	 * swap SSP0 if bytcr is detected
 	 * (will be overridden if DMI quirk is detected)
@@ -794,7 +792,8 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	dmi_check_system(byt_rt5651_quirk_table);
 
 	/* Must be called before register_card, also see declaration comment. */
-	ret_val = byt_rt5651_add_codec_device_props(byt_rt5651_codec_name);
+	ret_val = byt_rt5651_add_codec_device_props(codec_dev);
+	put_device(codec_dev);
 	if (ret_val)
 		return ret_val;
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/3] ASoC: Intel: bytcr_rt5651: Add support for externar amplifier enable GPIO
  2018-07-01 18:36 [PATCH v2 1/3] ASoC: Intel: bytcr_rt5651: Remove is_valleyview helper Hans de Goede
  2018-07-01 18:36 ` [PATCH v2 2/3] ASoC: Intel: bytcr_rt5651: Move getting of codec_dev into probe() Hans de Goede
@ 2018-07-01 18:36 ` Hans de Goede
  2018-07-04  0:14   ` Pierre-Louis Bossart
  2018-07-10 18:16 ` Applied "ASoC: Intel: bytcr_rt5651: Remove is_valleyview helper" to the asoc tree Mark Brown
  2 siblings, 1 reply; 8+ messages in thread
From: Hans de Goede @ 2018-07-01 18:36 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Carlo Caione

The rt5651 does not have a built-in speaker amplifier, so it is often
used together with an external amplifier. On Cherry Trail boards this
external amplifier's enable pin is driven through a GPIO, which is
given as the first GPIO in the ACPI resources of the codec fwnode.

This commit adds support to the bytcr_rt5651 for this GPIO, fixing
the speaker not working on CHT devices with a rt5651 codec.

Cc: Carlo Caione <carlo@endlessm.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-Handle the ext amp GPIO entirely in the machine driver, the ext-amp is
 not part of the codec, so it should not be controlled by the codec driver
---
 sound/soc/intel/boards/bytcr_rt5651.c | 65 +++++++++++++++++++++++++--
 1 file changed, 62 insertions(+), 3 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index d920725ce603..5301205496be 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -26,6 +26,8 @@
 #include <linux/clk.h>
 #include <linux/device.h>
 #include <linux/dmi.h>
+#include <linux/gpio/consumer.h>
+#include <linux/gpio/machine.h>
 #include <linux/slab.h>
 #include <asm/cpu_device_id.h>
 #include <asm/intel-family.h>
@@ -86,6 +88,7 @@ enum {
 
 struct byt_rt5651_private {
 	struct clk *mclk;
+	struct gpio_desc *ext_amp_gpio;
 	struct snd_soc_jack jack;
 };
 
@@ -208,6 +211,20 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
 	return 0;
 }
 
+static int rt5651_ext_amp_power_event(struct snd_soc_dapm_widget *w,
+	struct snd_kcontrol *kcontrol, int event)
+{
+	struct snd_soc_card *card = w->dapm->card;
+	struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
+
+	if (SND_SOC_DAPM_EVENT_ON(event))
+		gpiod_set_value_cansleep(priv->ext_amp_gpio, 1);
+	else
+		gpiod_set_value_cansleep(priv->ext_amp_gpio, 0);
+
+	return 0;
+}
+
 static const struct snd_soc_dapm_widget byt_rt5651_widgets[] = {
 	SND_SOC_DAPM_HP("Headphone", NULL),
 	SND_SOC_DAPM_MIC("Headset Mic", NULL),
@@ -217,7 +234,9 @@ static const struct snd_soc_dapm_widget byt_rt5651_widgets[] = {
 	SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
 			    platform_clock_control, SND_SOC_DAPM_PRE_PMU |
 			    SND_SOC_DAPM_POST_PMD),
-
+	SND_SOC_DAPM_SUPPLY("Ext Amp Power", SND_SOC_NOPM, 0, 0,
+			    rt5651_ext_amp_power_event,
+			    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
 };
 
 static const struct snd_soc_dapm_route byt_rt5651_audio_map[] = {
@@ -225,6 +244,7 @@ static const struct snd_soc_dapm_route byt_rt5651_audio_map[] = {
 	{"Headset Mic", NULL, "Platform Clock"},
 	{"Internal Mic", NULL, "Platform Clock"},
 	{"Speaker", NULL, "Platform Clock"},
+	{"Speaker", NULL, "Ext Amp Power"},
 	{"Line In", NULL, "Platform Clock"},
 
 	{"Headset Mic", NULL, "micbias1"}, /* lowercase for rt5651 */
@@ -678,6 +698,18 @@ static const struct x86_cpu_id baytrail_cpu_ids[] = {
 	{}
 };
 
+static const struct x86_cpu_id cherrytrail_cpu_ids[] = {
+	{ X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_AIRMONT },     /* Braswell */
+	{}
+};
+
+static const struct acpi_gpio_params ext_amp_enable_gpios = { 0, 0, false };
+
+static const struct acpi_gpio_mapping byt_rt5651_gpios[] = {
+	{ "ext-amp-enable-gpios", &ext_amp_enable_gpios, 1 },
+	{ },
+};
+
 struct acpi_chan_package {   /* ACPICA seems to require 64 bit integers */
 	u64 aif_value;       /* 1: AIF1, 2: AIF2 */
 	u64 mclock_value;    /* usually 25MHz (0x17d7940), ignored */
@@ -793,9 +825,36 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 
 	/* Must be called before register_card, also see declaration comment. */
 	ret_val = byt_rt5651_add_codec_device_props(codec_dev);
-	put_device(codec_dev);
-	if (ret_val)
+	if (ret_val) {
+		put_device(codec_dev);
 		return ret_val;
+	}
+
+	/* Cherry Trail devices use an external amplifier enable gpio */
+	if (x86_match_cpu(cherrytrail_cpu_ids)) {
+		devm_acpi_dev_add_driver_gpios(codec_dev, byt_rt5651_gpios);
+		priv->ext_amp_gpio = devm_fwnode_get_index_gpiod_from_child(
+						&pdev->dev, "ext-amp-enable", 0,
+						codec_dev->fwnode,
+						GPIOD_OUT_LOW, "speaker-amp");
+		if (IS_ERR(priv->ext_amp_gpio)) {
+			ret_val = PTR_ERR(priv->ext_amp_gpio);
+			switch (ret_val) {
+			case -ENOENT:
+				priv->ext_amp_gpio = NULL;
+				break;
+			default:
+				dev_err(&pdev->dev, "Failed to get ext-amp-enable GPIO: %d\n",
+					ret_val);
+				/* fall through */
+			case -EPROBE_DEFER:
+				put_device(codec_dev);
+				return ret_val;
+			}
+		}
+	}
+
+	put_device(codec_dev);
 
 	log_quirks(&pdev->dev);
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 3/3] ASoC: Intel: bytcr_rt5651: Add support for externar amplifier enable GPIO
  2018-07-01 18:36 ` [PATCH v2 3/3] ASoC: Intel: bytcr_rt5651: Add support for externar amplifier enable GPIO Hans de Goede
@ 2018-07-04  0:14   ` Pierre-Louis Bossart
  2018-07-04  7:46     ` Hans de Goede
  0 siblings, 1 reply; 8+ messages in thread
From: Pierre-Louis Bossart @ 2018-07-04  0:14 UTC (permalink / raw)
  To: Hans de Goede, Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: alsa-devel, Carlo Caione

On 7/1/18 1:36 PM, Hans de Goede wrote:
> The rt5651 does not have a built-in speaker amplifier, so it is often
> used together with an external amplifier. On Cherry Trail boards this
> external amplifier's enable pin is driven through a GPIO, which is
> given as the first GPIO in the ACPI resources of the codec fwnode.
> 
> This commit adds support to the bytcr_rt5651 for this GPIO, fixing
> the speaker not working on CHT devices with a rt5651 codec.

ALl this GPIO/ACPI stuff is a bit beyond my understanding. My only 
comment is "how would this work on Baytrail"? There are clearly a set of 
devices which use the SSP0 routing - so Baytrail-CR packages, it's not 
clear to me how the amplifier is controlled in those cases?

> 
> Cc: Carlo Caione <carlo@endlessm.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> -Handle the ext amp GPIO entirely in the machine driver, the ext-amp is
>   not part of the codec, so it should not be controlled by the codec driver
> ---
>   sound/soc/intel/boards/bytcr_rt5651.c | 65 +++++++++++++++++++++++++--
>   1 file changed, 62 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
> index d920725ce603..5301205496be 100644
> --- a/sound/soc/intel/boards/bytcr_rt5651.c
> +++ b/sound/soc/intel/boards/bytcr_rt5651.c
> @@ -26,6 +26,8 @@
>   #include <linux/clk.h>
>   #include <linux/device.h>
>   #include <linux/dmi.h>
> +#include <linux/gpio/consumer.h>
> +#include <linux/gpio/machine.h>
>   #include <linux/slab.h>
>   #include <asm/cpu_device_id.h>
>   #include <asm/intel-family.h>
> @@ -86,6 +88,7 @@ enum {
>   
>   struct byt_rt5651_private {
>   	struct clk *mclk;
> +	struct gpio_desc *ext_amp_gpio;
>   	struct snd_soc_jack jack;
>   };
>   
> @@ -208,6 +211,20 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
>   	return 0;
>   }
>   
> +static int rt5651_ext_amp_power_event(struct snd_soc_dapm_widget *w,
> +	struct snd_kcontrol *kcontrol, int event)
> +{
> +	struct snd_soc_card *card = w->dapm->card;
> +	struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
> +
> +	if (SND_SOC_DAPM_EVENT_ON(event))
> +		gpiod_set_value_cansleep(priv->ext_amp_gpio, 1);
> +	else
> +		gpiod_set_value_cansleep(priv->ext_amp_gpio, 0);
> +
> +	return 0;
> +}
> +
>   static const struct snd_soc_dapm_widget byt_rt5651_widgets[] = {
>   	SND_SOC_DAPM_HP("Headphone", NULL),
>   	SND_SOC_DAPM_MIC("Headset Mic", NULL),
> @@ -217,7 +234,9 @@ static const struct snd_soc_dapm_widget byt_rt5651_widgets[] = {
>   	SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
>   			    platform_clock_control, SND_SOC_DAPM_PRE_PMU |
>   			    SND_SOC_DAPM_POST_PMD),
> -
> +	SND_SOC_DAPM_SUPPLY("Ext Amp Power", SND_SOC_NOPM, 0, 0,
> +			    rt5651_ext_amp_power_event,
> +			    SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
>   };
>   
>   static const struct snd_soc_dapm_route byt_rt5651_audio_map[] = {
> @@ -225,6 +244,7 @@ static const struct snd_soc_dapm_route byt_rt5651_audio_map[] = {
>   	{"Headset Mic", NULL, "Platform Clock"},
>   	{"Internal Mic", NULL, "Platform Clock"},
>   	{"Speaker", NULL, "Platform Clock"},
> +	{"Speaker", NULL, "Ext Amp Power"},
>   	{"Line In", NULL, "Platform Clock"},
>   
>   	{"Headset Mic", NULL, "micbias1"}, /* lowercase for rt5651 */
> @@ -678,6 +698,18 @@ static const struct x86_cpu_id baytrail_cpu_ids[] = {
>   	{}
>   };
>   
> +static const struct x86_cpu_id cherrytrail_cpu_ids[] = {
> +	{ X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_AIRMONT },     /* Braswell */
> +	{}
> +};
> +
> +static const struct acpi_gpio_params ext_amp_enable_gpios = { 0, 0, false };
> +
> +static const struct acpi_gpio_mapping byt_rt5651_gpios[] = {
> +	{ "ext-amp-enable-gpios", &ext_amp_enable_gpios, 1 },
> +	{ },
> +};
> +
>   struct acpi_chan_package {   /* ACPICA seems to require 64 bit integers */
>   	u64 aif_value;       /* 1: AIF1, 2: AIF2 */
>   	u64 mclock_value;    /* usually 25MHz (0x17d7940), ignored */
> @@ -793,9 +825,36 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
>   
>   	/* Must be called before register_card, also see declaration comment. */
>   	ret_val = byt_rt5651_add_codec_device_props(codec_dev);
> -	put_device(codec_dev);
> -	if (ret_val)
> +	if (ret_val) {
> +		put_device(codec_dev);
>   		return ret_val;
> +	}
> +
> +	/* Cherry Trail devices use an external amplifier enable gpio */
> +	if (x86_match_cpu(cherrytrail_cpu_ids)) {
> +		devm_acpi_dev_add_driver_gpios(codec_dev, byt_rt5651_gpios);
> +		priv->ext_amp_gpio = devm_fwnode_get_index_gpiod_from_child(
> +						&pdev->dev, "ext-amp-enable", 0,
> +						codec_dev->fwnode,
> +						GPIOD_OUT_LOW, "speaker-amp");
> +		if (IS_ERR(priv->ext_amp_gpio)) {
> +			ret_val = PTR_ERR(priv->ext_amp_gpio);
> +			switch (ret_val) {
> +			case -ENOENT:
> +				priv->ext_amp_gpio = NULL;
> +				break;
> +			default:
> +				dev_err(&pdev->dev, "Failed to get ext-amp-enable GPIO: %d\n",
> +					ret_val);
> +				/* fall through */
> +			case -EPROBE_DEFER:
> +				put_device(codec_dev);
> +				return ret_val;
> +			}
> +		}
> +	}
> +
> +	put_device(codec_dev);
>   
>   	log_quirks(&pdev->dev);
>   
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 3/3] ASoC: Intel: bytcr_rt5651: Add support for externar amplifier enable GPIO
  2018-07-04  0:14   ` Pierre-Louis Bossart
@ 2018-07-04  7:46     ` Hans de Goede
  2018-07-09 22:50       ` Pierre-Louis Bossart
  0 siblings, 1 reply; 8+ messages in thread
From: Hans de Goede @ 2018-07-04  7:46 UTC (permalink / raw)
  To: Pierre-Louis Bossart, Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: alsa-devel, Carlo Caione

Hi,

On 04-07-18 02:14, Pierre-Louis Bossart wrote:
> On 7/1/18 1:36 PM, Hans de Goede wrote:
>> The rt5651 does not have a built-in speaker amplifier, so it is often
>> used together with an external amplifier. On Cherry Trail boards this
>> external amplifier's enable pin is driven through a GPIO, which is
>> given as the first GPIO in the ACPI resources of the codec fwnode.
>>
>> This commit adds support to the bytcr_rt5651 for this GPIO, fixing
>> the speaker not working on CHT devices with a rt5651 codec.
> 
> ALl this GPIO/ACPI stuff is a bit beyond my understanding. My only comment is "how would this work on Baytrail"? There are clearly a set of devices which use the SSP0 routing - so Baytrail-CR packages, it's not clear to me how the amplifier is controlled in those cases?

I have a couple of BYT devices with a rt5651 codec and there the
amplifier just works. Either it is a different model without an
enable pin, or the enable pin is hard wired to Vcc.

Regards,

Hans


> 
>>
>> Cc: Carlo Caione <carlo@endlessm.com>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> Changes in v2:
>> -Handle the ext amp GPIO entirely in the machine driver, the ext-amp is
>>   not part of the codec, so it should not be controlled by the codec driver
>> ---
>>   sound/soc/intel/boards/bytcr_rt5651.c | 65 +++++++++++++++++++++++++--
>>   1 file changed, 62 insertions(+), 3 deletions(-)
>>
>> diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
>> index d920725ce603..5301205496be 100644
>> --- a/sound/soc/intel/boards/bytcr_rt5651.c
>> +++ b/sound/soc/intel/boards/bytcr_rt5651.c
>> @@ -26,6 +26,8 @@
>>   #include <linux/clk.h>
>>   #include <linux/device.h>
>>   #include <linux/dmi.h>
>> +#include <linux/gpio/consumer.h>
>> +#include <linux/gpio/machine.h>
>>   #include <linux/slab.h>
>>   #include <asm/cpu_device_id.h>
>>   #include <asm/intel-family.h>
>> @@ -86,6 +88,7 @@ enum {
>>   struct byt_rt5651_private {
>>       struct clk *mclk;
>> +    struct gpio_desc *ext_amp_gpio;
>>       struct snd_soc_jack jack;
>>   };
>> @@ -208,6 +211,20 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
>>       return 0;
>>   }
>> +static int rt5651_ext_amp_power_event(struct snd_soc_dapm_widget *w,
>> +    struct snd_kcontrol *kcontrol, int event)
>> +{
>> +    struct snd_soc_card *card = w->dapm->card;
>> +    struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
>> +
>> +    if (SND_SOC_DAPM_EVENT_ON(event))
>> +        gpiod_set_value_cansleep(priv->ext_amp_gpio, 1);
>> +    else
>> +        gpiod_set_value_cansleep(priv->ext_amp_gpio, 0);
>> +
>> +    return 0;
>> +}
>> +
>>   static const struct snd_soc_dapm_widget byt_rt5651_widgets[] = {
>>       SND_SOC_DAPM_HP("Headphone", NULL),
>>       SND_SOC_DAPM_MIC("Headset Mic", NULL),
>> @@ -217,7 +234,9 @@ static const struct snd_soc_dapm_widget byt_rt5651_widgets[] = {
>>       SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
>>                   platform_clock_control, SND_SOC_DAPM_PRE_PMU |
>>                   SND_SOC_DAPM_POST_PMD),
>> -
>> +    SND_SOC_DAPM_SUPPLY("Ext Amp Power", SND_SOC_NOPM, 0, 0,
>> +                rt5651_ext_amp_power_event,
>> +                SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
>>   };
>>   static const struct snd_soc_dapm_route byt_rt5651_audio_map[] = {
>> @@ -225,6 +244,7 @@ static const struct snd_soc_dapm_route byt_rt5651_audio_map[] = {
>>       {"Headset Mic", NULL, "Platform Clock"},
>>       {"Internal Mic", NULL, "Platform Clock"},
>>       {"Speaker", NULL, "Platform Clock"},
>> +    {"Speaker", NULL, "Ext Amp Power"},
>>       {"Line In", NULL, "Platform Clock"},
>>       {"Headset Mic", NULL, "micbias1"}, /* lowercase for rt5651 */
>> @@ -678,6 +698,18 @@ static const struct x86_cpu_id baytrail_cpu_ids[] = {
>>       {}
>>   };
>> +static const struct x86_cpu_id cherrytrail_cpu_ids[] = {
>> +    { X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_AIRMONT },     /* Braswell */
>> +    {}
>> +};
>> +
>> +static const struct acpi_gpio_params ext_amp_enable_gpios = { 0, 0, false };
>> +
>> +static const struct acpi_gpio_mapping byt_rt5651_gpios[] = {
>> +    { "ext-amp-enable-gpios", &ext_amp_enable_gpios, 1 },
>> +    { },
>> +};
>> +
>>   struct acpi_chan_package {   /* ACPICA seems to require 64 bit integers */
>>       u64 aif_value;       /* 1: AIF1, 2: AIF2 */
>>       u64 mclock_value;    /* usually 25MHz (0x17d7940), ignored */
>> @@ -793,9 +825,36 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
>>       /* Must be called before register_card, also see declaration comment. */
>>       ret_val = byt_rt5651_add_codec_device_props(codec_dev);
>> -    put_device(codec_dev);
>> -    if (ret_val)
>> +    if (ret_val) {
>> +        put_device(codec_dev);
>>           return ret_val;
>> +    }
>> +
>> +    /* Cherry Trail devices use an external amplifier enable gpio */
>> +    if (x86_match_cpu(cherrytrail_cpu_ids)) {
>> +        devm_acpi_dev_add_driver_gpios(codec_dev, byt_rt5651_gpios);
>> +        priv->ext_amp_gpio = devm_fwnode_get_index_gpiod_from_child(
>> +                        &pdev->dev, "ext-amp-enable", 0,
>> +                        codec_dev->fwnode,
>> +                        GPIOD_OUT_LOW, "speaker-amp");
>> +        if (IS_ERR(priv->ext_amp_gpio)) {
>> +            ret_val = PTR_ERR(priv->ext_amp_gpio);
>> +            switch (ret_val) {
>> +            case -ENOENT:
>> +                priv->ext_amp_gpio = NULL;
>> +                break;
>> +            default:
>> +                dev_err(&pdev->dev, "Failed to get ext-amp-enable GPIO: %d\n",
>> +                    ret_val);
>> +                /* fall through */
>> +            case -EPROBE_DEFER:
>> +                put_device(codec_dev);
>> +                return ret_val;
>> +            }
>> +        }
>> +    }
>> +
>> +    put_device(codec_dev);
>>       log_quirks(&pdev->dev);
>>
> 
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 3/3] ASoC: Intel: bytcr_rt5651: Add support for externar amplifier enable GPIO
  2018-07-04  7:46     ` Hans de Goede
@ 2018-07-09 22:50       ` Pierre-Louis Bossart
  0 siblings, 0 replies; 8+ messages in thread
From: Pierre-Louis Bossart @ 2018-07-09 22:50 UTC (permalink / raw)
  To: Hans de Goede, Liam Girdwood, Mark Brown, Bard Liao, Oder Chiou
  Cc: alsa-devel, Carlo Caione



On 07/04/2018 02:46 AM, Hans de Goede wrote:
> Hi,
>
> On 04-07-18 02:14, Pierre-Louis Bossart wrote:
>> On 7/1/18 1:36 PM, Hans de Goede wrote:
>>> The rt5651 does not have a built-in speaker amplifier, so it is often
>>> used together with an external amplifier. On Cherry Trail boards this
>>> external amplifier's enable pin is driven through a GPIO, which is
>>> given as the first GPIO in the ACPI resources of the codec fwnode.
>>>
>>> This commit adds support to the bytcr_rt5651 for this GPIO, fixing
>>> the speaker not working on CHT devices with a rt5651 codec.
>>
>> ALl this GPIO/ACPI stuff is a bit beyond my understanding. My only 
>> comment is "how would this work on Baytrail"? There are clearly a set 
>> of devices which use the SSP0 routing - so Baytrail-CR packages, it's 
>> not clear to me how the amplifier is controlled in those cases?
>
> I have a couple of BYT devices with a rt5651 codec and there the
> amplifier just works. Either it is a different model without an
> enable pin, or the enable pin is hard wired to Vcc.
ok. All patches in this series

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

>
> Regards,
>
> Hans
>
>
>>
>>>
>>> Cc: Carlo Caione <carlo@endlessm.com>
>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>> ---
>>> Changes in v2:
>>> -Handle the ext amp GPIO entirely in the machine driver, the ext-amp is
>>>   not part of the codec, so it should not be controlled by the codec 
>>> driver
>>> ---
>>>   sound/soc/intel/boards/bytcr_rt5651.c | 65 
>>> +++++++++++++++++++++++++--
>>>   1 file changed, 62 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/sound/soc/intel/boards/bytcr_rt5651.c 
>>> b/sound/soc/intel/boards/bytcr_rt5651.c
>>> index d920725ce603..5301205496be 100644
>>> --- a/sound/soc/intel/boards/bytcr_rt5651.c
>>> +++ b/sound/soc/intel/boards/bytcr_rt5651.c
>>> @@ -26,6 +26,8 @@
>>>   #include <linux/clk.h>
>>>   #include <linux/device.h>
>>>   #include <linux/dmi.h>
>>> +#include <linux/gpio/consumer.h>
>>> +#include <linux/gpio/machine.h>
>>>   #include <linux/slab.h>
>>>   #include <asm/cpu_device_id.h>
>>>   #include <asm/intel-family.h>
>>> @@ -86,6 +88,7 @@ enum {
>>>   struct byt_rt5651_private {
>>>       struct clk *mclk;
>>> +    struct gpio_desc *ext_amp_gpio;
>>>       struct snd_soc_jack jack;
>>>   };
>>> @@ -208,6 +211,20 @@ static int platform_clock_control(struct 
>>> snd_soc_dapm_widget *w,
>>>       return 0;
>>>   }
>>> +static int rt5651_ext_amp_power_event(struct snd_soc_dapm_widget *w,
>>> +    struct snd_kcontrol *kcontrol, int event)
>>> +{
>>> +    struct snd_soc_card *card = w->dapm->card;
>>> +    struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
>>> +
>>> +    if (SND_SOC_DAPM_EVENT_ON(event))
>>> +        gpiod_set_value_cansleep(priv->ext_amp_gpio, 1);
>>> +    else
>>> +        gpiod_set_value_cansleep(priv->ext_amp_gpio, 0);
>>> +
>>> +    return 0;
>>> +}
>>> +
>>>   static const struct snd_soc_dapm_widget byt_rt5651_widgets[] = {
>>>       SND_SOC_DAPM_HP("Headphone", NULL),
>>>       SND_SOC_DAPM_MIC("Headset Mic", NULL),
>>> @@ -217,7 +234,9 @@ static const struct snd_soc_dapm_widget 
>>> byt_rt5651_widgets[] = {
>>>       SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
>>>                   platform_clock_control, SND_SOC_DAPM_PRE_PMU |
>>>                   SND_SOC_DAPM_POST_PMD),
>>> -
>>> +    SND_SOC_DAPM_SUPPLY("Ext Amp Power", SND_SOC_NOPM, 0, 0,
>>> +                rt5651_ext_amp_power_event,
>>> +                SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
>>>   };
>>>   static const struct snd_soc_dapm_route byt_rt5651_audio_map[] = {
>>> @@ -225,6 +244,7 @@ static const struct snd_soc_dapm_route 
>>> byt_rt5651_audio_map[] = {
>>>       {"Headset Mic", NULL, "Platform Clock"},
>>>       {"Internal Mic", NULL, "Platform Clock"},
>>>       {"Speaker", NULL, "Platform Clock"},
>>> +    {"Speaker", NULL, "Ext Amp Power"},
>>>       {"Line In", NULL, "Platform Clock"},
>>>       {"Headset Mic", NULL, "micbias1"}, /* lowercase for rt5651 */
>>> @@ -678,6 +698,18 @@ static const struct x86_cpu_id 
>>> baytrail_cpu_ids[] = {
>>>       {}
>>>   };
>>> +static const struct x86_cpu_id cherrytrail_cpu_ids[] = {
>>> +    { X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_AIRMONT },     /* 
>>> Braswell */
>>> +    {}
>>> +};
>>> +
>>> +static const struct acpi_gpio_params ext_amp_enable_gpios = { 0, 0, 
>>> false };
>>> +
>>> +static const struct acpi_gpio_mapping byt_rt5651_gpios[] = {
>>> +    { "ext-amp-enable-gpios", &ext_amp_enable_gpios, 1 },
>>> +    { },
>>> +};
>>> +
>>>   struct acpi_chan_package {   /* ACPICA seems to require 64 bit 
>>> integers */
>>>       u64 aif_value;       /* 1: AIF1, 2: AIF2 */
>>>       u64 mclock_value;    /* usually 25MHz (0x17d7940), ignored */
>>> @@ -793,9 +825,36 @@ static int snd_byt_rt5651_mc_probe(struct 
>>> platform_device *pdev)
>>>       /* Must be called before register_card, also see declaration 
>>> comment. */
>>>       ret_val = byt_rt5651_add_codec_device_props(codec_dev);
>>> -    put_device(codec_dev);
>>> -    if (ret_val)
>>> +    if (ret_val) {
>>> +        put_device(codec_dev);
>>>           return ret_val;
>>> +    }
>>> +
>>> +    /* Cherry Trail devices use an external amplifier enable gpio */
>>> +    if (x86_match_cpu(cherrytrail_cpu_ids)) {
>>> +        devm_acpi_dev_add_driver_gpios(codec_dev, byt_rt5651_gpios);
>>> +        priv->ext_amp_gpio = devm_fwnode_get_index_gpiod_from_child(
>>> +                        &pdev->dev, "ext-amp-enable", 0,
>>> +                        codec_dev->fwnode,
>>> +                        GPIOD_OUT_LOW, "speaker-amp");
>>> +        if (IS_ERR(priv->ext_amp_gpio)) {
>>> +            ret_val = PTR_ERR(priv->ext_amp_gpio);
>>> +            switch (ret_val) {
>>> +            case -ENOENT:
>>> +                priv->ext_amp_gpio = NULL;
>>> +                break;
>>> +            default:
>>> +                dev_err(&pdev->dev, "Failed to get ext-amp-enable 
>>> GPIO: %d\n",
>>> +                    ret_val);
>>> +                /* fall through */
>>> +            case -EPROBE_DEFER:
>>> +                put_device(codec_dev);
>>> +                return ret_val;
>>> +            }
>>> +        }
>>> +    }
>>> +
>>> +    put_device(codec_dev);
>>>       log_quirks(&pdev->dev);
>>>
>>

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Applied "ASoC: Intel: bytcr_rt5651: Move getting of codec_dev into probe()" to the asoc tree
  2018-07-01 18:36 ` [PATCH v2 2/3] ASoC: Intel: bytcr_rt5651: Move getting of codec_dev into probe() Hans de Goede
@ 2018-07-10 18:16   ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2018-07-10 18:16 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Oder Chiou, alsa-devel, Pierre-Louis Bossart, Liam Girdwood,
	Mark Brown, Carlo Caione, Bard Liao

The patch

   ASoC: Intel: bytcr_rt5651: Move getting of codec_dev into probe()

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

>From 2c375204bfad2f481feb006a82cdb67cc570b670 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 1 Jul 2018 20:36:30 +0200
Subject: [PATCH] ASoC: Intel: bytcr_rt5651: Move getting of codec_dev into
 probe()

Move the getting of the codec_dev, to add device-props to it, out of
byt_rt5651_add_codec_device_props() and into its caller,
snd_byt_rt5651_mc_probe().

This is a preparation patch for adding support for an external amplifier
enable GPIO, which requires further accesses to the codec_dev.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 80f47a45cb10..d920725ce603 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -403,15 +403,10 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
  * Note this MUST be called before snd_soc_register_card(), so that the props
  * are in place before the codec component driver's probe function parses them.
  */
-static int byt_rt5651_add_codec_device_props(const char *i2c_dev_name)
+static int byt_rt5651_add_codec_device_props(struct device *i2c_dev)
 {
 	struct property_entry props[MAX_NO_PROPS] = {};
-	struct device *i2c_dev;
-	int ret, cnt = 0;
-
-	i2c_dev = bus_find_device_by_name(&i2c_bus_type, NULL, i2c_dev_name);
-	if (!i2c_dev)
-		return -EPROBE_DEFER;
+	int cnt = 0;
 
 	props[cnt++] = PROPERTY_ENTRY_U32("realtek,jack-detect-source",
 				BYT_RT5651_JDSRC(byt_rt5651_quirk));
@@ -425,10 +420,7 @@ static int byt_rt5651_add_codec_device_props(const char *i2c_dev_name)
 	if (byt_rt5651_quirk & BYT_RT5651_DMIC_EN)
 		props[cnt++] = PROPERTY_ENTRY_BOOL("realtek,dmic-en");
 
-	ret = device_add_properties(i2c_dev, props);
-	put_device(i2c_dev);
-
-	return ret;
+	return device_add_properties(i2c_dev, props);
 }
 
 static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
@@ -696,6 +688,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	const char * const mic_name[] = { "dmic", "in1", "in12" };
 	struct byt_rt5651_private *priv;
 	struct snd_soc_acpi_mach *mach;
+	struct device *codec_dev;
 	const char *i2c_name = NULL;
 	const char *hp_swapped;
 	bool is_bytcr = false;
@@ -731,6 +724,11 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 		"%s%s", "i2c-", i2c_name);
 	byt_rt5651_dais[dai_index].codec_name = byt_rt5651_codec_name;
 
+	codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL,
+					    byt_rt5651_codec_name);
+	if (!codec_dev)
+		return -EPROBE_DEFER;
+
 	/*
 	 * swap SSP0 if bytcr is detected
 	 * (will be overridden if DMI quirk is detected)
@@ -794,7 +792,8 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	dmi_check_system(byt_rt5651_quirk_table);
 
 	/* Must be called before register_card, also see declaration comment. */
-	ret_val = byt_rt5651_add_codec_device_props(byt_rt5651_codec_name);
+	ret_val = byt_rt5651_add_codec_device_props(codec_dev);
+	put_device(codec_dev);
 	if (ret_val)
 		return ret_val;
 
-- 
2.18.0.rc2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Applied "ASoC: Intel: bytcr_rt5651: Remove is_valleyview helper" to the asoc tree
  2018-07-01 18:36 [PATCH v2 1/3] ASoC: Intel: bytcr_rt5651: Remove is_valleyview helper Hans de Goede
  2018-07-01 18:36 ` [PATCH v2 2/3] ASoC: Intel: bytcr_rt5651: Move getting of codec_dev into probe() Hans de Goede
  2018-07-01 18:36 ` [PATCH v2 3/3] ASoC: Intel: bytcr_rt5651: Add support for externar amplifier enable GPIO Hans de Goede
@ 2018-07-10 18:16 ` Mark Brown
  2 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2018-07-10 18:16 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Oder Chiou, alsa-devel, Pierre-Louis Bossart, Liam Girdwood,
	Mark Brown, Carlo Caione, Bard Liao

The patch

   ASoC: Intel: bytcr_rt5651: Remove is_valleyview helper

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

>From fbea16dbc0a31484811c5f335ae344b2bbc66f40 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 1 Jul 2018 20:36:29 +0200
Subject: [PATCH] ASoC: Intel: bytcr_rt5651: Remove is_valleyview helper

Remove is_valleyview helper, this is not necessary, we can simply call
x86_match_cpu() directly instead.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/boards/bytcr_rt5651.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index ba2753e0e12a..80f47a45cb10 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -28,6 +28,7 @@
 #include <linux/dmi.h>
 #include <linux/slab.h>
 #include <asm/cpu_device_id.h>
+#include <asm/intel-family.h>
 #include <asm/platform_sst_audio.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -680,17 +681,10 @@ static char byt_rt5651_codec_aif_name[12]; /*  = "rt5651-aif[1|2]" */
 static char byt_rt5651_cpu_dai_name[10]; /*  = "ssp[0|2]-port" */
 static char byt_rt5651_long_name[40]; /* = "bytcr-rt5651-*-mic[-swapped-hp]" */
 
-static bool is_valleyview(void)
-{
-	static const struct x86_cpu_id cpu_ids[] = {
-		{ X86_VENDOR_INTEL, 6, 55 }, /* Valleyview, Bay Trail */
-		{}
-	};
-
-	if (!x86_match_cpu(cpu_ids))
-		return false;
-	return true;
-}
+static const struct x86_cpu_id baytrail_cpu_ids[] = {
+	{ X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_SILVERMONT1 }, /* Valleyview */
+	{}
+};
 
 struct acpi_chan_package {   /* ACPICA seems to require 64 bit integers */
 	u64 aif_value;       /* 1: AIF1, 2: AIF2 */
@@ -741,7 +735,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	 * swap SSP0 if bytcr is detected
 	 * (will be overridden if DMI quirk is detected)
 	 */
-	if (is_valleyview()) {
+	if (x86_match_cpu(baytrail_cpu_ids)) {
 		struct sst_platform_info *p_info = mach->pdata;
 		const struct sst_res_info *res_info = p_info->res_info;
 
-- 
2.18.0.rc2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-07-10 18:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-01 18:36 [PATCH v2 1/3] ASoC: Intel: bytcr_rt5651: Remove is_valleyview helper Hans de Goede
2018-07-01 18:36 ` [PATCH v2 2/3] ASoC: Intel: bytcr_rt5651: Move getting of codec_dev into probe() Hans de Goede
2018-07-10 18:16   ` Applied "ASoC: Intel: bytcr_rt5651: Move getting of codec_dev into probe()" to the asoc tree Mark Brown
2018-07-01 18:36 ` [PATCH v2 3/3] ASoC: Intel: bytcr_rt5651: Add support for externar amplifier enable GPIO Hans de Goede
2018-07-04  0:14   ` Pierre-Louis Bossart
2018-07-04  7:46     ` Hans de Goede
2018-07-09 22:50       ` Pierre-Louis Bossart
2018-07-10 18:16 ` Applied "ASoC: Intel: bytcr_rt5651: Remove is_valleyview helper" to the asoc tree Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.