From d76fb8c8c6d079a3cee81da7072347dcb8bbbc70 Mon Sep 17 00:00:00 2001 From: huangcm <null@gmail.com> Date: Fri, 23 Aug 2024 08:49:38 +0000 Subject: [PATCH] feat(rtc/ir): add rtc func and fix ir pro --- longan/kernel/linux-4.9/arch/arm64/configs/sun50iw10p1smp_a133_android_defconfig | 1 + longan/kernel/linux-4.9/drivers/rtc/rtc-hym8563.c | 18 ++++++++++++++---- longan/device/config/chips/a133/configs/c3/board.dts | 7 +++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/longan/device/config/chips/a133/configs/c3/board.dts b/longan/device/config/chips/a133/configs/c3/board.dts index f9a0eac..cde8cea 100755 --- a/longan/device/config/chips/a133/configs/c3/board.dts +++ b/longan/device/config/chips/a133/configs/c3/board.dts @@ -104,7 +104,7 @@ allwinner,pins = "PH12", "PH13"; allwinner,pname = "twi3_scl", "twi3_sda"; allwinner,function = "twi3"; - allwinner,muxsel = <2>; + allwinner,muxsel = <3>; allwinner,drive = <1>; allwinner,pull = <1>; }; @@ -373,7 +373,10 @@ pcf8563@51 { compatible = "haoyu,hym8563"; reg = <0x51>; + interrupt-parent = <&pio>; + interrupts = <PB 8 IRQ_TYPE_LEVEL_LOW>; status = "okay"; + //wakeup-source; }; }; @@ -1365,7 +1368,7 @@ ir_addr_code1 = <0x7f80>; ir_power_key_code2 = <0x1c>; ir_addr_code2 = <0xdf00>; - wakeup-source; + //wakeup-source; }; //#include "lcd-lvds-21-1920-1080.dtsi" diff --git a/longan/kernel/linux-4.9/arch/arm64/configs/sun50iw10p1smp_a133_android_defconfig b/longan/kernel/linux-4.9/arch/arm64/configs/sun50iw10p1smp_a133_android_defconfig index 4d0ec2d..ac0614f 100755 --- a/longan/kernel/linux-4.9/arch/arm64/configs/sun50iw10p1smp_a133_android_defconfig +++ b/longan/kernel/linux-4.9/arch/arm64/configs/sun50iw10p1smp_a133_android_defconfig @@ -347,6 +347,7 @@ CONFIG_LIRC=y CONFIG_RC_DEVICES=y CONFIG_IR_SUNXI=y +CONFIG_SUNXI_MULTI_IR_SUPPORT=y CONFIG_V4L_PLATFORM_DRIVERS=y CONFIG_VIDEO_SUNXI_VIN=m # CONFIG_CSI_CCI is not set diff --git a/longan/kernel/linux-4.9/drivers/rtc/rtc-hym8563.c b/longan/kernel/linux-4.9/drivers/rtc/rtc-hym8563.c index e5ad527..db5f872 100644 --- a/longan/kernel/linux-4.9/drivers/rtc/rtc-hym8563.c +++ b/longan/kernel/linux-4.9/drivers/rtc/rtc-hym8563.c @@ -438,10 +438,10 @@ { struct hym8563 *hym8563 = (struct hym8563 *)dev_id; struct i2c_client *client = hym8563->client; - struct mutex *lock = &hym8563->rtc->ops_lock; + //struct mutex *lock = &hym8563->rtc->ops_lock; int data, ret; - mutex_lock(lock); + //mutex_lock(lock); /* Clear the alarm flag */ @@ -461,7 +461,7 @@ } out: - mutex_unlock(lock); + //mutex_unlock(lock); return IRQ_HANDLED; } @@ -529,7 +529,13 @@ { struct hym8563 *hym8563; int ret; - + struct rtc_time tm = { + .tm_year = 2024 - 1900, + .tm_mon = 7, + .tm_mday = 23, + .tm_wday = 5, + .tm_hour = 13, + }; hym8563 = devm_kzalloc(&client->dev, sizeof(*hym8563), GFP_KERNEL); if (!hym8563) return -ENOMEM; @@ -565,6 +571,10 @@ hym8563->valid = !(ret & HYM8563_SEC_VL); dev_dbg(&client->dev, "rtc information is %s\n", hym8563->valid ? "valid" : "invalid"); + if (!hym8563->valid) { + dev_err(&client->dev, "rtc use default time !!!\n"); + hym8563_rtc_set_time(&client->dev, &tm); + } hym8563->rtc = devm_rtc_device_register(&client->dev, client->name, &hym8563_rtc_ops, THIS_MODULE); -- Gitblit v1.6.2