[PATCH 4/6] ASoC: Intel: bytcr_rt5640: Add support for a second headphones output

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Mon Aug 2 15:45:33 CEST 2021



On 8/1/21 4:04 PM, Hans de Goede wrote:
> Some devices (HP Elitepad 1000 G2) have a second headphones output
> (1 on the dock, 2nd on the tablet itself) which is implemented through
> the line-out output of the codec combined with an external hp-amp
> which gets enabled through the codec's GPIO1 pin.
> 
> Add support for this through a new BYT_RT5640_LINEOUT_AS_HP2 quirk.
> 
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> ---
>  sound/soc/intel/boards/bytcr_rt5640.c | 36 +++++++++++++++++++++++++--
>  1 file changed, 34 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
> index 70faba13450c..51fb44ad9b4b 100644
> --- a/sound/soc/intel/boards/bytcr_rt5640.c
> +++ b/sound/soc/intel/boards/bytcr_rt5640.c
> @@ -74,6 +74,7 @@ enum {
>  #define BYT_RT5640_MCLK_25MHZ		BIT(23)
>  #define BYT_RT5640_NO_SPEAKERS		BIT(24)
>  #define BYT_RT5640_LINEOUT		BIT(25)
> +#define BYT_RT5640_LINEOUT_AS_HP2	BIT(26)

The definitions aren't fully clear to me. It seems that the two quirks
above are mutually exclusive if I read the code below

+	if (byt_rt5640_quirk & BYT_RT5640_LINEOUT_AS_HP2)
+		lineout_string = " cfg-hp2:lineout";
+	else if (byt_rt5640_quirk & BYT_RT5640_LINEOUT)
 		lineout_string = " cfg-lineout:1";

But in the following patch the two are mixed:

+		.driver_data = (void *)(BYT_RT5640_DMIC2_MAP |
+					BYT_RT5640_MCLK_EN |
+					BYT_RT5640_LINEOUT |
+					BYT_RT5640_LINEOUT_AS_HP2 |
+					BYT_RT5640_HSMIC2_ON_IN1),

so maybe the test above should be

if (byt_rt5640_quirk & BYT_RT5640_LINEOUT) {
	if (byt_rt5640_quirk & BYT_RT5640_LINEOUT_AS_HP2)
		lineout_string = " cfg-hp2:lineout";
	else
 		lineout_string = " cfg-lineout:1";
}


I am also not very clear on the hp2 support, is there any sort of jack
detection or will this require always an explicit user choice?


More information about the Alsa-devel mailing list