chore: initialize gentoo-setup documentation repository

Add comprehensive documentation for Lenovo ThinkPad Gentoo Linux setup
including:
- Complete system configuration guides (power, Bluetooth, WiFi, audio)
- Hardware setup documentation (touchpad, touchscreen, DisplayLink)
- Management scripts with ZSH completions
- Kernel configuration (6.12.41-gentoo-x86_64)
- Lid automation and monitor management
- Battery conservation system
- User guides and troubleshooting

Repository includes .gitignore to exclude logs, temporary files, and
secrets.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-07 18:22:51 +01:00
commit 8de3f16ee6
33 changed files with 18411 additions and 0 deletions

View File

@@ -0,0 +1,277 @@
# Touchpad and Touchscreen Setup
## Date: 2025-11-05
## Problem
Both touchpad and touchscreen were not functional despite being detected by the system.
## Hardware Details
### Touchpad
- **Model**: ELAN901C
- **Type**: I2C HID device
- **ACPI Path**: ELAN901C:00
- **Modalias**: `acpi:ELAN901C:PNP0C50:`
- **I2C Bus**: i2c-3 (AMDI0010:00)
- **Sysfs Path**: `/sys/bus/i2c/devices/i2c-ELAN901C:00`
### Touchscreen
- **Model**: ELAN0678
- **Type**: I2C HID multitouch display
- **ACPI Path**: ELAN0678:00
- **Modalias**: `acpi:ELAN0678:PNP0C50:`
- **I2C Bus**: i2c-4 (AMDI0010:01)
- **Sysfs Path**: `/sys/bus/i2c/devices/i2c-ELAN0678:00`
## Root Cause Analysis
The kernel was missing **two critical configurations**:
1. **I2C HID ACPI binding support** (`CONFIG_I2C_HID_ACPI`) - Required for ACPI-based I2C HID devices
2. **AMD GPIO/Pinctrl support** (`CONFIG_PINCTRL_AMD`) - Required for GPIO interrupts on AMD platforms
### Original Kernel Configuration (First Issue)
```
CONFIG_I2C_HID=m
# CONFIG_I2C_HID_ACPI is not set ← Problem #1!
# CONFIG_I2C_HID_OF is not set
```
### Second Issue Discovered After First Reboot
```
# CONFIG_PINCTRL_AMD is not set ← Problem #2!
```
**Why both are needed:**
- `CONFIG_I2C_HID_ACPI`: Allows the i2c-hid driver to bind to ACPI devices (PNP0C50)
- `CONFIG_PINCTRL_AMD`: Provides GPIO support for interrupt handling on AMD platforms
Without PINCTRL_AMD, the i2c-hid-acpi driver would hang when trying to configure device interrupts.
### PNP0C50 Identifier
Both devices use `PNP0C50`, which is the ACPI HID (Hardware ID) for "HID over I2C" devices. This is a standard identifier for touchpads and touchscreens that communicate via I2C protocol using the HID standard.
## Solution
### Step 1: Enable I2C HID ACPI in Kernel Config
```bash
cd /usr/src/linux
sudo scripts/config --module I2C_HID_ACPI
# or: sudo sed -i 's/# CONFIG_I2C_HID_ACPI is not set/CONFIG_I2C_HID_ACPI=m/' .config
```
### Step 2: Enable AMD Pinctrl Support
**CRITICAL:** This must be built-in (=y), not a module, because it provides GPIO interrupt support needed early in boot.
```bash
cd /usr/src/linux
sudo scripts/config --enable PINCTRL_AMD
```
**Verification**:
```bash
grep "CONFIG_I2C_HID_ACPI\|CONFIG_PINCTRL_AMD" .config
# Should output:
# CONFIG_I2C_HID_ACPI=m
# CONFIG_PINCTRL_AMD=y
```
### Step 3: Rebuild Kernel
```bash
cd /usr/src/linux
sudo genkernel --makeopts=-j16 all
```
**Build History**:
- First rebuild: November 5, 2025 08:27 (added CONFIG_I2C_HID_ACPI)
- Second rebuild: November 5, 2025 09:44 (attempted PINCTRL_AMD)
- Final rebuild: November 5, 2025 ~10:00 (properly added CONFIG_PINCTRL_AMD=y)
**Important Notes**:
- Use `--no-mrproper` to preserve existing kernel config when doing incremental changes
- When enabling new options with dependencies, sometimes a full rebuild without `--no-mrproper` is needed
- `--makeopts=-j16`: Uses all 16 CPU threads for parallel compilation
### Step 4: Verify Build
```bash
# Check i2c-hid modules
find /lib/modules/6.12.41-gentoo-x86_64/ -name "*i2c*hid*.ko*"
# Verify PINCTRL_AMD is built-in (not a module)
zcat /proc/config.gz | grep PINCTRL_AMD
# Should show: CONFIG_PINCTRL_AMD=y (after reboot with new kernel)
```
**Expected modules**:
```
/lib/modules/6.12.41-gentoo-x86_64/kernel/drivers/hid/i2c-hid/i2c-hid.ko
/lib/modules/6.12.41-gentoo-x86_64/kernel/drivers/hid/i2c-hid/i2c-hid-acpi.ko
```
**Note**: PINCTRL_AMD won't appear as a .ko file because it's built-in to the kernel.
### Step 5: Create Kernel Backup
```bash
# Create timestamped backup of previous kernel
sudo cp /boot/vmlinuz-6.12.41-gentoo-x86_64.old /boot/vmlinuz-6.12.41-gentoo-x86_64.backup-20251105
sudo cp /boot/initramfs-6.12.41-gentoo-x86_64.img.old /boot/initramfs-6.12.41-gentoo-x86_64.img.backup-20251105
sudo cp /boot/System.map-6.12.41-gentoo-x86_64.old /boot/System.map-6.12.41-gentoo-x86_64.backup-20251105
```
### Step 6: Reboot (Required)
The new kernel and modules are in place:
- `/boot/vmlinuz-6.12.41-gentoo-x86_64` (Nov 5 ~10:00 - final build)
- `/boot/initramfs-6.12.41-gentoo-x86_64.img` (Nov 5 ~10:00)
No GRUB changes needed - GRUB already boots from these filenames.
## Post-Reboot Verification
### Check Module Loading
```bash
# Check if i2c-hid-acpi module is loaded
lsmod | grep i2c_hid
# Expected output:
# i2c_hid_acpi 16384 0
# i2c_hid 32768 1 i2c_hid_acpi
```
### Check Input Devices
```bash
# List all input devices
cat /proc/bus/input/devices
# Should now show ELAN901C touchpad and ELAN0678 touchscreen
```
### Check with libinput
```bash
# List all input devices recognized by libinput
libinput list-devices
# Should show both touchpad and touchscreen with capabilities
```
### Test Functionality
**Touchpad**:
- Single finger: Cursor movement
- Two finger scroll: Vertical/horizontal scrolling
- Two finger tap: Right click
- Palm rejection: Should ignore accidental touches
**Touchscreen**:
- Single touch: Cursor movement and click
- Multi-touch: Pinch to zoom, two-finger gestures
- Touch accuracy: Should be precise across entire display
## Auto-Load Configuration (If Needed)
If the module doesn't load automatically after reboot, create an auto-load config:
```bash
# Create module auto-load configuration
echo "i2c-hid-acpi" | sudo tee /etc/modules-load.d/i2c-hid.conf
# Verify
cat /etc/modules-load.d/i2c-hid.conf
```
## Troubleshooting
### Module Not Loading
```bash
# Try loading manually
sudo modprobe i2c-hid-acpi
# Check kernel messages
dmesg | grep -i "i2c.*hid\|elan"
```
### Devices Not Recognized
```bash
# Check if devices are still on I2C bus
ls -la /sys/bus/i2c/devices/ | grep ELAN
# Check device status
cat /sys/bus/i2c/devices/i2c-ELAN901C:00/uevent
cat /sys/bus/i2c/devices/i2c-ELAN0678:00/uevent
```
### Verify Kernel Config
```bash
# Check running kernel config
zcat /proc/config.gz | grep I2C_HID
# Should show:
# CONFIG_I2C_HID=m
# CONFIG_I2C_HID_ACPI=m
```
## Files Modified/Created
### Kernel Configuration
- `/usr/src/linux/.config` - Enabled CONFIG_I2C_HID_ACPI=m
### Kernel Files
- `/boot/vmlinuz-6.12.41-gentoo-x86_64` - New kernel (Nov 5 08:27)
- `/boot/initramfs-6.12.41-gentoo-x86_64.img` - New initramfs (Nov 5 08:41)
- `/boot/System.map-6.12.41-gentoo-x86_64` - New symbol map
### Backups
- `/boot/vmlinuz-6.12.41-gentoo-x86_64.old` - Automatic genkernel backup
- `/boot/vmlinuz-6.12.41-gentoo-x86_64.backup-20251105` - Manual backup
- Similar for initramfs and System.map
### Kernel Modules
- `/lib/modules/6.12.41-gentoo-x86_64/kernel/drivers/hid/i2c-hid/i2c-hid-acpi.ko` - New module
### Configuration (to be created if needed)
- `/etc/modules-load.d/i2c-hid.conf` - Auto-load configuration (if needed)
## Key Learnings
1. **I2C HID ACPI is Essential**: Modern laptops use I2C HID with ACPI binding for touchpads and touchscreens. Generic I2C HID support (`CONFIG_I2C_HID`) is not sufficient.
2. **PNP0C50 = HID over I2C**: The ACPI identifier `PNP0C50` is the standard ID for devices using the HID over I2C protocol.
3. **Module Dependencies**:
- `i2c-hid-acpi` depends on `i2c-hid`
- Both must be enabled for ACPI-based I2C HID devices to work
4. **Fast Incremental Rebuilds**: Using `--no-clean --no-mrproper` with genkernel allows for fast incremental rebuilds when only adding a single module.
5. **Device Detection vs Functionality**: Devices can appear on the I2C bus (`/sys/bus/i2c/devices/`) but remain non-functional without the proper driver module.
## References
- ACPI specification: PNP0C50 = HID over I2C Device
- Linux kernel: `drivers/hid/i2c-hid/`
- ELAN touchpad/touchscreen drivers: Built into i2c-hid-acpi module
## Status
**Current**: ✅ **WORKING** - Both touchpad and touchscreen fully functional!
**Verified**:
- Touchpad cursor movement and multi-finger gestures working
- Touchscreen touch and multitouch input working
- Modules load automatically (i2c-hid-acpi)
- CONFIG_PINCTRL_AMD=y enabled and functional
---
**Last Updated**: 2025-11-05 (Verified working after manual kernel compilation)