Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) // Copyright (C) 2010 Maurus Cuelenaere
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #include <linux/fb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include <linux/gpio_keys.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/leds.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <video/samsung_fimd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <mach/irqs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include "map.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include "regs-gpio.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include "gpio-samsung.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include "cpu.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include "devs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include "fb.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include "gpio-cfg.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include "s3c64xx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include "mach-smartq.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) static struct gpio_led smartq7_leds[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 		.name			= "smartq7:red",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 		.active_low		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 		.gpio			= S3C64XX_GPN(8),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 		.name			= "smartq7:green",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 		.active_low		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 		.gpio			= S3C64XX_GPN(9),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) static struct gpio_led_platform_data smartq7_led_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	.num_leds = ARRAY_SIZE(smartq7_leds),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	.leds = smartq7_leds,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) static struct platform_device smartq7_leds_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	.name			= "leds-gpio",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	.id			= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	.dev.platform_data	= &smartq7_led_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) /* Labels according to the SmartQ manual */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) static struct gpio_keys_button smartq7_buttons[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 		.gpio			= S3C64XX_GPL(14),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 		.code			= KEY_POWER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 		.desc			= "Power",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		.active_low		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 		.debounce_interval	= 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 		.type                   = EV_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 		.gpio			= S3C64XX_GPN(2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 		.code			= KEY_FN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		.desc			= "Function",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 		.active_low		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		.debounce_interval	= 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		.type                   = EV_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 		.gpio			= S3C64XX_GPN(3),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		.code			= KEY_KPMINUS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		.desc			= "Minus",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		.active_low		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		.debounce_interval	= 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 		.type                   = EV_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		.gpio			= S3C64XX_GPN(4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		.code			= KEY_KPPLUS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		.desc			= "Plus",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 		.active_low		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		.debounce_interval	= 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 		.type                   = EV_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 		.gpio			= S3C64XX_GPN(12),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 		.code			= KEY_ENTER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		.desc			= "Enter",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 		.active_low		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		.debounce_interval	= 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		.type                   = EV_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		.gpio			= S3C64XX_GPN(15),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		.code			= KEY_ESC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		.desc			= "Cancel",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		.active_low		= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		.debounce_interval	= 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		.type                   = EV_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) static struct gpio_keys_platform_data smartq7_buttons_data  = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	.buttons	= smartq7_buttons,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	.nbuttons	= ARRAY_SIZE(smartq7_buttons),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) static struct platform_device smartq7_buttons_device  = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	.name		= "gpio-keys",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	.id		= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	.num_resources	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	.dev		= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 		.platform_data	= &smartq7_buttons_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) static struct s3c_fb_pd_win smartq7_fb_win0 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	.max_bpp	= 32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	.default_bpp	= 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	.xres		= 800,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	.yres		= 480,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) static struct fb_videomode smartq7_lcd_timing = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	.left_margin	= 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	.right_margin	= 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	.upper_margin	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	.lower_margin	= 20,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	.hsync_len	= 10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	.vsync_len	= 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	.xres		= 800,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	.yres		= 480,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	.refresh	= 80,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) static struct s3c_fb_platdata smartq7_lcd_pdata __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	.setup_gpio	= s3c64xx_fb_gpio_setup_24bpp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	.vtiming	= &smartq7_lcd_timing,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	.win[0]		= &smartq7_fb_win0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	.vidcon0	= VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	.vidcon1	= VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 			  VIDCON1_INV_VCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) static struct platform_device *smartq7_devices[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	&smartq7_leds_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	&smartq7_buttons_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) static void __init smartq7_machine_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	s3c_fb_set_platdata(&smartq7_lcd_pdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	smartq_machine_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	platform_add_devices(smartq7_devices, ARRAY_SIZE(smartq7_devices));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) MACHINE_START(SMARTQ7, "SmartQ 7")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	/* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	.atag_offset	= 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	.nr_irqs	= S3C64XX_NR_IRQS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	.init_irq	= s3c6410_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	.map_io		= smartq_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	.init_machine	= smartq7_machine_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	.init_time	= s3c64xx_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) MACHINE_END