aboutsummaryrefslogtreecommitdiff
path: root/include/linux/soc/qcom
diff options
context:
space:
mode:
authorSrinivas Kandagatla2021-09-27 14:55:40 +0100
committerBjorn Andersson2021-09-27 22:10:07 -0500
commit99139b80c1b3d73026ed8be2de42c52e2976ab64 (patch)
tree76bd3fd77cc25622ece84ccd9f2007999b93e975 /include/linux/soc/qcom
parent1ff63d5465d0b0bf4e69562096b2d3ec9ff1a116 (diff)
soc: qcom: apr: make code more reuseable
APR and other packet routers like GPR are pretty much same and interact with other drivers in similar way. Ex: GPR ports can be considered as APR services, only difference is they are allocated dynamically. Other difference is packet layout, which should not matter with the apis abstracted. Apart from this the rest of the functionality is pretty much identical across APR and GPR. Make the apr code more reusable by abstracting it service level, rather than device level so that we do not need to write new drivers for other new packet routers like GPR. This patch is in preparation to add GPR support to this driver. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20210927135559.738-4-srinivas.kandagatla@linaro.org
Diffstat (limited to 'include/linux/soc/qcom')
-rw-r--r--include/linux/soc/qcom/apr.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/linux/soc/qcom/apr.h b/include/linux/soc/qcom/apr.h
index 137f9f2ac4c3..7bca213a3f83 100644
--- a/include/linux/soc/qcom/apr.h
+++ b/include/linux/soc/qcom/apr.h
@@ -79,6 +79,15 @@ struct apr_resp_pkt {
#define APR_SVC_MAJOR_VERSION(v) ((v >> 16) & 0xFF)
#define APR_SVC_MINOR_VERSION(v) (v & 0xFF)
+struct packet_router;
+struct pkt_router_svc {
+ struct device *dev;
+ struct packet_router *pr;
+ spinlock_t lock;
+ int id;
+ void *priv;
+};
+
struct apr_device {
struct device dev;
uint16_t svc_id;
@@ -86,11 +95,12 @@ struct apr_device {
uint32_t version;
char name[APR_NAME_SIZE];
const char *service_path;
- spinlock_t lock;
+ struct pkt_router_svc svc;
struct list_head node;
};
#define to_apr_device(d) container_of(d, struct apr_device, dev)
+#define svc_to_apr_device(d) container_of(d, struct apr_device, svc)
struct apr_driver {
int (*probe)(struct apr_device *sl);