From b46438964e30467520901ab4113b497a9b97b694 Mon Sep 17 00:00:00 2001 From: OwerSun Date: Thu, 21 Feb 2019 09:00:09 +0000 Subject: [PATCH 1/8] AML: Backport 3.14 patch for video, seriously improving video playback --- drivers/amlogic/media/video_sink/video.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/amlogic/media/video_sink/video.c b/drivers/amlogic/media/video_sink/video.c index 08b1fca43bf3..ea72a1a6e146 100644 --- a/drivers/amlogic/media/video_sink/video.c +++ b/drivers/amlogic/media/video_sink/video.c @@ -5196,6 +5196,8 @@ static irqreturn_t vsync_isr_in(int irq, void *dev_id) if (omx_secret_mode == true) { u32 system_time = timestamp_pcrscr_get(); int diff = system_time - omx_pts; + video_notify_flag |= VIDEO_NOTIFY_TRICK_WAIT; + atomic_set(&trickmode_framedone, 1); if ((diff - omx_pts_interval_upper) > 0 || (diff - omx_pts_interval_lower) < 0 From e2b032fead958cdd7e1d1199cff9de65be2a2efb Mon Sep 17 00:00:00 2001 From: Joy Cho Date: Tue, 26 Feb 2019 13:45:34 +0900 Subject: [PATCH 2/8] media: rc: add LIRC_CAN_SEND for the buffer allocation to support IR TX Change-Id: I12c0695686084bd8f9a14e9b93284a17ef58c63f --- drivers/media/rc/lirc_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index f4509ef9922b..2d8e14fa131b 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -360,7 +360,7 @@ int lirc_register_driver(struct lirc_driver *d) if (minor < 0) return minor; - if (LIRC_CAN_REC(d->features)) { + if (LIRC_CAN_REC(d->features) || LIRC_CAN_SEND(d->features)) { err = lirc_allocate_buffer(irctls[minor]); if (err) lirc_unregister_driver(minor); From 84b6e24b459be67d8f1a1c16805c4769b2563b23 Mon Sep 17 00:00:00 2001 From: Joy Cho Date: Fri, 15 Feb 2019 18:32:15 +0900 Subject: [PATCH 3/8] ODROID-N2: staging: lirc: support GPIO based IR Blaster Change-Id: I0a4993e68784a31f3d89c2f54e69dc70aa7bc5f3 --- arch/arm64/configs/odroidn2_defconfig | 11 +- drivers/staging/media/lirc/Kconfig | 12 + drivers/staging/media/lirc/Makefile | 1 + drivers/staging/media/lirc/lirc_odroid.c | 450 +++++++++++++++++++++++ 4 files changed, 473 insertions(+), 1 deletion(-) create mode 100644 drivers/staging/media/lirc/lirc_odroid.c diff --git a/arch/arm64/configs/odroidn2_defconfig b/arch/arm64/configs/odroidn2_defconfig index f46a006500cf..57b3eb50482d 100644 --- a/arch/arm64/configs/odroidn2_defconfig +++ b/arch/arm64/configs/odroidn2_defconfig @@ -4823,7 +4823,16 @@ CONFIG_R8712U=m # Speakup console speech # # CONFIG_SPEAKUP is not set -# CONFIG_STAGING_MEDIA is not set +CONFIG_STAGING_MEDIA=y +# CONFIG_I2C_BCM2048 is not set +# CONFIG_MEDIA_CEC is not set +CONFIG_LIRC_STAGING=y +# CONFIG_LIRC_IMON is not set +CONFIG_LIRC_ODROID=m +# CONFIG_LIRC_SASEM is not set +# CONFIG_LIRC_SERIAL is not set +# CONFIG_LIRC_SIR is not set +# CONFIG_LIRC_ZILOG is not set # # Android diff --git a/drivers/staging/media/lirc/Kconfig b/drivers/staging/media/lirc/Kconfig index 6879c4651b46..ce4bbfa7d676 100644 --- a/drivers/staging/media/lirc/Kconfig +++ b/drivers/staging/media/lirc/Kconfig @@ -32,6 +32,18 @@ config LIRC_PARALLEL help Driver for Homebrew Parallel Port Receivers +config LIRC_ODROID + tristate "GPIO based IR Transmitter for ODROID" + depends on LIRC + help + Say Y if you want to use GPIO-based IR transmitter + connected on one of 40pin connector of ODROID-C1/C2. + + To compile this driver as a module, choose M here: the + module will be called lirc_odroid. + + If unsure, say N. + config LIRC_SASEM tristate "Sasem USB IR Remote" depends on LIRC && USB diff --git a/drivers/staging/media/lirc/Makefile b/drivers/staging/media/lirc/Makefile index 5430adf0475d..b72cdc2a6a06 100644 --- a/drivers/staging/media/lirc/Makefile +++ b/drivers/staging/media/lirc/Makefile @@ -10,3 +10,4 @@ obj-$(CONFIG_LIRC_SASEM) += lirc_sasem.o obj-$(CONFIG_LIRC_SERIAL) += lirc_serial.o obj-$(CONFIG_LIRC_SIR) += lirc_sir.o obj-$(CONFIG_LIRC_ZILOG) += lirc_zilog.o +obj-$(CONFIG_LIRC_ODROID) += lirc_odroid.o diff --git a/drivers/staging/media/lirc/lirc_odroid.c b/drivers/staging/media/lirc/lirc_odroid.c new file mode 100644 index 000000000000..e25a1f29b54c --- /dev/null +++ b/drivers/staging/media/lirc/lirc_odroid.c @@ -0,0 +1,450 @@ +/* + * lirc_odroid.c + * + * lirc_odroid - Modified version from lirc_gpioblaster.c of OpenWrt. + * taken from https://wiki.openwrt.org/doc/howto/lirc-gpioblaster + * + * Copyright (C) 2014 Qball Cow , + * Copyright (C) 2012 Aron Robert Szabo , + * Michael Bishop + * + * This driver has been modified to support ODROID-C1/C2 and ODROID-N2 + * and only supports IR transmitter. + * Modified by Joy Cho + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define LIRC_DRIVER_NAME "lirc_odroid" + +#define RBUF_LEN 256 +#define LIRC_TRANSMITTER_LATENCY 50 + +#ifndef MAX_UDELAY_MS +#define MAX_UDELAY_US 5000 +#else +#define MAX_UDELAY_US (MAX_UDELAY_MS * 1000) +#endif + +/* module parameters */ +/* set the default GPIO output pin */ +static int gpio_out_pin; +/* enable debugging messages */ +static bool debug; + +/* softcarrier option : default on */ +static bool softcarrier = 1; +/* 0 = do not invert output, 1 = invert output */ +static bool invert; + +/* forward declarations */ +static long send_pulse(unsigned long length); +static void send_space(long length); +static void lirc_odroid_exit(void); + +static struct platform_device *lirc_odroid_dev; +static struct lirc_buffer rbuf; +static spinlock_t lock; + +/* initialized/set in init_timing_params() */ +static unsigned int freq = 38000; +static unsigned int duty_cycle = 50; +static unsigned long period; +static unsigned long pulse_width; +static unsigned long space_width; + +static void safe_udelay(unsigned long usecs) +{ + while (usecs > MAX_UDELAY_US) { + udelay(MAX_UDELAY_US); + usecs -= MAX_UDELAY_US; + } + udelay(usecs); +} + +static unsigned long read_current_us(void) +{ + struct timespec now; + + getnstimeofday(&now); + + return (now.tv_sec * 1000000) + (now.tv_nsec / 1000); +} + +static int init_timing_params(unsigned int new_duty_cycle, + unsigned int new_freq) +{ + /* Time unit of all parameters is microseconds unit. + * It's available for the case when base frequency is smaller + * than 1MHz. + */ + duty_cycle = new_duty_cycle; + freq = new_freq; + period = 1000000L / freq; + + /* duty cycle in percentage unit, duty_cycle 50 means 50% */ + pulse_width = period * duty_cycle / 100; + space_width = period - pulse_width; + + pr_info("in init_timing_params, freq=%d pulse=%ld, space=%ld\n", + freq, pulse_width, space_width); + + return 0; +} + +static long send_pulse_softcarrier(unsigned long length) +{ + int flag; + unsigned long actual, target; + unsigned long actual_us, initial_us, target_us; + + actual = 0; target = 0; flag = 0; + + actual_us = read_current_us(); + /* length from lircd.conf is in us unit */ + while (actual < length) { + if (flag) { + gpio_set_value(gpio_out_pin, invert); + target += space_width; + } else { + gpio_set_value(gpio_out_pin, !invert); + target += pulse_width; + } + + initial_us = actual_us; + target_us = actual_us + (target - actual); + + /* + * Note - we've checked in ioctl that the pulse/space + * widths are big enough so that d is > 0 + */ + if ((int)(target_us - actual_us) > 0) + udelay(target_us - actual_us); + + actual_us = read_current_us(); + actual += (actual_us - initial_us); + flag = !flag; + } + + return (actual - length); +} + +static long send_pulse(unsigned long length) +{ + if (length <= 0) + return 0; + + if (softcarrier) + return send_pulse_softcarrier(length); + + gpio_set_value(gpio_out_pin, !invert); + safe_udelay(length); + + return 0; +} + +static void send_space(long length) +{ + gpio_set_value(gpio_out_pin, invert); + if (length <= 0) + return; + safe_udelay(length); +} + +static int init_port(void) +{ + int ret; + + if (gpio_request(gpio_out_pin, LIRC_DRIVER_NAME " ir/out")) { + pr_info(LIRC_DRIVER_NAME ": cant claim gpio pin %d\n", + gpio_out_pin); + ret = -ENODEV; + goto exit_init_port; + } + + gpio_direction_output(gpio_out_pin, invert); + gpio_set_value(gpio_out_pin, invert); + + return 0; + +exit_init_port: + gpio_free(gpio_out_pin); + return ret; +} + +/* called when the character device is opened */ +static int set_use_inc(void *data) +{ + pr_info(LIRC_DRIVER_NAME " is opened\n"); + return 0; +} + +static void set_use_dec(void *data) +{ + pr_info(LIRC_DRIVER_NAME " is closed\n"); +} + +/* + * Header space pulse + * + pre_data space pulse pairs + * + key_codes space pulse pairs + */ +static ssize_t lirc_write(struct file *file, const char *buf, + size_t n, loff_t *ppos) +{ + int i, count; + unsigned long flags; + long delta = 0; + int *wbuf; + + count = n / sizeof(int); + if (n % sizeof(int) || count % 2 == 0) + return -EINVAL; + wbuf = memdup_user(buf, n); + if (IS_ERR(wbuf)) + return PTR_ERR(wbuf); + spin_lock_irqsave(&lock, flags); + + /* + * refer to space and pulse duration for 'one','zero' + * space first and then pulse + */ + for (i = 0; i < count; i++) { + if (i % 2) + send_space(wbuf[i] - delta); + else + delta = send_pulse(wbuf[i]); + } + /* set default level after transmission */ + gpio_set_value(gpio_out_pin, invert); + + spin_unlock_irqrestore(&lock, flags); + kfree(wbuf); + + return n; +} + +static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) +{ + long result = 0; + __u32 value; + + switch (cmd) { + case LIRC_GET_SEND_MODE: + result = -ENOIOCTLCMD; + break; + + case LIRC_SET_SEND_MODE: + result = get_user(value, (__u32 *)arg); + if (result) + break; + /* only LIRC_MODE_PULSE supported */ + if (value != LIRC_MODE_PULSE) + result = -EPERM; + break; + + case LIRC_GET_LENGTH: + result = -EPERM; + break; + + case LIRC_SET_SEND_DUTY_CYCLE: + result = get_user(value, (__u32 *)arg); + pr_info(LIRC_DRIVER_NAME " - SET_SEND_DUTY_CYCLE %d\n", value); + if (result) + break; + + if (value <= 0 || value > 100) + result = -EINVAL; + else + result = init_timing_params(value, freq); + break; + + case LIRC_SET_SEND_CARRIER: + result = get_user(value, (__u32 *)arg); + pr_info(LIRC_DRIVER_NAME " - SET_SEND_CARRIER %d\n", value); + if (result) + break; + + if (value > 500000 || value < 20000) + result = -EINVAL; + else + result = init_timing_params(duty_cycle, value); + break; + + default: + result = lirc_dev_fop_ioctl(filep, cmd, arg); + break; + } + + return result; +} + +static const struct file_operations lirc_fops = { + .owner = THIS_MODULE, + .write = lirc_write, + .unlocked_ioctl = lirc_ioctl, + .read = lirc_dev_fop_read, + .poll = lirc_dev_fop_poll, + .open = lirc_dev_fop_open, + .release = lirc_dev_fop_close, + .llseek = no_llseek, +}; + +static struct lirc_driver driver = { + .name = LIRC_DRIVER_NAME, + .minor = -1, + .code_length = 1, + .sample_rate = 0, + .data = NULL, + .add_to_buf = NULL, + .rbuf = &rbuf, + .set_use_inc = set_use_inc, + .set_use_dec = set_use_dec, + .fops = &lirc_fops, + .dev = NULL, + .owner = THIS_MODULE, +}; + +static struct platform_driver lirc_odroid_driver = { + .driver = { + .name = LIRC_DRIVER_NAME, + .owner = THIS_MODULE, + }, +}; + +static int __init lirc_odroid_init(void) +{ + int result; + + /* Init read buffer. */ + result = lirc_buffer_init(&rbuf, sizeof(int), RBUF_LEN); + if (result < 0) + return -ENOMEM; + + result = platform_driver_register(&lirc_odroid_driver); + if (result) { + pr_info("lirc register returned %d\n", result); + goto exit_buffer_free; + } + + lirc_odroid_dev = platform_device_alloc(LIRC_DRIVER_NAME, 0); + if (!lirc_odroid_dev) { + result = -ENOMEM; + goto exit_driver_unregister; + } + + result = platform_device_add(lirc_odroid_dev); + if (result) + goto exit_device_put; + + return 0; + +exit_device_put: + platform_device_put(lirc_odroid_dev); + +exit_driver_unregister: + platform_driver_unregister(&lirc_odroid_driver); + +exit_buffer_free: + lirc_buffer_free(&rbuf); + + return result; +} + +static void lirc_odroid_exit(void) +{ + pr_info(LIRC_DRIVER_NAME "[%s]\n", __func__); + gpio_free(gpio_out_pin); + platform_device_unregister(lirc_odroid_dev); + platform_driver_unregister(&lirc_odroid_driver); + lirc_buffer_free(&rbuf); +} + +static int __init lirc_odroid_init_module(void) +{ + int result; + + result = lirc_odroid_init(); + if (result) + return result; + + result = init_port(); + if (result < 0) { + pr_info(LIRC_DRIVER_NAME ": init port fail!\n"); + goto exit_odroid; + } + + /* check if the module received valid gpio pin numbers */ + driver.features = LIRC_CAN_SET_SEND_DUTY_CYCLE | + LIRC_CAN_SET_SEND_CARRIER | + LIRC_CAN_SEND_PULSE; + + driver.dev = &lirc_odroid_dev->dev; + driver.minor = lirc_register_driver(&driver); + + if (driver.minor < 0) { + pr_info(LIRC_DRIVER_NAME ": device registration failed with %d\n", + result); + result = -EIO; + goto exit_odroid; + } + + pr_info(LIRC_DRIVER_NAME ": driver registered!\n"); + + return 0; + +exit_odroid: + lirc_odroid_exit(); + + return result; +} + +static void __exit lirc_odroid_exit_module(void) +{ + lirc_odroid_exit(); + + lirc_unregister_driver(driver.minor); + pr_info(LIRC_DRIVER_NAME ": cleaned up module\n"); +} + +module_init(lirc_odroid_init_module); +module_exit(lirc_odroid_exit_module); + +MODULE_DESCRIPTION("GPIO based IR Transmitter driver for Odroid C/C2 and N2"); +MODULE_AUTHOR("Joy Cho "); +MODULE_LICENSE("GPL"); + +module_param(gpio_out_pin, int, 0644); +MODULE_PARM_DESC(gpio_out_pin, "GPIO output/transmitter pin number"); + +module_param(softcarrier, bool, 0644); +MODULE_PARM_DESC(softcarrier, "Software carrier (0 = off, 1 = on, default on)"); + +module_param(invert, bool, 0644); +MODULE_PARM_DESC(invert, "Invert output (0 = off, 1 = on, default off"); + +module_param(debug, bool, 0644); +MODULE_PARM_DESC(debug, "Enable debugging messages"); From e0c47aefdd854046fb37d323bf1ea0123b782eb5 Mon Sep 17 00:00:00 2001 From: Dongjin Kim Date: Wed, 27 Feb 2019 16:46:40 +0900 Subject: [PATCH 4/8] ODROID-COMMON: rtl8211: Link/Active LED configuration * Green - 100Mbps * Amber - 1000Mbps Change-Id: Idc60ac29b5ddab39153a04564a6bb76d0ec02c17 Signed-off-by: Dongjin Kim --- drivers/net/phy/realtek.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 31bc5a349c29..a1878f045b04 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -151,7 +151,13 @@ static int rtl8211f_config_init(struct phy_device *phydev) } #endif phy_write(phydev, RTL8211F_PAGE_SELECT, 0xd04); /*set page 0xd04*/ +#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) + phy_write(phydev, RTL821x_LCR, + (1 << 6) | (1 << 9) // LED1 - GREEN (100Mbps) + | (1 << 13) | (1 << 14)); // LED2 - AMBER (1000Mbps) +#else phy_write(phydev, RTL821x_LCR, 0XC171); /*led configuration*/ +#endif /* restore to default page 0 */ phy_write(phydev, RTL8211F_PAGE_SELECT, 0x0); From 3fd41551e87434bfbc777dbcf4c17158d72eaaf0 Mon Sep 17 00:00:00 2001 From: Dongjin Kim Date: Thu, 28 Feb 2019 03:48:01 -0500 Subject: [PATCH 5/8] ODROID-COMMON: usb3: do not reset USB hub on boot Change-Id: I167f44ff20e35be30851e81cdd180afb5d093d29 Signed-off-by: Dongjin Kim --- arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi index d7ee7ae8e2c2..6b78e0b8f495 100644 --- a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi @@ -185,13 +185,11 @@ gpios = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>; asserted-state = <0>; duration-ms = <100>; - auto; }; usb_hub { gpios = <&gpio GPIOH_4 GPIO_ACTIVE_HIGH>; asserted-state = <0>; duration-ms = <100>; - auto; }; }; From c33092b845d3b5540d83a63cf6f00d25f6b43621 Mon Sep 17 00:00:00 2001 From: Arthur Liberman Date: Sat, 2 Mar 2019 23:20:14 +0200 Subject: [PATCH 6/8] net: phy: 8211f disable eee led indication --- drivers/net/phy/realtek.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 31bc5a349c29..5dde1504dfaa 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -26,6 +26,7 @@ #include #endif #define RTL821x_LCR 0x10 +#define RTL821x_EEELCR 0x11 #define RTL821x_PHYSR 0x11 #define RTL821x_PHYSR_DUPLEX 0x2000 #define RTL821x_PHYSR_SPEED 0xc000 @@ -152,6 +153,7 @@ static int rtl8211f_config_init(struct phy_device *phydev) #endif phy_write(phydev, RTL8211F_PAGE_SELECT, 0xd04); /*set page 0xd04*/ phy_write(phydev, RTL821x_LCR, 0XC171); /*led configuration*/ + phy_write(phydev, RTL821x_EEELCR, 0); /*disable eee led indication*/ /* restore to default page 0 */ phy_write(phydev, RTL8211F_PAGE_SELECT, 0x0); From 6388e218f9310f7bed879cfa0fdf152ff14e89ca Mon Sep 17 00:00:00 2001 From: Kevin Kim Date: Wed, 20 Feb 2019 18:13:24 +0900 Subject: [PATCH 7/8] ODROID-COMMON:Add Mixer control for LINE-OUT Mute Mute : amixer -c0 sset 'LINE_OUT mute' on Unmute : amixer -c0 sset 'LINE_OUT mute' off Boot on state : unmute Change-Id: If899ea5607cbef8b62fb35b66c79089beb192d1a --- .../boot/dts/amlogic/mesong12_odroid_common.dtsi | 4 ++-- sound/soc/amlogic/auge/card.c | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi index 6b78e0b8f495..1ae0371d372e 100644 --- a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi @@ -92,8 +92,8 @@ auge_sound { compatible = "amlogic, g12a-sound-card"; aml-audio-card,name = "AML-AUGESOUND"; - /*avout mute gpio*/ - avout_mute-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; + /*line-out mute gpio*/ + mute_gpio = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>; /*for audio effect ,eqdrc */ aml-audio-card,effect = <&audio_effect>; diff --git a/sound/soc/amlogic/auge/card.c b/sound/soc/amlogic/auge/card.c index f69a49c82c12..1bf5aa6d69cf 100644 --- a/sound/soc/amlogic/auge/card.c +++ b/sound/soc/amlogic/auge/card.c @@ -735,7 +735,7 @@ static int spk_mute_get(struct snd_kcontrol *kcontrol, } static const struct snd_kcontrol_new card_controls[] = { - SOC_SINGLE_BOOL_EXT("SPK mute", 0, + SOC_SINGLE_BOOL_EXT("LINE_OUT mute", 0, spk_mute_get, spk_mute_set), }; @@ -750,7 +750,7 @@ static int aml_card_parse_gpios(struct device_node *node, bool active_low; int ret; - gpio = of_get_named_gpio_flags(node, "spk_mute", 0, &flags); + gpio = of_get_named_gpio_flags(node, "mute_gpio", 0, &flags); priv->spk_mute_gpio = gpio; if (gpio_is_valid(gpio)) { @@ -758,14 +758,16 @@ static int aml_card_parse_gpios(struct device_node *node, flags = active_low ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; priv->spk_mute_active_low = active_low; - ret = devm_gpio_request_one(dev, gpio, flags, "spk_mute"); + ret = devm_gpio_request_one(dev, gpio, flags, "line_mute"); if (ret < 0) return ret; ret = snd_soc_add_card_controls(soc_card, card_controls, ARRAY_SIZE(card_controls)); - } + pr_info("add line-out mute controls\n"); + } +#if !defined(CONFIG_ARCH_MESON64_ODROID_COMMON) priv->avout_mute_desc = gpiod_get(dev, "avout_mute", GPIOD_OUT_HIGH); @@ -773,6 +775,7 @@ static int aml_card_parse_gpios(struct device_node *node, gpiod_direction_output(priv->avout_mute_desc, GPIOF_OUT_INIT_HIGH); pr_info("set av out GPIOF_OUT_INIT_HIGH!\n"); +#endif return 0; } From 7369d186e28c07c31d25c42898bf070b9140cd6c Mon Sep 17 00:00:00 2001 From: Ray <1458889+Raybuntu@users.noreply.github.com> Date: Wed, 20 Feb 2019 15:16:11 +0100 Subject: [PATCH 8/8] CEC: AOCEC libcec support --- drivers/amlogic/cec/hdmi_ao_cec.c | 14 +++++++++----- drivers/amlogic/cec/hdmi_ao_cec.h | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/amlogic/cec/hdmi_ao_cec.c b/drivers/amlogic/cec/hdmi_ao_cec.c index 68a27b512fb9..f5745eda3418 100644 --- a/drivers/amlogic/cec/hdmi_ao_cec.c +++ b/drivers/amlogic/cec/hdmi_ao_cec.c @@ -65,7 +65,7 @@ static struct early_suspend aocec_suspend_handler; #define CEC_FRAME_DELAY msecs_to_jiffies(400) -#define CEC_DEV_NAME "cec" +#define CEC_DEV_NAME "aocec" #define CEC_POWER_ON (0 << 0) #define CEC_EARLY_SUSPEND (1 << 0) @@ -1905,7 +1905,8 @@ static void cec_task(struct work_struct *work) cec_cfg = cec_config(0, 0); if (cec_cfg & CEC_FUNC_CFG_CEC_ON) { /*cec module on*/ - if (cec_dev && (!wake_ok || cec_service_suspended())) + if (cec_dev && (!wake_ok || cec_service_suspended()) + && !(cec_dev->hal_flag & (1 << HDMI_OPTION_SYSTEM_CEC_CONTROL))) cec_rx_process(); /*for check rx buffer for old chip version, cec rx irq process*/ @@ -2530,6 +2531,11 @@ static ssize_t hdmitx_cec_write(struct file *f, const char __user *buf, if (cec_cfg & CEC_FUNC_CFG_CEC_ON) { /*cec module on*/ ret = cec_ll_tx(tempbuf, size); + if (ret == CEC_FAIL_NACK) { + return -1; + } else { + return size; + } } else { CEC_ERR("err:cec module disabled\n"); } @@ -2906,9 +2912,7 @@ static char *aml_cec_class_devnode(struct device *dev, umode_t *mode) { if (mode) { *mode = 0666; - CEC_INFO("mode is %x\n", *mode); - } else - CEC_INFO("mode is null\n"); + } return NULL; } diff --git a/drivers/amlogic/cec/hdmi_ao_cec.h b/drivers/amlogic/cec/hdmi_ao_cec.h index e256b617b017..2567c9ea1688 100644 --- a/drivers/amlogic/cec/hdmi_ao_cec.h +++ b/drivers/amlogic/cec/hdmi_ao_cec.h @@ -22,7 +22,7 @@ #define CEC_DRIVER_VERSION "Ver 2018/11/21\n" #define CEC_FRAME_DELAY msecs_to_jiffies(400) -#define CEC_DEV_NAME "cec" +#define CEC_DEV_NAME "aocec" #define CEC_EARLY_SUSPEND (1 << 0) #define CEC_DEEP_SUSPEND (1 << 1)