Samsung mach/soc changes for v5.9
1. Restore big.LITTLE cpuidle support on Exynos542x boards. 2. Cleanups and minor fixes. -----BEGIN PGP SIGNATURE----- iQJEBAABCgAuFiEE3dJiKD0RGyM7briowTdm5oaLg9cFAl8XLcAQHGtyemtAa2Vy bmVsLm9yZwAKCRDBN2bmhouD1+PfEACWWeyJvLnhq44hhzYYkvBRwCpyBfyAIT2W I81v5bd53SFYhtjnfriKRl3YAzw0p3G7/sxXJMmbCrqvfjWHVOJDxvtNtYAWCZ7v 9dSDe0iZ6MCTHmRbC6ZnGzB4kTT0uD+1ZOwk6+/vXEVGV3roo1+EBzpXPW3toDqh Bm+9DYo0MwLwjL8IEYT7sOLkT10GlB9Tr7unNNV7QFVxEaDw41Ig8khuT9GyR5+4 wDH3+CHfplz3NjztgSKXfavp36wEQhvIO5zht7EL+ZysfM/XECvjpPGtchWtixAW t6dMuJtNQzommuLMZVZY/0gqvOzDw9OnP/1dMBIKrnMRLYDprY8ueW91cuLOnz0c cKl4SUv17vsxO5uRl67owspfOpBTmNn9iX3aXIvqujBFo31goTQJY39I4gVRjMhL DmX3bPK4PTN7RkM+mWGRTK8k7Kt3+wnekzCpqqLfb3Zqu8xSkK45myH5AlRpGYTr 7UUdg8P8muhy+qCRiTquGxEkThycupQWFp4o80npdeLSFin/PtrVc2e8AiB0B7ef guzBCvBes6YsMch3SrDvz2l58ZsAsGaIz2tNxcssTUqE6i0iR+oc7Esz1FaXk4B8 fpo6KJB+5imD30tAPduWNCOZBoLtNAgwcj3k0+6F4s9d1McIVLTvi711Pz68dYN9 s5kZydM2Xg== =uDUA -----END PGP SIGNATURE----- Merge tag 'samsung-soc-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux into arm/soc Samsung mach/soc changes for v5.9 1. Restore big.LITTLE cpuidle support on Exynos542x boards. 2. Cleanups and minor fixes. * tag 'samsung-soc-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux: ARM: s3c24xx: Replace HTTP links with HTTPS ones ARM: s3c24xx: leds: Convert to use GPIO descriptors ARM: exynos: MCPM: Restore big.LITTLE cpuidle support ARM: exynos: clear L310_AUX_CTRL_FULL_LINE_ZERO in default l2c_aux_val Link: https://lore.kernel.org/r/20200721180900.13844-4-krzk@kernel.org Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
commit
5644f690b9
@ -193,7 +193,7 @@ static void __init exynos_dt_fixup(void)
|
||||
}
|
||||
|
||||
DT_MACHINE_START(EXYNOS_DT, "Samsung Exynos (Flattened Device Tree)")
|
||||
.l2c_aux_val = 0x3c400001,
|
||||
.l2c_aux_val = 0x3c400000,
|
||||
.l2c_aux_mask = 0xc20fffff,
|
||||
.smp = smp_ops(exynos_smp_ops),
|
||||
.map_io = exynos_init_io,
|
||||
|
@ -26,6 +26,7 @@
|
||||
#define EXYNOS5420_USE_L2_COMMON_UP_STATE BIT(30)
|
||||
|
||||
static void __iomem *ns_sram_base_addr __ro_after_init;
|
||||
static bool secure_firmware __ro_after_init;
|
||||
|
||||
/*
|
||||
* The common v7_exit_coherency_flush API could not be used because of the
|
||||
@ -58,15 +59,16 @@ static void __iomem *ns_sram_base_addr __ro_after_init;
|
||||
static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster)
|
||||
{
|
||||
unsigned int cpunr = cpu + (cluster * EXYNOS5420_CPUS_PER_CLUSTER);
|
||||
bool state;
|
||||
|
||||
pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
|
||||
if (cpu >= EXYNOS5420_CPUS_PER_CLUSTER ||
|
||||
cluster >= EXYNOS5420_NR_CLUSTERS)
|
||||
return -EINVAL;
|
||||
|
||||
if (!exynos_cpu_power_state(cpunr)) {
|
||||
exynos_cpu_power_up(cpunr);
|
||||
|
||||
state = exynos_cpu_power_state(cpunr);
|
||||
exynos_cpu_power_up(cpunr);
|
||||
if (!state && secure_firmware) {
|
||||
/*
|
||||
* This assumes the cluster number of the big cores(Cortex A15)
|
||||
* is 0 and the Little cores(Cortex A7) is 1.
|
||||
@ -258,6 +260,8 @@ static int __init exynos_mcpm_init(void)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
secure_firmware = exynos_secure_firmware_available();
|
||||
|
||||
/*
|
||||
* To increase the stability of KFC reset we need to program
|
||||
* the PMU SPARE3 register
|
||||
|
@ -267,7 +267,7 @@ config MACH_TCT_HAMMER
|
||||
select S3C_DEV_USB_HOST
|
||||
help
|
||||
Say Y here if you are using the TinCanTools Hammer Board
|
||||
<http://www.tincantools.com>
|
||||
<https://www.tincantools.com>
|
||||
|
||||
config MACH_VR1000
|
||||
bool "Thorcom VR1000"
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <linux/timer.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/gpio/machine.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
@ -44,29 +45,53 @@
|
||||
|
||||
/* LED devices */
|
||||
|
||||
static struct gpiod_lookup_table smdk_led4_gpio_table = {
|
||||
.dev_id = "s3c24xx_led.0",
|
||||
.table = {
|
||||
GPIO_LOOKUP("GPF", 4, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpiod_lookup_table smdk_led5_gpio_table = {
|
||||
.dev_id = "s3c24xx_led.1",
|
||||
.table = {
|
||||
GPIO_LOOKUP("GPF", 5, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpiod_lookup_table smdk_led6_gpio_table = {
|
||||
.dev_id = "s3c24xx_led.2",
|
||||
.table = {
|
||||
GPIO_LOOKUP("GPF", 6, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpiod_lookup_table smdk_led7_gpio_table = {
|
||||
.dev_id = "s3c24xx_led.3",
|
||||
.table = {
|
||||
GPIO_LOOKUP("GPF", 7, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct s3c24xx_led_platdata smdk_pdata_led4 = {
|
||||
.gpio = S3C2410_GPF(4),
|
||||
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
|
||||
.name = "led4",
|
||||
.def_trigger = "timer",
|
||||
};
|
||||
|
||||
static struct s3c24xx_led_platdata smdk_pdata_led5 = {
|
||||
.gpio = S3C2410_GPF(5),
|
||||
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
|
||||
.name = "led5",
|
||||
.def_trigger = "nand-disk",
|
||||
};
|
||||
|
||||
static struct s3c24xx_led_platdata smdk_pdata_led6 = {
|
||||
.gpio = S3C2410_GPF(6),
|
||||
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
|
||||
.name = "led6",
|
||||
};
|
||||
|
||||
static struct s3c24xx_led_platdata smdk_pdata_led7 = {
|
||||
.gpio = S3C2410_GPF(7),
|
||||
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
|
||||
.name = "led7",
|
||||
};
|
||||
|
||||
@ -179,27 +204,25 @@ static struct platform_device __initdata *smdk_devs[] = {
|
||||
&smdk_led7,
|
||||
};
|
||||
|
||||
static const struct gpio smdk_led_gpios[] = {
|
||||
{ S3C2410_GPF(4), GPIOF_OUT_INIT_HIGH, NULL },
|
||||
{ S3C2410_GPF(5), GPIOF_OUT_INIT_HIGH, NULL },
|
||||
{ S3C2410_GPF(6), GPIOF_OUT_INIT_HIGH, NULL },
|
||||
{ S3C2410_GPF(7), GPIOF_OUT_INIT_HIGH, NULL },
|
||||
};
|
||||
|
||||
void __init smdk_machine_init(void)
|
||||
{
|
||||
/* Configure the LEDs (even if we have no LED support)*/
|
||||
|
||||
int ret = gpio_request_array(smdk_led_gpios,
|
||||
ARRAY_SIZE(smdk_led_gpios));
|
||||
if (!WARN_ON(ret < 0))
|
||||
gpio_free_array(smdk_led_gpios, ARRAY_SIZE(smdk_led_gpios));
|
||||
|
||||
if (machine_is_smdk2443())
|
||||
smdk_nand_info.twrph0 = 50;
|
||||
|
||||
s3c_nand_set_platdata(&smdk_nand_info);
|
||||
|
||||
/* Disable pull-up on the LED lines */
|
||||
s3c_gpio_setpull(S3C2410_GPF(4), S3C_GPIO_PULL_NONE);
|
||||
s3c_gpio_setpull(S3C2410_GPF(5), S3C_GPIO_PULL_NONE);
|
||||
s3c_gpio_setpull(S3C2410_GPF(6), S3C_GPIO_PULL_NONE);
|
||||
s3c_gpio_setpull(S3C2410_GPF(7), S3C_GPIO_PULL_NONE);
|
||||
|
||||
/* Add lookups for the lines */
|
||||
gpiod_add_lookup_table(&smdk_led4_gpio_table);
|
||||
gpiod_add_lookup_table(&smdk_led5_gpio_table);
|
||||
gpiod_add_lookup_table(&smdk_led6_gpio_table);
|
||||
gpiod_add_lookup_table(&smdk_led7_gpio_table);
|
||||
|
||||
platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs));
|
||||
|
||||
s3c_pm_init();
|
||||
|
@ -3,7 +3,7 @@
|
||||
// Copyright (c) 2003-2005 Simtec Electronics
|
||||
// Ben Dooks <ben@simtec.co.uk>
|
||||
//
|
||||
// http://www.handhelds.org/projects/h1940.html
|
||||
// https://www.handhelds.org/projects/h1940.html
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
|
@ -6,7 +6,7 @@
|
||||
// Weibing <http://weibing.blogbus.com> and
|
||||
// Michel Pollet <buserror@gmail.com>
|
||||
//
|
||||
// For product information, visit http://code.google.com/p/mini2440/
|
||||
// For product information, visit https://code.google.com/p/mini2440/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
@ -402,37 +402,68 @@ static struct platform_device mini2440_button_device = {
|
||||
|
||||
/* LEDS */
|
||||
|
||||
static struct gpiod_lookup_table mini2440_led1_gpio_table = {
|
||||
.dev_id = "s3c24xx_led.1",
|
||||
.table = {
|
||||
GPIO_LOOKUP("GPB", 5, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpiod_lookup_table mini2440_led2_gpio_table = {
|
||||
.dev_id = "s3c24xx_led.2",
|
||||
.table = {
|
||||
GPIO_LOOKUP("GPB", 6, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpiod_lookup_table mini2440_led3_gpio_table = {
|
||||
.dev_id = "s3c24xx_led.3",
|
||||
.table = {
|
||||
GPIO_LOOKUP("GPB", 7, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpiod_lookup_table mini2440_led4_gpio_table = {
|
||||
.dev_id = "s3c24xx_led.4",
|
||||
.table = {
|
||||
GPIO_LOOKUP("GPB", 8, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpiod_lookup_table mini2440_backlight_gpio_table = {
|
||||
.dev_id = "s3c24xx_led.5",
|
||||
.table = {
|
||||
GPIO_LOOKUP("GPG", 4, NULL, GPIO_ACTIVE_HIGH),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct s3c24xx_led_platdata mini2440_led1_pdata = {
|
||||
.name = "led1",
|
||||
.gpio = S3C2410_GPB(5),
|
||||
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
|
||||
.def_trigger = "heartbeat",
|
||||
};
|
||||
|
||||
static struct s3c24xx_led_platdata mini2440_led2_pdata = {
|
||||
.name = "led2",
|
||||
.gpio = S3C2410_GPB(6),
|
||||
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
|
||||
.def_trigger = "nand-disk",
|
||||
};
|
||||
|
||||
static struct s3c24xx_led_platdata mini2440_led3_pdata = {
|
||||
.name = "led3",
|
||||
.gpio = S3C2410_GPB(7),
|
||||
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
|
||||
.def_trigger = "mmc0",
|
||||
};
|
||||
|
||||
static struct s3c24xx_led_platdata mini2440_led4_pdata = {
|
||||
.name = "led4",
|
||||
.gpio = S3C2410_GPB(8),
|
||||
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
|
||||
.def_trigger = "",
|
||||
};
|
||||
|
||||
static struct s3c24xx_led_platdata mini2440_led_backlight_pdata = {
|
||||
.name = "backlight",
|
||||
.gpio = S3C2410_GPG(4),
|
||||
.def_trigger = "backlight",
|
||||
};
|
||||
|
||||
@ -714,6 +745,20 @@ static void __init mini2440_init(void)
|
||||
i2c_register_board_info(0, mini2440_i2c_devs,
|
||||
ARRAY_SIZE(mini2440_i2c_devs));
|
||||
|
||||
/* Disable pull-up on the LED lines */
|
||||
s3c_gpio_setpull(S3C2410_GPB(5), S3C_GPIO_PULL_NONE);
|
||||
s3c_gpio_setpull(S3C2410_GPB(6), S3C_GPIO_PULL_NONE);
|
||||
s3c_gpio_setpull(S3C2410_GPB(7), S3C_GPIO_PULL_NONE);
|
||||
s3c_gpio_setpull(S3C2410_GPB(8), S3C_GPIO_PULL_NONE);
|
||||
s3c_gpio_setpull(S3C2410_GPG(4), S3C_GPIO_PULL_NONE);
|
||||
|
||||
/* Add lookups for the lines */
|
||||
gpiod_add_lookup_table(&mini2440_led1_gpio_table);
|
||||
gpiod_add_lookup_table(&mini2440_led2_gpio_table);
|
||||
gpiod_add_lookup_table(&mini2440_led3_gpio_table);
|
||||
gpiod_add_lookup_table(&mini2440_led4_gpio_table);
|
||||
gpiod_add_lookup_table(&mini2440_backlight_gpio_table);
|
||||
|
||||
platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices));
|
||||
|
||||
if (features.count) /* the optional features */
|
||||
|
@ -9,7 +9,7 @@
|
||||
// Copyright (c) 2005-2008 Christer Weinigel <christer@weinigel.se>
|
||||
//
|
||||
// There is a wiki with more information about the n30 port at
|
||||
// http://handhelds.org/moin/moin.cgi/AcerN30Documentation .
|
||||
// https://handhelds.org/moin/moin.cgi/AcerN30Documentation .
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
@ -45,6 +45,7 @@
|
||||
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/devs.h>
|
||||
#include <plat/gpio-cfg.h>
|
||||
#include <linux/platform_data/mmc-s3cmci.h>
|
||||
#include <linux/platform_data/usb-s3c2410_udc.h>
|
||||
#include <plat/samsung-time.h>
|
||||
@ -246,17 +247,33 @@ static struct platform_device n35_button_device = {
|
||||
};
|
||||
|
||||
/* This is the bluetooth LED on the device. */
|
||||
|
||||
static struct gpiod_lookup_table n30_blue_led_gpio_table = {
|
||||
.dev_id = "s3c24xx_led.1",
|
||||
.table = {
|
||||
GPIO_LOOKUP("GPG", 6, NULL, GPIO_ACTIVE_HIGH),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct s3c24xx_led_platdata n30_blue_led_pdata = {
|
||||
.name = "blue_led",
|
||||
.gpio = S3C2410_GPG(6),
|
||||
.def_trigger = "",
|
||||
};
|
||||
|
||||
/* This is the blue LED on the device. Originally used to indicate GPS activity
|
||||
* by flashing. */
|
||||
|
||||
static struct gpiod_lookup_table n35_blue_led_gpio_table = {
|
||||
.dev_id = "s3c24xx_led.1",
|
||||
.table = {
|
||||
GPIO_LOOKUP("GPD", 8, NULL, GPIO_ACTIVE_HIGH),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct s3c24xx_led_platdata n35_blue_led_pdata = {
|
||||
.name = "blue_led",
|
||||
.gpio = S3C2410_GPD(8),
|
||||
.def_trigger = "",
|
||||
};
|
||||
|
||||
@ -264,17 +281,30 @@ static struct s3c24xx_led_platdata n35_blue_led_pdata = {
|
||||
* red, blinking green or solid green when the battery is low,
|
||||
* charging or full respectively. By driving GPD9 low, it's possible
|
||||
* to force the LED to blink red, so call that warning LED. */
|
||||
|
||||
static struct gpiod_lookup_table n30_warning_led_gpio_table = {
|
||||
.dev_id = "s3c24xx_led.2",
|
||||
.table = {
|
||||
GPIO_LOOKUP("GPD", 9, NULL, GPIO_ACTIVE_LOW),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct s3c24xx_led_platdata n30_warning_led_pdata = {
|
||||
.name = "warning_led",
|
||||
.flags = S3C24XX_LEDF_ACTLOW,
|
||||
.gpio = S3C2410_GPD(9),
|
||||
.def_trigger = "",
|
||||
};
|
||||
|
||||
static struct gpiod_lookup_table n35_warning_led_gpio_table = {
|
||||
.dev_id = "s3c24xx_led.2",
|
||||
.table = {
|
||||
GPIO_LOOKUP("GPD", 9, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct s3c24xx_led_platdata n35_warning_led_pdata = {
|
||||
.name = "warning_led",
|
||||
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
|
||||
.gpio = S3C2410_GPD(9),
|
||||
.def_trigger = "",
|
||||
};
|
||||
|
||||
@ -577,6 +607,12 @@ static void __init n30_init(void)
|
||||
S3C2410_MISCCR_USBSUSPND0 |
|
||||
S3C2410_MISCCR_USBSUSPND1, 0x0);
|
||||
|
||||
/* Disable pull-up and add GPIO tables */
|
||||
s3c_gpio_setpull(S3C2410_GPG(6), S3C_GPIO_PULL_NONE);
|
||||
s3c_gpio_setpull(S3C2410_GPD(9), S3C_GPIO_PULL_NONE);
|
||||
gpiod_add_lookup_table(&n30_blue_led_gpio_table);
|
||||
gpiod_add_lookup_table(&n30_warning_led_gpio_table);
|
||||
|
||||
platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices));
|
||||
}
|
||||
|
||||
@ -594,6 +630,12 @@ static void __init n30_init(void)
|
||||
S3C2410_MISCCR_USBSUSPND1,
|
||||
S3C2410_MISCCR_USBSUSPND0);
|
||||
|
||||
/* Disable pull-up and add GPIO tables */
|
||||
s3c_gpio_setpull(S3C2410_GPD(8), S3C_GPIO_PULL_NONE);
|
||||
s3c_gpio_setpull(S3C2410_GPD(9), S3C_GPIO_PULL_NONE);
|
||||
gpiod_add_lookup_table(&n35_blue_led_gpio_table);
|
||||
gpiod_add_lookup_table(&n35_warning_led_gpio_table);
|
||||
|
||||
platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices));
|
||||
}
|
||||
}
|
||||
|
@ -177,9 +177,15 @@ static struct platform_device qt2410_cs89x0 = {
|
||||
|
||||
/* LED */
|
||||
|
||||
static struct gpiod_lookup_table qt2410_led_gpio_table = {
|
||||
.dev_id = "s3c24xx_led.0",
|
||||
.table = {
|
||||
GPIO_LOOKUP("GPB", 0, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct s3c24xx_led_platdata qt2410_pdata_led = {
|
||||
.gpio = S3C2410_GPB(0),
|
||||
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
|
||||
.name = "led",
|
||||
.def_trigger = "timer",
|
||||
};
|
||||
@ -338,6 +344,8 @@ static void __init qt2410_machine_init(void)
|
||||
s3c_i2c0_set_platdata(NULL);
|
||||
|
||||
gpiod_add_lookup_table(&qt2410_spi_gpiod_table);
|
||||
s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
|
||||
gpiod_add_lookup_table(&qt2410_led_gpio_table);
|
||||
platform_add_devices(qt2410_devices, ARRAY_SIZE(qt2410_devices));
|
||||
s3c_pm_init();
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
// Copyright (c) 2003-2004 Simtec Electronics
|
||||
// Ben Dooks <ben@simtec.co.uk>
|
||||
//
|
||||
// http://www.handhelds.org/projects/rx3715.html
|
||||
// https://www.handhelds.org/projects/rx3715.html
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <linux/timer.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/gpio/machine.h>
|
||||
#include <linux/dm9000.h>
|
||||
#include <linux/i2c.h>
|
||||
|
||||
@ -40,6 +41,7 @@
|
||||
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/devs.h>
|
||||
#include <plat/gpio-cfg.h>
|
||||
#include <plat/samsung-time.h>
|
||||
|
||||
#include "bast.h"
|
||||
@ -223,21 +225,42 @@ static struct platform_device vr1000_dm9k1 = {
|
||||
|
||||
/* LEDS */
|
||||
|
||||
static struct gpiod_lookup_table vr1000_led1_gpio_table = {
|
||||
.dev_id = "s3c24xx_led.1",
|
||||
.table = {
|
||||
GPIO_LOOKUP("GPB", 0, NULL, GPIO_ACTIVE_HIGH),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpiod_lookup_table vr1000_led2_gpio_table = {
|
||||
.dev_id = "s3c24xx_led.2",
|
||||
.table = {
|
||||
GPIO_LOOKUP("GPB", 1, NULL, GPIO_ACTIVE_HIGH),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpiod_lookup_table vr1000_led3_gpio_table = {
|
||||
.dev_id = "s3c24xx_led.3",
|
||||
.table = {
|
||||
GPIO_LOOKUP("GPB", 2, NULL, GPIO_ACTIVE_HIGH),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static struct s3c24xx_led_platdata vr1000_led1_pdata = {
|
||||
.name = "led1",
|
||||
.gpio = S3C2410_GPB(0),
|
||||
.def_trigger = "",
|
||||
};
|
||||
|
||||
static struct s3c24xx_led_platdata vr1000_led2_pdata = {
|
||||
.name = "led2",
|
||||
.gpio = S3C2410_GPB(1),
|
||||
.def_trigger = "",
|
||||
};
|
||||
|
||||
static struct s3c24xx_led_platdata vr1000_led3_pdata = {
|
||||
.name = "led3",
|
||||
.gpio = S3C2410_GPB(2),
|
||||
.def_trigger = "",
|
||||
};
|
||||
|
||||
@ -317,6 +340,15 @@ static void __init vr1000_init_time(void)
|
||||
static void __init vr1000_init(void)
|
||||
{
|
||||
s3c_i2c0_set_platdata(NULL);
|
||||
|
||||
/* Disable pull-up on LED lines and register GPIO lookups */
|
||||
s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
|
||||
s3c_gpio_setpull(S3C2410_GPB(1), S3C_GPIO_PULL_NONE);
|
||||
s3c_gpio_setpull(S3C2410_GPB(2), S3C_GPIO_PULL_NONE);
|
||||
gpiod_add_lookup_table(&vr1000_led1_gpio_table);
|
||||
gpiod_add_lookup_table(&vr1000_led2_gpio_table);
|
||||
gpiod_add_lookup_table(&vr1000_led3_gpio_table);
|
||||
|
||||
platform_add_devices(vr1000_devices, ARRAY_SIZE(vr1000_devices));
|
||||
|
||||
i2c_register_board_info(0, vr1000_i2c_devs,
|
||||
|
@ -11,19 +11,19 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_data/leds-s3c24xx.h>
|
||||
|
||||
#include <mach/regs-gpio.h>
|
||||
#include <plat/gpio-cfg.h>
|
||||
|
||||
/* our context */
|
||||
|
||||
struct s3c24xx_gpio_led {
|
||||
struct led_classdev cdev;
|
||||
struct s3c24xx_led_platdata *pdata;
|
||||
struct gpio_desc *gpiod;
|
||||
};
|
||||
|
||||
static inline struct s3c24xx_gpio_led *to_gpio(struct led_classdev *led_cdev)
|
||||
@ -35,20 +35,8 @@ static void s3c24xx_led_set(struct led_classdev *led_cdev,
|
||||
enum led_brightness value)
|
||||
{
|
||||
struct s3c24xx_gpio_led *led = to_gpio(led_cdev);
|
||||
struct s3c24xx_led_platdata *pd = led->pdata;
|
||||
int state = (value ? 1 : 0) ^ (pd->flags & S3C24XX_LEDF_ACTLOW);
|
||||
|
||||
/* there will be a short delay between setting the output and
|
||||
* going from output to input when using tristate. */
|
||||
|
||||
gpio_set_value(pd->gpio, state);
|
||||
|
||||
if (pd->flags & S3C24XX_LEDF_TRISTATE) {
|
||||
if (value)
|
||||
gpio_direction_output(pd->gpio, state);
|
||||
else
|
||||
gpio_direction_input(pd->gpio);
|
||||
}
|
||||
gpiod_set_value(led->gpiod, !!value);
|
||||
}
|
||||
|
||||
static int s3c24xx_led_probe(struct platform_device *dev)
|
||||
@ -69,22 +57,12 @@ static int s3c24xx_led_probe(struct platform_device *dev)
|
||||
|
||||
led->pdata = pdata;
|
||||
|
||||
ret = devm_gpio_request(&dev->dev, pdata->gpio, "S3C24XX_LED");
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* no point in having a pull-up if we are always driving */
|
||||
|
||||
s3c_gpio_setpull(pdata->gpio, S3C_GPIO_PULL_NONE);
|
||||
|
||||
if (pdata->flags & S3C24XX_LEDF_TRISTATE)
|
||||
gpio_direction_input(pdata->gpio);
|
||||
else
|
||||
gpio_direction_output(pdata->gpio,
|
||||
pdata->flags & S3C24XX_LEDF_ACTLOW ? 1 : 0);
|
||||
/* Default to off */
|
||||
led->gpiod = devm_gpiod_get(&dev->dev, NULL, GPIOD_OUT_LOW);
|
||||
if (IS_ERR(led->gpiod))
|
||||
return PTR_ERR(led->gpiod);
|
||||
|
||||
/* register our new led device */
|
||||
|
||||
ret = devm_led_classdev_register(&dev->dev, &led->cdev);
|
||||
if (ret < 0)
|
||||
dev_err(&dev->dev, "led_classdev_register failed\n");
|
||||
|
@ -10,13 +10,7 @@
|
||||
#ifndef __LEDS_S3C24XX_H
|
||||
#define __LEDS_S3C24XX_H
|
||||
|
||||
#define S3C24XX_LEDF_ACTLOW (1<<0) /* LED is on when GPIO low */
|
||||
#define S3C24XX_LEDF_TRISTATE (1<<1) /* tristate to turn off */
|
||||
|
||||
struct s3c24xx_led_platdata {
|
||||
unsigned int gpio;
|
||||
unsigned int flags;
|
||||
|
||||
char *name;
|
||||
char *def_trigger;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user