Skip to content

Commit d3501dc

Browse files
committed
Merge branch 'master' into 'master'
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
2 parents a199701 + 7853cbf commit d3501dc

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

ddcci-backlight/ddcci-backlight.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,23 @@ static int ddcci_monitor_readctrl(struct ddcci_device *device,
8888
return -EIO;
8989
}
9090

91+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
92+
static bool ddcci_backlight_controls_device(struct backlight_device *bl,
93+
struct device *display_dev)
94+
{
95+
struct ddcci_monitor_drv_data *drv_data = bl_get_data(bl);
96+
97+
return drv_data->fb_dev == NULL || drv_data->fb_dev == display_dev;
98+
}
99+
#else
91100
static int ddcci_backlight_check_fb(struct backlight_device *bl,
92101
struct fb_info *info)
93102
{
94103
struct ddcci_monitor_drv_data *drv_data = bl_get_data(bl);
95104

96105
return drv_data->fb_dev == NULL || drv_data->fb_dev == info->dev;
97106
}
107+
#endif
98108

99109
static int ddcci_backlight_update_status(struct backlight_device *bl)
100110
{
@@ -135,7 +145,11 @@ static const struct backlight_ops ddcci_backlight_ops = {
135145
.options = 0,
136146
.update_status = ddcci_backlight_update_status,
137147
.get_brightness = ddcci_backlight_get_brightness,
148+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
149+
.controls_device = ddcci_backlight_controls_device,
150+
#else
138151
.check_fb = ddcci_backlight_check_fb,
152+
#endif
139153
};
140154

141155
static const char *ddcci_monitor_vcp_name(unsigned char vcp)

ddcci/ddcci.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1824,7 +1824,9 @@ static struct i2c_driver ddcci_driver = {
18241824
#else
18251825
.remove = ddcci_remove,
18261826
#endif
1827-
.class = I2C_CLASS_SPD,
1827+
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)
1828+
.class = I2C_CLASS_DDC,
1829+
#endif
18281830
.detect = ddcci_detect,
18291831
.address_list = I2C_ADDRS(
18301832
DDCCI_DEFAULT_DEVICE_ADDR>>1
@@ -1840,6 +1842,11 @@ static int __init ddcci_module_init(void)
18401842
int ret;
18411843

18421844
pr_debug("initializing ddcci driver\n");
1845+
1846+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
1847+
pr_warn("WARNING: Auto-probing of displays is not available on kernel 6.8 and later\n");
1848+
#endif
1849+
18431850
/* Allocate a device number region for the character devices */
18441851
ret = alloc_chrdev_region(&ddcci_cdev_first, 0, 128, DEVICE_NAME);
18451852
if (ret < 0) {

0 commit comments

Comments
 (0)