summaryrefslogtreecommitdiff
path: root/cras/src/server/cras_alsa_jack.c
AgeCommit message (Collapse)Author
2021-03-03Revert^2 "Merge branch 'upstream-master'"Jorge Moreira Broche
82f9901c43f5c647d7cef5fad37ec991439071a8 Change-Id: Ic261e0423897bd7cf35186431026b859aac66048
2021-02-22Revert "Merge branch 'upstream-master'"Florian Mayer
Revert submission 1579283-jemoreira-crosvm-update Reason for revert: Broke build. Reverted Changes: I7cf3fe07f:Merge remote-tracking branch 'aosp/upstream-main' Icb5f26241:Update Android.bp files I25af576b6:Merge branch 'upstream-master' Change-Id: I3dbab90871618dcbaf4404ba0d66c73a64c446f7
2020-11-18CRAS: alsa_jack - Simplify HDMI jack checkHsin-Yu Chao
Before we have fully specified UCM, the legacy logic of HDMI jack check compares jack name with "HDMI/DP" and this breaks in new platforms that jack name with "HDMI" in the middle. BUG=b:173487161 TEST=Test on Trogdor Change-Id: Ia93ec3068a084bef9272547dab1f3bc6de878288 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/2543709 Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
2020-11-12CRAS: alsa_jack - Non-HDMI/DP jack should not associate to ELD controlHsin-Yu Chao
In find_gpio_jacks() we should check the device name to see if it's really a HDMI/DP jack before associating an ELD mixer control. This avoids issue on a problematic platform that a non-HDMI gpio jack shares the same dev id with the ELD control of a real HDMI device. BUG=b:172928360 TEST=Verify 3.5mm jack detection works on hatch 13593.0.0 Change-Id: I10e607e975a9767cb0be958d267b8a985793bf2d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/2534234 Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
2020-08-17CRAS: alsa_jack - Fix crash at NULL result_jackHsin-Yu Chao
find_gpio_jacks could got NULL result_jack, so we need to check nullity. BUG=b:164307793, b:160939437 TEST=Test on helios to verify CRAS doesn't crash. Change-Id: Ieaeebf4c63bc280d1cbb1755c6074688baf76618 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/2355635 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
2020-08-13CRAS: alsa_jack - Check ELD control for HDMI/DP gpio jackHsin-Yu Chao
This fixes the missing case of ELD control on gpio HDMI jack, and consolidate various code paths of ELD control matching into one single function. BUG=b:160939437 TEST=Verify on GLk platform that external monitor name can be resolved. Change-Id: Ie874b5a28eef81bd1d66718eecd18e5220375db7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/2345906 Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
2020-05-21CRAS: server - Allow client callback to poll arbitrary eventsHsin-Yu Chao
Bluetooth HFP service level connection runs on rfcomm socket, and there are events when remote side hangs up and we fail to catch that. Fix this by allowing client callback be registerd to main thread with arbitrary poll events. BUG=b:155279795 TEST=Manual test HFP qualification test case HFP/AG/SDP/BV-01-I Change-Id: Ib5e36798d0e39aa5d921bee25e8fb6bf1e5f6a76 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/2198854 Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
2019-10-16CRAS: alsa_jack - Fix jack matching rule in UCMHsin-Yu Chao
Below is our existing logic of gpio jack matching: (1) Create jack for each input evdev. (2) Look up a UCM device by matching the 'JackName' label with input evdev name. (3) Once the UCM device is found, look for the value of 'PlaybackPCM' or 'CapturePCM' label according to direction. (4) Compare the PCM value with 'hw:<card-name>,<jack-list-index>' which was added in commit bc573a333 The last step is NOT always true, there are cases that PCM name doesn't really contain the exact string as card name. And that blocks us from passing these PCM values to snd_pcm_open(). In fact, part of step (4) is redundant because in (2) we found the UCM device that matches jack name so we already know it's the correct card to associate. We could simplify step (4) to just match the device index in PCM name. So that we can fix 'PlaybackPCM' and 'CapturePCM' values in UCM files to the ones that compatible with ALSA libraries. BUG=b:141447866, chromium:1014208 TEST=Verify node enumeration still works on octopus board. Change-Id: I3df0115a10def14ead6a93f49deadda218b1aad1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/1861477 Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
2019-07-08CRAS: Format cras_alsa_jackEn-Shuo Hsu
Reformat codes with the .clang-format we just introduced. To format whole files provided in-place: clang-format -i -style=file [<file> ...] BUG=chromium:950858 TEST=Add directory to check_format_error and run FEATURES="test" USE=asan emerge-${BOARD} -v media-sound/adhd Change-Id: Ib76fceb573c2b6d55b36d096a3757ab8b5704512 Reviewed-on: https://chromium-review.googlesource.com/1669414 Tested-by: En-Shuo Hsu <enshuo@google.com> Commit-Ready: En-Shuo Hsu <enshuo@google.com> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
2019-04-21CRAS: Support DspName in SectionDeviceEn-Shuo Hsu
Support DspName instead of OuputDspName and InputDspName in SectionDevice. With the change we could specify DspName in SectionDevice instead of setting OuputDspName or InputDspName in SectionVerb and disabling the devices we don't want to apply Dsp to. This change also move the DspName from cras_alsa_jack to cras_ionode to fix the issue that we couldn't specify Dsp for devices without jack. BUG=chromium:849598,chromium:947948 TEST=deploy and test on peppy Cq-Depend: chromium:1567574,chromium:1557833,chrome-internal:1168915,chrome-internal:1167322,chrome-internal:1166797,chrome-internal:1167539 Change-Id: I9335e2edc2a98b96f06a62896721302b37ba3bb1 Reviewed-on: https://chromium-review.googlesource.com/1556872 Commit-Ready: En-Shuo Hsu <enshuo@google.com> Tested-by: En-Shuo Hsu <enshuo@google.com> Reviewed-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
2018-09-21CRAS: alsa_jack - Monitor UAC2 jack controlsBen Zhang
With commit 5a222e849452 ("ALSA: usb-audio: UAC2 jack detection"), the usb card for a supported UAC2 device will have boolean kcontrols named "* - Input Jack" and "* - Output Jack" exposing jack status, where * is the usb terminal name. If the device provides a string in iTerminal, it'll be used as the terminal name. Otherwise a standard name is given based on wTerminalType. See sound/usb/mixer.c get_term_name for the complete list. Common ones we are interested in are "Headset", "Headphone", "Mic", "Speaker". This patch adds the jack names so CRAS can watch the kcontrols for plug/unplug event. BUG=b:74149899 TEST=Test dongle with UAC2 jack detect with various headsets on meowth. Unplug headset but keep usb dongle attached, cras_test_client --dump_s shows the correct ionode plug status for the usb card. Test dongles without UAC2 jack detect and verify ionode is set to plugged by default. Change-Id: Iba19612841dad5d764b08715a791d1ad64f9e541 Signed-off-by: Ben Zhang <benzh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1237315 Reviewed-by: Dylan Reid <dgreid@chromium.org>
2018-05-22adhd: Remove uninitialized string and syslog call in cras_alsa_jack.cpaulhsia
(4/17 leaking tests for the issue) char* device_name is uninitialized and it's used by syslog. This will cause memory access out of bounds if the memory bytes are dirty in the string. Remove it since it's only used by syslog. Remove the syslog call as well. BUG=chromium:844092 TEST=Apply full patch set and run FEATURES="test noclean nostrip" emerge-eve adhd and valgrind --leak-check=full --show-leak-kinds=all alsa_jack_unittest Change-Id: I1b366f6f08a5f0007f31c6bc78576ad20250c416 Reviewed-on: https://chromium-review.googlesource.com/1067518 Commit-Ready: Chih-Yang Hsia <paulhsia@chromium.org> Tested-by: Chih-Yang Hsia <paulhsia@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
2017-03-17CRAS: alsa_jack - Remove callback of hctl element on destroyCheng-Yi Chiang
When a hctl jack is to be freed, its callback should be removed too. Otherwise, callback will be called when snd_hctl_close is called, and at that time, iodev and jack might already be destroyed. BUG=chromium:701542 TEST=make check Change-Id: If08f98f5323aef75cb45dfe81bf5980da891e2f7 Reviewed-on: https://chromium-review.googlesource.com/455618 Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
2016-12-22CRAS: alsa_jack - Move wait_for_dev_input_access to cras_utilCheng-Yi Chiang
Move wait_for_dev_input_access to cras_utils so we can overwrite it in unittest. BUG=None TEST=make check, run alsa_jack_unittest and see it finishes within 1 second instead of 40 seconds. Change-Id: Id0f293e9b5ee1d56c151d918314ea85ff936a3c9 Reviewed-on: https://chromium-review.googlesource.com/416091 Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
2016-12-08CRAS: UCM - Introduce cras_use_case_mgr wrapper.Chinyue Chen
The cras_use_case_mgr wraps the ALSA snd_use_case_mgr and can hold the selected use case for the ALSA card. The benefit is that the use case verb can be looked up from cras_use_case_mgr and doesn't need to be passed around or hard-coded. Following commits will make use of the new wrapper. BUG=chromium:643039 TEST=make check Change-Id: I0ffe94e6d635c8c0b62aa5f9ccc40bf49808d1a3 Reviewed-on: https://chromium-review.googlesource.com/415749 Commit-Ready: Chinyue Chen <chinyue@chromium.org> Tested-by: Chinyue Chen <chinyue@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
2016-11-23CRAS: use R_OK to test file read permissionYong Zhi
Use macros defined in unistd.h for how argument of int access(const char *file, int how) function. BUG=chrome-os-partner:59363 TEST=reboot and test headset plug status Change-Id: I62318948dd4e4f70fa869d7ce7f0f7d27ce8a706 Signed-off-by: Yong Zhi <yong.zhi@intel.com> Reviewed-on: https://chromium-review.googlesource.com/412203 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com> Tested-by: Anson Tseng <ansonfcu@gmail.com> Reviewed-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com> Reviewed-by: Anson Tseng <ansonfcu@gmail.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
2016-10-12CRAS: alsa_jack - Use different timeout for different type of jacks.Chinyue Chen
GPIO jack on some boards need long timeout for working correctly. However that affects HCTL jacks on some boards to wait too long. Use different timeout for each of them so both work happily. BUG=chromium:624819 TEST=Verified on big that HDMI node got selected soon after plugged in. Change-Id: Iebb7be897ed931d943233cf163bb61933b81eeb3 Reviewed-on: https://chromium-review.googlesource.com/394468 Commit-Ready: Chinyue Chen <chinyue@chromium.org> Tested-by: Chinyue Chen <chinyue@chromium.org> Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
2016-10-05Revert "CRAS: alsa_jack: report jack status right away for hctl jack"Chinyue Chen
This reverts commit e8a04ef732f97405d91783ddfd3d64ca50ca16b1. The commit to report jack early does not work well on peppy after suspend/resume. BUG=chromium:651594 TEST=Test on peppy, play music, suspend/resume, plug external display and verify audio is working. Change-Id: I71d817cb2f7fc6e2581f534f4953b33ed635d2ab Reviewed-on: https://chromium-review.googlesource.com/393626 Commit-Ready: Chinyue Chen <chinyue@chromium.org> Tested-by: Chinyue Chen <chinyue@chromium.org> Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
2016-08-11CRAS: alsa_io - Get volume curve for node by UCMHsin-Yu Chao
This changes allows spcifying volume curve for a node associated to specific UCM device, which is useful in the case that 'Line Out' and 'Headphone' nodes shares the same gpio jack and mixer control. BUG=chromium:634958 TEST=Edit CRAS config under /etc/cras and specify the section label as the UCM device of a node to verify volume curve applied. Change-Id: Icec8de79385423922b9a0d52942cee833c8a07cc Reviewed-on: https://chromium-review.googlesource.com/367682 Commit-Ready: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
2016-07-21CRAS: Remove device index test in cras_alsa_jack.John Muir
There used to be limits in ALSA for device number values. Now this is not the case, and the card number is unlikely to be wrong coming into CRAS. Remove the test. BUG=None TEST=CRAS can use a device with index larger than 32. Change-Id: I9c41b8ec477a285d781ac3c94b4f65468707bafb Reviewed-on: https://chromium-review.googlesource.com/360028 Commit-Ready: Dan Shi <dshi@google.com> Tested-by: John Muir <muirj@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
2016-07-06CRAS: alsa_jack: report jack status right away for hctl jackCheng-Yi Chiang
hctl jack does not need to check EDID file to make sure it supports audio or not. Jack status should be reported to alsa_io right away. The display info in ELD control can be updated later. BUG=chromium:624819 TEST=on nyan_big, check HDMI is shown as plugged few seconds after plugging HDMI cable rather than 10 seconds. Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org> Change-Id: Ib2e09b2556b7f95da8f31c99714b5039e7ec8fb7 Reviewed-on: https://chromium-review.googlesource.com/358281
2016-06-26CRAS: alsa_jack - Increase number of DISPLAY_INFO_MAX_RETRIESPei-Cheng Liao
This patch increases number of DISPLAY_INFO_MAX_RETRIES to 25 to avoid some display need more time to connect. BUG=chrome-os-partner:54657 TEST=build and boot elm to UI plug on HDMI and check audio output Change-Id: I783f55e4810ae4b8bbfbbf7f6ab73842998b88d0 Signed-off-by: PC Liao <pc.liao@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/355772 Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
2016-06-17CRAS: Fix for Brillo release build warning on unused variable.Frank Barchard
assert is redefined to nothing in Brillo release builds, and as a result some variables can be unused in release mode. Fix this code to avoid using assert when the return value of the regular expression compile can simply be checked. BUG=None TEST=Build+test passes on Chrome. Run test on Samus. Release build passes on Brillo. Debug build passes on Brillo. Change-Id: I45be32ef6703000dad07bd7caec87ac34613f00a Reviewed-on: https://chromium-review.googlesource.com/353036 Commit-Ready: John Muir <muirj@google.com> Tested-by: John Muir <muirj@google.com> Reviewed-by: Frank Barchard <phthoruth@gmail.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
2016-06-11CRAS: Allow jack switch number to be specified.John Muir
Some sound cards can detect multiple types of connections into the audio jack - for example distinguish between line-out and headphones by measuring the impedance on the other end. In that case we want each jack to have it's own I/O node so that each can have it's own volume settings. This allows us to specify the jack used more exactly. BUG=None TEST=Added unit tests. Validated that only the specified switch is used. Change-Id: Ieef1cf46198977cb7e246e5383199650b27f75c4 Reviewed-on: https://chromium-review.googlesource.com/347362 Commit-Ready: John Muir <muirj@google.com> Tested-by: John Muir <muirj@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
2016-06-08CRAS: Allow jacks to be specified fully in UCM configuration.John Muir
Add functions that allow jacks to be specified fully in the UCM configuration files. BUG=None TEST=Added unit tests to cover the new functions. Change-Id: I3acb2ecea4c121c2542f923e1441a669f8095d83 Reviewed-on: https://chromium-review.googlesource.com/343342 Commit-Ready: John Muir <muirj@google.com> Tested-by: John Muir <muirj@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
2016-06-03CRAS: alsa_jack - Fix name matching for microphone jackCheng-Yi Chiang
On some board the microphone jack is "Headset Jack". BUG=chromium:616370 TEST=build on cyan, check microphone node is enumerated TEST=make check Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org> Change-Id: I41da8689cb7a7a3e749721d8136561814f5e2a8a Reviewed-on: https://chromium-review.googlesource.com/349391
2016-05-31CRAS: Make GPIO search more generic.John Muir
This is in preparation for a second way to match the GPIO device name without regular expressions for UCM fully specified. There will also be a change to allow listing the devices without UDEV which is not available on Brillo. BUG=None TEST=Updated jack unit test. Change-Id: I4bed1cc6482b0446cd0e61f86d65ea802d71ea90 Reviewed-on: https://chromium-review.googlesource.com/343262 Commit-Ready: John Muir <muirj@google.com> Tested-by: John Muir <muirj@google.com> Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
2016-05-31CRAS: Refactor use of hctl poll descriptors.John Muir
Move setup of ALSA hcontrol pollfds from jack to card since the poll descriptors are per-card. This paves the way for execution of the jack search multiple times where we don't want to register the pollfds multiple times. Fix bug where GPIO jack fds were not being de-registered from cras_system_state when the card was removed. Make real failure to create a GPIO jack filter up through the chain. BUG=None TEST=Updated unit tests for the associated cards. Tested on samus and the panther Chrome Box. Change-Id: If007589a0d90acbb4ecde60f3f6e12a77d976130 Reviewed-on: https://chromium-review.googlesource.com/343261 Commit-Ready: John Muir <muirj@google.com> Tested-by: John Muir <muirj@google.com> Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
2016-04-14CRAS: alsa_jack - Separate jack_list creation and finding jacksCheng-Yi Chiang
Separate cras_alsa_jack_list_create into jack_list creation and finding jacks by name matching. Add fields card_name, card_index, direction to cras_alsa_jack_list so finding jacks can reuse those fields without passing parameters. Wrap the original usage into cras_alsa_jack_create_jack_list_and_find_jacks so cras_alsa_io can have least change. In the future changes, cras_alsa_io will go through one of the paths in alsa_iodev_create: - If FullySpecifiedUCM is enabled, call cras_alsa_jack_list_create to create a jack list, and find jacks by going through the sections with matched device name. Associate the found jack to the node, and add the jack to jack list. - If FullySpecifiedUCM is not enabled, call cras_alsa_jack_create_jack_list_and_find_jacks to create jack list and find jacks with current name matching scheme. BUG=chromium:540888 TEST=make check Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org> Change-Id: If2acb86307abe9d7cde29a399f8a17e249da1392 Reviewed-on: https://chromium-review.googlesource.com/323622 Reviewed-by: Dylan Reid <dgreid@chromium.org>
2015-10-29CRAS: alsa_jack - Checks device name for GPIO jackCheng-Yi Chiang
Checks if a GPIO jack should be associated with a device by checking the device name if it is specified in UCM. Otherwise, assume GPIO jacks should be associated with the first device. On the other hand, hctl jacks still use pcm=? in its name to determine the device index because it is the common case on hctl jacks. BUG=chrome-os-partner:40529 TEST=make check TEST=on samus, test headphone and microphone. TEST=on oak, HDMI jack works. Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org> Change-Id: I4e3397dd95cbac290f6daa61b5029d3068cfd64b Reviewed-on: https://chromium-review.googlesource.com/309094
2015-09-10CRAS: alsa_mixer - Check input control when creating alsa mixer.Yao-Wen Mao
For usb devices, the names of their capture controls may be 'Mic' or 'Microphone' or something else. We need to identify them and associate to a input node so that we can mute them properly. BUG=chromium:526092 TEST=Plug in Plantronic .Audio 655 DSP. Use 'cras_test_client --capture_mute 1' to mute the Mic and verify the result with 'amixer -c <CARD>'. Change-Id: Ib6d6e67b0b1168d3f6945aa949e6b685e9b09076 Reviewed-on: https://chromium-review.googlesource.com/296876 Commit-Ready: Yao-Wen Mao <yaowen@google.com> Tested-by: Yao-Wen Mao <yaowen@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
2015-09-10CRAS: alsa_mixer - refactor the mixer control structure.Yao-Wen Mao
Use mixer_control as a unified interface and hide the definition of it. mixer_output_control is a derived structure from mixer_control. Store additional information for output control in it. BUG=None TEST=None Change-Id: I910f572d4ec12fdd5b9a72ef80f937050285dbb5 Reviewed-on: https://chromium-review.googlesource.com/298004 Commit-Ready: Yao-Wen Mao <yaowen@google.com> Tested-by: Yao-Wen Mao <yaowen@google.com> Reviewed-by: Yao-Wen Mao <yaowen@google.com>
2015-09-09CRAS: alsa_mixer - remove device index in output controls.Yao-Wen Mao
Remove device_index in output controls since it is always zero for a long time. BUG=None TEST=None Change-Id: I90a55781c6c7325ebee6c8f6f3a59475ed4ec2b8 Reviewed-on: https://chromium-review.googlesource.com/298003 Commit-Ready: Yao-Wen Mao <yaowen@google.com> Tested-by: Yao-Wen Mao <yaowen@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
2015-07-21CRAS: alsa_io - Remove may_have_internal_micCheng-Yi Chiang
The method may_have_internal_mic was needed for stumpy/lumpy where we want to distinguish that there is internal mic on lumpy, not on stumpy. However with the ucm config NoCreateDefaultInputNode that logic is actually not needed. Now, for board with "Speaker Phantom Jack" and without "Internal Mic Phantom Jack", we should still create internal mic node. BUG=chromium:509529 TEST=With CL in kernel to create "Speaker Phantom Jack", check internal mic node is in UI. Change-Id: Id2f098a6747978b7b988ef34dde5656746f449c2 Reviewed-on: https://chromium-review.googlesource.com/286285 Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org> Commit-Queue: Cheng-Yi Chiang <cychiang@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
2015-07-21CRAS: alsa_jack - Find GPIO jacks even when there are already some jacksCheng-Yi Chiang
cras_alsa_jack_list_create should try to find GPIO jack even when there is jack found by find_jack_controls. For example, there can be a snd control jack "Speaker Phantom Jack" associated with Speaker node, and a GPIO jack "Headphone Jack" associated with Headphone node. BUG=chromium:509529 TEST=with previous CL to add "Speaker Phantom Jack", check headphone plugged state can be detected correctly. Change-Id: I01815604b0fe9a6d13a1ca4af2b7caad978001a1 Reviewed-on: https://chromium-review.googlesource.com/286092 Reviewed-by: Dylan Reid <dgreid@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org> Commit-Queue: Cheng-Yi Chiang <cychiang@chromium.org>
2015-07-21CRAS: alsa_jack - Add speaker phantom jack to output_jack_base_namesCheng-Yi Chiang
Create a jack for speaker if there is a jack control named "Speaker Phantom Jack". This jack will be associated to "Speaker" mixer control and thus affect the plugged status of Speaker node. BUG=chromium:509529 TEST=With CL in kernel to create such jack control, check speaker node in UI appear/disappear based on the value of that jack control. Change-Id: I20b8939bc31545992b2e006c8ae691a657929181 Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/286090 Reviewed-by: Dylan Reid <dgreid@chromium.org>
2015-07-10CRAS: alsa_jack - Update monitor name from EDID.Chinyue Chen
The external node name doesn't get updated now for devices without ELD control. Use the monitor name from EDID if present. BUG=chrome-os-partner:40065 TEST=Test and verify on minnie Change-Id: I9d5a38e2dcff03da4575d9d1a7c3cfebbe91d21f Reviewed-on: https://chromium-review.googlesource.com/284033 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Chinyue Chen <chinyue@chromium.org> Tested-by: Chinyue Chen <chinyue@chromium.org>
2014-11-23CRAS: jack - Look for headset jacksDylan Reid
Allow Headset combo jacks that report separate mic and headphone events on the same input device. This is needed to support Pinky and Ryu with the 227e headset chip. BUG=none TEST=plug/unplug headset on Pinky. Change-Id: Ibf464f52760047b35d5209439bd3beded5ff223f Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/229965 Reviewed-by: Hsinyu Chao <hychao@chromium.org>
2014-11-23CRAS: jack - Check direction when looking for a valueDylan Reid
This will allow the Mic and Headphone Jack to be the same in a future commit. This is needed for boards that use the new Watson headset detect chip. BUG=none TEST=plug/unplug on Pinky with new headset changes merged. Change-Id: I6f84e3140ffd6e0793d4a71edd040efe08d0ff5e Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/229964
2014-10-15CRAS: alsa_jack - Create gpio jacks on first input/output deviceBen Zhang
We used to create gpio jacks only on device 0 of a card. This does not work for Samus since there are two front end DAIs: device 0: System Playback (CRAS_STREAM_OUTPUT) device 1: Capture (CRAS_STREAM_INPUT) With this patch, headphone/HDMI gpio jacks are created and attached to the first output device of a card. Mic gpio jacks are created and attached to the first input device of a card. BUG=chrome-os-partner:29649 TEST=On Samus bdw-rt5677 Mic Jack appears with this patch Change-Id: I87ad98c7605a7855af86bfaaec8425c02a89427d Signed-off-by: Ben Zhang <benzh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220591
2014-05-02CRAS: Let user override node type in ucm-configCheng-Yi Chiang
In some use case, we need to override the node type. E.g. on All-In-One device, audio outputs to HDMI, but it should be internal speaker from user point of view. This CL enables user to set OverrideNodeType "Internal Speaker" in ucm-config to override node type to CRAS_NODE_TYPE_INTERNAL_SPEAKER. BUG=chrome-os-partner:27695 TEST=with next CL to set ucm-config, check audio type is changed to internal speaker on monroe. Change-Id: I40b904ff778241d24d4676d6f65c3dfd9e786e83 Reviewed-on: https://chromium-review.googlesource.com/197199 Reviewed-by: Dylan Reid <dgreid@chromium.org> Tested-by: Cheng-Yi Chiang <cychiang@chromium.org> Commit-Queue: Cheng-Yi Chiang <cychiang@chromium.org>
2014-02-26CRAS alsa_jack: Add method to get monitor name from ELDHsin-Yu Chao
When ELD buffer ready, read the external monitor name and update to the corresponding node. If the monitor name fails to read, or at the unplug event, fallback to use jack name. BUG=chrome-os-partner:25101 TEST=gmerge adhd; Test on Peppy, verify the external monitor name is displayed in audio device UI, instead of the jack name "HDMI/DP ..." Change-Id: I64e716c5ebe88780fc1c647c8f3f2a252f871574 Reviewed-on: https://chromium-review.googlesource.com/187102 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
2014-02-26CRAS alsa_jack: Poll ELD controlHsin-Yu Chao
When HDMI jack plug event happens, the corresponding ELD buffer will be updated after a delay. Reuse existing timer callback to poll whether it is ready for read. BUG=chrome-os-partner:25101 TEST=Manual test on Peppy, add log to verify that when HDMI hotplug, the plug/unplug status is reported in a few tries(within the max number of retries). Change-Id: I1f28808443fe7177fc4cb9d6aed19bd1952b2e2f Reviewed-on: https://chromium-review.googlesource.com/187101 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
2014-02-26CRAS alsa_jack: Refactor/rename EDID timer and callbackHsin-Yu Chao
This refactor modifies the callback functions used for EDID timer. check_jack_edid() function is extracted so now it's independent from the timers and callbacs. The new look allows better integration with a later change adding poll and read ELD mixer control. The edid timer/retries/delay_cb and gpio change callback are renamed to a more general name, so that they can be reused in later change. E.g. 'edid_' prefix changed to 'display_info_' BUG=chrome-os-partner:25101 TEST=Build and run on daisy, make sure the HDMI jack behavior does not break. Change-Id: I37e94fe00717803ade9a64c82755def2473575ff Reviewed-on: https://chromium-review.googlesource.com/187419 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org>
2014-02-25CRAS alsa_jack: ELD controls for HDMI/DP jackHsin-Yu Chao
For HDMI/DP jack, check if there is a ELD control for it. This ELD control will be used to retrieve the name of the connected external monitor in later changes. BUG=chrome-os-partner:25101 TEST=Unittest. Test on Peppy, manual add log to verify that we got an ELD control for each HDMI/DP alsa device. Change-Id: I700c993450049697faf731c949484080d0b6abf4 Reviewed-on: https://chromium-review.googlesource.com/187100 Reviewed-by: Hsinyu Chao <hychao@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
2014-02-25CRAS alsa_jack: Add error log when EDID read timeoutHsin-Yu Chao
When EDID read timeout happens for whatever reason, log it so we can spot this in feedback log. BUG=chromium:338927 TEST=None Change-Id: I186fcbd3aa478807577cf3bbb6290233d7cc89b9 Reviewed-on: https://chromium-review.googlesource.com/187621 Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org>
2013-10-04CRAS: Remove DL_FOREACH_SAFE because DL_FOREACH is also safe now.Chih-Chung Chang
BUG=none TEST=make check Change-Id: Iab32c7afb9c7a97fbc2f246b6c3e6130afd628f7 Reviewed-on: https://chromium-review.googlesource.com/171704 Reviewed-by: Chih-Chung Chang <chihchung@chromium.org> Commit-Queue: Chih-Chung Chang <chihchung@chromium.org> Tested-by: Chih-Chung Chang <chihchung@chromium.org>
2013-09-17CRAS: Try to read EDID longerDylan Reid
Pit takes a long time to debounce hot plug and read HDMI. Give it more time, trying every half second until it is ready. BUG=chromium:22258 TEST=plug HDMI monitor, listen Change-Id: Ic7b1df254963db9f1d63c67c619289d0afea0347 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/169660
2013-08-22CRAS: alsa_jack - remove unused header.Dylan Reid
libudev isn't used in this file. Change-Id: I8bd50cba5cf3e1dd05001dfd30e9e05568dde950 Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/66152 Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
2013-08-14CRAS: If we know there is no internal mic, don't add an output node for it.Chih-Chung Chang
On newer kernels we can know if there is an internal mic by checking if the jack named "Internal Mic Phantom Jack" exists. BUG=chromium:270292 TEST=make check. run on stumpy and there is no output node for internal mic, but on lumpy there is. Change-Id: I62fb7b7e0c4bc10fba8b1221d957b4bb6312206a Reviewed-on: https://gerrit.chromium.org/gerrit/65688 Reviewed-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Chih-Chung Chang <chihchung@chromium.org> Tested-by: Chih-Chung Chang <chihchung@chromium.org>