| .. | .. |
|---|
| 18 | 18 | * Clean patches should be sent to the ARM Linux Patch System. Please see the |
|---|
| 19 | 19 | * following web page for more information: |
|---|
| 20 | 20 | * |
|---|
| 21 | | - * http://www.arm.linux.org.uk/developer/patches/info.shtml |
|---|
| 21 | + * https://www.arm.linux.org.uk/developer/patches/info.shtml |
|---|
| 22 | 22 | * |
|---|
| 23 | 23 | * Thank you. |
|---|
| 24 | 24 | * |
|---|
| .. | .. |
|---|
| 173 | 173 | #include <linux/init.h> |
|---|
| 174 | 174 | #include <linux/ioport.h> |
|---|
| 175 | 175 | #include <linux/cpufreq.h> |
|---|
| 176 | | -#include <linux/gpio.h> |
|---|
| 176 | +#include <linux/gpio/consumer.h> |
|---|
| 177 | 177 | #include <linux/platform_device.h> |
|---|
| 178 | 178 | #include <linux/dma-mapping.h> |
|---|
| 179 | 179 | #include <linux/mutex.h> |
|---|
| .. | .. |
|---|
| 574 | 574 | return vm_iomap_memory(vma, info->fix.mmio_start, info->fix.mmio_len); |
|---|
| 575 | 575 | } |
|---|
| 576 | 576 | |
|---|
| 577 | | -static struct fb_ops sa1100fb_ops = { |
|---|
| 577 | +static const struct fb_ops sa1100fb_ops = { |
|---|
| 578 | 578 | .owner = THIS_MODULE, |
|---|
| 579 | 579 | .fb_check_var = sa1100fb_check_var, |
|---|
| 580 | 580 | .fb_set_par = sa1100fb_set_par, |
|---|
| .. | .. |
|---|
| 799 | 799 | writel_relaxed(fbi->dbar2, fbi->base + DBAR2); |
|---|
| 800 | 800 | writel_relaxed(fbi->reg_lccr0 | LCCR0_LEN, fbi->base + LCCR0); |
|---|
| 801 | 801 | |
|---|
| 802 | | - if (machine_is_shannon()) |
|---|
| 803 | | - gpio_set_value(SHANNON_GPIO_DISP_EN, 1); |
|---|
| 802 | + if (fbi->shannon_lcden) |
|---|
| 803 | + gpiod_set_value(fbi->shannon_lcden, 1); |
|---|
| 804 | 804 | |
|---|
| 805 | 805 | dev_dbg(fbi->dev, "DBAR1: 0x%08x\n", readl_relaxed(fbi->base + DBAR1)); |
|---|
| 806 | 806 | dev_dbg(fbi->dev, "DBAR2: 0x%08x\n", readl_relaxed(fbi->base + DBAR2)); |
|---|
| .. | .. |
|---|
| 817 | 817 | |
|---|
| 818 | 818 | dev_dbg(fbi->dev, "Disabling LCD controller\n"); |
|---|
| 819 | 819 | |
|---|
| 820 | | - if (machine_is_shannon()) |
|---|
| 821 | | - gpio_set_value(SHANNON_GPIO_DISP_EN, 0); |
|---|
| 820 | + if (fbi->shannon_lcden) |
|---|
| 821 | + gpiod_set_value(fbi->shannon_lcden, 0); |
|---|
| 822 | 822 | |
|---|
| 823 | 823 | set_current_state(TASK_UNINTERRUPTIBLE); |
|---|
| 824 | 824 | add_wait_queue(&fbi->ctrlr_wait, &wait); |
|---|
| .. | .. |
|---|
| 935 | 935 | */ |
|---|
| 936 | 936 | if (old_state != C_DISABLE_PM) |
|---|
| 937 | 937 | break; |
|---|
| 938 | | - /* fall through */ |
|---|
| 938 | + fallthrough; |
|---|
| 939 | 939 | |
|---|
| 940 | 940 | case C_ENABLE: |
|---|
| 941 | 941 | /* |
|---|
| .. | .. |
|---|
| 968 | 968 | |
|---|
| 969 | 969 | #ifdef CONFIG_CPU_FREQ |
|---|
| 970 | 970 | /* |
|---|
| 971 | | - * Calculate the minimum DMA period over all displays that we own. |
|---|
| 972 | | - * This, together with the SDRAM bandwidth defines the slowest CPU |
|---|
| 973 | | - * frequency that can be selected. |
|---|
| 974 | | - */ |
|---|
| 975 | | -static unsigned int sa1100fb_min_dma_period(struct sa1100fb_info *fbi) |
|---|
| 976 | | -{ |
|---|
| 977 | | -#if 0 |
|---|
| 978 | | - unsigned int min_period = (unsigned int)-1; |
|---|
| 979 | | - int i; |
|---|
| 980 | | - |
|---|
| 981 | | - for (i = 0; i < MAX_NR_CONSOLES; i++) { |
|---|
| 982 | | - struct display *disp = &fb_display[i]; |
|---|
| 983 | | - unsigned int period; |
|---|
| 984 | | - |
|---|
| 985 | | - /* |
|---|
| 986 | | - * Do we own this display? |
|---|
| 987 | | - */ |
|---|
| 988 | | - if (disp->fb_info != &fbi->fb) |
|---|
| 989 | | - continue; |
|---|
| 990 | | - |
|---|
| 991 | | - /* |
|---|
| 992 | | - * Ok, calculate its DMA period |
|---|
| 993 | | - */ |
|---|
| 994 | | - period = sa1100fb_display_dma_period(&disp->var); |
|---|
| 995 | | - if (period < min_period) |
|---|
| 996 | | - min_period = period; |
|---|
| 997 | | - } |
|---|
| 998 | | - |
|---|
| 999 | | - return min_period; |
|---|
| 1000 | | -#else |
|---|
| 1001 | | - /* |
|---|
| 1002 | | - * FIXME: we need to verify _all_ consoles. |
|---|
| 1003 | | - */ |
|---|
| 1004 | | - return sa1100fb_display_dma_period(&fbi->fb.var); |
|---|
| 1005 | | -#endif |
|---|
| 1006 | | -} |
|---|
| 1007 | | - |
|---|
| 1008 | | -/* |
|---|
| 1009 | 971 | * CPU clock speed change handler. We need to adjust the LCD timing |
|---|
| 1010 | 972 | * parameters when the CPU clock is adjusted by the power management |
|---|
| 1011 | 973 | * subsystem. |
|---|
| .. | .. |
|---|
| 1026 | 988 | pcd = get_pcd(fbi, fbi->fb.var.pixclock); |
|---|
| 1027 | 989 | fbi->reg_lccr3 = (fbi->reg_lccr3 & ~0xff) | LCCR3_PixClkDiv(pcd); |
|---|
| 1028 | 990 | set_ctrlr_state(fbi, C_ENABLE_CLKCHANGE); |
|---|
| 1029 | | - break; |
|---|
| 1030 | | - } |
|---|
| 1031 | | - return 0; |
|---|
| 1032 | | -} |
|---|
| 1033 | | - |
|---|
| 1034 | | -static int |
|---|
| 1035 | | -sa1100fb_freq_policy(struct notifier_block *nb, unsigned long val, |
|---|
| 1036 | | - void *data) |
|---|
| 1037 | | -{ |
|---|
| 1038 | | - struct sa1100fb_info *fbi = TO_INF(nb, freq_policy); |
|---|
| 1039 | | - struct cpufreq_policy *policy = data; |
|---|
| 1040 | | - |
|---|
| 1041 | | - switch (val) { |
|---|
| 1042 | | - case CPUFREQ_ADJUST: |
|---|
| 1043 | | - dev_dbg(fbi->dev, "min dma period: %d ps, " |
|---|
| 1044 | | - "new clock %d kHz\n", sa1100fb_min_dma_period(fbi), |
|---|
| 1045 | | - policy->max); |
|---|
| 1046 | | - /* todo: fill in min/max values */ |
|---|
| 1047 | | - break; |
|---|
| 1048 | | - case CPUFREQ_NOTIFY: |
|---|
| 1049 | | - do {} while(0); |
|---|
| 1050 | | - /* todo: panic if min/max values aren't fulfilled |
|---|
| 1051 | | - * [can't really happen unless there's a bug in the |
|---|
| 1052 | | - * CPU policy verififcation process * |
|---|
| 1053 | | - */ |
|---|
| 1054 | 991 | break; |
|---|
| 1055 | 992 | } |
|---|
| 1056 | 993 | return 0; |
|---|
| .. | .. |
|---|
| 1116 | 1053 | } |
|---|
| 1117 | 1054 | |
|---|
| 1118 | 1055 | /* Fake monspecs to fill in fbinfo structure */ |
|---|
| 1119 | | -static struct fb_monspecs monspecs = { |
|---|
| 1056 | +static const struct fb_monspecs monspecs = { |
|---|
| 1120 | 1057 | .hfmin = 30000, |
|---|
| 1121 | 1058 | .hfmax = 70000, |
|---|
| 1122 | 1059 | .vfmin = 50, |
|---|
| .. | .. |
|---|
| 1206 | 1143 | static int sa1100fb_probe(struct platform_device *pdev) |
|---|
| 1207 | 1144 | { |
|---|
| 1208 | 1145 | struct sa1100fb_info *fbi; |
|---|
| 1209 | | - struct resource *res; |
|---|
| 1210 | 1146 | int ret, irq; |
|---|
| 1211 | 1147 | |
|---|
| 1212 | 1148 | if (!dev_get_platdata(&pdev->dev)) { |
|---|
| .. | .. |
|---|
| 1222 | 1158 | if (!fbi) |
|---|
| 1223 | 1159 | return -ENOMEM; |
|---|
| 1224 | 1160 | |
|---|
| 1225 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 1226 | | - fbi->base = devm_ioremap_resource(&pdev->dev, res); |
|---|
| 1161 | + fbi->base = devm_platform_ioremap_resource(pdev, 0); |
|---|
| 1227 | 1162 | if (IS_ERR(fbi->base)) |
|---|
| 1228 | 1163 | return PTR_ERR(fbi->base); |
|---|
| 1229 | 1164 | |
|---|
| .. | .. |
|---|
| 1238 | 1173 | return ret; |
|---|
| 1239 | 1174 | } |
|---|
| 1240 | 1175 | |
|---|
| 1241 | | - if (machine_is_shannon()) { |
|---|
| 1242 | | - ret = devm_gpio_request_one(&pdev->dev, SHANNON_GPIO_DISP_EN, |
|---|
| 1243 | | - GPIOF_OUT_INIT_LOW, "display enable"); |
|---|
| 1244 | | - if (ret) |
|---|
| 1245 | | - return ret; |
|---|
| 1246 | | - } |
|---|
| 1176 | + fbi->shannon_lcden = gpiod_get_optional(&pdev->dev, "shannon-lcden", |
|---|
| 1177 | + GPIOD_OUT_LOW); |
|---|
| 1178 | + if (IS_ERR(fbi->shannon_lcden)) |
|---|
| 1179 | + return PTR_ERR(fbi->shannon_lcden); |
|---|
| 1247 | 1180 | |
|---|
| 1248 | 1181 | /* Initialize video memory */ |
|---|
| 1249 | 1182 | ret = sa1100fb_map_video_memory(fbi); |
|---|
| .. | .. |
|---|
| 1267 | 1200 | |
|---|
| 1268 | 1201 | #ifdef CONFIG_CPU_FREQ |
|---|
| 1269 | 1202 | fbi->freq_transition.notifier_call = sa1100fb_freq_transition; |
|---|
| 1270 | | - fbi->freq_policy.notifier_call = sa1100fb_freq_policy; |
|---|
| 1271 | 1203 | cpufreq_register_notifier(&fbi->freq_transition, CPUFREQ_TRANSITION_NOTIFIER); |
|---|
| 1272 | | - cpufreq_register_notifier(&fbi->freq_policy, CPUFREQ_POLICY_NOTIFIER); |
|---|
| 1273 | 1204 | #endif |
|---|
| 1274 | 1205 | |
|---|
| 1275 | 1206 | /* This driver cannot be unloaded at the moment */ |
|---|