aboutsummaryrefslogtreecommitdiffstats
path: root/src/w/thinkpad-x220.md
blob: 2cb7f7ee0b70e7ffe93856319825b7b544df3ffc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
title: thinkpad x220

## performances

On a linux installation, disabling mitigations can
[considerably increase the performances](https://linuxreviews.org/HOWTO_make_Linux_run_blazing_fast).
However, it comes with serious security issues.

Add the following parameter for booting your kernel:

```
mitigations=off
```

## microphone

The embbeded microphones can generate a static noise. According to the
[Archlinux wiki](https://wiki.archlinux.org/title/Lenovo_ThinkPad_X220#Microphone),
muting the right microphone fix this issue.

> The following informations are about pulseaudio and its built-in module
> system. A more modern approache would be to use easyeffects. However I
> experienced noisy inputs/outputs while being on calls, and running it in the
> background requires to a) keep the easyeffects window opened b) move
> easyeffects to system tray.

With pulseaudio/pipewire-pulse, the `remap-source` module can be loaded:

```
$ pactl load-module module-remap-source \
    "source_name=${source_name}" \
    "master=${source_index}" \
    use_master_format=1 \
    master_channel_map=front-left \
    channel_map=mono \
    channels=1
```

However, the fans can still be heard, and not all voip clients handle noise
cancelling. Instead, you can keep the right microphone active and use it for
[noise cancellation](https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#module-echo-cancel)
(including the static noise).

```
$ pactl load-module module-echo-cancel \
    "source_name=${source_name}" \
    "master=${source_index}" \
    use_master_format=1 \
    aec_method="webrtc" \
    aec_args='"beamforming=1 mic_geometry=-1,0,0,1,0,0"'
```

See [my dotfiles](https://git.rgoncalves.se/dots/tree/.config/pipewire) for
additional information.

## headset microphone

The built-in microphone controller might automatically switch to a smartphone
headset microphone if one is plugged. It may be a problem for one of the
following reasons:

- The microphone quality can be worse than the chassis one, depending on what
  model or brand you use.
- Apple EarPods do not work out-of-the-box, mostly because of different
  resistors for its 4-pin jack.

On ArchLinux, running `hdajackretask` as root and disabling the smartphone
headset microphone is a solution.

The generated configuration in `/etc/modprobe.d/` can be similar as the
following one:

```
options snd-hda-intel patch=hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw,hda-jack-retask.fw
```

## audio led buttons

On some ThinkPad models, audio led buttons can be broken and desynchronized
on linux `5.15.x`.

A quick workaround is to catch the key press events (in your dwm configuration,
i3, sway, etc ...) and force the synchronization of the leds.

For the microphone:

```
$ pactl get-source-mute @DEFAULT_SOURCE@ | grep no >/dev/null 2>&1
$ echo "${?}" > /sys/class/leds/platform::micmute/brightness
```

For the audio sink:

```
$ pactl get-sink-mute @DEFAULT_SINK@ | grep no >/dev/null 2>&1
$ echo "${?}" > /sys/class/leds/platform::mute/brightness
```

See my [dotfiles](https://git.rgoncalves.se/dots/tree/.bin/ag-audio) and
[the related pipewire issue](https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1849).

## usb-c mod

// todo
remember that computers suck.