linux icon indicating copy to clipboard operation
linux copied to clipboard

[BUG] [CML] jack detection of speaker error on galaxy chromebook

Open rhjdvsgsgks opened this issue 1 year ago • 6 comments

on this device. speaker been recognized as "line out" in pipewire and alsa. but it is a speaker, which means it will never be "pluged in". thus pipewire will never try to use it.

but if i force some sound play through this card and device. the speaker will works

alsa-info.txt

pw-dump

  {
    "id": 52,
    "type": "PipeWire:Interface:Device",
    "version": 3,
    "permissions": [ "r", "w", "x", "m" ],
    "info": {
      "change-mask": [ "props", "params" ],
      "props": {
        "alsa.card": 0,
        "alsa.card_name": "sof-cmlda7219max",
        "alsa.components": "HDA:8086280b,80860101,00100000",
        "alsa.driver_name": "snd_soc_sst_bxt_da7219_max98357a",
        "alsa.id": "sofcmlda7219max",
        "alsa.long_card_name": "Google-Kohaku-rev6",
        "alsa.mixer_name": "Intel Kabylake HDMI",
        "api.acp.auto-port": false,
        "api.alsa.card": 0,
        "api.alsa.card.longname": "Google-Kohaku-rev6",
        "api.alsa.card.name": "sof-cmlda7219max",
        "api.alsa.path": "hw:0",
        "api.alsa.use-acp": true,
        "api.dbus.ReserveDevice1": "Audio0",
        "api.dbus.ReserveDevice1.Priority": -20,
        "client.id": 51,
        "device.api": "alsa",
        "device.bus": "pci",
        "device.bus-path": "pci-0000:00:1f.3-platform-cml_da7219_mx98357a",
        "device.description": "Comet Lake PCH-LP cAVS",
        "device.enum.api": "udev",
        "device.icon-name": "audio-card-analog-pci",
        "device.name": "alsa_card.pci-0000_00_1f.3-platform-cml_da7219_mx98357a",
        "device.nick": "sof-cmlda7219max",
        "device.plugged.usec": 14165294,
        "device.product.id": "0x02c8",
        "device.product.name": "Comet Lake PCH-LP cAVS",
        "device.string": 0,
        "device.subsystem": "sound",
        "device.sysfs.path": "/devices/pci0000:00/0000:00:1f.3/cml_da7219_mx98357a/sound/card0",
        "device.vendor.id": "0x8086",
        "device.vendor.name": "Intel Corporation",
        "factory.id": 14,
        "media.class": "Audio/Device",
        "object.id": 52,
        "object.path": "alsa:pcm:0",
        "object.serial": 52
      },
      "params": {
        "EnumProfile": [
          {
            "index": 0,
            "name": "off",
            "description": "Off",
            "priority": 0,
            "available": "yes",
            "classes": [
              0
            ]
          },
          {
            "index": 1,
            "name": "output:stereo-fallback",
            "description": "Stereo Output",
            "priority": 5100,
            "available": "no",
            "classes": [
              1,
              [
                "Audio/Sink",
                1,
                "card.profile.devices",
                [ 8 ]
              ]
            ]
          },
          {
            "index": 2,
            "name": "pro-audio",
            "description": "Pro Audio",
            "priority": 1,
            "available": "unknown",
            "classes": [
              2,
              [
                "Audio/Source",
                3,
                "card.profile.devices",
                [ 5, 6, 7 ]
              ],
              [
                "Audio/Sink",
                5,
                "card.profile.devices",
                [ 0, 1, 2, 3, 4 ]
              ]
            ]
          }
        ],
        "Profile": [
          {
            "index": 0,
            "name": "off",
            "description": "Off",
            "priority": 0,
            "available": "yes",
            "classes": [
              0
            ],
            "save": false
          }
        ],
        "EnumRoute": [
          {
            "index": 0,
            "direction": "Output",
            "name": "analog-output-lineout", <<< should be speaker
            "description": "Line Out",
            "priority": 9000,
            "available": "no",
            "info": [
              3,
              "port.type",
              "line",
              "port.availability-group",
              "Legacy 1",
              "card.profile.port",
              "0"
            ],
            "profiles": [ 1 ],
            "devices": [ 8 ]
          },
          {
            "index": 1,
            "direction": "Output",
            "name": "analog-output-headphones",
            "description": "Headphones",
            "priority": 9900,
            "available": "no",
            "info": [
              4,
              "port.type",
              "headphones",
              "port.availability-group",
              "Legacy 2",
              "device.icon_name",
              "audio-headphones",
              "card.profile.port",
              "1"
            ],
            "profiles": [ 1 ],
            "devices": [ 8 ]
          }
        ],
        "Route": [
        ]
      }
    }
  }

amixer contents

numid=72,iface=CARD,name='HDMI/DP,pcm=5 Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off
numid=78,iface=CARD,name='HDMI/DP,pcm=6 Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off
numid=84,iface=CARD,name='HDMI/DP,pcm=7 Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off
numid=65,iface=CARD,name='Headphone Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off
numid=66,iface=CARD,name='Headset Mic Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off
numid=67,iface=CARD,name='Line Out Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off
numid=68,iface=MIXER,name='Headphone Jack Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off

rhjdvsgsgks avatar Jun 09 '24 01:06 rhjdvsgsgks

i tried reconfig with jack_detect = no hint. and it will freeze like https://github.com/thesofproject/linux/issues/4055#issuecomment-1332331371

rhjdvsgsgks avatar Jun 09 '24 01:06 rhjdvsgsgks

if no alsa config. pipewire will play through speaker when headphone pluged. and no sound on speaker while unpluged. so im using this asound.conf to force headphone (and internal mic) as default device for this card

pcm.!hw {
	#keep this part, otherwise will throw error when have args
	@args.0 CARD
	@args.1 DEV
	@args.2 SUBDEV
	@args.CARD {
		type string
		default {
			@func getenv
			vars [
				ALSA_PCM_CARD
				ALSA_CARD
			]
			default {
				@func refer
				name 'defaults.pcm.card'
			}
		}
	}
	@args.DEV {
		type integer
		default {
			@func igetenv
			vars [
				ALSA_PCM_DEVICE
			]
			default {
				@func refer
				name 'defaults.pcm.device'
			}
		}
	}
	@args.SUBDEV {
		type integer
		default {
			@func refer
			name 'defaults.pcm.subdevice'
		}
	}
	type asym
	playback.pcm {
		type hw
		card 0
		device 1
	}
	capture.pcm {
		type hw
		card 0
		device 2
	}
}

rhjdvsgsgks avatar Jun 09 '24 21:06 rhjdvsgsgks

It's likely that there are no UCM configurations for this card

I can see this

alsa-ucm-conf$ ls ucm2/Intel/sof-glkda7219max/
Hdmi.conf  HiFi.conf  sof-glkda7219max.conf

so most likely you can try to adjust this file for sof-cmlda7219max, which IIRC should be the same configuration.

maybe @brentlu can help?

plbossart avatar Jun 10 '24 06:06 plbossart

UCM could be found here:

https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/refs/heads/main/overlay-hatch/chromeos-base/chromeos-bsp-hatch/files/common/audio/ucm-config/sof-cmlda7219max.base/

brentlu avatar Jun 11 '24 06:06 brentlu

Just curious if there is something needs to be done in machine driver for speaker PCM to be recognized correctly? In this case, it's recognized as lineout.

brentlu avatar Jun 11 '24 06:06 brentlu

thanks. i just tried use the ucm from chromiumos or from sof-glkda7219max. none of them works. EnumRoute will become empty after using any of these config

rhjdvsgsgks avatar Jun 12 '24 08:06 rhjdvsgsgks

solved by https://github.com/alsa-project/alsa-ucm-conf/pull/630

rhjdvsgsgks avatar Nov 03 '25 23:11 rhjdvsgsgks