Compare commits
15 Commits
master
...
un_sdk_pat
Author | SHA1 | Date |
---|---|---|
|
5d8c4aded0 | |
|
b7a09ed8ad | |
|
b80eb8ffbb | |
|
f9e1e8ba00 | |
|
4696041eec | |
|
086acd270a | |
|
b7d111bd2c | |
|
3b0473e297 | |
|
4f3b47d955 | |
|
5e0a96de8e | |
|
8383510f4c | |
|
40835d83e5 | |
|
ead711e571 | |
|
64b2ea45ca | |
|
41d07b8ed7 |
|
@ -21,6 +21,9 @@ bitbake -c cleanall lk && bitbake lk -f
|
||||||
|
|
||||||
bitbake -c cleanall linux-mtk-extension && bitbake linux-mtk-extension -f
|
bitbake -c cleanall linux-mtk-extension && bitbake linux-mtk-extension -f
|
||||||
|
|
||||||
|
### compile linux kernel
|
||||||
|
bitbake linux-mtk-extension -c cleanall
|
||||||
|
|
||||||
### update
|
### update
|
||||||
|
|
||||||
use adb to update image
|
use adb to update image
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
DESCRIPTION = "config-app"
|
||||||
|
LICENSE = "MediaTekProprietary"
|
||||||
|
DEPENDS+="bluetooth openssl libev json-c alsa-lib curl"
|
||||||
|
APPS_SRC = "${TOPDIR}/../src/apps/aud-base/config_app"
|
||||||
|
|
||||||
|
inherit workonsrc systemd
|
||||||
|
|
||||||
|
WORKONSRC = "${APPS_SRC}"
|
||||||
|
|
||||||
|
SYSTEMD_PACKAGES = "${PN}"
|
||||||
|
SYSTEMD_SERVICE_${PN} = "config_app.service"
|
||||||
|
|
||||||
|
do_compile() {
|
||||||
|
echo "Print Env"
|
||||||
|
MULTI_CPU=-j7
|
||||||
|
echo ${TOPDIR}
|
||||||
|
echo ${COMBO_CHIP_ID}
|
||||||
|
echo ${MTK_PROJECT}
|
||||||
|
#cd ${S}/nvram_helper && make ${MULTI_CPU}
|
||||||
|
#sh ${S}/copy_include.sh ${TOPDIR} ${COMBO_CHIP_ID} ${MTK_PROJECT}
|
||||||
|
echo ${S}
|
||||||
|
#cd ${S}/AssistantCenter && make
|
||||||
|
#cd ${S}/daemon_light && make ${MULTI_CPU}
|
||||||
|
#cd ${S}/udp_server_test && make ${MULTI_CPU}
|
||||||
|
echo "fffffff"
|
||||||
|
#cd ${S} && make
|
||||||
|
#cd ${S}/nvram_helper && make ${MULTI_CPU}
|
||||||
|
}
|
||||||
|
|
||||||
|
do_install() {
|
||||||
|
install -d ${D}${bindir}
|
||||||
|
install -d ${D}${systemd_unitdir}/system
|
||||||
|
install -d ${D}/etc/config_app
|
||||||
|
install -d ${D}/data
|
||||||
|
install -d ${D}/data/dingdong
|
||||||
|
install -d ${D}/data/dingdong/etc
|
||||||
|
|
||||||
|
cp -a ${S}/data/etc/* ${D}/data/dingdong/etc/ #配置文件
|
||||||
|
cp -a ${S}/data/etc_ro/* ${D}/etc/config_app/
|
||||||
|
install -m 755 ${S}/AssistantCenter/dingdong-AssistantCenter ${D}${bindir}
|
||||||
|
install -m 755 ${S}/config_app ${D}${bindir}
|
||||||
|
install -m 755 ${S}/config_app.service ${D}${systemd_unitdir}/system
|
||||||
|
install -m 755 ${S}/daemon_light/daemon.bin ${D}${bindir}
|
||||||
|
#install -m 755 ${S}/udp_server_test/udp_server ${D}${bindir}
|
||||||
|
}
|
||||||
|
|
||||||
|
FILES_${PN} += "/etc /data/dingdong"
|
||||||
|
FILES_${PN} += "${systemd_unitdir}/system/config_app.service"
|
||||||
|
INSANE_SKIP_${PN} += "already-stripped ldflags"
|
||||||
|
FILES_${PN}-dev = ""
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF
|
||||||
|
ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6
|
||||||
|
b24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL
|
||||||
|
MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv
|
||||||
|
b3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJ4gHHKeNXj
|
||||||
|
ca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgHFzZM
|
||||||
|
9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qw
|
||||||
|
IFAGbHrQgLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6
|
||||||
|
VOujw5H5SNz/0egwLX0tdHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L
|
||||||
|
93FcXmn/6pUCyziKrlA4b9v7LWIbxcceVOF34GfID5yHI9Y/QCB/IIDEgEw+OyQm
|
||||||
|
jgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
|
||||||
|
AYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3DQEBCwUA
|
||||||
|
A4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDI
|
||||||
|
U5PMCCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUs
|
||||||
|
N+gDS63pYaACbvXy8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vv
|
||||||
|
o/ufQJVtMVT8QtPHRh8jrdkPSHCa2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU
|
||||||
|
5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2xJNDd2ZhwLnoQdeXeGADbkpy
|
||||||
|
rqXRfboQnoZsG4q5WTP468SQvvG5
|
||||||
|
-----END CERTIFICATE-----
|
|
@ -0,0 +1,31 @@
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwF
|
||||||
|
ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6
|
||||||
|
b24gUm9vdCBDQSAyMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTEL
|
||||||
|
MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv
|
||||||
|
b3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK2Wny2cSkxK
|
||||||
|
gXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4kHbZ
|
||||||
|
W0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg
|
||||||
|
1dKmSYXpN+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K
|
||||||
|
8nu+NQWpEjTj82R0Yiw9AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r
|
||||||
|
2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvdfLC6HM783k81ds8P+HgfajZRRidhW+me
|
||||||
|
z/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAExkv8LV/SasrlX6avvDXbR
|
||||||
|
8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSSbtqDT6Zj
|
||||||
|
mUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz
|
||||||
|
7Mt0Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6
|
||||||
|
+XUyo05f7O0oYtlNc/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI
|
||||||
|
0u1ufm8/0i2BWSlmy5A5lREedCf+3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMB
|
||||||
|
Af8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSwDPBMMPQFWAJI/TPlUq9LhONm
|
||||||
|
UjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oAA7CXDpO8Wqj2
|
||||||
|
LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
|
||||||
|
+gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kS
|
||||||
|
k5Nrp+gvU5LEYFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl
|
||||||
|
7uxMMne0nxrpS10gxdr9HIcWxkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygm
|
||||||
|
btmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQgj9sAq+uEjonljYE1x2igGOpm/Hl
|
||||||
|
urR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbWaQbLU8uz/mtBzUF+
|
||||||
|
fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoVYh63
|
||||||
|
n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE
|
||||||
|
76KlXIx3KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H
|
||||||
|
9jVlpNMKVv/1F2Rs76giJUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT
|
||||||
|
4PsJYGw=
|
||||||
|
-----END CERTIFICATE-----
|
|
@ -0,0 +1,12 @@
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5
|
||||||
|
MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g
|
||||||
|
Um9vdCBDQSAzMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG
|
||||||
|
A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg
|
||||||
|
Q0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZBf8ANm+gBG1bG8lKl
|
||||||
|
ui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjrZt6j
|
||||||
|
QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSr
|
||||||
|
ttvXBp43rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkr
|
||||||
|
BqWTrBqYaGFy+uGh0PsceGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteM
|
||||||
|
YyRIHN8wfdVoOw==
|
||||||
|
-----END CERTIFICATE-----
|
|
@ -0,0 +1,13 @@
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5
|
||||||
|
MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g
|
||||||
|
Um9vdCBDQSA0MB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG
|
||||||
|
A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg
|
||||||
|
Q0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN/sGKe0uoe0ZLY7Bi
|
||||||
|
9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri83Bk
|
||||||
|
M6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB
|
||||||
|
/zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WB
|
||||||
|
MAoGCCqGSM49BAMDA2gAMGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlw
|
||||||
|
CkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1AE47xDqUEpHJWEadIRNyp4iciuRMStuW
|
||||||
|
1KyLa2tJElMzrdfkviT8tQp21KW8EA==
|
||||||
|
-----END CERTIFICATE-----
|
|
@ -0,0 +1,24 @@
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMx
|
||||||
|
EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT
|
||||||
|
HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVs
|
||||||
|
ZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
|
||||||
|
MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNVBAYTAlVTMRAwDgYD
|
||||||
|
VQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFy
|
||||||
|
ZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2Vy
|
||||||
|
dmljZXMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
|
||||||
|
hvcNAQEBBQADggEPADCCAQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20p
|
||||||
|
OsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm2
|
||||||
|
8xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4PahHQUw2eeBGg6345AWh1K
|
||||||
|
Ts9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLPLJGmpufe
|
||||||
|
hRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk
|
||||||
|
6mFBrMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAw
|
||||||
|
DwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+q
|
||||||
|
AdcwKziIorhtSpzyEZGDMA0GCSqGSIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMI
|
||||||
|
bw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPPE95Dz+I0swSdHynVv/heyNXB
|
||||||
|
ve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTyxQGjhdByPq1z
|
||||||
|
qwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
|
||||||
|
iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn
|
||||||
|
0q23KXB56jzaYyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCN
|
||||||
|
sSi6
|
||||||
|
-----END CERTIFICATE-----
|
|
@ -14,6 +14,11 @@ SRC_URI_append = " \
|
||||||
file://ring_buf.patch \
|
file://ring_buf.patch \
|
||||||
file://echo.patch \
|
file://echo.patch \
|
||||||
file://syslog.conf \
|
file://syslog.conf \
|
||||||
|
file://ssl/AmazonRootCA1.pem \
|
||||||
|
file://ssl/AmazonRootCA2.pem \
|
||||||
|
file://ssl/AmazonRootCA3.pem \
|
||||||
|
file://ssl/AmazonRootCA4.pem \
|
||||||
|
file://ssl/SFSRootCAG2.pem \
|
||||||
"
|
"
|
||||||
|
|
||||||
inherit systemd
|
inherit systemd
|
||||||
|
@ -24,6 +29,7 @@ FILES_${PN}-syslog_append = " ${systemd_unitdir}/system/busybox-syslog.service \
|
||||||
"
|
"
|
||||||
|
|
||||||
do_install_append() {
|
do_install_append() {
|
||||||
|
install -d ${D}${sysconfdir}/ssl/certs
|
||||||
cp ${WORKDIR}/syslogctl ${D}/bin/syslogctl
|
cp ${WORKDIR}/syslogctl ${D}/bin/syslogctl
|
||||||
cp ${WORKDIR}/mdlogctl ${D}/bin/mdlogctl
|
cp ${WORKDIR}/mdlogctl ${D}/bin/mdlogctl
|
||||||
cp ${WORKDIR}/syslog-start ${D}/bin/syslog-start
|
cp ${WORKDIR}/syslog-start ${D}/bin/syslog-start
|
||||||
|
@ -34,6 +40,11 @@ do_install_append() {
|
||||||
install -d ${D}${sysconfdir}/systemd/system
|
install -d ${D}${sysconfdir}/systemd/system
|
||||||
install -d ${D}${sysconfdir}/systemd/system/multi-user.target.wants
|
install -d ${D}${sysconfdir}/systemd/system/multi-user.target.wants
|
||||||
install -m 0644 ${WORKDIR}/tcpdump.service.in ${D}${systemd_unitdir}/system/tcpdump.service
|
install -m 0644 ${WORKDIR}/tcpdump.service.in ${D}${systemd_unitdir}/system/tcpdump.service
|
||||||
|
install -m 0644 ${WORKDIR}/ssl/AmazonRootCA1.pem ${D}${sysconfdir}/ssl/certs/AmazonRootCA1.pem
|
||||||
|
install -m 0644 ${WORKDIR}/ssl/AmazonRootCA2.pem ${D}${sysconfdir}/ssl/certs/AmazonRootCA2.pem
|
||||||
|
install -m 0644 ${WORKDIR}/ssl/AmazonRootCA3.pem ${D}${sysconfdir}/ssl/certs/AmazonRootCA3.pem
|
||||||
|
install -m 0644 ${WORKDIR}/ssl/AmazonRootCA4.pem ${D}${sysconfdir}/ssl/certs/AmazonRootCA4.pem
|
||||||
|
install -m 0644 ${WORKDIR}/ssl/SFSRootCAG2.pem ${D}${sysconfdir}/ssl/certs/SFSRootCAG2.pem
|
||||||
ln -sf ${systemd_unitdir}/system/busybox-syslog.service ${D}${sysconfdir}/systemd/system/syslog.service
|
ln -sf ${systemd_unitdir}/system/busybox-syslog.service ${D}${sysconfdir}/systemd/system/syslog.service
|
||||||
ln -sf ${systemd_unitdir}/system/busybox-syslog.service ${D}${sysconfdir}/systemd/system/multi-user.target.wants/busybox-syslog.service
|
ln -sf ${systemd_unitdir}/system/busybox-syslog.service ${D}${sysconfdir}/systemd/system/multi-user.target.wants/busybox-syslog.service
|
||||||
ln -sf ${systemd_unitdir}/system/busybox-klogd.service ${D}${sysconfdir}/systemd/system/multi-user.target.wants/busybox-klogd.service
|
ln -sf ${systemd_unitdir}/system/busybox-klogd.service ${D}${sysconfdir}/systemd/system/multi-user.target.wants/busybox-klogd.service
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
From a4ed9fc8da720585f853d2ca6ffd30e2fa4d1247 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Trevor Gamblin <trevor.gamblin@windriver.com>
|
||||||
|
Date: Wed, 9 Mar 2022 12:50:39 -0500
|
||||||
|
Subject: [PATCH] Makefile.am: do not install /etc/ethertypes
|
||||||
|
|
||||||
|
The /etc/ethertypes is provided by netbase since 6.0[1].
|
||||||
|
Do not instal the file in ebtables, otherwise there would be a conflict:
|
||||||
|
Error: Transaction test error:
|
||||||
|
file /etc/ethertypes conflicts between attempted installs of
|
||||||
|
netbase-1:6.2-r0.corei7_64 and iptables-1.8.7-r0.corei7_64
|
||||||
|
|
||||||
|
[1]
|
||||||
|
https://salsa.debian.org/md/netbase/-/commit/316680c6a2c3641b6abc76b3eebf88781f609d35)
|
||||||
|
|
||||||
|
This patch is based off of the same change made for the ebtables recipe:
|
||||||
|
|
||||||
|
http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-filter/ebtables/ebtables-2.0.11/0001-Makefile.am-do-not-install-etc-ethertypes.patch?h=master
|
||||||
|
|
||||||
|
Upstream-Status: Inappropriate [embedded specific]
|
||||||
|
|
||||||
|
Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com>
|
||||||
|
---
|
||||||
|
Makefile.am | 1 -
|
||||||
|
1 file changed, 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile.am b/Makefile.am
|
||||||
|
index 799bf8b8..2eb1843f 100644
|
||||||
|
--- a/Makefile.am
|
||||||
|
+++ b/Makefile.am
|
||||||
|
@@ -18,7 +18,6 @@ SUBDIRS += iptables
|
||||||
|
|
||||||
|
if ENABLE_NFTABLES
|
||||||
|
confdir = $(sysconfdir)
|
||||||
|
-dist_conf_DATA = etc/ethertypes
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: tarball
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
From c46db7c2e1f63ec525835553587e70c635565310 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Maxin B. John" <maxin.john@intel.com>
|
||||||
|
Date: Tue, 21 Feb 2017 11:16:31 +0200
|
||||||
|
Subject: [PATCH] configure: Add option to enable/disable libnfnetlink
|
||||||
|
|
||||||
|
This changes the configure behaviour from autodetecting
|
||||||
|
for libnfnetlink to having an option to disable it explicitly
|
||||||
|
|
||||||
|
Upstream-Status: Pending
|
||||||
|
|
||||||
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||||
|
Signed-off-by: Maxin B. John <maxin.john@intel.com>
|
||||||
|
---
|
||||||
|
configure.ac | 10 +++++++---
|
||||||
|
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index eda7871..03ddc50 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -63,6 +63,9 @@ AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH],
|
||||||
|
AC_ARG_ENABLE([nftables],
|
||||||
|
AS_HELP_STRING([--disable-nftables], [Do not build nftables compat]),
|
||||||
|
[enable_nftables="$enableval"], [enable_nftables="yes"])
|
||||||
|
+AC_ARG_ENABLE([libnfnetlink],
|
||||||
|
+ AS_HELP_STRING([--disable-libnfnetlink], [Do not use netfilter netlink library]),
|
||||||
|
+ [enable_libnfnetlink="$enableval"], [enable_libnfnetlink="yes"])
|
||||||
|
AC_ARG_ENABLE([connlabel],
|
||||||
|
AS_HELP_STRING([--disable-connlabel],
|
||||||
|
[Do not build libnetfilter_conntrack]),
|
||||||
|
@@ -115,9 +118,10 @@ if test "x$enable_bpfc" = "xyes" || test "x$enable_nfsynproxy" = "xyes"; then
|
||||||
|
AC_CHECK_LIB(pcap, pcap_compile,, AC_MSG_ERROR(missing libpcap library required by bpf compiler or nfsynproxy tool))
|
||||||
|
fi
|
||||||
|
|
||||||
|
-PKG_CHECK_MODULES([libnfnetlink], [libnfnetlink >= 1.0],
|
||||||
|
- [nfnetlink=1], [nfnetlink=0])
|
||||||
|
-AM_CONDITIONAL([HAVE_LIBNFNETLINK], [test "$nfnetlink" = 1])
|
||||||
|
+AS_IF([test "x$enable_libnfnetlink" = "xyes"], [
|
||||||
|
+ PKG_CHECK_MODULES([libnfnetlink], [libnfnetlink >= 1.0])
|
||||||
|
+ ])
|
||||||
|
+AM_CONDITIONAL([HAVE_LIBNFNETLINK], [test "x$enable_libnfnetlink" = "xyes"])
|
||||||
|
|
||||||
|
if test "x$enable_nftables" = "xyes"; then
|
||||||
|
PKG_CHECK_MODULES([libmnl], [libmnl >= 1.0], [mnl=1], [mnl=0])
|
||||||
|
--
|
||||||
|
2.4.0
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
From 26090b3dbcdf6a11e60535da949b726a6e86426d Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Maxin B. John" <maxin.john@intel.com>
|
||||||
|
Date: Tue, 21 Feb 2017 11:49:07 +0200
|
||||||
|
Subject: [PATCH] configure.ac:
|
||||||
|
only-check-conntrack-when-libnfnetlink-enabled.patch
|
||||||
|
|
||||||
|
Package libnetfilter-conntrack depends on package libnfnetlink. iptables
|
||||||
|
checks package libnetfilter-conntrack whatever its package config
|
||||||
|
libnfnetlink is enabled or not. When libnfnetlink is disabled but
|
||||||
|
package libnetfilter-conntrack exists, it fails randomly with:
|
||||||
|
|
||||||
|
In file included from
|
||||||
|
.../iptables/1.4.21-r0/iptables-1.4.21/extensions/libxt_connlabel.c:8:0:
|
||||||
|
|
||||||
|
.../tmp/sysroots/qemumips/usr/include/libnetfilter_conntrack/libnetfilter_conntrack.h:14:42:
|
||||||
|
fatal error: libnfnetlink/linux_nfnetlink.h: No such file or directory
|
||||||
|
|
||||||
|
compilation terminated.
|
||||||
|
GNUmakefile:96: recipe for target 'libxt_connlabel.oo' failed
|
||||||
|
Only check libnetfilter-conntrack when libnfnetlink is enabled to fix it.
|
||||||
|
|
||||||
|
Upstream-Status: Pending
|
||||||
|
|
||||||
|
Signed-off-by: Kai Kang <kai.kang@windriver.com>
|
||||||
|
Signed-off-by: Maxin B. John <maxin.john@intel.com>
|
||||||
|
---
|
||||||
|
configure.ac | 6 ++++--
|
||||||
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index 03ddc50..523caea 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -172,10 +172,12 @@ if test "$nftables" != 1; then
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$enable_connlabel" = "xyes"; then
|
||||||
|
- PKG_CHECK_MODULES([libnetfilter_conntrack],
|
||||||
|
+ nfconntrack=0
|
||||||
|
+ AS_IF([test "x$enable_libnfnetlink" = "xyes"], [
|
||||||
|
+ PKG_CHECK_MODULES([libnetfilter_conntrack],
|
||||||
|
[libnetfilter_conntrack >= 1.0.6],
|
||||||
|
[nfconntrack=1], [nfconntrack=0])
|
||||||
|
-
|
||||||
|
+ ])
|
||||||
|
if test "$nfconntrack" -ne 1; then
|
||||||
|
blacklist_modules="$blacklist_modules connlabel";
|
||||||
|
echo "WARNING: libnetfilter_conntrack not found, connlabel match will not be built";
|
||||||
|
--
|
||||||
|
2.4.0
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
[Unit]
|
||||||
|
Description=IPv6 Packet Filtering Framework
|
||||||
|
Before=network-pre.target
|
||||||
|
Wants=network-pre.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=@SBINDIR@/ip6tables-restore -w -- @RULESDIR@/ip6tables.rules
|
||||||
|
ExecReload=@SBINDIR@/ip6tables-restore -w -- @RULESDIR@/ip6tables.rules
|
||||||
|
RemainAfterExit=yes
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Generated by iptables-save v1.8.7 on Tue Jul 12 01:22:18 2022
|
||||||
|
*raw
|
||||||
|
:PREROUTING ACCEPT [0:0]
|
||||||
|
:OUTPUT ACCEPT [0:0]
|
||||||
|
COMMIT
|
||||||
|
# Completed on Tue Jul 12 01:22:18 2022
|
||||||
|
# Generated by iptables-save v1.8.7 on Tue Jul 12 01:22:18 2022
|
||||||
|
*mangle
|
||||||
|
:PREROUTING ACCEPT [0:0]
|
||||||
|
:INPUT ACCEPT [0:0]
|
||||||
|
:FORWARD ACCEPT [0:0]
|
||||||
|
:OUTPUT ACCEPT [0:0]
|
||||||
|
:POSTROUTING ACCEPT [0:0]
|
||||||
|
COMMIT
|
||||||
|
# Completed on Tue Jul 12 01:22:18 2022
|
||||||
|
# Generated by iptables-save v1.8.7 on Tue Jul 12 01:22:18 2022
|
||||||
|
*filter
|
||||||
|
:INPUT DROP [0:0]
|
||||||
|
:FORWARD DROP [0:0]
|
||||||
|
:OUTPUT ACCEPT [0:0]
|
||||||
|
-A INPUT -i lo -j ACCEPT
|
||||||
|
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
|
||||||
|
-A INPUT -p tcp -m tcp --dport 2017 -j ACCEPT
|
||||||
|
-A INPUT -p udp -m udp --dport 2345 -j ACCEPT
|
||||||
|
-A INPUT -p udp -m udp --dport 22655 -j ACCEPT
|
||||||
|
-A OUTPUT -j ACCEPT
|
||||||
|
COMMIT
|
||||||
|
# Completed on Tue Jul 12 01:22:18 2022
|
|
@ -0,0 +1,13 @@
|
||||||
|
[Unit]
|
||||||
|
Description=IPv4 Packet Filtering Framework
|
||||||
|
Before=network-pre.target
|
||||||
|
Wants=network-pre.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/sbin/iptables-restore < /etc/iptables.rules
|
||||||
|
ExecReload=/usr/sbin/iptables-restore < /etc/iptables.rules
|
||||||
|
RemainAfterExit=yes
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -0,0 +1,52 @@
|
||||||
|
SUMMARY = "Tools for managing kernel packet filtering capabilities"
|
||||||
|
DESCRIPTION = "iptables is the userspace command line program used to configure and control network packet \
|
||||||
|
filtering code in Linux."
|
||||||
|
HOMEPAGE = "http://www.netfilter.org/"
|
||||||
|
BUGTRACKER = "http://bugzilla.netfilter.org/"
|
||||||
|
LICENSE = "GPL-2.0-or-later"
|
||||||
|
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
|
||||||
|
file://iptables/iptables.c;beginline=13;endline=25;md5=c5cffd09974558cf27d0f763df2a12dc \
|
||||||
|
"
|
||||||
|
|
||||||
|
SRC_URI = "http://netfilter.org/projects/iptables/files/iptables-${PV}.tar.bz2 \
|
||||||
|
file://0001-configure-Add-option-to-enable-disable-libnfnetlink.patch \
|
||||||
|
file://0001-Makefile.am-do-not-install-etc-ethertypes.patch \
|
||||||
|
file://0002-configure.ac-only-check-conntrack-when-libnfnetlink-enabled.patch \
|
||||||
|
file://iptables.service \
|
||||||
|
file://iptables.rules \
|
||||||
|
file://ip6tables.service \
|
||||||
|
file://ip6tables.rules \
|
||||||
|
"
|
||||||
|
SRC_URI[sha256sum] = "c109c96bb04998cd44156622d36f8e04b140701ec60531a10668cfdff5e8d8f0"
|
||||||
|
|
||||||
|
inherit autotools pkgconfig
|
||||||
|
|
||||||
|
EXTRA_OECONF = "--with-kernel=${STAGING_INCDIR} \
|
||||||
|
--disable-ipv6 \
|
||||||
|
"
|
||||||
|
PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'ipv6', '', d)} \
|
||||||
|
"
|
||||||
|
|
||||||
|
PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
|
||||||
|
|
||||||
|
# libnfnetlink recipe is in meta-networking layer
|
||||||
|
PACKAGECONFIG[libnfnetlink] = "--enable-libnfnetlink,--disable-libnfnetlink,libnfnetlink libnetfilter-conntrack"
|
||||||
|
|
||||||
|
# libnftnl recipe is in meta-networking layer(previously known as libnftables)
|
||||||
|
PACKAGECONFIG[libnftnl] = "--enable-nftables,--disable-nftables,libnftnl"
|
||||||
|
|
||||||
|
do_configure_prepend() {
|
||||||
|
# Remove some libtool m4 files
|
||||||
|
# Keep ax_check_linker_flags.m4 which belongs to autoconf-archive.
|
||||||
|
rm -f libtool.m4 lt~obsolete.m4 ltoptions.m4 ltsugar.m4 ltversion.m4
|
||||||
|
}
|
||||||
|
|
||||||
|
do_install_append() {
|
||||||
|
install -d ${D}${sysconfdir}/
|
||||||
|
install -d ${D}${sysconfdir}/systemd/system/
|
||||||
|
install -m 0644 ${WORKDIR}/iptables.rules ${D}${sysconfdir}/iptables.rules
|
||||||
|
install -m 0644 ${WORKDIR}/iptables.service ${D}${sysconfdir}/systemd/system/iptables.service
|
||||||
|
}
|
||||||
|
|
||||||
|
FILES_${PN} += "${libdir}/xtables/*"
|
||||||
|
INSANE_SKIP_${PN} = "dev-so"
|
|
@ -63,7 +63,7 @@ VERIFIED_KEY = "verified_key_doctor"
|
||||||
MTEE_KEY = "mtee_key"
|
MTEE_KEY = "mtee_key"
|
||||||
FORCE_DISABLE_DM_VERITY = "yes"
|
FORCE_DISABLE_DM_VERITY = "yes"
|
||||||
FORCE_DISABLE_TEE_ENCRYPTION = "yes"
|
FORCE_DISABLE_TEE_ENCRYPTION = "yes"
|
||||||
ENABLE_MTD_VERITY = "yes"
|
ENABLE_MTD_VERITY = "no"
|
||||||
|
|
||||||
# Trustzone
|
# Trustzone
|
||||||
TZ_PROJECT = "aud8516"
|
TZ_PROJECT = "aud8516"
|
||||||
|
|
|
@ -11,17 +11,12 @@ inherit mkusrdata
|
||||||
inherit pack-update-zip
|
inherit pack-update-zip
|
||||||
#inherit extrausers
|
#inherit extrausers
|
||||||
|
|
||||||
EXTRA_USERS_PARAMS = "usermod -p $(openssl passwd avs123!@#) root;"
|
|
||||||
EXTRA_USERS_PARAMS += "useradd -P $(openssl passwd avs123!@#) aud8516;"
|
|
||||||
|
|
||||||
CORE_IMAGE_EXTRA_INSTALL += " \
|
CORE_IMAGE_EXTRA_INSTALL += " \
|
||||||
packagegroup-mtk-upgrade-kit-native \
|
packagegroup-mtk-upgrade-kit-native \
|
||||||
${@base_contains('LICENSE_FLAGS_GMRENDER', 'yes', 'packagegroup-mtk-gstreamer1.0', '' ,d)} \
|
${@base_contains('LICENSE_FLAGS_GMRENDER', 'yes', 'packagegroup-mtk-gstreamer1.0', '' ,d)} \
|
||||||
"
|
"
|
||||||
|
|
||||||
IMAGE_INSTALL_append = " \
|
IMAGE_INSTALL_append = " \
|
||||||
${@base_contains('LICENSE_FLAGS_FFMPEG', 'yes', 'ffmpeg', '' ,d)} \
|
|
||||||
${@base_contains('LICENSE_FLAGS_AISPEECH', 'yes', 'aispeech', '' ,d)} \
|
|
||||||
${@base_contains('LICENSE_FLAGS_GMRENDER', 'yes', 'gmediarender', '' ,d)} \
|
${@base_contains('LICENSE_FLAGS_GMRENDER', 'yes', 'gmediarender', '' ,d)} \
|
||||||
${@base_contains('LICENSE_FLAGS_BLUEZ', 'yes', 'bluez5', 'bluetooth' ,d)} \
|
${@base_contains('LICENSE_FLAGS_BLUEZ', 'yes', 'bluez5', 'bluetooth' ,d)} \
|
||||||
openssl \
|
openssl \
|
||||||
|
@ -36,6 +31,7 @@ IMAGE_INSTALL_append = " \
|
||||||
prog \
|
prog \
|
||||||
ntpdate \
|
ntpdate \
|
||||||
appmainprog \
|
appmainprog \
|
||||||
|
config-app \
|
||||||
mic-asp \
|
mic-asp \
|
||||||
ppc \
|
ppc \
|
||||||
ppccli \
|
ppccli \
|
||||||
|
@ -83,6 +79,8 @@ IMAGE_INSTALL_append = " \
|
||||||
libgcrypt \
|
libgcrypt \
|
||||||
zeromq \
|
zeromq \
|
||||||
json-c \
|
json-c \
|
||||||
|
libev \
|
||||||
|
iptables \
|
||||||
"
|
"
|
||||||
|
|
||||||
install_proc() {
|
install_proc() {
|
||||||
|
@ -94,7 +92,7 @@ install_proc() {
|
||||||
cd ${IMAGE_ROOTFS}/bin
|
cd ${IMAGE_ROOTFS}/bin
|
||||||
rm -rf `ls systemd*|egrep -v systemd-firstboot`
|
rm -rf `ls systemd*|egrep -v systemd-firstboot`
|
||||||
rm -rf hostname.coreutils journalctl
|
rm -rf hostname.coreutils journalctl
|
||||||
rm -rf loginctl login.shadow
|
rm -rf loginctl
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
cd ${IMAGE_ROOTFS}/usr/sbin
|
cd ${IMAGE_ROOTFS}/usr/sbin
|
||||||
|
@ -107,7 +105,7 @@ install_proc() {
|
||||||
rm -rf openssl curl ffmpeg ffserver btmw-test mas_test2 pcm_merge_test mas_test btmw-rpc-test wifitesttool data_send2
|
rm -rf openssl curl ffmpeg ffserver btmw-test mas_test2 pcm_merge_test mas_test btmw-rpc-test wifitesttool data_send2
|
||||||
rm -rf dingdong-AssistantCenter alsamixer base64 basename bashbug boots* bt-dbg btut
|
rm -rf dingdong-AssistantCenter alsamixer base64 basename bashbug boots* bt-dbg btut
|
||||||
rm -rf chgrp chown chfn* cksum comm c_rehash csplit dir* expand expiry faillog fmt fold gpasswd groups*
|
rm -rf chgrp chown chfn* cksum comm c_rehash csplit dir* expand expiry faillog fmt fold gpasswd groups*
|
||||||
rm -rf hostid id install join lastlog lbracket* logname md5sum nettle* new* nice nl od passwd* paste pathchk
|
rm -rf hostid id install join lastlog lbracket* logname md5sum nettle* new* nice nl od paste pathchk
|
||||||
rm -rf pinky pkcs1-conv pr ptx sexp-conv sha* shred shuf sum
|
rm -rf pinky pkcs1-conv pr ptx sexp-conv sha* shred shuf sum
|
||||||
rm -rf systemd-* timedatectl
|
rm -rf systemd-* timedatectl
|
||||||
rm -rf tac vdir uptime.coreutils users utf_gbk
|
rm -rf tac vdir uptime.coreutils users utf_gbk
|
||||||
|
|
|
@ -8,6 +8,7 @@ CONFIG_DELGROUP=y
|
||||||
CONFIG_GETTY=y
|
CONFIG_GETTY=y
|
||||||
CONFIG_LOGIN=y
|
CONFIG_LOGIN=y
|
||||||
CONFIG_PASSWD=y
|
CONFIG_PASSWD=y
|
||||||
CONFIG_SU=y
|
CONFIG_CHPASSWD=y
|
||||||
|
#CONFIG_SU=y
|
||||||
CONFIG_SULOGIN=y
|
CONFIG_SULOGIN=y
|
||||||
CONFIG_VLOCK=y
|
CONFIG_VLOCK=y
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1 +1 @@
|
||||||
1.0.2.246
|
1.0.1.001
|
||||||
|
|
|
@ -29,3 +29,20 @@ getcurrentvboxstate
|
||||||
config_app启动后的log实时保存在/tmp/config.log可实时查看
|
config_app启动后的log实时保存在/tmp/config.log可实时查看
|
||||||
配网成功后信息会写入/data/dingdong/etc/appconfig.json
|
配网成功后信息会写入/data/dingdong/etc/appconfig.json
|
||||||
若想清除配网信息重新配网,删掉/data/dingdong/etc/appconfig*即可
|
若想清除配网信息重新配网,删掉/data/dingdong/etc/appconfig*即可
|
||||||
|
|
||||||
|
|
||||||
|
###OTA
|
||||||
|
需要写入key数据后重启才可验证
|
||||||
|
##path:tool/nvram_helper.bin
|
||||||
|
|
||||||
|
1:adb push nvram_helper.bin /tmp/
|
||||||
|
2:write key:
|
||||||
|
dev1:
|
||||||
|
adb shell /tmp/nvram_helper.bin -w robosen RBS1234567890124,FC:A4:7A:E0:4E:73,FC:A4:7A:E0:4E:74,66d79ee5-e553-4615-b03c-ac013fb58a56,35e6d575-e607-43ed-a26b-6d56fdf9a46acbc9bf46-c3ca-48d2-98aa-d91d9d6142c0
|
||||||
|
dev2:
|
||||||
|
adb shell /tmp/nvram_helper.bin -w robosen RBS1234567890125,FC:A4:7A:E0:4E:74,FC:A4:7A:E0:4E:75,abad1041-8723-4baf-af6f-8f68c7b5689d,3db4d740-356f-46a8-b122-7cb016a1039ec678e9dd-6092-4bb1-8a43-1d87d7b3b2ab
|
||||||
|
dev3:
|
||||||
|
adb shell /tmp/nvram_helper.bin -w robosen RBS1234567890126,FC:A4:7A:E0:4E:75,FC:A4:7A:E0:4E:76,dea3057f-6f11-480d-a937-a9f3a11cfad8,fb6212be-1155-4629-a158-ae33fe72736e33ccb202-4339-4cd5-8bb5-092dbedf4b82
|
||||||
|
dev4:
|
||||||
|
adb shell /tmp/nvram_helper.bin -w robosen RBS1234567890127,FC:A4:7A:E0:4E:76,FC:A4:7A:E0:4E:77,80a7aae0-bc18-4774-8e38-d53738497b8e,ebd83f2f-7bd0-4f14-9e34-30c931f2cbdd95e0cc43-7649-43b8-82d5-1a49f6a522a5
|
||||||
|
3:reboot
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# start appmainprog
|
# start appmainprog
|
||||||
|
echo 2 > /proc/sys/kernel/randomize_va_space
|
||||||
|
# /usr/sbin/iptables-restore < /etc/iptables.rules
|
||||||
echo auostart appmainprog
|
echo auostart appmainprog
|
||||||
hwclock -w
|
hwclock -w
|
||||||
/usr/bin/appmainprog
|
/usr/bin/appmainprog
|
||||||
|
|
||||||
|
|
109
src/kernel/linux/v4.4/arch/arm64/boot/dts/mediatek/aud8516p1v2_consys_slc_128_yocto.dts
Executable file → Normal file
109
src/kernel/linux/v4.4/arch/arm64/boot/dts/mediatek/aud8516p1v2_consys_slc_128_yocto.dts
Executable file → Normal file
|
@ -229,7 +229,7 @@
|
||||||
mediatek,connectivity-combo {
|
mediatek,connectivity-combo {
|
||||||
compatible = "mediatek,connectivity-combo";
|
compatible = "mediatek,connectivity-combo";
|
||||||
//gpio_combo_pmu_en_pin = <&pio 48 0>; /* GPIO_COMBO_PMU_EN_PIN */
|
//gpio_combo_pmu_en_pin = <&pio 48 0>; /* GPIO_COMBO_PMU_EN_PIN */
|
||||||
gpio_combo_rst_pin = <&pio 18 0>; /* GPIO_COMBO_RST_PIN pin */
|
gpio_combo_rst_pin = <&pio 20 0>; /* GPIO_COMBO_RST_PIN pin */
|
||||||
gpio_wifi_eint_pin = <&pio 20 0>; /* GPIO_WIFI_EINT_PIN */
|
gpio_wifi_eint_pin = <&pio 20 0>; /* GPIO_WIFI_EINT_PIN */
|
||||||
gpio_gps_sync_pin = <&pio 4 0>; /* GPIO_GPS_SYNC_PIN */
|
gpio_gps_sync_pin = <&pio 4 0>; /* GPIO_GPS_SYNC_PIN */
|
||||||
/*gpio_gps_lna_pin = <&pio 3 0>;*/ /* GPIO_GPS_LNA_PIN */
|
/*gpio_gps_lna_pin = <&pio 3 0>;*/ /* GPIO_GPS_LNA_PIN */
|
||||||
|
@ -273,20 +273,16 @@
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};*/
|
};*/
|
||||||
|
|
||||||
|
feier_gpioint {
|
||||||
};
|
compatible = "mediatek,feier_gpioint";
|
||||||
&spi {
|
interrupts-extended = <&pio 3 IRQ_TYPE_LEVEL_LOW>,
|
||||||
pinctrl-names = "default";
|
<&pio 0 IRQ_TYPE_LEVEL_LOW>;
|
||||||
pinctrl-0 = <&spi_pins_0>;
|
charge_en = <&pio 1 0>;
|
||||||
|
touch-debounce = <20>;
|
||||||
status = "okay";
|
status = "okay";
|
||||||
spidev: spidev@0 {
|
|
||||||
compatible = "st7789v";
|
|
||||||
reg = <0>;
|
|
||||||
reset_gpio = <&pio 11 0>;
|
|
||||||
wr_sel_gpio = <&pio 10 0>;
|
|
||||||
spi-max-frequency = <40000000>;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
&accdet {
|
&accdet {
|
||||||
interrupts-extended = <&sysirq GIC_SPI 152 IRQ_TYPE_LEVEL_LOW>;
|
interrupts-extended = <&sysirq GIC_SPI 152 IRQ_TYPE_LEVEL_LOW>;
|
||||||
// <&pio 0 IRQ_TYPE_LEVEL_HIGH>;
|
// <&pio 0 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
@ -317,11 +313,6 @@
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
&bat_comm {
|
|
||||||
//interrupt-parent = <&pmic>;
|
|
||||||
//interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
|
|
||||||
interrupts-extended = <&pio 0 IRQ_TYPE_LEVEL_LOW>;
|
|
||||||
};
|
|
||||||
|
|
||||||
&consys {
|
&consys {
|
||||||
pinctrl-names = "default", "gps_lna_state_init", "gps_lna_state_oh", "gps_lna_state_ol";
|
pinctrl-names = "default", "gps_lna_state_init", "gps_lna_state_oh", "gps_lna_state_ol";
|
||||||
|
@ -421,11 +412,7 @@
|
||||||
regulator-always-on;
|
regulator-always-on;
|
||||||
vsel-gpio = <&pio 34 0>;
|
vsel-gpio = <&pio 34 0>;
|
||||||
};
|
};
|
||||||
SGM41511@6B{
|
|
||||||
compatible = "SG,SGM41511-charger";
|
|
||||||
reg = <0x6B>;
|
|
||||||
ce-gpio = <&pio 1 0>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*<zhongjinrong added for led driver begin*/
|
/*<zhongjinrong added for led driver begin*/
|
||||||
/*
|
/*
|
||||||
|
@ -437,29 +424,45 @@
|
||||||
*/
|
*/
|
||||||
/*zhongjinrong added for led driver end >*/
|
/*zhongjinrong added for led driver end >*/
|
||||||
|
|
||||||
aw20036_led@3a {
|
aw20036_led: aw20036_led@3a {
|
||||||
compatible = "awinic,aw20036_led";
|
compatible = "awinic,aw20036_led";
|
||||||
reg = <0x3a>;
|
reg = <0x3a>;
|
||||||
reset-gpio = <&pio 7 0>;
|
reset-gpio = <&pio 7 0>;
|
||||||
irq-gpio = <&pio 6 0>;
|
imax = <5>; /* 80mA */
|
||||||
|
max-brightness = <255>;
|
||||||
|
brightness = <80>;
|
||||||
|
gamma-table = <
|
||||||
|
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
|
0 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2
|
||||||
|
2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5
|
||||||
|
5 6 6 6 7 7 7 7 8 8 8 9 9 10 10 10
|
||||||
|
11 11 11 12 12 13 13 13 14 14 15 15 16 16 17 17
|
||||||
|
18 18 19 19 20 20 21 21 22 23 23 24 24 25 26 26
|
||||||
|
27 28 28 29 30 30 31 32 32 33 34 35 35 36 37 38
|
||||||
|
38 39 40 41 42 42 43 44 45 46 47 48 49 49 50 51
|
||||||
|
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
||||||
|
69 70 71 72 73 74 75 76 78 79 80 81 82 84 85 86
|
||||||
|
87 89 90 91 92 94 95 96 98 99 100 102 103 104 106 107
|
||||||
|
109 110 112 113 114 116 117 119 120 122 123 125 126 128 130 131
|
||||||
|
133 134 136 138 139 141 143 144 146 148 149 151 153 154 156 158
|
||||||
|
160 161 163 165 167 169 170 172 174 176 178 180 182 183 185 187
|
||||||
|
189 191 193 195 197 199 201 203 205 207 209 211 213 215 218 220
|
||||||
|
222 224 226 228 230 233 235 237 239 241 244 246 248 250 253 255
|
||||||
|
>;
|
||||||
|
brightness-levels = <
|
||||||
|
0 40 42 44 46 48 50 52 54 56
|
||||||
|
58 60 62 64 66 68 70 72 74 76
|
||||||
|
78 80 82 84 86 88 90 92 94 98
|
||||||
|
100 102 104 106 108 110 112 114 116 118
|
||||||
|
120 122 124 126 128 130 132 134 136 138
|
||||||
|
140 142 144 146 148 150 152 154 156 158
|
||||||
|
160 162 164 166 168 170 172 174 176 178
|
||||||
|
180 182 184 186 188 190 192 194 196 198
|
||||||
|
200 202 204 206 208 210 212 214 216 218
|
||||||
|
220 222 224 226 228 230 232 234 236 238
|
||||||
|
255>;
|
||||||
|
default-brightness-level = <100>;
|
||||||
status = "okay";
|
status = "okay";
|
||||||
aw20036,led {
|
|
||||||
aw20036,name = "aw20036_led";
|
|
||||||
aw20036,imax = <1>;
|
|
||||||
aw20036,brightness = <128>;
|
|
||||||
aw20036,max_brightness = <255>;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
cht8305_dev@38 {
|
|
||||||
compatible = "sensylink,cht8305_dev";
|
|
||||||
reg = <0x40>;
|
|
||||||
status = "ok";
|
|
||||||
};
|
|
||||||
cw2015_dev@62 {
|
|
||||||
/*compatible = "cellwise,cw2015_dev";*/
|
|
||||||
compatible = "cellwise,cw2015";
|
|
||||||
reg = <0x62>;
|
|
||||||
status = "ok";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -473,8 +476,8 @@
|
||||||
tlv320aic:tlv320aic@18 {
|
tlv320aic:tlv320aic@18 {
|
||||||
compatible = "mediatek,tlv320aic";
|
compatible = "mediatek,tlv320aic";
|
||||||
reg = <0x18>;
|
reg = <0x18>;
|
||||||
rst-gpio = <&pio 24 0>;
|
/* rst-gpio = <&pio 24 0>;
|
||||||
/* pdn-gpio = <&pio 2 0 >;
|
pdn-gpio = <&pio 2 0 >;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -484,11 +487,6 @@
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
&irrx {
|
|
||||||
pinctrl-names = "default";
|
|
||||||
pinctrl-0 = <&irrx_pins_ir_input>;
|
|
||||||
status = "okay";
|
|
||||||
};
|
|
||||||
|
|
||||||
&keypad {
|
&keypad {
|
||||||
pinctrl-names = "default";
|
pinctrl-names = "default";
|
||||||
|
@ -583,7 +581,7 @@
|
||||||
|
|
||||||
pwm_goio_def_cfg: pwmdefault {
|
pwm_goio_def_cfg: pwmdefault {
|
||||||
pins_cmd_dat {
|
pins_cmd_dat {
|
||||||
pinmux = <MT8167_PIN_12_EINT12__FUNC_PWM_A>;
|
pinmux = <MT8167_PIN_24_EINT24__FUNC_PWM_A>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -808,7 +806,7 @@
|
||||||
*/
|
*/
|
||||||
pcfg_combo_rst_pull_dis_cfgs:cfg_rst_pull_dis {
|
pcfg_combo_rst_pull_dis_cfgs:cfg_rst_pull_dis {
|
||||||
combo_pins {
|
combo_pins {
|
||||||
pins = <MT8167_PIN_18_EINT18__FUNC_GPIO18>;
|
pins = <MT8167_PIN_20_EINT20__FUNC_GPIO20>;
|
||||||
bias-disable;
|
bias-disable;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -953,15 +951,7 @@
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
spi_pins_0: spi0@0 {
|
|
||||||
pins_spi {
|
|
||||||
pinmux = <MT8167_PIN_48_SPI_CS__FUNC_SPI_CSB>,
|
|
||||||
<MT8167_PIN_49_SPI_CK__FUNC_SPI_CLK>,
|
|
||||||
<MT8167_PIN_50_SPI_MI__FUNC_SPI_MI>,
|
|
||||||
<MT8167_PIN_51_SPI_MO__FUNC_SPI_MO>;
|
|
||||||
bias-disable;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1020,3 +1010,4 @@
|
||||||
pinctrl-0 = <&pwm_goio_def_cfg>;
|
pinctrl-0 = <&pwm_goio_def_cfg>;
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1441,25 +1441,26 @@
|
||||||
/* led part */
|
/* led part */
|
||||||
led0:led@0 {
|
led0:led@0 {
|
||||||
compatible = "mediatek,red";
|
compatible = "mediatek,red";
|
||||||
// led_mode = <1>;
|
led_mode = <2>;
|
||||||
// data = <1>;
|
data = < >;
|
||||||
// pwm_config = <0 0 0 0 0>;
|
pwm_config = <0 0 0 0 0>;
|
||||||
// ate_gpio = <&pio 0 0>;
|
ate_gpio = <&pio 18 0>;
|
||||||
};
|
};
|
||||||
|
|
||||||
led1:led@1 {
|
led1:led@1 {
|
||||||
compatible = "mediatek,green";
|
compatible = "mediatek,green";
|
||||||
// led_mode = <1>;
|
led_mode = <2>;
|
||||||
// data = <2>;
|
data = < >;
|
||||||
// pwm_config = <0 0 0 0 0>;
|
pwm_config = <0 0 0 0 0>;
|
||||||
// ate_gpio = <&pio 1 0>;
|
ate_gpio = <&pio 19 0>;
|
||||||
};
|
};
|
||||||
|
|
||||||
led2:led@2 {
|
led2:led@2 {
|
||||||
compatible = "mediatek,blue";
|
compatible = "mediatek,blue";
|
||||||
led_mode = <1>;
|
led_mode = <1>;
|
||||||
data = <0>;
|
data = <0>;
|
||||||
pwm_config = <0 0 0 0 0>;
|
/*CLK_DIV128 = 7*/
|
||||||
|
pwm_config = <0 7 0 0 0>;
|
||||||
//iate_gpio = <&pio 12 0>;
|
//iate_gpio = <&pio 12 0>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1606,3 +1607,4 @@
|
||||||
compatible = "mediatek,lcm";
|
compatible = "mediatek,lcm";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
193
src/kernel/linux/v4.4/arch/arm64/configs/aud8516p1v2_consys_slc_yocto_defconfig
Executable file → Normal file
193
src/kernel/linux/v4.4/arch/arm64/configs/aud8516p1v2_consys_slc_yocto_defconfig
Executable file → Normal file
|
@ -11,6 +11,7 @@ CONFIG_CGROUP_SCHED=y
|
||||||
CONFIG_RT_GROUP_SCHED=y
|
CONFIG_RT_GROUP_SCHED=y
|
||||||
CONFIG_NAMESPACES=y
|
CONFIG_NAMESPACES=y
|
||||||
#CONFIG_BLK_DEV_INITRD is not set
|
#CONFIG_BLK_DEV_INITRD is not set
|
||||||
|
CONFIG_LEDS_CLASS_AVS_UX=y
|
||||||
# CONFIG_SYSCTL_SYSCALL is not set
|
# CONFIG_SYSCTL_SYSCALL is not set
|
||||||
CONFIG_EMBEDDED=y
|
CONFIG_EMBEDDED=y
|
||||||
# CONFIG_SLUB_DEBUG is not set
|
# CONFIG_SLUB_DEBUG is not set
|
||||||
|
@ -146,7 +147,7 @@ CONFIG_MTD48=y
|
||||||
CONFIG_MTD_NAND=y
|
CONFIG_MTD_NAND=y
|
||||||
CONFIG_MTD_NAND_MTK=y
|
CONFIG_MTD_NAND_MTK=y
|
||||||
CONFIG_MTD_UBI=y
|
CONFIG_MTD_UBI=y
|
||||||
CONFIG_MTD_VERITY=y
|
CONFIG_MTD_VERITY=n
|
||||||
CONFIG_ZRAM=y
|
CONFIG_ZRAM=y
|
||||||
CONFIG_BLK_DEV_LOOP=y
|
CONFIG_BLK_DEV_LOOP=y
|
||||||
CONFIG_MEDIATEK_SOLUTION=y
|
CONFIG_MEDIATEK_SOLUTION=y
|
||||||
|
@ -203,7 +204,9 @@ CONFIG_MTK_DRAMC=y
|
||||||
# CONFIG_MTK_EMI_MPU is not set
|
# CONFIG_MTK_EMI_MPU is not set
|
||||||
# CONFIG_MTK_GPIO is not set
|
# CONFIG_MTK_GPIO is not set
|
||||||
# CONFIG_MTK_LEDS is not set
|
# CONFIG_MTK_LEDS is not set
|
||||||
# CONFIG_MTK_LEDS=y
|
CONFIG_MTK_LEDS=y
|
||||||
|
CONFIG_LEDS_TRIGGERS=y
|
||||||
|
CONFIG_LEDS_TRIGGER_TIMER=y
|
||||||
# CONFIG_MTK_M4U is not set
|
# CONFIG_MTK_M4U is not set
|
||||||
# CONFIG_MTK_PSEUDO_M4U is not set
|
# CONFIG_MTK_PSEUDO_M4U is not set
|
||||||
CONFIG_MTK_PWM=y
|
CONFIG_MTK_PWM=y
|
||||||
|
@ -264,7 +267,7 @@ CONFIG_NET_VENDOR_MEDIATEK=y
|
||||||
CONFIG_INPUT_EVDEV=y
|
CONFIG_INPUT_EVDEV=y
|
||||||
CONFIG_KEYBOARD_MTK=y
|
CONFIG_KEYBOARD_MTK=y
|
||||||
CONFIG_KEYBOARD_GPIO=y
|
CONFIG_KEYBOARD_GPIO=y
|
||||||
CONFIG_KEYBOARD_MTK_PMIC=y
|
# CONFIG_KEYBOARD_MTK_PMIC is not set
|
||||||
CONFIG_INPUT_MISC=y
|
CONFIG_INPUT_MISC=y
|
||||||
CONFIG_INPUT_UINPUT=y
|
CONFIG_INPUT_UINPUT=y
|
||||||
# CONFIG_VT is not set
|
# CONFIG_VT is not set
|
||||||
|
@ -488,19 +491,18 @@ CONFIG_NEW_LEDS=y
|
||||||
CONFIG_LEDS_CLASS=y
|
CONFIG_LEDS_CLASS=y
|
||||||
# end for usb storage support
|
# end for usb storage support
|
||||||
CONFIG_DEBUG_FS=y
|
CONFIG_DEBUG_FS=y
|
||||||
CONFIG_MTK_SWCHR_SUPPORT=y
|
#CONFIG_MTK_SWCHR_SUPPORT=y
|
||||||
CONFIG_MTK_SMART_BATTERY=y
|
#CONFIG_MTK_SMART_BATTERY=y
|
||||||
CONFIG_MTK_SGM4151_SUPPORT=y
|
#CONFIG_MTK_SGM4151_SUPPORT=y
|
||||||
CONFIG_POWER_DEBUG=y
|
CONFIG_POWER_DEBUG=y
|
||||||
#CONFIG_USB_MTK_CHARGER_DETECT=y
|
#CONFIG_USB_MTK_CHARGER_DETECT=y
|
||||||
#CONFIG_MTK_LCM=is not set
|
#CONFIG_MTK_LCM=is not set
|
||||||
#CONFIG_MTK_FB=y
|
#CONFIG_MTK_FB=y
|
||||||
CONFIG_FB=y
|
#CONFIG_FB=y
|
||||||
CONFIG_FB_DEFERRED_IO=y
|
#CONFIG_FB_DEFERRED_IO=y
|
||||||
#CONFIG_CUSTOM_KERNEL_LCM=b20c24017q_qvga_cmd is not set
|
#CONFIG_CUSTOM_KERNEL_LCM=b20c24017q_qvga_cmd is not set
|
||||||
CONFIG_SPI_SPIDEV=y
|
CONFIG_SPI_SPIDEV=y
|
||||||
CONFIG_SPI_MT65XX=y
|
CONFIG_SPI_MT65XX=y
|
||||||
CONFIG_MTK_LEDS=y
|
|
||||||
|
|
||||||
CONFIG_NETWORK_FILESYSTEMS=y
|
CONFIG_NETWORK_FILESYSTEMS=y
|
||||||
CONFIG_NFS_FS=y
|
CONFIG_NFS_FS=y
|
||||||
|
@ -534,3 +536,176 @@ CONFIG_SUNRPC_BACKCHANNEL=y
|
||||||
# CONFIG_NCP_FS is not set
|
# CONFIG_NCP_FS is not set
|
||||||
# CONFIG_CODA_FS is not set
|
# CONFIG_CODA_FS is not set
|
||||||
# CONFIG_AFS_FS is not set
|
# CONFIG_AFS_FS is not set
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Core Netfilter Configuration
|
||||||
|
#
|
||||||
|
CONFIG_NETFILTER_INGRESS=y
|
||||||
|
CONFIG_NETFILTER_NETLINK=y
|
||||||
|
# CONFIG_NETFILTER_NETLINK_ACCT is not set
|
||||||
|
CONFIG_NETFILTER_NETLINK_QUEUE=y
|
||||||
|
# CONFIG_NETFILTER_NETLINK_LOG is not set
|
||||||
|
CONFIG_NF_CONNTRACK=y
|
||||||
|
CONFIG_NF_CONNTRACK_MARK=y
|
||||||
|
CONFIG_NF_CONNTRACK_PROCFS=y
|
||||||
|
CONFIG_NF_CONNTRACK_EVENTS=y
|
||||||
|
# CONFIG_NF_CONNTRACK_TIMEOUT is not set
|
||||||
|
# CONFIG_NF_CONNTRACK_TIMESTAMP is not set
|
||||||
|
# CONFIG_NF_CT_PROTO_DCCP is not set
|
||||||
|
# CONFIG_NF_CT_PROTO_SCTP is not set
|
||||||
|
CONFIG_NF_CT_PROTO_UDPLITE=y
|
||||||
|
# CONFIG_NF_CONNTRACK_AMANDA is not set
|
||||||
|
# CONFIG_NF_CONNTRACK_FTP is not set
|
||||||
|
# CONFIG_NF_CONNTRACK_H323 is not set
|
||||||
|
# CONFIG_NF_CONNTRACK_IRC is not set
|
||||||
|
# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set
|
||||||
|
# CONFIG_NF_CONNTRACK_SNMP is not set
|
||||||
|
# CONFIG_NF_CONNTRACK_PPTP is not set
|
||||||
|
# CONFIG_NF_CONNTRACK_SANE is not set
|
||||||
|
# CONFIG_NF_CONNTRACK_SIP is not set
|
||||||
|
# CONFIG_NF_CONNTRACK_TFTP is not set
|
||||||
|
CONFIG_NF_CT_NETLINK=y
|
||||||
|
# CONFIG_NF_CT_NETLINK_TIMEOUT is not set
|
||||||
|
# CONFIG_NETFILTER_NETLINK_GLUE_CT is not set
|
||||||
|
# CONFIG_NF_TABLES is not set
|
||||||
|
CONFIG_NETFILTER_XTABLES=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# Xtables combined modules
|
||||||
|
#
|
||||||
|
CONFIG_NETFILTER_XT_MARK=y
|
||||||
|
CONFIG_NETFILTER_XT_CONNMARK=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# Xtables targets
|
||||||
|
#
|
||||||
|
# CONFIG_NETFILTER_XT_TARGET_AUDIT is not set
|
||||||
|
# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set
|
||||||
|
CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y
|
||||||
|
# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set
|
||||||
|
# CONFIG_NETFILTER_XT_TARGET_CT is not set
|
||||||
|
# CONFIG_NETFILTER_XT_TARGET_DSCP is not set
|
||||||
|
# CONFIG_NETFILTER_XT_TARGET_HL is not set
|
||||||
|
# CONFIG_NETFILTER_XT_TARGET_HMARK is not set
|
||||||
|
CONFIG_NETFILTER_XT_TARGET_IDLETIMER=y
|
||||||
|
# CONFIG_NETFILTER_XT_TARGET_LOG is not set
|
||||||
|
CONFIG_NETFILTER_XT_TARGET_MARK=y
|
||||||
|
# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
|
||||||
|
CONFIG_NETFILTER_XT_TARGET_NFQUEUE=y
|
||||||
|
# CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set
|
||||||
|
# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
|
||||||
|
# CONFIG_NETFILTER_XT_TARGET_TEE is not set
|
||||||
|
# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set
|
||||||
|
# CONFIG_NETFILTER_XT_TARGET_TRACE is not set
|
||||||
|
CONFIG_NETFILTER_XT_TARGET_TCPMSS=y
|
||||||
|
# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set
|
||||||
|
|
||||||
|
#
|
||||||
|
# Xtables matches
|
||||||
|
#
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_ADDRTYPE is not set
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_BPF is not set
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_CONNBYTES=y
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_CONNMARK=y
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_CPU is not set
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_DCCP is not set
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_DSCP is not set
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_ECN is not set
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_ESP is not set
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_HELPER is not set
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_HL is not set
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_IPRANGE=y
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_L2TP is not set
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_LENGTH=y
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_LIMIT=y
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_MAC=y
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_MARK=y
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_OSF is not set
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_OWNER is not set
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_POLICY=y
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_PHYSDEV=y
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_QTAGUID=y
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_QUOTA=y
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_QUOTA2=y
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_QUOTA2_LOG is not set
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_REALM=y
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_RECENT=y
|
||||||
|
# CONFIG_NETFILTER_XT_MATCH_SCTP is not set
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_SOCKET=y
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_STATE=y
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_STATISTIC=y
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_STRING=y
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_TCPMSS=y
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_TIME=y
|
||||||
|
CONFIG_NETFILTER_XT_MATCH_U32=y
|
||||||
|
# CONFIG_IP_SET is not set
|
||||||
|
# CONFIG_IP_VS is not set
|
||||||
|
|
||||||
|
#
|
||||||
|
# IP: Netfilter Configuration
|
||||||
|
#
|
||||||
|
CONFIG_NF_DEFRAG_IPV4=y
|
||||||
|
CONFIG_NF_CONNTRACK_IPV4=y
|
||||||
|
CONFIG_NF_CONNTRACK_PROC_COMPAT=y
|
||||||
|
# CONFIG_NF_DUP_IPV4 is not set
|
||||||
|
# CONFIG_NF_LOG_ARP is not set
|
||||||
|
# CONFIG_NF_LOG_IPV4 is not set
|
||||||
|
CONFIG_NF_REJECT_IPV4=y
|
||||||
|
# CONFIG_NF_NAT_IPV4 is not set
|
||||||
|
CONFIG_IP_NF_IPTABLES=y
|
||||||
|
# CONFIG_IP_NF_MATCH_AH is not set
|
||||||
|
# CONFIG_IP_NF_MATCH_ECN is not set
|
||||||
|
# CONFIG_IP_NF_MATCH_RPFILTER is not set
|
||||||
|
# CONFIG_IP_NF_MATCH_TTL is not set
|
||||||
|
CONFIG_IP_NF_FILTER=y
|
||||||
|
CONFIG_IP_NF_TARGET_REJECT=y
|
||||||
|
# CONFIG_IP_NF_TARGET_SYNPROXY is not set
|
||||||
|
# CONFIG_IP_NF_NAT is not set
|
||||||
|
CONFIG_IP_NF_MANGLE=y
|
||||||
|
# CONFIG_IP_NF_TARGET_CLUSTERIP is not set
|
||||||
|
# CONFIG_IP_NF_TARGET_ECN is not set
|
||||||
|
# CONFIG_IP_NF_TARGET_TTL is not set
|
||||||
|
CONFIG_IP_NF_RAW=y
|
||||||
|
# CONFIG_IP_NF_SECURITY is not set
|
||||||
|
CONFIG_IP_NF_ARPTABLES=y
|
||||||
|
# CONFIG_IP_NF_ARPFILTER is not set
|
||||||
|
# CONFIG_IP_NF_ARP_MANGLE is not set
|
||||||
|
# CONFIG_BRIDGE_NF_EBTABLES is not set
|
||||||
|
# CONFIG_IP_DCCP is not set
|
||||||
|
# CONFIG_IP_SCTP is not set
|
||||||
|
# CONFIG_RDS is not set
|
||||||
|
# CONFIG_TIPC is not set
|
||||||
|
# CONFIG_ATM is not set
|
||||||
|
# CONFIG_L2TP is not set
|
||||||
|
CONFIG_STP=y
|
||||||
|
CONFIG_BRIDGE=y
|
||||||
|
CONFIG_BRIDGE_IGMP_SNOOPING=y
|
||||||
|
# CONFIG_BRIDGE_VLAN_FILTERING is not set
|
||||||
|
CONFIG_HAVE_NET_DSA=y
|
||||||
|
CONFIG_VLAN_8021Q=y
|
||||||
|
# CONFIG_VLAN_8021Q_GVRP is not set
|
||||||
|
# CONFIG_VLAN_8021Q_MVRP is not set
|
||||||
|
# CONFIG_DECNET is not set
|
||||||
|
CONFIG_LLC=y
|
||||||
|
# CONFIG_LLC2 is not set
|
||||||
|
# CONFIG_IPX is not set
|
||||||
|
# CONFIG_ATALK is not set
|
||||||
|
# CONFIG_X25 is not set
|
||||||
|
# CONFIG_LAPB is not set
|
||||||
|
# CONFIG_PHONET is not set
|
||||||
|
# CONFIG_IEEE802154 is not set
|
||||||
|
CONFIG_NET_SCHED=y
|
||||||
|
|
|
@ -29,6 +29,17 @@ config LEDS_CLASS_FLASH
|
||||||
for the flash related features of a LED device. It can be built
|
for the flash related features of a LED device. It can be built
|
||||||
as a module.
|
as a module.
|
||||||
|
|
||||||
|
config LEDS_CLASS_AVS_UX
|
||||||
|
tristate "Amazon Alexa Voice Service LED UX Class Support"
|
||||||
|
depends on LEDS_CLASS
|
||||||
|
help
|
||||||
|
This option enables the amazon alexa voice service led sysfs class in
|
||||||
|
/sys/class/leds.
|
||||||
|
It wrapps LED Class and adds AVS ux LEDS specific sysfs attributes and
|
||||||
|
kernel internal API to it. You'll need this to provide support for AVS
|
||||||
|
releated features of a LED device. It can be built as a module.
|
||||||
|
|
||||||
|
|
||||||
comment "LED drivers"
|
comment "LED drivers"
|
||||||
|
|
||||||
config LEDS_88PM860X
|
config LEDS_88PM860X
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
obj-$(CONFIG_NEW_LEDS) += led-core.o
|
obj-$(CONFIG_NEW_LEDS) += led-core.o
|
||||||
obj-$(CONFIG_LEDS_CLASS) += led-class.o
|
obj-$(CONFIG_LEDS_CLASS) += led-class.o
|
||||||
obj-$(CONFIG_LEDS_CLASS_FLASH) += led-class-flash.o
|
obj-$(CONFIG_LEDS_CLASS_FLASH) += led-class-flash.o
|
||||||
|
obj-$(CONFIG_LEDS_CLASS_AVS_UX) += led-class-avsux.o leds-aw20036.o
|
||||||
obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o
|
obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o
|
||||||
|
|
||||||
# LED Platform Drivers
|
# LED Platform Drivers
|
||||||
|
|
|
@ -0,0 +1,462 @@
|
||||||
|
/*
|
||||||
|
* Amazon alexa voice service LED UX class interface
|
||||||
|
*
|
||||||
|
* 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 3 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.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/device.h>
|
||||||
|
#include <linux/init.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
|
#include <linux/firmware.h>
|
||||||
|
#include <linux/led-class-avsux.h>
|
||||||
|
#include "leds.h"
|
||||||
|
|
||||||
|
int avsux_timer_flag = 0;
|
||||||
|
|
||||||
|
static void avsux_parse_rgb(const u32 rgb, struct led_rgb_colors *colors)
|
||||||
|
{
|
||||||
|
colors->red = rgb & 0xff; /*exchange r&b data of the patten,by eric 20220623 */
|
||||||
|
colors->green = (rgb >> 8) & 0xff;
|
||||||
|
colors->blue = (rgb >> 16) & 0xff;/*exchange r&b data of the patten,by eric 20220623 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static u32 avsux_dump_rgb(struct led_rgb_colors *colors)
|
||||||
|
{
|
||||||
|
return (colors->red << 16) | (colors->green << 8) | colors->blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int avsux_parse_pattern(struct led_avsux_animation *animation, char *buf, size_t len)
|
||||||
|
{
|
||||||
|
struct led_avsux_pattern *pattern;
|
||||||
|
char *line, *duration, *hex;
|
||||||
|
u32 rgb;
|
||||||
|
int idx;
|
||||||
|
int ret;
|
||||||
|
char *next_line = buf;
|
||||||
|
|
||||||
|
if (!buf)
|
||||||
|
return -1;
|
||||||
|
buf[len-1] = '\0';
|
||||||
|
|
||||||
|
while ((line = strsep(&next_line, "\r\n")) != NULL) {
|
||||||
|
if ((line - buf) >= len)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (*line == '\0' || *line == '#')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
duration = strsep(&line, ":");
|
||||||
|
if (line) {
|
||||||
|
pattern = kzalloc(sizeof(struct led_avsux_pattern), GFP_KERNEL);
|
||||||
|
if (pattern) {
|
||||||
|
ret = kstrtou32(duration, 10, &pattern->duration);
|
||||||
|
if(ret < 0) return ret; // add by kk
|
||||||
|
idx = 0;
|
||||||
|
while ((hex = strsep(&line, ",")) != NULL) {
|
||||||
|
ret = kstrtou32(hex, 16, &rgb);
|
||||||
|
if(ret < 0) return ret; // add by kk
|
||||||
|
avsux_parse_rgb(rgb, &pattern->colors[idx++]);
|
||||||
|
if (idx >= MAX_NUM_LEDS)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
list_add_tail(&pattern->list, &animation->patterns);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void avsux_animation_free(struct led_avsux_animation *animation)
|
||||||
|
{
|
||||||
|
struct list_head *pos, *p;
|
||||||
|
struct led_avsux_pattern *pattern;
|
||||||
|
|
||||||
|
if (!animation)
|
||||||
|
return;
|
||||||
|
|
||||||
|
list_for_each_safe(pos, p, &animation->patterns) {
|
||||||
|
pattern = list_entry(pos, struct led_avsux_pattern, list);
|
||||||
|
list_del(pos);
|
||||||
|
kfree(pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
kfree(animation);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int avsux_animation_reset(struct led_classdev_avsux *auled_cdev)
|
||||||
|
{
|
||||||
|
struct list_head *pos, *p;
|
||||||
|
struct led_avsux_animation *animation;
|
||||||
|
|
||||||
|
auled_cdev->cur_anime = NULL;
|
||||||
|
|
||||||
|
list_for_each_safe(pos, p, &auled_cdev->animations) {
|
||||||
|
animation = list_entry(pos, struct led_avsux_animation, list);
|
||||||
|
list_del(pos);
|
||||||
|
avsux_animation_free(animation);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct led_avsux_animation *led_avsux_create_animation(char *name, int priority,
|
||||||
|
u32 loop, u32 pause, struct led_avsux_pattern *patterns,
|
||||||
|
int num_pattern)
|
||||||
|
{
|
||||||
|
struct led_avsux_animation *animation;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
animation = kzalloc(sizeof(struct led_avsux_animation), GFP_KERNEL);
|
||||||
|
if (!animation)
|
||||||
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
|
INIT_LIST_HEAD(&animation->patterns);
|
||||||
|
|
||||||
|
strncpy(animation->name, name, 32);
|
||||||
|
animation->priority = priority;
|
||||||
|
animation->loop = loop;
|
||||||
|
animation->pause = pause;
|
||||||
|
|
||||||
|
for (i = 0; i < num_pattern; i++)
|
||||||
|
list_add_tail(&patterns[i].list, &animation->patterns);
|
||||||
|
|
||||||
|
return animation;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(led_avsux_create_animation);
|
||||||
|
|
||||||
|
void led_avsux_start_animation(struct led_classdev_avsux *auled_cdev,
|
||||||
|
struct led_avsux_animation *animation)
|
||||||
|
{
|
||||||
|
if (!auled_cdev || !animation)
|
||||||
|
return;
|
||||||
|
|
||||||
|
auled_cdev->cur_anime = animation;
|
||||||
|
animation->cur_pattern = list_first_entry(&animation->patterns,
|
||||||
|
struct led_avsux_pattern, list);
|
||||||
|
animation->count = animation->loop;
|
||||||
|
hrtimer_start(&auled_cdev->anime_timer, ktime_set(0, 0), HRTIMER_MODE_REL);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(led_avsux_start_animation);
|
||||||
|
|
||||||
|
static void avsux_animation_start(struct led_classdev_avsux *auled_cdev, const char *name)
|
||||||
|
{
|
||||||
|
struct led_avsux_animation *animation;
|
||||||
|
|
||||||
|
if (hrtimer_active(&auled_cdev->anime_timer))
|
||||||
|
hrtimer_cancel(&auled_cdev->anime_timer);
|
||||||
|
|
||||||
|
list_for_each_entry(animation, &auled_cdev->animations, list) {
|
||||||
|
if (!strcmp(animation->name, name)) {
|
||||||
|
avsux_timer_flag = 1;
|
||||||
|
led_avsux_start_animation(auled_cdev, animation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t avsux_animation_store(struct device *dev,
|
||||||
|
struct device_attribute *attr, const char *buf, size_t size)
|
||||||
|
{
|
||||||
|
struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||||
|
struct led_classdev_avsux *auled_cdev = lcdev_to_aucdev(led_cdev);
|
||||||
|
const struct firmware *fw;
|
||||||
|
ssize_t ret = -EINVAL;
|
||||||
|
struct led_avsux_animation *animation;
|
||||||
|
|
||||||
|
mutex_lock(&led_cdev->led_access);
|
||||||
|
|
||||||
|
if (led_sysfs_is_disabled(led_cdev)) {
|
||||||
|
ret = -EBUSY;
|
||||||
|
goto unlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strncmp(buf, "reset", 5)) {
|
||||||
|
if (hrtimer_active(&auled_cdev->anime_timer))
|
||||||
|
hrtimer_cancel(&auled_cdev->anime_timer);
|
||||||
|
|
||||||
|
avsux_animation_reset(auled_cdev);
|
||||||
|
ret = size;
|
||||||
|
goto unlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
animation = kzalloc(sizeof(struct led_avsux_animation), GFP_KERNEL);
|
||||||
|
if (!animation) {
|
||||||
|
ret = -ENOMEM;
|
||||||
|
goto unlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
INIT_LIST_HEAD(&animation->patterns);
|
||||||
|
|
||||||
|
ret = sscanf(buf, "%s %s %d %d", animation->name, animation->anime_path,
|
||||||
|
&animation->loop, &animation->pause);
|
||||||
|
if (ret < 2) {
|
||||||
|
kfree(animation);
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto unlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = request_firmware(&fw, animation->anime_path, dev);
|
||||||
|
if (ret) {
|
||||||
|
kfree(animation);
|
||||||
|
goto unlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = avsux_parse_pattern(animation, (char *)fw->data, fw->size);
|
||||||
|
if (ret == 0)
|
||||||
|
list_add_tail(&animation->list, &auled_cdev->animations);
|
||||||
|
|
||||||
|
release_firmware(fw);
|
||||||
|
|
||||||
|
ret = size;
|
||||||
|
unlock:
|
||||||
|
mutex_unlock(&led_cdev->led_access);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t avsux_animation_show(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
|
{
|
||||||
|
struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||||
|
struct led_classdev_avsux *auled_cdev = lcdev_to_aucdev(led_cdev);
|
||||||
|
struct led_avsux_animation *animation;
|
||||||
|
ssize_t len = 0;
|
||||||
|
|
||||||
|
if (list_empty(&auled_cdev->animations))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
len += snprintf(buf + len, PAGE_SIZE - len, "Available animations:\n");
|
||||||
|
list_for_each_entry(animation, &auled_cdev->animations, list) {
|
||||||
|
len += snprintf(buf + len, PAGE_SIZE - len, "\t[%s]:[%s][%d][%d]\n",
|
||||||
|
animation->name, animation->anime_path,
|
||||||
|
animation->loop, animation->pause);
|
||||||
|
}
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
static DEVICE_ATTR_RW(avsux_animation);
|
||||||
|
|
||||||
|
static ssize_t avsux_select_store(struct device *dev,
|
||||||
|
struct device_attribute *attr, const char *buf, size_t size)
|
||||||
|
{
|
||||||
|
struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||||
|
struct led_classdev_avsux *auled_cdev = lcdev_to_aucdev(led_cdev);
|
||||||
|
ssize_t ret = -EINVAL;
|
||||||
|
char name[32];
|
||||||
|
|
||||||
|
mutex_lock(&led_cdev->led_access);
|
||||||
|
|
||||||
|
if (led_sysfs_is_disabled(led_cdev)) {
|
||||||
|
ret = -EBUSY;
|
||||||
|
goto unlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = sscanf(buf, "%s", name);
|
||||||
|
if (ret < 1) {
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto unlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
avsux_animation_start(auled_cdev, name);
|
||||||
|
|
||||||
|
ret = size;
|
||||||
|
unlock:
|
||||||
|
mutex_unlock(&led_cdev->led_access);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t avsux_select_show(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
|
{
|
||||||
|
struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||||
|
struct led_classdev_avsux *auled_cdev = lcdev_to_aucdev(led_cdev);
|
||||||
|
struct led_avsux_animation *animation = auled_cdev->cur_anime;
|
||||||
|
struct led_avsux_pattern *pattern;
|
||||||
|
ssize_t len = 0;
|
||||||
|
|
||||||
|
if (!animation)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
len += snprintf(buf + len, PAGE_SIZE - len, "%s[%s][%d][%d]:\n",
|
||||||
|
animation->name, animation->anime_path,
|
||||||
|
animation->loop, animation->pause);
|
||||||
|
list_for_each_entry(pattern, &animation->patterns, list) {
|
||||||
|
len += snprintf(buf + len, PAGE_SIZE - len,
|
||||||
|
"\t%8d:%06X,%06X,%06X,%06X,%06X,%06X,%06X,%06X,%06X,%06X,%06X,%06X\n", pattern->duration,
|
||||||
|
avsux_dump_rgb(&pattern->colors[0]), avsux_dump_rgb(&pattern->colors[1]),
|
||||||
|
avsux_dump_rgb(&pattern->colors[2]), avsux_dump_rgb(&pattern->colors[3]),
|
||||||
|
avsux_dump_rgb(&pattern->colors[4]), avsux_dump_rgb(&pattern->colors[5]),
|
||||||
|
avsux_dump_rgb(&pattern->colors[6]), avsux_dump_rgb(&pattern->colors[7]),
|
||||||
|
avsux_dump_rgb(&pattern->colors[8]), avsux_dump_rgb(&pattern->colors[9]),
|
||||||
|
avsux_dump_rgb(&pattern->colors[10]), avsux_dump_rgb(&pattern->colors[11]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
static DEVICE_ATTR_RW(avsux_select);
|
||||||
|
|
||||||
|
static char *avsux_type_str(enum led_avsux_type type)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case AVS_UX_TYPE_SINGLE:
|
||||||
|
return "single";
|
||||||
|
case AVS_UX_TYPE_RADIAL:
|
||||||
|
return "radial";
|
||||||
|
case AVS_UX_TYPE_LINEAR:
|
||||||
|
return "linear";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "unknow";
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t avsux_info_show(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
|
{
|
||||||
|
struct led_classdev *led_cdev = dev_get_drvdata(dev);
|
||||||
|
struct led_classdev_avsux *auled_cdev = lcdev_to_aucdev(led_cdev);
|
||||||
|
ssize_t len = 0;
|
||||||
|
|
||||||
|
len += snprintf(buf + len, PAGE_SIZE - len, "INFO:\n");
|
||||||
|
len += snprintf(buf + len, PAGE_SIZE - len, "\tled name:[%s]\n",
|
||||||
|
led_cdev->name);
|
||||||
|
len += snprintf(buf + len, PAGE_SIZE - len, "\tled type:[%s]\n",
|
||||||
|
avsux_type_str(auled_cdev->led_type));
|
||||||
|
len += snprintf(buf + len, PAGE_SIZE - len, "\tled nums:[%d]\n",
|
||||||
|
auled_cdev->num_leds);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
static DEVICE_ATTR_RO(avsux_info);
|
||||||
|
|
||||||
|
static struct attribute *led_avsux_select_attrs[] = {
|
||||||
|
&dev_attr_avsux_select.attr,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct attribute_group led_avsux_select_group = {
|
||||||
|
.attrs = led_avsux_select_attrs,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct attribute *led_avsux_animation_attrs[] = {
|
||||||
|
&dev_attr_avsux_animation.attr,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct attribute_group led_avsux_animation_group = {
|
||||||
|
.attrs = led_avsux_animation_attrs,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct attribute *led_avsux_info_attrs[] = {
|
||||||
|
&dev_attr_avsux_info.attr,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct attribute_group led_avsux_info_group = {
|
||||||
|
.attrs = led_avsux_info_attrs,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void led_avsux_init_sysfs_groups(struct led_classdev_avsux *auled_cdev)
|
||||||
|
{
|
||||||
|
struct led_classdev *led_cdev = &auled_cdev->led_cdev;
|
||||||
|
const struct attribute_group **avsux_groups = auled_cdev->sysfs_groups;
|
||||||
|
|
||||||
|
int num_sysfs_groups = 0;
|
||||||
|
|
||||||
|
avsux_groups[num_sysfs_groups++] = &led_avsux_select_group;
|
||||||
|
avsux_groups[num_sysfs_groups++] = &led_avsux_animation_group;
|
||||||
|
avsux_groups[num_sysfs_groups++] = &led_avsux_info_group;
|
||||||
|
|
||||||
|
led_cdev->groups = avsux_groups;
|
||||||
|
}
|
||||||
|
|
||||||
|
static enum hrtimer_restart led_avsux_animation_timer(struct hrtimer *timer)
|
||||||
|
{
|
||||||
|
struct led_classdev_avsux *auled_cdev =
|
||||||
|
container_of(timer, struct led_classdev_avsux, anime_timer);
|
||||||
|
struct led_avsux_animation *animation = auled_cdev->cur_anime;
|
||||||
|
ktime_t interval = ms_to_ktime(animation->cur_pattern->duration);
|
||||||
|
|
||||||
|
auled_cdev->ops->pattern_set(auled_cdev, animation->cur_pattern);
|
||||||
|
if (list_is_last(&animation->cur_pattern->list, &animation->patterns)) {
|
||||||
|
animation->cur_pattern = list_first_entry(&animation->patterns, struct led_avsux_pattern, list);
|
||||||
|
if (animation->pause)
|
||||||
|
interval = ktime_add_ms(interval, animation->pause);
|
||||||
|
|
||||||
|
if (--animation->count == 0) {
|
||||||
|
avsux_timer_flag = 0;
|
||||||
|
printk("%s, HRTIMER_NORESTART\n", __func__);
|
||||||
|
return HRTIMER_NORESTART;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
animation->cur_pattern = list_next_entry(animation->cur_pattern, list);
|
||||||
|
|
||||||
|
hrtimer_forward_now(&auled_cdev->anime_timer, interval);
|
||||||
|
|
||||||
|
return HRTIMER_RESTART;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int led_avsux_pattern_set_common(struct led_classdev_avsux *auled_cdev, struct led_avsux_pattern *pattern)
|
||||||
|
{
|
||||||
|
struct led_classdev *led_cdev = &auled_cdev->led_cdev;
|
||||||
|
|
||||||
|
//led_set_brightness(led_cdev, LED_FULL);
|
||||||
|
led_set_brightness(led_cdev, led_cdev->brightness);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct led_avsux_ops led_avsux_common_ops = {
|
||||||
|
.pattern_set = led_avsux_pattern_set_common,
|
||||||
|
};
|
||||||
|
|
||||||
|
int led_classdev_avsux_register(struct device *parent,
|
||||||
|
struct led_classdev_avsux *auled_cdev)
|
||||||
|
{
|
||||||
|
struct led_classdev *led_cdev;
|
||||||
|
|
||||||
|
if (!auled_cdev)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
led_cdev = &auled_cdev->led_cdev;
|
||||||
|
|
||||||
|
if (led_cdev->flags & LED_DEV_CAP_AVS_UX) {
|
||||||
|
if (!auled_cdev->ops)
|
||||||
|
auled_cdev->ops = &led_avsux_common_ops;
|
||||||
|
|
||||||
|
INIT_LIST_HEAD(&auled_cdev->animations);
|
||||||
|
hrtimer_init(&auled_cdev->anime_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
|
||||||
|
auled_cdev->anime_timer.function = &led_avsux_animation_timer;
|
||||||
|
|
||||||
|
led_avsux_init_sysfs_groups(auled_cdev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Register led class device */
|
||||||
|
return led_classdev_register(parent, led_cdev);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(led_classdev_avsux_register);
|
||||||
|
|
||||||
|
void led_classdev_avsux_unregister(struct led_classdev_avsux *auled_cdev)
|
||||||
|
{
|
||||||
|
if (!auled_cdev)
|
||||||
|
return;
|
||||||
|
|
||||||
|
led_classdev_unregister(&auled_cdev->led_cdev);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(led_classdev_avsux_unregister);
|
||||||
|
|
||||||
|
MODULE_AUTHOR("Jason <yzhuq@qq.com>");
|
||||||
|
MODULE_DESCRIPTION("Amazon alexa voice service LED UX class interface");
|
||||||
|
MODULE_LICENSE("GPL v2");
|
|
@ -0,0 +1,207 @@
|
||||||
|
#ifndef __AW20036_BOOTUP_H__
|
||||||
|
#define __AW20036_BOOTUP_H__
|
||||||
|
|
||||||
|
struct led_avsux_pattern bootup_patterns[] = {
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0xFF, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0xEF, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},
|
||||||
|
{0xFF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0xDF, 0x00, 0x00},
|
||||||
|
{0xFF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},
|
||||||
|
{0xEF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0xFF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0xCF, 0x00, 0x00},
|
||||||
|
{0xEF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},
|
||||||
|
{0xDF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0xEF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0xBF, 0x00, 0x00},
|
||||||
|
{0xDF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},
|
||||||
|
{0xCF, 0x00, 0x00},{0xFF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0xDF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0xAF, 0x00, 0x00},
|
||||||
|
{0xCF, 0x00, 0x00},{0xFF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},
|
||||||
|
{0xBF, 0x00, 0x00},{0xEF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0xCF, 0x00, 0x00},{0xFF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x9F, 0x00, 0x00},
|
||||||
|
{0xBF, 0x00, 0x00},{0xEF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},
|
||||||
|
{0xAF, 0x00, 0x00},{0xDF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0xBF, 0x00, 0x00},{0xEF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x8F, 0x00, 0x00},
|
||||||
|
{0xAF, 0x00, 0x00},{0xDF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},
|
||||||
|
{0x9F, 0x00, 0x00},{0xCF, 0x00, 0x00},{0xFF, 0x00, 0x00},{0x00, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0xAF, 0x00, 0x00},{0xDF, 0x00, 0x00},{0x00, 0x00, 0x00},{0x7F, 0x00, 0x00},
|
||||||
|
{0x9F, 0x00, 0x00},{0xCF, 0x00, 0x00},{0xFF, 0x00, 0x00},{0x00, 0x00, 0x00},
|
||||||
|
{0x8F, 0x00, 0x00},{0xBF, 0x00, 0x00},{0xEF, 0x00, 0x00},{0x00, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x9F, 0x00, 0x00},{0xCF, 0x00, 0x00},{0xFF, 0x00, 0x00},{0x6F, 0x00, 0x00},
|
||||||
|
{0x8F, 0x00, 0x00},{0xBF, 0x00, 0x00},{0xEF, 0x00, 0x00},{0x00, 0x00, 0x00},
|
||||||
|
{0x7F, 0x00, 0x00},{0xAF, 0x00, 0x00},{0xDF, 0x00, 0x00},{0x00, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x8F, 0x00, 0x00},{0xBF, 0x00, 0x00},{0xEF, 0x00, 0x00},{0x5F, 0x00, 0x00},
|
||||||
|
{0x7F, 0x00, 0x00},{0xAF, 0x00, 0x00},{0xDF, 0x00, 0x00},{0x00, 0x00, 0x00},
|
||||||
|
{0x6F, 0x00, 0x00},{0x9F, 0x00, 0x00},{0xCF, 0x00, 0x00},{0xFF, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x7F, 0x00, 0x00},{0xAF, 0x00, 0x00},{0xDF, 0x00, 0x00},{0x4F, 0x00, 0x00},
|
||||||
|
{0x6F, 0x00, 0x00},{0x9F, 0x00, 0x00},{0xCF, 0x00, 0x00},{0xFF, 0x00, 0x00},
|
||||||
|
{0x5F, 0x00, 0x00},{0x8F, 0x00, 0x00},{0xBF, 0x00, 0x00},{0xEF, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x6F, 0x00, 0x00},{0x9F, 0x00, 0x00},{0xCF, 0x00, 0x00},{0xFF, 0x00, 0x00},
|
||||||
|
{0x5F, 0x00, 0x00},{0x8F, 0x00, 0x00},{0xBF, 0x00, 0x00},{0xEF, 0x00, 0x00},
|
||||||
|
{0x4F, 0x00, 0x00},{0x7F, 0x00, 0x00},{0xAF, 0x00, 0x00},{0xEF, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x5F, 0x00, 0x00},{0x8F, 0x00, 0x00},{0xBF, 0x00, 0x00},{0xEF, 0x00, 0x00},
|
||||||
|
{0x4F, 0x00, 0x00},{0x7F, 0x00, 0x00},{0xAF, 0x00, 0x00},{0xDF, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x6F, 0x00, 0x00},{0x9F, 0x00, 0x00},{0xCF, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x4F, 0x00, 0x00},{0x7F, 0x00, 0x00},{0xAF, 0x00, 0x00},{0xDF, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x6F, 0x00, 0x00},{0x9F, 0x00, 0x00},{0xCF, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x5F, 0x00, 0x00},{0x8F, 0x00, 0x00},{0xBF, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x00, 0x00, 0x00},{0x6F, 0x00, 0x00},{0x9F, 0x00, 0x00},{0xCF, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x5F, 0x00, 0x00},{0x8F, 0x00, 0x00},{0xBF, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x4F, 0x00, 0x00},{0x7F, 0x00, 0x00},{0xAF, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x00, 0x00, 0x00},{0x5F, 0x00, 0x00},{0x8F, 0x00, 0x00},{0xBF, 0x00, 0xBF},
|
||||||
|
{0x00, 0x00, 0x00},{0x4F, 0x00, 0x00},{0x7F, 0x00, 0x00},{0xAF, 0x00, 0xAF},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x6F, 0x00, 0x00},{0x9F, 0x00, 0x9F}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x00, 0x00, 0x00},{0x4F, 0x00, 0x00},{0x7F, 0x00, 0x00},{0xAF, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x6F, 0x00, 0x00},{0x9F, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x5F, 0x00, 0x00},{0x8F, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x6F, 0x00, 0x00},{0x9F, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x5F, 0x00, 0x00},{0x8F, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x4F, 0x00, 0x00},{0x7F, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x5F, 0x00, 0x00},{0x8F, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x4F, 0x00, 0x00},{0x7F, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x6F, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x4F, 0x00, 0x00},{0x7F, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x6F, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x5F, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x6F, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x5F, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x4F, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x5F, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x4F, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x4F, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.duration = 50,
|
||||||
|
.colors = {
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},
|
||||||
|
{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00},{0x00, 0x00, 0x00}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,436 @@
|
||||||
|
/*
|
||||||
|
* AW20036 LED UX driver for amazon alexa voice service
|
||||||
|
*
|
||||||
|
* 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 3 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.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/init.h>
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/regmap.h>
|
||||||
|
#include <linux/led-class-avsux.h>
|
||||||
|
#include "leds-aw20036.h"
|
||||||
|
#include "leds-aw20036-bootup.h"
|
||||||
|
|
||||||
|
#define AW20036_I2C_NAME "aw20036_led"
|
||||||
|
#define AW20036_VERSION "v2.0.0"
|
||||||
|
#define AW20036_RESET_GPIO_NAME "aw20036_reset_gpio"
|
||||||
|
|
||||||
|
struct led_avsux_animation *bootup_anime;
|
||||||
|
extern int avsux_timer_flag;
|
||||||
|
|
||||||
|
static void aw20036_brightness_work(struct work_struct *work)
|
||||||
|
{
|
||||||
|
struct aw20036 *priv = container_of(work, struct aw20036, work);
|
||||||
|
struct led_classdev_avsux *auled_cdev = &priv->aucdev;
|
||||||
|
struct led_classdev *led_cdev = &auled_cdev->led_cdev;
|
||||||
|
struct led_avsux_pattern *pattern = priv->cur_pattern;
|
||||||
|
enum led_brightness value = led_cdev->brightness;
|
||||||
|
int act_value = 0;
|
||||||
|
int max = led_cdev->max_brightness;
|
||||||
|
u8 red, green, blue;
|
||||||
|
int i;
|
||||||
|
#if 1
|
||||||
|
if (value > 100)
|
||||||
|
value = 100;
|
||||||
|
#else
|
||||||
|
if (value > max)
|
||||||
|
value = max;
|
||||||
|
#endif
|
||||||
|
if (value < 0)
|
||||||
|
value = 0;
|
||||||
|
|
||||||
|
if (priv->levels) {
|
||||||
|
act_value = priv->levels[value];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set fade current */
|
||||||
|
regmap_write(priv->regmap, REG_PAGE, 0xC2);
|
||||||
|
for (i = 0; i < 12; i++) {
|
||||||
|
#if 1
|
||||||
|
red = pattern->colors[i].red * act_value / max;
|
||||||
|
green = pattern->colors[i].green * act_value / max;
|
||||||
|
blue = pattern->colors[i].blue * act_value / max;
|
||||||
|
#else
|
||||||
|
red = pattern->colors[i].red * max / LED_FULL;
|
||||||
|
green = pattern->colors[i].green * max / LED_FULL;
|
||||||
|
blue = pattern->colors[i].blue * max / LED_FULL;
|
||||||
|
#endif
|
||||||
|
if (priv->gamma_table) {
|
||||||
|
regmap_write(priv->regmap, 3*i, priv->gamma_table[red]);
|
||||||
|
regmap_write(priv->regmap, 3*i + 1, priv->gamma_table[green]);
|
||||||
|
regmap_write(priv->regmap, 3*i + 2, priv->gamma_table[blue]);
|
||||||
|
} else {
|
||||||
|
regmap_write(priv->regmap, 3*i, red);
|
||||||
|
regmap_write(priv->regmap, 3*i + 1, green);
|
||||||
|
regmap_write(priv->regmap, 3*i + 2, blue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void aw20036_brightness_set(struct led_classdev *led_cdev,
|
||||||
|
enum led_brightness value)
|
||||||
|
{
|
||||||
|
struct led_classdev_avsux *auled_cdev = lcdev_to_aucdev(led_cdev);
|
||||||
|
struct led_avsux_animation *animation = auled_cdev->cur_anime;
|
||||||
|
struct aw20036 *priv = container_of(auled_cdev, struct aw20036, aucdev);
|
||||||
|
|
||||||
|
/* Save current pattern */
|
||||||
|
priv->cur_pattern = animation->cur_pattern;
|
||||||
|
|
||||||
|
schedule_work(&priv->work);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t aw20036_store_setting(struct class *class,
|
||||||
|
struct class_attribute *attr,
|
||||||
|
const char *buf, size_t count)
|
||||||
|
{
|
||||||
|
int value;
|
||||||
|
struct aw20036 *priv =
|
||||||
|
container_of(class, struct aw20036, cls);
|
||||||
|
|
||||||
|
if (kstrtoint(buf, 10, &value) || ((value != 0) && (value != 1)))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (!strcmp(attr->attr.name, "reset-gpio")) {
|
||||||
|
gpio_set_value_cansleep(priv->reset_gpio, value);
|
||||||
|
} else {
|
||||||
|
pr_err("Invalid write attr.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void aw20036_debug_class_release(struct class *cls)
|
||||||
|
{
|
||||||
|
pr_info("aw20036_debug_class_release...\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct class_attribute aw20036_debug_class_attrs[] = {
|
||||||
|
__ATTR(reset-gpio, 0644, NULL, aw20036_store_setting),
|
||||||
|
__ATTR_NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static int aw20036_debug_reset_gpio(struct device *dev, struct aw20036 *priv)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
priv->cls.name = devm_kzalloc(dev, 20, GFP_KERNEL);
|
||||||
|
sprintf((char *)priv->cls.name, AW20036_RESET_GPIO_NAME);
|
||||||
|
priv->cls.class_attrs = aw20036_debug_class_attrs;
|
||||||
|
priv->cls.class_release = aw20036_debug_class_release;
|
||||||
|
ret = class_register(&priv->cls);
|
||||||
|
if (ret < 0)
|
||||||
|
dev_err(dev, "debug register class failed! (%d)\n", ret);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int aw20036_parse_dt(struct device *dev, struct aw20036 *aw20036,
|
||||||
|
struct device_node *np)
|
||||||
|
{
|
||||||
|
int ret = 0, prop_size, length;
|
||||||
|
struct property *prop;
|
||||||
|
struct property *prop_level;
|
||||||
|
|
||||||
|
aw20036->reset_gpio = of_get_named_gpio(np, "reset-gpio", 0);
|
||||||
|
if (aw20036->reset_gpio < 0) {
|
||||||
|
dev_err(dev,
|
||||||
|
"%s: no reset gpio provided, will not HW reset device\n",
|
||||||
|
__func__);
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
dev_info(dev, "%s: reset gpio provided ok\n", __func__);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = of_property_read_u32(np, "max-brightness", &aw20036->max_brightness);
|
||||||
|
if (ret < 0) {
|
||||||
|
dev_err(dev, "Failed read max brightness, use default!");
|
||||||
|
aw20036->max_brightness = LED_FULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = of_property_read_u32(np, "brightness", &aw20036->brightness);
|
||||||
|
if (ret < 0) {
|
||||||
|
dev_err(dev, "Failed read max brightness, use default!");
|
||||||
|
aw20036->brightness = LED_FULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = of_property_read_u32(np, "imax", &aw20036->imax);
|
||||||
|
if (ret < 0) {
|
||||||
|
dev_err(dev, "Failed read global max current, use default!");
|
||||||
|
aw20036->imax = 3; /* 40mA */
|
||||||
|
}
|
||||||
|
|
||||||
|
prop = of_find_property(np, "gamma-table", &prop_size);
|
||||||
|
if (prop) {
|
||||||
|
aw20036->gamma_table = devm_kzalloc(dev, prop_size, GFP_KERNEL);
|
||||||
|
if (!aw20036->gamma_table)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
ret = of_property_read_u32_array(np, "gamma-table",
|
||||||
|
aw20036->gamma_table,
|
||||||
|
prop_size / sizeof(u32));
|
||||||
|
if (ret < 0) {
|
||||||
|
dev_err(dev, "Get LED gamma table failed!\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dev_info(dev, "No LED gamma table found!\n");
|
||||||
|
aw20036->gamma_table = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
prop_level = of_find_property(np, "brightness-levels", &length);
|
||||||
|
if (prop_level) {
|
||||||
|
aw20036->levels = devm_kzalloc(dev, length, GFP_KERNEL);
|
||||||
|
if (!aw20036->levels)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
ret = of_property_read_u32_array(np, "brightness-levels",
|
||||||
|
aw20036->levels,
|
||||||
|
length / sizeof(u32));
|
||||||
|
|
||||||
|
if (ret < 0) {
|
||||||
|
dev_err(dev, "Get LED brightness-levels failed!\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dev_info(dev, "No LED brightness levels table found!\n");
|
||||||
|
aw20036->levels = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int aw20036_hw_reset(struct aw20036 *aw20036) {
|
||||||
|
if (aw20036 && gpio_is_valid(aw20036->reset_gpio)) {
|
||||||
|
gpio_set_value_cansleep(aw20036->reset_gpio, 0);
|
||||||
|
msleep(1);
|
||||||
|
gpio_set_value_cansleep(aw20036->reset_gpio, 1);
|
||||||
|
usleep_range(2000, 2500);
|
||||||
|
} else {
|
||||||
|
dev_err(aw20036->dev, "hw_reset...failed\n");
|
||||||
|
}
|
||||||
|
dev_info(aw20036->dev, "hw_reset...ok.\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int aw20036_read_aw20036id(struct aw20036 *aw20036) {
|
||||||
|
int ret = -1;
|
||||||
|
unsigned char cnt = 0;
|
||||||
|
unsigned int reg_val = 0;
|
||||||
|
|
||||||
|
regmap_write(aw20036->regmap, REG_PAGE, 0xC0);
|
||||||
|
|
||||||
|
while (cnt < AW_READ_CHIPID_RETRIES) {
|
||||||
|
ret = regmap_read(aw20036->regmap, REG_CHIPID, ®_val);
|
||||||
|
if (reg_val == AW20036_CHIPID) {
|
||||||
|
dev_info(aw20036->dev, "This Chip is 'AW20036' REG_ID: '0x%x'\n",
|
||||||
|
reg_val);
|
||||||
|
return 0;
|
||||||
|
} else if (ret < 0) {
|
||||||
|
dev_err(aw20036->dev,
|
||||||
|
"%s: failed to AW20036_REG_ID: %d\n", __func__,
|
||||||
|
ret);
|
||||||
|
return -EIO;
|
||||||
|
} else {
|
||||||
|
cnt++;
|
||||||
|
dev_info(aw20036->dev,
|
||||||
|
"This Chip read register REG_ID: 0x%x\n",
|
||||||
|
reg_val);
|
||||||
|
}
|
||||||
|
msleep(AW_READ_CHIPID_RETRY_DELAY);
|
||||||
|
}
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int aw20036_led_init(struct aw20036 *aw20036) {
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
regmap_write(aw20036->regmap, REG_PAGE, 0xC0);
|
||||||
|
regmap_write(aw20036->regmap, REG_SWRST, 0x01);
|
||||||
|
msleep(2);
|
||||||
|
regmap_write(aw20036->regmap, REG_GCCR, (aw20036->imax << 4) | 0x8);
|
||||||
|
/* 3x12 LEDs */
|
||||||
|
regmap_write(aw20036->regmap, REG_SIZE, 0x2);
|
||||||
|
/* Active mode */
|
||||||
|
regmap_write(aw20036->regmap, REG_WORK_MODE, 0x00);
|
||||||
|
|
||||||
|
/* Set DIM current */
|
||||||
|
regmap_write(aw20036->regmap, REG_PAGE, 0xC1);
|
||||||
|
for (i = 0; i < 36; i+=3) {
|
||||||
|
regmap_write(aw20036->regmap, i, 0x3f);
|
||||||
|
regmap_write(aw20036->regmap, i + 1, 0x3f);
|
||||||
|
regmap_write(aw20036->regmap, i + 2, 0x2f);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set fade current */
|
||||||
|
regmap_write(aw20036->regmap, REG_PAGE, 0xC2);
|
||||||
|
for (i = 0; i <= 0x23; i++)
|
||||||
|
regmap_write(aw20036->regmap, i, 0);
|
||||||
|
|
||||||
|
dev_info(aw20036->dev, "aw20036_led_init...ok\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int aw20036_led_release(struct aw20036 *aw20036) {
|
||||||
|
regmap_write(aw20036->regmap, REG_PAGE, 0xC0);
|
||||||
|
regmap_write(aw20036->regmap, REG_SWRST, 0x01);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct regmap_config aw20036_regmap = {
|
||||||
|
.reg_bits = 8,
|
||||||
|
.val_bits = 8,
|
||||||
|
.max_register = 0xFF,
|
||||||
|
.cache_type = REGCACHE_NONE,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int aw20036_i2c_probe(struct i2c_client *i2c,
|
||||||
|
const struct i2c_device_id *id) {
|
||||||
|
struct aw20036 *aw20036 = NULL;
|
||||||
|
struct device_node *np = i2c->dev.of_node;
|
||||||
|
struct led_classdev *led_cdev;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
aw20036 = devm_kzalloc(&i2c->dev, sizeof(struct aw20036), GFP_KERNEL);
|
||||||
|
if (aw20036 == NULL)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
ret = aw20036_debug_reset_gpio(&i2c->dev, aw20036);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
aw20036->i2c = i2c;
|
||||||
|
aw20036->dev = &i2c->dev;
|
||||||
|
|
||||||
|
if (np) {
|
||||||
|
ret = aw20036_parse_dt(&i2c->dev, aw20036, np);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(&i2c->dev,
|
||||||
|
"%s: failed to parse device tree node\n",
|
||||||
|
__func__);
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
aw20036->reset_gpio = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gpio_is_valid(aw20036->reset_gpio)) {
|
||||||
|
ret = devm_gpio_request_one(&i2c->dev, aw20036->reset_gpio,
|
||||||
|
GPIOF_OUT_INIT_LOW, "aw20036_rst");
|
||||||
|
if (ret) {
|
||||||
|
dev_err(&i2c->dev, "%s: rst request failed\n",
|
||||||
|
__func__);
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
aw20036->regmap = devm_regmap_init_i2c(i2c, &aw20036_regmap);
|
||||||
|
if (IS_ERR(aw20036->regmap)) {
|
||||||
|
ret = PTR_ERR(aw20036->regmap);
|
||||||
|
dev_err(&i2c->dev,
|
||||||
|
"Failed to allocate register map: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
aw20036_hw_reset(aw20036);
|
||||||
|
ret = aw20036_read_aw20036id(aw20036);
|
||||||
|
if (ret < 0) {
|
||||||
|
dev_err(&i2c->dev, "%s: aw20036_read_aw20036id failed ret=%d\n",
|
||||||
|
__func__, ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
aw20036_led_init(aw20036);
|
||||||
|
|
||||||
|
INIT_WORK(&aw20036->work, aw20036_brightness_work);
|
||||||
|
|
||||||
|
aw20036->aucdev.led_type = AVS_UX_TYPE_RADIAL,
|
||||||
|
aw20036->aucdev.num_leds = 12,
|
||||||
|
led_cdev = &aw20036->aucdev.led_cdev;
|
||||||
|
led_cdev->name = AW20036_I2C_NAME;
|
||||||
|
led_cdev->max_brightness = aw20036->max_brightness;
|
||||||
|
led_cdev->brightness = aw20036->brightness;
|
||||||
|
led_cdev->brightness_set = aw20036_brightness_set;
|
||||||
|
led_cdev->flags |= LED_DEV_CAP_AVS_UX;
|
||||||
|
|
||||||
|
ret = led_classdev_avsux_register(&i2c->dev, &aw20036->aucdev);
|
||||||
|
if (ret < 0) {
|
||||||
|
dev_err(&i2c->dev, "Register avsux led failed:%d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
i2c_set_clientdata(i2c, aw20036);
|
||||||
|
|
||||||
|
/* Run bootup animation */
|
||||||
|
avsux_timer_flag = 1;
|
||||||
|
bootup_anime = led_avsux_create_animation("bootup", 0, 0, 0,
|
||||||
|
bootup_patterns, ARRAY_SIZE(bootup_patterns));
|
||||||
|
if (!IS_ERR(bootup_anime)) {
|
||||||
|
printk("############### bootup ###############\n");
|
||||||
|
led_avsux_start_animation(&aw20036->aucdev, bootup_anime);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int aw20036_i2c_remove(struct i2c_client *i2c) {
|
||||||
|
struct aw20036 *aw20036 = i2c_get_clientdata(i2c);
|
||||||
|
|
||||||
|
aw20036_led_release(aw20036);
|
||||||
|
|
||||||
|
if (gpio_is_valid(aw20036->reset_gpio)) {
|
||||||
|
devm_gpio_free(&i2c->dev, aw20036->reset_gpio);
|
||||||
|
}
|
||||||
|
|
||||||
|
led_classdev_avsux_unregister(&aw20036->aucdev);
|
||||||
|
|
||||||
|
if (!IS_ERR(bootup_anime))
|
||||||
|
kfree(bootup_anime);
|
||||||
|
|
||||||
|
devm_kfree(&i2c->dev, aw20036);
|
||||||
|
aw20036 = NULL;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct i2c_device_id aw20036_i2c_id[] = {
|
||||||
|
{AW20036_I2C_NAME, 0},
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
MODULE_DEVICE_TABLE(i2c, aw20036_i2c_id);
|
||||||
|
|
||||||
|
static const struct of_device_id aw20036_dt_match[] = {
|
||||||
|
{.compatible = "awinic,aw20036_led"},
|
||||||
|
{},
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct i2c_driver aw20036_i2c_driver = {
|
||||||
|
.driver = {
|
||||||
|
.name = AW20036_I2C_NAME,
|
||||||
|
.owner = THIS_MODULE,
|
||||||
|
.of_match_table = of_match_ptr(aw20036_dt_match),
|
||||||
|
},
|
||||||
|
.probe = aw20036_i2c_probe,
|
||||||
|
.remove = aw20036_i2c_remove,
|
||||||
|
.id_table = aw20036_i2c_id,
|
||||||
|
};
|
||||||
|
|
||||||
|
module_i2c_driver(aw20036_i2c_driver);
|
||||||
|
|
||||||
|
MODULE_DESCRIPTION("AW20036 LED Driver");
|
||||||
|
MODULE_LICENSE("GPL v2");
|
|
@ -0,0 +1,80 @@
|
||||||
|
#ifndef __AW20036_H__
|
||||||
|
#define __AW20036_H__
|
||||||
|
#include <linux/leds.h>
|
||||||
|
#include <linux/i2c.h>
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/of_gpio.h>
|
||||||
|
#include <linux/cdev.h>
|
||||||
|
#include <linux/uaccess.h>
|
||||||
|
#include <linux/device.h>
|
||||||
|
#include <linux/delay.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
|
#include <linux/interrupt.h>
|
||||||
|
#include <linux/led-class-avsux.h>
|
||||||
|
|
||||||
|
#define REG_CHIPID 0x00
|
||||||
|
#define REG_WORK_MODE 0x01
|
||||||
|
#define REG_SWRST 0x02
|
||||||
|
#define REG_GCCR 0x03
|
||||||
|
#define REG_FCS 0x04
|
||||||
|
#define REG_CLKSYS 0x05
|
||||||
|
#define REG_FLTCFG1 0x09
|
||||||
|
#define REG_FLTCFG2 0x0A
|
||||||
|
#define REG_ISRFLT 0x0B
|
||||||
|
#define REG_LEDON0 0x31
|
||||||
|
#define REG_LEDON1 0x32
|
||||||
|
#define REG_LEDON2 0x33
|
||||||
|
#define REG_LEDON3 0x34
|
||||||
|
#define REG_LEDON4 0x35
|
||||||
|
#define REG_LEDON5 0x36
|
||||||
|
#define REG_PATE 0x43
|
||||||
|
#define REG_FADEH0 0x44
|
||||||
|
#define REG_FADEH1 0x45
|
||||||
|
#define REG_FADEH2 0x46
|
||||||
|
#define REG_FADEL0 0x47
|
||||||
|
#define REG_FADEL1 0x48
|
||||||
|
#define REG_FADEL2 0x49
|
||||||
|
#define REG_PAT0T0 0x4A
|
||||||
|
#define REG_PAT0T1 0x4B
|
||||||
|
#define REG_PAT0T2 0x4C
|
||||||
|
#define REG_PAT0T3 0x4D
|
||||||
|
#define REG_PAT1T0 0x4E
|
||||||
|
#define REG_PAT1T1 0x4F
|
||||||
|
#define REG_PAT1T2 0x50
|
||||||
|
#define REG_PAT1T3 0x51
|
||||||
|
#define REG_PAT2T0 0x52
|
||||||
|
#define REG_PAT2T1 0x53
|
||||||
|
#define REG_PAT2T2 0x54
|
||||||
|
#define REG_PAT2T3 0x55
|
||||||
|
#define REG_PAT0CFG 0x56
|
||||||
|
#define REG_PAT1CFG 0x57
|
||||||
|
#define REG_PAT2CFG 0x58
|
||||||
|
#define REG_PATGO 0x59
|
||||||
|
#define REG_SIZE 0x80
|
||||||
|
#define REG_PAGE 0xF0
|
||||||
|
|
||||||
|
#define AW_I2C_RETRIES 2
|
||||||
|
#define AW_I2C_RETRY_DELAY 1
|
||||||
|
#define AW_READ_CHIPID_RETRIES 2
|
||||||
|
#define AW_READ_CHIPID_RETRY_DELAY 1
|
||||||
|
|
||||||
|
#define AW20036_RSTR 0x01
|
||||||
|
#define AW20036_CHIPID 0x18
|
||||||
|
|
||||||
|
struct aw20036 {
|
||||||
|
struct i2c_client *i2c;
|
||||||
|
struct device *dev;
|
||||||
|
struct led_classdev_avsux aucdev;
|
||||||
|
struct regmap *regmap;
|
||||||
|
struct work_struct work;
|
||||||
|
struct led_avsux_pattern *cur_pattern;
|
||||||
|
struct class cls;
|
||||||
|
unsigned max_brightness;
|
||||||
|
unsigned brightness;
|
||||||
|
unsigned imax;
|
||||||
|
u32 *gamma_table;
|
||||||
|
u32 *levels;
|
||||||
|
int reset_gpio;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -16,11 +16,20 @@
|
||||||
#include <linux/rwsem.h>
|
#include <linux/rwsem.h>
|
||||||
#include <linux/leds.h>
|
#include <linux/leds.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_LEDS_CLASS_AVS_UX
|
||||||
|
extern int avsux_timer_flag;
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline void led_set_brightness_async(struct led_classdev *led_cdev,
|
static inline void led_set_brightness_async(struct led_classdev *led_cdev,
|
||||||
enum led_brightness value)
|
enum led_brightness value)
|
||||||
{
|
{
|
||||||
value = min(value, led_cdev->max_brightness);
|
value = min(value, led_cdev->max_brightness);
|
||||||
led_cdev->brightness = value;
|
led_cdev->brightness = value;
|
||||||
|
#ifdef CONFIG_LEDS_CLASS_AVS_UX
|
||||||
|
if (!avsux_timer_flag){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!(led_cdev->flags & LED_SUSPENDED))
|
if (!(led_cdev->flags & LED_SUSPENDED))
|
||||||
led_cdev->brightness_set(led_cdev, value);
|
led_cdev->brightness_set(led_cdev, value);
|
||||||
|
|
|
@ -11,6 +11,13 @@
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
#ccflags-y += -I$(srctree)/drivers/misc/mediatek/feier_infrad
|
#ccflags-y += -I$(srctree)/drivers/misc/mediatek/feier_infrad
|
||||||
obj-y += cht8305.o
|
#obj-y += feier_infrad.o
|
||||||
obj-y += cw2015_fuel_gauge_V5.0.o
|
#obj-y += leds-aw9523.o
|
||||||
obj-y += leds-aw20036.o
|
#obj-y += aht10.o
|
||||||
|
#obj-y += cht8305.o
|
||||||
|
#obj-y += cw2015_fuel_gauge_V5.0.o
|
||||||
|
#obj-y += cw2015.o
|
||||||
|
#obj-y += leds-aw20036.o
|
||||||
|
obj-y += feier_gpioint.o
|
||||||
|
#obj-y += spi-st7789v.o
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,313 @@
|
||||||
|
/*
|
||||||
|
* Feier Smart gpioint Driver
|
||||||
|
*
|
||||||
|
* Copyright (C) 2018 Feier
|
||||||
|
*
|
||||||
|
* Authors: yang
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
|
#include <linux/irq.h>
|
||||||
|
#include <linux/interrupt.h>
|
||||||
|
#include <linux/jiffies.h>
|
||||||
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/delay.h>
|
||||||
|
#include <linux/string.h>
|
||||||
|
#include <linux/ctype.h>
|
||||||
|
#include <linux/workqueue.h>
|
||||||
|
#include <linux/wakelock.h>
|
||||||
|
#include <linux/kthread.h>
|
||||||
|
#include <linux/spinlock.h>
|
||||||
|
#include <linux/ktime.h>
|
||||||
|
#include <linux/fs.h>
|
||||||
|
#include <linux/miscdevice.h>
|
||||||
|
#include <linux/hrtimer.h>
|
||||||
|
#include <linux/jiffies.h>
|
||||||
|
#include <asm/uaccess.h>
|
||||||
|
#include <linux/wait.h>
|
||||||
|
#include <linux/completion.h>
|
||||||
|
#include <linux/timer.h>
|
||||||
|
#include <linux/timex.h>
|
||||||
|
#include <linux/rtc.h>
|
||||||
|
#include <linux/sched/rt.h> /* MAX_RT_PRIO */
|
||||||
|
|
||||||
|
#include <mt-plat/mtk_pwm.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_OF
|
||||||
|
#include <linux/of_gpio.h>
|
||||||
|
#include <linux/of_irq.h>
|
||||||
|
#include <linux/of_device.h>
|
||||||
|
#include <linux/gpio.h>
|
||||||
|
#include <asm-generic/gpio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int gpioint,chargeint,charge_en;
|
||||||
|
//#include "feier_infrad.h"
|
||||||
|
|
||||||
|
struct device *gdevb;
|
||||||
|
void report_func(unsigned long data);
|
||||||
|
|
||||||
|
struct tasklet_struct gpioint_tasklet; //定义tasklet结构体
|
||||||
|
//DECLEAR_TASKLET(gpioint_tasklet, report_func,(unsigned long)123);
|
||||||
|
|
||||||
|
|
||||||
|
void mute_status_report(void)
|
||||||
|
{
|
||||||
|
//unsigned long flags;
|
||||||
|
char module_name[16];
|
||||||
|
char udev_event[128];
|
||||||
|
char *envp[] = { module_name, udev_event, NULL };
|
||||||
|
const char *event;
|
||||||
|
static unsigned int oldstat=-1;
|
||||||
|
|
||||||
|
int newstat = gpio_get_value(gpioint);
|
||||||
|
printk("newstat %d\n",newstat);
|
||||||
|
if(gdevb!=NULL)
|
||||||
|
{
|
||||||
|
if(oldstat!=newstat)
|
||||||
|
{
|
||||||
|
printk("2newstat %d\n",newstat);
|
||||||
|
oldstat = newstat;
|
||||||
|
if(newstat==0)
|
||||||
|
{
|
||||||
|
event = "mute";
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
|
||||||
|
event = "unmute";
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(module_name, 16, "MODULE=%s", "gpioint");
|
||||||
|
snprintf(udev_event, 128, "EVENT=%s", event);
|
||||||
|
printk("3newstat %d\n",newstat);
|
||||||
|
if(newstat==0)
|
||||||
|
kobject_uevent_env(&gdevb->kobj, KOBJ_CHANGE, envp);
|
||||||
|
else
|
||||||
|
kobject_uevent_env(&gdevb->kobj, KOBJ_CHANGE, envp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void charge_status_report(void)
|
||||||
|
{
|
||||||
|
//unsigned long flags;
|
||||||
|
char *event = NULL;
|
||||||
|
char *envp[2];
|
||||||
|
const char *name;
|
||||||
|
static unsigned int oldstat=-1;
|
||||||
|
|
||||||
|
int newstat = gpio_get_value(chargeint);
|
||||||
|
printk("chargeint %d\n",newstat);
|
||||||
|
if(gdevb!=NULL)
|
||||||
|
{
|
||||||
|
if(oldstat!=newstat)
|
||||||
|
{
|
||||||
|
printk("2newstat %d\n",newstat);
|
||||||
|
oldstat = newstat;
|
||||||
|
if(newstat==0)
|
||||||
|
{
|
||||||
|
name = "off";
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
name = "on";
|
||||||
|
}
|
||||||
|
event = kasprintf(GFP_KERNEL, "TRIGGER=%s", name);
|
||||||
|
printk("event %p\n",event);
|
||||||
|
if (event) {
|
||||||
|
envp[0] = event;
|
||||||
|
envp[1] = NULL;
|
||||||
|
printk("3newstat %d\n",newstat);
|
||||||
|
if(newstat==0)
|
||||||
|
kobject_uevent_env(&gdevb->kobj, KOBJ_REMOVE, envp);
|
||||||
|
else
|
||||||
|
kobject_uevent_env(&gdevb->kobj, KOBJ_ADD, envp);
|
||||||
|
kfree(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void report_func(unsigned long data)
|
||||||
|
{
|
||||||
|
mute_status_report();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static irqreturn_t feier_mute_interrupt(int irq, void *dev_id)
|
||||||
|
{
|
||||||
|
//printk("feier_mute_interrupt....\n");
|
||||||
|
// mute_status_report();
|
||||||
|
tasklet_schedule(&gpioint_tasklet);
|
||||||
|
return IRQ_HANDLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
static irqreturn_t feier_charge_interrupt(int irq, void *dev_id)
|
||||||
|
{
|
||||||
|
|
||||||
|
printk("feier_charge_interrupt....\n");
|
||||||
|
// charge_status_report();
|
||||||
|
return IRQ_HANDLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t feier_gpioint_mute_status_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
|
{
|
||||||
|
int stat = gpio_get_value(gpioint);
|
||||||
|
return sprintf(buf, "mutestat = %d\n", stat);
|
||||||
|
}
|
||||||
|
static ssize_t feier_gpioint_charge_status_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
|
{
|
||||||
|
int stat = gpio_get_value(chargeint);
|
||||||
|
return sprintf(buf, "chargeint = %d\n", stat);
|
||||||
|
}
|
||||||
|
static ssize_t feier_gpioint_charge_enable_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||||
|
{
|
||||||
|
int stat = gpio_get_value(charge_en);
|
||||||
|
return sprintf(buf, "charge_en = %d\n", stat);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t feier_gpioint_charge_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len)
|
||||||
|
{
|
||||||
|
int rc, _data_enable;
|
||||||
|
rc = sscanf(buf, "%d", &_data_enable);
|
||||||
|
if(_data_enable == 0)
|
||||||
|
{
|
||||||
|
gpio_set_value(charge_en, 0);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
gpio_set_value(charge_en, 1);
|
||||||
|
}
|
||||||
|
return len;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static DEVICE_ATTR(mute_status, 0664, feier_gpioint_mute_status_show, NULL);
|
||||||
|
static DEVICE_ATTR(charge_status, 0664, feier_gpioint_charge_status_show, NULL);
|
||||||
|
static DEVICE_ATTR(charge_enable, 0664, feier_gpioint_charge_enable_show, feier_gpioint_charge_enable_store);
|
||||||
|
|
||||||
|
static struct attribute *feier_gpioint_attributes[] = {
|
||||||
|
&dev_attr_mute_status.attr,
|
||||||
|
&dev_attr_charge_status.attr,
|
||||||
|
&dev_attr_charge_enable.attr,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct attribute_group feier_gpioint_attr_group = {
|
||||||
|
.attrs = feier_gpioint_attributes
|
||||||
|
};
|
||||||
|
|
||||||
|
static int feier_gpioint_probe(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
int ret = -1;
|
||||||
|
struct device_node *node;
|
||||||
|
unsigned int irqmute,irqchr;
|
||||||
|
|
||||||
|
printk("Feier gpioint Probe...\n");
|
||||||
|
|
||||||
|
node = pdev->dev.of_node;
|
||||||
|
if (node == NULL)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
ret = sysfs_create_group(&pdev->dev.kobj, &feier_gpioint_attr_group);
|
||||||
|
tasklet_init(&gpioint_tasklet, report_func, (unsigned long)123);
|
||||||
|
|
||||||
|
gpioint = of_get_named_gpio(node, "interrupts-extended", 0);
|
||||||
|
irqmute = irq_of_parse_and_map(node, 0);
|
||||||
|
printk("irqmute = %d\n", irqmute);
|
||||||
|
ret = request_irq(irqmute, feier_mute_interrupt,
|
||||||
|
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, "feier_mute", pdev);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(&pdev->dev, "fail to request irq\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
chargeint = of_get_named_gpio(node, "interrupts-extended", 1);
|
||||||
|
irqchr = irq_of_parse_and_map(node, 1);
|
||||||
|
printk("irqchr = %d\n", irqchr);
|
||||||
|
ret = request_irq(irqchr, feier_charge_interrupt,
|
||||||
|
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, "feier_chrint", pdev);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(&pdev->dev, "fail to request irq\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
charge_en = of_get_named_gpio(node, "charge_en", 0);
|
||||||
|
ret = gpio_request(charge_en, "charge_en");
|
||||||
|
if (ret)
|
||||||
|
printk("gpio_request fail, ret(%d)\n", ret);
|
||||||
|
gpio_direction_output(charge_en, 0);
|
||||||
|
|
||||||
|
|
||||||
|
irq_set_irq_wake(irqmute, 1);
|
||||||
|
irq_set_irq_wake(irqchr, 1);
|
||||||
|
gdevb =&(pdev->dev);
|
||||||
|
printk("Feier gpioint Probe done...\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int feier_gpioint_remove(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CONFIG_OF
|
||||||
|
static struct of_device_id gpioint_match_table[] = {
|
||||||
|
{ .compatible = "mediatek,feier_gpioint",},
|
||||||
|
{ },
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(of, gpioint_match_table);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static struct platform_driver gpioint_driver = {
|
||||||
|
.probe = feier_gpioint_probe,
|
||||||
|
.remove = feier_gpioint_remove,
|
||||||
|
.driver = {
|
||||||
|
.name = "Feier_gpioint",
|
||||||
|
.owner = THIS_MODULE,
|
||||||
|
#ifdef CONFIG_OF
|
||||||
|
.of_match_table = of_match_ptr(gpioint_match_table),
|
||||||
|
#endif
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int __init gpioint_init(void)
|
||||||
|
{
|
||||||
|
printk("Feier gpioint driver.\n");
|
||||||
|
platform_driver_register(&gpioint_driver);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __exit gpioint_exit(void)
|
||||||
|
{
|
||||||
|
tasklet_kill(&gpioint_tasklet);
|
||||||
|
platform_driver_unregister(&gpioint_driver);
|
||||||
|
}
|
||||||
|
|
||||||
|
module_init(gpioint_init);
|
||||||
|
module_exit(gpioint_exit);
|
||||||
|
|
||||||
|
MODULE_AUTHOR("yang");
|
||||||
|
MODULE_DESCRIPTION("Feier Redhat gpioint driver");
|
||||||
|
MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,19 @@ void mt_set_bl_frequency(unsigned int freq)
|
||||||
bl_frequency_hal = freq;
|
bl_frequency_hal = freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int mt_set_gpio_led_set_brightness(int gpio,int level)
|
||||||
|
{
|
||||||
|
if(level==0)
|
||||||
|
{
|
||||||
|
if (gpio_is_valid(gpio))
|
||||||
|
gpio_direction_output(gpio, 0);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
if (gpio_is_valid(gpio))
|
||||||
|
gpio_direction_output(gpio, 1);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
struct cust_mt65xx_led *get_cust_led_dtsi(void)
|
struct cust_mt65xx_led *get_cust_led_dtsi(void)
|
||||||
{
|
{
|
||||||
struct device_node *led_node = NULL;
|
struct device_node *led_node = NULL;
|
||||||
|
@ -215,12 +228,7 @@ struct cust_mt65xx_led *get_cust_led_dtsi(void)
|
||||||
pled_dtsi[i].mode = 0;
|
pled_dtsi[i].mode = 0;
|
||||||
pled_dtsi[i].data = -1;
|
pled_dtsi[i].data = -1;
|
||||||
} else {
|
} else {
|
||||||
ate_gpio = of_get_named_gpio(led_node, "ate_gpio", 0);
|
|
||||||
if (gpio_is_valid(ate_gpio)) {
|
|
||||||
ret = gpio_request(ate_gpio, "ate_gpio");
|
|
||||||
if (ret)
|
|
||||||
LEDS_INFO("cannot find gpio from dts %d\n", ate_gpio);
|
|
||||||
}
|
|
||||||
|
|
||||||
isSupportDTS = true;
|
isSupportDTS = true;
|
||||||
ret =
|
ret =
|
||||||
|
@ -282,6 +290,27 @@ struct cust_mt65xx_led *get_cust_led_dtsi(void)
|
||||||
} else
|
} else
|
||||||
LEDS_DEBUG
|
LEDS_DEBUG
|
||||||
("led dts can not get pwm config data.\n");
|
("led dts can not get pwm config data.\n");
|
||||||
|
switch (pled_dtsi[i].mode) {
|
||||||
|
case MT65XX_LED_MODE_GPIO:
|
||||||
|
ate_gpio = of_get_named_gpio(led_node, "ate_gpio", 0);
|
||||||
|
if (gpio_is_valid(ate_gpio)) {
|
||||||
|
ret = gpio_request(ate_gpio, "ate_gpio");
|
||||||
|
if (ret)
|
||||||
|
LEDS_INFO("cannot find gpio from dts %d\n", ate_gpio);
|
||||||
|
printk("get ate_gpio ret %d\n ate_gpio:%d ",ret,ate_gpio);
|
||||||
|
pled_dtsi[i].config_data.clock_source = ate_gpio;//use clock_soure for gpio pin
|
||||||
|
}else{
|
||||||
|
//printk("ate_gpio gpio_is_valid :%d\n ",ate_gpio);
|
||||||
|
}
|
||||||
|
pled_dtsi[i].data =
|
||||||
|
(long)mt_set_gpio_led_set_brightness;
|
||||||
|
LEDS_DEBUG
|
||||||
|
("kernel:the backlight hw mode is LCM.\n");
|
||||||
|
printk("datais :%ld",pled_dtsi[i].data);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
#if 0
|
#if 0
|
||||||
switch (pled_dtsi[i].mode) {
|
switch (pled_dtsi[i].mode) {
|
||||||
case MT65XX_LED_MODE_CUST_LCM:
|
case MT65XX_LED_MODE_CUST_LCM:
|
||||||
|
@ -363,15 +392,19 @@ int mt_led_set_pwm(int pwm_num, struct nled_setting *led)
|
||||||
/* Actually, the setting still can not to turn off NLED. We should disable PWM to turn off NLED. */
|
/* Actually, the setting still can not to turn off NLED. We should disable PWM to turn off NLED. */
|
||||||
case NLED_OFF:
|
case NLED_OFF:
|
||||||
pwm_setting.PWM_MODE_OLD_REGS.THRESH = 0;
|
pwm_setting.PWM_MODE_OLD_REGS.THRESH = 0;
|
||||||
pwm_setting.clk_div = CLK_DIV1;
|
if(led->div >= CLK_DIV_MAX)
|
||||||
|
led->div = CLK_DIV1;
|
||||||
|
pwm_setting.clk_div = led->div;
|
||||||
pwm_setting.PWM_MODE_OLD_REGS.DATA_WIDTH = 100 / 2;
|
pwm_setting.PWM_MODE_OLD_REGS.DATA_WIDTH = 100 / 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NLED_ON:
|
case NLED_ON:
|
||||||
/*pwm_setting.PWM_MODE_OLD_REGS.THRESH = 1000 / 2;*/
|
/*pwm_setting.PWM_MODE_OLD_REGS.THRESH = 1000 / 2;*/
|
||||||
pwm_setting.clk_div = CLK_DIV1;
|
if(led->div >= CLK_DIV_MAX)
|
||||||
|
led->div = CLK_DIV1;
|
||||||
|
pwm_setting.clk_div = led->div;
|
||||||
pwm_setting.PWM_MODE_OLD_REGS.DATA_WIDTH = 1020;
|
pwm_setting.PWM_MODE_OLD_REGS.DATA_WIDTH = 1020;
|
||||||
pwm_setting.PWM_MODE_OLD_REGS.THRESH =led->nled_level;//pin pwoer low for ledon
|
pwm_setting.PWM_MODE_OLD_REGS.THRESH = led->nled_level;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NLED_BLINK:
|
case NLED_BLINK:
|
||||||
|
@ -931,7 +964,7 @@ int mt_brightness_set_pmic_duty_store(u32 level, u32 div)
|
||||||
|
|
||||||
int mt_mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level)
|
int mt_mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level)
|
||||||
{
|
{
|
||||||
struct nled_setting led_tmp_setting = { 0, 0, 0 };
|
struct nled_setting led_tmp_setting = { 0, 0, 0 ,0};
|
||||||
int tmp_level = level;
|
int tmp_level = level;
|
||||||
unsigned int BacklightLevelSupport =
|
unsigned int BacklightLevelSupport =
|
||||||
Cust_GetBacklightLevelSupport_byPWM();
|
Cust_GetBacklightLevelSupport_byPWM();
|
||||||
|
@ -959,16 +992,16 @@ int mt_mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level)
|
||||||
bl_duty_hal = level;
|
bl_duty_hal = level;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
led_tmp_setting.nled_mode = NLED_OFF;
|
led_tmp_setting.nled_mode = NLED_OFF;
|
||||||
|
led_tmp_setting.div = cust->config_data.div;
|
||||||
mt_led_set_pwm(cust->data, &led_tmp_setting);
|
mt_led_set_pwm(cust->data, &led_tmp_setting);
|
||||||
mt_pwm_disable(cust->data,
|
mt_pwm_disable(cust->data,
|
||||||
cust->config_data.pmic_pad);
|
cust->config_data.pmic_pad);
|
||||||
} else {
|
} else {
|
||||||
led_tmp_setting.nled_level = 4*tmp_level;
|
led_tmp_setting.nled_level = 4*tmp_level;
|
||||||
led_tmp_setting.nled_mode = NLED_ON;
|
led_tmp_setting.nled_mode = NLED_ON;
|
||||||
|
led_tmp_setting.div = cust->config_data.div;
|
||||||
mt_led_set_pwm(cust->data, &led_tmp_setting);
|
mt_led_set_pwm(cust->data, &led_tmp_setting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -989,7 +1022,7 @@ int mt_mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level)
|
||||||
}
|
}
|
||||||
mutex_unlock(&bl_level_limit_mutex);
|
mutex_unlock(&bl_level_limit_mutex);
|
||||||
#endif
|
#endif
|
||||||
return ((cust_set_brightness) (cust->data)) (level);
|
return ((cust_set_brightness) (cust->data)) (cust->config_data.clock_source,level);
|
||||||
|
|
||||||
case MT65XX_LED_MODE_PMIC:
|
case MT65XX_LED_MODE_PMIC:
|
||||||
|
|
||||||
|
@ -1017,7 +1050,7 @@ int mt_mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level)
|
||||||
case MT65XX_LED_MODE_CUST_BLS_PWM:
|
case MT65XX_LED_MODE_CUST_BLS_PWM:
|
||||||
if (strcmp(cust->name, "lcd-backlight") == 0)
|
if (strcmp(cust->name, "lcd-backlight") == 0)
|
||||||
bl_brightness_hal = level;
|
bl_brightness_hal = level;
|
||||||
return ((cust_set_brightness) (cust->data)) (level);
|
return ((cust_set_brightness) (cust->data)) (cust->config_data.clock_source,level);//use clock_soure for gpio pin
|
||||||
|
|
||||||
case MT65XX_LED_MODE_NONE:
|
case MT65XX_LED_MODE_NONE:
|
||||||
default:
|
default:
|
||||||
|
@ -1043,10 +1076,8 @@ void mt_mt65xx_led_set(struct led_classdev *led_cdev, enum led_brightness level)
|
||||||
container_of(led_cdev, struct mt65xx_led_data, cdev);
|
container_of(led_cdev, struct mt65xx_led_data, cdev);
|
||||||
/* unsigned long flags; */
|
/* unsigned long flags; */
|
||||||
/* spin_lock_irqsave(&leds_lock, flags); */
|
/* spin_lock_irqsave(&leds_lock, flags); */
|
||||||
|
#if 0
|
||||||
output_met_backlight_tag(level);
|
output_met_backlight_tag(level);
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
if (gpio_is_valid(ate_gpio))
|
if (gpio_is_valid(ate_gpio))
|
||||||
gpio_direction_output(ate_gpio, 0);
|
gpio_direction_output(ate_gpio, 0);
|
||||||
|
@ -1054,8 +1085,7 @@ void mt_mt65xx_led_set(struct led_classdev *led_cdev, enum led_brightness level)
|
||||||
if (gpio_is_valid(ate_gpio))
|
if (gpio_is_valid(ate_gpio))
|
||||||
gpio_direction_output(ate_gpio, 1);
|
gpio_direction_output(ate_gpio, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_MTK_AAL_SUPPORT
|
#ifdef CONFIG_MTK_AAL_SUPPORT
|
||||||
if (led_data->level != level) {
|
if (led_data->level != level) {
|
||||||
led_data->level = level;
|
led_data->level = level;
|
||||||
|
@ -1125,7 +1155,7 @@ int mt_mt65xx_blink_set(struct led_classdev *led_cdev,
|
||||||
struct mt65xx_led_data *led_data =
|
struct mt65xx_led_data *led_data =
|
||||||
container_of(led_cdev, struct mt65xx_led_data, cdev);
|
container_of(led_cdev, struct mt65xx_led_data, cdev);
|
||||||
static int got_wake_lock;
|
static int got_wake_lock;
|
||||||
struct nled_setting nled_tmp_setting = { 0, 0, 0 };
|
struct nled_setting nled_tmp_setting = { 0, 0, 0,0 };
|
||||||
|
|
||||||
/* only allow software blink when delay_on or delay_off changed */
|
/* only allow software blink when delay_on or delay_off changed */
|
||||||
if (*delay_on != led_data->delay_on
|
if (*delay_on != led_data->delay_on
|
||||||
|
@ -1190,3 +1220,4 @@ int mt_mt65xx_blink_set(struct led_classdev *led_cdev,
|
||||||
/* delay_on and delay_off are not changed */
|
/* delay_on and delay_off are not changed */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,7 @@ enum mt65xx_led_mode {
|
||||||
|
|
||||||
/* backlight call back function */
|
/* backlight call back function */
|
||||||
typedef int (*cust_brightness_set) (int level, int div);
|
typedef int (*cust_brightness_set) (int level, int div);
|
||||||
typedef int (*cust_set_brightness) (int level);
|
typedef int (*cust_set_brightness) (int gpio,int level);
|
||||||
|
|
||||||
/* 10bit backlight level */
|
/* 10bit backlight level */
|
||||||
#define LED_INCREASE_LED_LEVEL_MTKPATCH
|
#define LED_INCREASE_LED_LEVEL_MTKPATCH
|
||||||
#ifdef LED_INCREASE_LED_LEVEL_MTKPATCH
|
#ifdef LED_INCREASE_LED_LEVEL_MTKPATCH
|
||||||
|
@ -187,6 +186,7 @@ struct nled_setting {
|
||||||
u32 nled_level;
|
u32 nled_level;
|
||||||
u32 blink_on_time;
|
u32 blink_on_time;
|
||||||
u32 blink_off_time;
|
u32 blink_off_time;
|
||||||
|
int div;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _LEDS_SW_H */
|
#endif /* _LEDS_SW_H */
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
* variables
|
* variables
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
struct cust_mt65xx_led *bl_setting;
|
struct cust_mt65xx_led *bl_setting;
|
||||||
//static unsigned int bl_div = CLK_DIV1;
|
static unsigned int bl_div = CLK_DIV1;
|
||||||
#define PWM_DIV_NUM 8
|
#define PWM_DIV_NUM 8
|
||||||
static unsigned int div_array[PWM_DIV_NUM];
|
static unsigned int div_array[PWM_DIV_NUM];
|
||||||
struct mt65xx_led_data *g_leds_data[MT65XX_LED_TYPE_TOTAL];
|
struct mt65xx_led_data *g_leds_data[MT65XX_LED_TYPE_TOTAL];
|
||||||
|
@ -52,7 +52,7 @@ static int debug_enable_led = 1;
|
||||||
/* #define pr_fmt(fmt) "[LED_DRV]"fmt */
|
/* #define pr_fmt(fmt) "[LED_DRV]"fmt */
|
||||||
#define LEDS_DRV_DEBUG(format, args...) do { \
|
#define LEDS_DRV_DEBUG(format, args...) do { \
|
||||||
if (debug_enable_led) { \
|
if (debug_enable_led) { \
|
||||||
pr_debug(format, ##args);\
|
printk(format, ##args);\
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ static void get_div_array(void)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
static int led_set_pwm(int pwm_num, struct nled_setting *led)
|
static int led_set_pwm(int pwm_num, struct nled_setting *led)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -169,7 +169,6 @@ static int brightness_set_pmic(enum mt65xx_led_pmic pmic_type, u32 level,
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static int mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level)
|
static int mt65xx_led_set_cust(struct cust_mt65xx_led *cust, int level)
|
||||||
{
|
{
|
||||||
|
@ -743,11 +742,10 @@ static int mt65xx_leds_suspend(struct platform_device *pdev, pm_message_t state)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void mt65xx_leds_shutdown(struct platform_device *pdev)
|
static void mt65xx_leds_shutdown(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct nled_setting led_tmp_setting = { NLED_OFF, 0, 0 };
|
struct nled_setting led_tmp_setting = { NLED_OFF, 0, 0, 0 };
|
||||||
|
|
||||||
LEDS_DRV_DEBUG("%s\n", __func__);
|
LEDS_DRV_DEBUG("%s\n", __func__);
|
||||||
LEDS_DRV_DEBUG("mt65xx_leds_shutdown: turn off backlight\n");
|
LEDS_DRV_DEBUG("mt65xx_leds_shutdown: turn off backlight\n");
|
||||||
|
@ -764,6 +762,7 @@ static void mt65xx_leds_shutdown(struct platform_device *pdev)
|
||||||
/* mt_pwm_power_off (g_leds_data[i]->cust.data); */
|
/* mt_pwm_power_off (g_leds_data[i]->cust.data); */
|
||||||
mt_led_pwm_disable(g_leds_data[i]->cust.data);
|
mt_led_pwm_disable(g_leds_data[i]->cust.data);
|
||||||
} else {
|
} else {
|
||||||
|
led_tmp_setting.div = g_leds_data[i]->cust.config_data.div;
|
||||||
led_set_pwm(g_leds_data[i]->cust.data,
|
led_set_pwm(g_leds_data[i]->cust.data,
|
||||||
&led_tmp_setting);
|
&led_tmp_setting);
|
||||||
}
|
}
|
||||||
|
@ -783,7 +782,7 @@ static void mt65xx_leds_shutdown(struct platform_device *pdev)
|
||||||
break;
|
break;
|
||||||
case MT65XX_LED_MODE_CUST_BLS_PWM:
|
case MT65XX_LED_MODE_CUST_BLS_PWM:
|
||||||
LEDS_DRV_DEBUG("backlight control through BLS!!1\n");
|
LEDS_DRV_DEBUG("backlight control through BLS!!1\n");
|
||||||
((cust_set_brightness) (g_leds_data[i]->cust.data)) (0);
|
((cust_set_brightness) (g_leds_data[i]->cust.data)) (g_leds_data[i]->cust.config_data.clock_source,0);
|
||||||
break;
|
break;
|
||||||
case MT65XX_LED_MODE_NONE:
|
case MT65XX_LED_MODE_NONE:
|
||||||
default:
|
default:
|
||||||
|
@ -792,7 +791,6 @@ static void mt65xx_leds_shutdown(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static struct platform_driver mt65xx_leds_driver = {
|
static struct platform_driver mt65xx_leds_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
|
@ -802,7 +800,7 @@ static struct platform_driver mt65xx_leds_driver = {
|
||||||
.probe = mt65xx_leds_probe,
|
.probe = mt65xx_leds_probe,
|
||||||
.remove = mt65xx_leds_remove,
|
.remove = mt65xx_leds_remove,
|
||||||
/* .suspend = mt65xx_leds_suspend, */
|
/* .suspend = mt65xx_leds_suspend, */
|
||||||
/*.shutdown = mt65xx_leds_shutdown,*/
|
.shutdown = mt65xx_leds_shutdown,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_OF
|
#ifdef CONFIG_OF
|
||||||
|
@ -852,3 +850,4 @@ MODULE_AUTHOR("MediaTek Inc.");
|
||||||
MODULE_DESCRIPTION("LED driver for MediaTek MT65xx chip");
|
MODULE_DESCRIPTION("LED driver for MediaTek MT65xx chip");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
MODULE_ALIAS("leds-mt65xx");
|
MODULE_ALIAS("leds-mt65xx");
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
* 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 3 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.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LINUX_AVS_UX_LED_CLASS_H__
|
||||||
|
#define __LINUX_AVS_UX_LED_CLASS_H__
|
||||||
|
|
||||||
|
#include <linux/leds.h>
|
||||||
|
#include <linux/hrtimer.h>
|
||||||
|
#include <linux/list.h>
|
||||||
|
|
||||||
|
struct device_node;
|
||||||
|
struct led_classdev_avsux;
|
||||||
|
|
||||||
|
#define MAX_NUM_LEDS 12
|
||||||
|
#define LED_AVS_UX_SYSFS_GROUPS_SIZE 5
|
||||||
|
|
||||||
|
enum led_avsux_type {
|
||||||
|
AVS_UX_TYPE_SINGLE = 0,
|
||||||
|
AVS_UX_TYPE_RADIAL,
|
||||||
|
AVS_UX_TYPE_LINEAR,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct led_rgb_colors {
|
||||||
|
u8 red;
|
||||||
|
u8 green;
|
||||||
|
u8 blue;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct led_avsux_pattern {
|
||||||
|
struct list_head list;
|
||||||
|
struct led_rgb_colors colors[MAX_NUM_LEDS];
|
||||||
|
u32 duration;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct led_avsux_animation {
|
||||||
|
char name[32];
|
||||||
|
char anime_path[256];
|
||||||
|
struct list_head list;
|
||||||
|
struct list_head patterns;
|
||||||
|
struct led_avsux_pattern *cur_pattern;
|
||||||
|
int priority;
|
||||||
|
u32 loop, pause;
|
||||||
|
u32 count;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct led_avsux_ops {
|
||||||
|
int (*pattern_set)(struct led_classdev_avsux *auled_cdev, struct led_avsux_pattern *pattern);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct led_classdev_avsux {
|
||||||
|
struct led_classdev led_cdev;
|
||||||
|
struct led_avsux_ops *ops;
|
||||||
|
enum led_avsux_type led_type;
|
||||||
|
int num_leds;
|
||||||
|
struct hrtimer anime_timer;
|
||||||
|
struct list_head animations;
|
||||||
|
struct led_avsux_animation *cur_anime;
|
||||||
|
|
||||||
|
const struct attribute_group *sysfs_groups[LED_AVS_UX_SYSFS_GROUPS_SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline struct led_classdev_avsux *lcdev_to_aucdev(
|
||||||
|
struct led_classdev *lcdev)
|
||||||
|
{
|
||||||
|
return container_of(lcdev, struct led_classdev_avsux, led_cdev);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern int led_classdev_avsux_register(struct device *parent,
|
||||||
|
struct led_classdev_avsux *auled_cdev);
|
||||||
|
|
||||||
|
extern void led_classdev_avsux_unregister(struct led_classdev_avsux *auled_cdev);
|
||||||
|
|
||||||
|
extern struct led_avsux_animation *led_avsux_create_animation(char *name, int priority,
|
||||||
|
u32 loop, u32 pause, struct led_avsux_pattern *patterns,
|
||||||
|
int num_pattern);
|
||||||
|
extern void led_avsux_start_animation(struct led_classdev_avsux *auled_cdev, struct led_avsux_animation *animation);
|
||||||
|
|
||||||
|
#endif
|
|
@ -48,6 +48,7 @@ struct led_classdev {
|
||||||
#define SET_BRIGHTNESS_ASYNC (1 << 21)
|
#define SET_BRIGHTNESS_ASYNC (1 << 21)
|
||||||
#define SET_BRIGHTNESS_SYNC (1 << 22)
|
#define SET_BRIGHTNESS_SYNC (1 << 22)
|
||||||
#define LED_DEV_CAP_FLASH (1 << 23)
|
#define LED_DEV_CAP_FLASH (1 << 23)
|
||||||
|
#define LED_DEV_CAP_AVS_UX (1 << 24)
|
||||||
|
|
||||||
/* Set LED brightness level */
|
/* Set LED brightness level */
|
||||||
/* Must not sleep, use a workqueue if needed */
|
/* Must not sleep, use a workqueue if needed */
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue