From b688100bb770cba38c5ca7d0c282c6e019847f10 Mon Sep 17 00:00:00 2001 From: Andrew D'Angelo Date: Sat, 12 Aug 2023 18:41:48 -0500 Subject: [PATCH] Rename to sharp-drm --- Config.in | 4 ++-- Makefile | 47 +++++++++++++++++++++++--------------- sharp.dts => sharp-drm.dts | 4 ++-- sharp.mk => sharp-drm.mk | 0 src/drm_iface.c | 2 +- src/main.c | 3 ++- 6 files changed, 36 insertions(+), 24 deletions(-) rename sharp.dts => sharp-drm.dts (94%) rename sharp.mk => sharp-drm.mk (100%) diff --git a/Config.in b/Config.in index d293833..86e7b5f 100644 --- a/Config.in +++ b/Config.in @@ -1,5 +1,5 @@ -config BR2_PACKAGE_SHARP - bool "sharp" +config BR2_PACKAGE_SHARP_DRM + bool "sharp-drm" default y depends on BR2_LINUX_KERNEL select BR2_PACKAGE_LIBDRM diff --git a/Makefile b/Makefile index f5f4394..abd97db 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,11 @@ -obj-m += sharp.o -sharp-objs += src/main.o src/drm_iface.o src/params_iface.o src/ioctl_iface.o -ccflags-y := -DDEBUG -g -std=gnu99 -Wno-declaration-after-statement +obj-m += sharp-drm.o +sharp-drm-objs += src/main.o src/drm_iface.o src/params_iface.o src/ioctl_iface.o +ccflags-y := -g -std=gnu99 -Wno-declaration-after-statement + +dtb-y += sharp-drm.dtbo + +targets += $(dtbo-y) +always := $(dtbo-y) .PHONY: all clean install uninstall @@ -9,37 +14,43 @@ ifeq ($(LINUX_DIR),) LINUX_DIR := /lib/modules/$(shell uname -r)/build endif -BOOT_CONFIG_LINE := dtoverlay=sharp +# BUILD_DIR is set by DKMS, but not if running manually +ifeq ($(BUILD_DIR),) +BUILD_DIR := . +endif -all: sharp.ko sharp.dtbo +BOOT_CONFIG_LINE := dtoverlay=sharp-drm -sharp.ko: src/*.c src/*.h - $(MAKE) -C '$(LINUX_DIR)' M='$(shell pwd)' modules +all: + $(MAKE) -C '$(LINUX_DIR)' M='$(shell pwd)' -sharp.dtbo: sharp.dts - dtc -@ -I dts -O dtb -W no-unit_address_vs_reg -o $@ $< - -install: sharp.ko sharp.dtbo - # Install kernel module +install_modules: $(MAKE) -C '$(LINUX_DIR)' M='$(shell pwd)' modules_install + # Rebuild dependencies + depmod -A + +install: install_modules install_aux + +# Separate rule to be called from DKMS +install_aux: # Install device tree overlay - install -D -m 0644 sharp.dtbo /boot/overlays/ + install -D -m 0644 $(BUILD_DIR)/sharp-drm.dtbo /boot/overlays/ # Add configuration line if it wasn't already there grep -qxF '$(BOOT_CONFIG_LINE)' /boot/config.txt \ - || echo '[all]\n$(BOOT_CONFIG_LINE)' >> /boot/config.txt + || echo '[all]\ndtparam=spi=on\n$(BOOT_CONFIG_LINE)' >> /boot/config.txt # Add auto-load module line if it wasn't already there - grep -qxF 'sharp' /etc/modules \ - || echo 'sharp' >> /etc/modules + grep -qxF 'sharp-drm' /etc/modules \ + || echo 'sharp-drm' >> /etc/modules # Rebuild dependencies depmod -A uninstall: # Remove auto-load module line and create a backup file - sed -i.save '/sharp/d' /etc/modules + sed -i.save '/sharp-drm/d' /etc/modules # Remove configuration line and create a backup file sed -i.save '/$(BOOT_CONFIG_LINE)/d' /boot/config.txt # Remove device tree overlay - rm -f /boot/overlays/sharp.dtbo + rm -f /boot/overlays/sharp-drm.dtbo clean: $(MAKE) -C '$(LINUX_DIR)' M='$(shell pwd)' clean diff --git a/sharp.dts b/sharp-drm.dts similarity index 94% rename from sharp.dts rename to sharp-drm.dts index 2e16032..e51e478 100644 --- a/sharp.dts +++ b/sharp-drm.dts @@ -43,8 +43,8 @@ #address-cells = <1>; #size-cells = <0>; - sharp: sharp@0{ - compatible = "sharp"; + sharp_drm: sharp_drm@0{ + compatible = "sharp-drm"; reg = <0>; pinctrl-names = "default"; pinctrl-0 = <&sharp_pins>; diff --git a/sharp.mk b/sharp-drm.mk similarity index 100% rename from sharp.mk rename to sharp-drm.mk diff --git a/src/drm_iface.c b/src/drm_iface.c index 1014905..518d2e5 100644 --- a/src/drm_iface.c +++ b/src/drm_iface.c @@ -455,7 +455,7 @@ static const struct drm_driver sharp_memory_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .fops = &sharp_memory_fops, DRM_GEM_DMA_DRIVER_OPS_VMAP, - .name = "sharp_memory", + .name = "sharp_drm", .desc = "Sharp Memory LCD panel", .date = "20230713", .major = 1, diff --git a/src/main.c b/src/main.c index 4741569..8283fa4 100644 --- a/src/main.c +++ b/src/main.c @@ -49,7 +49,7 @@ static void sharp_memory_shutdown(struct spi_device *spi) static struct spi_driver sharp_memory_spi_driver = { .driver = { - .name = "sharp", + .name = "sharp-drm", }, .probe = sharp_memory_probe, .remove = sharp_memory_remove, @@ -57,6 +57,7 @@ static struct spi_driver sharp_memory_spi_driver = { }; module_spi_driver(sharp_memory_spi_driver); +MODULE_VERSION("1.0"); MODULE_DESCRIPTION("Sharp Memory LCD DRM driver"); MODULE_AUTHOR("Andrew D'Angelo"); MODULE_LICENSE("GPL");