Compare commits

..

No commits in common. "master" and "fedora-ark" have entirely different histories.

96 changed files with 8740 additions and 10678 deletions

View file

@ -1,33 +0,0 @@
#!/usr/bin/env bash
set -euxo pipefail
if [ -z "${GITHUB_REPOSITORY_ID:-}" ]; then
echo "GITHUB_REPOSITORY_ID is unset!"
exit 1
fi
if [ -z "${GITHUB_WORKSPACE:-}" ]; then
echo "GITHUB_WORKSPACE is unset!"
exit 1
fi
IMAGE="${1:-}"
if [ -z "${IMAGE}" ]; then
echo "Container image is unset!"
exit 1
fi
if command -v docker &> /dev/null; then
DOCKER="docker"
elif command -v podman &> /dev/null; then
DOCKER="podman"
else
echo "Could not find docker / podman!"
exit 1
fi
exec "${DOCKER}" run -d --name "${GITHUB_REPOSITORY_ID}" \
-v "${GITHUB_WORKSPACE}:/working" --workdir "/working" \
--entrypoint "tail" "${IMAGE}" -f /dev/null

View file

@ -1,46 +0,0 @@
#!/usr/bin/env bash
set -euxo pipefail
if [ -z "${GITHUB_REPOSITORY_ID:-}" ]; then
echo "GITHUB_REPOSITORY_ID is unset!"
exit 1
fi
if [ -z "${1:-}" ]; then
echo "Arguments are unset!"
exit 1
fi
ENVVARS=()
COMMAND=()
while (( "${#}" )); do
case "$1" in
-e)
ENVVARS+=("-e")
shift
ENVVARS+=("$1")
shift
;;
--)
shift
while (( "${#}" )); do
COMMAND+=("$1")
shift
done
;;
esac
done
if command -v docker &> /dev/null; then
DOCKER="docker"
elif command -v podman &> /dev/null; then
DOCKER="podman"
else
echo "Could not find docker / podman!"
exit 1
fi
exec "${DOCKER}" exec "${ENVVARS[@]}" "${GITHUB_REPOSITORY_ID}" "${COMMAND[@]}"

View file

@ -1,77 +0,0 @@
#!/usr/bin/env bash
set -euxo pipefail
if [ -z "${1:-}" ]; then
$0 setup-builddeps
$0 setup-secureboot
$0 build-packages
$0 sign-packages
exit
fi
pacman()
{
command pacman --noconfirm "$@"
}
case "${1:-}" in
setup-builddeps)
# Update the container
pacman -Syu
# Install makepkg deps
pacman -S sudo binutils fakeroot base-devel git
# Install tools for singing the kernel for secureboot
pacman -S sbsigntools
;;
setup-secureboot)
if [ -z "${SB_KEY:-}" ]; then
echo "WARNING: No secureboot key configured, skipping signing."
exit
fi
# Install the surface secureboot certificate
echo "${SB_KEY}" | base64 -d > pkg/arch/kernel/MOK.key
cp pkg/keys/surface.crt pkg/arch/kernel/MOK.crt
;;
build-packages)
pushd pkg/arch/kernel || exit 1
# Fix permissions (can't makepkg as root)
echo "nobody ALL=(ALL) NOPASSWD: /usr/bin/pacman" >> /etc/sudoers
chown -R nobody .
# Package compression settings (Matches latest Arch)
export PKGEXT='.pkg.tar.zst'
export COMPRESSZST=(zstd -c -T0 --ultra -20 -)
export MAKEFLAGS="-j2"
# Build
su nobody --pty -p -s /bin/bash -c 'makepkg -sf --skippgpcheck --noconfirm'
# Prepare release
mkdir release
find . -name '*.pkg.tar.zst' -type f -print0 | xargs -0 -I '{}' mv {} release
popd || exit 1
;;
sign-packages)
if [ -z "${GPG_KEY:-}" ] || [ -z "${GPG_KEY_ID:-}" ]; then
echo "WARNING: No GPG key configured, skipping signing."
exit
fi
pushd pkg/arch/kernel/release || exit 1
# import GPG key
echo "${GPG_KEY}" | base64 -d | gpg --import --no-tty --batch --yes
# sign packages
find . -name '*.pkg.tar.zst' -type f -print0 | xargs -0 -I '{}' \
gpg --detach-sign --batch --no-tty -u "${GPG_KEY_ID}" {}
popd || exit 1
;;
esac

View file

@ -1,151 +0,0 @@
#!/usr/bin/env bash
set -euxo pipefail
if [ -z "${1:-}" ]; then
$0 setup-builddeps
$0 setup-secureboot
$0 build-packages
$0 sign-packages
exit
fi
apt-get()
{
command apt-get -y "$@"
}
MAINLINE_REPO="git://git.launchpad.net/~ubuntu-kernel-test/ubuntu/+source/linux/+git/mainline-crack"
MAINLINE_BRANCH="cod/mainline"
case "${1:-}" in
setup-builddeps)
SOURCES="$(sed 's/^deb /deb-src /' /etc/apt/sources.list)"
echo "${SOURCES}" >> /etc/apt/sources.list
ln -snf /usr/share/zoneinfo/UTC /etc/localtime
echo UTC > /etc/timezone
apt-get update
apt-get upgrade
apt-get install build-essential fakeroot rsync git wget software-properties-common \
zstd lz4 sbsigntool debhelper dpkg-dev dpkg-sig
apt-get build-dep linux
# install python 3.11, required for configuring the kernel via Ubuntu's annotation format
add-apt-repository -y ppa:deadsnakes
apt-get update
apt-get upgrade
apt-get install python3.11
rm -f /usr/bin/python
rm -f /usr/bin/python3
ln -s /usr/bin/python3.11 /usr/bin/python
ln -s /usr/bin/python3.11 /usr/bin/python3
;;
setup-secureboot)
if [ -z "${SB_KEY:-}" ]; then
echo "WARNING: No secureboot key configured, skipping signing."
exit
fi
mkdir -p pkg/debian/kernel/keys
# Install the surface secureboot certificate
echo "${SB_KEY}" | base64 -d > pkg/debian/kernel/keys/MOK.key
cp pkg/keys/surface.crt pkg/debian/kernel/keys/MOK.crt
;;
build-packages)
pushd pkg/debian/kernel || exit 1
. version.conf
# setup git
git config --global user.name "surfacebot"
git config --global user.email "surfacebot@users.noreply.github.com"
# get ubuntu mainline source
# see https://kernel.ubuntu.com/~kernel-ppa/mainline
git clone "${MAINLINE_REPO}" --branch "${MAINLINE_BRANCH}/v${KERNEL_VERSION}" --depth 1 linux
if [ -d "keys" ]; then
mv keys linux
fi
pushd linux || exit 1
# apply surface build/packaging patches
find .. -name '*.patch' -type f -print0 | sort -z | xargs -0 -I '{}' \
git apply --index --reject {}
git add .
git commit --allow-empty -m "Apply linux-surface packaging patches"
KERNEL_MAJORVER="${KERNEL_VERSION%.*}"
PATCHES="../../../../patches/${KERNEL_MAJORVER}"
# apply surface patches
find "${PATCHES}" -name '*.patch' -type f -print0 | sort -z | xargs -0 -I '{}' \
git apply --index --reject {}
git add .
git commit --allow-empty -m "Apply linux-surface patches"
# generate base config
./debian/scripts/misc/annotations --arch amd64 --flavour generic --export > ../base.config
# merge configs
./scripts/kconfig/merge_config.sh \
../base.config \
../ubuntu.config \
"../../../../configs/surface-${KERNEL_MAJORVER}.config"
# Explicitly set package version, including revision. This is picked up by 'make bindeb-pkg'.
export KDEB_PKGVERSION="${KERNEL_VERSION}${KERNEL_LOCALVERSION}-${KERNEL_REVISION}"
# The DPKG in Ubuntu 22.04 defaults to using ZSTD, which is not yet supported by the DPKG in Debian 11
export KDEB_COMPRESS="xz"
# Set kernel localversion
export LOCALVERSION="${KERNEL_LOCALVERSION}-${KERNEL_REVISION}"
make bindeb-pkg -j "$(nproc)"
popd || exit 1
popd || exit 1
pushd pkg/debian/meta || exit 1
./mkdebian.sh "$(make -C ../kernel/linux -s kernelrelease)"
dpkg-buildpackage -b -Zxz
popd || exit 1
pushd pkg/debian || exit 1
mkdir release
find . -name 'linux-libc-dev*.deb' -type f -print0 | xargs -0 -I '{}' rm {}
find . -name '*.deb' -type f -print0 | xargs -0 -I '{}' cp {} release
popd || exit 1
;;
sign-packages)
if [ -z "${GPG_KEY:-}" ] || [ -z "${GPG_KEY_ID:-}" ]; then
echo "WARNING: No GPG key configured, skipping signing."
exit
fi
pushd pkg/debian/release || exit 1
# import GPG key
echo "${GPG_KEY}" | base64 -d | gpg --import --no-tty --batch --yes
# sign packages
find . -name '*.deb' -type f -print0 | xargs -0 -I '{}' \
dpkg-sig -g "--batch --no-tty" --sign builder -k "${GPG_KEY_ID}" {}
popd || exit 1
;;
esac

View file

@ -1,76 +0,0 @@
#!/usr/bin/env bash
set -euxo pipefail
if [ -z "$1" ]; then
$0 setup-builddeps
$0 setup-secureboot
$0 build-packages
$0 sign-packages
exit
fi
dnf()
{
command dnf -y "$@"
}
case "$1" in
setup-builddeps)
# Setup build environment
dnf distro-sync
dnf install @rpm-development-tools git rpm-sign
# Install build dependencies
dnf builddep kernel
# Install additional build dependencies
dnf install sbsigntools
;;
setup-secureboot)
if [ -z "${SB_KEY:-}" ]; then
echo "WARNING: No secureboot key configured, skipping signing."
exit
fi
# Install the surface secureboot certificate
echo "${SB_KEY}" | base64 -d > pkg/fedora/kernel-surface/secureboot/MOK.key
cp pkg/keys/surface.crt pkg/fedora/kernel-surface/secureboot/MOK.crt
;;
build-packages)
pushd pkg/fedora/kernel-surface || exit 1
# setup git
git config --global user.name "surfacebot"
git config --global user.email "surfacebot@users.noreply.github.com"
# Build source RPM packages
python3 build-linux-surface.py --mode srpm --ark-dir kernel-ark --outdir srpm
# Remove the kernel-ark tree to get as much free disk space as possible
rm -rf kernel-ark
# Build binary RPM packages
find srpm -name '*.src.rpm' -type f -print0 | xargs -0 -I '{}' \
rpmbuild -rb --define "_topdir ${PWD}/rpmbuild" --define "_rpmdir ${PWD}/out" {}
popd || exit 1
;;
sign-packages)
if [ -z "${GPG_KEY:-}" ] || [ -z "${GPG_KEY_ID:-}" ]; then
echo "WARNING: No GPG key configured, skipping signing."
exit
fi
pushd pkg/fedora/kernel-surface/out/x86_64 || exit 1
# import GPG key
echo "${GPG_KEY}" | base64 -d | gpg --import --no-tty --batch --yes
# sign packages
find . -name '*.rpm' -type f -print0 | xargs -0 -I '{}' \
rpm --resign {} --define "_gpg_name ${GPG_KEY_ID}"
popd || exit 1
;;
esac

View file

@ -1,66 +0,0 @@
#!/usr/bin/env bash
set -euxo pipefail
pacman()
{
command pacman --noconfirm "$@"
}
if [ -z "${GIT_REF:-}" ]; then
echo "GIT_REF is unset!"
exit 1
fi
if [ -z "${GITHUB_REPOSITORY:-}" ]; then
echo "GITHUB_REPOSITORY is unset!"
exit 1
fi
if [ -z "${SURFACEBOT_TOKEN:-}" ]; then
echo "SURFACEBOT_TOKEN is unset!"
exit 1
fi
if [ -z "${BRANCH_STAGING:-}" ]; then
echo "BRANCH_STAGING is unset!"
exit 1
fi
REPONAME="$(echo "${GITHUB_REPOSITORY}" | cut -d'/' -f2)"
REPO="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
# parse git tag from ref
GIT_TAG="${GIT_REF#refs/tags/}"
# Install dependencies
pacman -Syu
pacman -S base-devel git openssl
# clone package repository
git clone -b "${BRANCH_STAGING}" "${REPO}" repo
# copy packages
find arch-latest -type f -print0 | xargs -0 -I '{}' cp {} repo/arch
pushd repo/arch || exit 1
# convert packages into references
while read -rd $'\n' FILE; do
echo "${REPONAME}:${GIT_TAG}/$(basename "${FILE}")" > "${FILE}.blob"
rm "${FILE}"
done <<< "$(find . -name '*.pkg.tar.zst')"
RAND="$(openssl rand -hex 16)"
BRANCH="${BRANCH_STAGING}-${RAND}"
# set git identity
git config --global user.name "surfacebot"
git config --global user.email "surfacebot@users.noreply.github.com"
# commit and push
git checkout -b "${BRANCH}"
git add .
git commit -m "Update Arch Linux ${REPONAME} package"
git push --set-upstream origin "${BRANCH}"
popd || exit 1

View file

@ -1,66 +0,0 @@
#!/usr/bin/env bash
set -euxo pipefail
apt-get()
{
command apt-get -y "$@"
}
if [ -z "${GIT_REF:-}" ]; then
echo "GIT_REF is unset!"
exit 1
fi
if [ -z "${GITHUB_REPOSITORY:-}" ]; then
echo "GITHUB_REPOSITORY is unset!"
exit 1
fi
if [ -z "${SURFACEBOT_TOKEN:-}" ]; then
echo "SURFACEBOT_TOKEN is unset!"
exit 1
fi
if [ -z "${BRANCH_STAGING:-}" ]; then
echo "BRANCH_STAGING is unset!"
exit 1
fi
REPONAME="$(echo "${GITHUB_REPOSITORY}" | cut -d'/' -f2)"
REPO="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
# parse git tag from ref
GIT_TAG="${GIT_REF#refs/tags/}"
# Install dependencies
apt-get update
apt-get install git openssl
# clone package repository
git clone -b "${BRANCH_STAGING}" "${REPO}" repo
# copy packages
find debian-latest -type f -print0 | xargs -0 -I '{}' cp {} repo/debian
pushd repo/debian || exit 1
# convert packages into references
while read -rd $'\n' FILE; do
echo "${REPONAME}:${GIT_TAG}/$(basename "${FILE}")" > "${FILE}.blob"
rm "${FILE}"
done <<< "$(find . -name '*.deb')"
RAND="$(openssl rand -hex 16)"
BRANCH="${BRANCH_STAGING}-${RAND}"
# set git identity
git config --global user.name "surfacebot"
git config --global user.email "surfacebot@users.noreply.github.com"
# commit and push
git checkout -b "${BRANCH}"
git add .
git commit -m "Update Debian ${REPONAME} package"
git push --set-upstream origin "${BRANCH}"
popd || exit 1

View file

@ -1,72 +0,0 @@
#!/usr/bin/env bash
set -euxo pipefail
dnf()
{
command dnf -y "$@"
}
if [ -z "${GIT_REF:-}" ]; then
echo "GIT_REF is unset!"
exit 1
fi
if [ -z "${GITHUB_REPOSITORY:-}" ]; then
echo "GITHUB_REPOSITORY is unset!"
exit 1
fi
if [ -z "${SURFACEBOT_TOKEN:-}" ]; then
echo "SURFACEBOT_TOKEN is unset!"
exit 1
fi
if [ -z "${BRANCH_STAGING:-}" ]; then
echo "BRANCH_STAGING is unset!"
exit 1
fi
FEDORA="${1:-}"
if [ -z "${FEDORA}" ]; then
echo "Fedora version is unset!"
exit 1
fi
REPONAME="$(echo "${GITHUB_REPOSITORY}" | cut -d'/' -f2)"
REPO="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
# parse git tag from ref
GIT_TAG="${GIT_REF#refs/tags/}"
# Install dependencies
dnf install git findutils openssl
# clone package repository
git clone -b "${BRANCH_STAGING}" "${REPO}" repo
# copy packages
find "fedora-${FEDORA}-latest" -type f -print0 | xargs -0 -I '{}' cp {} "repo/fedora/f${FEDORA}"
pushd "repo/fedora/f${FEDORA}" || exit 1
# convert packages into references
while read -rd $'\n' FILE; do
echo "${REPONAME}:${GIT_TAG}/$(basename "${FILE}")" > "${FILE}.blob"
rm "${FILE}"
done <<< "$(find . -name '*.rpm' -type f)"
RAND="$(openssl rand -hex 16)"
BRANCH="${BRANCH_STAGING}-${RAND}"
# set git identity
git config --global user.name "surfacebot"
git config --global user.email "surfacebot@users.noreply.github.com"
# commit and push
git checkout -b "${BRANCH}"
git add .
git commit -m "Update Fedora ${FEDORA} ${REPONAME} package"
git push --set-upstream origin "${BRANCH}"
popd || exit 1

View file

@ -1,124 +1,146 @@
name: Arch
env:
GPG_KEY_ID: 56C464BAAC421453
on:
push:
tags:
- 'arch-*'
repository_dispatch:
workflow_dispatch:
name: Arch
env:
GPG_KEY_ID: 56C464BAAC421453
jobs:
build:
name: Build Kernel
runs-on: ubuntu-latest
container: archlinux
steps:
- name: Maximize disk space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 5120
remove-dotnet: true
remove-android: true
remove-docker-images: true
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3
- name: Install build dependencies
run: |
# Install makepkg deps
pacman -Syu --noconfirm
pacman -S --noconfirm sudo binutils fakeroot grep base-devel git sbsigntools libffi python
- name: Initialize containers
run: |
bash ./.github/scripts/container/create.sh \
archlinux
- name: Setup secureboot certificate
env:
SB_KEY: ${{ secrets.SURFACE_SB_KEY }}
run: |
cd pkg
- name: Install build dependencies
run: |
bash ./.github/scripts/container/exec.sh \
-- \
bash ./.github/scripts/package/arch.sh setup-builddeps
# Install the surface secureboot certificate
echo "$SB_KEY" | base64 -d > arch/kernel/MOK.key
cp keys/surface.crt arch/kernel/MOK.crt
- name: Setup secureboot certificate
env:
SB_KEY: ${{ secrets.SURFACE_SB_KEY }}
run: |
bash ./.github/scripts/container/exec.sh \
-e SB_KEY \
-- \
bash ./.github/scripts/package/arch.sh setup-secureboot
- name: Build
run: |
cd pkg/arch/kernel
- name: Build packages
run: |
bash ./.github/scripts/container/exec.sh \
-- \
bash ./.github/scripts/package/arch.sh build-packages
# Fix permissions (can't makepkg as root)
echo "nobody ALL=(ALL) NOPASSWD: /usr/bin/pacman" >> /etc/sudoers
chown -R nobody .
- name: Sign packages
env:
GPG_KEY: ${{ secrets.LINUX_SURFACE_GPG_KEY }}
run: |
bash ./.github/scripts/container/exec.sh \
-e GPG_KEY \
-e GPG_KEY_ID \
-- \
bash ./.github/scripts/package/arch.sh sign-packages
# Package compression settings (Matches latest Arch)
export PKGEXT='.pkg.tar.zst'
export COMPRESSZST=(zstd -c -T0 --ultra -20 -)
export MAKEFLAGS="-j2"
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: arch-latest
path: pkg/arch/kernel/release
# Build
su nobody --pty -p -s /bin/bash -c 'makepkg -f --syncdeps --skippgpcheck --noconfirm'
- name: Prepare release
run: |
mkdir release
mv pkg/arch/kernel/*.pkg.tar.zst release
- name: Sign packages
env:
GPG_KEY: ${{ secrets.LINUX_SURFACE_GPG_KEY }}
run: |
cd release
# import GPG key
echo "$GPG_KEY" | base64 -d | gpg --import --no-tty --batch --yes
export GPG_TTY=$(tty)
# sign packages
ls *.pkg.tar.zst | xargs -L1 gpg --detach-sign --batch --no-tty -u $GPG_KEY_ID
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: arch-latest
path: release
release:
name: Publish release
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: arch-latest
path: arch-latest
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: arch-latest
path: arch-latest
- name: Upload assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
file: ./*-latest/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Upload assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
file: ./*-latest/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
repo:
name: Update package repository
needs: [release]
runs-on: ubuntu-latest
container: archlinux
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install dependencies
run: |
pacman -Syu --noconfirm
pacman -S --noconfirm base-devel git
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: arch-latest
path: arch-latest
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: arch-latest
path: arch-latest
- name: Initialize containers
run: |
bash ./.github/scripts/container/create.sh \
archlinux
- name: Update repository
env:
SURFACEBOT_TOKEN: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
BRANCH_STAGING: u/staging
GIT_REF: ${{ github.ref }}
run: |
repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
- name: Update repository
env:
SURFACEBOT_TOKEN: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
GIT_REF: ${{ github.ref }}
BRANCH_STAGING: u/staging
run: |
bash ./.github/scripts/container/exec.sh \
-e SURFACEBOT_TOKEN \
-e GIT_REF \
-e BRANCH_STAGING \
-e GITHUB_REPOSITORY \
-- \
bash ./.github/scripts/repository/arch.sh
# clone package repository
git clone -b "${BRANCH_STAGING}" "${repo}" repo
# copy packages
cp arch-latest/* repo/arch/
cd repo/arch
# parse git tag from ref
GIT_TAG=$(echo $GIT_REF | sed 's|^refs/tags/||g')
# convert packages into references
for pkg in $(find . -name '*.pkg.tar.zst'); do
echo "linux-surface:$GIT_TAG/$(basename $pkg)" > $pkg.blob
rm $pkg
done
# set git identity
git config --global user.email "surfacebot@users.noreply.github.com"
git config --global user.name "surfacebot"
# commit and push
update_branch="${BRANCH_STAGING}-$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
git switch -c "${update_branch}"
git add .
git commit -m "Update Arch Linux kernel"
git push --set-upstream origin "${update_branch}"

View file

@ -1,124 +1,221 @@
name: Debian
env:
GPG_KEY_ID: 56C464BAAC421453
on:
push:
tags:
- 'debian-*'
repository_dispatch:
workflow_dispatch:
name: Debian
env:
GPG_KEY_ID: 56C464BAAC421453
KERNEL_VERSION: 6.3.4
KERNEL_REVISION: 1
LOCALVERSION: -surface
MAINLINE_REPO: git://git.launchpad.net/~ubuntu-kernel-test/ubuntu/+source/linux/+git/mainline-crack
MAINLINE_BRANCH: cod/mainline
TZ: UTC
jobs:
build:
name: Build Kernel
runs-on: ubuntu-latest
container: ubuntu:20.04
steps:
- name: Maximize disk space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 5120
remove-dotnet: true
remove-android: true
remove-docker-images: true
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3
- name: Install build dependencies
run: |
sed 's/^deb /deb-src /' /etc/apt/sources.list >> /etc/apt/sources.list
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
echo $TZ > /etc/timezone
apt-get -y update
apt-get -y upgrade
apt-get -y install build-essential fakeroot rsync git wget software-properties-common \
zstd lz4 sbsigntool debhelper dpkg-dev dpkg-sig
apt-get -y build-dep linux
- name: Initialize containers
run: |
bash ./.github/scripts/container/create.sh \
ubuntu:20.04
- name: Install Python 3.11
run: |
# install python 3.11, required for configuring the kernel via Ubuntu's annotation format
add-apt-repository -y ppa:deadsnakes
- name: Install build dependencies
run: |
bash ./.github/scripts/container/exec.sh \
-- \
bash ./.github/scripts/package/debian.sh setup-builddeps
apt-get -y update
apt-get -y upgrade
- name: Setup secureboot certificate
env:
SB_KEY: ${{ secrets.SURFACE_SB_KEY }}
run: |
bash ./.github/scripts/container/exec.sh \
-e SB_KEY \
-- \
bash ./.github/scripts/package/debian.sh setup-secureboot
apt-get -y install python3.11
- name: Build packages
run: |
bash ./.github/scripts/container/exec.sh \
-- \
bash ./.github/scripts/package/debian.sh build-packages
rm -f /usr/bin/python
rm -f /usr/bin/python3
ln -s /usr/bin/python3.11 /usr/bin/python
ln -s /usr/bin/python3.11 /usr/bin/python3
- name: Sign packages
env:
GPG_KEY: ${{ secrets.LINUX_SURFACE_GPG_KEY }}
run: |
bash ./.github/scripts/container/exec.sh \
-e GPG_KEY \
-e GPG_KEY_ID \
-- \
bash ./.github/scripts/package/debian.sh sign-packages
- name: Prepare kernel source
run: |
cd pkg/debian/kernel
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: debian-latest
path: pkg/debian/release
# setup git
git config --global user.email "surfacebot@users.noreply.github.com"
git config --global user.name "surfacebot"
# get ubuntu mainline source
# see https://kernel.ubuntu.com/~kernel-ppa/mainline
git clone "$MAINLINE_REPO" --branch "$MAINLINE_BRANCH/v$KERNEL_VERSION" --depth 1 linux
cd linux
# apply surface build/packaging patches
for PATCH in ../*.patch; do
git apply --index --reject ${PATCH}
done
git add .
git commit --allow-empty -m "Apply linux-surface packaging patches"
# apply surface patches
for PATCH in ../../../../patches/${KERNEL_VERSION%.*}/*.patch; do
git apply --index --reject ${PATCH}
done
git add .
git commit --allow-empty -m "Apply linux-surface patches"
- name: Configure
run: |
cd pkg/debian/kernel/linux
# generate base config
./debian/scripts/misc/annotations --arch amd64 --flavour generic --export > ../base.config
# merge configs
./scripts/kconfig/merge_config.sh \
../base.config \
../ubuntu.config \
../../../../configs/surface-${KERNEL_VERSION%.*}.config
- name: Setup secureboot certificate
env:
SB_KEY: ${{ secrets.SURFACE_SB_KEY }}
run: |
cd pkg
mkdir -p debian/kernel/linux/keys
# unlock/copy key and certificate
echo "$SB_KEY" | base64 -d > debian/kernel/linux/keys/MOK.key
cp keys/surface.crt debian/kernel/linux/keys/MOK.crt
- name: Build kernel
env:
# The DPKG in Ubuntu 22.04 defaults to using ZSTD,
# which is not yet supported by the DPKG in Debian 11
KDEB_COMPRESS: xz
run: |
cd pkg/debian/kernel/linux
# Explicitly set package version, including revision. This is picked up
# by 'make bindeb-pkg'.
export KDEB_PKGVERSION="${KERNEL_VERSION}${LOCALVERSION}-${KERNEL_REVISION}"
make bindeb-pkg -j2
- name: Build meta-package
run: |
cd pkg/debian/meta
./mkdebian.sh $(make -C ../kernel/linux -s kernelrelease) ${KERNEL_REVISION}
dpkg-buildpackage -b -Zxz
- name: Prepare release
run: |
mkdir release
rm pkg/debian/kernel/linux-libc-dev*.deb
mv pkg/debian/kernel/*.deb release
mv pkg/debian/*.deb release
- name: Sign packages
env:
GPG_KEY: ${{ secrets.LINUX_SURFACE_GPG_KEY }}
run: |
# import GPG key
echo "$GPG_KEY" | base64 -d | gpg --import --no-tty --batch --yes
export GPG_TTY=$(tty)
# sign package
dpkg-sig -g "--batch --no-tty" --sign builder -k $GPG_KEY_ID release/*.deb
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: debian-latest
path: release
release:
name: Publish release
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: debian-latest
path: debian-latest
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: debian-latest
path: debian-latest
- name: Upload assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
file: ./*-latest/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Upload assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
file: ./*-latest/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
repo:
name: Update package repository
needs: [release]
runs-on: ubuntu-latest
container: debian:sid
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install dependencies
run: |
apt-get update
apt-get install -y git
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: debian-latest
path: debian-latest
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: debian-latest
path: debian-latest
- name: Initialize containers
run: |
bash ./.github/scripts/container/create.sh \
debian:sid
- name: Update repository
env:
SURFACEBOT_TOKEN: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
BRANCH_STAGING: u/staging
GIT_REF: ${{ github.ref }}
run: |
repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
- name: Update repository
env:
SURFACEBOT_TOKEN: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
GIT_REF: ${{ github.ref }}
BRANCH_STAGING: u/staging
run: |
bash ./.github/scripts/container/exec.sh \
-e SURFACEBOT_TOKEN \
-e GIT_REF \
-e BRANCH_STAGING \
-e GITHUB_REPOSITORY \
-- \
bash ./.github/scripts/repository/debian.sh
# clone package repository
git clone -b "${BRANCH_STAGING}" "${repo}" repo
# copy packages
cp debian-latest/* repo/debian/
cd repo/debian
# parse git tag from ref
GIT_TAG=$(echo $GIT_REF | sed 's|^refs/tags/||g')
# convert packages into references
for pkg in $(find . -name '*.deb'); do
echo "linux-surface:$GIT_TAG/$(basename $pkg)" > $pkg.blob
rm $pkg
done
# set git identity
git config --global user.email "surfacebot@users.noreply.github.com"
git config --global user.name "surfacebot"
# commit and push
update_branch="${BRANCH_STAGING}-$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
git switch -c "${update_branch}"
git add .
git commit -m "Update Debian kernel"
git push --set-upstream origin "${update_branch}"

138
.github/workflows/fedora-37.yml vendored Normal file
View file

@ -0,0 +1,138 @@
on:
push:
tags:
- 'fedora-37-*'
name: Fedora 37
env:
GPG_KEY_ID: 56C464BAAC421453
jobs:
build:
name: Build Kernel
runs-on: ubuntu-latest
container: registry.fedoraproject.org/fedora:37
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install build dependencies
run: |
dnf distro-sync -y
dnf install -y git make gcc flex bison bzip2 rpm-build
dnf install -y rpmdevtools rpm-sign 'dnf-command(builddep)'
# Install build dependencies
dnf builddep -y kernel
# Install additional build dependencies
dnf install -y sbsigntools
- name: Setup secureboot certificate
env:
SB_KEY: ${{ secrets.SURFACE_SB_KEY }}
run: |
# Install the surface secureboot certificate
echo "$SB_KEY" | base64 -d > pkg/fedora/kernel-surface/secureboot/MOK.key
cp pkg/keys/surface.crt pkg/fedora/kernel-surface/secureboot/MOK.crt
- name: Build packages
run: |
cd pkg/fedora/kernel-surface
# setup git
git config --global user.email "surfacebot@users.noreply.github.com"
git config --global user.name "surfacebot"
# Build the .rpm packages
python3 build-linux-surface.py
- name: Sign packages
env:
GPG_KEY: ${{ secrets.LINUX_SURFACE_GPG_KEY }}
run: |
cd pkg/fedora/kernel-surface/out/x86_64
# import GPG key
echo "$GPG_KEY" | base64 -d | gpg --import --no-tty --batch --yes
# sign packages
rpm --resign *.rpm --define "_gpg_name $GPG_KEY_ID"
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: fedora-37-latest
path: pkg/fedora/kernel-surface/out/x86_64
release:
name: Publish release
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: fedora-37-latest
path: fedora-37-latest
- name: Upload assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
file: ./*-latest/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
repo:
name: Update package repository
needs: [release]
runs-on: ubuntu-latest
container: registry.fedoraproject.org/fedora:37
steps:
- name: Install dependencies
run: |
dnf install -y git findutils
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: fedora-37-latest
path: fedora-37-latest
- name: Update repository
env:
SURFACEBOT_TOKEN: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
BRANCH_STAGING: u/staging
GIT_REF: ${{ github.ref }}
run: |
repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
# clone package repository
git clone -b "${BRANCH_STAGING}" "${repo}" repo
# copy packages
cp fedora-37-latest/* repo/fedora/f37
cd repo/fedora/f37
# parse git tag from ref
GIT_TAG=$(echo $GIT_REF | sed 's|^refs/tags/||g')
# convert packages into references
for pkg in $(find . -name '*.rpm'); do
echo "linux-surface:$GIT_TAG/$(basename $pkg)" > $pkg.blob
rm $pkg
done
# set git identity
git config --global user.email "surfacebot@users.noreply.github.com"
git config --global user.name "surfacebot"
# commit and push
update_branch="${BRANCH_STAGING}-$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
git checkout -b "${update_branch}"
git add .
git commit -m "Update Fedora 37 kernel"
git push --set-upstream origin "${update_branch}"

View file

@ -1,125 +1,138 @@
name: Fedora 38
env:
FEDORA: 38
GPG_KEY_ID: 56C464BAAC421453
on:
push:
tags:
- 'fedora-38-*'
repository_dispatch:
workflow_dispatch:
name: Fedora 38
env:
GPG_KEY_ID: 56C464BAAC421453
jobs:
build:
name: Build Kernel
runs-on: ubuntu-latest
container: registry.fedoraproject.org/fedora:38
steps:
- name: Maximize disk space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 5120
remove-dotnet: true
remove-android: true
remove-docker-images: true
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3
- name: Install build dependencies
run: |
dnf distro-sync -y
dnf install -y git make gcc flex bison bzip2 rpm-build
dnf install -y rpmdevtools rpm-sign 'dnf-command(builddep)'
- name: Initialize containers
run: |
bash ./.github/scripts/container/create.sh \
registry.fedoraproject.org/fedora:${{ env.FEDORA }}
# Install build dependencies
dnf builddep -y kernel
- name: Install build dependencies
run: |
bash ./.github/scripts/container/exec.sh \
-- \
bash ./.github/scripts/package/fedora.sh setup-builddeps
# Install additional build dependencies
dnf install -y sbsigntools
- name: Setup secureboot certificate
env:
SB_KEY: ${{ secrets.SURFACE_SB_KEY }}
run: |
bash ./.github/scripts/container/exec.sh \
-e SB_KEY \
-- \
bash ./.github/scripts/package/fedora.sh setup-secureboot
- name: Setup secureboot certificate
env:
SB_KEY: ${{ secrets.SURFACE_SB_KEY }}
run: |
# Install the surface secureboot certificate
echo "$SB_KEY" | base64 -d > pkg/fedora/kernel-surface/secureboot/MOK.key
cp pkg/keys/surface.crt pkg/fedora/kernel-surface/secureboot/MOK.crt
- name: Build packages
run: |
bash ./.github/scripts/container/exec.sh \
-- \
bash ./.github/scripts/package/fedora.sh build-packages
- name: Build packages
run: |
cd pkg/fedora/kernel-surface
- name: Sign packages
env:
GPG_KEY: ${{ secrets.LINUX_SURFACE_GPG_KEY }}
run: |
bash ./.github/scripts/container/exec.sh \
-e GPG_KEY \
-e GPG_KEY_ID \
-- \
bash ./.github/scripts/package/fedora.sh sign-packages
# setup git
git config --global user.email "surfacebot@users.noreply.github.com"
git config --global user.name "surfacebot"
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: fedora-${{ env.FEDORA }}-latest
path: pkg/fedora/kernel-surface/out/x86_64
# Build the .rpm packages
python3 build-linux-surface.py
- name: Sign packages
env:
GPG_KEY: ${{ secrets.LINUX_SURFACE_GPG_KEY }}
run: |
cd pkg/fedora/kernel-surface/out/x86_64
# import GPG key
echo "$GPG_KEY" | base64 -d | gpg --import --no-tty --batch --yes
# sign packages
rpm --resign *.rpm --define "_gpg_name $GPG_KEY_ID"
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: fedora-38-latest
path: pkg/fedora/kernel-surface/out/x86_64
release:
name: Publish release
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: fedora-${{ env.FEDORA }}-latest
path: fedora-${{ env.FEDORA }}-latest
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: fedora-38-latest
path: fedora-38-latest
- name: Upload assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
file: ./*-latest/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Upload assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
file: ./*-latest/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
repo:
name: Update package repository
needs: [release]
runs-on: ubuntu-latest
container: registry.fedoraproject.org/fedora:38
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install dependencies
run: |
dnf install -y git findutils
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: fedora-${{ env.FEDORA }}-latest
path: fedora-${{ env.FEDORA }}-latest
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: fedora-38-latest
path: fedora-38-latest
- name: Initialize containers
run: |
bash ./.github/scripts/container/create.sh \
registry.fedoraproject.org/fedora:${{ env.FEDORA }}
- name: Update repository
env:
SURFACEBOT_TOKEN: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
BRANCH_STAGING: u/staging
GIT_REF: ${{ github.ref }}
run: |
repo="https://surfacebot:${SURFACEBOT_TOKEN}@github.com/linux-surface/repo.git"
- name: Update repository
env:
SURFACEBOT_TOKEN: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
GIT_REF: ${{ github.ref }}
BRANCH_STAGING: u/staging
run: |
bash ./.github/scripts/container/exec.sh \
-e SURFACEBOT_TOKEN \
-e GIT_REF \
-e BRANCH_STAGING \
-e GITHUB_REPOSITORY \
-- \
bash ./.github/scripts/repository/fedora.sh ${{ env.FEDORA }}
# clone package repository
git clone -b "${BRANCH_STAGING}" "${repo}" repo
# copy packages
cp fedora-38-latest/* repo/fedora/f38
cd repo/fedora/f38
# parse git tag from ref
GIT_TAG=$(echo $GIT_REF | sed 's|^refs/tags/||g')
# convert packages into references
for pkg in $(find . -name '*.rpm'); do
echo "linux-surface:$GIT_TAG/$(basename $pkg)" > $pkg.blob
rm $pkg
done
# set git identity
git config --global user.email "surfacebot@users.noreply.github.com"
git config --global user.name "surfacebot"
# commit and push
update_branch="${BRANCH_STAGING}-$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
git checkout -b "${update_branch}"
git add .
git commit -m "Update Fedora 38 kernel"
git push --set-upstream origin "${update_branch}"

View file

@ -1,125 +0,0 @@
name: Fedora 39
env:
FEDORA: 39
GPG_KEY_ID: 56C464BAAC421453
on:
push:
tags:
- 'fedora-39-*'
repository_dispatch:
workflow_dispatch:
jobs:
build:
name: Build Kernel
runs-on: ubuntu-latest
steps:
- name: Maximize disk space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 5120
remove-dotnet: true
remove-android: true
remove-docker-images: true
- name: Checkout code
uses: actions/checkout@v3
- name: Initialize containers
run: |
bash ./.github/scripts/container/create.sh \
registry.fedoraproject.org/fedora:${{ env.FEDORA }}
- name: Install build dependencies
run: |
bash ./.github/scripts/container/exec.sh \
-- \
bash ./.github/scripts/package/fedora.sh setup-builddeps
- name: Setup secureboot certificate
env:
SB_KEY: ${{ secrets.SURFACE_SB_KEY }}
run: |
bash ./.github/scripts/container/exec.sh \
-e SB_KEY \
-- \
bash ./.github/scripts/package/fedora.sh setup-secureboot
- name: Build packages
run: |
bash ./.github/scripts/container/exec.sh \
-- \
bash ./.github/scripts/package/fedora.sh build-packages
- name: Sign packages
env:
GPG_KEY: ${{ secrets.LINUX_SURFACE_GPG_KEY }}
run: |
bash ./.github/scripts/container/exec.sh \
-e GPG_KEY \
-e GPG_KEY_ID \
-- \
bash ./.github/scripts/package/fedora.sh sign-packages
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: fedora-${{ env.FEDORA }}-latest
path: pkg/fedora/kernel-surface/out/x86_64
release:
name: Publish release
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: fedora-${{ env.FEDORA }}-latest
path: fedora-${{ env.FEDORA }}-latest
- name: Upload assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
file: ./*-latest/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
repo:
name: Update package repository
needs: [release]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: fedora-${{ env.FEDORA }}-latest
path: fedora-${{ env.FEDORA }}-latest
- name: Initialize containers
run: |
bash ./.github/scripts/container/create.sh \
registry.fedoraproject.org/fedora:${{ env.FEDORA }}
- name: Update repository
env:
SURFACEBOT_TOKEN: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
GIT_REF: ${{ github.ref }}
BRANCH_STAGING: u/staging
run: |
bash ./.github/scripts/container/exec.sh \
-e SURFACEBOT_TOKEN \
-e GIT_REF \
-e BRANCH_STAGING \
-e GITHUB_REPOSITORY \
-- \
bash ./.github/scripts/repository/fedora.sh ${{ env.FEDORA }}

View file

@ -1,125 +0,0 @@
name: Fedora 40
env:
FEDORA: 40
GPG_KEY_ID: 56C464BAAC421453
on:
push:
tags:
- 'fedora-40-*'
repository_dispatch:
workflow_dispatch:
jobs:
build:
name: Build Kernel
runs-on: ubuntu-latest
steps:
- name: Maximize disk space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 5120
remove-dotnet: true
remove-android: true
remove-docker-images: true
- name: Checkout code
uses: actions/checkout@v3
- name: Initialize containers
run: |
bash ./.github/scripts/container/create.sh \
registry.fedoraproject.org/fedora:${{ env.FEDORA }}
- name: Install build dependencies
run: |
bash ./.github/scripts/container/exec.sh \
-- \
bash ./.github/scripts/package/fedora.sh setup-builddeps
- name: Setup secureboot certificate
env:
SB_KEY: ${{ secrets.SURFACE_SB_KEY }}
run: |
bash ./.github/scripts/container/exec.sh \
-e SB_KEY \
-- \
bash ./.github/scripts/package/fedora.sh setup-secureboot
- name: Build packages
run: |
bash ./.github/scripts/container/exec.sh \
-- \
bash ./.github/scripts/package/fedora.sh build-packages
- name: Sign packages
env:
GPG_KEY: ${{ secrets.LINUX_SURFACE_GPG_KEY }}
run: |
bash ./.github/scripts/container/exec.sh \
-e GPG_KEY \
-e GPG_KEY_ID \
-- \
bash ./.github/scripts/package/fedora.sh sign-packages
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: fedora-${{ env.FEDORA }}-latest
path: pkg/fedora/kernel-surface/out/x86_64
release:
name: Publish release
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: fedora-${{ env.FEDORA }}-latest
path: fedora-${{ env.FEDORA }}-latest
- name: Upload assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
file: ./*-latest/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
repo:
name: Update package repository
needs: [release]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: fedora-${{ env.FEDORA }}-latest
path: fedora-${{ env.FEDORA }}-latest
- name: Initialize containers
run: |
bash ./.github/scripts/container/create.sh \
registry.fedoraproject.org/fedora:${{ env.FEDORA }}
- name: Update repository
env:
SURFACEBOT_TOKEN: ${{ secrets.LINUX_SURFACE_BOT_TOKEN }}
GIT_REF: ${{ github.ref }}
BRANCH_STAGING: u/staging
run: |
bash ./.github/scripts/container/exec.sh \
-e SURFACEBOT_TOKEN \
-e GIT_REF \
-e BRANCH_STAGING \
-e GITHUB_REPOSITORY \
-- \
bash ./.github/scripts/repository/fedora.sh ${{ env.FEDORA }}

View file

@ -5,34 +5,6 @@ Follow the instructions below to install the latest kernel.
[Announcements and Updates](https://github.com/linux-surface/linux-surface/issues/96) | [Upstream Status](https://github.com/linux-surface/linux-surface/issues/205)
### Why / About this Project
These days, Linux supports a lot of devices out-of-the-box.
As a matter of fact, this includes a good portion of the Microsoft Surface devices—for most parts at least.
So why would you need a special kernel for Surface devices?
In short, for the parts that are not supported upstream yet.
Unfortunately, Surface devices tend to be a bit special.
This is mostly because some hardware choices Microsoft made are rarely (if at all) used by other, more "standard", devices.
For example:
- Surface devices (4th generation and later) use their own embedded controller (the Surface Aggregator Module, or SAM).
In contrast to other devices, however, some newer Surface devices route their keyboard and touchpad input via this controller.
Unfortunately, every new Surface device requires some (usually small) patch to enable support for it, since devices managed by SAM are generally not auto-discoverable.
- Surface devices (4th generation and later, excluding the Go series) use a rather special system for touch and pen input.
In short, this requires user-space processing of touch and pen data to enable multitouch support and has not been upstreamed yet.
- Surface devices rely on Intel's ISP for camera image processing.
This means that the webcam also requires some user-space processing.
While patches are being upstreamed, not all devices are supported (even with this project), and more work remains to be done.
We aim to send all the changes we make here upstream, but this may take time.
This kernel allows us to ship new features faster, as we do not have to adhere to the upstream release schedule (and, for better or worse, code standards).
We also rely on it to test and prototype patches before sending them upstream, which is crucial because we maintainers cannot test on all Surface devices (which also means we may break things along the way).
_So should you install this custom kernel and the associated packages?_
It depends: We generally recommend you try your standard distribution kernel first.
If that works well for you, great!
But if you're missing any features or experiencing issues, take a look at our [feature matrix](https://github.com/linux-surface/linux-surface/wiki/Supported-Devices-and-Features#feature-matrix) and give our kernel and packages a try.
If your device is not listed as supported yet, feel free to open an issue.
### Supported Devices
@ -51,7 +23,6 @@ If your device is not listed as supported yet, feel free to open an issue.
* Surface Laptop Go
* Surface Laptop Go 2
* Surface Laptop Studio
* Surface Pro 1
* Surface Pro 3
* Surface Pro 4
* Surface Pro (5th Gen) / Surface Pro 2017
@ -96,6 +67,7 @@ If you have questions or need support, please join our [Matrix Space][matrix-spa
This space contains
- a [support channel][matrix-support] for general support and
- a [development channel][matrix-development] for all development related questions and discussions.
If you prefer IRC, you can also join in via our channel at [`libera.chat/#linux-surface`][liberachat], to which the matrix room is bridged to.
## License
This repository contains patches, which are either derivative work targeting a specific already licensed source, i.e. parts of the Linux kernel, or introduce new parts to the Linux kernel.
@ -111,6 +83,7 @@ License texts can be obtained at https://github.com/torvalds/linux/tree/master/L
[matrix-space]: https://matrix.to/#/#linux-surface:matrix.org
[matrix-support]: https://matrix.to/#/#linux-surface-support:matrix.org
[matrix-development]: https://matrix.to/#/#linux-surface-development:matrix.org
[liberachat]: https://web.libera.chat/#linux-surface
[hibernate-setup]: https://fitzcarraldoblog.wordpress.com/2018/07/14/configuring-lubuntu-18-04-to-enable-hibernation-using-a-swap-file
[releases]: https://github.com/linux-surface/linux-surface/releases

View file

@ -19,9 +19,6 @@ CONFIG_SURFACE_KBD=m
CONFIG_BATTERY_SURFACE=m
CONFIG_CHARGER_SURFACE=m
CONFIG_SENSORS_SURFACE_TEMP=m
CONFIG_SENSORS_SURFACE_FAN=m
##
## Surface Hotplug
##
@ -42,11 +39,10 @@ CONFIG_HID_ITHC=m
CONFIG_VIDEO_DW9719=m
CONFIG_VIDEO_IPU3_IMGU=m
CONFIG_VIDEO_IPU3_CIO2=m
CONFIG_IPU_BRIDGE=m
CONFIG_CIO2_BRIDGE=y
CONFIG_INTEL_SKL_INT3472=m
CONFIG_REGULATOR_TPS68470=m
CONFIG_COMMON_CLK_TPS68470=m
CONFIG_LEDS_TPS68470=m
##
## Cameras: Sensor drivers
@ -65,6 +61,11 @@ CONFIG_VIDEO_OV8865=m
##
CONFIG_APDS9960=m
##
## For Intel Thread Director (Alder-Lake)
##
CONFIG_IPC_CLASSES=y
##
## Other Drivers
##

View file

@ -19,9 +19,6 @@ CONFIG_SURFACE_KBD=m
CONFIG_BATTERY_SURFACE=m
CONFIG_CHARGER_SURFACE=m
CONFIG_SENSORS_SURFACE_TEMP=m
CONFIG_SENSORS_SURFACE_FAN=m
##
## Surface Hotplug
##
@ -42,7 +39,7 @@ CONFIG_HID_ITHC=m
CONFIG_VIDEO_DW9719=m
CONFIG_VIDEO_IPU3_IMGU=m
CONFIG_VIDEO_IPU3_CIO2=m
CONFIG_IPU_BRIDGE=m
CONFIG_CIO2_BRIDGE=y
CONFIG_INTEL_SKL_INT3472=m
CONFIG_REGULATOR_TPS68470=m
CONFIG_COMMON_CLK_TPS68470=m
@ -65,6 +62,11 @@ CONFIG_VIDEO_OV8865=m
##
CONFIG_APDS9960=m
##
## For Intel Thread Director (Alder-Lake)
##
CONFIG_IPC_CLASSES=y
##
## Other Drivers
##

View file

@ -1,6 +1,6 @@
# One-shot automatic screen rotation
There are many scripts around (you can find some [here](https://gist.github.com/mildmojo/48e9025070a2ba40795c), where this script was published first), which rotate the screen automatically. Many desktop environment have this feature built in, but if you like a one-shot automatic rotation facility, this is for you.
There are many scripts around (you can find some [here](https://gist.github.com/mildmojo/48e9025070a2ba40795c, where this script was published first)), which rotate the screen automatically. Many desktop environment have this feature built in, but if you like a one-shot automatic rotation facility, this is for you.
## Motivation

View file

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ThermalConfiguration>
<Platform>
<Name>Intel Powered Laptop</Name>
<ProductName>*</ProductName>
<Preference>QUIET</Preference>
<ThermalZones>
<ThermalZone>
<Type>cpu</Type>
<TripPoints>
<TripPoint>
<SensorType>x86_pkg_temp</SensorType>
<Temperature>65000</Temperature>
<type>passive</type>
<ControlType>SEQUENTIAL</ControlType>
<CoolingDevice>
<index>1</index>
<type>intel_pstate</type>
<influence>100</influence>
<SamplingPeriod>10</SamplingPeriod>
</CoolingDevice>
</TripPoint>
</TripPoints>
</ThermalZone>
</ThermalZones>
</Platform>
</ThermalConfiguration>

View file

@ -1,11 +0,0 @@
# Using thermald to avoid thermal throttling
1. Install `thermald` for your distro, on many distros it might be installed by default
2. Copy the `thermal-conf.xml` file into the `/etc/thermald/` directory
3. Depending on your ambient temperature you might want to lower the `<Temperature>` line to make thermald kick in more aggressively. (65000 = 65°C)
4. Copy the `thermal-cpu-cdev-order.xml` file into the `/etc/thermald/` directory
5. Run `sudo systemctl restart thermald`
# Making Fedora respect your config files
Fedora uses the `--adaptive` option by default, thus ignoring your config files. This might also apply to some other distros.
Edit `/usr/lib/systemd/system/thermald.service` and remove `--adaptive` from the `ExecStart=` line. Then do a `systemctl daemon-reload` so systemd realizes the change. Thermald should then respect your configuration files.

View file

@ -1,27 +0,0 @@
<?xml version="1.0"?>
<ThermalConfiguration>
<Platform>
<Name>Surface Pro 7 Thermal Workaround</Name>
<ProductName>*</ProductName>
<Preference>QUIET</Preference>
<ThermalZones>
<ThermalZone>
<Type>cpu</Type>
<TripPoints>
<TripPoint>
<SensorType>x86_pkg_temp</SensorType>
<Temperature>65000</Temperature>
<type>passive</type>
<ControlType>SEQUENTIAL</ControlType>
<CoolingDevice>
<index>1</index>
<type>rapl_controller</type>
<influence>100</influence>
<SamplingPeriod>10</SamplingPeriod>
</CoolingDevice>
</TripPoint>
</TripPoints>
</ThermalZone>
</ThermalZones>
</Platform>
</ThermalConfiguration>

View file

@ -1,18 +0,0 @@
<!--
Specifies the order of compensation to cool CPU only.
There is a default already implemented in the code, but
this file can be used to change order
The Following cooling device can present
-->
<CoolingDeviceOrder>
<!-- Specify Cooling device order -->
<CoolingDevice>rapl_controller</CoolingDevice>
<CoolingDevice>intel_pstate</CoolingDevice>
<CoolingDevice>intel_powerclamp</CoolingDevice>
<CoolingDevice>cpufreq</CoolingDevice>
<CoolingDevice>Processor</CoolingDevice>
</CoolingDeviceOrder>

View file

@ -1,4 +1,4 @@
From d82f678f3ab57bc30a52237389693b1084ac1e49 Mon Sep 17 00:00:00 2001
From b062a358226ff93e073cf1af2b04fa38011b12fe Mon Sep 17 00:00:00 2001
From: Tsuchiya Yuto <kitakar@gmail.com>
Date: Sun, 18 Oct 2020 16:42:44 +0900
Subject: [PATCH] (surface3-oemb) add DMI matches for Surface 3 with broken DMI
@ -58,10 +58,10 @@ index ca4602bcc7de..490b9731068a 100644
{ }
};
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 7938b52d741d..2d5f83b0cdb0 100644
index 620ecbfa4a7a..b07d06d2971a 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3746,6 +3746,15 @@ static const struct dmi_system_id dmi_platform_data[] = {
@@ -3717,6 +3717,15 @@ static const struct dmi_system_id dmi_platform_data[] = {
},
.driver_data = (void *)&intel_braswell_platform_data,
},
@ -78,7 +78,7 @@ index 7938b52d741d..2d5f83b0cdb0 100644
/*
* Match for the GPDwin which unfortunately uses somewhat
diff --git a/sound/soc/intel/common/soc-acpi-intel-cht-match.c b/sound/soc/intel/common/soc-acpi-intel-cht-match.c
index 5e2ec60e2954..207868c699f2 100644
index 6beb00858c33..d82d77387a0a 100644
--- a/sound/soc/intel/common/soc-acpi-intel-cht-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-cht-match.c
@@ -27,6 +27,14 @@ static const struct dmi_system_id cht_table[] = {
@ -97,5 +97,5 @@ index 5e2ec60e2954..207868c699f2 100644
};
--
2.44.0
2.40.1

View file

@ -1,4 +1,4 @@
From 2c7ff35a85341dcd8fa2ea575088881df9dea874 Mon Sep 17 00:00:00 2001
From 6098a9e7f7d9437908d780c0555d2c54c2618dab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
Date: Tue, 3 Nov 2020 13:28:04 +0100
Subject: [PATCH] mwifiex: Add quirk resetting the PCI bridge on MS Surface
@ -32,11 +32,11 @@ Patchset: mwifiex
3 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index 5f997becdbaa..9a9929424513 100644
index 9a698a16a8f3..14687342bc81 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -1702,9 +1702,21 @@ mwifiex_pcie_send_boot_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb)
static void mwifiex_pcie_init_fw_port(struct mwifiex_adapter *adapter)
@@ -1762,9 +1762,21 @@ mwifiex_pcie_send_boot_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb)
static int mwifiex_pcie_init_fw_port(struct mwifiex_adapter *adapter)
{
struct pcie_service_card *card = adapter->card;
+ struct pci_dev *pdev = card->dev;
@ -55,8 +55,8 @@ index 5f997becdbaa..9a9929424513 100644
+ pci_reset_function(parent_pdev);
+
/* Write the RX ring read pointer in to reg->rx_rdptr */
mwifiex_write_reg(adapter, reg->rx_rdptr, card->rxbd_rdptr | tx_wrap);
}
if (mwifiex_write_reg(adapter, reg->rx_rdptr, card->rxbd_rdptr |
tx_wrap)) {
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c b/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c
index dd6d21f1dbfd..f46b06f8d643 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c
@ -163,9 +163,9 @@ index d6ff964aec5b..5d30ae39d65e 100644
void mwifiex_initialize_quirks(struct pcie_service_card *card);
int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev);
--
2.44.0
2.40.1
From 4a326d9e87d1dc4945903560d3d22fbd69a8962c Mon Sep 17 00:00:00 2001
From a6c3d424052350efb88aa02d5486b6f9bd4172d3 Mon Sep 17 00:00:00 2001
From: Tsuchiya Yuto <kitakar@gmail.com>
Date: Sun, 4 Oct 2020 00:11:49 +0900
Subject: [PATCH] mwifiex: pcie: disable bridge_d3 for Surface gen4+
@ -187,10 +187,10 @@ Patchset: mwifiex
3 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index 9a9929424513..2273e3029776 100644
index 14687342bc81..5e1a341f63df 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -377,6 +377,7 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
@@ -368,6 +368,7 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
struct pcie_service_card *card;
@ -198,7 +198,7 @@ index 9a9929424513..2273e3029776 100644
int ret;
pr_debug("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n",
@@ -418,6 +419,12 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
@@ -409,6 +410,12 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
return -1;
}
@ -318,9 +318,9 @@ index 5d30ae39d65e..c14eb56eb911 100644
void mwifiex_initialize_quirks(struct pcie_service_card *card);
int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev);
--
2.44.0
2.40.1
From dddda6f9c25716dea1265f71b8286936afa192b5 Mon Sep 17 00:00:00 2001
From 7d40421c8e49ba19f095be2773a2133feaa061fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
Date: Thu, 25 Mar 2021 11:33:02 +0100
Subject: [PATCH] Bluetooth: btusb: Lower passive lescan interval on Marvell
@ -356,10 +356,10 @@ Patchset: mwifiex
1 file changed, 15 insertions(+)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index d31edad7a056..fc08e0c51c87 100644
index faad19b396d5..cc7bb57c4f90 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -65,6 +65,7 @@ static struct usb_driver btusb_driver;
@@ -64,6 +64,7 @@ static struct usb_driver btusb_driver;
#define BTUSB_INTEL_BROKEN_INITIAL_NCMD BIT(25)
#define BTUSB_INTEL_NO_WBS_SUPPORT BIT(26)
#define BTUSB_ACTIONS_SEMI BIT(27)
@ -367,7 +367,7 @@ index d31edad7a056..fc08e0c51c87 100644
static const struct usb_device_id btusb_table[] = {
/* Generic Bluetooth USB device */
@@ -468,6 +469,7 @@ static const struct usb_device_id quirks_table[] = {
@@ -467,6 +468,7 @@ static const struct usb_device_id blacklist_table[] = {
{ USB_DEVICE(0x1286, 0x2044), .driver_info = BTUSB_MARVELL },
{ USB_DEVICE(0x1286, 0x2046), .driver_info = BTUSB_MARVELL },
{ USB_DEVICE(0x1286, 0x204e), .driver_info = BTUSB_MARVELL },
@ -375,7 +375,7 @@ index d31edad7a056..fc08e0c51c87 100644
/* Intel Bluetooth devices */
{ USB_DEVICE(0x8087, 0x0025), .driver_info = BTUSB_INTEL_COMBINED },
@@ -4401,6 +4403,19 @@ static int btusb_probe(struct usb_interface *intf,
@@ -3950,6 +3952,19 @@ static int btusb_probe(struct usb_interface *intf,
if (id->driver_info & BTUSB_MARVELL)
hdev->set_bdaddr = btusb_set_bdaddr_marvell;
@ -396,5 +396,5 @@ index d31edad7a056..fc08e0c51c87 100644
(id->driver_info & BTUSB_MEDIATEK)) {
hdev->setup = btusb_mtk_setup;
--
2.44.0
2.40.1

View file

@ -1,4 +1,4 @@
From d1f0488a3591ea31a8f493ad8cd3feb79e2338b8 Mon Sep 17 00:00:00 2001
From eb669c8c09afdc098857e69996e70bb8e6eaa264 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 27 Feb 2021 00:45:52 +0100
Subject: [PATCH] ath10k: Add module parameters to override board files
@ -20,7 +20,7 @@ Patchset: ath10k
1 file changed, 58 insertions(+)
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 6cdb225b7eac..19c036751fb1 100644
index 5eb131ab916f..67f074a126d1 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -38,6 +38,9 @@ static bool fw_diag_log;
@ -117,5 +117,5 @@ index 6cdb225b7eac..19c036751fb1 100644
ret = firmware_request_nowarn(&fw, filename, ar->dev);
ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot fw request '%s': %d\n",
--
2.44.0
2.40.1

File diff suppressed because it is too large Load diff

1433
patches/6.1/0005-ithc.patch Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
From ed9c386e94b695909ed806887188e127e99e7140 Mon Sep 17 00:00:00 2001
From 8d667f7302921a2941ded0dd79c0ceb48327fbe0 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 25 Jul 2020 17:19:53 +0200
Subject: [PATCH] i2c: acpi: Implement RawBytes read access
@ -55,10 +55,10 @@ Patchset: surface-sam-over-hid
1 file changed, 35 insertions(+)
diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c
index d6037a328669..a290ebc77aea 100644
index 4dd777cc0c89..b2338618163a 100644
--- a/drivers/i2c/i2c-core-acpi.c
+++ b/drivers/i2c/i2c-core-acpi.c
@@ -628,6 +628,28 @@ static int acpi_gsb_i2c_write_bytes(struct i2c_client *client,
@@ -639,6 +639,28 @@ static int acpi_gsb_i2c_write_bytes(struct i2c_client *client,
return (ret == 1) ? 0 : -EIO;
}
@ -87,7 +87,7 @@ index d6037a328669..a290ebc77aea 100644
static acpi_status
i2c_acpi_space_handler(u32 function, acpi_physical_address command,
u32 bits, u64 *value64,
@@ -729,6 +751,19 @@ i2c_acpi_space_handler(u32 function, acpi_physical_address command,
@@ -740,6 +762,19 @@ i2c_acpi_space_handler(u32 function, acpi_physical_address command,
}
break;
@ -108,9 +108,9 @@ index d6037a328669..a290ebc77aea 100644
dev_warn(&adapter->dev, "protocol 0x%02x not supported for client 0x%02x\n",
accessor_type, client->addr);
--
2.44.0
2.40.1
From 09df61b1ed72eb879aeb7b8091606299bc61fdd6 Mon Sep 17 00:00:00 2001
From 21924fb67904eeba63c6ffc69b4927a522d77c8b Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 13 Feb 2021 16:41:18 +0100
Subject: [PATCH] platform/surface: Add driver for Surface Book 1 dGPU switch
@ -331,5 +331,5 @@ index 000000000000..8b816ed8f35c
+MODULE_DESCRIPTION("Discrete GPU Power-Switch for Surface Book 1");
+MODULE_LICENSE("GPL");
--
2.44.0
2.40.1

View file

@ -1,4 +1,4 @@
From c57b5f294df0367dd1411c050654e1f03470f776 Mon Sep 17 00:00:00 2001
From b2ff68b36382b24556f2fa76e93ab6cf137fe079 Mon Sep 17 00:00:00 2001
From: Sachi King <nakato@nakato.io>
Date: Tue, 5 Oct 2021 00:05:09 +1100
Subject: [PATCH] Input: soc_button_array - support AMD variant Surface devices
@ -20,10 +20,10 @@ Patchset: surface-button
1 file changed, 8 insertions(+), 25 deletions(-)
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
index 9116f4248fd0..eba53cb0139e 100644
index 09489380afda..0f02411a60f1 100644
--- a/drivers/input/misc/soc_button_array.c
+++ b/drivers/input/misc/soc_button_array.c
@@ -542,8 +542,8 @@ static const struct soc_device_data soc_device_MSHW0028 = {
@@ -507,8 +507,8 @@ static const struct soc_device_data soc_device_MSHW0028 = {
* Both, the Surface Pro 4 (surfacepro3_button.c) and the above mentioned
* devices use MSHW0040 for power and volume buttons, however the way they
* have to be addressed differs. Make sure that we only load this drivers
@ -34,7 +34,7 @@ index 9116f4248fd0..eba53cb0139e 100644
*/
#define MSHW0040_DSM_REVISION 0x01
#define MSHW0040_DSM_GET_OMPR 0x02 // get OEM Platform Revision
@@ -554,31 +554,14 @@ static const guid_t MSHW0040_DSM_UUID =
@@ -519,31 +519,14 @@ static const guid_t MSHW0040_DSM_UUID =
static int soc_device_check_MSHW0040(struct device *dev)
{
acpi_handle handle = ACPI_HANDLE(dev);
@ -73,9 +73,9 @@ index 9116f4248fd0..eba53cb0139e 100644
/*
--
2.44.0
2.40.1
From 41a632737f84b0404c1faca01edb90aecc9378ee Mon Sep 17 00:00:00 2001
From e74a226ff06a157120645ef0d0b8d40c218b3d04 Mon Sep 17 00:00:00 2001
From: Sachi King <nakato@nakato.io>
Date: Tue, 5 Oct 2021 00:22:57 +1100
Subject: [PATCH] platform/surface: surfacepro3_button: don't load on amd
@ -96,7 +96,7 @@ Patchset: surface-button
1 file changed, 6 insertions(+), 24 deletions(-)
diff --git a/drivers/platform/surface/surfacepro3_button.c b/drivers/platform/surface/surfacepro3_button.c
index 2755601f979c..4240c98ca226 100644
index 242fb690dcaf..30eea54dbb47 100644
--- a/drivers/platform/surface/surfacepro3_button.c
+++ b/drivers/platform/surface/surfacepro3_button.c
@@ -149,7 +149,8 @@ static int surface_button_resume(struct device *dev)
@ -145,5 +145,5 @@ index 2755601f979c..4240c98ca226 100644
--
2.44.0
2.40.1

View file

@ -1,4 +1,4 @@
From 278a4a551b60ef874cde389c7b83a07655f5cda6 Mon Sep 17 00:00:00 2001
From 13974a5ec1b064248ffea9995298dadeaf4d939e Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 18 Feb 2023 01:02:49 +0100
Subject: [PATCH] USB: quirks: Add USB_QUIRK_DELAY_INIT for Surface Go 3
@ -23,7 +23,7 @@ Patchset: surface-typecover
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 15e9bd180a1d..0d70461d01e1 100644
index 934b3d997702..2c6604c6e8e1 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -220,6 +220,9 @@ static const struct usb_device_id usb_quirk_list[] = {
@ -37,9 +37,9 @@ index 15e9bd180a1d..0d70461d01e1 100644
{ USB_DEVICE(0x046a, 0x0023), .driver_info = USB_QUIRK_RESET_RESUME },
--
2.44.0
2.40.1
From 350edff5f5c90d811ff0686f95dd7f5222ee3d8d Mon Sep 17 00:00:00 2001
From bc79d7356a5adbb862c2b65d2cdc713e3fd6aea2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
Date: Thu, 5 Nov 2020 13:09:45 +0100
Subject: [PATCH] hid/multitouch: Turn off Type Cover keyboard backlight when
@ -75,7 +75,7 @@ Patchset: surface-typecover
1 file changed, 98 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 5ec1f174127a..a7a12b56f79c 100644
index e31be0cb8b85..63fd042aba6b 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -34,7 +34,10 @@
@ -147,7 +147,7 @@ index 5ec1f174127a..a7a12b56f79c 100644
{ }
};
@@ -1721,6 +1741,69 @@ static void mt_expired_timeout(struct timer_list *t)
@@ -1728,6 +1748,69 @@ static void mt_expired_timeout(struct timer_list *t)
clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags);
}
@ -217,7 +217,7 @@ index 5ec1f174127a..a7a12b56f79c 100644
static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
int ret, i;
@@ -1744,6 +1827,9 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
@@ -1751,6 +1834,9 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
td->inputmode_value = MT_INPUTMODE_TOUCHSCREEN;
hid_set_drvdata(hdev, td);
@ -227,7 +227,7 @@ index 5ec1f174127a..a7a12b56f79c 100644
INIT_LIST_HEAD(&td->applications);
INIT_LIST_HEAD(&td->reports);
@@ -1782,15 +1868,19 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
@@ -1789,15 +1875,19 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
timer_setup(&td->release_timer, mt_expired_timeout, 0);
ret = hid_parse(hdev);
@ -249,7 +249,7 @@ index 5ec1f174127a..a7a12b56f79c 100644
ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group);
if (ret)
@@ -1842,6 +1932,7 @@ static void mt_remove(struct hid_device *hdev)
@@ -1849,6 +1939,7 @@ static void mt_remove(struct hid_device *hdev)
{
struct mt_device *td = hid_get_drvdata(hdev);
@ -257,7 +257,7 @@ index 5ec1f174127a..a7a12b56f79c 100644
del_timer_sync(&td->release_timer);
sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group);
@@ -2228,6 +2319,11 @@ static const struct hid_device_id mt_devices[] = {
@@ -2226,6 +2317,11 @@ static const struct hid_device_id mt_devices[] = {
MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
USB_DEVICE_ID_XIROKU_CSR2) },
@ -270,9 +270,9 @@ index 5ec1f174127a..a7a12b56f79c 100644
{ .driver_data = MT_CLS_GOOGLE,
HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_GOOGLE,
--
2.44.0
2.40.1
From 29e073fd0ed75ce3f28b49a4fd34358104a3fd13 Mon Sep 17 00:00:00 2001
From d65c4f23ce20f7a73e614bb43b08600e4bc3cea6 Mon Sep 17 00:00:00 2001
From: PJungkamp <p.jungkamp@gmail.com>
Date: Fri, 25 Feb 2022 12:04:25 +0100
Subject: [PATCH] hid/multitouch: Add support for surface pro type cover tablet
@ -301,7 +301,7 @@ Patchset: surface-typecover
1 file changed, 122 insertions(+), 26 deletions(-)
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index a7a12b56f79c..d4ac41f2f9a8 100644
index 63fd042aba6b..508a250ff4bf 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -77,6 +77,7 @@ MODULE_LICENSE("GPL");
@ -454,7 +454,7 @@ index a7a12b56f79c..d4ac41f2f9a8 100644
static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
{
struct mt_device *td = hid_get_drvdata(hdev);
@@ -1659,6 +1741,13 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
@@ -1660,6 +1742,13 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
/* force BTN_STYLUS to allow tablet matching in udev */
__set_bit(BTN_STYLUS, hi->input->keybit);
break;
@ -468,7 +468,7 @@ index a7a12b56f79c..d4ac41f2f9a8 100644
default:
suffix = "UNKNOWN";
break;
@@ -1741,30 +1830,6 @@ static void mt_expired_timeout(struct timer_list *t)
@@ -1748,30 +1837,6 @@ static void mt_expired_timeout(struct timer_list *t)
clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags);
}
@ -499,7 +499,7 @@ index a7a12b56f79c..d4ac41f2f9a8 100644
static void update_keyboard_backlight(struct hid_device *hdev, bool enabled)
{
struct usb_device *udev = hid_to_usb_dev(hdev);
@@ -1773,8 +1838,9 @@ static void update_keyboard_backlight(struct hid_device *hdev, bool enabled)
@@ -1780,8 +1845,9 @@ static void update_keyboard_backlight(struct hid_device *hdev, bool enabled)
/* Wake up the device in case it's already suspended */
pm_runtime_get_sync(&udev->dev);
@ -511,7 +511,7 @@ index a7a12b56f79c..d4ac41f2f9a8 100644
hid_err(hdev, "couldn't find backlight field\n");
goto out;
}
@@ -1909,13 +1975,24 @@ static int mt_suspend(struct hid_device *hdev, pm_message_t state)
@@ -1916,13 +1982,24 @@ static int mt_suspend(struct hid_device *hdev, pm_message_t state)
static int mt_reset_resume(struct hid_device *hdev)
{
@ -536,7 +536,7 @@ index a7a12b56f79c..d4ac41f2f9a8 100644
/* Some Elan legacy devices require SET_IDLE to be set on resume.
* It should be safe to send it to other devices too.
* Tested on 3M, Stantum, Cypress, Zytronic, eGalax, and Elan panels. */
@@ -1924,6 +2001,10 @@ static int mt_resume(struct hid_device *hdev)
@@ -1931,6 +2008,10 @@ static int mt_resume(struct hid_device *hdev)
mt_set_modes(hdev, HID_LATENCY_NORMAL, true, true);
@ -547,7 +547,7 @@ index a7a12b56f79c..d4ac41f2f9a8 100644
return 0;
}
#endif
@@ -1931,6 +2012,21 @@ static int mt_resume(struct hid_device *hdev)
@@ -1938,6 +2019,21 @@ static int mt_resume(struct hid_device *hdev)
static void mt_remove(struct hid_device *hdev)
{
struct mt_device *td = hid_get_drvdata(hdev);
@ -570,5 +570,5 @@ index a7a12b56f79c..d4ac41f2f9a8 100644
unregister_pm_notifier(&td->pm_notifier);
del_timer_sync(&td->release_timer);
--
2.44.0
2.40.1

View file

@ -1,4 +1,4 @@
From aa49dc59b192cc038ca789ac70215d7492f043cb Mon Sep 17 00:00:00 2001
From 7fa1affcf27e00e5b6a785a501839b240716c60f Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sun, 19 Feb 2023 22:12:24 +0100
Subject: [PATCH] PCI: Add quirk to prevent calling shutdown mehtod
@ -23,7 +23,7 @@ Patchset: surface-shutdown
3 files changed, 40 insertions(+)
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 51ec9e7e784f..40554890d721 100644
index f47a3b10bf50..9ea4352aac56 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -507,6 +507,9 @@ static void pci_device_shutdown(struct device *dev)
@ -37,13 +37,13 @@ index 51ec9e7e784f..40554890d721 100644
if (drv && drv->shutdown)
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index d797df6e5f3e..c674ee496a0b 100644
index 8d32a3834688..3ebeaf296886 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -6250,3 +6250,39 @@ static void pci_fixup_d3cold_delay_1sec(struct pci_dev *pdev)
pdev->d3cold_delay = 1000;
}
DECLARE_PCI_FIXUP_FINAL(0x5555, 0x0004, pci_fixup_d3cold_delay_1sec);
@@ -6028,3 +6028,39 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9a2d, dpc_log_size);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9a2f, dpc_log_size);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9a31, dpc_log_size);
#endif
+
+static const struct dmi_system_id no_shutdown_dmi_table[] = {
+ /*
@ -81,17 +81,17 @@ index d797df6e5f3e..c674ee496a0b 100644
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x466d, quirk_no_shutdown); // Thunderbolt 4 NHI
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x46a8, quirk_no_shutdown); // GPU
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7ab0d13672da..8d8d9225e0db 100644
index d20695184e0b..e0d4ff7f154a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -465,6 +465,7 @@ struct pci_dev {
@@ -462,6 +462,7 @@ struct pci_dev {
unsigned int no_vf_scan:1; /* Don't scan for VFs after IOV enablement */
unsigned int no_command_memory:1; /* No PCI_COMMAND_MEMORY */
unsigned int rom_bar_overlap:1; /* ROM BAR disable broken */
unsigned int rom_attr_enabled:1; /* Display of ROM attribute enabled? */
+ unsigned int no_shutdown:1; /* Do not touch device on shutdown */
pci_dev_flags_t dev_flags;
atomic_t enable_cnt; /* pci_enable_device has been called */
--
2.44.0
2.40.1

View file

@ -1,4 +1,4 @@
From 2d4cd827e3fc8aec6dee8da356eda809152d34ce Mon Sep 17 00:00:00 2001
From 47c5c233ac5228afb49fc6be6f1f313bc717f5cb Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sun, 12 Mar 2023 01:41:57 +0100
Subject: [PATCH] platform/surface: gpe: Add support for Surface Pro 9
@ -47,5 +47,5 @@ index c219b840d491..69c4352e8406 100644
.ident = "Surface Book 1",
.matches = {
--
2.44.0
2.40.1

View file

@ -0,0 +1,977 @@
From 88cf252dde1ff3aa4d1c7e6431fa80a409ecaeaf Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 10 Oct 2021 20:56:57 +0200
Subject: [PATCH] ACPI: delay enumeration of devices with a _DEP pointing to an
INT3472 device
The clk and regulator frameworks expect clk/regulator consumer-devices
to have info about the consumed clks/regulators described in the device's
fw_node.
To work around cases where this info is not present in the firmware tables,
which is often the case on x86/ACPI devices, both frameworks allow the
provider-driver to attach info about consumers to the clks/regulators
when registering these.
This causes problems with the probe ordering wrt drivers for consumers
of these clks/regulators. Since the lookups are only registered when the
provider-driver binds, trying to get these clks/regulators before then
results in a -ENOENT error for clks and a dummy regulator for regulators.
One case where we hit this issue is camera sensors such as e.g. the OV8865
sensor found on the Microsoft Surface Go. The sensor uses clks, regulators
and GPIOs provided by a TPS68470 PMIC which is described in an INT3472
ACPI device. There is special platform code handling this and setting
platform_data with the necessary consumer info on the MFD cells
instantiated for the PMIC under: drivers/platform/x86/intel/int3472.
For this to work properly the ov8865 driver must not bind to the I2C-client
for the OV8865 sensor until after the TPS68470 PMIC gpio, regulator and
clk MFD cells have all been fully setup.
The OV8865 on the Microsoft Surface Go is just one example, all X86
devices using the Intel IPU3 camera block found on recent Intel SoCs
have similar issues where there is an INT3472 HID ACPI-device, which
describes the clks and regulators, and the driver for this INT3472 device
must be fully initialized before the sensor driver (any sensor driver)
binds for things to work properly.
On these devices the ACPI nodes describing the sensors all have a _DEP
dependency on the matching INT3472 ACPI device (there is one per sensor).
This allows solving the probe-ordering problem by delaying the enumeration
(instantiation of the I2C-client in the ov8865 example) of ACPI-devices
which have a _DEP dependency on an INT3472 device.
The new acpi_dev_ready_for_enumeration() helper used for this is also
exported because for devices, which have the enumeration_by_parent flag
set, the parent-driver will do its own scan of child ACPI devices and
it will try to enumerate those during its probe(). Code doing this such
as e.g. the i2c-core-acpi.c code must call this new helper to ensure
that it too delays the enumeration until all the _DEP dependencies are
met on devices which have the new honor_deps flag set.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Patchset: cameras
---
drivers/acpi/scan.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index dbfa58e799e2..ccbd3f8b523e 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -2106,6 +2106,9 @@ static acpi_status acpi_bus_check_add_2(acpi_handle handle, u32 lvl_not_used,
static void acpi_default_enumeration(struct acpi_device *device)
{
+ if (!acpi_dev_ready_for_enumeration(device))
+ return;
+
/*
* Do not enumerate devices with enumeration_by_parent flag set as
* they will be enumerated by their respective parents.
--
2.40.1
From fd72e98abb6f8d39801212014074b5f6721e9ff4 Mon Sep 17 00:00:00 2001
From: zouxiaoh <xiaohong.zou@intel.com>
Date: Fri, 25 Jun 2021 08:52:59 +0800
Subject: [PATCH] iommu: intel-ipu: use IOMMU passthrough mode for Intel IPUs
Intel IPU(Image Processing Unit) has its own (IO)MMU hardware,
The IPU driver allocates its own page table that is not mapped
via the DMA, and thus the Intel IOMMU driver blocks access giving
this error: DMAR: DRHD: handling fault status reg 3 DMAR:
[DMA Read] Request device [00:05.0] PASID ffffffff
fault addr 76406000 [fault reason 06] PTE Read access is not set
As IPU is not an external facing device which is not risky, so use
IOMMU passthrough mode for Intel IPUs.
Change-Id: I6dcccdadac308cf42e20a18e1b593381391e3e6b
Depends-On: Iacd67578e8c6a9b9ac73285f52b4081b72fb68a6
Tracked-On: #JIITL8-411
Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: zouxiaoh <xiaohong.zou@intel.com>
Signed-off-by: Xu Chongyang <chongyang.xu@intel.com>
Patchset: cameras
---
drivers/iommu/intel/iommu.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 3965979c7bd4..509cfb9f6695 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -37,6 +37,12 @@
#define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY)
#define IS_USB_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_SERIAL_USB)
#define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA)
+#define IS_INTEL_IPU(pdev) ((pdev)->vendor == PCI_VENDOR_ID_INTEL && \
+ ((pdev)->device == 0x9a19 || \
+ (pdev)->device == 0x9a39 || \
+ (pdev)->device == 0x4e19 || \
+ (pdev)->device == 0x465d || \
+ (pdev)->device == 0x1919))
#define IS_IPTS(pdev) ((pdev)->vendor == PCI_VENDOR_ID_INTEL && \
((pdev)->device == 0x9d3e))
#define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e)
@@ -289,12 +295,14 @@ EXPORT_SYMBOL_GPL(intel_iommu_enabled);
static int dmar_map_gfx = 1;
static int dmar_map_ipts = 1;
+static int dmar_map_ipu = 1;
static int intel_iommu_superpage = 1;
static int iommu_identity_mapping;
static int iommu_skip_te_disable;
#define IDENTMAP_GFX 2
#define IDENTMAP_AZALIA 4
+#define IDENTMAP_IPU 8
#define IDENTMAP_IPTS 16
const struct iommu_ops intel_iommu_ops;
@@ -2635,6 +2643,9 @@ static int device_def_domain_type(struct device *dev)
if ((iommu_identity_mapping & IDENTMAP_GFX) && IS_GFX_DEVICE(pdev))
return IOMMU_DOMAIN_IDENTITY;
+ if ((iommu_identity_mapping & IDENTMAP_IPU) && IS_INTEL_IPU(pdev))
+ return IOMMU_DOMAIN_IDENTITY;
+
if ((iommu_identity_mapping & IDENTMAP_IPTS) && IS_IPTS(pdev))
return IOMMU_DOMAIN_IDENTITY;
}
@@ -3026,6 +3037,9 @@ static int __init init_dmars(void)
if (!dmar_map_gfx)
iommu_identity_mapping |= IDENTMAP_GFX;
+ if (!dmar_map_ipu)
+ iommu_identity_mapping |= IDENTMAP_IPU;
+
if (!dmar_map_ipts)
iommu_identity_mapping |= IDENTMAP_IPTS;
@@ -4798,6 +4812,18 @@ static void quirk_iommu_igfx(struct pci_dev *dev)
dmar_map_gfx = 0;
}
+static void quirk_iommu_ipu(struct pci_dev *dev)
+{
+ if (!IS_INTEL_IPU(dev))
+ return;
+
+ if (risky_device(dev))
+ return;
+
+ pci_info(dev, "Passthrough IOMMU for integrated Intel IPU\n");
+ dmar_map_ipu = 0;
+}
+
static void quirk_iommu_ipts(struct pci_dev *dev)
{
if (!IS_IPTS(dev))
@@ -4809,6 +4835,7 @@ static void quirk_iommu_ipts(struct pci_dev *dev)
pci_info(dev, "Passthrough IOMMU for IPTS\n");
dmar_map_ipts = 0;
}
+
/* G4x/GM45 integrated gfx dmar support is totally busted. */
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_igfx);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e00, quirk_iommu_igfx);
@@ -4844,6 +4871,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1632, quirk_iommu_igfx);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x163A, quirk_iommu_igfx);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x163D, quirk_iommu_igfx);
+/* disable IPU dmar support */
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_iommu_ipu);
+
/* disable IPTS dmar support */
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9D3E, quirk_iommu_ipts);
--
2.40.1
From aee80ed3078dc3a8c3a4dde93efae305738be2c5 Mon Sep 17 00:00:00 2001
From: Daniel Scally <djrscally@gmail.com>
Date: Sun, 10 Oct 2021 20:57:02 +0200
Subject: [PATCH] platform/x86: int3472: Enable I2c daisy chain
The TPS68470 PMIC has an I2C passthrough mode through which I2C traffic
can be forwarded to a device connected to the PMIC as though it were
connected directly to the system bus. Enable this mode when the chip
is initialised.
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Patchset: cameras
---
drivers/platform/x86/intel/int3472/tps68470.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c
index 5b8d1a9620a5..6a0ff035cf20 100644
--- a/drivers/platform/x86/intel/int3472/tps68470.c
+++ b/drivers/platform/x86/intel/int3472/tps68470.c
@@ -46,6 +46,13 @@ static int tps68470_chip_init(struct device *dev, struct regmap *regmap)
return ret;
}
+ /* Enable I2C daisy chain */
+ ret = regmap_write(regmap, TPS68470_REG_S_I2C_CTL, 0x03);
+ if (ret) {
+ dev_err(dev, "Failed to enable i2c daisy chain\n");
+ return ret;
+ }
+
dev_info(dev, "TPS68470 REVID: 0x%02x\n", version);
return 0;
--
2.40.1
From f7b8dde42f8744ccc41a34e081f30e0021a23940 Mon Sep 17 00:00:00 2001
From: Daniel Scally <djrscally@gmail.com>
Date: Thu, 28 Oct 2021 21:55:16 +0100
Subject: [PATCH] media: i2c: Add driver for DW9719 VCM
Add a driver for the DW9719 VCM. The driver creates a v4l2 subdevice
and registers a control to set the desired focus.
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Patchset: cameras
---
MAINTAINERS | 7 +
drivers/media/i2c/Kconfig | 11 +
drivers/media/i2c/Makefile | 1 +
drivers/media/i2c/dw9719.c | 425 +++++++++++++++++++++++++++++++++++++
4 files changed, 444 insertions(+)
create mode 100644 drivers/media/i2c/dw9719.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 301b9ba6af79..439133f39c00 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6286,6 +6286,13 @@ T: git git://linuxtv.org/media_tree.git
F: Documentation/devicetree/bindings/media/i2c/dongwoon,dw9714.yaml
F: drivers/media/i2c/dw9714.c
+DONGWOON DW9719 LENS VOICE COIL DRIVER
+M: Daniel Scally <djrscally@gmail.com>
+L: linux-media@vger.kernel.org
+S: Maintained
+T: git git://linuxtv.org/media_tree.git
+F: drivers/media/i2c/dw9719.c
+
DONGWOON DW9768 LENS VOICE COIL DRIVER
M: Dongchun Zhu <dongchun.zhu@mediatek.com>
L: linux-media@vger.kernel.org
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 7806d4b81716..98d081efeef7 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -821,6 +821,17 @@ config VIDEO_DW9714
capability. This is designed for linear control of
voice coil motors, controlled via I2C serial interface.
+config VIDEO_DW9719
+ tristate "DW9719 lens voice coil support"
+ depends on I2C && VIDEO_V4L2
+ select MEDIA_CONTROLLER
+ select VIDEO_V4L2_SUBDEV_API
+ select V4L2_ASYNC
+ help
+ This is a driver for the DW9719 camera lens voice coil.
+ This is designed for linear control of voice coil motors,
+ controlled via I2C serial interface.
+
config VIDEO_DW9768
tristate "DW9768 lens voice coil support"
depends on I2C && VIDEO_DEV
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 0a2933103dd9..b82a07c76388 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -30,6 +30,7 @@ obj-$(CONFIG_VIDEO_CS5345) += cs5345.o
obj-$(CONFIG_VIDEO_CS53L32A) += cs53l32a.o
obj-$(CONFIG_VIDEO_CX25840) += cx25840/
obj-$(CONFIG_VIDEO_DW9714) += dw9714.o
+obj-$(CONFIG_VIDEO_DW9719) += dw9719.o
obj-$(CONFIG_VIDEO_DW9768) += dw9768.o
obj-$(CONFIG_VIDEO_DW9807_VCM) += dw9807-vcm.o
obj-$(CONFIG_VIDEO_ET8EK8) += et8ek8/
diff --git a/drivers/media/i2c/dw9719.c b/drivers/media/i2c/dw9719.c
new file mode 100644
index 000000000000..180b04d2a6b3
--- /dev/null
+++ b/drivers/media/i2c/dw9719.c
@@ -0,0 +1,425 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2012 Intel Corporation
+
+/*
+ * Based on linux/modules/camera/drivers/media/i2c/imx/dw9719.c in this repo:
+ * https://github.com/ZenfoneArea/android_kernel_asus_zenfone5
+ */
+
+#include <asm/unaligned.h>
+
+#include <linux/delay.h>
+#include <linux/i2c.h>
+#include <linux/pm_runtime.h>
+#include <linux/regulator/consumer.h>
+#include <linux/types.h>
+
+#include <media/v4l2-common.h>
+#include <media/v4l2-ctrls.h>
+#include <media/v4l2-subdev.h>
+
+#define DW9719_MAX_FOCUS_POS 1023
+#define DW9719_CTRL_STEPS 16
+#define DW9719_CTRL_DELAY_US 1000
+#define DELAY_MAX_PER_STEP_NS (1000000 * 1023)
+
+#define DW9719_INFO 0
+#define DW9719_ID 0xF1
+#define DW9719_CONTROL 2
+#define DW9719_VCM_CURRENT 3
+
+#define DW9719_MODE 6
+#define DW9719_VCM_FREQ 7
+
+#define DW9719_MODE_SAC3 0x40
+#define DW9719_DEFAULT_VCM_FREQ 0x60
+#define DW9719_ENABLE_RINGING 0x02
+
+#define NUM_REGULATORS 2
+
+#define to_dw9719_device(x) container_of(x, struct dw9719_device, sd)
+
+struct dw9719_device {
+ struct device *dev;
+ struct i2c_client *client;
+ struct regulator_bulk_data regulators[NUM_REGULATORS];
+ struct v4l2_subdev sd;
+
+ struct dw9719_v4l2_ctrls {
+ struct v4l2_ctrl_handler handler;
+ struct v4l2_ctrl *focus;
+ } ctrls;
+};
+
+static int dw9719_i2c_rd8(struct i2c_client *client, u8 reg, u8 *val)
+{
+ struct i2c_msg msg[2];
+ u8 buf[2] = { reg };
+ int ret;
+
+ msg[0].addr = client->addr;
+ msg[0].flags = 0;
+ msg[0].len = 1;
+ msg[0].buf = buf;
+
+ msg[1].addr = client->addr;
+ msg[1].flags = I2C_M_RD;
+ msg[1].len = 1;
+ msg[1].buf = &buf[1];
+ *val = 0;
+
+ ret = i2c_transfer(client->adapter, msg, 2);
+ if (ret < 0)
+ return ret;
+
+ *val = buf[1];
+
+ return 0;
+}
+
+static int dw9719_i2c_wr8(struct i2c_client *client, u8 reg, u8 val)
+{
+ struct i2c_msg msg;
+ int ret;
+
+ u8 buf[2] = { reg, val };
+
+ msg.addr = client->addr;
+ msg.flags = 0;
+ msg.len = sizeof(buf);
+ msg.buf = buf;
+
+ ret = i2c_transfer(client->adapter, &msg, 1);
+
+ return ret < 0 ? ret : 0;
+}
+
+static int dw9719_i2c_wr16(struct i2c_client *client, u8 reg, u16 val)
+{
+ struct i2c_msg msg;
+ u8 buf[3] = { reg };
+ int ret;
+
+ put_unaligned_be16(val, buf + 1);
+
+ msg.addr = client->addr;
+ msg.flags = 0;
+ msg.len = sizeof(buf);
+ msg.buf = buf;
+
+ ret = i2c_transfer(client->adapter, &msg, 1);
+
+ return ret < 0 ? ret : 0;
+}
+
+static int dw9719_detect(struct dw9719_device *dw9719)
+{
+ int ret;
+ u8 val;
+
+ ret = dw9719_i2c_rd8(dw9719->client, DW9719_INFO, &val);
+ if (ret < 0)
+ return ret;
+
+ if (val != DW9719_ID) {
+ dev_err(dw9719->dev, "Failed to detect correct id\n");
+ ret = -ENXIO;
+ }
+
+ return 0;
+}
+
+static int dw9719_power_down(struct dw9719_device *dw9719)
+{
+ return regulator_bulk_disable(NUM_REGULATORS, dw9719->regulators);
+}
+
+static int dw9719_power_up(struct dw9719_device *dw9719)
+{
+ int ret;
+
+ ret = regulator_bulk_enable(NUM_REGULATORS, dw9719->regulators);
+ if (ret)
+ return ret;
+
+ /* Jiggle SCL pin to wake up device */
+ ret = dw9719_i2c_wr8(dw9719->client, DW9719_CONTROL, 1);
+
+ /* Need 100us to transit from SHUTDOWN to STANDBY*/
+ usleep_range(100, 1000);
+
+ ret = dw9719_i2c_wr8(dw9719->client, DW9719_CONTROL,
+ DW9719_ENABLE_RINGING);
+ if (ret < 0)
+ goto fail_powerdown;
+
+ ret = dw9719_i2c_wr8(dw9719->client, DW9719_MODE, DW9719_MODE_SAC3);
+ if (ret < 0)
+ goto fail_powerdown;
+
+ ret = dw9719_i2c_wr8(dw9719->client, DW9719_VCM_FREQ,
+ DW9719_DEFAULT_VCM_FREQ);
+ if (ret < 0)
+ goto fail_powerdown;
+
+ return 0;
+
+fail_powerdown:
+ dw9719_power_down(dw9719);
+ return ret;
+}
+
+static int dw9719_t_focus_abs(struct dw9719_device *dw9719, s32 value)
+{
+ int ret;
+
+ value = clamp(value, 0, DW9719_MAX_FOCUS_POS);
+ ret = dw9719_i2c_wr16(dw9719->client, DW9719_VCM_CURRENT, value);
+ if (ret < 0)
+ return ret;
+
+ return 0;
+}
+
+static int dw9719_set_ctrl(struct v4l2_ctrl *ctrl)
+{
+ struct dw9719_device *dw9719 = container_of(ctrl->handler,
+ struct dw9719_device,
+ ctrls.handler);
+ int ret;
+
+ /* Only apply changes to the controls if the device is powered up */
+ if (!pm_runtime_get_if_in_use(dw9719->dev))
+ return 0;
+
+ switch (ctrl->id) {
+ case V4L2_CID_FOCUS_ABSOLUTE:
+ ret = dw9719_t_focus_abs(dw9719, ctrl->val);
+ break;
+ default:
+ ret = -EINVAL;
+ }
+
+ pm_runtime_put(dw9719->dev);
+
+ return ret;
+}
+
+static const struct v4l2_ctrl_ops dw9719_ctrl_ops = {
+ .s_ctrl = dw9719_set_ctrl,
+};
+
+static int __maybe_unused dw9719_suspend(struct device *dev)
+{
+ struct v4l2_subdev *sd = dev_get_drvdata(dev);
+ struct dw9719_device *dw9719 = to_dw9719_device(sd);
+ int ret;
+ int val;
+
+ for (val = dw9719->ctrls.focus->val; val >= 0;
+ val -= DW9719_CTRL_STEPS) {
+ ret = dw9719_t_focus_abs(dw9719, val);
+ if (ret)
+ return ret;
+
+ usleep_range(DW9719_CTRL_DELAY_US, DW9719_CTRL_DELAY_US + 10);
+ }
+
+ return dw9719_power_down(dw9719);
+}
+
+static int __maybe_unused dw9719_resume(struct device *dev)
+{
+ struct v4l2_subdev *sd = dev_get_drvdata(dev);
+ struct dw9719_device *dw9719 = to_dw9719_device(sd);
+ int current_focus = dw9719->ctrls.focus->val;
+ int ret;
+ int val;
+
+ ret = dw9719_power_up(dw9719);
+ if (ret)
+ return ret;
+
+ for (val = current_focus % DW9719_CTRL_STEPS; val < current_focus;
+ val += DW9719_CTRL_STEPS) {
+ ret = dw9719_t_focus_abs(dw9719, val);
+ if (ret)
+ goto err_power_down;
+
+ usleep_range(DW9719_CTRL_DELAY_US, DW9719_CTRL_DELAY_US + 10);
+ }
+
+ return 0;
+
+err_power_down:
+ dw9719_power_down(dw9719);
+ return ret;
+}
+
+static int dw9719_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
+{
+ return pm_runtime_resume_and_get(sd->dev);
+}
+
+static int dw9719_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
+{
+ pm_runtime_put(sd->dev);
+
+ return 0;
+}
+
+static const struct v4l2_subdev_internal_ops dw9719_internal_ops = {
+ .open = dw9719_open,
+ .close = dw9719_close,
+};
+
+static int dw9719_init_controls(struct dw9719_device *dw9719)
+{
+ const struct v4l2_ctrl_ops *ops = &dw9719_ctrl_ops;
+ int ret;
+
+ ret = v4l2_ctrl_handler_init(&dw9719->ctrls.handler, 1);
+ if (ret)
+ return ret;
+
+ dw9719->ctrls.focus = v4l2_ctrl_new_std(&dw9719->ctrls.handler, ops,
+ V4L2_CID_FOCUS_ABSOLUTE, 0,
+ DW9719_MAX_FOCUS_POS, 1, 0);
+
+ if (dw9719->ctrls.handler.error) {
+ dev_err(dw9719->dev, "Error initialising v4l2 ctrls\n");
+ ret = dw9719->ctrls.handler.error;
+ goto err_free_handler;
+ }
+
+ dw9719->sd.ctrl_handler = &dw9719->ctrls.handler;
+
+ return ret;
+
+err_free_handler:
+ v4l2_ctrl_handler_free(&dw9719->ctrls.handler);
+ return ret;
+}
+
+static const struct v4l2_subdev_ops dw9719_ops = { };
+
+static int dw9719_probe(struct i2c_client *client)
+{
+ struct dw9719_device *dw9719;
+ int ret;
+
+ dw9719 = devm_kzalloc(&client->dev, sizeof(*dw9719), GFP_KERNEL);
+ if (!dw9719)
+ return -ENOMEM;
+
+ dw9719->client = client;
+ dw9719->dev = &client->dev;
+
+ dw9719->regulators[0].supply = "vdd";
+ /*
+ * The DW9719 has only the 1 VDD voltage input, but some PMICs such as
+ * the TPS68470 PMIC have I2C passthrough capability, to disconnect the
+ * sensor's I2C pins from the I2C bus when the sensors VSIO (Sensor-IO)
+ * is off, because some sensors then short these pins to ground;
+ * and the DW9719 might sit behind this passthrough, this it needs to
+ * enable VSIO as that will also enable the I2C passthrough.
+ */
+ dw9719->regulators[1].supply = "vsio";
+
+ ret = devm_regulator_bulk_get(&client->dev, NUM_REGULATORS,
+ dw9719->regulators);
+ if (ret)
+ return dev_err_probe(&client->dev, ret, "getting regulators\n");
+
+ v4l2_i2c_subdev_init(&dw9719->sd, client, &dw9719_ops);
+ dw9719->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+ dw9719->sd.internal_ops = &dw9719_internal_ops;
+
+ ret = dw9719_init_controls(dw9719);
+ if (ret)
+ return ret;
+
+ ret = media_entity_pads_init(&dw9719->sd.entity, 0, NULL);
+ if (ret < 0)
+ goto err_free_ctrl_handler;
+
+ dw9719->sd.entity.function = MEDIA_ENT_F_LENS;
+
+ /*
+ * We need the driver to work in the event that pm runtime is disable in
+ * the kernel, so power up and verify the chip now. In the event that
+ * runtime pm is disabled this will leave the chip on, so that the lens
+ * will work.
+ */
+
+ ret = dw9719_power_up(dw9719);
+ if (ret)
+ goto err_cleanup_media;
+
+ ret = dw9719_detect(dw9719);
+ if (ret)
+ goto err_powerdown;
+
+ pm_runtime_set_active(&client->dev);
+ pm_runtime_get_noresume(&client->dev);
+ pm_runtime_enable(&client->dev);
+
+ ret = v4l2_async_register_subdev(&dw9719->sd);
+ if (ret < 0)
+ goto err_pm_runtime;
+
+ pm_runtime_set_autosuspend_delay(&client->dev, 1000);
+ pm_runtime_use_autosuspend(&client->dev);
+ pm_runtime_put_autosuspend(&client->dev);
+
+ return ret;
+
+err_pm_runtime:
+ pm_runtime_disable(&client->dev);
+ pm_runtime_put_noidle(&client->dev);
+err_powerdown:
+ dw9719_power_down(dw9719);
+err_cleanup_media:
+ media_entity_cleanup(&dw9719->sd.entity);
+err_free_ctrl_handler:
+ v4l2_ctrl_handler_free(&dw9719->ctrls.handler);
+
+ return ret;
+}
+
+static void dw9719_remove(struct i2c_client *client)
+{
+ struct v4l2_subdev *sd = i2c_get_clientdata(client);
+ struct dw9719_device *dw9719 = container_of(sd, struct dw9719_device,
+ sd);
+
+ pm_runtime_disable(&client->dev);
+ v4l2_async_unregister_subdev(sd);
+ v4l2_ctrl_handler_free(&dw9719->ctrls.handler);
+ media_entity_cleanup(&dw9719->sd.entity);
+}
+
+static const struct i2c_device_id dw9719_id_table[] = {
+ { "dw9719" },
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, dw9719_id_table);
+
+static const struct dev_pm_ops dw9719_pm_ops = {
+ SET_RUNTIME_PM_OPS(dw9719_suspend, dw9719_resume, NULL)
+};
+
+static struct i2c_driver dw9719_i2c_driver = {
+ .driver = {
+ .name = "dw9719",
+ .pm = &dw9719_pm_ops,
+ },
+ .probe_new = dw9719_probe,
+ .remove = dw9719_remove,
+ .id_table = dw9719_id_table,
+};
+module_i2c_driver(dw9719_i2c_driver);
+
+MODULE_AUTHOR("Daniel Scally <djrscally@gmail.com>");
+MODULE_DESCRIPTION("DW9719 VCM Driver");
+MODULE_LICENSE("GPL");
--
2.40.1
From 27e4c2c11065d83e973981d5dc16e139826925ce Mon Sep 17 00:00:00 2001
From: Daniel Scally <djrscally@gmail.com>
Date: Wed, 4 May 2022 23:21:45 +0100
Subject: [PATCH] media: ipu3-cio2: Move functionality from .complete() to
.bound()
Creating links and registering subdev nodes during the .complete()
callback has the unfortunate effect of preventing all cameras that
connect to a notifier from working if any one of their drivers fails
to probe. Moving the functionality from .complete() to .bound() allows
those camera sensor drivers that did probe correctly to work regardless.
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Patchset: cameras
---
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 65 +++++++------------
1 file changed, 23 insertions(+), 42 deletions(-)
diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
index 3b76a9d0383a..38f9f4da1922 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
@@ -1383,7 +1383,10 @@ static int cio2_notifier_bound(struct v4l2_async_notifier *notifier,
{
struct cio2_device *cio2 = to_cio2_device(notifier);
struct sensor_async_subdev *s_asd = to_sensor_asd(asd);
+ struct device *dev = &cio2->pci_dev->dev;
struct cio2_queue *q;
+ unsigned int pad;
+ int ret;
if (cio2->queue[s_asd->csi2.port].sensor)
return -EBUSY;
@@ -1394,7 +1397,26 @@ static int cio2_notifier_bound(struct v4l2_async_notifier *notifier,
q->sensor = sd;
q->csi_rx_base = cio2->base + CIO2_REG_PIPE_BASE(q->csi2.port);
- return 0;
+ for (pad = 0; pad < q->sensor->entity.num_pads; pad++)
+ if (q->sensor->entity.pads[pad].flags &
+ MEDIA_PAD_FL_SOURCE)
+ break;
+
+ if (pad == q->sensor->entity.num_pads) {
+ dev_err(dev, "failed to find src pad for %s\n",
+ q->sensor->name);
+ return -ENXIO;
+ }
+
+ ret = media_create_pad_link(&q->sensor->entity, pad, &q->subdev.entity,
+ CIO2_PAD_SINK, 0);
+ if (ret) {
+ dev_err(dev, "failed to create link for %s\n",
+ q->sensor->name);
+ return ret;
+ }
+
+ return v4l2_device_register_subdev_nodes(&cio2->v4l2_dev);
}
/* The .unbind callback */
@@ -1408,50 +1430,9 @@ static void cio2_notifier_unbind(struct v4l2_async_notifier *notifier,
cio2->queue[s_asd->csi2.port].sensor = NULL;
}
-/* .complete() is called after all subdevices have been located */
-static int cio2_notifier_complete(struct v4l2_async_notifier *notifier)
-{
- struct cio2_device *cio2 = to_cio2_device(notifier);
- struct device *dev = &cio2->pci_dev->dev;
- struct sensor_async_subdev *s_asd;
- struct v4l2_async_subdev *asd;
- struct cio2_queue *q;
- unsigned int pad;
- int ret;
-
- list_for_each_entry(asd, &cio2->notifier.asd_list, asd_list) {
- s_asd = to_sensor_asd(asd);
- q = &cio2->queue[s_asd->csi2.port];
-
- for (pad = 0; pad < q->sensor->entity.num_pads; pad++)
- if (q->sensor->entity.pads[pad].flags &
- MEDIA_PAD_FL_SOURCE)
- break;
-
- if (pad == q->sensor->entity.num_pads) {
- dev_err(dev, "failed to find src pad for %s\n",
- q->sensor->name);
- return -ENXIO;
- }
-
- ret = media_create_pad_link(
- &q->sensor->entity, pad,
- &q->subdev.entity, CIO2_PAD_SINK,
- 0);
- if (ret) {
- dev_err(dev, "failed to create link for %s\n",
- q->sensor->name);
- return ret;
- }
- }
-
- return v4l2_device_register_subdev_nodes(&cio2->v4l2_dev);
-}
-
static const struct v4l2_async_notifier_operations cio2_async_ops = {
.bound = cio2_notifier_bound,
.unbind = cio2_notifier_unbind,
- .complete = cio2_notifier_complete,
};
static int cio2_parse_firmware(struct cio2_device *cio2)
--
2.40.1
From 9937198809897a459c727b54449125c876899477 Mon Sep 17 00:00:00 2001
From: Daniel Scally <djrscally@gmail.com>
Date: Thu, 2 Jun 2022 22:15:56 +0100
Subject: [PATCH] media: ipu3-cio2: Re-add .complete() to ipu3-cio2
Removing the .complete() callback had some unintended consequences.
Because the VCM driver is not directly linked to the ipu3-cio2
driver .bound() never gets called for it, which means its devnode
is never created if it probes late. Because .complete() waits for
any sub-notifiers to also be complete it is captured in that call.
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Patchset: cameras
---
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
index 38f9f4da1922..82681df7d794 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
@@ -1430,9 +1430,18 @@ static void cio2_notifier_unbind(struct v4l2_async_notifier *notifier,
cio2->queue[s_asd->csi2.port].sensor = NULL;
}
+/* .complete() is called after all subdevices have been located */
+static int cio2_notifier_complete(struct v4l2_async_notifier *notifier)
+{
+ struct cio2_device *cio2 = to_cio2_device(notifier);
+
+ return v4l2_device_register_subdev_nodes(&cio2->v4l2_dev);
+}
+
static const struct v4l2_async_notifier_operations cio2_async_ops = {
.bound = cio2_notifier_bound,
.unbind = cio2_notifier_unbind,
+ .complete = cio2_notifier_complete,
};
static int cio2_parse_firmware(struct cio2_device *cio2)
--
2.40.1
From 704bd3669f6781a08f1eb6983cddc706fb2c0dad Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Fri, 15 Jul 2022 23:48:00 +0200
Subject: [PATCH] drivers/media/i2c: Fix DW9719 dependencies
It should depend on VIDEO_DEV instead of VIDEO_V4L2.
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Patchset: cameras
---
drivers/media/i2c/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 98d081efeef7..c67966cafe10 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -823,7 +823,7 @@ config VIDEO_DW9714
config VIDEO_DW9719
tristate "DW9719 lens voice coil support"
- depends on I2C && VIDEO_V4L2
+ depends on I2C && VIDEO_DEV
select MEDIA_CONTROLLER
select VIDEO_V4L2_SUBDEV_API
select V4L2_ASYNC
--
2.40.1
From 26d626cfcd1f86c560802da12c146b1dcefd9138 Mon Sep 17 00:00:00 2001
From: Daniel Scally <dan.scally@ideasonboard.com>
Date: Thu, 2 Mar 2023 12:59:39 +0000
Subject: [PATCH] platform/x86: int3472: Remap reset GPIO for INT347E
ACPI _HID INT347E represents the OmniVision 7251 camera sensor. The
driver for this sensor expects a single pin named "enable", but on
some Microsoft Surface platforms the sensor is assigned a single
GPIO who's type flag is INT3472_GPIO_TYPE_RESET.
Remap the GPIO pin's function from "reset" to "enable". This is done
outside of the existing remap table since it is a more widespread
discrepancy than that method is designed for. Additionally swap the
polarity of the pin to match the driver's expectation.
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Patchset: cameras
---
drivers/platform/x86/intel/int3472/discrete.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c
index c42c3faa2c32..6f4b8e24eb56 100644
--- a/drivers/platform/x86/intel/int3472/discrete.c
+++ b/drivers/platform/x86/intel/int3472/discrete.c
@@ -108,6 +108,9 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347
{
const struct int3472_sensor_config *sensor_config;
char *path = agpio->resource_source.string_ptr;
+ const struct acpi_device_id ov7251_ids[] = {
+ { "INT347E" },
+ };
struct gpiod_lookup *table_entry;
struct acpi_device *adev;
acpi_handle handle;
@@ -130,6 +133,17 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347
}
}
+ /*
+ * In addition to the function remap table we need to bulk remap the
+ * "reset" GPIO for the OmniVision 7251 sensor, as the driver for that
+ * expects its only GPIO pin to be called "enable" (and to have the
+ * opposite polarity).
+ */
+ if (!strcmp(func, "reset") && !acpi_match_device_ids(int3472->sensor, ov7251_ids)) {
+ func = "enable";
+ polarity = GPIO_ACTIVE_HIGH;
+ }
+
/* Functions mapped to NULL should not be mapped to the sensor */
if (!func)
return 0;
--
2.40.1

View file

@ -1,4 +1,4 @@
From 302d8dc26283bc10ba22bc549c41292d00125e60 Mon Sep 17 00:00:00 2001
From 442501128c7925f2e0c2dd5d1c220054f5a1a8b0 Mon Sep 17 00:00:00 2001
From: Sachi King <nakato@nakato.io>
Date: Sat, 29 May 2021 17:47:38 +1000
Subject: [PATCH] ACPI: Add quirk for Surface Laptop 4 AMD missing irq 7
@ -21,7 +21,7 @@ Patchset: amd-gpio
1 file changed, 17 insertions(+)
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 85a3ce2a3666..2c0e04a3a697 100644
index 0f762070a5e1..6362dd452233 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -22,6 +22,7 @@
@ -32,7 +32,7 @@ index 85a3ce2a3666..2c0e04a3a697 100644
#include <asm/e820/api.h>
#include <asm/irqdomain.h>
@@ -1251,6 +1252,17 @@ static void __init mp_config_acpi_legacy_irqs(void)
@@ -1252,6 +1253,17 @@ static void __init mp_config_acpi_legacy_irqs(void)
}
}
@ -50,7 +50,7 @@ index 85a3ce2a3666..2c0e04a3a697 100644
/*
* Parse IOAPIC related entries in MADT
* returns 0 on success, < 0 on error
@@ -1306,6 +1318,11 @@ static int __init acpi_parse_madt_ioapic_entries(void)
@@ -1307,6 +1319,11 @@ static int __init acpi_parse_madt_ioapic_entries(void)
acpi_sci_ioapic_setup(acpi_gbl_FADT.sci_interrupt, 0, 0,
acpi_gbl_FADT.sci_interrupt);
@ -63,9 +63,9 @@ index 85a3ce2a3666..2c0e04a3a697 100644
mp_config_acpi_legacy_irqs();
--
2.44.0
2.40.1
From d2a793e4fd47cd1cba2847915e7078671d9e9ea5 Mon Sep 17 00:00:00 2001
From 417c239f3b143ef0db20714eb64f72ff4f19a00e Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Thu, 3 Jun 2021 14:04:26 +0200
Subject: [PATCH] ACPI: Add AMD 13" Surface Laptop 4 model to irq 7 override
@ -80,10 +80,10 @@ Patchset: amd-gpio
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 2c0e04a3a697..b0e1dab3d2ec 100644
index 6362dd452233..8a092c2c6fa8 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -1254,12 +1254,19 @@ static void __init mp_config_acpi_legacy_irqs(void)
@@ -1255,12 +1255,19 @@ static void __init mp_config_acpi_legacy_irqs(void)
static const struct dmi_system_id surface_quirk[] __initconst = {
{
@ -105,5 +105,5 @@ index 2c0e04a3a697..b0e1dab3d2ec 100644
};
--
2.44.0
2.40.1

View file

@ -1,4 +1,4 @@
From 34ad5b493b00c944ed68d2436cad96785fe37a33 Mon Sep 17 00:00:00 2001
From f901956ff489fe15559f68ce6cf1c54ba4aaa415 Mon Sep 17 00:00:00 2001
From: "Bart Groeneveld | GPX Solutions B.V" <bart@gpxbv.nl>
Date: Mon, 5 Dec 2022 16:08:46 +0100
Subject: [PATCH] acpi: allow usage of acpi_tad on HW-reduced platforms
@ -17,11 +17,11 @@ but it does have an HW-reduced TAD, which can be used as a RTC instead.
Signed-off-by: Bart Groeneveld | GPX Solutions B.V. <bart@gpxbv.nl>
Patchset: rtc
---
drivers/acpi/acpi_tad.c | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
drivers/acpi/acpi_tad.c | 35 ++++++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 11 deletions(-)
diff --git a/drivers/acpi/acpi_tad.c b/drivers/acpi/acpi_tad.c
index 33c3b16af556..900445d06623 100644
index e9b8e8305e23..944276934e7e 100644
--- a/drivers/acpi/acpi_tad.c
+++ b/drivers/acpi/acpi_tad.c
@@ -432,6 +432,14 @@ static ssize_t caps_show(struct device *dev, struct device_attribute *attr,
@ -58,7 +58,7 @@ index 33c3b16af556..900445d06623 100644
};
static ssize_t dc_alarm_store(struct device *dev, struct device_attribute *attr,
@@ -564,13 +571,18 @@ static int acpi_tad_remove(struct platform_device *pdev)
@@ -563,13 +570,18 @@ static int acpi_tad_remove(struct platform_device *pdev)
pm_runtime_get_sync(dev);
@ -79,20 +79,19 @@ index 33c3b16af556..900445d06623 100644
if (dd->capabilities & ACPI_TAD_DC_WAKE) {
acpi_tad_disable_timer(dev, ACPI_TAD_DC_TIMER);
acpi_tad_clear_status(dev, ACPI_TAD_DC_TIMER);
@@ -613,12 +625,6 @@ static int acpi_tad_probe(struct platform_device *pdev)
goto remove_handler;
@@ -604,11 +616,6 @@ static int acpi_tad_probe(struct platform_device *pdev)
return -ENODEV;
}
- if (!acpi_has_method(handle, "_PRW")) {
- dev_info(dev, "Missing _PRW\n");
- ret = -ENODEV;
- goto remove_handler;
- return -ENODEV;
- }
-
dd = devm_kzalloc(dev, sizeof(*dd), GFP_KERNEL);
if (!dd) {
ret = -ENOMEM;
@@ -649,6 +655,12 @@ static int acpi_tad_probe(struct platform_device *pdev)
if (!dd)
return -ENOMEM;
@@ -637,6 +644,12 @@ static int acpi_tad_probe(struct platform_device *pdev)
if (ret)
goto fail;
@ -106,5 +105,5 @@ index 33c3b16af556..900445d06623 100644
ret = sysfs_create_group(&dev->kobj, &acpi_tad_dc_attr_group);
if (ret)
--
2.44.0
2.40.1

View file

@ -1,4 +1,4 @@
From 45a9e7f97fc36942e3d70a78fe5313fa78733933 Mon Sep 17 00:00:00 2001
From 83cc05c72f1f63597ec728280dba6fb55d7add76 Mon Sep 17 00:00:00 2001
From: Tsuchiya Yuto <kitakar@gmail.com>
Date: Sun, 18 Oct 2020 16:42:44 +0900
Subject: [PATCH] (surface3-oemb) add DMI matches for Surface 3 with broken DMI
@ -40,7 +40,7 @@ Patchset: surface3-oemb
3 files changed, 24 insertions(+)
diff --git a/drivers/platform/surface/surface3-wmi.c b/drivers/platform/surface/surface3-wmi.c
index c15ed7a12784..1ec8edb5aafa 100644
index ca4602bcc7de..490b9731068a 100644
--- a/drivers/platform/surface/surface3-wmi.c
+++ b/drivers/platform/surface/surface3-wmi.c
@@ -37,6 +37,13 @@ static const struct dmi_system_id surface3_dmi_table[] = {
@ -58,10 +58,10 @@ index c15ed7a12784..1ec8edb5aafa 100644
{ }
};
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 20191a4473c2..5ba599b5aba6 100644
index 7c7cbb6362ea..81a8ff40e86e 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3768,6 +3768,15 @@ static const struct dmi_system_id dmi_platform_data[] = {
@@ -3717,6 +3717,15 @@ static const struct dmi_system_id dmi_platform_data[] = {
},
.driver_data = (void *)&intel_braswell_platform_data,
},
@ -78,7 +78,7 @@ index 20191a4473c2..5ba599b5aba6 100644
/*
* Match for the GPDwin which unfortunately uses somewhat
diff --git a/sound/soc/intel/common/soc-acpi-intel-cht-match.c b/sound/soc/intel/common/soc-acpi-intel-cht-match.c
index 5e2ec60e2954..207868c699f2 100644
index 6beb00858c33..d82d77387a0a 100644
--- a/sound/soc/intel/common/soc-acpi-intel-cht-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-cht-match.c
@@ -27,6 +27,14 @@ static const struct dmi_system_id cht_table[] = {
@ -97,5 +97,5 @@ index 5e2ec60e2954..207868c699f2 100644
};
--
2.44.0
2.40.1

View file

@ -1,4 +1,4 @@
From 710646309780d1a59cbeae7e4bfa92068364aa67 Mon Sep 17 00:00:00 2001
From 4432de77009d2d1765b85345fe091e525d444ef9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
Date: Tue, 3 Nov 2020 13:28:04 +0100
Subject: [PATCH] mwifiex: Add quirk resetting the PCI bridge on MS Surface
@ -32,10 +32,10 @@ Patchset: mwifiex
3 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index 6697132ecc97..f06b4ebc5bd8 100644
index 9a698a16a8f3..14687342bc81 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -1771,9 +1771,21 @@ mwifiex_pcie_send_boot_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb)
@@ -1762,9 +1762,21 @@ mwifiex_pcie_send_boot_cmd(struct mwifiex_adapter *adapter, struct sk_buff *skb)
static int mwifiex_pcie_init_fw_port(struct mwifiex_adapter *adapter)
{
struct pcie_service_card *card = adapter->card;
@ -163,9 +163,9 @@ index d6ff964aec5b..5d30ae39d65e 100644
void mwifiex_initialize_quirks(struct pcie_service_card *card);
int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev);
--
2.44.0
2.40.1
From d10371a089a968b913b9413e1f06bd3d9d154b21 Mon Sep 17 00:00:00 2001
From 8999971ac1888c7f868ca9307fa43e69fcaf0454 Mon Sep 17 00:00:00 2001
From: Tsuchiya Yuto <kitakar@gmail.com>
Date: Sun, 4 Oct 2020 00:11:49 +0900
Subject: [PATCH] mwifiex: pcie: disable bridge_d3 for Surface gen4+
@ -187,10 +187,10 @@ Patchset: mwifiex
3 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index f06b4ebc5bd8..07f13b52ddb9 100644
index 14687342bc81..5e1a341f63df 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -370,6 +370,7 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
@@ -368,6 +368,7 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
struct pcie_service_card *card;
@ -198,7 +198,7 @@ index f06b4ebc5bd8..07f13b52ddb9 100644
int ret;
pr_debug("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n",
@@ -411,6 +412,12 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
@@ -409,6 +410,12 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
return -1;
}
@ -318,9 +318,9 @@ index 5d30ae39d65e..c14eb56eb911 100644
void mwifiex_initialize_quirks(struct pcie_service_card *card);
int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev);
--
2.44.0
2.40.1
From 59d4464c43b8c4090372cbf2632fc116a0ca8b2a Mon Sep 17 00:00:00 2001
From 98a074a2f96ac4bb9062191e8bc7b2bdf5f11e32 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
Date: Thu, 25 Mar 2021 11:33:02 +0100
Subject: [PATCH] Bluetooth: btusb: Lower passive lescan interval on Marvell
@ -356,7 +356,7 @@ Patchset: mwifiex
1 file changed, 15 insertions(+)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 66080fae072f..68e2f2976a51 100644
index 0923582299f3..3a2c8e3bc244 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -65,6 +65,7 @@ static struct usb_driver btusb_driver;
@ -367,7 +367,7 @@ index 66080fae072f..68e2f2976a51 100644
static const struct usb_device_id btusb_table[] = {
/* Generic Bluetooth USB device */
@@ -468,6 +469,7 @@ static const struct usb_device_id quirks_table[] = {
@@ -468,6 +469,7 @@ static const struct usb_device_id blacklist_table[] = {
{ USB_DEVICE(0x1286, 0x2044), .driver_info = BTUSB_MARVELL },
{ USB_DEVICE(0x1286, 0x2046), .driver_info = BTUSB_MARVELL },
{ USB_DEVICE(0x1286, 0x204e), .driver_info = BTUSB_MARVELL },
@ -375,7 +375,7 @@ index 66080fae072f..68e2f2976a51 100644
/* Intel Bluetooth devices */
{ USB_DEVICE(0x8087, 0x0025), .driver_info = BTUSB_INTEL_COMBINED },
@@ -4395,6 +4397,19 @@ static int btusb_probe(struct usb_interface *intf,
@@ -4036,6 +4038,19 @@ static int btusb_probe(struct usb_interface *intf,
if (id->driver_info & BTUSB_MARVELL)
hdev->set_bdaddr = btusb_set_bdaddr_marvell;
@ -396,5 +396,5 @@ index 66080fae072f..68e2f2976a51 100644
(id->driver_info & BTUSB_MEDIATEK)) {
hdev->setup = btusb_mtk_setup;
--
2.44.0
2.40.1

View file

@ -1,4 +1,4 @@
From 7b414f11dfa0be3204b0a43b82a75744f8218d57 Mon Sep 17 00:00:00 2001
From 0af0f82cd021c2fe32e507969debca87cc36a438 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 27 Feb 2021 00:45:52 +0100
Subject: [PATCH] ath10k: Add module parameters to override board files
@ -20,10 +20,10 @@ Patchset: ath10k
1 file changed, 58 insertions(+)
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 0032f8aa892f..17717b53316b 100644
index 5eb131ab916f..67f074a126d1 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -39,6 +39,9 @@ static bool fw_diag_log;
@@ -38,6 +38,9 @@ static bool fw_diag_log;
/* frame mode values are mapped as per enum ath10k_hw_txrx_mode */
unsigned int ath10k_frame_mode = ATH10K_HW_TXRX_NATIVE_WIFI;
@ -33,7 +33,7 @@ index 0032f8aa892f..17717b53316b 100644
unsigned long ath10k_coredump_mask = BIT(ATH10K_FW_CRASH_DUMP_REGISTERS) |
BIT(ATH10K_FW_CRASH_DUMP_CE_DATA);
@@ -51,6 +54,9 @@ module_param(fw_diag_log, bool, 0644);
@@ -50,6 +53,9 @@ module_param(fw_diag_log, bool, 0644);
module_param_named(frame_mode, ath10k_frame_mode, uint, 0644);
module_param_named(coredump_mask, ath10k_coredump_mask, ulong, 0444);
@ -43,7 +43,7 @@ index 0032f8aa892f..17717b53316b 100644
MODULE_PARM_DESC(debug_mask, "Debugging mask");
MODULE_PARM_DESC(uart_print, "Uart target debugging");
MODULE_PARM_DESC(skip_otp, "Skip otp failure for calibration in testmode");
@@ -60,6 +66,9 @@ MODULE_PARM_DESC(frame_mode,
@@ -59,6 +65,9 @@ MODULE_PARM_DESC(frame_mode,
MODULE_PARM_DESC(coredump_mask, "Bitfield of what to include in firmware crash file");
MODULE_PARM_DESC(fw_diag_log, "Diag based fw log debugging");
@ -53,7 +53,7 @@ index 0032f8aa892f..17717b53316b 100644
static const struct ath10k_hw_params ath10k_hw_params_list[] = {
{
.id = QCA988X_HW_2_0_VERSION,
@@ -928,6 +937,42 @@ static int ath10k_init_configure_target(struct ath10k *ar)
@@ -911,6 +920,42 @@ static int ath10k_init_configure_target(struct ath10k *ar)
return 0;
}
@ -96,7 +96,7 @@ index 0032f8aa892f..17717b53316b 100644
static const struct firmware *ath10k_fetch_fw_file(struct ath10k *ar,
const char *dir,
const char *file)
@@ -942,6 +987,19 @@ static const struct firmware *ath10k_fetch_fw_file(struct ath10k *ar,
@@ -925,6 +970,19 @@ static const struct firmware *ath10k_fetch_fw_file(struct ath10k *ar,
if (dir == NULL)
dir = ".";
@ -117,5 +117,5 @@ index 0032f8aa892f..17717b53316b 100644
ret = firmware_request_nowarn(&fw, filename, ar->dev);
ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot fw request '%s': %d\n",
--
2.44.0
2.40.1

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,660 @@
From b5352df11ec4bfc20133348d43d1abc08ca19bf7 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 4 Mar 2023 20:09:36 +0100
Subject: [PATCH] platform/surface: aggregator_tabletsw: Properly handle
different posture source IDs
The device posture subsystem (POS) can provide different posture
sources. Different sources can provide different posture states and
sources can be identified by their ID.
For example, screen posture of the Surface Laptop Studio (SLS), which is
currently the only supported source, uses a source ID of 0x03. The
Surface Pro 9 uses the same subsystem for its Type-Cover, however,
provides different states for that under the ID 0x00.
To eventually support the Surface Pro 9 and potential future devices, we
need to properly disambiguate between source IDs. Therefore, add the
source ID to the state we carry and determine the tablet-mode state (as
well as state names) based on that.
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Patchset: surface-sam
---
.../surface/surface_aggregator_tabletsw.c | 123 ++++++++++++------
1 file changed, 84 insertions(+), 39 deletions(-)
diff --git a/drivers/platform/surface/surface_aggregator_tabletsw.c b/drivers/platform/surface/surface_aggregator_tabletsw.c
index 9fed800c7cc0..e8682f52558f 100644
--- a/drivers/platform/surface/surface_aggregator_tabletsw.c
+++ b/drivers/platform/surface/surface_aggregator_tabletsw.c
@@ -20,16 +20,23 @@
struct ssam_tablet_sw;
+struct ssam_tablet_sw_state {
+ u32 source;
+ u32 state;
+};
+
struct ssam_tablet_sw_ops {
- int (*get_state)(struct ssam_tablet_sw *sw, u32 *state);
- const char *(*state_name)(struct ssam_tablet_sw *sw, u32 state);
- bool (*state_is_tablet_mode)(struct ssam_tablet_sw *sw, u32 state);
+ int (*get_state)(struct ssam_tablet_sw *sw, struct ssam_tablet_sw_state *state);
+ const char *(*state_name)(struct ssam_tablet_sw *sw,
+ const struct ssam_tablet_sw_state *state);
+ bool (*state_is_tablet_mode)(struct ssam_tablet_sw *sw,
+ const struct ssam_tablet_sw_state *state);
};
struct ssam_tablet_sw {
struct ssam_device *sdev;
- u32 state;
+ struct ssam_tablet_sw_state state;
struct work_struct update_work;
struct input_dev *mode_switch;
@@ -45,9 +52,11 @@ struct ssam_tablet_sw_desc {
struct {
u32 (*notify)(struct ssam_event_notifier *nf, const struct ssam_event *event);
- int (*get_state)(struct ssam_tablet_sw *sw, u32 *state);
- const char *(*state_name)(struct ssam_tablet_sw *sw, u32 state);
- bool (*state_is_tablet_mode)(struct ssam_tablet_sw *sw, u32 state);
+ int (*get_state)(struct ssam_tablet_sw *sw, struct ssam_tablet_sw_state *state);
+ const char *(*state_name)(struct ssam_tablet_sw *sw,
+ const struct ssam_tablet_sw_state *state);
+ bool (*state_is_tablet_mode)(struct ssam_tablet_sw *sw,
+ const struct ssam_tablet_sw_state *state);
} ops;
struct {
@@ -61,7 +70,7 @@ struct ssam_tablet_sw_desc {
static ssize_t state_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct ssam_tablet_sw *sw = dev_get_drvdata(dev);
- const char *state = sw->ops.state_name(sw, sw->state);
+ const char *state = sw->ops.state_name(sw, &sw->state);
return sysfs_emit(buf, "%s\n", state);
}
@@ -79,19 +88,19 @@ static const struct attribute_group ssam_tablet_sw_group = {
static void ssam_tablet_sw_update_workfn(struct work_struct *work)
{
struct ssam_tablet_sw *sw = container_of(work, struct ssam_tablet_sw, update_work);
+ struct ssam_tablet_sw_state state;
int tablet, status;
- u32 state;
status = sw->ops.get_state(sw, &state);
if (status)
return;
- if (sw->state == state)
+ if (sw->state.source == state.source && sw->state.state == state.state)
return;
sw->state = state;
/* Send SW_TABLET_MODE event. */
- tablet = sw->ops.state_is_tablet_mode(sw, state);
+ tablet = sw->ops.state_is_tablet_mode(sw, &state);
input_report_switch(sw->mode_switch, SW_TABLET_MODE, tablet);
input_sync(sw->mode_switch);
}
@@ -146,7 +155,7 @@ static int ssam_tablet_sw_probe(struct ssam_device *sdev)
sw->mode_switch->id.bustype = BUS_HOST;
sw->mode_switch->dev.parent = &sdev->dev;
- tablet = sw->ops.state_is_tablet_mode(sw, sw->state);
+ tablet = sw->ops.state_is_tablet_mode(sw, &sw->state);
input_set_capability(sw->mode_switch, EV_SW, SW_TABLET_MODE);
input_report_switch(sw->mode_switch, SW_TABLET_MODE, tablet);
@@ -203,9 +212,10 @@ enum ssam_kip_cover_state {
SSAM_KIP_COVER_STATE_FOLDED_BACK = 0x05,
};
-static const char *ssam_kip_cover_state_name(struct ssam_tablet_sw *sw, u32 state)
+static const char *ssam_kip_cover_state_name(struct ssam_tablet_sw *sw,
+ const struct ssam_tablet_sw_state *state)
{
- switch (state) {
+ switch (state->state) {
case SSAM_KIP_COVER_STATE_DISCONNECTED:
return "disconnected";
@@ -222,14 +232,15 @@ static const char *ssam_kip_cover_state_name(struct ssam_tablet_sw *sw, u32 stat
return "folded-back";
default:
- dev_warn(&sw->sdev->dev, "unknown KIP cover state: %u\n", state);
+ dev_warn(&sw->sdev->dev, "unknown KIP cover state: %u\n", state->state);
return "<unknown>";
}
}
-static bool ssam_kip_cover_state_is_tablet_mode(struct ssam_tablet_sw *sw, u32 state)
+static bool ssam_kip_cover_state_is_tablet_mode(struct ssam_tablet_sw *sw,
+ const struct ssam_tablet_sw_state *state)
{
- switch (state) {
+ switch (state->state) {
case SSAM_KIP_COVER_STATE_DISCONNECTED:
case SSAM_KIP_COVER_STATE_FOLDED_CANVAS:
case SSAM_KIP_COVER_STATE_FOLDED_BACK:
@@ -240,7 +251,7 @@ static bool ssam_kip_cover_state_is_tablet_mode(struct ssam_tablet_sw *sw, u32 s
return false;
default:
- dev_warn(&sw->sdev->dev, "unknown KIP cover state: %d\n", sw->state);
+ dev_warn(&sw->sdev->dev, "unknown KIP cover state: %d\n", state->state);
return true;
}
}
@@ -252,7 +263,7 @@ SSAM_DEFINE_SYNC_REQUEST_R(__ssam_kip_get_cover_state, u8, {
.instance_id = 0x00,
});
-static int ssam_kip_get_cover_state(struct ssam_tablet_sw *sw, u32 *state)
+static int ssam_kip_get_cover_state(struct ssam_tablet_sw *sw, struct ssam_tablet_sw_state *state)
{
int status;
u8 raw;
@@ -263,7 +274,8 @@ static int ssam_kip_get_cover_state(struct ssam_tablet_sw *sw, u32 *state)
return status;
}
- *state = raw;
+ state->source = 0; /* Unused for KIP switch. */
+ state->state = raw;
return 0;
}
@@ -312,11 +324,15 @@ MODULE_PARM_DESC(tablet_mode_in_slate_state, "Enable tablet mode in slate device
#define SSAM_EVENT_POS_CID_POSTURE_CHANGED 0x03
#define SSAM_POS_MAX_SOURCES 4
-enum ssam_pos_state {
- SSAM_POS_POSTURE_LID_CLOSED = 0x00,
- SSAM_POS_POSTURE_LAPTOP = 0x01,
- SSAM_POS_POSTURE_SLATE = 0x02,
- SSAM_POS_POSTURE_TABLET = 0x03,
+enum ssam_pos_source_id {
+ SSAM_POS_SOURCE_SLS = 0x03,
+};
+
+enum ssam_pos_state_sls {
+ SSAM_POS_SLS_LID_CLOSED = 0x00,
+ SSAM_POS_SLS_LAPTOP = 0x01,
+ SSAM_POS_SLS_SLATE = 0x02,
+ SSAM_POS_SLS_TABLET = 0x03,
};
struct ssam_sources_list {
@@ -324,42 +340,68 @@ struct ssam_sources_list {
__le32 id[SSAM_POS_MAX_SOURCES];
} __packed;
-static const char *ssam_pos_state_name(struct ssam_tablet_sw *sw, u32 state)
+static const char *ssam_pos_state_name_sls(struct ssam_tablet_sw *sw, u32 state)
{
switch (state) {
- case SSAM_POS_POSTURE_LID_CLOSED:
+ case SSAM_POS_SLS_LID_CLOSED:
return "closed";
- case SSAM_POS_POSTURE_LAPTOP:
+ case SSAM_POS_SLS_LAPTOP:
return "laptop";
- case SSAM_POS_POSTURE_SLATE:
+ case SSAM_POS_SLS_SLATE:
return "slate";
- case SSAM_POS_POSTURE_TABLET:
+ case SSAM_POS_SLS_TABLET:
return "tablet";
default:
- dev_warn(&sw->sdev->dev, "unknown device posture: %u\n", state);
+ dev_warn(&sw->sdev->dev, "unknown device posture for SLS: %u\n", state);
return "<unknown>";
}
}
-static bool ssam_pos_state_is_tablet_mode(struct ssam_tablet_sw *sw, u32 state)
+static const char *ssam_pos_state_name(struct ssam_tablet_sw *sw,
+ const struct ssam_tablet_sw_state *state)
+{
+ switch (state->source) {
+ case SSAM_POS_SOURCE_SLS:
+ return ssam_pos_state_name_sls(sw, state->state);
+
+ default:
+ dev_warn(&sw->sdev->dev, "unknown device posture source: %u\n", state->source);
+ return "<unknown>";
+ }
+}
+
+static bool ssam_pos_state_is_tablet_mode_sls(struct ssam_tablet_sw *sw, u32 state)
{
switch (state) {
- case SSAM_POS_POSTURE_LAPTOP:
- case SSAM_POS_POSTURE_LID_CLOSED:
+ case SSAM_POS_SLS_LAPTOP:
+ case SSAM_POS_SLS_LID_CLOSED:
return false;
- case SSAM_POS_POSTURE_SLATE:
+ case SSAM_POS_SLS_SLATE:
return tablet_mode_in_slate_state;
- case SSAM_POS_POSTURE_TABLET:
+ case SSAM_POS_SLS_TABLET:
return true;
default:
- dev_warn(&sw->sdev->dev, "unknown device posture: %u\n", state);
+ dev_warn(&sw->sdev->dev, "unknown device posture for SLS: %u\n", state);
+ return true;
+ }
+}
+
+static bool ssam_pos_state_is_tablet_mode(struct ssam_tablet_sw *sw,
+ const struct ssam_tablet_sw_state *state)
+{
+ switch (state->source) {
+ case SSAM_POS_SOURCE_SLS:
+ return ssam_pos_state_is_tablet_mode_sls(sw, state->state);
+
+ default:
+ dev_warn(&sw->sdev->dev, "unknown device posture source: %u\n", state->source);
return true;
}
}
@@ -450,9 +492,10 @@ static int ssam_pos_get_posture_for_source(struct ssam_tablet_sw *sw, u32 source
return 0;
}
-static int ssam_pos_get_posture(struct ssam_tablet_sw *sw, u32 *state)
+static int ssam_pos_get_posture(struct ssam_tablet_sw *sw, struct ssam_tablet_sw_state *state)
{
u32 source_id;
+ u32 source_state;
int status;
status = ssam_pos_get_source(sw, &source_id);
@@ -461,13 +504,15 @@ static int ssam_pos_get_posture(struct ssam_tablet_sw *sw, u32 *state)
return status;
}
- status = ssam_pos_get_posture_for_source(sw, source_id, state);
+ status = ssam_pos_get_posture_for_source(sw, source_id, &source_state);
if (status) {
dev_err(&sw->sdev->dev, "failed to get posture value for source %u: %d\n",
source_id, status);
return status;
}
+ state->source = source_id;
+ state->state = source_state;
return 0;
}
--
2.40.1
From 366d4400549e896159aceee4ce0cc2514074998a Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sun, 19 Feb 2023 23:33:43 +0100
Subject: [PATCH] platform/surface: aggregator_tabletsw: Add support for
Type-Cover posture source
Implement support for the Type-Cover posture source (ID 0x00), found on
the Surface Pro 9.
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Patchset: surface-sam
---
.../surface/surface_aggregator_tabletsw.c | 57 +++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/drivers/platform/surface/surface_aggregator_tabletsw.c b/drivers/platform/surface/surface_aggregator_tabletsw.c
index e8682f52558f..8f52b62d1c19 100644
--- a/drivers/platform/surface/surface_aggregator_tabletsw.c
+++ b/drivers/platform/surface/surface_aggregator_tabletsw.c
@@ -325,9 +325,18 @@ MODULE_PARM_DESC(tablet_mode_in_slate_state, "Enable tablet mode in slate device
#define SSAM_POS_MAX_SOURCES 4
enum ssam_pos_source_id {
+ SSAM_POS_SOURCE_COVER = 0x00,
SSAM_POS_SOURCE_SLS = 0x03,
};
+enum ssam_pos_state_cover {
+ SSAM_POS_COVER_DISCONNECTED = 0x01,
+ SSAM_POS_COVER_CLOSED = 0x02,
+ SSAM_POS_COVER_LAPTOP = 0x03,
+ SSAM_POS_COVER_FOLDED_CANVAS = 0x04,
+ SSAM_POS_COVER_FOLDED_BACK = 0x05,
+};
+
enum ssam_pos_state_sls {
SSAM_POS_SLS_LID_CLOSED = 0x00,
SSAM_POS_SLS_LAPTOP = 0x01,
@@ -340,6 +349,30 @@ struct ssam_sources_list {
__le32 id[SSAM_POS_MAX_SOURCES];
} __packed;
+static const char *ssam_pos_state_name_cover(struct ssam_tablet_sw *sw, u32 state)
+{
+ switch (state) {
+ case SSAM_POS_COVER_DISCONNECTED:
+ return "disconnected";
+
+ case SSAM_POS_COVER_CLOSED:
+ return "closed";
+
+ case SSAM_POS_COVER_LAPTOP:
+ return "laptop";
+
+ case SSAM_POS_COVER_FOLDED_CANVAS:
+ return "folded-canvas";
+
+ case SSAM_POS_COVER_FOLDED_BACK:
+ return "folded-back";
+
+ default:
+ dev_warn(&sw->sdev->dev, "unknown device posture for type-cover: %u\n", state);
+ return "<unknown>";
+ }
+}
+
static const char *ssam_pos_state_name_sls(struct ssam_tablet_sw *sw, u32 state)
{
switch (state) {
@@ -365,6 +398,9 @@ static const char *ssam_pos_state_name(struct ssam_tablet_sw *sw,
const struct ssam_tablet_sw_state *state)
{
switch (state->source) {
+ case SSAM_POS_SOURCE_COVER:
+ return ssam_pos_state_name_cover(sw, state->state);
+
case SSAM_POS_SOURCE_SLS:
return ssam_pos_state_name_sls(sw, state->state);
@@ -374,6 +410,24 @@ static const char *ssam_pos_state_name(struct ssam_tablet_sw *sw,
}
}
+static bool ssam_pos_state_is_tablet_mode_cover(struct ssam_tablet_sw *sw, u32 state)
+{
+ switch (state) {
+ case SSAM_POS_COVER_DISCONNECTED:
+ case SSAM_POS_COVER_FOLDED_CANVAS:
+ case SSAM_POS_COVER_FOLDED_BACK:
+ return true;
+
+ case SSAM_POS_COVER_CLOSED:
+ case SSAM_POS_COVER_LAPTOP:
+ return false;
+
+ default:
+ dev_warn(&sw->sdev->dev, "unknown device posture for type-cover: %u\n", state);
+ return true;
+ }
+}
+
static bool ssam_pos_state_is_tablet_mode_sls(struct ssam_tablet_sw *sw, u32 state)
{
switch (state) {
@@ -397,6 +451,9 @@ static bool ssam_pos_state_is_tablet_mode(struct ssam_tablet_sw *sw,
const struct ssam_tablet_sw_state *state)
{
switch (state->source) {
+ case SSAM_POS_SOURCE_COVER:
+ return ssam_pos_state_is_tablet_mode_cover(sw, state->state);
+
case SSAM_POS_SOURCE_SLS:
return ssam_pos_state_is_tablet_mode_sls(sw, state->state);
--
2.40.1
From 517b8295d0ee72a07e4d2fbea33caa62c95b6cd6 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sun, 19 Feb 2023 23:41:18 +0100
Subject: [PATCH] platform/surface: aggregator_registry: Add support for
tablet-mode switch on Surface Pro 9
Add support for the POS-subsystem tablet-mode switch used on the Surface
Pro 9.
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Patchset: surface-sam
---
drivers/platform/surface/surface_aggregator_registry.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/surface/surface_aggregator_registry.c b/drivers/platform/surface/surface_aggregator_registry.c
index 296f72d52e6a..0fe5be539652 100644
--- a/drivers/platform/surface/surface_aggregator_registry.c
+++ b/drivers/platform/surface/surface_aggregator_registry.c
@@ -305,7 +305,7 @@ static const struct software_node *ssam_node_group_sp9[] = {
&ssam_node_bat_ac,
&ssam_node_bat_main,
&ssam_node_tmp_pprof,
- /* TODO: Tablet mode switch (via POS subsystem) */
+ &ssam_node_pos_tablet_switch,
&ssam_node_hid_kip_keyboard,
&ssam_node_hid_kip_penstash,
&ssam_node_hid_kip_touchpad,
--
2.40.1
From d755c0fc01f40efdbcef5a0dce87851d192d2428 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Wed, 3 May 2023 02:02:21 +0200
Subject: [PATCH] platform/surface: aggregator: Allow completion work-items to
be executed in parallel
Currently, event completion work-items are restricted to be run strictly
in non-parallel fashion by the respective workqueue. However, this has
lead to some problems:
In some instances, the event notifier function called inside this
completion workqueue takes a non-negligible amount of time to execute.
One such example is the battery event handling code (surface_battery.c),
which can result in a full battery information refresh, involving
further synchronous communication with the EC inside the event handler.
This is made worse if the communication fails spuriously, generally
incurring a multi-second timeout.
Since the event completions are run strictly non-parallel, this blocks
other events from being propagated to the respective subsystems. This
becomes especially noticeable for keyboard and touchpad input, which
also funnel their events through this system. Here, users have reported
occasional multi-second "freezes".
Note, however, that the event handling system was never intended to run
purely sequentially. Instead, we have one work struct per EC/SAM
subsystem, processing the event queue for that subsystem. These work
structs were intended to run in parallel, allowing sequential processing
of work items for each subsystem but parallel processing of work items
across subsystems.
The only restriction to this is the way the workqueue is created.
Therefore, replace create_workqueue() with alloc_workqueue() and do not
restrict the maximum number of parallel work items to be executed on
that queue, resolving any cross-subsystem blockage.
Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem")
Link: https://github.com/linux-surface/linux-surface/issues/1026
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Patchset: surface-sam
---
drivers/platform/surface/aggregator/controller.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/surface/aggregator/controller.c b/drivers/platform/surface/aggregator/controller.c
index 535581c0471c..7fc602e01487 100644
--- a/drivers/platform/surface/aggregator/controller.c
+++ b/drivers/platform/surface/aggregator/controller.c
@@ -825,7 +825,7 @@ static int ssam_cplt_init(struct ssam_cplt *cplt, struct device *dev)
cplt->dev = dev;
- cplt->wq = create_workqueue(SSAM_CPLT_WQ_NAME);
+ cplt->wq = alloc_workqueue(SSAM_CPLT_WQ_NAME, WQ_UNBOUND | WQ_MEM_RECLAIM, 0);
if (!cplt->wq)
return -ENOMEM;
--
2.40.1
From 4bbf93ff793516e059b80c6ba46aa9acba97bc32 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Thu, 18 May 2023 22:33:55 +0200
Subject: [PATCH] platform/surface: aggregator: Make to_ssam_device_driver()
respect const-ness
Make to_ssam_device_driver() a bit safer by replacing container_of()
with container_of_const() to respect the const-ness of the passed in
pointer, instead of silently discarding any const specifications.
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Patchset: surface-sam
---
include/linux/surface_aggregator/device.h | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/include/linux/surface_aggregator/device.h b/include/linux/surface_aggregator/device.h
index df81043b9e71..42b249b4c24b 100644
--- a/include/linux/surface_aggregator/device.h
+++ b/include/linux/surface_aggregator/device.h
@@ -243,11 +243,7 @@ static inline bool is_ssam_device(struct device *d)
* Return: Returns the pointer to the &struct ssam_device_driver wrapping the
* given device driver @d.
*/
-static inline
-struct ssam_device_driver *to_ssam_device_driver(struct device_driver *d)
-{
- return container_of(d, struct ssam_device_driver, driver);
-}
+#define to_ssam_device_driver(d) container_of_const(d, struct ssam_device_driver, driver)
const struct ssam_device_id *ssam_device_id_match(const struct ssam_device_id *table,
const struct ssam_device_uid uid);
--
2.40.1
From 0090c94065225954afeb4e31ee9275f2604f9e98 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Thu, 18 May 2023 22:53:12 +0200
Subject: [PATCH] platform/surface: aggregator_tabletsw: Add support for book
mode in KIP subsystem
Devices with a type-cover have an additional "book" mode, deactivating
type-cover input and turning off its backlight. This is currently
unsupported, leading to the warning
surface_aggregator_tablet_mode_switch 01:03:01:00:01: unknown KIP cover state: 6
Therefore, add support for this state and map it to enable tablet-mode.
Fixes: 9f794056db5b ("platform/surface: Add KIP/POS tablet-mode switch driver")
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Patchset: surface-sam
---
drivers/platform/surface/surface_aggregator_tabletsw.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/platform/surface/surface_aggregator_tabletsw.c b/drivers/platform/surface/surface_aggregator_tabletsw.c
index 8f52b62d1c19..4a029f5db20a 100644
--- a/drivers/platform/surface/surface_aggregator_tabletsw.c
+++ b/drivers/platform/surface/surface_aggregator_tabletsw.c
@@ -210,6 +210,7 @@ enum ssam_kip_cover_state {
SSAM_KIP_COVER_STATE_LAPTOP = 0x03,
SSAM_KIP_COVER_STATE_FOLDED_CANVAS = 0x04,
SSAM_KIP_COVER_STATE_FOLDED_BACK = 0x05,
+ SSAM_KIP_COVER_STATE_BOOK = 0x06,
};
static const char *ssam_kip_cover_state_name(struct ssam_tablet_sw *sw,
@@ -231,6 +232,9 @@ static const char *ssam_kip_cover_state_name(struct ssam_tablet_sw *sw,
case SSAM_KIP_COVER_STATE_FOLDED_BACK:
return "folded-back";
+ case SSAM_KIP_COVER_STATE_BOOK:
+ return "book";
+
default:
dev_warn(&sw->sdev->dev, "unknown KIP cover state: %u\n", state->state);
return "<unknown>";
@@ -244,6 +248,7 @@ static bool ssam_kip_cover_state_is_tablet_mode(struct ssam_tablet_sw *sw,
case SSAM_KIP_COVER_STATE_DISCONNECTED:
case SSAM_KIP_COVER_STATE_FOLDED_CANVAS:
case SSAM_KIP_COVER_STATE_FOLDED_BACK:
+ case SSAM_KIP_COVER_STATE_BOOK:
return true;
case SSAM_KIP_COVER_STATE_CLOSED:
--
2.40.1
From 64b3ed37013345594b474ec1d513ca1409d497b1 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Thu, 18 May 2023 22:57:17 +0200
Subject: [PATCH] platform/surface: aggregator_tabletsw: Add support for book
mode in POS subsystem
Devices with a type-cover have an additional "book" mode, deactivating
type-cover input and turning off its backlight. This is currently
unsupported, leading to the warning
surface_aggregator_tablet_mode_switch 01:26:01:00:01: unknown device posture for type-cover: 6
Therefore, add support for this state and map it to enable tablet-mode.
Fixes: 37ff64cd81ff ("platform/surface: aggregator_tabletsw: Add support for Type-Cover posture source")
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Patchset: surface-sam
---
drivers/platform/surface/surface_aggregator_tabletsw.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/platform/surface/surface_aggregator_tabletsw.c b/drivers/platform/surface/surface_aggregator_tabletsw.c
index 4a029f5db20a..c0a1a5869246 100644
--- a/drivers/platform/surface/surface_aggregator_tabletsw.c
+++ b/drivers/platform/surface/surface_aggregator_tabletsw.c
@@ -340,6 +340,7 @@ enum ssam_pos_state_cover {
SSAM_POS_COVER_LAPTOP = 0x03,
SSAM_POS_COVER_FOLDED_CANVAS = 0x04,
SSAM_POS_COVER_FOLDED_BACK = 0x05,
+ SSAM_POS_COVER_BOOK = 0x06,
};
enum ssam_pos_state_sls {
@@ -372,6 +373,9 @@ static const char *ssam_pos_state_name_cover(struct ssam_tablet_sw *sw, u32 stat
case SSAM_POS_COVER_FOLDED_BACK:
return "folded-back";
+ case SSAM_POS_COVER_BOOK:
+ return "book";
+
default:
dev_warn(&sw->sdev->dev, "unknown device posture for type-cover: %u\n", state);
return "<unknown>";
@@ -421,6 +425,7 @@ static bool ssam_pos_state_is_tablet_mode_cover(struct ssam_tablet_sw *sw, u32 s
case SSAM_POS_COVER_DISCONNECTED:
case SSAM_POS_COVER_FOLDED_CANVAS:
case SSAM_POS_COVER_FOLDED_BACK:
+ case SSAM_POS_COVER_BOOK:
return true;
case SSAM_POS_COVER_CLOSED:
--
2.40.1

View file

@ -1,4 +1,4 @@
From 95b66fb97652988a7b4be5bb1deaa625e1bb3c3f Mon Sep 17 00:00:00 2001
From 62e117eb2b95baa34e8c143510227a9e8c9dd37d Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 25 Jul 2020 17:19:53 +0200
Subject: [PATCH] i2c: acpi: Implement RawBytes read access
@ -108,9 +108,9 @@ index d6037a328669..a290ebc77aea 100644
dev_warn(&adapter->dev, "protocol 0x%02x not supported for client 0x%02x\n",
accessor_type, client->addr);
--
2.44.0
2.40.1
From 2b86ac312b956799265cdd1411d305cd2dcaf6db Mon Sep 17 00:00:00 2001
From 7ec90ea0a1749bd444aa8ba5e1ff63d620785f91 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 13 Feb 2021 16:41:18 +0100
Subject: [PATCH] platform/surface: Add driver for Surface Book 1 dGPU switch
@ -331,5 +331,5 @@ index 000000000000..8b816ed8f35c
+MODULE_DESCRIPTION("Discrete GPU Power-Switch for Surface Book 1");
+MODULE_LICENSE("GPL");
--
2.44.0
2.40.1

View file

@ -1,4 +1,4 @@
From 3584a6c1791dc9c9b9c3ee846621571cbfabe37e Mon Sep 17 00:00:00 2001
From bcc1e114cfef6719a83a57c4f1a8c2499c19f04b Mon Sep 17 00:00:00 2001
From: Sachi King <nakato@nakato.io>
Date: Tue, 5 Oct 2021 00:05:09 +1100
Subject: [PATCH] Input: soc_button_array - support AMD variant Surface devices
@ -20,10 +20,10 @@ Patchset: surface-button
1 file changed, 8 insertions(+), 25 deletions(-)
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
index f6d060377d18..b8603f74eb28 100644
index 09489380afda..0f02411a60f1 100644
--- a/drivers/input/misc/soc_button_array.c
+++ b/drivers/input/misc/soc_button_array.c
@@ -540,8 +540,8 @@ static const struct soc_device_data soc_device_MSHW0028 = {
@@ -507,8 +507,8 @@ static const struct soc_device_data soc_device_MSHW0028 = {
* Both, the Surface Pro 4 (surfacepro3_button.c) and the above mentioned
* devices use MSHW0040 for power and volume buttons, however the way they
* have to be addressed differs. Make sure that we only load this drivers
@ -34,7 +34,7 @@ index f6d060377d18..b8603f74eb28 100644
*/
#define MSHW0040_DSM_REVISION 0x01
#define MSHW0040_DSM_GET_OMPR 0x02 // get OEM Platform Revision
@@ -552,31 +552,14 @@ static const guid_t MSHW0040_DSM_UUID =
@@ -519,31 +519,14 @@ static const guid_t MSHW0040_DSM_UUID =
static int soc_device_check_MSHW0040(struct device *dev)
{
acpi_handle handle = ACPI_HANDLE(dev);
@ -73,9 +73,9 @@ index f6d060377d18..b8603f74eb28 100644
/*
--
2.44.0
2.40.1
From c26bb1d0af0fe40be270d203d6aaeab28dd04a10 Mon Sep 17 00:00:00 2001
From c3ae94a83db83d0009077ff2169f89e235c9cdea Mon Sep 17 00:00:00 2001
From: Sachi King <nakato@nakato.io>
Date: Tue, 5 Oct 2021 00:22:57 +1100
Subject: [PATCH] platform/surface: surfacepro3_button: don't load on amd
@ -145,5 +145,5 @@ index 2755601f979c..4240c98ca226 100644
--
2.44.0
2.40.1

View file

@ -1,4 +1,4 @@
From b3fac417611f5bb4ae2a9bc9e828dacfe4418fbf Mon Sep 17 00:00:00 2001
From c9cc368852f53a8ef87f90819338115219ddd327 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 18 Feb 2023 01:02:49 +0100
Subject: [PATCH] USB: quirks: Add USB_QUIRK_DELAY_INIT for Surface Go 3
@ -23,10 +23,10 @@ Patchset: surface-typecover
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index b4783574b8e6..360970620589 100644
index 934b3d997702..2c6604c6e8e1 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -223,6 +223,9 @@ static const struct usb_device_id usb_quirk_list[] = {
@@ -220,6 +220,9 @@ static const struct usb_device_id usb_quirk_list[] = {
/* Microsoft Surface Dock Ethernet (RTL8153 GigE) */
{ USB_DEVICE(0x045e, 0x07c6), .driver_info = USB_QUIRK_NO_LPM },
@ -37,9 +37,9 @@ index b4783574b8e6..360970620589 100644
{ USB_DEVICE(0x046a, 0x0023), .driver_info = USB_QUIRK_RESET_RESUME },
--
2.44.0
2.40.1
From bf5167d418b660e321368222505a97d9f1ed68b4 Mon Sep 17 00:00:00 2001
From 8b2409405f787d5fcca840047b8338cd5f75b0f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
Date: Thu, 5 Nov 2020 13:09:45 +0100
Subject: [PATCH] hid/multitouch: Turn off Type Cover keyboard backlight when
@ -75,7 +75,7 @@ Patchset: surface-typecover
1 file changed, 98 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 3e91e4d6ba6f..45b7884c97f0 100644
index e31be0cb8b85..63fd042aba6b 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -34,7 +34,10 @@
@ -147,7 +147,7 @@ index 3e91e4d6ba6f..45b7884c97f0 100644
{ }
};
@@ -1721,6 +1741,69 @@ static void mt_expired_timeout(struct timer_list *t)
@@ -1728,6 +1748,69 @@ static void mt_expired_timeout(struct timer_list *t)
clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags);
}
@ -217,7 +217,7 @@ index 3e91e4d6ba6f..45b7884c97f0 100644
static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
int ret, i;
@@ -1744,6 +1827,9 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
@@ -1751,6 +1834,9 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
td->inputmode_value = MT_INPUTMODE_TOUCHSCREEN;
hid_set_drvdata(hdev, td);
@ -227,7 +227,7 @@ index 3e91e4d6ba6f..45b7884c97f0 100644
INIT_LIST_HEAD(&td->applications);
INIT_LIST_HEAD(&td->reports);
@@ -1782,15 +1868,19 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
@@ -1789,15 +1875,19 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
timer_setup(&td->release_timer, mt_expired_timeout, 0);
ret = hid_parse(hdev);
@ -249,7 +249,7 @@ index 3e91e4d6ba6f..45b7884c97f0 100644
ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group);
if (ret)
@@ -1840,6 +1930,7 @@ static void mt_remove(struct hid_device *hdev)
@@ -1849,6 +1939,7 @@ static void mt_remove(struct hid_device *hdev)
{
struct mt_device *td = hid_get_drvdata(hdev);
@ -257,7 +257,7 @@ index 3e91e4d6ba6f..45b7884c97f0 100644
del_timer_sync(&td->release_timer);
sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group);
@@ -2230,6 +2321,11 @@ static const struct hid_device_id mt_devices[] = {
@@ -2226,6 +2317,11 @@ static const struct hid_device_id mt_devices[] = {
MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
USB_DEVICE_ID_XIROKU_CSR2) },
@ -270,9 +270,9 @@ index 3e91e4d6ba6f..45b7884c97f0 100644
{ .driver_data = MT_CLS_GOOGLE,
HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_GOOGLE,
--
2.44.0
2.40.1
From dda4ca6e0248ae5acf3aaf78ee00e613f4e04bad Mon Sep 17 00:00:00 2001
From 11185cfd33079320d91f8a09939060fb7df24fa6 Mon Sep 17 00:00:00 2001
From: PJungkamp <p.jungkamp@gmail.com>
Date: Fri, 25 Feb 2022 12:04:25 +0100
Subject: [PATCH] hid/multitouch: Add support for surface pro type cover tablet
@ -301,7 +301,7 @@ Patchset: surface-typecover
1 file changed, 122 insertions(+), 26 deletions(-)
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 45b7884c97f0..f8978b405aca 100644
index 63fd042aba6b..508a250ff4bf 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -77,6 +77,7 @@ MODULE_LICENSE("GPL");
@ -454,7 +454,7 @@ index 45b7884c97f0..f8978b405aca 100644
static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
{
struct mt_device *td = hid_get_drvdata(hdev);
@@ -1659,6 +1741,13 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
@@ -1660,6 +1742,13 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
/* force BTN_STYLUS to allow tablet matching in udev */
__set_bit(BTN_STYLUS, hi->input->keybit);
break;
@ -468,7 +468,7 @@ index 45b7884c97f0..f8978b405aca 100644
default:
suffix = "UNKNOWN";
break;
@@ -1741,30 +1830,6 @@ static void mt_expired_timeout(struct timer_list *t)
@@ -1748,30 +1837,6 @@ static void mt_expired_timeout(struct timer_list *t)
clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags);
}
@ -499,7 +499,7 @@ index 45b7884c97f0..f8978b405aca 100644
static void update_keyboard_backlight(struct hid_device *hdev, bool enabled)
{
struct usb_device *udev = hid_to_usb_dev(hdev);
@@ -1773,8 +1838,9 @@ static void update_keyboard_backlight(struct hid_device *hdev, bool enabled)
@@ -1780,8 +1845,9 @@ static void update_keyboard_backlight(struct hid_device *hdev, bool enabled)
/* Wake up the device in case it's already suspended */
pm_runtime_get_sync(&udev->dev);
@ -511,7 +511,7 @@ index 45b7884c97f0..f8978b405aca 100644
hid_err(hdev, "couldn't find backlight field\n");
goto out;
}
@@ -1908,13 +1974,24 @@ static int mt_suspend(struct hid_device *hdev, pm_message_t state)
@@ -1916,13 +1982,24 @@ static int mt_suspend(struct hid_device *hdev, pm_message_t state)
static int mt_reset_resume(struct hid_device *hdev)
{
@ -536,7 +536,7 @@ index 45b7884c97f0..f8978b405aca 100644
/* Some Elan legacy devices require SET_IDLE to be set on resume.
* It should be safe to send it to other devices too.
* Tested on 3M, Stantum, Cypress, Zytronic, eGalax, and Elan panels. */
@@ -1923,12 +2000,31 @@ static int mt_resume(struct hid_device *hdev)
@@ -1931,6 +2008,10 @@ static int mt_resume(struct hid_device *hdev)
mt_set_modes(hdev, HID_LATENCY_NORMAL, true, true);
@ -546,7 +546,8 @@ index 45b7884c97f0..f8978b405aca 100644
+
return 0;
}
#endif
@@ -1938,6 +2019,21 @@ static int mt_resume(struct hid_device *hdev)
static void mt_remove(struct hid_device *hdev)
{
struct mt_device *td = hid_get_drvdata(hdev);
@ -569,5 +570,5 @@ index 45b7884c97f0..f8978b405aca 100644
unregister_pm_notifier(&td->pm_notifier);
del_timer_sync(&td->release_timer);
--
2.44.0
2.40.1

View file

@ -1,4 +1,4 @@
From b57c1784927f0ef467efdee4cb2a026d7eea3c1c Mon Sep 17 00:00:00 2001
From b0bf94fe785a83311fa078f235ee2f449ef74256 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sun, 19 Feb 2023 22:12:24 +0100
Subject: [PATCH] PCI: Add quirk to prevent calling shutdown mehtod
@ -23,7 +23,7 @@ Patchset: surface-shutdown
3 files changed, 40 insertions(+)
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 51ec9e7e784f..40554890d721 100644
index 57ddcc59af30..497cbadd2c6c 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -507,6 +507,9 @@ static void pci_device_shutdown(struct device *dev)
@ -37,13 +37,13 @@ index 51ec9e7e784f..40554890d721 100644
if (drv && drv->shutdown)
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index ae95d0950772..036af941b5e6 100644
index f4e2a88729fd..ad3cf25becfc 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -6223,3 +6223,39 @@ static void pci_fixup_d3cold_delay_1sec(struct pci_dev *pdev)
pdev->d3cold_delay = 1000;
}
DECLARE_PCI_FIXUP_FINAL(0x5555, 0x0004, pci_fixup_d3cold_delay_1sec);
@@ -6036,3 +6036,39 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9a2d, dpc_log_size);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9a2f, dpc_log_size);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9a31, dpc_log_size);
#endif
+
+static const struct dmi_system_id no_shutdown_dmi_table[] = {
+ /*
@ -81,17 +81,17 @@ index ae95d0950772..036af941b5e6 100644
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x466d, quirk_no_shutdown); // Thunderbolt 4 NHI
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x46a8, quirk_no_shutdown); // GPU
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 1596b1205b8d..608ab04a0b6c 100644
index a5dda515fcd1..69f6fc707ae5 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -465,6 +465,7 @@ struct pci_dev {
@@ -464,6 +464,7 @@ struct pci_dev {
unsigned int no_vf_scan:1; /* Don't scan for VFs after IOV enablement */
unsigned int no_command_memory:1; /* No PCI_COMMAND_MEMORY */
unsigned int rom_bar_overlap:1; /* ROM BAR disable broken */
unsigned int rom_attr_enabled:1; /* Display of ROM attribute enabled? */
+ unsigned int no_shutdown:1; /* Do not touch device on shutdown */
pci_dev_flags_t dev_flags;
atomic_t enable_cnt; /* pci_enable_device has been called */
--
2.44.0
2.40.1

View file

@ -1,4 +1,4 @@
From 36cf5399fd0f16f10f97c21131d29ebda13607f5 Mon Sep 17 00:00:00 2001
From 5ee0ac6f8e868d40002fa83e2c17c3d52b81749f Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sun, 12 Mar 2023 01:41:57 +0100
Subject: [PATCH] platform/surface: gpe: Add support for Surface Pro 9
@ -12,7 +12,7 @@ Patchset: surface-gpe
1 file changed, 17 insertions(+)
diff --git a/drivers/platform/surface/surface_gpe.c b/drivers/platform/surface/surface_gpe.c
index 62fd4004db31..103fc4468262 100644
index c219b840d491..69c4352e8406 100644
--- a/drivers/platform/surface/surface_gpe.c
+++ b/drivers/platform/surface/surface_gpe.c
@@ -41,6 +41,11 @@ static const struct property_entry lid_device_props_l4F[] = {
@ -47,5 +47,5 @@ index 62fd4004db31..103fc4468262 100644
.ident = "Surface Book 1",
.matches = {
--
2.44.0
2.40.1

View file

@ -1,4 +1,4 @@
From c01ee9d838aff57b20b6fe9d57aaae5439748680 Mon Sep 17 00:00:00 2001
From ec09656666c001b610e91600dc33529aeeb20ced Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 10 Oct 2021 20:56:57 +0200
Subject: [PATCH] ACPI: delay enumeration of devices with a _DEP pointing to an
@ -58,10 +58,10 @@ Patchset: cameras
1 file changed, 3 insertions(+)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 1d249d0f61ae..558cf449a6e2 100644
index 0c6f06abe3f4..4fc320f424e8 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -2113,6 +2113,9 @@ static acpi_status acpi_bus_check_add_2(acpi_handle handle, u32 lvl_not_used,
@@ -2106,6 +2106,9 @@ static acpi_status acpi_bus_check_add_2(acpi_handle handle, u32 lvl_not_used,
static void acpi_default_enumeration(struct acpi_device *device)
{
@ -72,9 +72,9 @@ index 1d249d0f61ae..558cf449a6e2 100644
* Do not enumerate devices with enumeration_by_parent flag set as
* they will be enumerated by their respective parents.
--
2.44.0
2.40.1
From 992be6ed831018a7673a0424adad595c44475de7 Mon Sep 17 00:00:00 2001
From e9b690e2ecbc09834b84f10671c0a44d2dd59c56 Mon Sep 17 00:00:00 2001
From: zouxiaoh <xiaohong.zou@intel.com>
Date: Fri, 25 Jun 2021 08:52:59 +0800
Subject: [PATCH] iommu: intel-ipu: use IOMMU passthrough mode for Intel IPUs
@ -100,10 +100,10 @@ Patchset: cameras
1 file changed, 30 insertions(+)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 0cbe3a521254..9f3df5662889 100644
index 3ebd2260cdab..f8937235de4b 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -38,6 +38,12 @@
@@ -37,6 +37,12 @@
#define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY)
#define IS_USB_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_SERIAL_USB)
#define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA)
@ -116,7 +116,7 @@ index 0cbe3a521254..9f3df5662889 100644
#define IS_IPTS(pdev) ((pdev)->vendor == PCI_VENDOR_ID_INTEL && \
((pdev)->device == 0x9d3e))
#define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e)
@@ -295,12 +301,14 @@ EXPORT_SYMBOL_GPL(intel_iommu_enabled);
@@ -290,12 +296,14 @@ EXPORT_SYMBOL_GPL(intel_iommu_enabled);
static int dmar_map_gfx = 1;
static int dmar_map_ipts = 1;
@ -131,7 +131,7 @@ index 0cbe3a521254..9f3df5662889 100644
#define IDENTMAP_IPTS 16
const struct iommu_ops intel_iommu_ops;
@@ -2550,6 +2558,9 @@ static int device_def_domain_type(struct device *dev)
@@ -2593,6 +2601,9 @@ static int device_def_domain_type(struct device *dev)
if ((iommu_identity_mapping & IDENTMAP_GFX) && IS_GFX_DEVICE(pdev))
return IOMMU_DOMAIN_IDENTITY;
@ -141,7 +141,7 @@ index 0cbe3a521254..9f3df5662889 100644
if ((iommu_identity_mapping & IDENTMAP_IPTS) && IS_IPTS(pdev))
return IOMMU_DOMAIN_IDENTITY;
}
@@ -2859,6 +2870,9 @@ static int __init init_dmars(void)
@@ -2984,6 +2995,9 @@ static int __init init_dmars(void)
if (!dmar_map_gfx)
iommu_identity_mapping |= IDENTMAP_GFX;
@ -151,7 +151,7 @@ index 0cbe3a521254..9f3df5662889 100644
if (!dmar_map_ipts)
iommu_identity_mapping |= IDENTMAP_IPTS;
@@ -4842,6 +4856,18 @@ static void quirk_iommu_igfx(struct pci_dev *dev)
@@ -4829,6 +4843,18 @@ static void quirk_iommu_igfx(struct pci_dev *dev)
dmar_map_gfx = 0;
}
@ -170,7 +170,7 @@ index 0cbe3a521254..9f3df5662889 100644
static void quirk_iommu_ipts(struct pci_dev *dev)
{
if (!IS_IPTS(dev))
@@ -4853,6 +4879,7 @@ static void quirk_iommu_ipts(struct pci_dev *dev)
@@ -4840,6 +4866,7 @@ static void quirk_iommu_ipts(struct pci_dev *dev)
pci_info(dev, "Passthrough IOMMU for IPTS\n");
dmar_map_ipts = 0;
}
@ -178,7 +178,7 @@ index 0cbe3a521254..9f3df5662889 100644
/* G4x/GM45 integrated gfx dmar support is totally busted. */
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_igfx);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e00, quirk_iommu_igfx);
@@ -4888,6 +4915,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1632, quirk_iommu_igfx);
@@ -4875,6 +4902,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1632, quirk_iommu_igfx);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x163A, quirk_iommu_igfx);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x163D, quirk_iommu_igfx);
@ -189,9 +189,9 @@ index 0cbe3a521254..9f3df5662889 100644
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9D3E, quirk_iommu_ipts);
--
2.44.0
2.40.1
From a3e7ba42e2b2cce37b0d4987fde18c745139c19b Mon Sep 17 00:00:00 2001
From 1487f4ad2ed8b38a7905b34ab8f5d9f0566ffa7e Mon Sep 17 00:00:00 2001
From: Daniel Scally <djrscally@gmail.com>
Date: Sun, 10 Oct 2021 20:57:02 +0200
Subject: [PATCH] platform/x86: int3472: Enable I2c daisy chain
@ -208,7 +208,7 @@ Patchset: cameras
1 file changed, 7 insertions(+)
diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c
index 1e107fd49f82..e3e1696e7f0e 100644
index 5b8d1a9620a5..6a0ff035cf20 100644
--- a/drivers/platform/x86/intel/int3472/tps68470.c
+++ b/drivers/platform/x86/intel/int3472/tps68470.c
@@ -46,6 +46,13 @@ static int tps68470_chip_init(struct device *dev, struct regmap *regmap)
@ -226,9 +226,700 @@ index 1e107fd49f82..e3e1696e7f0e 100644
return 0;
--
2.44.0
2.40.1
From 9caa85a76f4310dd758c406b7754907ebdbb3931 Mon Sep 17 00:00:00 2001
From c827cbe45bb51de44104dc68cf040d7e7a9e2768 Mon Sep 17 00:00:00 2001
From: Daniel Scally <djrscally@gmail.com>
Date: Wed, 4 May 2022 23:21:45 +0100
Subject: [PATCH] media: ipu3-cio2: Move functionality from .complete() to
.bound()
Creating links and registering subdev nodes during the .complete()
callback has the unfortunate effect of preventing all cameras that
connect to a notifier from working if any one of their drivers fails
to probe. Moving the functionality from .complete() to .bound() allows
those camera sensor drivers that did probe correctly to work regardless.
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Patchset: cameras
---
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 65 +++++++------------
1 file changed, 23 insertions(+), 42 deletions(-)
diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
index 3b76a9d0383a..38f9f4da1922 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
@@ -1383,7 +1383,10 @@ static int cio2_notifier_bound(struct v4l2_async_notifier *notifier,
{
struct cio2_device *cio2 = to_cio2_device(notifier);
struct sensor_async_subdev *s_asd = to_sensor_asd(asd);
+ struct device *dev = &cio2->pci_dev->dev;
struct cio2_queue *q;
+ unsigned int pad;
+ int ret;
if (cio2->queue[s_asd->csi2.port].sensor)
return -EBUSY;
@@ -1394,7 +1397,26 @@ static int cio2_notifier_bound(struct v4l2_async_notifier *notifier,
q->sensor = sd;
q->csi_rx_base = cio2->base + CIO2_REG_PIPE_BASE(q->csi2.port);
- return 0;
+ for (pad = 0; pad < q->sensor->entity.num_pads; pad++)
+ if (q->sensor->entity.pads[pad].flags &
+ MEDIA_PAD_FL_SOURCE)
+ break;
+
+ if (pad == q->sensor->entity.num_pads) {
+ dev_err(dev, "failed to find src pad for %s\n",
+ q->sensor->name);
+ return -ENXIO;
+ }
+
+ ret = media_create_pad_link(&q->sensor->entity, pad, &q->subdev.entity,
+ CIO2_PAD_SINK, 0);
+ if (ret) {
+ dev_err(dev, "failed to create link for %s\n",
+ q->sensor->name);
+ return ret;
+ }
+
+ return v4l2_device_register_subdev_nodes(&cio2->v4l2_dev);
}
/* The .unbind callback */
@@ -1408,50 +1430,9 @@ static void cio2_notifier_unbind(struct v4l2_async_notifier *notifier,
cio2->queue[s_asd->csi2.port].sensor = NULL;
}
-/* .complete() is called after all subdevices have been located */
-static int cio2_notifier_complete(struct v4l2_async_notifier *notifier)
-{
- struct cio2_device *cio2 = to_cio2_device(notifier);
- struct device *dev = &cio2->pci_dev->dev;
- struct sensor_async_subdev *s_asd;
- struct v4l2_async_subdev *asd;
- struct cio2_queue *q;
- unsigned int pad;
- int ret;
-
- list_for_each_entry(asd, &cio2->notifier.asd_list, asd_list) {
- s_asd = to_sensor_asd(asd);
- q = &cio2->queue[s_asd->csi2.port];
-
- for (pad = 0; pad < q->sensor->entity.num_pads; pad++)
- if (q->sensor->entity.pads[pad].flags &
- MEDIA_PAD_FL_SOURCE)
- break;
-
- if (pad == q->sensor->entity.num_pads) {
- dev_err(dev, "failed to find src pad for %s\n",
- q->sensor->name);
- return -ENXIO;
- }
-
- ret = media_create_pad_link(
- &q->sensor->entity, pad,
- &q->subdev.entity, CIO2_PAD_SINK,
- 0);
- if (ret) {
- dev_err(dev, "failed to create link for %s\n",
- q->sensor->name);
- return ret;
- }
- }
-
- return v4l2_device_register_subdev_nodes(&cio2->v4l2_dev);
-}
-
static const struct v4l2_async_notifier_operations cio2_async_ops = {
.bound = cio2_notifier_bound,
.unbind = cio2_notifier_unbind,
- .complete = cio2_notifier_complete,
};
static int cio2_parse_firmware(struct cio2_device *cio2)
--
2.40.1
From 039d2340085e21bcad5e68b7b926d1e10a7755e7 Mon Sep 17 00:00:00 2001
From: Daniel Scally <djrscally@gmail.com>
Date: Thu, 2 Jun 2022 22:15:56 +0100
Subject: [PATCH] media: ipu3-cio2: Re-add .complete() to ipu3-cio2
Removing the .complete() callback had some unintended consequences.
Because the VCM driver is not directly linked to the ipu3-cio2
driver .bound() never gets called for it, which means its devnode
is never created if it probes late. Because .complete() waits for
any sub-notifiers to also be complete it is captured in that call.
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Patchset: cameras
---
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
index 38f9f4da1922..82681df7d794 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
@@ -1430,9 +1430,18 @@ static void cio2_notifier_unbind(struct v4l2_async_notifier *notifier,
cio2->queue[s_asd->csi2.port].sensor = NULL;
}
+/* .complete() is called after all subdevices have been located */
+static int cio2_notifier_complete(struct v4l2_async_notifier *notifier)
+{
+ struct cio2_device *cio2 = to_cio2_device(notifier);
+
+ return v4l2_device_register_subdev_nodes(&cio2->v4l2_dev);
+}
+
static const struct v4l2_async_notifier_operations cio2_async_ops = {
.bound = cio2_notifier_bound,
.unbind = cio2_notifier_unbind,
+ .complete = cio2_notifier_complete,
};
static int cio2_parse_firmware(struct cio2_device *cio2)
--
2.40.1
From f70f763ca5d030731c2db01ea2afb29e63f063d3 Mon Sep 17 00:00:00 2001
From: Daniel Scally <djrscally@gmail.com>
Date: Thu, 28 Oct 2021 21:55:16 +0100
Subject: [PATCH] media: i2c: Add driver for DW9719 VCM
Add a driver for the DW9719 VCM. The driver creates a v4l2 subdevice
and registers a control to set the desired focus.
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Patchset: cameras
---
MAINTAINERS | 7 +
drivers/media/i2c/Kconfig | 11 +
drivers/media/i2c/Makefile | 1 +
drivers/media/i2c/dw9719.c | 425 +++++++++++++++++++++++++++++++++++++
4 files changed, 444 insertions(+)
create mode 100644 drivers/media/i2c/dw9719.c
diff --git a/MAINTAINERS b/MAINTAINERS
index c6545eb54104..a197e0a54eed 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6237,6 +6237,13 @@ T: git git://linuxtv.org/media_tree.git
F: Documentation/devicetree/bindings/media/i2c/dongwoon,dw9714.yaml
F: drivers/media/i2c/dw9714.c
+DONGWOON DW9719 LENS VOICE COIL DRIVER
+M: Daniel Scally <djrscally@gmail.com>
+L: linux-media@vger.kernel.org
+S: Maintained
+T: git git://linuxtv.org/media_tree.git
+F: drivers/media/i2c/dw9719.c
+
DONGWOON DW9768 LENS VOICE COIL DRIVER
M: Dongchun Zhu <dongchun.zhu@mediatek.com>
L: linux-media@vger.kernel.org
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index c3d5952ca27e..e759470a0b6b 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -887,6 +887,17 @@ config VIDEO_DW9714
capability. This is designed for linear control of
voice coil motors, controlled via I2C serial interface.
+config VIDEO_DW9719
+ tristate "DW9719 lens voice coil support"
+ depends on I2C && VIDEO_V4L2
+ select MEDIA_CONTROLLER
+ select VIDEO_V4L2_SUBDEV_API
+ select V4L2_ASYNC
+ help
+ This is a driver for the DW9719 camera lens voice coil.
+ This is designed for linear control of voice coil motors,
+ controlled via I2C serial interface.
+
config VIDEO_DW9768
tristate "DW9768 lens voice coil support"
depends on I2C && VIDEO_DEV
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 4f5e9d9cee85..eef3ee84d7dc 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -30,6 +30,7 @@ obj-$(CONFIG_VIDEO_CS5345) += cs5345.o
obj-$(CONFIG_VIDEO_CS53L32A) += cs53l32a.o
obj-$(CONFIG_VIDEO_CX25840) += cx25840/
obj-$(CONFIG_VIDEO_DW9714) += dw9714.o
+obj-$(CONFIG_VIDEO_DW9719) += dw9719.o
obj-$(CONFIG_VIDEO_DW9768) += dw9768.o
obj-$(CONFIG_VIDEO_DW9807_VCM) += dw9807-vcm.o
obj-$(CONFIG_VIDEO_ET8EK8) += et8ek8/
diff --git a/drivers/media/i2c/dw9719.c b/drivers/media/i2c/dw9719.c
new file mode 100644
index 000000000000..180b04d2a6b3
--- /dev/null
+++ b/drivers/media/i2c/dw9719.c
@@ -0,0 +1,425 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2012 Intel Corporation
+
+/*
+ * Based on linux/modules/camera/drivers/media/i2c/imx/dw9719.c in this repo:
+ * https://github.com/ZenfoneArea/android_kernel_asus_zenfone5
+ */
+
+#include <asm/unaligned.h>
+
+#include <linux/delay.h>
+#include <linux/i2c.h>
+#include <linux/pm_runtime.h>
+#include <linux/regulator/consumer.h>
+#include <linux/types.h>
+
+#include <media/v4l2-common.h>
+#include <media/v4l2-ctrls.h>
+#include <media/v4l2-subdev.h>
+
+#define DW9719_MAX_FOCUS_POS 1023
+#define DW9719_CTRL_STEPS 16
+#define DW9719_CTRL_DELAY_US 1000
+#define DELAY_MAX_PER_STEP_NS (1000000 * 1023)
+
+#define DW9719_INFO 0
+#define DW9719_ID 0xF1
+#define DW9719_CONTROL 2
+#define DW9719_VCM_CURRENT 3
+
+#define DW9719_MODE 6
+#define DW9719_VCM_FREQ 7
+
+#define DW9719_MODE_SAC3 0x40
+#define DW9719_DEFAULT_VCM_FREQ 0x60
+#define DW9719_ENABLE_RINGING 0x02
+
+#define NUM_REGULATORS 2
+
+#define to_dw9719_device(x) container_of(x, struct dw9719_device, sd)
+
+struct dw9719_device {
+ struct device *dev;
+ struct i2c_client *client;
+ struct regulator_bulk_data regulators[NUM_REGULATORS];
+ struct v4l2_subdev sd;
+
+ struct dw9719_v4l2_ctrls {
+ struct v4l2_ctrl_handler handler;
+ struct v4l2_ctrl *focus;
+ } ctrls;
+};
+
+static int dw9719_i2c_rd8(struct i2c_client *client, u8 reg, u8 *val)
+{
+ struct i2c_msg msg[2];
+ u8 buf[2] = { reg };
+ int ret;
+
+ msg[0].addr = client->addr;
+ msg[0].flags = 0;
+ msg[0].len = 1;
+ msg[0].buf = buf;
+
+ msg[1].addr = client->addr;
+ msg[1].flags = I2C_M_RD;
+ msg[1].len = 1;
+ msg[1].buf = &buf[1];
+ *val = 0;
+
+ ret = i2c_transfer(client->adapter, msg, 2);
+ if (ret < 0)
+ return ret;
+
+ *val = buf[1];
+
+ return 0;
+}
+
+static int dw9719_i2c_wr8(struct i2c_client *client, u8 reg, u8 val)
+{
+ struct i2c_msg msg;
+ int ret;
+
+ u8 buf[2] = { reg, val };
+
+ msg.addr = client->addr;
+ msg.flags = 0;
+ msg.len = sizeof(buf);
+ msg.buf = buf;
+
+ ret = i2c_transfer(client->adapter, &msg, 1);
+
+ return ret < 0 ? ret : 0;
+}
+
+static int dw9719_i2c_wr16(struct i2c_client *client, u8 reg, u16 val)
+{
+ struct i2c_msg msg;
+ u8 buf[3] = { reg };
+ int ret;
+
+ put_unaligned_be16(val, buf + 1);
+
+ msg.addr = client->addr;
+ msg.flags = 0;
+ msg.len = sizeof(buf);
+ msg.buf = buf;
+
+ ret = i2c_transfer(client->adapter, &msg, 1);
+
+ return ret < 0 ? ret : 0;
+}
+
+static int dw9719_detect(struct dw9719_device *dw9719)
+{
+ int ret;
+ u8 val;
+
+ ret = dw9719_i2c_rd8(dw9719->client, DW9719_INFO, &val);
+ if (ret < 0)
+ return ret;
+
+ if (val != DW9719_ID) {
+ dev_err(dw9719->dev, "Failed to detect correct id\n");
+ ret = -ENXIO;
+ }
+
+ return 0;
+}
+
+static int dw9719_power_down(struct dw9719_device *dw9719)
+{
+ return regulator_bulk_disable(NUM_REGULATORS, dw9719->regulators);
+}
+
+static int dw9719_power_up(struct dw9719_device *dw9719)
+{
+ int ret;
+
+ ret = regulator_bulk_enable(NUM_REGULATORS, dw9719->regulators);
+ if (ret)
+ return ret;
+
+ /* Jiggle SCL pin to wake up device */
+ ret = dw9719_i2c_wr8(dw9719->client, DW9719_CONTROL, 1);
+
+ /* Need 100us to transit from SHUTDOWN to STANDBY*/
+ usleep_range(100, 1000);
+
+ ret = dw9719_i2c_wr8(dw9719->client, DW9719_CONTROL,
+ DW9719_ENABLE_RINGING);
+ if (ret < 0)
+ goto fail_powerdown;
+
+ ret = dw9719_i2c_wr8(dw9719->client, DW9719_MODE, DW9719_MODE_SAC3);
+ if (ret < 0)
+ goto fail_powerdown;
+
+ ret = dw9719_i2c_wr8(dw9719->client, DW9719_VCM_FREQ,
+ DW9719_DEFAULT_VCM_FREQ);
+ if (ret < 0)
+ goto fail_powerdown;
+
+ return 0;
+
+fail_powerdown:
+ dw9719_power_down(dw9719);
+ return ret;
+}
+
+static int dw9719_t_focus_abs(struct dw9719_device *dw9719, s32 value)
+{
+ int ret;
+
+ value = clamp(value, 0, DW9719_MAX_FOCUS_POS);
+ ret = dw9719_i2c_wr16(dw9719->client, DW9719_VCM_CURRENT, value);
+ if (ret < 0)
+ return ret;
+
+ return 0;
+}
+
+static int dw9719_set_ctrl(struct v4l2_ctrl *ctrl)
+{
+ struct dw9719_device *dw9719 = container_of(ctrl->handler,
+ struct dw9719_device,
+ ctrls.handler);
+ int ret;
+
+ /* Only apply changes to the controls if the device is powered up */
+ if (!pm_runtime_get_if_in_use(dw9719->dev))
+ return 0;
+
+ switch (ctrl->id) {
+ case V4L2_CID_FOCUS_ABSOLUTE:
+ ret = dw9719_t_focus_abs(dw9719, ctrl->val);
+ break;
+ default:
+ ret = -EINVAL;
+ }
+
+ pm_runtime_put(dw9719->dev);
+
+ return ret;
+}
+
+static const struct v4l2_ctrl_ops dw9719_ctrl_ops = {
+ .s_ctrl = dw9719_set_ctrl,
+};
+
+static int __maybe_unused dw9719_suspend(struct device *dev)
+{
+ struct v4l2_subdev *sd = dev_get_drvdata(dev);
+ struct dw9719_device *dw9719 = to_dw9719_device(sd);
+ int ret;
+ int val;
+
+ for (val = dw9719->ctrls.focus->val; val >= 0;
+ val -= DW9719_CTRL_STEPS) {
+ ret = dw9719_t_focus_abs(dw9719, val);
+ if (ret)
+ return ret;
+
+ usleep_range(DW9719_CTRL_DELAY_US, DW9719_CTRL_DELAY_US + 10);
+ }
+
+ return dw9719_power_down(dw9719);
+}
+
+static int __maybe_unused dw9719_resume(struct device *dev)
+{
+ struct v4l2_subdev *sd = dev_get_drvdata(dev);
+ struct dw9719_device *dw9719 = to_dw9719_device(sd);
+ int current_focus = dw9719->ctrls.focus->val;
+ int ret;
+ int val;
+
+ ret = dw9719_power_up(dw9719);
+ if (ret)
+ return ret;
+
+ for (val = current_focus % DW9719_CTRL_STEPS; val < current_focus;
+ val += DW9719_CTRL_STEPS) {
+ ret = dw9719_t_focus_abs(dw9719, val);
+ if (ret)
+ goto err_power_down;
+
+ usleep_range(DW9719_CTRL_DELAY_US, DW9719_CTRL_DELAY_US + 10);
+ }
+
+ return 0;
+
+err_power_down:
+ dw9719_power_down(dw9719);
+ return ret;
+}
+
+static int dw9719_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
+{
+ return pm_runtime_resume_and_get(sd->dev);
+}
+
+static int dw9719_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
+{
+ pm_runtime_put(sd->dev);
+
+ return 0;
+}
+
+static const struct v4l2_subdev_internal_ops dw9719_internal_ops = {
+ .open = dw9719_open,
+ .close = dw9719_close,
+};
+
+static int dw9719_init_controls(struct dw9719_device *dw9719)
+{
+ const struct v4l2_ctrl_ops *ops = &dw9719_ctrl_ops;
+ int ret;
+
+ ret = v4l2_ctrl_handler_init(&dw9719->ctrls.handler, 1);
+ if (ret)
+ return ret;
+
+ dw9719->ctrls.focus = v4l2_ctrl_new_std(&dw9719->ctrls.handler, ops,
+ V4L2_CID_FOCUS_ABSOLUTE, 0,
+ DW9719_MAX_FOCUS_POS, 1, 0);
+
+ if (dw9719->ctrls.handler.error) {
+ dev_err(dw9719->dev, "Error initialising v4l2 ctrls\n");
+ ret = dw9719->ctrls.handler.error;
+ goto err_free_handler;
+ }
+
+ dw9719->sd.ctrl_handler = &dw9719->ctrls.handler;
+
+ return ret;
+
+err_free_handler:
+ v4l2_ctrl_handler_free(&dw9719->ctrls.handler);
+ return ret;
+}
+
+static const struct v4l2_subdev_ops dw9719_ops = { };
+
+static int dw9719_probe(struct i2c_client *client)
+{
+ struct dw9719_device *dw9719;
+ int ret;
+
+ dw9719 = devm_kzalloc(&client->dev, sizeof(*dw9719), GFP_KERNEL);
+ if (!dw9719)
+ return -ENOMEM;
+
+ dw9719->client = client;
+ dw9719->dev = &client->dev;
+
+ dw9719->regulators[0].supply = "vdd";
+ /*
+ * The DW9719 has only the 1 VDD voltage input, but some PMICs such as
+ * the TPS68470 PMIC have I2C passthrough capability, to disconnect the
+ * sensor's I2C pins from the I2C bus when the sensors VSIO (Sensor-IO)
+ * is off, because some sensors then short these pins to ground;
+ * and the DW9719 might sit behind this passthrough, this it needs to
+ * enable VSIO as that will also enable the I2C passthrough.
+ */
+ dw9719->regulators[1].supply = "vsio";
+
+ ret = devm_regulator_bulk_get(&client->dev, NUM_REGULATORS,
+ dw9719->regulators);
+ if (ret)
+ return dev_err_probe(&client->dev, ret, "getting regulators\n");
+
+ v4l2_i2c_subdev_init(&dw9719->sd, client, &dw9719_ops);
+ dw9719->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+ dw9719->sd.internal_ops = &dw9719_internal_ops;
+
+ ret = dw9719_init_controls(dw9719);
+ if (ret)
+ return ret;
+
+ ret = media_entity_pads_init(&dw9719->sd.entity, 0, NULL);
+ if (ret < 0)
+ goto err_free_ctrl_handler;
+
+ dw9719->sd.entity.function = MEDIA_ENT_F_LENS;
+
+ /*
+ * We need the driver to work in the event that pm runtime is disable in
+ * the kernel, so power up and verify the chip now. In the event that
+ * runtime pm is disabled this will leave the chip on, so that the lens
+ * will work.
+ */
+
+ ret = dw9719_power_up(dw9719);
+ if (ret)
+ goto err_cleanup_media;
+
+ ret = dw9719_detect(dw9719);
+ if (ret)
+ goto err_powerdown;
+
+ pm_runtime_set_active(&client->dev);
+ pm_runtime_get_noresume(&client->dev);
+ pm_runtime_enable(&client->dev);
+
+ ret = v4l2_async_register_subdev(&dw9719->sd);
+ if (ret < 0)
+ goto err_pm_runtime;
+
+ pm_runtime_set_autosuspend_delay(&client->dev, 1000);
+ pm_runtime_use_autosuspend(&client->dev);
+ pm_runtime_put_autosuspend(&client->dev);
+
+ return ret;
+
+err_pm_runtime:
+ pm_runtime_disable(&client->dev);
+ pm_runtime_put_noidle(&client->dev);
+err_powerdown:
+ dw9719_power_down(dw9719);
+err_cleanup_media:
+ media_entity_cleanup(&dw9719->sd.entity);
+err_free_ctrl_handler:
+ v4l2_ctrl_handler_free(&dw9719->ctrls.handler);
+
+ return ret;
+}
+
+static void dw9719_remove(struct i2c_client *client)
+{
+ struct v4l2_subdev *sd = i2c_get_clientdata(client);
+ struct dw9719_device *dw9719 = container_of(sd, struct dw9719_device,
+ sd);
+
+ pm_runtime_disable(&client->dev);
+ v4l2_async_unregister_subdev(sd);
+ v4l2_ctrl_handler_free(&dw9719->ctrls.handler);
+ media_entity_cleanup(&dw9719->sd.entity);
+}
+
+static const struct i2c_device_id dw9719_id_table[] = {
+ { "dw9719" },
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, dw9719_id_table);
+
+static const struct dev_pm_ops dw9719_pm_ops = {
+ SET_RUNTIME_PM_OPS(dw9719_suspend, dw9719_resume, NULL)
+};
+
+static struct i2c_driver dw9719_i2c_driver = {
+ .driver = {
+ .name = "dw9719",
+ .pm = &dw9719_pm_ops,
+ },
+ .probe_new = dw9719_probe,
+ .remove = dw9719_remove,
+ .id_table = dw9719_id_table,
+};
+module_i2c_driver(dw9719_i2c_driver);
+
+MODULE_AUTHOR("Daniel Scally <djrscally@gmail.com>");
+MODULE_DESCRIPTION("DW9719 VCM Driver");
+MODULE_LICENSE("GPL");
--
2.40.1
From de4c986ae352ae75b578196693785eba1e7ed76d Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Fri, 15 Jul 2022 23:48:00 +0200
Subject: [PATCH] drivers/media/i2c: Fix DW9719 dependencies
It should depend on VIDEO_DEV instead of VIDEO_V4L2.
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Patchset: cameras
---
drivers/media/i2c/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index e759470a0b6b..dbc6d20efbe5 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -889,7 +889,7 @@ config VIDEO_DW9714
config VIDEO_DW9719
tristate "DW9719 lens voice coil support"
- depends on I2C && VIDEO_V4L2
+ depends on I2C && VIDEO_DEV
select MEDIA_CONTROLLER
select VIDEO_V4L2_SUBDEV_API
select V4L2_ASYNC
--
2.40.1
From c9e81c233bb7dd14e5d702438979de7bbe43d7e5 Mon Sep 17 00:00:00 2001
From: Daniel Scally <dan.scally@ideasonboard.com>
Date: Thu, 2 Mar 2023 12:59:39 +0000
Subject: [PATCH] platform/x86: int3472: Remap reset GPIO for INT347E
@ -250,12 +941,12 @@ Patchset: cameras
1 file changed, 14 insertions(+)
diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c
index e33c2d75975c..c0c90ae66b70 100644
index f064da74f50a..2064b3bbe530 100644
--- a/drivers/platform/x86/intel/int3472/discrete.c
+++ b/drivers/platform/x86/intel/int3472/discrete.c
@@ -57,6 +57,9 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347
const char *func, u32 polarity)
@@ -98,6 +98,9 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347
{
const struct int3472_sensor_config *sensor_config;
char *path = agpio->resource_source.string_ptr;
+ const struct acpi_device_id ov7251_ids[] = {
+ { "INT347E" },
@ -263,8 +954,8 @@ index e33c2d75975c..c0c90ae66b70 100644
struct gpiod_lookup *table_entry;
struct acpi_device *adev;
acpi_handle handle;
@@ -67,6 +70,17 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347
return -EINVAL;
@@ -120,6 +123,17 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347
}
}
+ /*
@ -278,13 +969,13 @@ index e33c2d75975c..c0c90ae66b70 100644
+ polarity = GPIO_ACTIVE_HIGH;
+ }
+
status = acpi_get_handle(NULL, path, &handle);
if (ACPI_FAILURE(status))
return -EINVAL;
/* Functions mapped to NULL should not be mapped to the sensor */
if (!func)
return 0;
--
2.44.0
2.40.1
From 3ede4c09a68bc8ee1820986f865133c3cd188f2e Mon Sep 17 00:00:00 2001
From 62cdeb5122bab9ab731d059155bfddc58f7ca0dc Mon Sep 17 00:00:00 2001
From: Daniel Scally <dan.scally@ideasonboard.com>
Date: Tue, 21 Mar 2023 13:45:26 +0000
Subject: [PATCH] media: i2c: Clarify that gain is Analogue gain in OV7251
@ -299,7 +990,7 @@ Patchset: cameras
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c
index 675fb37a6fea..43b30db08c9e 100644
index 88e987435285..ff7b2c26da83 100644
--- a/drivers/media/i2c/ov7251.c
+++ b/drivers/media/i2c/ov7251.c
@@ -1051,7 +1051,7 @@ static int ov7251_s_ctrl(struct v4l2_ctrl *ctrl)
@ -321,9 +1012,9 @@ index 675fb37a6fea..43b30db08c9e 100644
V4L2_CID_TEST_PATTERN,
ARRAY_SIZE(ov7251_test_pattern_menu) - 1,
--
2.44.0
2.40.1
From 7161e88bfd849eb77ad8dcf5111ebc4a3f8c3fd4 Mon Sep 17 00:00:00 2001
From dd119debd4a323d4310c28fb83897b02a64e1d6b Mon Sep 17 00:00:00 2001
From: Daniel Scally <dan.scally@ideasonboard.com>
Date: Wed, 22 Mar 2023 11:01:42 +0000
Subject: [PATCH] media: v4l2-core: Acquire privacy led in
@ -342,27 +1033,27 @@ Patchset: cameras
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index 091e8cf4114b..cca10f535584 100644
index b16b5f4cb91e..33739a979cbc 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -796,6 +796,10 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd)
INIT_LIST_HEAD(&sd->asc_list);
@@ -760,6 +760,10 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd)
struct v4l2_async_notifier *notifier;
int ret;
+ ret = v4l2_subdev_get_privacy_led(sd);
+ if (ret < 0)
+ return ret;
+
/*
* No reference taken. The reference is held by the device (struct
* v4l2_subdev.dev), and async sub-device does not exist independently
* No reference taken. The reference is held by the device
* (struct v4l2_subdev.dev), and async sub-device does not
diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c
index 7f181fbbb140..1c0347de4e21 100644
index 049c2f2001ea..f8c3e40b2b71 100644
--- a/drivers/media/v4l2-core/v4l2-fwnode.c
+++ b/drivers/media/v4l2-core/v4l2-fwnode.c
@@ -1217,10 +1217,6 @@ int v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd)
@@ -1304,10 +1304,6 @@ int v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd)
v4l2_async_subdev_nf_init(notifier, sd);
v4l2_async_nf_init(notifier);
- ret = v4l2_subdev_get_privacy_led(sd);
- if (ret < 0)
@ -372,9 +1063,9 @@ index 7f181fbbb140..1c0347de4e21 100644
if (ret < 0)
goto out_cleanup;
--
2.44.0
2.40.1
From aab439d9ca04f9e56b1573fb6fe666acd6ecc0fa Mon Sep 17 00:00:00 2001
From 98f45a697ea77058a84ceb93d9fe5736fbf32c4c Mon Sep 17 00:00:00 2001
From: Kate Hsuan <hpa@redhat.com>
Date: Tue, 21 Mar 2023 23:37:16 +0800
Subject: [PATCH] platform: x86: int3472: Add MFD cell for tps68470 LED
@ -390,7 +1081,7 @@ Patchset: cameras
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c
index e3e1696e7f0e..423dc555093f 100644
index 6a0ff035cf20..2a7d01d3abc8 100644
--- a/drivers/platform/x86/intel/int3472/tps68470.c
+++ b/drivers/platform/x86/intel/int3472/tps68470.c
@@ -17,7 +17,7 @@
@ -413,9 +1104,9 @@ index e3e1696e7f0e..423dc555093f 100644
for (i = 0; i < board_data->n_gpiod_lookups; i++)
gpiod_add_lookup_table(board_data->tps68470_gpio_lookup_tables[i]);
--
2.44.0
2.40.1
From 110530f6b622a9f4ae2308d684d7624be69218f9 Mon Sep 17 00:00:00 2001
From 960c31a09178852085dcfe0ea6babd45018d59f2 Mon Sep 17 00:00:00 2001
From: Kate Hsuan <hpa@redhat.com>
Date: Tue, 21 Mar 2023 23:37:17 +0800
Subject: [PATCH] include: mfd: tps68470: Add masks for LEDA and LEDB
@ -454,9 +1145,9 @@ index 7807fa329db0..2d2abb25b944 100644
+
#endif /* __LINUX_MFD_TPS68470_H */
--
2.44.0
2.40.1
From 9353e9a63ccf0ffca8a097c4ebee7674f8a67d11 Mon Sep 17 00:00:00 2001
From eb4aaa36f8f989a70c4b3b8de9c61ac3d447ae14 Mon Sep 17 00:00:00 2001
From: Kate Hsuan <hpa@redhat.com>
Date: Tue, 21 Mar 2023 23:37:18 +0800
Subject: [PATCH] leds: tps68470: Add LED control for tps68470
@ -479,10 +1170,10 @@ Patchset: cameras
create mode 100644 drivers/leds/leds-tps68470.c
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index b92208eccdea..312c0c21cc5e 100644
index aaa9140bc351..1fb892c9acf1 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -873,6 +873,18 @@ config LEDS_TPS6105X
@@ -827,6 +827,18 @@ config LEDS_TPS6105X
It is a single boost converter primarily for white LEDs and
audio amplifiers.
@ -502,10 +1193,10 @@ index b92208eccdea..312c0c21cc5e 100644
tristate "LED support for SGI Octane machines"
depends on LEDS_CLASS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index d7348e8bc019..10caea4e7c61 100644
index d30395d11fd8..515a69953e73 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -84,6 +84,7 @@ obj-$(CONFIG_LEDS_TCA6507) += leds-tca6507.o
@@ -80,6 +80,7 @@ obj-$(CONFIG_LEDS_TCA6507) += leds-tca6507.o
obj-$(CONFIG_LEDS_TI_LMU_COMMON) += leds-ti-lmu-common.o
obj-$(CONFIG_LEDS_TLC591XX) += leds-tlc591xx.o
obj-$(CONFIG_LEDS_TPS6105X) += leds-tps6105x.o
@ -705,5 +1396,5 @@ index 000000000000..35aeb5db89c8
+MODULE_DESCRIPTION("LED driver for TPS68470 PMIC");
+MODULE_LICENSE("GPL v2");
--
2.44.0
2.40.1

View file

@ -1,4 +1,4 @@
From 63ebdc4f3b214e6bc789b55432fa9c5d1dbe916f Mon Sep 17 00:00:00 2001
From 52b885b62b4b77682307aa2dff1aa922816623aa Mon Sep 17 00:00:00 2001
From: Sachi King <nakato@nakato.io>
Date: Sat, 29 May 2021 17:47:38 +1000
Subject: [PATCH] ACPI: Add quirk for Surface Laptop 4 AMD missing irq 7
@ -21,7 +21,7 @@ Patchset: amd-gpio
1 file changed, 17 insertions(+)
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index c55c0ef47a18..f29740cf89ff 100644
index 0dac4ab5b55b..9ce909da6db3 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -22,6 +22,7 @@
@ -32,7 +32,7 @@ index c55c0ef47a18..f29740cf89ff 100644
#include <asm/e820/api.h>
#include <asm/irqdomain.h>
@@ -1255,6 +1256,17 @@ static void __init mp_config_acpi_legacy_irqs(void)
@@ -1252,6 +1253,17 @@ static void __init mp_config_acpi_legacy_irqs(void)
}
}
@ -50,7 +50,7 @@ index c55c0ef47a18..f29740cf89ff 100644
/*
* Parse IOAPIC related entries in MADT
* returns 0 on success, < 0 on error
@@ -1310,6 +1322,11 @@ static int __init acpi_parse_madt_ioapic_entries(void)
@@ -1307,6 +1319,11 @@ static int __init acpi_parse_madt_ioapic_entries(void)
acpi_sci_ioapic_setup(acpi_gbl_FADT.sci_interrupt, 0, 0,
acpi_gbl_FADT.sci_interrupt);
@ -63,9 +63,9 @@ index c55c0ef47a18..f29740cf89ff 100644
mp_config_acpi_legacy_irqs();
--
2.44.0
2.40.1
From 82d8be77dbf1f5df125c796b7fdc8c60f2139eb8 Mon Sep 17 00:00:00 2001
From 5984f29452ed348b5008e0331dbd9398d196cffe Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Thu, 3 Jun 2021 14:04:26 +0200
Subject: [PATCH] ACPI: Add AMD 13" Surface Laptop 4 model to irq 7 override
@ -80,10 +80,10 @@ Patchset: amd-gpio
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index f29740cf89ff..247d2a8bcdf4 100644
index 9ce909da6db3..623d94a9cb86 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -1258,12 +1258,19 @@ static void __init mp_config_acpi_legacy_irqs(void)
@@ -1255,12 +1255,19 @@ static void __init mp_config_acpi_legacy_irqs(void)
static const struct dmi_system_id surface_quirk[] __initconst = {
{
@ -105,5 +105,5 @@ index f29740cf89ff..247d2a8bcdf4 100644
};
--
2.44.0
2.40.1

View file

@ -1,4 +1,4 @@
From 55aabf536ba74a27665aa48413ff958be42cb8eb Mon Sep 17 00:00:00 2001
From 03b40e54aa09ea00d1a4232a6c02ee7e40993bfd Mon Sep 17 00:00:00 2001
From: "Bart Groeneveld | GPX Solutions B.V" <bart@gpxbv.nl>
Date: Mon, 5 Dec 2022 16:08:46 +0100
Subject: [PATCH] acpi: allow usage of acpi_tad on HW-reduced platforms
@ -17,11 +17,11 @@ but it does have an HW-reduced TAD, which can be used as a RTC instead.
Signed-off-by: Bart Groeneveld | GPX Solutions B.V. <bart@gpxbv.nl>
Patchset: rtc
---
drivers/acpi/acpi_tad.c | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
drivers/acpi/acpi_tad.c | 35 ++++++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 11 deletions(-)
diff --git a/drivers/acpi/acpi_tad.c b/drivers/acpi/acpi_tad.c
index 33c3b16af556..900445d06623 100644
index e9b8e8305e23..944276934e7e 100644
--- a/drivers/acpi/acpi_tad.c
+++ b/drivers/acpi/acpi_tad.c
@@ -432,6 +432,14 @@ static ssize_t caps_show(struct device *dev, struct device_attribute *attr,
@ -58,7 +58,7 @@ index 33c3b16af556..900445d06623 100644
};
static ssize_t dc_alarm_store(struct device *dev, struct device_attribute *attr,
@@ -564,13 +571,18 @@ static int acpi_tad_remove(struct platform_device *pdev)
@@ -563,13 +570,18 @@ static int acpi_tad_remove(struct platform_device *pdev)
pm_runtime_get_sync(dev);
@ -79,20 +79,19 @@ index 33c3b16af556..900445d06623 100644
if (dd->capabilities & ACPI_TAD_DC_WAKE) {
acpi_tad_disable_timer(dev, ACPI_TAD_DC_TIMER);
acpi_tad_clear_status(dev, ACPI_TAD_DC_TIMER);
@@ -613,12 +625,6 @@ static int acpi_tad_probe(struct platform_device *pdev)
goto remove_handler;
@@ -604,11 +616,6 @@ static int acpi_tad_probe(struct platform_device *pdev)
return -ENODEV;
}
- if (!acpi_has_method(handle, "_PRW")) {
- dev_info(dev, "Missing _PRW\n");
- ret = -ENODEV;
- goto remove_handler;
- return -ENODEV;
- }
-
dd = devm_kzalloc(dev, sizeof(*dd), GFP_KERNEL);
if (!dd) {
ret = -ENOMEM;
@@ -649,6 +655,12 @@ static int acpi_tad_probe(struct platform_device *pdev)
if (!dd)
return -ENOMEM;
@@ -637,6 +644,12 @@ static int acpi_tad_probe(struct platform_device *pdev)
if (ret)
goto fail;
@ -106,5 +105,5 @@ index 33c3b16af556..900445d06623 100644
ret = sysfs_create_group(&dev->kobj, &acpi_tad_dc_attr_group);
if (ret)
--
2.44.0
2.40.1

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,852 +0,0 @@
From 526bea529e4befa282fcfd01bbadbed7325faf01 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 10 Oct 2021 20:56:57 +0200
Subject: [PATCH] ACPI: delay enumeration of devices with a _DEP pointing to an
INT3472 device
The clk and regulator frameworks expect clk/regulator consumer-devices
to have info about the consumed clks/regulators described in the device's
fw_node.
To work around cases where this info is not present in the firmware tables,
which is often the case on x86/ACPI devices, both frameworks allow the
provider-driver to attach info about consumers to the clks/regulators
when registering these.
This causes problems with the probe ordering wrt drivers for consumers
of these clks/regulators. Since the lookups are only registered when the
provider-driver binds, trying to get these clks/regulators before then
results in a -ENOENT error for clks and a dummy regulator for regulators.
One case where we hit this issue is camera sensors such as e.g. the OV8865
sensor found on the Microsoft Surface Go. The sensor uses clks, regulators
and GPIOs provided by a TPS68470 PMIC which is described in an INT3472
ACPI device. There is special platform code handling this and setting
platform_data with the necessary consumer info on the MFD cells
instantiated for the PMIC under: drivers/platform/x86/intel/int3472.
For this to work properly the ov8865 driver must not bind to the I2C-client
for the OV8865 sensor until after the TPS68470 PMIC gpio, regulator and
clk MFD cells have all been fully setup.
The OV8865 on the Microsoft Surface Go is just one example, all X86
devices using the Intel IPU3 camera block found on recent Intel SoCs
have similar issues where there is an INT3472 HID ACPI-device, which
describes the clks and regulators, and the driver for this INT3472 device
must be fully initialized before the sensor driver (any sensor driver)
binds for things to work properly.
On these devices the ACPI nodes describing the sensors all have a _DEP
dependency on the matching INT3472 ACPI device (there is one per sensor).
This allows solving the probe-ordering problem by delaying the enumeration
(instantiation of the I2C-client in the ov8865 example) of ACPI-devices
which have a _DEP dependency on an INT3472 device.
The new acpi_dev_ready_for_enumeration() helper used for this is also
exported because for devices, which have the enumeration_by_parent flag
set, the parent-driver will do its own scan of child ACPI devices and
it will try to enumerate those during its probe(). Code doing this such
as e.g. the i2c-core-acpi.c code must call this new helper to ensure
that it too delays the enumeration until all the _DEP dependencies are
met on devices which have the new honor_deps flag set.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Patchset: cameras
---
drivers/acpi/scan.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index e6ed1ba91e5c..b367890b7438 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -2138,6 +2138,9 @@ static acpi_status acpi_bus_check_add_2(acpi_handle handle, u32 lvl_not_used,
static void acpi_default_enumeration(struct acpi_device *device)
{
+ if (!acpi_dev_ready_for_enumeration(device))
+ return;
+
/*
* Do not enumerate devices with enumeration_by_parent flag set as
* they will be enumerated by their respective parents.
--
2.44.0
From d41ef92974135b1c22c2f46cbaba926701e0d4af Mon Sep 17 00:00:00 2001
From: zouxiaoh <xiaohong.zou@intel.com>
Date: Fri, 25 Jun 2021 08:52:59 +0800
Subject: [PATCH] iommu: intel-ipu: use IOMMU passthrough mode for Intel IPUs
Intel IPU(Image Processing Unit) has its own (IO)MMU hardware,
The IPU driver allocates its own page table that is not mapped
via the DMA, and thus the Intel IOMMU driver blocks access giving
this error: DMAR: DRHD: handling fault status reg 3 DMAR:
[DMA Read] Request device [00:05.0] PASID ffffffff
fault addr 76406000 [fault reason 06] PTE Read access is not set
As IPU is not an external facing device which is not risky, so use
IOMMU passthrough mode for Intel IPUs.
Change-Id: I6dcccdadac308cf42e20a18e1b593381391e3e6b
Depends-On: Iacd67578e8c6a9b9ac73285f52b4081b72fb68a6
Tracked-On: #JIITL8-411
Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: zouxiaoh <xiaohong.zou@intel.com>
Signed-off-by: Xu Chongyang <chongyang.xu@intel.com>
Patchset: cameras
---
drivers/iommu/intel/iommu.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 6c01b1aebf27..ceed043464b1 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -45,6 +45,13 @@
((pdev)->vendor == PCI_VENDOR_ID_INTEL && (pdev)->device == 0x34E4) \
)
+#define IS_INTEL_IPU(pdev) ((pdev)->vendor == PCI_VENDOR_ID_INTEL && \
+ ((pdev)->device == 0x9a19 || \
+ (pdev)->device == 0x9a39 || \
+ (pdev)->device == 0x4e19 || \
+ (pdev)->device == 0x465d || \
+ (pdev)->device == 0x1919))
+
#define IOAPIC_RANGE_START (0xfee00000)
#define IOAPIC_RANGE_END (0xfeefffff)
#define IOVA_START_ADDR (0x1000)
@@ -154,12 +161,14 @@ EXPORT_SYMBOL_GPL(intel_iommu_enabled);
static int dmar_map_gfx = 1;
static int dmar_map_ipts = 1;
+static int dmar_map_ipu = 1;
static int intel_iommu_superpage = 1;
static int iommu_identity_mapping;
static int iommu_skip_te_disable;
#define IDENTMAP_GFX 2
#define IDENTMAP_AZALIA 4
+#define IDENTMAP_IPU 8
#define IDENTMAP_IPTS 16
const struct iommu_ops intel_iommu_ops;
@@ -2420,6 +2429,9 @@ static int device_def_domain_type(struct device *dev)
if ((iommu_identity_mapping & IDENTMAP_GFX) && IS_GFX_DEVICE(pdev))
return IOMMU_DOMAIN_IDENTITY;
+ if ((iommu_identity_mapping & IDENTMAP_IPU) && IS_INTEL_IPU(pdev))
+ return IOMMU_DOMAIN_IDENTITY;
+
if ((iommu_identity_mapping & IDENTMAP_IPTS) && IS_IPTS(pdev))
return IOMMU_DOMAIN_IDENTITY;
}
@@ -2729,6 +2741,9 @@ static int __init init_dmars(void)
if (!dmar_map_gfx)
iommu_identity_mapping |= IDENTMAP_GFX;
+ if (!dmar_map_ipu)
+ iommu_identity_mapping |= IDENTMAP_IPU;
+
if (!dmar_map_ipts)
iommu_identity_mapping |= IDENTMAP_IPTS;
@@ -4909,6 +4924,18 @@ static void quirk_iommu_igfx(struct pci_dev *dev)
dmar_map_gfx = 0;
}
+static void quirk_iommu_ipu(struct pci_dev *dev)
+{
+ if (!IS_INTEL_IPU(dev))
+ return;
+
+ if (risky_device(dev))
+ return;
+
+ pci_info(dev, "Passthrough IOMMU for integrated Intel IPU\n");
+ dmar_map_ipu = 0;
+}
+
static void quirk_iommu_ipts(struct pci_dev *dev)
{
if (!IS_IPTS(dev))
@@ -4956,6 +4983,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1632, quirk_iommu_igfx);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x163A, quirk_iommu_igfx);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x163D, quirk_iommu_igfx);
+/* disable IPU dmar support */
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_iommu_ipu);
+
/* disable IPTS dmar support */
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9D3E, quirk_iommu_ipts);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x34E4, quirk_iommu_ipts);
--
2.44.0
From 214600c4c0c3039ba0d0a5e522a2eb162da3857b Mon Sep 17 00:00:00 2001
From: Daniel Scally <djrscally@gmail.com>
Date: Sun, 10 Oct 2021 20:57:02 +0200
Subject: [PATCH] platform/x86: int3472: Enable I2c daisy chain
The TPS68470 PMIC has an I2C passthrough mode through which I2C traffic
can be forwarded to a device connected to the PMIC as though it were
connected directly to the system bus. Enable this mode when the chip
is initialised.
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Patchset: cameras
---
drivers/platform/x86/intel/int3472/tps68470.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c
index 1e107fd49f82..e3e1696e7f0e 100644
--- a/drivers/platform/x86/intel/int3472/tps68470.c
+++ b/drivers/platform/x86/intel/int3472/tps68470.c
@@ -46,6 +46,13 @@ static int tps68470_chip_init(struct device *dev, struct regmap *regmap)
return ret;
}
+ /* Enable I2C daisy chain */
+ ret = regmap_write(regmap, TPS68470_REG_S_I2C_CTL, 0x03);
+ if (ret) {
+ dev_err(dev, "Failed to enable i2c daisy chain\n");
+ return ret;
+ }
+
dev_info(dev, "TPS68470 REVID: 0x%02x\n", version);
return 0;
--
2.44.0
From f5c4f5e1de99e04416ddffca65246a7769a202e3 Mon Sep 17 00:00:00 2001
From: Daniel Scally <dan.scally@ideasonboard.com>
Date: Thu, 2 Mar 2023 12:59:39 +0000
Subject: [PATCH] platform/x86: int3472: Remap reset GPIO for INT347E
ACPI _HID INT347E represents the OmniVision 7251 camera sensor. The
driver for this sensor expects a single pin named "enable", but on
some Microsoft Surface platforms the sensor is assigned a single
GPIO who's type flag is INT3472_GPIO_TYPE_RESET.
Remap the GPIO pin's function from "reset" to "enable". This is done
outside of the existing remap table since it is a more widespread
discrepancy than that method is designed for. Additionally swap the
polarity of the pin to match the driver's expectation.
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Patchset: cameras
---
drivers/platform/x86/intel/int3472/discrete.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c
index 07b302e09340..1d3097bc7e48 100644
--- a/drivers/platform/x86/intel/int3472/discrete.c
+++ b/drivers/platform/x86/intel/int3472/discrete.c
@@ -83,12 +83,26 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347
const char *func, u32 polarity)
{
int ret;
+ const struct acpi_device_id ov7251_ids[] = {
+ { "INT347E" },
+ };
if (int3472->n_sensor_gpios >= INT3472_MAX_SENSOR_GPIOS) {
dev_warn(int3472->dev, "Too many GPIOs mapped\n");
return -EINVAL;
}
+ /*
+ * In addition to the function remap table we need to bulk remap the
+ * "reset" GPIO for the OmniVision 7251 sensor, as the driver for that
+ * expects its only GPIO pin to be called "enable" (and to have the
+ * opposite polarity).
+ */
+ if (!strcmp(func, "reset") && !acpi_match_device_ids(int3472->sensor, ov7251_ids)) {
+ func = "enable";
+ polarity = GPIO_ACTIVE_HIGH;
+ }
+
ret = skl_int3472_fill_gpiod_lookup(&int3472->gpios.table[int3472->n_sensor_gpios],
agpio, func, polarity);
if (ret)
--
2.44.0
From 216df183e0ad29051b42fcb856d0818a6094f16d Mon Sep 17 00:00:00 2001
From: Daniel Scally <dan.scally@ideasonboard.com>
Date: Tue, 21 Mar 2023 13:45:26 +0000
Subject: [PATCH] media: i2c: Clarify that gain is Analogue gain in OV7251
Update the control ID for the gain control in the ov7251 driver to
V4L2_CID_ANALOGUE_GAIN.
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Patchset: cameras
---
drivers/media/i2c/ov7251.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c
index 30f61e04ecaf..9c1292ca8552 100644
--- a/drivers/media/i2c/ov7251.c
+++ b/drivers/media/i2c/ov7251.c
@@ -1051,7 +1051,7 @@ static int ov7251_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_EXPOSURE:
ret = ov7251_set_exposure(ov7251, ctrl->val);
break;
- case V4L2_CID_GAIN:
+ case V4L2_CID_ANALOGUE_GAIN:
ret = ov7251_set_gain(ov7251, ctrl->val);
break;
case V4L2_CID_TEST_PATTERN:
@@ -1572,7 +1572,7 @@ static int ov7251_init_ctrls(struct ov7251 *ov7251)
ov7251->exposure = v4l2_ctrl_new_std(&ov7251->ctrls, &ov7251_ctrl_ops,
V4L2_CID_EXPOSURE, 1, 32, 1, 32);
ov7251->gain = v4l2_ctrl_new_std(&ov7251->ctrls, &ov7251_ctrl_ops,
- V4L2_CID_GAIN, 16, 1023, 1, 16);
+ V4L2_CID_ANALOGUE_GAIN, 16, 1023, 1, 16);
v4l2_ctrl_new_std_menu_items(&ov7251->ctrls, &ov7251_ctrl_ops,
V4L2_CID_TEST_PATTERN,
ARRAY_SIZE(ov7251_test_pattern_menu) - 1,
--
2.44.0
From 0573bb8c22ed0f0476a2ca6c5df2a7f09c6a1b66 Mon Sep 17 00:00:00 2001
From: Daniel Scally <dan.scally@ideasonboard.com>
Date: Wed, 22 Mar 2023 11:01:42 +0000
Subject: [PATCH] media: v4l2-core: Acquire privacy led in
v4l2_async_register_subdev()
The current call to v4l2_subdev_get_privacy_led() is contained in
v4l2_async_register_subdev_sensor(), but that function isn't used by
all the sensor drivers. Move the acquisition of the privacy led to
v4l2_async_register_subdev() instead.
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Patchset: cameras
---
drivers/media/v4l2-core/v4l2-async.c | 4 ++++
drivers/media/v4l2-core/v4l2-fwnode.c | 4 ----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index 3ec323bd528b..b55570a0142c 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -796,6 +796,10 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd)
INIT_LIST_HEAD(&sd->asc_list);
+ ret = v4l2_subdev_get_privacy_led(sd);
+ if (ret < 0)
+ return ret;
+
/*
* No reference taken. The reference is held by the device (struct
* v4l2_subdev.dev), and async sub-device does not exist independently
diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c
index 89c7192148df..44eca113e772 100644
--- a/drivers/media/v4l2-core/v4l2-fwnode.c
+++ b/drivers/media/v4l2-core/v4l2-fwnode.c
@@ -1219,10 +1219,6 @@ int v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd)
v4l2_async_subdev_nf_init(notifier, sd);
- ret = v4l2_subdev_get_privacy_led(sd);
- if (ret < 0)
- goto out_cleanup;
-
ret = v4l2_async_nf_parse_fwnode_sensor(sd->dev, notifier);
if (ret < 0)
goto out_cleanup;
--
2.44.0
From 84d70102a7892f720a11a0b3d313f3932c859798 Mon Sep 17 00:00:00 2001
From: Kate Hsuan <hpa@redhat.com>
Date: Tue, 21 Mar 2023 23:37:16 +0800
Subject: [PATCH] platform: x86: int3472: Add MFD cell for tps68470 LED
Add MFD cell for tps68470-led.
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Patchset: cameras
---
drivers/platform/x86/intel/int3472/tps68470.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c
index e3e1696e7f0e..423dc555093f 100644
--- a/drivers/platform/x86/intel/int3472/tps68470.c
+++ b/drivers/platform/x86/intel/int3472/tps68470.c
@@ -17,7 +17,7 @@
#define DESIGNED_FOR_CHROMEOS 1
#define DESIGNED_FOR_WINDOWS 2
-#define TPS68470_WIN_MFD_CELL_COUNT 3
+#define TPS68470_WIN_MFD_CELL_COUNT 4
static const struct mfd_cell tps68470_cros[] = {
{ .name = "tps68470-gpio" },
@@ -200,7 +200,8 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client)
cells[1].name = "tps68470-regulator";
cells[1].platform_data = (void *)board_data->tps68470_regulator_pdata;
cells[1].pdata_size = sizeof(struct tps68470_regulator_platform_data);
- cells[2].name = "tps68470-gpio";
+ cells[2].name = "tps68470-led";
+ cells[3].name = "tps68470-gpio";
for (i = 0; i < board_data->n_gpiod_lookups; i++)
gpiod_add_lookup_table(board_data->tps68470_gpio_lookup_tables[i]);
--
2.44.0
From 183f7e4da9cacc2a0f9cb3549adad9a3c95f1b94 Mon Sep 17 00:00:00 2001
From: Kate Hsuan <hpa@redhat.com>
Date: Tue, 21 Mar 2023 23:37:17 +0800
Subject: [PATCH] include: mfd: tps68470: Add masks for LEDA and LEDB
Add flags for both LEDA(TPS68470_ILEDCTL_ENA), LEDB
(TPS68470_ILEDCTL_ENB), and current control mask for LEDB
(TPS68470_ILEDCTL_CTRLB)
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Patchset: cameras
---
include/linux/mfd/tps68470.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/linux/mfd/tps68470.h b/include/linux/mfd/tps68470.h
index 7807fa329db0..2d2abb25b944 100644
--- a/include/linux/mfd/tps68470.h
+++ b/include/linux/mfd/tps68470.h
@@ -34,6 +34,7 @@
#define TPS68470_REG_SGPO 0x22
#define TPS68470_REG_GPDI 0x26
#define TPS68470_REG_GPDO 0x27
+#define TPS68470_REG_ILEDCTL 0x28
#define TPS68470_REG_VCMVAL 0x3C
#define TPS68470_REG_VAUX1VAL 0x3D
#define TPS68470_REG_VAUX2VAL 0x3E
@@ -94,4 +95,8 @@
#define TPS68470_GPIO_MODE_OUT_CMOS 2
#define TPS68470_GPIO_MODE_OUT_ODRAIN 3
+#define TPS68470_ILEDCTL_ENA BIT(2)
+#define TPS68470_ILEDCTL_ENB BIT(6)
+#define TPS68470_ILEDCTL_CTRLB GENMASK(5, 4)
+
#endif /* __LINUX_MFD_TPS68470_H */
--
2.44.0
From 0f3811853f436eed853d7d226eb811f65137d03a Mon Sep 17 00:00:00 2001
From: Kate Hsuan <hpa@redhat.com>
Date: Tue, 21 Mar 2023 23:37:18 +0800
Subject: [PATCH] leds: tps68470: Add LED control for tps68470
There are two LED controllers, LEDA indicator LED and LEDB flash LED for
tps68470. LEDA can be enabled by setting TPS68470_ILEDCTL_ENA. Moreover,
tps68470 provides four levels of power status for LEDB. If the
properties called "ti,ledb-current" can be found, the current will be
set according to the property values. These two LEDs can be controlled
through the LED class of sysfs (tps68470-leda and tps68470-ledb).
Signed-off-by: Kate Hsuan <hpa@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Patchset: cameras
---
drivers/leds/Kconfig | 12 +++
drivers/leds/Makefile | 1 +
drivers/leds/leds-tps68470.c | 185 +++++++++++++++++++++++++++++++++++
3 files changed, 198 insertions(+)
create mode 100644 drivers/leds/leds-tps68470.c
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index d721b254e1e4..1717f94d1491 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -899,6 +899,18 @@ config LEDS_TPS6105X
It is a single boost converter primarily for white LEDs and
audio amplifiers.
+config LEDS_TPS68470
+ tristate "LED support for TI TPS68470"
+ depends on LEDS_CLASS
+ depends on INTEL_SKL_INT3472
+ help
+ This driver supports TPS68470 PMIC with LED chip.
+ It provides two LED controllers, with the ability to drive 2
+ indicator LEDs and 2 flash LEDs.
+
+ To compile this driver as a module, choose M and it will be
+ called leds-tps68470
+
config LEDS_IP30
tristate "LED support for SGI Octane machines"
depends on LEDS_CLASS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index ce07dc295ff0..0ebf6a9f9f7f 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -86,6 +86,7 @@ obj-$(CONFIG_LEDS_TCA6507) += leds-tca6507.o
obj-$(CONFIG_LEDS_TI_LMU_COMMON) += leds-ti-lmu-common.o
obj-$(CONFIG_LEDS_TLC591XX) += leds-tlc591xx.o
obj-$(CONFIG_LEDS_TPS6105X) += leds-tps6105x.o
+obj-$(CONFIG_LEDS_TPS68470) += leds-tps68470.o
obj-$(CONFIG_LEDS_TURRIS_OMNIA) += leds-turris-omnia.o
obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o
obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o
diff --git a/drivers/leds/leds-tps68470.c b/drivers/leds/leds-tps68470.c
new file mode 100644
index 000000000000..35aeb5db89c8
--- /dev/null
+++ b/drivers/leds/leds-tps68470.c
@@ -0,0 +1,185 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * LED driver for TPS68470 PMIC
+ *
+ * Copyright (C) 2023 Red Hat
+ *
+ * Authors:
+ * Kate Hsuan <hpa@redhat.com>
+ */
+
+#include <linux/leds.h>
+#include <linux/mfd/tps68470.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/property.h>
+#include <linux/regmap.h>
+
+
+#define lcdev_to_led(led_cdev) \
+ container_of(led_cdev, struct tps68470_led, lcdev)
+
+#define led_to_tps68470(led, index) \
+ container_of(led, struct tps68470_device, leds[index])
+
+enum tps68470_led_ids {
+ TPS68470_ILED_A,
+ TPS68470_ILED_B,
+ TPS68470_NUM_LEDS
+};
+
+static const char *tps68470_led_names[] = {
+ [TPS68470_ILED_A] = "tps68470-iled_a",
+ [TPS68470_ILED_B] = "tps68470-iled_b",
+};
+
+struct tps68470_led {
+ unsigned int led_id;
+ struct led_classdev lcdev;
+};
+
+struct tps68470_device {
+ struct device *dev;
+ struct regmap *regmap;
+ struct tps68470_led leds[TPS68470_NUM_LEDS];
+};
+
+enum ctrlb_current {
+ CTRLB_2MA = 0,
+ CTRLB_4MA = 1,
+ CTRLB_8MA = 2,
+ CTRLB_16MA = 3,
+};
+
+static int tps68470_brightness_set(struct led_classdev *led_cdev, enum led_brightness brightness)
+{
+ struct tps68470_led *led = lcdev_to_led(led_cdev);
+ struct tps68470_device *tps68470 = led_to_tps68470(led, led->led_id);
+ struct regmap *regmap = tps68470->regmap;
+
+ switch (led->led_id) {
+ case TPS68470_ILED_A:
+ return regmap_update_bits(regmap, TPS68470_REG_ILEDCTL, TPS68470_ILEDCTL_ENA,
+ brightness ? TPS68470_ILEDCTL_ENA : 0);
+ case TPS68470_ILED_B:
+ return regmap_update_bits(regmap, TPS68470_REG_ILEDCTL, TPS68470_ILEDCTL_ENB,
+ brightness ? TPS68470_ILEDCTL_ENB : 0);
+ }
+ return -EINVAL;
+}
+
+static enum led_brightness tps68470_brightness_get(struct led_classdev *led_cdev)
+{
+ struct tps68470_led *led = lcdev_to_led(led_cdev);
+ struct tps68470_device *tps68470 = led_to_tps68470(led, led->led_id);
+ struct regmap *regmap = tps68470->regmap;
+ int ret = 0;
+ int value = 0;
+
+ ret = regmap_read(regmap, TPS68470_REG_ILEDCTL, &value);
+ if (ret)
+ return dev_err_probe(led_cdev->dev, -EINVAL, "failed on reading register\n");
+
+ switch (led->led_id) {
+ case TPS68470_ILED_A:
+ value = value & TPS68470_ILEDCTL_ENA;
+ break;
+ case TPS68470_ILED_B:
+ value = value & TPS68470_ILEDCTL_ENB;
+ break;
+ }
+
+ return value ? LED_ON : LED_OFF;
+}
+
+
+static int tps68470_ledb_current_init(struct platform_device *pdev,
+ struct tps68470_device *tps68470)
+{
+ int ret = 0;
+ unsigned int curr;
+
+ /* configure LEDB current if the properties can be got */
+ if (!device_property_read_u32(&pdev->dev, "ti,ledb-current", &curr)) {
+ if (curr > CTRLB_16MA) {
+ dev_err(&pdev->dev,
+ "Invalid LEDB current value: %d\n",
+ curr);
+ return -EINVAL;
+ }
+ ret = regmap_update_bits(tps68470->regmap, TPS68470_REG_ILEDCTL,
+ TPS68470_ILEDCTL_CTRLB, curr);
+ }
+ return ret;
+}
+
+static int tps68470_leds_probe(struct platform_device *pdev)
+{
+ int i = 0;
+ int ret = 0;
+ struct tps68470_device *tps68470;
+ struct tps68470_led *led;
+ struct led_classdev *lcdev;
+
+ tps68470 = devm_kzalloc(&pdev->dev, sizeof(struct tps68470_device),
+ GFP_KERNEL);
+ if (!tps68470)
+ return -ENOMEM;
+
+ tps68470->dev = &pdev->dev;
+ tps68470->regmap = dev_get_drvdata(pdev->dev.parent);
+
+ for (i = 0; i < TPS68470_NUM_LEDS; i++) {
+ led = &tps68470->leds[i];
+ lcdev = &led->lcdev;
+
+ led->led_id = i;
+
+ lcdev->name = devm_kasprintf(tps68470->dev, GFP_KERNEL, "%s::%s",
+ tps68470_led_names[i], LED_FUNCTION_INDICATOR);
+ if (!lcdev->name)
+ return -ENOMEM;
+
+ lcdev->max_brightness = 1;
+ lcdev->brightness = 0;
+ lcdev->brightness_set_blocking = tps68470_brightness_set;
+ lcdev->brightness_get = tps68470_brightness_get;
+ lcdev->dev = &pdev->dev;
+
+ ret = devm_led_classdev_register(tps68470->dev, lcdev);
+ if (ret) {
+ dev_err_probe(tps68470->dev, ret,
+ "error registering led\n");
+ goto err_exit;
+ }
+
+ if (i == TPS68470_ILED_B) {
+ ret = tps68470_ledb_current_init(pdev, tps68470);
+ if (ret)
+ goto err_exit;
+ }
+ }
+
+err_exit:
+ if (ret) {
+ for (i = 0; i < TPS68470_NUM_LEDS; i++) {
+ if (tps68470->leds[i].lcdev.name)
+ devm_led_classdev_unregister(&pdev->dev,
+ &tps68470->leds[i].lcdev);
+ }
+ }
+
+ return ret;
+}
+static struct platform_driver tps68470_led_driver = {
+ .driver = {
+ .name = "tps68470-led",
+ },
+ .probe = tps68470_leds_probe,
+};
+
+module_platform_driver(tps68470_led_driver);
+
+MODULE_ALIAS("platform:tps68470-led");
+MODULE_DESCRIPTION("LED driver for TPS68470 PMIC");
+MODULE_LICENSE("GPL v2");
--
2.44.0
From 87ebc160cb35a068acfaf59847c84656cb52b1b7 Mon Sep 17 00:00:00 2001
From: Sakari Ailus <sakari.ailus@linux.intel.com>
Date: Thu, 25 May 2023 14:12:04 +0300
Subject: [PATCH] media: ipu3-cio2: Further clean up async subdev link creation
Use v4l2_create_fwnode_links_to_pad() to create links from async
sub-devices to the CSI-2 receiver subdevs.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Patchset: cameras
---
drivers/media/pci/intel/ipu3/ipu3-cio2.c | 22 +++++-----------------
1 file changed, 5 insertions(+), 17 deletions(-)
diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
index ed08bf4178f0..83e29c56fe33 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -28,6 +28,7 @@
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-fwnode.h>
+#include <media/v4l2-mc.h>
#include <media/v4l2-ioctl.h>
#include <media/videobuf2-dma-sg.h>
@@ -1407,7 +1408,6 @@ static void cio2_notifier_unbind(struct v4l2_async_notifier *notifier,
static int cio2_notifier_complete(struct v4l2_async_notifier *notifier)
{
struct cio2_device *cio2 = to_cio2_device(notifier);
- struct device *dev = &cio2->pci_dev->dev;
struct sensor_async_subdev *s_asd;
struct v4l2_async_connection *asd;
struct cio2_queue *q;
@@ -1417,23 +1417,10 @@ static int cio2_notifier_complete(struct v4l2_async_notifier *notifier)
s_asd = to_sensor_asd(asd);
q = &cio2->queue[s_asd->csi2.port];
- ret = media_entity_get_fwnode_pad(&q->sensor->entity,
- s_asd->asd.match.fwnode,
- MEDIA_PAD_FL_SOURCE);
- if (ret < 0) {
- dev_err(dev, "no pad for endpoint %pfw (%d)\n",
- s_asd->asd.match.fwnode, ret);
- return ret;
- }
-
- ret = media_create_pad_link(&q->sensor->entity, ret,
- &q->subdev.entity, CIO2_PAD_SINK,
- 0);
- if (ret) {
- dev_err(dev, "failed to create link for %s (endpoint %pfw, error %d)\n",
- q->sensor->name, s_asd->asd.match.fwnode, ret);
+ ret = v4l2_create_fwnode_links_to_pad(asd->sd,
+ &q->subdev_pads[CIO2_PAD_SINK], 0);
+ if (ret)
return ret;
- }
}
return v4l2_device_register_subdev_nodes(&cio2->v4l2_dev);
@@ -1572,6 +1559,7 @@ static int cio2_queue_init(struct cio2_device *cio2, struct cio2_queue *q)
v4l2_subdev_init(subdev, &cio2_subdev_ops);
subdev->flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
subdev->owner = THIS_MODULE;
+ subdev->dev = dev;
snprintf(subdev->name, sizeof(subdev->name),
CIO2_ENTITY_NAME " %td", q - cio2->queue);
subdev->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
--
2.44.0
From c5d6c95fd5cefbd4ba9779fc965bce0a36bdbe5e Mon Sep 17 00:00:00 2001
From: mojyack <mojyack@gmail.com>
Date: Sat, 3 Feb 2024 12:59:53 +0900
Subject: [PATCH] media: staging: ipu3-imgu: Fix multiple calls of s_stream on
stream stop
Adapt to 009905e "media: v4l2-subdev: Document and enforce .s_stream() requirements"
Patchset: cameras
---
drivers/staging/media/ipu3/ipu3-v4l2.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c
index 3df58eb3e882..81aff2d5d898 100644
--- a/drivers/staging/media/ipu3/ipu3-v4l2.c
+++ b/drivers/staging/media/ipu3/ipu3-v4l2.c
@@ -538,18 +538,18 @@ static void imgu_vb2_stop_streaming(struct vb2_queue *vq)
WARN_ON(!node->enabled);
- pipe = node->pipe;
- dev_dbg(dev, "Try to stream off node [%u][%u]", pipe, node->id);
- imgu_pipe = &imgu->imgu_pipe[pipe];
- r = v4l2_subdev_call(&imgu_pipe->imgu_sd.subdev, video, s_stream, 0);
- if (r)
- dev_err(&imgu->pci_dev->dev,
- "failed to stop subdev streaming\n");
-
mutex_lock(&imgu->streaming_lock);
/* Was this the first node with streaming disabled? */
if (imgu->streaming && imgu_all_nodes_streaming(imgu, node)) {
/* Yes, really stop streaming now */
+ pipe = node->pipe;
+ dev_dbg(dev, "Try to stream off node [%u][%u]", pipe, node->id);
+ imgu_pipe = &imgu->imgu_pipe[pipe];
+ r = v4l2_subdev_call(&imgu_pipe->imgu_sd.subdev, video, s_stream, 0);
+ if (r)
+ dev_err(&imgu->pci_dev->dev,
+ "failed to stop subdev streaming\n");
+
dev_dbg(dev, "IMGU streaming is ready to stop");
r = imgu_s_stream(imgu, false);
if (!r)
--
2.44.0
From 65421dfc17e3559d45345ea2aa48b44268653496 Mon Sep 17 00:00:00 2001
From: mojyack <mojyack@gmail.com>
Date: Tue, 26 Mar 2024 05:55:44 +0900
Subject: [PATCH] media: i2c: dw9719: fix probe error on surface go 2
On surface go 2, sometimes probing dw9719 fails with "dw9719: probe of i2c-INT347A:00-VCM failed with error -121".
The -121(-EREMOTEIO) is came from drivers/i2c/busses/i2c-designware-common.c:575, and indicates the initialize occurs too early.
So just add some delay.
There is no exact reason for this 10000us, but 100us failed.
---
drivers/media/i2c/dw9719.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/media/i2c/dw9719.c b/drivers/media/i2c/dw9719.c
index c626ed845928..0094cfda57ea 100644
--- a/drivers/media/i2c/dw9719.c
+++ b/drivers/media/i2c/dw9719.c
@@ -82,6 +82,9 @@ static int dw9719_power_up(struct dw9719_device *dw9719)
if (ret)
return ret;
+ /* Wait for device to be acknowledged */
+ fsleep(10000);
+
/* Jiggle SCL pin to wake up device */
cci_write(dw9719->regmap, DW9719_CONTROL, 1, &ret);
--
2.44.0

View file

@ -1 +1 @@
../../../patches/6.8/0001-surface3-oemb.patch
../../../patches/6.3/0001-surface3-oemb.patch

View file

@ -1 +1 @@
../../../patches/6.8/0002-mwifiex.patch
../../../patches/6.3/0002-mwifiex.patch

View file

@ -1 +1 @@
../../../patches/6.8/0003-ath10k.patch
../../../patches/6.3/0003-ath10k.patch

View file

@ -1 +1 @@
../../../patches/6.8/0004-ipts.patch
../../../patches/6.3/0004-ipts.patch

View file

@ -1 +1 @@
../../../patches/6.8/0005-ithc.patch
../../../patches/6.3/0005-ithc.patch

View file

@ -1 +1 @@
../../../patches/6.8/0006-surface-sam.patch
../../../patches/6.3/0006-surface-sam.patch

View file

@ -1 +1 @@
../../../patches/6.8/0007-surface-sam-over-hid.patch
../../../patches/6.3/0007-surface-sam-over-hid.patch

View file

@ -1 +1 @@
../../../patches/6.8/0008-surface-button.patch
../../../patches/6.3/0008-surface-button.patch

View file

@ -1 +1 @@
../../../patches/6.8/0009-surface-typecover.patch
../../../patches/6.3/0009-surface-typecover.patch

View file

@ -1 +1 @@
../../../patches/6.8/0010-surface-shutdown.patch
../../../patches/6.3/0010-surface-shutdown.patch

View file

@ -1 +1 @@
../../../patches/6.8/0011-surface-gpe.patch
../../../patches/6.3/0011-surface-gpe.patch

View file

@ -1 +1 @@
../../../patches/6.8/0012-cameras.patch
../../../patches/6.3/0012-cameras.patch

View file

@ -1 +1 @@
../../../patches/6.8/0013-amd-gpio.patch
../../../patches/6.3/0013-amd-gpio.patch

View file

@ -1 +1 @@
../../../patches/6.8/0014-rtc.patch
../../../patches/6.3/0014-rtc.patch

View file

@ -3,7 +3,7 @@
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
pkgbase=linux-surface
pkgver=6.8.6.arch1
pkgver=6.3.5.arch1
pkgrel=1
pkgdesc='Linux'
_shortver=${pkgver%.*}
@ -56,24 +56,24 @@ validpgpkeys=(
'647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
'A2FF3A36AAA56654109064AB19802F8B0D70FC30' # Jan Alexander Steffens (heftig)
)
sha256sums=('2a56b8533af53cf5d3be8882a4a2da34a8d5a2d26569b098102aa072960c32e0'
'9a21f27cdfdb1d7b27af526b2c85632eca890e5264cd44dcb0882e9953794a2a'
'985cd5e0b11538f31887e451c398d226c06ca4b34c5466e93a21ebd65b7b3919'
sha256sums=('SKIP'
'6b337a9d3cfdc00005589a80b8d36fa500f6a92ed21565a3aceec48d7202a7da'
'65c28c44516a57d32d2d557bf6b9bcf38e00cefdf2b8ad51160eb07f53e6e998'
'3cabe391cc39dbee88a79f76e9e7a68f7fbcd5518941aa2ab73a77692c87dead'
'ee9857e96ee5d871aa557f6d6d142474c26187faa2c21b351bafde065b288fe0'
'12f914866916181f232b4f159a270bce1fc8bd8e93c4f86ae7b18f8d6a777573'
'1984f355569702ff87cfab75682ceb89bfe40ad22c5c4dd8653abe623e000dfb'
'be01d5c3e851830be8ef55c794e8480e5cf19ff6b66266db32d352c2c60eebe4'
'0b27a1ea32c6cdbb3ab89866724b0b193998d7ee0525d736242411c2ec3d4bd5'
'ca4c0bc2b26e3e07c29537cbecc8bade50212d5a0277ae1a834b7c33c36f7c8a'
'9dd041d482eb7f0479487c5fe127f4fd6bec1209d9cd7d77a73f87b205035238'
'bd32fc7cc18345f027a4fe2af2b249d27470f7b120b1e521dd26008cc34e1e8d'
'02d720e3fffae018fc8719a98135e63c84e8b7f39769bcdee45ddf973a567732'
'6225348b31112a67f5e37a9075363b36c103ba6144083cf4e2d7d83edc77513c'
'ea0016af33f682a0353738b00c39407b7e1a96a9ccfb04b3904b58143c1953ee'
'f59a6c1a59699664eeeb5243cb961845944cbc6d1c63353ad9d2ff7d8b593ec3'
'1e620fa5bb90d7a8d4a57d0dc1552b096762a4da4cf1a5ce461d54c3c9b9885f'
'7693cf1df35a47ec8702543d9665f9010a5c7db18a39d9506649e892fd36954f')
'bafede425f0930d649443480e5ed2dbc341d9ed0e63b1e35defc48a2f712922a'
'0834780cef6741a64569f5b688743b51d26b4d8f6ccbb465fc4b2c00791bd429'
'3aab5d5adfc80ccd1bfad3be07ca8021f5664d08dd17dab6476509eac932d161'
'731439ba40c5e2ac519adeaac5a8ba75f9357c23df41b30dcf9f2d477cde91f7'
'53e17165431f15208da5b5fd9557dfacd29021af0c8b61a0bc950699523d8492'
'1fd862b46a15d58274ddc2edc31b32936693d946a442e1f01f67ad88fcd364c5'
'94db4f74506557bdcf6e41a8f97cd20fe7b28d6b633ff903d49e4717d31e08c8'
'b522c1c30328c3c28a3e6b2ed5a5bd131cc5c7aabf3692037ae7537bde45da05'
'f2d5c20f580e9a7abc056465baa7f13b70a7b7ecbed89325087c8ceed88bf705'
'4d31a1702cc3e1ffe0bfa59412de409a4e59659ae74681211f4baa4444114677'
'd8f55c45424fd3f7d4d7761778f37e26c8a758e902d72bb908d15322f7b93fbc'
'85fc200bf048fddf97b045a4725d1613c090c0027f0c5b219484ff301021ac02'
'ae58a11aa0230d0d22e00e8ea26ffc0daddfc448a9f1c809fbeb4b83cd7e8f2b'
'9ff67df8be581b14f995cd3bc5d5a68bba261a623c1b7c721b4e86512abaae05')
export KBUILD_BUILD_HOST=archlinux
@ -171,7 +171,7 @@ _package() {
DEPMOD=/doesnt/exist modules_install # Suppress depmod
# remove build and source links
rm "$modulesdir"/build
rm "$modulesdir"/{source,build}
}
_package-headers() {

View file

@ -24,20 +24,3 @@ CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDERFS=y
CONFIG_ANDROID_BINDER_DEVICES=""
##
## Build-in basic pinctrl/serial modules to prevent race-conditions in drivers
## relying on them (like soc-button-array, SAM)
##
CONFIG_SERIAL_8250_DW=y
CONFIG_MFD_INTEL_LPSS=y
CONFIG_MFD_INTEL_LPSS_PCI=y
CONFIG_PINCTRL_INTEL=y
CONFIG_PINCTRL_ALDERLAKE=y
CONFIG_PINCTRL_CANNONLAKE=y
CONFIG_PINCTRL_ICELAKE=y
CONFIG_PINCTRL_METEORLAKE=y
CONFIG_PINCTRL_SUNRISEPOINT=y
CONFIG_PINCTRL_TIGERLAKE=y

File diff suppressed because it is too large Load diff

View file

@ -1 +1 @@
../../../configs/surface-6.8.config
../../../configs/surface-6.3.config

View file

@ -1,87 +0,0 @@
From 43a7e8759162fa25aea203ce732f177bc6f15cdb Mon Sep 17 00:00:00 2001
From: Dorian Stoll <dorian.stoll@tmsp.io>
Date: Sun, 22 Sep 2019 22:44:16 +0200
Subject: [PATCH] Add secureboot pre-signing to the kernel
If it detects a secure boot certificate at `keys/MOK.key` and `keys/MOK.cer`,
the kernel Makefile will automatically sign the vmlinux / bzImage file that
gets generated, and that is then used in packaging.
By integrating it into the kernel build system directly, it is fully integrated
with targets like `make deb-pkg` (opposed to `make all`, sign, `make bindeb-pkg`)
and it gets added to every tree by the same mechanism that is used to apply the
other surface patches anyways.
Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
---
.gitignore | 3 +++
arch/x86/Makefile | 1 +
scripts/sign_kernel.sh | 30 ++++++++++++++++++++++++++++++
3 files changed, 34 insertions(+)
create mode 100755 scripts/sign_kernel.sh
diff --git a/.gitignore b/.gitignore
index 7f86e0837909..04aaae490610 100644
--- a/.gitignore
+++ b/.gitignore
@@ -152,6 +152,9 @@ signing_key.priv
signing_key.x509
x509.genkey
+# Secureboot certificate
+/keys/
+
# Kconfig presets
/all.config
/alldef.config
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index fdc2e3abd615..c7a374c7ceaf 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -283,6 +283,7 @@ endif
$(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE)
$(Q)mkdir -p $(objtree)/arch/$(UTS_MACHINE)/boot
$(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/$(UTS_MACHINE)/boot/$@
+ $(Q)$(srctree)/scripts/sign_kernel.sh $(objtree)/arch/$(UTS_MACHINE)/boot/$@
$(BOOT_TARGETS): vmlinux
$(Q)$(MAKE) $(build)=$(boot) $@
diff --git a/scripts/sign_kernel.sh b/scripts/sign_kernel.sh
new file mode 100755
index 000000000000..d2526a279254
--- /dev/null
+++ b/scripts/sign_kernel.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+# The path to the compiled kernel image is passed as the first argument
+BUILDDIR=$(dirname $(dirname $0))
+VMLINUX=$1
+
+# Keys are stored in a toplevel directory called keys
+# The following files need to be there:
+# * MOK.priv (private key)
+# * MOK.pem (public key)
+#
+# If the files don't exist, this script will do nothing.
+if [ ! -f "$BUILDDIR/keys/MOK.key" ]; then
+ exit 0
+fi
+if [ ! -f "$BUILDDIR/keys/MOK.crt" ]; then
+ exit 0
+fi
+
+# Both required certificates were found. Check if sbsign is installed.
+echo "Keys for automatic secureboot signing found."
+if [ ! -x "$(command -v sbsign)" ]; then
+ echo "ERROR: sbsign not found!"
+ exit -2
+fi
+
+# Sign the kernel
+sbsign --key $BUILDDIR/keys/MOK.key --cert $BUILDDIR/keys/MOK.crt \
+ --output $VMLINUX $VMLINUX
--
2.41.0

View file

@ -0,0 +1 @@
../../fedora/kernel-surface/0001-Add-secureboot-pre-signing-to-the-kernel.patch

View file

@ -0,0 +1,129 @@
From 2cd850987436405547384feb707200c7dad4a675 Mon Sep 17 00:00:00 2001
From: Ben Hutchings <ben@decadent.org.uk>
Date: Mon, 7 Sep 2020 02:51:53 +0100
Subject: [PATCH 1/2] Export symbols needed by Android drivers
We want to enable use of the Android ashmem and binder drivers to
support Anbox, but they should not be built-in as that would waste
resources and increase security attack surface on systems that don't
need them.
Export the currently un-exported symbols they depend on.
---
fs/file.c | 1 +
kernel/sched/core.c | 1 +
kernel/sched/wait.c | 1 +
kernel/task_work.c | 1 +
mm/memory.c | 1 +
mm/shmem.c | 1 +
security/security.c | 4 ++++
7 files changed, 10 insertions(+)
diff --git a/fs/file.c b/fs/file.c
index 7893ea161d770..066f90a4f572f 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -814,6 +814,7 @@ struct file *close_fd_get_file(unsigned int fd)
return file;
}
+EXPORT_SYMBOL_GPL(close_fd_get_file);
void do_close_on_exec(struct files_struct *files)
{
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 0d18c3969f904..d1e20b1aad9c3 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7183,6 +7183,7 @@ static bool is_nice_reduction(const struct task_struct *p, const int nice)
return (nice_rlim <= task_rlimit(p, RLIMIT_NICE));
}
+EXPORT_SYMBOL_GPL(can_nice);
/*
* can_nice - check if a task can reduce its nice value
diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
index 133b74730738b..a2a3381ede737 100644
--- a/kernel/sched/wait.c
+++ b/kernel/sched/wait.c
@@ -247,6 +247,7 @@ void __wake_up_pollfree(struct wait_queue_head *wq_head)
/* POLLFREE must have cleared the queue. */
WARN_ON_ONCE(waitqueue_active(wq_head));
}
+EXPORT_SYMBOL_GPL(__wake_up_pollfree);
/*
* Note: we use "set_current_state()" _after_ the wait-queue add,
diff --git a/kernel/task_work.c b/kernel/task_work.c
index 065e1ef8fc8d7..7d06ea82a53e4 100644
--- a/kernel/task_work.c
+++ b/kernel/task_work.c
@@ -73,6 +73,7 @@ int task_work_add(struct task_struct *task, struct callback_head *work,
return 0;
}
+EXPORT_SYMBOL_GPL(task_work_add);
/**
* task_work_cancel_match - cancel a pending work added by task_work_add()
diff --git a/mm/memory.c b/mm/memory.c
index 01a23ad48a042..8762b48854243 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1728,6 +1728,7 @@ void zap_page_range_single(struct vm_area_struct *vma, unsigned long address,
mmu_notifier_invalidate_range_end(&range);
tlb_finish_mmu(&tlb);
}
+EXPORT_SYMBOL_GPL(zap_page_range_single);
/**
* zap_vma_ptes - remove ptes mapping the vma
diff --git a/mm/shmem.c b/mm/shmem.c
index 448f393d8ab2b..b14ac0867f27d 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -4318,6 +4318,7 @@ int shmem_zero_setup(struct vm_area_struct *vma)
return 0;
}
+EXPORT_SYMBOL_GPL(shmem_zero_setup);
/**
* shmem_read_folio_gfp - read into page cache, using specified page allocation flags.
diff --git a/security/security.c b/security/security.c
index cf6cc576736f3..5401a0c5a1472 100644
--- a/security/security.c
+++ b/security/security.c
@@ -782,24 +782,28 @@ int security_binder_set_context_mgr(const struct cred *mgr)
{
return call_int_hook(binder_set_context_mgr, 0, mgr);
}
+EXPORT_SYMBOL_GPL(security_binder_set_context_mgr);
int security_binder_transaction(const struct cred *from,
const struct cred *to)
{
return call_int_hook(binder_transaction, 0, from, to);
}
+EXPORT_SYMBOL_GPL(security_binder_transaction);
int security_binder_transfer_binder(const struct cred *from,
const struct cred *to)
{
return call_int_hook(binder_transfer_binder, 0, from, to);
}
+EXPORT_SYMBOL_GPL(security_binder_transfer_binder);
int security_binder_transfer_file(const struct cred *from,
const struct cred *to, struct file *file)
{
return call_int_hook(binder_transfer_file, 0, from, to, file);
}
+EXPORT_SYMBOL_GPL(security_binder_transfer_file);
int security_ptrace_access_check(struct task_struct *child, unsigned int mode)
{
--
2.40.1

View file

@ -1,41 +0,0 @@
From fbfaff58fe821fa93ceeb17e034886a6d8447207 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Mon, 20 Nov 2023 22:54:05 +0100
Subject: [PATCH] Partially revert "integrity: Only use machine keyring when
uefi_check_trust_mok_keys is true"
This partially reverts commit 3d6ae1a5d0c2019d274284859f556dcb64aa98a7.
MokListTrustedRT doesn't seem to be set by the Shim version used by
Ubuntu and Debian. Therefore, these systems don't trust the MOK keys on
newer kernels. While pre-5.19 kernels silently disregard the untrusted
keys and (without signature enforcement enabled) still load external
modules (tainting the kernel), on 5.19 kernels, this breaks module
loading. Therefore, revert this change.
---
security/integrity/platform_certs/machine_keyring.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/security/integrity/platform_certs/machine_keyring.c b/security/integrity/platform_certs/machine_keyring.c
index a401640a63cd1..a1ad244cbf86d 100644
--- a/security/integrity/platform_certs/machine_keyring.c
+++ b/security/integrity/platform_certs/machine_keyring.c
@@ -51,14 +51,7 @@ void __init add_to_machine_keyring(const char *source, const void *data, size_t
*/
static __init bool uefi_check_trust_mok_keys(void)
{
- struct efi_mokvar_table_entry *mokvar_entry;
-
- mokvar_entry = efi_mokvar_entry_find("MokListTrustedRT");
-
- if (mokvar_entry)
- return true;
-
- return false;
+ return true;
}
static bool __init trust_moklist(void)
--
2.42.1

View file

@ -0,0 +1,102 @@
From e79c4bebdeeb42325394c95fa13f36042f9a34fa Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Fri, 26 Aug 2022 21:24:36 +0200
Subject: [PATCH] Revert "integrity: Only use machine keyring when
uefi_check_trust_mok_keys is true"
This reverts commit 3d6ae1a5d0c2019d274284859f556dcb64aa98a7.
MokListTrustedRT doesn't seem to be set by the Shim version used by
Ubuntu and Debian. Therefore, these systems don't trust the MOK keys on
newer kernels. While pre-5.19 kernels silently disregard the untrusted
keys and (without signature enforcement enabled) still load external
modules (tainting the kernel), on 5.19 kernels, this breaks module
loading. Therefore, revert this change.
See https://github.com/linux-surface/linux-surface/issues/906.
---
security/integrity/digsig.c | 2 +-
security/integrity/integrity.h | 5 -----
.../integrity/platform_certs/keyring_handler.c | 2 +-
.../integrity/platform_certs/machine_keyring.c | 16 ----------------
4 files changed, 2 insertions(+), 23 deletions(-)
diff --git a/security/integrity/digsig.c b/security/integrity/digsig.c
index f2193c531f4a4..4a1d0bb2ffd42 100644
--- a/security/integrity/digsig.c
+++ b/security/integrity/digsig.c
@@ -113,7 +113,7 @@ static int __init __integrity_init_keyring(const unsigned int id,
} else {
if (id == INTEGRITY_KEYRING_PLATFORM)
set_platform_trusted_keys(keyring[id]);
- if (id == INTEGRITY_KEYRING_MACHINE && trust_moklist())
+ if (id == INTEGRITY_KEYRING_MACHINE)
set_machine_trusted_keys(keyring[id]);
if (id == INTEGRITY_KEYRING_IMA)
load_module_cert(keyring[id]);
diff --git a/security/integrity/integrity.h b/security/integrity/integrity.h
index 7167a6e99bdc0..1dbb494c86c07 100644
--- a/security/integrity/integrity.h
+++ b/security/integrity/integrity.h
@@ -320,14 +320,9 @@ static inline void __init add_to_platform_keyring(const char *source,
#ifdef CONFIG_INTEGRITY_MACHINE_KEYRING
void __init add_to_machine_keyring(const char *source, const void *data, size_t len);
-bool __init trust_moklist(void);
#else
static inline void __init add_to_machine_keyring(const char *source,
const void *data, size_t len)
{
}
-static inline bool __init trust_moklist(void)
-{
- return false;
-}
#endif
diff --git a/security/integrity/platform_certs/keyring_handler.c b/security/integrity/platform_certs/keyring_handler.c
index 8a1124e4d7696..b22e0125a4833 100644
--- a/security/integrity/platform_certs/keyring_handler.c
+++ b/security/integrity/platform_certs/keyring_handler.c
@@ -61,7 +61,7 @@ __init efi_element_handler_t get_handler_for_db(const efi_guid_t *sig_type)
__init efi_element_handler_t get_handler_for_mok(const efi_guid_t *sig_type)
{
if (efi_guidcmp(*sig_type, efi_cert_x509_guid) == 0) {
- if (IS_ENABLED(CONFIG_INTEGRITY_MACHINE_KEYRING) && trust_moklist())
+ if (IS_ENABLED(CONFIG_INTEGRITY_MACHINE_KEYRING))
return add_to_machine_keyring;
else
return add_to_platform_keyring;
diff --git a/security/integrity/platform_certs/machine_keyring.c b/security/integrity/platform_certs/machine_keyring.c
index 7aaed7950b6e3..09fd8f20c7560 100644
--- a/security/integrity/platform_certs/machine_keyring.c
+++ b/security/integrity/platform_certs/machine_keyring.c
@@ -8,8 +8,6 @@
#include <linux/efi.h>
#include "../integrity.h"
-static bool trust_mok;
-
static __init int machine_keyring_init(void)
{
int rc;
@@ -61,17 +59,3 @@ static __init bool uefi_check_trust_mok_keys(void)
return false;
}
-
-bool __init trust_moklist(void)
-{
- static bool initialized;
-
- if (!initialized) {
- initialized = true;
-
- if (uefi_check_trust_mok_keys())
- trust_mok = true;
- }
-
- return trust_mok;
-}
--
2.40.1

View file

@ -0,0 +1,71 @@
From bcc03c72770a9602dcf6afe560346ef02ae84e1e Mon Sep 17 00:00:00 2001
From: Ben Hutchings <ben@decadent.org.uk>
Date: Fri, 22 Jun 2018 17:27:00 +0100
Subject: [PATCH 2/2] android: Enable building ashmem and binder as modules
We want to enable use of the Android ashmem and binder drivers to
support Anbox, but they should not be built-in as that would waste
resources and increase security attack surface on systems that don't
need them.
- Add a MODULE_LICENSE declaration to ashmem
- Change the Makefiles to build each driver as an object with the
"_linux" suffix (which is what Anbox expects)
- Change config symbol types to tristate
Update:
In upstream commit 721412ed3d titled "staging: remove ashmem" the ashmem
driver was removed entirely. Secondary commit message:
"The mainline replacement for ashmem is memfd, so remove the legacy
code from drivers/staging/"
Consequently, the ashmem part of this patch has been removed.
---
drivers/android/Kconfig | 2 +-
drivers/android/Makefile | 7 ++++---
drivers/android/binder_alloc.c | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig
index 07aa8ae0a058c..94a3a86f9bd4f 100644
--- a/drivers/android/Kconfig
+++ b/drivers/android/Kconfig
@@ -2,7 +2,7 @@
menu "Android"
config ANDROID_BINDER_IPC
- bool "Android Binder IPC Driver"
+ tristate "Android Binder IPC Driver"
depends on MMU
default n
help
diff --git a/drivers/android/Makefile b/drivers/android/Makefile
index c9d3d0c99c257..55411d9a9c2a1 100644
--- a/drivers/android/Makefile
+++ b/drivers/android/Makefile
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
ccflags-y += -I$(src) # needed for trace events
-obj-$(CONFIG_ANDROID_BINDERFS) += binderfs.o
-obj-$(CONFIG_ANDROID_BINDER_IPC) += binder.o binder_alloc.o
-obj-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o
+obj-$(CONFIG_ANDROID_BINDER_IPC) += binder_linux.o
+binder_linux-y := binder.o binder_alloc.o
+binder_linux-$(CONFIG_ANDROID_BINDERFS) += binderfs.o
+binder_linux-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o
diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c
index 55a3c3c2409f0..7014ec2f212b5 100644
--- a/drivers/android/binder_alloc.c
+++ b/drivers/android/binder_alloc.c
@@ -38,7 +38,7 @@ enum {
};
static uint32_t binder_alloc_debug_mask = BINDER_DEBUG_USER_ERROR;
-module_param_named(debug_mask, binder_alloc_debug_mask,
+module_param_named(alloc_debug_mask, binder_alloc_debug_mask,
uint, 0644);
#define binder_alloc_debug(mask, x...) \
--
2.40.1

View file

@ -9,14 +9,6 @@ CONFIG_DEBUG_INFO_NONE=y
# CONFIG_DEBUG_INFO_DWARF4 is not set
# CONFIG_DEBUG_INFO_DWARF5 is not set
##
## Disable module compression
##
CONFIG_MODULE_COMPRESS_NONE=y
# CONFIG_MODULE_COMPRESS_GZIP is not set
# CONFIG_MODULE_COMPRESS_XZ is not set
# CONFIG_MODULE_COMPRESS_ZSTD is not set
##
## Do not build samples and tests
##
@ -40,15 +32,14 @@ CONFIG_SYSTEM_TRUSTED_KEYS=""
CONFIG_SYSTEM_REVOCATION_KEYS=""
##
## Modules required for running Android apps
##
## Ubuntu builds binder as a module by patching the Makefile. To keep it
## simple, we just put it into vmlinux. One patch less to keep track of.
## Additional options from upstream (not in PPA)
##
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDERFS=y
CONFIG_ANDROID_BINDER_DEVICES=""
CONFIG_ASHMEM=m
CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=m
# CONFIG_ANDROID_BINDERFS is not set
CONFIG_ANDROID_BINDER_DEVICES="binder"
# CONFIG_ANDROID_BINDER_IPC_SELFTEST is not set
##

View file

@ -1,3 +0,0 @@
KERNEL_VERSION="6.8.6"
KERNEL_REVISION="1"
KERNEL_LOCALVERSION="-surface"

View file

@ -1,13 +1,15 @@
#!/usr/bin/bash
kernelrelease="${1}"
suffix="${2:+-${2}}"
pkgrevision="${2}"
suffix="${3:+-${3}}"
distribution="unstable"
debarch="amd64"
debcompat="10"
sourcename="linux-surface${suffix}"
maintainer="surfacebot <surfacebot@users.noreply.github.com>"
pkgversion="${kernelrelease}-${pkgrevision}"
image_pkgname="linux-image-surface${suffix}"
image_pkgname_actual="linux-image-${kernelrelease}"
@ -26,7 +28,7 @@ echo "${debarch}" > "debian/arch"
echo "${debcompat}" > "debian/compat"
cat <<EOF > "debian/changelog"
${sourcename} (${kernelrelease}) ${distribution}; urgency=medium
${sourcename} (${pkgversion}) ${distribution}; urgency=medium
* Linux kernel for Microsoft Surface devices.
@ -42,14 +44,14 @@ Homepage: https://github.com/linux-surface/linux-surface
Package: ${image_pkgname}
Architecture: ${debarch}
Depends: ${image_pkgname_actual} (= ${kernelrelease})
Depends: ${image_pkgname_actual} (= ${pkgversion})
Recommends: ${recommends}
Description:
Meta-package for linux-surface kernel images.
Package: ${headers_pkgname}
Architecture: ${debarch}
Depends: ${headers_pkgname_actual} (= ${kernelrelease})
Depends: ${headers_pkgname_actual} (= ${pkgversion})
Description:
Meta-package for linux-surface headers.
EOF

View file

@ -73,13 +73,6 @@ parser.add_argument(
nargs="+",
)
parser.add_argument(
"--mode",
help="Whether to build a source RPM or binary RPMs.",
choices=["rpms", "srpm"],
default="rpms",
)
parser.add_argument(
"--outdir",
help="The directory where the built RPM files will be saved.",
@ -158,15 +151,11 @@ for config in configs:
f.write(line)
system("git add redhat/configs/custom-overrides/generic")
system("git commit --allow-empty -m 'Merge %s config'" % args.package_name)
cmd = ["make"]
if args.mode == "rpms":
cmd.append("dist-rpms")
else:
cmd.append("dist-srpm")
system("git commit -m 'Merge %s config'" % args.package_name)
cmd = []
cmd.append("make")
cmd.append("dist-rpms")
cmd.append("SPECPACKAGE_NAME='kernel-%s'" % args.package_name)
cmd.append("DISTLOCALVERSION='.%s'" % args.package_name)
cmd.append("BUILD='%s'" % args.package_release)
@ -177,11 +166,6 @@ if len(buildopts) > 0:
# Build RPMS
system(" ".join(cmd))
if args.mode == "rpms":
rpmdir = "RPMS"
else:
rpmdir = "SRPMS"
# Copy built RPMS to output directory
os.makedirs(outdir, exist_ok=True)
system("cp -r redhat/rpm/%s/* '%s'" % (rpmdir, outdir))
system("cp -r redhat/rpm/RPMS/* '%s'" % outdir)

View file

@ -1,6 +1,5 @@
#!/usr/bin/env python3
import argparse
import subprocess
import sys
from pathlib import Path
@ -18,7 +17,7 @@ PACKAGE_NAME = "surface"
## Fedora tags: kernel-X.Y.Z
## Upstream tags: vX.Y.Z
##
PACKAGE_TAG = "kernel-6.8.6-0"
PACKAGE_TAG = "kernel-6.3.6-0"
##
## The release number of the modified kernel package.
@ -38,35 +37,6 @@ KERNEL_BUILDOPTS = "+up +baseonly -debuginfo -doc -headers -efiuki"
#####################################################################
parser = argparse.ArgumentParser(usage="Build a Fedora kernel with linux-surface patches")
parser.add_argument(
"--ark-dir",
help="The local path to the kernel-ark repository.",
default="kernel-ark",
)
parser.add_argument(
"--ark-url",
help="The remote path to the kernel-ark repository.",
default="https://gitlab.com/cki-project/kernel-ark",
)
parser.add_argument(
"--mode",
help="Whether to build a source RPM or binary RPMs.",
choices=["rpms", "srpm"],
default="rpms",
)
parser.add_argument(
"--outdir",
help="The directory where the built RPM files will be saved.",
default="out",
)
args = parser.parse_args()
# The directory where this script is saved.
script = Path(sys.argv[0]).resolve().parent
@ -99,16 +69,13 @@ if not sb_avail:
print("The compiled kernel will not boot with Secure Boot enabled!")
print("")
input("Press enter to continue: ")
input("Press any key to continue")
# Expand globs
surface_patches = sorted(patches.glob("*.patch"))
cmd = [script / "build-ark.py"]
cmd += ["--ark-dir", args.ark_dir]
cmd += ["--ark-url", args.ark_url]
cmd += ["--mode", args.mode]
cmd += ["--outdir", args.outdir]
cmd = []
cmd += [script / "build-ark.py"]
cmd += ["--package-name", PACKAGE_NAME]
cmd += ["--package-tag", PACKAGE_TAG]
cmd += ["--package-release", PACKAGE_RELEASE]

View file

@ -2,13 +2,6 @@
## Config options specific to Fedora
##
##
## The build fails because this is not enabled in the config set for RHEL,
## but enabled automatically by one of our patches.
##
# The build fails because this is not enabled in the config set for RHEL,
# but enabled automatically by one of our patches.
CONFIG_VIDEO_V4L2_SUBDEV_API=y
##
## Disable (wrong) NX compatibility flag.
##
# CONFIG_EFI_DXE_MEM_ATTRIBUTES is not set

View file

@ -1,5 +0,0 @@
# Make sure that the old, manually created units get disabled
disable default-kernel.path
# Enable the new unit provided by the package
enable linux-surface-default-watchdog.path

View file

@ -3,4 +3,4 @@ Description=linux-surface default kernel watchdog
[Service]
Type=oneshot
ExecStart=/usr/bin/linux-surface-default-watchdog.py
ExecStart=/usr/bin/linux-surface-default-kernel.sh

View file

@ -0,0 +1,20 @@
#!/bin/bash
set -euo pipefail
# get list of surface kernels with timestamp
kernels=$(find /boot -maxdepth 1 -name "vmlinuz-*.surface.*" -printf '%T@\t%p\n')
# sort by timestamp
kernels=$(echo "${kernels}" | sort -n)
# get latest kernel (last line) and extract path
kernel=$(echo "${kernels}" | tail -n1 | cut -f2)
echo $kernel
# update GRUB config
grubby --set-default "${kernel}"
# update timestamp for rEFInd (ensure it's marked as latest across all kernels,
# not just surface ones)
touch "${kernel}"

View file

@ -1,87 +0,0 @@
#!/usr/bin/env python3
from __future__ import annotations
import subprocess
import sys
from pathlib import Path
from typing import Any
def grub2_editenv(*args: Any, **kwargs: Any) -> str:
subprocess.run(["grub2-editenv", *args], check=True, **kwargs)
def main() -> int:
boot: Path = Path("/boot")
mid: Path = Path("/etc/machine-id")
if not boot.exists():
print("ERROR: /boot directory does not exist")
return 1
if not mid.exists():
print("ERROR: /etc/machine-id does not exist")
return 1
blsdir: Path = boot / "loader" / "entries"
if not blsdir.exists():
print("ERROR: /boot/loader/entries does not exist")
return 1
try:
grub2_editenv("--help", capture_output=True)
except:
print("ERROR: grub2-editenv is not working")
return 1
# Get list of surface kernels sorted by timestamp.
#
# We use creation time here because it represents when the kernel was installed.
# Modification time can be a bit wonky and seems to correspond to the build date.
kernels: list[Path] = sorted(
boot.glob("vmlinuz-*.surface.*"),
key=lambda x: x.stat().st_ctime,
reverse=True,
)
if len(kernels) == 0:
print("ERROR: Failed to find a surface kernel")
return 1
# The saved_entry property from grubenv determines what kernel is booted by default.
# Its value is the filename of the BLS entry in /boot/loader/entries minus the file extension.
#
# The BLS files are named using a combination of the machine ID and the version string
# of the kernel that is being booted. Since we have the vmlinux, we can get the version
# from its name, and the machine ID from /etc/machine-id.
#
# This allows setting the default kernel without calling grubby or having to figure out
# which path GRUB will use to boot the kernel.
kernel: Path = kernels[0]
machineid: str = mid.read_text().strip()
version: str = kernel.name.lstrip("vmlinuz-")
blscfg: Path = blsdir / "{}-{}.conf".format(machineid, version)
# Make sure the config really exists
if not blscfg.exists():
print("ERROR: {} does not exist".format(blscfg))
return 1
print("Kernel: {}".format(kernel))
print("BLS entry: {}".format(blscfg))
grub2_editenv("-", "set", "saved_entry={}".format(blscfg.stem))
# Update timestamp for rEFInd and ensure it is marked as latest across all kernels
kernel.touch(exist_ok=True)
return 0
if __name__ == "__main__":
sys.exit(main())

View file

@ -1,6 +1,6 @@
From 1cad947df5f2ec874863e42cce595a76dad64cc2 Mon Sep 17 00:00:00 2001
From 5fc0582727cb64230d1c2ac02001263f92a9b82c Mon Sep 17 00:00:00 2001
From: Dorian Stoll <dorian.stoll@tmsp.io>
Date: Sat, 22 Jul 2023 10:33:03 +0200
Date: Sun, 14 May 2023 09:21:43 +0200
Subject: [PATCH] Pull in iptsd as a weak dependency
Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
@ -9,10 +9,10 @@ Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
1 file changed, 1 insertion(+)
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index d3dafe56aa64..24823cd8b784 100644
index 51f43b21b018..d61276b49d95 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -1052,6 +1052,7 @@ Requires(pre): %{kernel_prereq}\
@@ -938,6 +938,7 @@ Requires(pre): %{kernel_prereq}\
Requires(pre): %{initrd_prereq}\
Requires(pre): ((linux-firmware >= 20150904-56.git6ebf5d57) if linux-firmware)\
Recommends: linux-firmware\
@ -21,5 +21,5 @@ index d3dafe56aa64..24823cd8b784 100644
Conflicts: xfsprogs < 4.3.0-1\
Conflicts: xorg-x11-drv-vmmouse < 13.0.99\
--
2.41.0
2.40.1

View file

@ -1,6 +1,6 @@
From 17907fed744ae17414a1ad8bebc335e12dac7691 Mon Sep 17 00:00:00 2001
From 4f7a333fc3dbacc4b3fa25ea117cb59f865878af Mon Sep 17 00:00:00 2001
From: Dorian Stoll <dorian.stoll@tmsp.io>
Date: Sat, 22 Jul 2023 10:34:38 +0200
Date: Sun, 14 May 2023 15:04:22 +0200
Subject: [PATCH] Let kernel-surface provide the standard package names
Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
@ -9,10 +9,10 @@ Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
1 file changed, 5 insertions(+)
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index 24823cd8b784..ea7de5884a89 100644
index 51f43b21b018..2d91719b7d93 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -697,6 +697,7 @@ Requires: kernel-core-uname-r = %{KVERREL}
@@ -598,6 +598,7 @@ Requires: kernel-core-uname-r = %{KVERREL}
Requires: kernel-modules-uname-r = %{KVERREL}
Requires: kernel-modules-core-uname-r = %{KVERREL}
Provides: installonlypkg(kernel)
@ -20,15 +20,15 @@ index 24823cd8b784..ea7de5884a89 100644
%endif
@@ -1352,6 +1353,7 @@ Summary: Development package for building kernel modules to match the %{?2:%{2}
@@ -1226,6 +1227,7 @@ Summary: Development package for building kernel modules to match the %{?2:%{2}
Provides: kernel%{?1:-%{1}}-devel-%{_target_cpu} = %{specrpmversion}-%{release}\
Provides: kernel-devel-%{_target_cpu} = %{specrpmversion}-%{release}%{uname_suffix %{?1:+%{1}}}\
Provides: kernel-devel-uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\
Provides: kernel-devel-%{_target_cpu} = %{specrpmversion}-%{release}%{?1:+%{1}}\
Provides: kernel-devel-uname-r = %{KVERREL}%{?1:+%{1}}\
+Provides: kernel-devel = %{KVERREL}%{?1:+%{1}}\
Provides: installonlypkg(kernel)\
AutoReqProv: no\
Requires(pre): findutils\
@@ -1381,6 +1383,7 @@ against the %{?2:%{2} }kernel package.\
@@ -1255,6 +1257,7 @@ against the %{?2:%{2} }kernel package.\
Summary: Meta package to install matching core and devel packages for a given %{?2:%{2} }kernel\
Requires: %{package_name}%{?1:-%{1}}-devel = %{specrpmversion}-%{release}\
Requires: %{package_name}%{?1:-%{1}}-core = %{specrpmversion}-%{release}\
@ -36,22 +36,22 @@ index 24823cd8b784..ea7de5884a89 100644
%description %{?1:%{1}-}devel-matched\
This meta package is used to install matching core and devel packages for a given %{?2:%{2} }kernel.\
%{nil}
@@ -1502,6 +1505,7 @@ Requires: kernel-%{1}-modules-core-uname-r = %{KVERREL}+%{uname_suffix %{1}}\
Requires: realtime-setup\
%endif\
@@ -1373,6 +1376,7 @@ Requires: kernel-%{1}-core-uname-r = %{KVERREL}+%{1}\
Requires: kernel-%{1}-modules-uname-r = %{KVERREL}+%{1}\
Requires: kernel-%{1}-modules-core-uname-r = %{KVERREL}+%{1}\
Provides: installonlypkg(kernel)\
+Provides: kernel = %{KVERREL}+%{1}\
%description %{1}\
The meta-package for the %{1} kernel\
%{nil}
@@ -1534,6 +1538,7 @@ This package provides KVM modules for package kernel%{?1:-%{1}}.\
@@ -1387,6 +1391,7 @@ The meta-package for the %{1} kernel\
Summary: %{variant_summary}\
Provides: kernel-%{?1:%{1}-}core-uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\
Provides: kernel-%{?1:%{1}-}core-uname-r = %{KVERREL}%{?1:+%{1}}\
Provides: installonlypkg(kernel)\
+Provides: kernel-%{?1:%{1}-}core = %{KVERREL}%{?1:+%{1}}\
%if %{-m:1}%{!-m:0}\
Requires: kernel-core-uname-r = %{KVERREL}%{uname_variant %{?1:+%{1}}}\
Requires: kernel-%{?1:%{1}-}-modules-core-uname-r = %{KVERREL}%{uname_variant %{?1:+%{1}}}\
Requires: kernel-core-uname-r = %{KVERREL}\
Requires: kernel-%{?1:%{1}-}-modules-core-uname-r = %{KVERREL}%{?1:+%{1}}\
--
2.41.0
2.40.1

View file

@ -1,19 +1,19 @@
From 819c1b06089925d6944bf2dad9dc29649b7510d5 Mon Sep 17 00:00:00 2001
From 084f48d80c730162805d654325934843cd12db94 Mon Sep 17 00:00:00 2001
From: Dorian Stoll <dorian.stoll@tmsp.io>
Date: Sat, 22 Jul 2023 10:40:32 +0200
Date: Sun, 14 May 2023 18:16:38 +0200
Subject: [PATCH] Let kernel-surface conflict with older versions of the
package
Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
---
redhat/kernel.spec.template | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
redhat/kernel.spec.template | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index ea7de5884a89..43dce82a9d36 100644
index 2d91719b7d93..9ad0c720d467 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -698,6 +698,10 @@ Requires: kernel-modules-uname-r = %{KVERREL}
@@ -599,6 +599,10 @@ Requires: kernel-modules-uname-r = %{KVERREL}
Requires: kernel-modules-core-uname-r = %{KVERREL}
Provides: installonlypkg(kernel)
Provides: kernel = %{KVERREL}
@ -24,78 +24,6 @@ index ea7de5884a89..43dce82a9d36 100644
%endif
@@ -1355,6 +1359,8 @@ Provides: kernel-devel-%{_target_cpu} = %{specrpmversion}-%{release}%{uname_suff
Provides: kernel-devel-uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\
Provides: kernel-devel = %{KVERREL}%{?1:+%{1}}\
Provides: installonlypkg(kernel)\
+Conflicts: %{package_name}-devel < 6.3.7-2\
+Obsoletes: %{package_name}-devel < 6.3.7-2\
AutoReqProv: no\
Requires(pre): findutils\
Requires: findutils\
@@ -1384,6 +1390,8 @@ Summary: Meta package to install matching core and devel packages for a given %{
Requires: %{package_name}%{?1:-%{1}}-devel = %{specrpmversion}-%{release}\
Requires: %{package_name}%{?1:-%{1}}-core = %{specrpmversion}-%{release}\
Provides: kernel-devel-matched = %{specrpmversion}-%{release}\
+Conflicts: %{package_name}-devel-matched < 6.3.7-2\
+Obsoletes: %{package_name}-devel-matched < 6.3.7-2\
%description %{?1:%{1}-}devel-matched\
This meta package is used to install matching core and devel packages for a given %{?2:%{2} }kernel.\
%{nil}
@@ -1416,6 +1424,8 @@ Provides: kernel%{?1:-%{1}}-modules-internal-uname-r = %{KVERREL}%{uname_suffix
Requires: kernel-uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\
Requires: kernel%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\
Requires: kernel%{?1:-%{1}}-modules-core-uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\
+Conflicts: %{package_name}-modules-internal < 6.3.7-2\
+Obsoletes: %{package_name}-modules-internal < 6.3.7-2\
AutoReq: no\
AutoProv: yes\
%description %{?1:%{1}-}modules-internal\
@@ -1437,6 +1447,8 @@ Provides: kernel%{?1:-%{1}}-modules-extra-uname-r = %{KVERREL}%{uname_suffix %{?
Requires: kernel-uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\
Requires: kernel%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\
Requires: kernel%{?1:-%{1}}-modules-core-uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\
+Conflicts: %{package_name}-modules-extra < 6.3.7-2\
+Obsoletes: %{package_name}-modules-extra < 6.3.7-2\
%if %{-m:1}%{!-m:0}\
Requires: kernel-modules-extra-uname-r = %{KVERREL}%{uname_variant %{?1:+%{1}}}\
%endif\
@@ -1460,6 +1472,8 @@ Provides: installonlypkg(kernel-module)\
Provides: kernel%{?1:-%{1}}-modules-uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\
Requires: kernel-uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\
Requires: kernel%{?1:-%{1}}-modules-core-uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\
+Conflicts: %{package_name}-modules < 6.3.7-2\
+Obsoletes: %{package_name}-modules < 6.3.7-2\
%if %{-m:1}%{!-m:0}\
Requires: kernel-modules-uname-r = %{KVERREL}%{uname_variant %{?1:+%{1}}}\
%endif\
@@ -1482,6 +1496,8 @@ Provides: kernel-modules-core = %{specrpmversion}-%{release}%{uname_suffix %{?1:
Provides: installonlypkg(kernel-module)\
Provides: kernel%{?1:-%{1}}-modules-core-uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\
Requires: kernel-uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\
+Conflicts: %{package_name}-modules-core < 6.3.7-2\
+Obsoletes: %{package_name}-modules-core < 6.3.7-2\
%if %{-m:1}%{!-m:0}\
Requires: kernel-modules-core-uname-r = %{KVERREL}%{uname_variant %{?1:+%{1}}}\
%endif\
@@ -1504,6 +1520,8 @@ Requires: kernel-%{1}-modules-core-uname-r = %{KVERREL}+%{uname_suffix %{1}}\
%if "%{1}" == "rt" || "%{1}" == "rt-debug"\
Requires: realtime-setup\
%endif\
+Conflicts: %{package_name} < 6.3.7-2\
+Obsoletes: %{package_name} < 6.3.7-2\
Provides: installonlypkg(kernel)\
Provides: kernel = %{KVERREL}+%{1}\
%description %{1}\
@@ -1539,6 +1557,8 @@ Summary: %{variant_summary}\
Provides: kernel-%{?1:%{1}-}core-uname-r = %{KVERREL}%{uname_suffix %{?1:+%{1}}}\
Provides: installonlypkg(kernel)\
Provides: kernel-%{?1:%{1}-}core = %{KVERREL}%{?1:+%{1}}\
+Conflicts: %{package_name}-core < 6.3.7-2\
+Obsoletes: %{package_name}-core < 6.3.7-2\
%if %{-m:1}%{!-m:0}\
Requires: kernel-core-uname-r = %{KVERREL}%{uname_variant %{?1:+%{1}}}\
Requires: kernel-%{?1:%{1}-}-modules-core-uname-r = %{KVERREL}%{uname_variant %{?1:+%{1}}}\
--
2.41.0
2.40.1

View file

@ -1,94 +1,50 @@
From 81141a454f41cbc5fd41b778f85b10552c8676e8 Mon Sep 17 00:00:00 2001
From 5d16b0aca7c07c1e3df5c47c61f5b6f402dd987b Mon Sep 17 00:00:00 2001
From: Dorian Stoll <dorian.stoll@tmsp.io>
Date: Sat, 22 Jul 2023 10:41:11 +0200
Date: Sat, 3 Jun 2023 11:47:02 +0200
Subject: [PATCH] Install scripts and service files for keeping the surface
kernel the default
Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
---
redhat/kernel.spec.template | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
redhat/kernel.spec.template | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index 43dce82a9d36..28df94e561d4 100644
index 9ad0c720d467..5a367c936e05 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -1025,6 +1025,11 @@ Source4000: README.rst
@@ -911,6 +911,10 @@ Source4000: README.rst
Source4001: rpminspect.yaml
Source4002: gating.yaml
+Source4100: linux-surface-default-watchdog.path
+Source4101: linux-surface-default-watchdog.service
+Source4102: linux-surface-default-watchdog.py
+Source4103: 90-linux-surface-default-watchdog.preset
+Source4100: linux-surface-default-kernel.path
+Source4101: linux-surface-default-kernel.service
+Source4102: linux-surface-default-kernel.sh
+
## Patches needed for building this package
%if !%{nopatches}
@@ -1058,6 +1063,7 @@ Requires(pre): %{initrd_prereq}\
Requires(pre): ((linux-firmware >= 20150904-56.git6ebf5d57) if linux-firmware)\
Recommends: linux-firmware\
Recommends: iptsd\
+Recommends: %{package_name}-default-watchdog\
Requires(preun): systemd >= 200\
Conflicts: xfsprogs < 4.3.0-1\
Conflicts: xorg-x11-drv-vmmouse < 13.0.99\
@@ -1072,6 +1078,14 @@ AutoProv: yes\
%{nil}
+%package default-watchdog
+Summary: Watchdog service ensuring that the surface kernel stays the default kernel.
+%description default-watchdog
+This package provides a systemd service that will automatically keep
+the surface kernel as the default kernel in GRUB, even if a newer stock
+kernel has been installed.
+
+
%package doc
Summary: Various documentation bits found in the kernel source
Group: Documentation
@@ -2945,6 +2959,11 @@ find Documentation -type d | xargs chmod u+w
@@ -2674,6 +2678,10 @@ find Documentation -type d | xargs chmod u+w
cd linux-%{KVERREL}
+install -D -m644 "%{SOURCE4100}" -t "%{buildroot}%{_unitdir}"
+install -D -m644 "%{SOURCE4101}" -t "%{buildroot}%{_unitdir}"
+install -D -m755 "%{SOURCE4102}" -t "%{buildroot}%{_bindir}"
+install -D -m755 "%{SOURCE4103}" -t "%{buildroot}%{_presetdir}"
+
%if %{with_doc}
docdir=$RPM_BUILD_ROOT%{_datadir}/doc/kernel-doc-%{specversion}-%{pkgrelease}
@@ -3197,6 +3216,15 @@ popd
### scripts
###
+%post default-watchdog
+%systemd_post linux-surface-default-watchdog.path
+
+%preun default-watchdog
+%systemd_preun linux-surface-default-watchdog.path
+
+%postun default-watchdog
+%systemd_postun_with_restart linux-surface-default-watchdog.path
+
%if %{with_tools}
%post -n %{package_name}-tools-libs
/sbin/ldconfig
@@ -3609,6 +3637,12 @@ fi\
%{_libexecdir}/kselftests
%endif
+%files default-watchdog
+%{_bindir}/linux-surface-default-watchdog.py
+%{_unitdir}/linux-surface-default-watchdog.path
+%{_unitdir}/linux-surface-default-watchdog.service
+%{_presetdir}/90-linux-surface-default-watchdog.preset
+
# empty meta-package
%if %{with_up_base}
%ifnarch %nobuildarches noarch
@@ -3331,6 +3339,9 @@ fi
%ghost %attr(0600, root, root) /boot/symvers-%{KVERREL}%{?3:+%{3}}.gz\
%ghost %attr(0600, root, root) /boot/initramfs-%{KVERREL}%{?3:+%{3}}.img\
%ghost %attr(0644, root, root) /boot/config-%{KVERREL}%{?3:+%{3}}\
+%{_bindir}/linux-surface-default-kernel.sh\
+%{_unitdir}/linux-surface-default-kernel.path\
+%{_unitdir}/linux-surface-default-kernel.service\
%{expand:%%files -f kernel-%{?3:%{3}-}modules-core.list %{?3:%{3}-}modules-core}\
%dir /lib/modules\
%dir /lib/modules/%{KVERREL}%{?3:+%{3}}\
--
2.41.0
2.40.1

View file

@ -1,26 +0,0 @@
From bb654591f82503f9e3c319902af2a2b64c18ae50 Mon Sep 17 00:00:00 2001
From: Dorian Stoll <dorian.stoll@tmsp.io>
Date: Sat, 13 Jan 2024 12:30:02 +0100
Subject: [PATCH] HACK: Move surface_fan and surface_temp to kernel-modules
---
redhat/fedora_files/filter-modules.sh.fedora | 3 +++
1 file changed, 3 insertions(+)
diff --git a/redhat/fedora_files/filter-modules.sh.fedora b/redhat/fedora_files/filter-modules.sh.fedora
index 2e7b79eba1d9..7ef7614cbda2 100755
--- a/redhat/fedora_files/filter-modules.sh.fedora
+++ b/redhat/fedora_files/filter-modules.sh.fedora
@@ -84,6 +84,9 @@ filter_ko() {
return 0
}
+# HACK: move surface_fan and surface_temp to kernel-modules
+singlemods="${singlemods} surface_fan surface_temp"
+
# Filter the drivers/ subsystems
for subsys in ${driverdirs}
do
--
2.43.0

View file

@ -1,25 +0,0 @@
From a82af933b2ee35e24140ee7fddf9a083596cda3f Mon Sep 17 00:00:00 2001
From: Dorian Stoll <dorian.stoll@tmsp.io>
Date: Mon, 29 Jan 2024 19:26:41 +0100
Subject: [PATCH] Pull in intel-vsc-firmware
This package contains the IPU3 firmware needed for camera support.
---
redhat/kernel.spec.template | 1 +
1 file changed, 1 insertion(+)
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index 4ece0fa3a56c..768316b2ec82 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -1028,6 +1028,7 @@ Requires(pre): %{kernel_prereq}\
Requires(pre): %{initrd_prereq}\
Requires(pre): ((linux-firmware >= 20150904-56.git6ebf5d57) if linux-firmware)\
Recommends: linux-firmware\
+Recommends: intel-vsc-firmware\
Recommends: iptsd\
Recommends: %{package_name}-default-watchdog\
Requires(preun): systemd >= 200\
--
2.43.0

View file

@ -1,6 +1,6 @@
From d4bbfbfee98f8b117885cf88a48f686ac889d73e Mon Sep 17 00:00:00 2001
From 67f8052f553191686b1224b5598d00ff33d38608 Mon Sep 17 00:00:00 2001
From: Dorian Stoll <dorian.stoll@tmsp.io>
Date: Sat, 22 Jul 2023 10:45:33 +0200
Date: Sat, 13 May 2023 16:39:50 +0200
Subject: [PATCH] Use a custom key and certificate for Secure Boot signing
Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
@ -9,10 +9,10 @@ Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index 0fb19cc23041..d7bd6013423c 100644
index 51f43b21b018..76d1ad8e2818 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -762,6 +762,7 @@ BuildRequires: system-sb-certs
@@ -703,6 +703,7 @@ BuildRequires: system-sb-certs
%ifarch x86_64 aarch64
BuildRequires: nss-tools
BuildRequires: pesign >= 0.10-4
@ -20,7 +20,7 @@ index 0fb19cc23041..d7bd6013423c 100644
%endif
%endif
%endif
@@ -821,6 +822,13 @@ Source2: kernel.changelog
@@ -762,6 +763,13 @@ Source1: Makefile.rhelver
%define signing_key_filename kernel-signing-s390.cer
%endif
@ -34,10 +34,10 @@ index 0fb19cc23041..d7bd6013423c 100644
%if %{?released_kernel}
Source10: redhatsecurebootca5.cer
@@ -2201,9 +2209,7 @@ BuildKernel() {
@@ -1860,9 +1868,7 @@ BuildKernel() {
fi
%ifarch x86_64 aarch64
%{log_msg "Sign kernel image"}
- %pesign -s -i $SignImage -o vmlinuz.tmp -a %{secureboot_ca_0} -c %{secureboot_key_0} -n %{pesign_name_0}
- %pesign -s -i vmlinuz.tmp -o vmlinuz.signed -a %{secureboot_ca_1} -c %{secureboot_key_1} -n %{pesign_name_1}
- rm vmlinuz.tmp
@ -45,8 +45,8 @@ index 0fb19cc23041..d7bd6013423c 100644
%endif
%ifarch s390x ppc64le
if [ -x /usr/bin/rpm-sign ]; then
@@ -2783,9 +2789,6 @@ BuildKernel() {
%{log_msg "Install certs"}
@@ -2393,9 +2399,6 @@ BuildKernel() {
# Red Hat UEFI Secure Boot CA cert, which can be used to authenticate the kernel
mkdir -p $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer
%ifarch x86_64 aarch64
- install -m 0644 %{secureboot_ca_0} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca-20200609.cer
@ -56,5 +56,5 @@ index 0fb19cc23041..d7bd6013423c 100644
install -m 0644 %{secureboot_ca_0} $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer/kernel-signing-ca.cer
%endif
--
2.44.0
2.40.1

View file

@ -1,93 +0,0 @@
#!/usr/bin/env bash
set -euxo pipefail
tag()
{
DISTRO="${1:-}"
VERSION="${2:-}"
if [ -z "${DISTRO}" ]; then
echo "DISTRO missing!"
return 1
fi
if [ -z "${VERSION}" ]; then
echo "VERSION missing!"
return 1
fi
git tag -f "${DISTRO}-${VERSION}"
git push --force origin "${DISTRO}-${VERSION}"
}
getarch()
{
VERSION="$(grep 'pkgver=' pkg/arch/kernel/PKGBUILD | cut -d'=' -f2 | cut -d'.' -f1-3)"
RELEASE="$(grep 'pkgrel=' pkg/arch/kernel/PKGBUILD | cut -d'=' -f2)"
if [ -z "${VERSION}" ]; then
echo "VERSION missing!"
return 1
fi
if [ -z "${RELEASE}" ]; then
echo "RELEASE missing!"
return 1
fi
echo "${VERSION}-${RELEASE}"
}
getdebian()
{
. pkg/debian/kernel/version.conf
if [ -z "${KERNEL_VERSION}" ]; then
echo "KERNEL_VERSION missing!"
return 1
fi
if [ -z "${KERNEL_REVISION}" ]; then
echo "KERNEL_REVISION missing!"
return 1
fi
echo "${KERNEL_VERSION}-${KERNEL_REVISION}"
}
getfedoravar()
{
VAR="${1:-}"
if [ -z "${VAR}" ]; then
echo "VAR is missing!"
return 1
fi
grep -E "${VAR} = \"([^\"]+)\"" pkg/fedora/kernel-surface/build-linux-surface.py | sed "s|^${VAR} = \"||g" | sed 's|"$||g'
}
getfedora()
{
VERSION="$(getfedoravar PACKAGE_TAG | cut -d'-' -f2)"
RELEASE="$(getfedoravar PACKAGE_RELEASE)"
if [ -z "${VERSION}" ]; then
echo "VERSION missing!"
return 1
fi
if [ -z "${RELEASE}" ]; then
echo "RELEASE missing!"
return 1
fi
echo "${VERSION}-${RELEASE}"
}
tag 'arch' "$(getarch)"
tag 'debian' "$(getdebian)"
tag 'fedora-38' "$(getfedora)"
tag 'fedora-39' "$(getfedora)"
tag 'fedora-40' "$(getfedora)"