Finalize verified 2720 Flip release source and untrack image outputs
This commit is contained in:
1 parent
2a3078e42c
commit
1c011b360a
121 files changed
+8467
-686
No files matched your search
@@ -0,0 +1,53 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
#ifndef LK2ND_SPI_PANEL_INIT_H
|
||||
#define LK2ND_SPI_PANEL_INIT_H
|
||||
|
||||
/*
|
||||
* Walk a downstream qcom,mdss-spi-on-command byte stream.
|
||||
*
|
||||
* Every command is [wait_ms, dlen, payload[dlen]]. The first payload byte is
|
||||
* the command (DC low), the rest are parameters (DC high), and wait_ms is
|
||||
* applied after the command. This matches the KaiOS 3.10 mdss_spi_panel_on()
|
||||
* implementation (struct spi_ctrl_hdr { char wait; char dlen; }).
|
||||
*
|
||||
* Returns 0 on success, a negative value on a malformed stream or a write
|
||||
* error. The callbacks make this usable by both the target SPI driver and a
|
||||
* host unit test.
|
||||
*/
|
||||
struct lk2nd_spi_panel_init_ops {
|
||||
int (*write_cmd)(const unsigned char *cmd);
|
||||
int (*write_data)(const unsigned char *data, unsigned int len);
|
||||
void (*delay)(unsigned int ms);
|
||||
};
|
||||
|
||||
static inline int lk2nd_spi_panel_init_run(const unsigned char *cmds,
|
||||
unsigned int len, const struct lk2nd_spi_panel_init_ops *ops)
|
||||
{
|
||||
unsigned int off = 0, size;
|
||||
unsigned char wait;
|
||||
int ret;
|
||||
|
||||
while(off + 2 <= len) {
|
||||
wait = cmds[off++];
|
||||
size = cmds[off++];
|
||||
if(!size || off + size > len)
|
||||
return -1;
|
||||
|
||||
ret = ops->write_cmd(cmds + off);
|
||||
if(ret)
|
||||
return ret;
|
||||
if(size > 1) {
|
||||
ret = ops->write_data(cmds + off + 1, size - 1);
|
||||
if(ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
off += size;
|
||||
if(wait)
|
||||
ops->delay(wait);
|
||||
}
|
||||
|
||||
return off == len ? 0 : -1;
|
||||
}
|
||||
|
||||
#endif /* LK2ND_SPI_PANEL_INIT_H */
|
||||
Reference in new issue
Block a user