From c0a305325dacbcf2caf97637c591209369416f2a Mon Sep 17 00:00:00 2001 From: Daisuke Sato Date: Thu, 4 Mar 2021 12:02:40 +0900 Subject: [PATCH 1/3] Support kernel 5.10.x --- src/drivers/rtmouse.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/drivers/rtmouse.c b/src/drivers/rtmouse.c index 12ab069..d6df0c4 100644 --- a/src/drivers/rtmouse.c +++ b/src/drivers/rtmouse.c @@ -5,7 +5,7 @@ * * Version: 3.0.0 * - * Copyright (C) 2015-2020 RT Corporation + * Copyright (C) 2015-2021 RT Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -752,15 +752,15 @@ static int gpio_map(void) static int clk_status = 1; if (gpio_base == NULL) { - gpio_base = ioremap_nocache(RPI_GPIO_BASE, RPI_GPIO_SIZE); + gpio_base = ioremap(RPI_GPIO_BASE, RPI_GPIO_SIZE); } if (pwm_base == NULL) { - pwm_base = ioremap_nocache(RPI_PWM_BASE, RPI_PWM_SIZE); + pwm_base = ioremap(RPI_PWM_BASE, RPI_PWM_SIZE); } if (clk_base == NULL) { - clk_base = ioremap_nocache(RPI_CLK_BASE, RPI_CLK_SIZE); + clk_base = ioremap(RPI_CLK_BASE, RPI_CLK_SIZE); } /* kill */ @@ -2060,13 +2060,13 @@ static int i2c_counter_init(void) */ // printk(KERN_DEBUG "%s: adding i2c device", __func__); i2c_adap_l = i2c_get_adapter(1); - i2c_client_l = i2c_new_device(i2c_adap_l, &i2c_board_info_l); + i2c_client_l = i2c_new_client_device(i2c_adap_l, &i2c_board_info_l); i2c_put_adapter(i2c_adap_l); // printk(KERN_DEBUG "%s: added i2c device rtcntl", __func__); // printk(KERN_DEBUG "%s: adding i2c device", __func__); i2c_adap_r = i2c_get_adapter(1); - i2c_client_r = i2c_new_device(i2c_adap_r, &i2c_board_info_r); + i2c_client_r = i2c_new_client_device(i2c_adap_r, &i2c_board_info_r); i2c_put_adapter(i2c_adap_r); // printk(KERN_DEBUG "%s: added i2c device rtcntr", __func__); From c920c68ff50c721d0a681098a609c61a256d9f2d Mon Sep 17 00:00:00 2001 From: Daisuke Sato Date: Thu, 4 Mar 2021 12:03:00 +0900 Subject: [PATCH 2/3] Bump up tp 3.1.0 --- src/drivers/rtmouse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/rtmouse.c b/src/drivers/rtmouse.c index d6df0c4..7770003 100644 --- a/src/drivers/rtmouse.c +++ b/src/drivers/rtmouse.c @@ -3,7 +3,7 @@ * rtmouse.c * Raspberry Pi Mouse device driver * - * Version: 3.0.0 + * Version: 3.1.0 * * Copyright (C) 2015-2021 RT Corporation * From 9f0905b638e3318cf721dab281de3a121ee47aa7 Mon Sep 17 00:00:00 2001 From: Daisuke Sato Date: Fri, 9 Apr 2021 19:52:37 +0900 Subject: [PATCH 3/3] Keep backward compatibility --- src/drivers/rtmouse.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/drivers/rtmouse.c b/src/drivers/rtmouse.c index 7770003..53983e0 100644 --- a/src/drivers/rtmouse.c +++ b/src/drivers/rtmouse.c @@ -751,6 +751,19 @@ static int gpio_map(void) { static int clk_status = 1; +#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 0, 0) + if (gpio_base == NULL) { + gpio_base = ioremap_nocache(RPI_GPIO_BASE, RPI_GPIO_SIZE); + } + + if (pwm_base == NULL) { + pwm_base = ioremap_nocache(RPI_PWM_BASE, RPI_PWM_SIZE); + } + + if (clk_base == NULL) { + clk_base = ioremap_nocache(RPI_CLK_BASE, RPI_CLK_SIZE); + } +#else if (gpio_base == NULL) { gpio_base = ioremap(RPI_GPIO_BASE, RPI_GPIO_SIZE); } @@ -762,6 +775,7 @@ static int gpio_map(void) if (clk_base == NULL) { clk_base = ioremap(RPI_CLK_BASE, RPI_CLK_SIZE); } +#endif /* kill */ if (clk_status == 1) { @@ -2058,18 +2072,31 @@ static int i2c_counter_init(void) * 動的にデバイス実体を作成 * (https://www.kernel.org/doc/Documentation/i2c/instantiating-devices) */ +#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 0, 0) // printk(KERN_DEBUG "%s: adding i2c device", __func__); i2c_adap_l = i2c_get_adapter(1); - i2c_client_l = i2c_new_client_device(i2c_adap_l, &i2c_board_info_l); + i2c_client_l = i2c_new_device(i2c_adap_l, &i2c_board_info_l); i2c_put_adapter(i2c_adap_l); // printk(KERN_DEBUG "%s: added i2c device rtcntl", __func__); // printk(KERN_DEBUG "%s: adding i2c device", __func__); i2c_adap_r = i2c_get_adapter(1); - i2c_client_r = i2c_new_client_device(i2c_adap_r, &i2c_board_info_r); + i2c_client_r = i2c_new_device(i2c_adap_r, &i2c_board_info_r); i2c_put_adapter(i2c_adap_r); // printk(KERN_DEBUG "%s: added i2c device rtcntr", __func__); +#else + // printk(KERN_DEBUG "%s: adding i2c device", __func__); + i2c_adap_l = i2c_get_adapter(1); + i2c_client_l = i2c_new_client_device(i2c_adap_l, &i2c_board_info_l); + i2c_put_adapter(i2c_adap_l); + // printk(KERN_DEBUG "%s: added i2c device rtcntl", __func__); + // printk(KERN_DEBUG "%s: adding i2c device", __func__); + i2c_adap_r = i2c_get_adapter(1); + i2c_client_r = i2c_new_client_device(i2c_adap_r, &i2c_board_info_r); + i2c_put_adapter(i2c_adap_r); +// printk(KERN_DEBUG "%s: added i2c device rtcntr", __func__); +#endif return retval; }