Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb781418 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "spmi: pmic_arb: Add snapshot of virto spmi driver"

parents eafa5790 930c2eb3
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -45,4 +45,17 @@ config SPMI_QTI_GLINK_DEBUG
	  PMIC peripherals that would typically only be accessible to the
	  charger and fuel gauging firmware running on the remote subsystem.

config VIOSPMI_MSM_PMIC_ARB
	tristate "QTI Virtio SPMI Controller (Virtio PMIC Arbiter)"
	select IRQ_DOMAIN
	depends on ARCH_QCOM || COMPILE_TEST
	depends on HAS_IOMEM
	depends on VIRTIO
	help
	  If you say yes to this option, support will be included for the
	  built-in SPMI PMIC Arbiter interface on MSM virtual platform.

	  This is required for communicating with PMICs and
	  other devices that have the SPMI interface.

endif
+1 −0
Original line number Diff line number Diff line
@@ -7,3 +7,4 @@ obj-$(CONFIG_SPMI) += spmi.o
obj-$(CONFIG_SPMI_MSM_PMIC_ARB)	+= spmi-pmic-arb.o
obj-$(CONFIG_SPMI_MSM_PMIC_ARB_DEBUG)	+= spmi-pmic-arb-debug.o
obj-$(CONFIG_SPMI_QTI_GLINK_DEBUG)	+= spmi-glink-debug.o
obj-$(CONFIG_VIOSPMI_MSM_PMIC_ARB)	+= viospmi-pmic-arb.o
+881 −0

File added.

Preview size limit exceeded, changes collapsed.

+59 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved. */

#ifndef _LINUX_VIRTIO_SPMI_H
#define _LINUX_VIRTIO_SPMI_H

#include <linux/types.h>
#include <linux/virtio_ids.h>
#include <linux/virtio_config.h>
#include <linux/virtio_types.h>

/* Feature bits */
#define VIRTIO_SPMI_F_INT	1	/* Support interrupt */

#define VM_MAX_PERIPHS 512

/* Configuration layout */
struct virtio_spmi_config {
	__u16 ppid_allowed[VM_MAX_PERIPHS];
} __packed;

struct payload_cmd {
	__virtio32 cmd;
	__virtio32 data[2];
};

struct payload_irq {
	__virtio16 ppid;
	__virtio32 regval;
};

union payload_data {
	struct payload_cmd cmdd;
	struct payload_irq irqd;
};

struct virtio_spmi_msg {
	__virtio32 type;
	__virtio32 res;
	union payload_data payload;
};

/* Virtio SPMI message type */
enum vio_spmi_msg_type {
	VIO_SPMI_BUS_WRITE = 0,
	VIO_SPMI_BUS_READ = 1,
	VIO_SPMI_BUS_CMDMAX  = 1,
	VIO_ACC_ENABLE_WR = 2,
	VIO_ACC_ENABLE_RD = 3,
	VIO_IRQ_CLEAR = 4,
	VIO_IRQ_STATUS = 5,
};

/* Virtio SPMI message type */
enum vio_spmi_msg_res {
	VIO_SPMI_DONE = 0,
	VIO_SPMI_ERR = 1,
};
#endif /* _LINUX_VIRTIO_SPMI_H */