diff --git a/src/drivers/rtmouse.c b/src/drivers/rtmouse.c index 12ab069..53983e0 100644 --- a/src/drivers/rtmouse.c +++ b/src/drivers/rtmouse.c @@ -3,9 +3,9 @@ * rtmouse.c * Raspberry Pi Mouse device driver * - * Version: 3.0.0 + * Version: 3.1.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 @@ -751,6 +751,7 @@ 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); } @@ -762,6 +763,19 @@ static int gpio_map(void) 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); + } + + if (pwm_base == NULL) { + pwm_base = ioremap(RPI_PWM_BASE, RPI_PWM_SIZE); + } + + if (clk_base == NULL) { + clk_base = ioremap(RPI_CLK_BASE, RPI_CLK_SIZE); + } +#endif /* kill */ if (clk_status == 1) { @@ -2058,6 +2072,7 @@ 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_device(i2c_adap_l, &i2c_board_info_l); @@ -2069,7 +2084,19 @@ static int i2c_counter_init(void) 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; }