linux/include/soc/bcm2835/raspberrypi-firmware.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 *  Copyright © 2015 Broadcom
 */

#ifndef __SOC_RASPBERRY_FIRMWARE_H__
#define __SOC_RASPBERRY_FIRMWARE_H__

#include <linux/types.h>
#include <linux/of_device.h>

struct rpi_firmware;

enum rpi_firmware_property_status {};

/**
 * struct rpi_firmware_property_tag_header - Firmware property tag header
 * @tag:		One of enum_mbox_property_tag.
 * @buf_size:		The number of bytes in the value buffer following this
 *			struct.
 * @req_resp_size:	On submit, the length of the request (though it doesn't
 *			appear to be currently used by the firmware).  On return,
 *			the length of the response (always 4 byte aligned), with
 *			the low bit set.
 */
struct rpi_firmware_property_tag_header {};

enum rpi_firmware_property_tag {};

enum rpi_firmware_clk_id {};

/**
 * struct rpi_firmware_clk_rate_request - Firmware Request for a rate
 * @id:	ID of the clock being queried
 * @rate: Rate in Hertz. Set by the firmware.
 *
 * Used by @RPI_FIRMWARE_GET_CLOCK_RATE, @RPI_FIRMWARE_GET_CLOCK_MEASURED,
 * @RPI_FIRMWARE_GET_MAX_CLOCK_RATE and @RPI_FIRMWARE_GET_MIN_CLOCK_RATE.
 */
struct rpi_firmware_clk_rate_request {} __packed;

#define RPI_FIRMWARE_CLK_RATE_REQUEST(_id)

#if IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE)
int rpi_firmware_property(struct rpi_firmware *fw,
			  u32 tag, void *data, size_t len);
int rpi_firmware_property_list(struct rpi_firmware *fw,
			       void *data, size_t tag_size);
void rpi_firmware_put(struct rpi_firmware *fw);
unsigned int rpi_firmware_clk_get_max_rate(struct rpi_firmware *fw,
					   unsigned int id);
struct device_node *rpi_firmware_find_node(void);
struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node);
struct rpi_firmware *devm_rpi_firmware_get(struct device *dev,
					   struct device_node *firmware_node);
#else
static inline int rpi_firmware_property(struct rpi_firmware *fw, u32 tag,
					void *data, size_t len)
{}

static inline int rpi_firmware_property_list(struct rpi_firmware *fw,
					     void *data, size_t tag_size)
{}

static inline void rpi_firmware_put(struct rpi_firmware *fw) {}

static inline unsigned int rpi_firmware_clk_get_max_rate(struct rpi_firmware *fw,
							 unsigned int id)
{}

static inline struct device_node *rpi_firmware_find_node(void)
{}

static inline struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node)
{}

static inline struct rpi_firmware *devm_rpi_firmware_get(struct device *dev,
					struct device_node *firmware_node)
{}
#endif

#endif /* __SOC_RASPBERRY_FIRMWARE_H__ */