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

Commit d7194ffe authored by Lina Iyer's avatar Lina Iyer
Browse files

drivers: soc: qcom: Add helper functions for RPMH communication



Add helper function layer over TCS mailbox driver for communicating with
the RPMH accelerators. The helper functions proxy memory allocations on
behalf of the driver as well as callbacks from the mailbox framework
making it easy for drivers to use TCS mailbox for RPM communication.

Change-Id: I5f2d2dfff3c6b3d2b48de915c2913bb4b1902b1c
Signed-off-by: default avatarLina Iyer <ilina@codeaurora.org>
parent 8d442df8
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -281,3 +281,11 @@ config TRACER_PKT
	  Tracer Packet helps in profiling the performance of inter-
	  processor communication protocols. The profiling information
	  can be logged into the tracer packet itself.

config QTI_RPMH_API
	bool "QTI RPMH (h/w accelerators) Communication API"
	select MAILBOX
	select QTI_RPMH_MBOX
	help
	  This option enables RPMH hardware communication for making shared
	  resource requests on Qualcomm Technologies Inc SoCs.
+1 −0
Original line number Diff line number Diff line
@@ -30,3 +30,4 @@ obj-$(CONFIG_MSM_GLINK_SMEM_NATIVE_XPRT) += glink_smem_native_xprt.o
obj-$(CONFIG_MSM_GLINK_SPI_XPRT) += glink_spi_xprt.o
obj-$(CONFIG_TRACER_PKT) += tracer_pkt.o
obj-$(CONFIG_QCOM_BUS_SCALING) += msm_bus/
obj-$(CONFIG_QTI_RPMH_API) += rpmh.o
+837 −0

File added.

Preview size limit exceeded, changes collapsed.

+97 −0
Original line number Diff line number Diff line
/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */
#ifndef __SOC_QCOM_RPMH_H__
#define __SOC_QCOM_RPMH_H__

#include <soc/qcom/tcs.h>

struct rpmh_client;

#ifdef CONFIG_QTI_RPMH_API
int rpmh_write_single(struct rpmh_client *rc, enum rpmh_state state,
			u32 addr, u32 data);

int rpmh_write_single_async(struct rpmh_client *rc,
			enum rpmh_state state, u32 addr, u32 data);

int rpmh_write(struct rpmh_client *rc, enum rpmh_state state,
			struct tcs_cmd *cmd, int n);

int rpmh_write_async(struct rpmh_client *rc, enum rpmh_state state,
			struct tcs_cmd *cmd, int n);

int rpmh_write_passthru(struct rpmh_client *rc, enum rpmh_state state,
			struct tcs_cmd *cmd, int *n);

int rpmh_write_control(struct rpmh_client *rc, struct tcs_cmd *cmd, int n);

int rpmh_invalidate(struct rpmh_client *rc);

int rpmh_flush(struct rpmh_client *rc);

int rpmh_read(struct rpmh_client *rc, u32 addr, u32 *resp);

struct rpmh_client *rpmh_get_byname(struct platform_device *pdev,
			const char *name);

struct rpmh_client *rpmh_get_byindex(struct platform_device *pdev,
			int index);

void rpmh_release(struct rpmh_client *rc);
#else
static inline int rpmh_write_single(struct rpmh_client *rc,
			enum rpmh_state state, u32 addr, u32 data)
{ return -ENODEV; }

static inline int rpmh_write_single_async(struct rpmh_client *rc,
			enum rpmh_state state, u32 addr, u32 data)
{ return -ENODEV; }

static inline int rpmh_write(struct rpmh_client *rc, enum rpmh_state state,
			struct tcs_cmd *cmd, int n)
{ return -ENODEV; }

static inline int rpmh_write_async(struct rpmh_client *rc,
			enum rpmh_state state, struct tcs_cmd *cmd, int n)
{ return -ENODEV; }

static inline int rpmh_write_passthru(struct rpmh_client *rc,
			enum rpmh_state state, struct tcs_cmd *cmd, int *n)
{ return -ENODEV; }

static inline int rpmh_write_control(struct rpmh_client *rc,
			struct tcs_cmd *cmd, int n)
{ return -ENODEV; }

static inline int rpmh_invalidate(struct rpmh_client *rc)
{ return -ENODEV; }

static inline int rpmh_flush(struct rpmh_client *rc)
{ return -ENODEV; }

static inline int rpmh_read(struct rpmh_client *rc, u32 addr,
			u32 *resp)
{ return -ENODEV; }

static inline struct rpmh_client *rpmh_get_byname(struct platform_device *pdev,
			const char *name)
{ return ERR_PTR(-ENODEV); }

static inline struct rpmh_client *rpmh_get_byindex(struct platform_device *pdev,
			int index)
{ return ERR_PTR(-ENODEV); }

static inline void rpmh_release(struct rpmh_client *rc) { }
#endif /* CONFIG_QTI_RPMH_API */

#endif /* __SOC_QCOM_RPMH_H__ */