UNFINISHED: firmware: Add synaptics tcm oncell fw loader driver

This commit is contained in:
Nia Espera 2023-09-04 09:18:52 +02:00
parent ff19be52ff
commit cb877d00b3
No known key found for this signature in database
GPG key ID: F224CEC23756E2AD
3 changed files with 90 additions and 0 deletions

View file

@ -220,6 +220,15 @@ config SYSFB_SIMPLEFB
If unsure, say Y.
config SYNA_TCM_FW
tristate "Synaptics TCM Firmware Loader"
depends on RMI4_I2C
help
Say yes here to add support for loading firmware images on Synaptics
TCM on-cell touch controllers.
If unsure, say N.
config TI_SCI_PROTOCOL
tristate "TI System Control Interface (TISCI) Message Protocol"
depends on TI_MESSAGE_MANAGER

View file

@ -15,6 +15,7 @@ obj-$(CONFIG_ISCSI_IBFT_FIND) += iscsi_ibft_find.o
obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o
obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o
obj-$(CONFIG_MTK_ADSP_IPC) += mtk-adsp-ipc.o
obj-$(CONFIG_SYNA_TCM_FW) += syna_tcm_loader.o
obj-$(CONFIG_RASPBERRYPI_FIRMWARE) += raspberrypi.o
obj-$(CONFIG_FW_CFG_SYSFS) += qemu_fw_cfg.o
obj-$(CONFIG_SYSFB) += sysfb.o

View file

@ -0,0 +1,80 @@
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/rmi.h>
#include <linux/delay.h>
struct fw_block {
unsigned char *data;
unsigned int size;
unsigned int addr;
};
struct tcm_firmware {
struct fw_block boot_cfg;
struct fw_block app_fw;
struct fw_block app_cfg;
struct fw_block disp_cfg;
};
enum tcm_mode {
MODE_BL,
MODE_APP,
};
static int rmi_is_tcm(struct rmi_device *rmi) {
/* TODO */
return 0;
}
static int syna_tcm_switch_mode(struct rmi_device *rmi, enum tcm_mode mode)
{
unsigned char *response;
unsigned int
int ret;
mutex_lock(rmi->dev->mutex);
/* TODO */
mutex_unlock(rmi->dev->mutex);
}
static int syna_tcm_fw_load(struct rmi_device *rmi,
const struct tcm_firmware *fw)
{
int ret;
ret = syna_tcm_switch_mode(struct rmi_device *rmi, MODE_BL);
if (!ret) {
dev_err(dev, "Failed to switch into bootloader mode: %d\n", ret);
return ret;
}
/* XXX: Write the 4 fw imgs */
}
static int syna_tcm_fw_init(struct rmi_device *rmi)
{
struct tcm_firmware *fw;
struct device *dev = rmi->dev;
int ret;
ret = rmi_is_tcm(rmi);
if (ret) {
dev_err(dev, "RMI device is not TCM; aborting fw load: %d\n", ret);
return -ENODEV;
}
fw = devm_kzalloc(dev, sizeof(*fw), GFP_KERNEL);
if (!fw)
return -ENOMEM;
ret = syna_tcm_fw_load(rmi, const struct tcm_firmware *fw)
}
static const struct of_device_id syna_tcm_fw_match {
/* XXX: See if this is actually generic before upstreaming */
{
.compatible = "syna,tcm-fw-loader",
},
{},
};