linux/drivers/hsi/hsi_core.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * HSI core.
 *
 * Copyright (C) 2010 Nokia Corporation. All rights reserved.
 *
 * Contact: Carlos Chinea <[email protected]>
 */
#include <linux/hsi/hsi.h>
#include <linux/compiler.h>
#include <linux/list.h>
#include <linux/kobject.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/notifier.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include "hsi_core.h"

static ssize_t modalias_show(struct device *dev,
			struct device_attribute *a __maybe_unused, char *buf)
{}
static DEVICE_ATTR_RO(modalias);

static struct attribute *hsi_bus_dev_attrs[] =;
ATTRIBUTE_GROUPS();

static int hsi_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{}

static int hsi_bus_match(struct device *dev, const struct device_driver *driver)
{}

static const struct bus_type hsi_bus_type =;

static void hsi_client_release(struct device *dev)
{}

struct hsi_client *hsi_new_client(struct hsi_port *port,
						struct hsi_board_info *info)
{}
EXPORT_SYMBOL_GPL();

static void hsi_scan_board_info(struct hsi_controller *hsi)
{}

#ifdef CONFIG_OF
static struct hsi_board_info hsi_char_dev_info =;

static int hsi_of_property_parse_mode(struct device_node *client, char *name,
				      unsigned int *result)
{}

static int hsi_of_property_parse_flow(struct device_node *client, char *name,
				      unsigned int *result)
{}

static int hsi_of_property_parse_arb_mode(struct device_node *client,
					  char *name, unsigned int *result)
{}

static void hsi_add_client_from_dt(struct hsi_port *port,
						struct device_node *client)
{}

void hsi_add_clients_from_dt(struct hsi_port *port, struct device_node *clients)
{}
EXPORT_SYMBOL_GPL();
#endif

int hsi_remove_client(struct device *dev, void *data __maybe_unused)
{}
EXPORT_SYMBOL_GPL();

static int hsi_remove_port(struct device *dev, void *data __maybe_unused)
{}

static void hsi_controller_release(struct device *dev)
{}

static void hsi_port_release(struct device *dev)
{}

/**
 * hsi_port_unregister_clients - Unregister an HSI port
 * @port: The HSI port to unregister
 */
void hsi_port_unregister_clients(struct hsi_port *port)
{}
EXPORT_SYMBOL_GPL();

/**
 * hsi_unregister_controller - Unregister an HSI controller
 * @hsi: The HSI controller to register
 */
void hsi_unregister_controller(struct hsi_controller *hsi)
{}
EXPORT_SYMBOL_GPL();

/**
 * hsi_register_controller - Register an HSI controller and its ports
 * @hsi: The HSI controller to register
 *
 * Returns -errno on failure, 0 on success.
 */
int hsi_register_controller(struct hsi_controller *hsi)
{}
EXPORT_SYMBOL_GPL();

/**
 * hsi_register_client_driver - Register an HSI client to the HSI bus
 * @drv: HSI client driver to register
 *
 * Returns -errno on failure, 0 on success.
 */
int hsi_register_client_driver(struct hsi_client_driver *drv)
{}
EXPORT_SYMBOL_GPL();

static inline int hsi_dummy_msg(struct hsi_msg *msg __maybe_unused)
{}

static inline int hsi_dummy_cl(struct hsi_client *cl __maybe_unused)
{}

/**
 * hsi_put_controller - Free an HSI controller
 *
 * @hsi: Pointer to the HSI controller to freed
 *
 * HSI controller drivers should only use this function if they need
 * to free their allocated hsi_controller structures before a successful
 * call to hsi_register_controller. Other use is not allowed.
 */
void hsi_put_controller(struct hsi_controller *hsi)
{}
EXPORT_SYMBOL_GPL();

/**
 * hsi_alloc_controller - Allocate an HSI controller and its ports
 * @n_ports: Number of ports on the HSI controller
 * @flags: Kernel allocation flags
 *
 * Return NULL on failure or a pointer to an hsi_controller on success.
 */
struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags)
{}
EXPORT_SYMBOL_GPL();

/**
 * hsi_free_msg - Free an HSI message
 * @msg: Pointer to the HSI message
 *
 * Client is responsible to free the buffers pointed by the scatterlists.
 */
void hsi_free_msg(struct hsi_msg *msg)
{}
EXPORT_SYMBOL_GPL();

/**
 * hsi_alloc_msg - Allocate an HSI message
 * @nents: Number of memory entries
 * @flags: Kernel allocation flags
 *
 * nents can be 0. This mainly makes sense for read transfer.
 * In that case, HSI drivers will call the complete callback when
 * there is data to be read without consuming it.
 *
 * Return NULL on failure or a pointer to an hsi_msg on success.
 */
struct hsi_msg *hsi_alloc_msg(unsigned int nents, gfp_t flags)
{}
EXPORT_SYMBOL_GPL();

/**
 * hsi_async - Submit an HSI transfer to the controller
 * @cl: HSI client sending the transfer
 * @msg: The HSI transfer passed to controller
 *
 * The HSI message must have the channel, ttype, complete and destructor
 * fields set beforehand. If nents > 0 then the client has to initialize
 * also the scatterlists to point to the buffers to write to or read from.
 *
 * HSI controllers relay on pre-allocated buffers from their clients and they
 * do not allocate buffers on their own.
 *
 * Once the HSI message transfer finishes, the HSI controller calls the
 * complete callback with the status and actual_len fields of the HSI message
 * updated. The complete callback can be called before returning from
 * hsi_async.
 *
 * Returns -errno on failure or 0 on success
 */
int hsi_async(struct hsi_client *cl, struct hsi_msg *msg)
{}
EXPORT_SYMBOL_GPL();

/**
 * hsi_claim_port - Claim the HSI client's port
 * @cl: HSI client that wants to claim its port
 * @share: Flag to indicate if the client wants to share the port or not.
 *
 * Returns -errno on failure, 0 on success.
 */
int hsi_claim_port(struct hsi_client *cl, unsigned int share)
{}
EXPORT_SYMBOL_GPL();

/**
 * hsi_release_port - Release the HSI client's port
 * @cl: HSI client which previously claimed its port
 */
void hsi_release_port(struct hsi_client *cl)
{}
EXPORT_SYMBOL_GPL();

static int hsi_event_notifier_call(struct notifier_block *nb,
				unsigned long event, void *data __maybe_unused)
{}

/**
 * hsi_register_port_event - Register a client to receive port events
 * @cl: HSI client that wants to receive port events
 * @handler: Event handler callback
 *
 * Clients should register a callback to be able to receive
 * events from the ports. Registration should happen after
 * claiming the port.
 * The handler can be called in interrupt context.
 *
 * Returns -errno on error, or 0 on success.
 */
int hsi_register_port_event(struct hsi_client *cl,
			void (*handler)(struct hsi_client *, unsigned long))
{}
EXPORT_SYMBOL_GPL();

/**
 * hsi_unregister_port_event - Stop receiving port events for a client
 * @cl: HSI client that wants to stop receiving port events
 *
 * Clients should call this function before releasing their associated
 * port.
 *
 * Returns -errno on error, or 0 on success.
 */
int hsi_unregister_port_event(struct hsi_client *cl)
{}
EXPORT_SYMBOL_GPL();

/**
 * hsi_event - Notifies clients about port events
 * @port: Port where the event occurred
 * @event: The event type
 *
 * Clients should not be concerned about wake line behavior. However, due
 * to a race condition in HSI HW protocol, clients need to be notified
 * about wake line changes, so they can implement a workaround for it.
 *
 * Events:
 * HSI_EVENT_START_RX - Incoming wake line high
 * HSI_EVENT_STOP_RX - Incoming wake line down
 *
 * Returns -errno on error, or 0 on success.
 */
int hsi_event(struct hsi_port *port, unsigned long event)
{}
EXPORT_SYMBOL_GPL();

/**
 * hsi_get_channel_id_by_name - acquire channel id by channel name
 * @cl: HSI client, which uses the channel
 * @name: name the channel is known under
 *
 * Clients can call this function to get the hsi channel ids similar to
 * requesting IRQs or GPIOs by name. This function assumes the same
 * channel configuration is used for RX and TX.
 *
 * Returns -errno on error or channel id on success.
 */
int hsi_get_channel_id_by_name(struct hsi_client *cl, char *name)
{}
EXPORT_SYMBOL_GPL();

static int __init hsi_init(void)
{}
postcore_initcall(hsi_init);

static void __exit hsi_exit(void)
{}
module_exit(hsi_exit);

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();