1.806驱动添加获取唤醒源功能,驱动编译进内核

2.lcd驱动增加背光渐亮功能,解耦驱动
This commit is contained in:
2025-04-28 17:58:56 +08:00
parent 17f1d2754e
commit 0833611b03
7 changed files with 169 additions and 52 deletions

View File

@@ -27,4 +27,4 @@ endif
$(CONFIG_MODULE_NAME)-y := $(xr806-y)
obj-m += $(CONFIG_MODULE_NAME).o
obj-$(CONFIG_XR806_WLAN) += $(CONFIG_MODULE_NAME).o

View File

@@ -18,6 +18,10 @@
#define __XR_CMD_PROTO_H__
/*XR_WIFI_HOST_HAND_WAY */
#define HAS_MAGIC (0x55aa55aa)
#define HAS_SET_WAKEUP_SRC (0x0264)
#define HAS_GET_WAKEUP_SRC (0x0259)
struct cmd_para_hand_way {
u8 id;
};
@@ -70,5 +74,22 @@ struct cmd_payload {
u8 param[0];
};
#pragma pack(1)
typedef struct{
u32 magic; /* HAS_PACKET_MAGIC */
u16 event;
u32 payload_size; /* total size of payload */
u8 wakeupsrc; /* the addr of payload */
}kpacket_box; //for transport reason
struct cmd_has_payload {
u16 unkown1;
u16 unkown2;
u32 len;
kpacket_box has_app_proto;
};
#pragma pack()
#define CMD_HEAD_SIZE (sizeof(struct cmd_payload))
#endif

View File

@@ -29,6 +29,16 @@
u16 txparse_flags;
u16 rxparse_flags;
#if defined(CONFIG_HAS_INTERNALCODEC)
extern void doorbell_control(unsigned char wakeup_src);
#endif
#if defined(CONFIG_DISP2_HAS_SUPPORT_BACK_WKSRCBL)
extern void disp_backlight_control(unsigned char wakeup_src);
#endif
#if defined(CONFIG_MEM_OPERATION)
extern int mem_set_wakeup_source(unsigned char wakeup_src);
#endif
void xradio_wake_up_tx_work(void *priv)
{
struct xradio_priv *_priv = (struct xradio_priv *)priv;
@@ -257,6 +267,9 @@ end:
return ret;
}
static struct cmd_has_payload *has_cmd = NULL;
static int xradio_rx_process(struct xradio_priv *priv, struct sk_buff *skb)
{
struct xradio_hdr *hdr = NULL;
@@ -266,6 +279,7 @@ static int xradio_rx_process(struct xradio_priv *priv, struct sk_buff *skb)
u16 checksum = 0, c_checksum = 0;
u8 seq = 0;
static int dev_seq = -1;
static unsigned char get_wksrc_flag = 0;
int i;
if (!priv || !skb)
@@ -316,6 +330,23 @@ static int xradio_rx_process(struct xradio_priv *priv, struct sk_buff *skb)
/* incom data */
if (type_id == XR_REQ_CMD) {
xradio_rx_cmd_process(priv, skb, cur_len, seq);
if (get_wksrc_flag == 0)
{
has_cmd = (struct cmd_has_payload *)skb->data;
if ((has_cmd->has_app_proto.magic == HAS_MAGIC) && has_cmd->has_app_proto.event == HAS_SET_WAKEUP_SRC)
{
#if defined(CONFIG_HAS_INTERNALCODEC)
doorbell_control(has_cmd->has_app_proto.wakeupsrc);
#endif
#if defined(CONFIG_DISP2_HAS_SUPPORT_BACK_WKSRCBL)
disp_backlight_control(has_cmd->has_app_proto.wakeupsrc);
#endif
#if defined(CONFIG_MEM_OPERATION)
mem_set_wakeup_source(has_cmd->has_app_proto.wakeupsrc);
#endif
get_wksrc_flag = 1;
}
}
} else {
#if DATA_TEST
xradio_data_test_rx_handle(skb->data, skb->len);
@@ -403,9 +434,20 @@ static int xradio_txrx_thread(void *data)
int status = 0;
int rx_len = 0;
int tx_status = 0;
const struct cmd_has_payload wakeup_src_cmd =
{
.unkown1 = 0x003f, // TODO:全志通信协议
.unkown2 = 0x000f,
.len = sizeof(kpacket_box),
.has_app_proto.magic = HAS_MAGIC,
.has_app_proto.event = HAS_GET_WAKEUP_SRC,
.has_app_proto.payload_size = 1,
.has_app_proto.wakeupsrc = 0,
};
xradio_k_atomic_set(&priv->tranc_ready, 1);
xradio_tx_cmd_process(priv, (char *)&wakeup_src_cmd, sizeof(wakeup_src_cmd)); // 获取唤醒源
while (1) {
status = wait_event_interruptible(priv->txrx_wq, ({
rx = xradio_hwio_rx_pending();