Skip to content

Commit

Permalink
Merge pull request #1 from EffectiveRange/dev
Browse files Browse the repository at this point in the history
feat: Refactor TI driver to be usable on kernel 6.1.21+
  • Loading branch information
effective-range authored Jul 15, 2024
2 parents e1a4247 + 17026fa commit 53a8548
Show file tree
Hide file tree
Showing 16 changed files with 1,767 additions and 609 deletions.
743 changes: 743 additions & 0 deletions .clang-format

Large diffs are not rendered by default.

67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Release

on:
push:
branches: main
tags: v*.*.*

pull_request:
types:
- synchronize
- opened
- reopened

concurrency:
group: ${{ github.workflow }}-${{ github.sha }}
cancel-in-progress: true


jobs:

create_release:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
discussions: write
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
submodules: true
-
name: Set up QEMU for multi-architecture builds
uses: docker/setup-qemu-action@v2
-
name: Extract project name
id: extract
run: |
echo proj="$(basename ${{github.workspace}})" >> $GITHUB_OUTPUT
-
name: Build Project
uses: devcontainers/[email protected]
with:
subFolder: "${{github.workspace}}"
configFile: .devcontainer/armhf-container/devcontainer.json
push: never
runCmd: |
make -C "/workspaces/${{steps.extract.outputs.proj}}/" all
-
name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
fail_on_unmatched_files: true
generate_release_notes: true
files: |
build/*.deb
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build/*
mrhat-*/boot/*
mrhat-*/boot/*
mrhat-*/lib/*
360 changes: 339 additions & 21 deletions LICENSE

Large diffs are not rendered by default.

58 changes: 48 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,48 @@
obj-m += bq2562x_charger.o

KVER ?= $(shell uname -r)
PWD := $(CURDIR)

all:
make -C /lib/modules/$(KVER)/build M=$(PWD) modules

clean:
make -C /lib/modules/$(KVER)/build M=$(PWD) clean

VERSION = $(shell grep Version: mrhat-bq25622/DEBIAN/control | cut -d' ' -f2)
# TODO: build module for all kernel versions
KVER ?= 6.1.21+
TARGET ?= $(error TARGET not specified for deploy )

all: build/mrhat-bq25622_$(VERSION)-1_armhf.deb
@true

build/mrhat-bq25622_$(VERSION)-1_armhf.deb : build/bq2562x_charger.ko build/mrhat-bq25622.dtbo mrhat-bq25622/DEBIAN/*
mkdir -p build
mkdir -p mrhat-bq25622/lib/modules/$(KVER)
mkdir -p mrhat-bq25622/boot/overlays/
cp build/bq2562x_charger.ko mrhat-bq25622/lib/modules/$(KVER)/
cp build/mrhat-bq25622.dtbo mrhat-bq25622/boot/overlays/
dpkg-deb --root-owner-group --build mrhat-bq25622 build/mrhat-bq25622_$(VERSION)-1_armhf.deb

build/bq2562x_charger.ko: driver/*.c driver/*.h
mkdir -p build
rsync --delete -r ./driver/ /tmp/drv-bq25622
schroot -c buildroot -u root -d /tmp/drv-bq25622 -- make KVER=$(KVER)
cp /tmp/drv-bq25622/bq2562x_charger.ko build/bq2562x_charger.ko


clean:
rm -rf mrhat-bq25622/boot/ mrhat-bq25622/lib/ build/

build/mrhat-bq25622.dts.pre: mrhat-bq25622.dts
mkdir -p build/
cpp -nostdinc -undef -x assembler-with-cpp -I/var/chroot/buildroot/usr/src/linux-headers-$(KVER)/include -o build/mrhat-bq25622.dts.pre mrhat-bq25622.dts

build/mrhat-bq25622.dtbo: build/mrhat-bq25622.dts.pre
mkdir -p build/
dtc -I dts -O dtb -o build/mrhat-bq25622.dtbo build/mrhat-bq25622.dts.pre

deploy: all
rsync -avhz --progress build/mrhat-bq25622_$(VERSION)-1_armhf.deb $(TARGET):/tmp/
ssh $(TARGET) -- sudo dpkg -r mrhat-bq25622
ssh $(TARGET) -- sudo dpkg -i /tmp/mrhat-bq25622_$(VERSION)-1_armhf.deb

quickdeploy: build/bq2562x_charger.ko
scp build/bq2562x_charger.ko $(TARGET):/tmp/
ssh $(TARGET) -- sudo cp /tmp/bq2562x_charger.ko /lib/modules/$(KVER)/
ssh $(TARGET) -- "sudo rmmod bq2562x_charger || true"
ssh $(TARGET) -- "sudo modprobe bq2562x_charger"


.PHONY: clean all deploy quickdeploy
13 changes: 0 additions & 13 deletions TI_BQ_V1.1/ReleaseNotes.txt

This file was deleted.

100 changes: 0 additions & 100 deletions bq2562x.yaml

This file was deleted.

10 changes: 10 additions & 0 deletions driver/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
obj-m += bq2562x_charger.o

KVER ?= $(shell uname -r)
PWD := $(CURDIR)

all:
make -C /lib/modules/$(KVER)/build M=$(PWD) modules

clean:
make -C /lib/modules/$(KVER)/build M=$(PWD) clean
Loading

0 comments on commit 53a8548

Please sign in to comment.