Rename to sharp-drm

This commit is contained in:
Andrew D'Angelo 2023-08-12 18:41:48 -05:00
parent 356f882e5a
commit b688100bb7
6 changed files with 36 additions and 24 deletions

View File

@ -1,5 +1,5 @@
config BR2_PACKAGE_SHARP config BR2_PACKAGE_SHARP_DRM
bool "sharp" bool "sharp-drm"
default y default y
depends on BR2_LINUX_KERNEL depends on BR2_LINUX_KERNEL
select BR2_PACKAGE_LIBDRM select BR2_PACKAGE_LIBDRM

View File

@ -1,6 +1,11 @@
obj-m += sharp.o obj-m += sharp-drm.o
sharp-objs += src/main.o src/drm_iface.o src/params_iface.o src/ioctl_iface.o sharp-drm-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 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 .PHONY: all clean install uninstall
@ -9,37 +14,43 @@ ifeq ($(LINUX_DIR),)
LINUX_DIR := /lib/modules/$(shell uname -r)/build LINUX_DIR := /lib/modules/$(shell uname -r)/build
endif 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 all:
$(MAKE) -C '$(LINUX_DIR)' M='$(shell pwd)' modules $(MAKE) -C '$(LINUX_DIR)' M='$(shell pwd)'
sharp.dtbo: sharp.dts install_modules:
dtc -@ -I dts -O dtb -W no-unit_address_vs_reg -o $@ $<
install: sharp.ko sharp.dtbo
# Install kernel module
$(MAKE) -C '$(LINUX_DIR)' M='$(shell pwd)' modules_install $(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 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 # Add configuration line if it wasn't already there
grep -qxF '$(BOOT_CONFIG_LINE)' /boot/config.txt \ 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 # Add auto-load module line if it wasn't already there
grep -qxF 'sharp' /etc/modules \ grep -qxF 'sharp-drm' /etc/modules \
|| echo 'sharp' >> /etc/modules || echo 'sharp-drm' >> /etc/modules
# Rebuild dependencies # Rebuild dependencies
depmod -A depmod -A
uninstall: uninstall:
# Remove auto-load module line and create a backup file # 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 # Remove configuration line and create a backup file
sed -i.save '/$(BOOT_CONFIG_LINE)/d' /boot/config.txt sed -i.save '/$(BOOT_CONFIG_LINE)/d' /boot/config.txt
# Remove device tree overlay # Remove device tree overlay
rm -f /boot/overlays/sharp.dtbo rm -f /boot/overlays/sharp-drm.dtbo
clean: clean:
$(MAKE) -C '$(LINUX_DIR)' M='$(shell pwd)' clean $(MAKE) -C '$(LINUX_DIR)' M='$(shell pwd)' clean

View File

@ -43,8 +43,8 @@
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
sharp: sharp@0{ sharp_drm: sharp_drm@0{
compatible = "sharp"; compatible = "sharp-drm";
reg = <0>; reg = <0>;
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&sharp_pins>; pinctrl-0 = <&sharp_pins>;

View File

@ -455,7 +455,7 @@ static const struct drm_driver sharp_memory_driver = {
.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
.fops = &sharp_memory_fops, .fops = &sharp_memory_fops,
DRM_GEM_DMA_DRIVER_OPS_VMAP, DRM_GEM_DMA_DRIVER_OPS_VMAP,
.name = "sharp_memory", .name = "sharp_drm",
.desc = "Sharp Memory LCD panel", .desc = "Sharp Memory LCD panel",
.date = "20230713", .date = "20230713",
.major = 1, .major = 1,

View File

@ -49,7 +49,7 @@ static void sharp_memory_shutdown(struct spi_device *spi)
static struct spi_driver sharp_memory_spi_driver = { static struct spi_driver sharp_memory_spi_driver = {
.driver = { .driver = {
.name = "sharp", .name = "sharp-drm",
}, },
.probe = sharp_memory_probe, .probe = sharp_memory_probe,
.remove = sharp_memory_remove, .remove = sharp_memory_remove,
@ -57,6 +57,7 @@ static struct spi_driver sharp_memory_spi_driver = {
}; };
module_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_DESCRIPTION("Sharp Memory LCD DRM driver");
MODULE_AUTHOR("Andrew D'Angelo"); MODULE_AUTHOR("Andrew D'Angelo");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");