diff --git a/projects/WeTek_Play/linux/linux.arm.conf b/projects/WeTek_Play/linux/linux.arm.conf index 6d0830ccf7..09a7ca542e 100644 --- a/projects/WeTek_Play/linux/linux.arm.conf +++ b/projects/WeTek_Play/linux/linux.arm.conf @@ -931,7 +931,7 @@ CONFIG_I2C_AML=y # CONFIG_I2C_SW_AML is not set # CONFIG_BCM2079X_I2C is not set CONFIG_AM_INPUT=y -# CONFIG_SARADC_AM is not set +CONFIG_SARADC_AM=y CONFIG_MESON_INPUT_REMOTE=y CONFIG_AM_REMOTE=y # CONFIG_AM_IR_RECEIVER is not set @@ -940,11 +940,13 @@ CONFIG_MESON_NEW_INPUT_REMOTE=y # CONFIG_NEW_AM_REMOTE is not set # CONFIG_NEW_AM_IR_TX is not set CONFIG_MESON_INPUT_KEYBOARD=y +# CONFIG_ADC_KEYPADS_AM is not set CONFIG_KEY_INPUT_CUSTOM_AM=y # CONFIG_TOUCH_KEY_PAD_IT7230 is not set # CONFIG_TOUCH_KEY_PAD_SO340010 is not set # CONFIG_TOUCH_KEY_PAD_HA2605 is not set # CONFIG_MESON_INPUT_TOUCHSCREEN is not set +# CONFIG_SIMCARD_DETECT_AM is not set # CONFIG_AML_HOLD_KEY is not set # CONFIG_AML_CALL_KEY is not set # CONFIG_SENSOR_DEVICES is not set @@ -3046,18 +3048,20 @@ CONFIG_LEDS_CLASS=y # CONFIG_LEDS_LM355x is not set # CONFIG_LEDS_OT200 is not set # CONFIG_LEDS_BLINKM is not set +CONFIG_LEDS_WETEKPLAY=y # # LED Triggers # CONFIG_LEDS_TRIGGERS=y -# CONFIG_LEDS_TRIGGER_TIMER is not set -# CONFIG_LEDS_TRIGGER_ONESHOT is not set -# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set +CONFIG_LEDS_TRIGGER_TIMER=y +CONFIG_LEDS_TRIGGER_ONESHOT=y +CONFIG_LEDS_TRIGGER_HEARTBEAT=y # CONFIG_LEDS_TRIGGER_BACKLIGHT is not set -# CONFIG_LEDS_TRIGGER_CPU is not set -# CONFIG_LEDS_TRIGGER_GPIO is not set -# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set +CONFIG_LEDS_TRIGGER_CPU=y +CONFIG_LEDS_TRIGGER_GPIO=y +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y +CONFIG_LEDS_TRIGGER_REMOTE_CONTROL=y # # iptables trigger is under Netfilter config (LED target) diff --git a/projects/WeTek_Play/patches/linux/110-add_wetekplay_led.patch b/projects/WeTek_Play/patches/linux/110-add_wetekplay_led.patch new file mode 100644 index 0000000000..fd8d525f01 --- /dev/null +++ b/projects/WeTek_Play/patches/linux/110-add_wetekplay_led.patch @@ -0,0 +1,136 @@ +--- a/drivers/leds/Makefile.orig 2015-01-18 14:29:58.091729932 +0100 ++++ b/drivers/leds/Makefile 2015-01-18 13:59:03.465220281 +0100 +@@ -53,6 +53,7 @@ + obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o + obj-$(CONFIG_LEDS_LM355x) += leds-lm355x.o + obj-$(CONFIG_LEDS_BLINKM) += leds-blinkm.o ++obj-$(CONFIG_LEDS_WETEKPLAY) += leds-wetekplay.o + + + # LED SPI Drivers +--- a/drivers/leds/Kconfig.orig 2015-01-18 14:30:02.727729748 +0100 ++++ b/drivers/leds/Kconfig 2015-01-18 14:00:07.433217741 +0100 +@@ -479,6 +479,13 @@ + This option enables support for the BlinkM RGB LED connected + through I2C. Say Y to enable support for the BlinkM LED. + ++config LEDS_WETEKPLAY ++ tristate "LED support for the WeTek.Play status LED" ++ depends on LEDS_CLASS ++ help ++ This option enables support for controlling the status LED ++ of the WeTek.Play box. ON means BLUE, OFF means RED. ++ + + comment "LED Triggers" + source "drivers/leds/trigger/Kconfig" +--- /dev/null 2015-01-18 13:52:01.718570970 +0100 ++++ b/drivers/leds/leds-wetekplay.c 2015-01-18 16:00:12.791515784 +0100 +@@ -0,0 +1,107 @@ ++/* ++ * LEDs driver for the "User LED" on WeTek.Play ++ * ++ * Copyright (C) 2015 Memphiz ++ * ++ * Based on leds.rb532 ++ */ ++ ++#include ++#include ++#include ++ ++#include ++#include ++ ++static void wetekplay_led_set(struct led_classdev *cdev, ++ enum led_brightness brightness) ++{ ++ ++ if (brightness) { ++ //printk(KERN_INFO "%s() LED BLUE\n", __FUNCTION__); ++ aml_set_reg32_bits(SECBUS2_REG_ADDR(0), 1, 0, 1); // set TEST_n output mode ++ aml_set_reg32_bits(AOBUS_REG_ADDR(0x24), 1, 31, 1); // set TEST_n pin H ++ } ++ else { ++ //printk(KERN_INFO "%s() LED RED\n", __FUNCTION__); ++ aml_set_reg32_bits(SECBUS2_REG_ADDR(0), 1, 0, 1); // set TEST_n output mode ++ aml_set_reg32_bits(AOBUS_REG_ADDR(0x24), 0, 31, 1); // set TEST_n pin L ++ } ++} ++ ++static enum led_brightness wetekplay_led_get(struct led_classdev *cdev) ++{ ++ if (aml_get_reg32_bits(AOBUS_REG_ADDR(0x24), 31, 1)) ++ return 255; ++ else ++ return 0; ++} ++ ++static struct led_classdev wetekplay_powerled = { ++ .name = "wetek:blue:powerled", ++ .brightness_set = wetekplay_led_set, ++ .brightness_get = wetekplay_led_get, ++ .default_trigger = "default-on", ++}; ++ ++static int wetekplay_led_probe(struct platform_device *pdev) ++{ ++ return led_classdev_register(&pdev->dev, &wetekplay_powerled); ++} ++ ++static int wetekplay_led_remove(struct platform_device *pdev) ++{ ++ led_classdev_unregister(&wetekplay_powerled); ++ return 0; ++} ++ ++#ifdef CONFIG_USE_OF ++static const struct of_device_id amlogic_wetekplayled_dt_match[]={ ++ { .compatible = "amlogic,wetekplay-led", ++ }, ++ {}, ++}; ++#else ++#define amlogic_wetekplayled_dt_match, NULL ++#endif ++ ++ ++static struct platform_driver wetekplay_led_driver = { ++ .probe = wetekplay_led_probe, ++ .remove = wetekplay_led_remove, ++ .driver = { ++ .name = "wetekplay-led", ++ .of_match_table = amlogic_wetekplayled_dt_match, ++ }, ++}; ++ ++static int __init ++wetekplay_led_init_module(void) ++{ ++ int err; ++ ++ printk("wetekplay_led_init_module\n"); ++ if ((err = platform_driver_register(&wetekplay_led_driver))) { ++ return err; ++ } ++ ++ return err; ++ ++} ++ ++static void __exit ++wetekplay_led_remove_module(void) ++{ ++ platform_driver_unregister(&wetekplay_led_driver); ++ printk("wetekplay-led module removed.\n"); ++} ++ ++ ++//module_platform_driver(wetekplay_led_driver); ++module_init(wetekplay_led_init_module); ++module_exit(wetekplay_led_remove_module); ++ ++MODULE_LICENSE("GPL"); ++MODULE_DESCRIPTION("Power LED support for WeTek.Play"); ++MODULE_AUTHOR("Memphiz "); ++MODULE_ALIAS("platform:wetekplay-led"); diff --git a/projects/WeTek_Play/patches/linux/111-add-remote-control-ledtrigger.patch b/projects/WeTek_Play/patches/linux/111-add-remote-control-ledtrigger.patch new file mode 100644 index 0000000000..2965c343c6 --- /dev/null +++ b/projects/WeTek_Play/patches/linux/111-add-remote-control-ledtrigger.patch @@ -0,0 +1,165 @@ +From 4ac75e4f0aa7b1be61fe4a495248a11f49d3f204 Mon Sep 17 00:00:00 2001 +From: Memphiz +Date: Mon, 19 Jan 2015 20:27:36 +0100 +Subject: [PATCH] [LED] - add remote control ledtrigger + +--- + drivers/input/input.c | 13 ++++- + drivers/leds/trigger/Kconfig | 7 +++ + drivers/leds/trigger/Makefile | 1 + + drivers/leds/trigger/ledtrig-remote-control.c | 76 +++++++++++++++++++++++++++ + 4 files changed, 96 insertions(+), 1 deletion(-) + create mode 100644 drivers/leds/trigger/ledtrig-remote-control.c + +diff --git a/drivers/input/input.c b/drivers/input/input.c +index a161021..08829e3 100644 +--- a/drivers/input/input.c ++++ b/drivers/input/input.c +@@ -28,6 +28,11 @@ + #include + #include + #include "input-compat.h" ++// Led Trigger Support. ++#ifdef CONFIG_LEDS_TRIGGER_REMOTE_CONTROL ++#include ++extern void ledtrig_rc_activity(struct led_classdev *led_cdev); ++#endif + + MODULE_AUTHOR("Vojtech Pavlik "); + MODULE_DESCRIPTION("Input core"); +@@ -179,9 +184,12 @@ static void input_repeat_key(unsigned long data) + { + struct input_dev *dev = (void *) data; + unsigned long flags; +- ++#ifdef CONFIG_LEDS_TRIGGER_REMOTE_CONTROL ++ ledtrig_rc_activity(NULL); ++#endif + spin_lock_irqsave(&dev->event_lock, flags); + ++ + if (test_bit(dev->repeat_key, dev->key) && + is_event_supported(dev->repeat_key, dev->keybit, KEY_MAX)) { + struct input_value vals[] = { +@@ -427,6 +435,9 @@ void input_event(struct input_dev *dev, + + if (is_event_supported(type, dev->evbit, EV_MAX)) { + ++#ifdef CONFIG_LEDS_TRIGGER_REMOTE_CONTROL ++ledtrig_rc_activity(NULL); ++#endif + spin_lock_irqsave(&dev->event_lock, flags); + input_handle_event(dev, type, code, value); + spin_unlock_irqrestore(&dev->event_lock, flags); +diff --git a/drivers/leds/trigger/Kconfig b/drivers/leds/trigger/Kconfig +index 49794b4..e911914 100644 +--- a/drivers/leds/trigger/Kconfig ++++ b/drivers/leds/trigger/Kconfig +@@ -41,6 +41,13 @@ config LEDS_TRIGGER_IDE_DISK + This allows LEDs to be controlled by IDE disk activity. + If unsure, say Y. + ++config LEDS_TRIGGER_REMOTE_CONTROL ++ bool "LED Remote Control Trigger" ++ depends on AM_REMOTE ++ help ++ This allows LEDs to be controlled by Remote Control activity. ++ If unsure, say Y. ++ + config LEDS_TRIGGER_HEARTBEAT + tristate "LED Heartbeat Trigger" + depends on LEDS_TRIGGERS +diff --git a/drivers/leds/trigger/Makefile b/drivers/leds/trigger/Makefile +index 1abf48d..868976b 100644 +--- a/drivers/leds/trigger/Makefile ++++ b/drivers/leds/trigger/Makefile +@@ -8,3 +8,4 @@ obj-$(CONFIG_LEDS_TRIGGER_CPU) += ledtrig-cpu.o + obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o + obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o + obj-$(CONFIG_LEDS_TRIGGER_CAMERA) += ledtrig-camera.o ++obj-$(CONFIG_LEDS_TRIGGER_REMOTE_CONTROL) += ledtrig-remote-control.o +diff --git a/drivers/leds/trigger/ledtrig-remote-control.c b/drivers/leds/trigger/ledtrig-remote-control.c +new file mode 100644 +index 0000000..96dc71a +--- /dev/null ++++ b/drivers/leds/trigger/ledtrig-remote-control.c +@@ -0,0 +1,76 @@ ++/* ++ * LED Remote Control Activity Trigger ++ * ++ * Copyright 2015 Memphiz (memphiz@kodi.tv) ++ * Copyright 2013 Rene van Dorst ++ * Copyright 2006 Openedhand Ltd. ++ * ++ * Author: Richard Purdie ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Delay on in mSec */ ++ #define delay_on 20 ++ ++static void ledtrig_rc_timerfunc(unsigned long data); ++ ++ ++static DEFINE_TIMER(ledtrig_rc_timer, ledtrig_rc_timerfunc, 0, 0); ++static int rc_activity; ++static int rc_lastactivity; ++ ++void ledtrig_rc_activity(struct led_classdev *led_cdev) ++{ ++ rc_activity++; ++ if (!timer_pending(&ledtrig_rc_timer)) ++ mod_timer(&ledtrig_rc_timer, jiffies + msecs_to_jiffies(delay_on)); ++} ++EXPORT_SYMBOL(ledtrig_rc_activity); ++ ++static struct led_trigger ledtrig_rc = { ++ .name = "rc", ++ .activate = ledtrig_rc_activity, ++}; ++ ++ ++static void ledtrig_rc_timerfunc(unsigned long data) ++{ ++ if (rc_lastactivity != rc_activity) { ++ rc_lastactivity = rc_activity; ++ /* INT_MAX will set each LED to its maximum brightness */ ++ led_trigger_event(&ledtrig_rc, LED_OFF); ++ mod_timer(&ledtrig_rc_timer, jiffies + msecs_to_jiffies(delay_on)); ++ } else { ++ led_trigger_event(&ledtrig_rc, INT_MAX); ++ } ++} ++ ++static int __init ledtrig_rc_init(void) ++{ ++ led_trigger_register(&ledtrig_rc); ++ return 0; ++} ++ ++static void __exit ledtrig_rc_exit(void) ++{ ++ led_trigger_unregister(&ledtrig_rc); ++} ++ ++module_init(ledtrig_rc_init); ++module_exit(ledtrig_rc_exit); ++ ++MODULE_AUTHOR("Memphiz "); ++MODULE_DESCRIPTION("LED Remote Control Activity Trigger"); ++MODULE_LICENSE("GPL"); ++ +-- +1.9.3 (Apple Git-50) + diff --git a/projects/WeTek_Play/patches/linux/120-enable_cputemp.patch b/projects/WeTek_Play/patches/linux/120-enable_cputemp.patch new file mode 100644 index 0000000000..8fb9019894 --- /dev/null +++ b/projects/WeTek_Play/patches/linux/120-enable_cputemp.patch @@ -0,0 +1,17 @@ +--- a/arch/arm/mach-meson6/cpu.c.orig 2015-01-18 19:50:04.897840428 +0100 ++++ b/arch/arm/mach-meson6/cpu.c 2015-01-18 19:50:30.241839679 +0100 +@@ -59,6 +59,14 @@ + int mali_revb_flag = -1; + //int mali_version(void) + ++int (*get_cpu_temperature_celius)(void) = NULL; ++EXPORT_SYMBOL_GPL(get_cpu_temperature_celius); ++ ++int get_cpu_temperature(void) ++{ ++ return get_cpu_temperature_celius ? get_cpu_temperature_celius() : -1; ++} ++ + EXPORT_SYMBOL_GPL(mali_revb_flag); + static int __init maliversion(char *str) + { diff --git a/projects/WeTek_Play/patches/linux/30-g18dtd.patch b/projects/WeTek_Play/patches/linux/30-g18dtd.patch index a70fc2d63f..8fc6cd3a5c 100644 --- a/projects/WeTek_Play/patches/linux/30-g18dtd.patch +++ b/projects/WeTek_Play/patches/linux/30-g18dtd.patch @@ -2713,3 +2713,16 @@ diff -Naur a/arch/arm/boot/dts/amlogic/meson6_g18.dtd b/arch/arm/boot/dts/amlogi + }; /* end of / */ +--- a/arch/arm/boot/dts/amlogic/meson6_g18.dtd.orig 2015-01-18 14:59:49.171659096 +0100 ++++ b/arch/arm/boot/dts/amlogic/meson6_g18.dtd 2015-01-18 14:59:59.147658701 +0100 +@@ -1428,5 +1428,10 @@ + reserve-iomap = "true"; + }; + ++ powerled{ ++ compatible = "amlogic,wetekplay-led"; ++ label = "wetek:blue:powerled"; ++ }; ++ + }; /* end of / */ +