huangcm
2024-08-23 d76fb8c8c6d079a3cee81da7072347dcb8bbbc70
feat(rtc/ir): add rtc func and fix ir pro
3 files modified
26 ■■■■ changed files
longan/device/config/chips/a133/configs/c3/board.dts 7 ●●●● patch | view | raw | blame | history
longan/kernel/linux-4.9/arch/arm64/configs/sun50iw10p1smp_a133_android_defconfig 1 ●●●● patch | view | raw | blame | history
longan/kernel/linux-4.9/drivers/rtc/rtc-hym8563.c 18 ●●●● patch | view | raw | blame | history
longan/device/config/chips/a133/configs/c3/board.dts
....@@ -104,7 +104,7 @@
104104 allwinner,pins = "PH12", "PH13";
105105 allwinner,pname = "twi3_scl", "twi3_sda";
106106 allwinner,function = "twi3";
107
- allwinner,muxsel = <2>;
107
+ allwinner,muxsel = <3>;
108108 allwinner,drive = <1>;
109109 allwinner,pull = <1>;
110110 };
....@@ -373,7 +373,10 @@
373373 pcf8563@51 {
374374 compatible = "haoyu,hym8563";
375375 reg = <0x51>;
376
+ interrupt-parent = <&pio>;
377
+ interrupts = <PB 8 IRQ_TYPE_LEVEL_LOW>;
376378 status = "okay";
379
+ //wakeup-source;
377380 };
378381 };
379382
....@@ -1365,7 +1368,7 @@
13651368 ir_addr_code1 = <0x7f80>;
13661369 ir_power_key_code2 = <0x1c>;
13671370 ir_addr_code2 = <0xdf00>;
1368
- wakeup-source;
1371
+ //wakeup-source;
13691372 };
13701373
13711374 //#include "lcd-lvds-21-1920-1080.dtsi"
longan/kernel/linux-4.9/arch/arm64/configs/sun50iw10p1smp_a133_android_defconfig
....@@ -347,6 +347,7 @@
347347 CONFIG_LIRC=y
348348 CONFIG_RC_DEVICES=y
349349 CONFIG_IR_SUNXI=y
350
+CONFIG_SUNXI_MULTI_IR_SUPPORT=y
350351 CONFIG_V4L_PLATFORM_DRIVERS=y
351352 CONFIG_VIDEO_SUNXI_VIN=m
352353 # CONFIG_CSI_CCI is not set
longan/kernel/linux-4.9/drivers/rtc/rtc-hym8563.c
....@@ -438,10 +438,10 @@
438438 {
439439 struct hym8563 *hym8563 = (struct hym8563 *)dev_id;
440440 struct i2c_client *client = hym8563->client;
441
- struct mutex *lock = &hym8563->rtc->ops_lock;
441
+ //struct mutex *lock = &hym8563->rtc->ops_lock;
442442 int data, ret;
443443
444
- mutex_lock(lock);
444
+ //mutex_lock(lock);
445445
446446 /* Clear the alarm flag */
447447
....@@ -461,7 +461,7 @@
461461 }
462462
463463 out:
464
- mutex_unlock(lock);
464
+ //mutex_unlock(lock);
465465 return IRQ_HANDLED;
466466 }
467467
....@@ -529,7 +529,13 @@
529529 {
530530 struct hym8563 *hym8563;
531531 int ret;
532
-
532
+ struct rtc_time tm = {
533
+ .tm_year = 2024 - 1900,
534
+ .tm_mon = 7,
535
+ .tm_mday = 23,
536
+ .tm_wday = 5,
537
+ .tm_hour = 13,
538
+ };
533539 hym8563 = devm_kzalloc(&client->dev, sizeof(*hym8563), GFP_KERNEL);
534540 if (!hym8563)
535541 return -ENOMEM;
....@@ -565,6 +571,10 @@
565571 hym8563->valid = !(ret & HYM8563_SEC_VL);
566572 dev_dbg(&client->dev, "rtc information is %s\n",
567573 hym8563->valid ? "valid" : "invalid");
574
+ if (!hym8563->valid) {
575
+ dev_err(&client->dev, "rtc use default time !!!\n");
576
+ hym8563_rtc_set_time(&client->dev, &tm);
577
+ }
568578
569579 hym8563->rtc = devm_rtc_device_register(&client->dev, client->name,
570580 &hym8563_rtc_ops, THIS_MODULE);