Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions src/drivers/rtmouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <shop@rt-net.jp>
* Copyright (C) 2015-2021 RT Corporation <shop@rt-net.jp>
*
* 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
Expand Down Expand Up @@ -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);
}
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down