Skip to content

Commit

Permalink
Merge branch 'master' into 'master'
Browse files Browse the repository at this point in the history
Improve the Linux 6.8+ compat patch, fix building on 6.10+

Closes torvalds#44

See merge request ddcci-driver-linux/ddcci-driver-linux!16
  • Loading branch information
cgrenz committed Sep 26, 2024
2 parents a199701 + 7853cbf commit d3501dc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
14 changes: 14 additions & 0 deletions ddcci-backlight/ddcci-backlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,23 @@ static int ddcci_monitor_readctrl(struct ddcci_device *device,
return -EIO;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
static bool ddcci_backlight_controls_device(struct backlight_device *bl,
struct device *display_dev)
{
struct ddcci_monitor_drv_data *drv_data = bl_get_data(bl);

return drv_data->fb_dev == NULL || drv_data->fb_dev == display_dev;
}
#else
static int ddcci_backlight_check_fb(struct backlight_device *bl,
struct fb_info *info)
{
struct ddcci_monitor_drv_data *drv_data = bl_get_data(bl);

return drv_data->fb_dev == NULL || drv_data->fb_dev == info->dev;
}
#endif

static int ddcci_backlight_update_status(struct backlight_device *bl)
{
Expand Down Expand Up @@ -135,7 +145,11 @@ static const struct backlight_ops ddcci_backlight_ops = {
.options = 0,
.update_status = ddcci_backlight_update_status,
.get_brightness = ddcci_backlight_get_brightness,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
.controls_device = ddcci_backlight_controls_device,
#else
.check_fb = ddcci_backlight_check_fb,
#endif
};

static const char *ddcci_monitor_vcp_name(unsigned char vcp)
Expand Down
9 changes: 8 additions & 1 deletion ddcci/ddcci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,9 @@ static struct i2c_driver ddcci_driver = {
#else
.remove = ddcci_remove,
#endif
.class = I2C_CLASS_SPD,
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)
.class = I2C_CLASS_DDC,
#endif
.detect = ddcci_detect,
.address_list = I2C_ADDRS(
DDCCI_DEFAULT_DEVICE_ADDR>>1
Expand All @@ -1840,6 +1842,11 @@ static int __init ddcci_module_init(void)
int ret;

pr_debug("initializing ddcci driver\n");

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
pr_warn("WARNING: Auto-probing of displays is not available on kernel 6.8 and later\n");
#endif

/* Allocate a device number region for the character devices */
ret = alloc_chrdev_region(&ddcci_cdev_first, 0, 128, DEVICE_NAME);
if (ret < 0) {
Expand Down

0 comments on commit d3501dc

Please sign in to comment.