linux/drivers/media/common/siano/smscoreapi.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *  Siano core API module
 *
 *  This file contains implementation for the interface to sms core component
 *
 *  author: Uri Shkolnik
 *
 *  Copyright (c), 2005-2008 Siano Mobile Silicon, Inc.
 */

#include "smscoreapi.h"

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/dma-mapping.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/slab.h>

#include <linux/firmware.h>
#include <linux/wait.h>
#include <asm/byteorder.h>

#include "sms-cards.h"
#include "smsir.h"

struct smscore_device_notifyee_t {};

struct smscore_idlist_t {};

struct smscore_client_t {};

static char *siano_msgs[] =;

char *smscore_translate_msg(enum msg_types msgtype)
{}
EXPORT_SYMBOL_GPL();

void smscore_set_board_id(struct smscore_device_t *core, int id)
{}

int smscore_led_state(struct smscore_device_t *core, int led)
{}
EXPORT_SYMBOL_GPL();

int smscore_get_board_id(struct smscore_device_t *core)
{}
EXPORT_SYMBOL_GPL();

struct smscore_registry_entry_t {};

static struct list_head g_smscore_notifyees;
static struct list_head g_smscore_devices;
static DEFINE_MUTEX(g_smscore_deviceslock);

static struct list_head g_smscore_registry;
static DEFINE_MUTEX(g_smscore_registrylock);

static int default_mode =;

module_param(default_mode, int, 0644);
MODULE_PARM_DESC();

static struct smscore_registry_entry_t *smscore_find_registry(char *devpath)
{}

int smscore_registry_getmode(char *devpath)
{}
EXPORT_SYMBOL_GPL();

static enum sms_device_type_st smscore_registry_gettype(char *devpath)
{}

static void smscore_registry_setmode(char *devpath, int mode)
{}

static void smscore_registry_settype(char *devpath,
				     enum sms_device_type_st type)
{}


static void list_add_locked(struct list_head *new, struct list_head *head,
			    spinlock_t *lock)
{}

/*
 * register a client callback that called when device plugged in/unplugged
 * NOTE: if devices exist callback is called immediately for each device
 *
 * @param hotplug callback
 *
 * return: 0 on success, <0 on error.
 */
int smscore_register_hotplug(hotplug_t hotplug)
{}
EXPORT_SYMBOL_GPL();

/*
 * unregister a client callback that called when device plugged in/unplugged
 *
 * @param hotplug callback
 *
 */
void smscore_unregister_hotplug(hotplug_t hotplug)
{}
EXPORT_SYMBOL_GPL();

static void smscore_notify_clients(struct smscore_device_t *coredev)
{}

static int smscore_notify_callbacks(struct smscore_device_t *coredev,
				    struct device *device, int arrival)
{}

static struct
smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer,
				       dma_addr_t common_buffer_phys)
{}

/*
 * creates coredev object for a device, prepares buffers,
 * creates buffer mappings, notifies registered hotplugs about new device.
 *
 * @param params device pointer to struct with device specific parameters
 *               and handlers
 * @param coredev pointer to a value that receives created coredev object
 *
 * return: 0 on success, <0 on error.
 */
int smscore_register_device(struct smsdevice_params_t *params,
			    struct smscore_device_t **coredev,
			    gfp_t gfp_buf_flags,
			    void *mdev)
{}
EXPORT_SYMBOL_GPL();


static int smscore_sendrequest_and_wait(struct smscore_device_t *coredev,
		void *buffer, size_t size, struct completion *completion) {}

/*
 * Starts & enables IR operations
 *
 * return: 0 on success, < 0 on error.
 */
static int smscore_init_ir(struct smscore_device_t *coredev)
{}

/*
 * configures device features according to board configuration structure.
 *
 * @param coredev pointer to a coredev object returned by
 *                smscore_register_device
 *
 * return: 0 on success, <0 on error.
 */
static int smscore_configure_board(struct smscore_device_t *coredev)
{}

/*
 * sets initial device mode and notifies client hotplugs that device is ready
 *
 * @param coredev pointer to a coredev object returned by
 *		  smscore_register_device
 *
 * return: 0 on success, <0 on error.
 */
int smscore_start_device(struct smscore_device_t *coredev)
{}
EXPORT_SYMBOL_GPL();


static int smscore_load_firmware_family2(struct smscore_device_t *coredev,
					 void *buffer, size_t size)
{}

static char *smscore_fw_lkup[][DEVICE_MODE_MAX] =;

/*
 * get firmware file name from one of the two mechanisms : sms_boards or
 * smscore_fw_lkup.
 * @param coredev pointer to a coredev object returned by
 *		  smscore_register_device
 * @param mode requested mode of operation
 * @param lookup if 1, always get the fw filename from smscore_fw_lkup
 *	 table. if 0, try first to get from sms_boards
 *
 * return: 0 on success, <0 on error.
 */
static char *smscore_get_fw_filename(struct smscore_device_t *coredev,
			      int mode)
{}

/*
 * loads specified firmware into a buffer and calls device loadfirmware_handler
 *
 * @param coredev pointer to a coredev object returned by
 *                smscore_register_device
 * @param filename null-terminated string specifies firmware file name
 * @param loadfirmware_handler device handler that loads firmware
 *
 * return: 0 on success, <0 on error.
 */
static int smscore_load_firmware_from_file(struct smscore_device_t *coredev,
					   int mode)
{}

/*
 * notifies all clients registered with the device, notifies hotplugs,
 * frees all buffers and coredev object
 *
 * @param coredev pointer to a coredev object returned by
 *                smscore_register_device
 *
 * return: 0 on success, <0 on error.
 */
void smscore_unregister_device(struct smscore_device_t *coredev)
{}
EXPORT_SYMBOL_GPL();

static int smscore_detect_mode(struct smscore_device_t *coredev)
{}

/*
 * send init device request and wait for response
 *
 * @param coredev pointer to a coredev object returned by
 *                smscore_register_device
 * @param mode requested mode of operation
 *
 * return: 0 on success, <0 on error.
 */
static int smscore_init_device(struct smscore_device_t *coredev, int mode)
{}

/*
 * calls device handler to change mode of operation
 * NOTE: stellar/usb may disconnect when changing mode
 *
 * @param coredev pointer to a coredev object returned by
 *                smscore_register_device
 * @param mode requested mode of operation
 *
 * return: 0 on success, <0 on error.
 */
int smscore_set_device_mode(struct smscore_device_t *coredev, int mode)
{}

/*
 * calls device handler to get current mode of operation
 *
 * @param coredev pointer to a coredev object returned by
 *                smscore_register_device
 *
 * return: current mode
 */
int smscore_get_device_mode(struct smscore_device_t *coredev)
{}
EXPORT_SYMBOL_GPL();

/*
 * find client by response id & type within the clients list.
 * return client handle or NULL.
 *
 * @param coredev pointer to a coredev object returned by
 *                smscore_register_device
 * @param data_type client data type (SMS_DONT_CARE for all types)
 * @param id client id (SMS_DONT_CARE for all id)
 *
 */
static struct
smscore_client_t *smscore_find_client(struct smscore_device_t *coredev,
				      int data_type, int id)
{}

/*
 * find client by response id/type, call clients onresponse handler
 * return buffer to pool on error
 *
 * @param coredev pointer to a coredev object returned by
 *                smscore_register_device
 * @param cb pointer to response buffer descriptor
 *
 */
void smscore_onresponse(struct smscore_device_t *coredev,
		struct smscore_buffer_t *cb) {}
EXPORT_SYMBOL_GPL();

/*
 * return pointer to next free buffer descriptor from core pool
 *
 * @param coredev pointer to a coredev object returned by
 *                smscore_register_device
 *
 * return: pointer to descriptor on success, NULL on error.
 */

static struct smscore_buffer_t *get_entry(struct smscore_device_t *coredev)
{}

struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev)
{}
EXPORT_SYMBOL_GPL();

/*
 * return buffer descriptor to a pool
 *
 * @param coredev pointer to a coredev object returned by
 *                smscore_register_device
 * @param cb pointer buffer descriptor
 *
 */
void smscore_putbuffer(struct smscore_device_t *coredev,
		struct smscore_buffer_t *cb) {}
EXPORT_SYMBOL_GPL();

static int smscore_validate_client(struct smscore_device_t *coredev,
				   struct smscore_client_t *client,
				   int data_type, int id)
{}

/*
 * creates smsclient object, check that id is taken by another client
 *
 * @param coredev pointer to a coredev object from clients hotplug
 * @param initial_id all messages with this id would be sent to this client
 * @param data_type all messages of this type would be sent to this client
 * @param onresponse_handler client handler that is called to
 *                           process incoming messages
 * @param onremove_handler client handler that is called when device is removed
 * @param context client-specific context
 * @param client pointer to a value that receives created smsclient object
 *
 * return: 0 on success, <0 on error.
 */
int smscore_register_client(struct smscore_device_t *coredev,
			    struct smsclient_params_t *params,
			    struct smscore_client_t **client)
{}
EXPORT_SYMBOL_GPL();

/*
 * frees smsclient object and all subclients associated with it
 *
 * @param client pointer to smsclient object returned by
 *               smscore_register_client
 *
 */
void smscore_unregister_client(struct smscore_client_t *client)
{}
EXPORT_SYMBOL_GPL();

/*
 * verifies that source id is not taken by another client,
 * calls device handler to send requests to the device
 *
 * @param client pointer to smsclient object returned by
 *               smscore_register_client
 * @param buffer pointer to a request buffer
 * @param size size (in bytes) of request buffer
 *
 * return: 0 on success, <0 on error.
 */
int smsclient_sendrequest(struct smscore_client_t *client,
			  void *buffer, size_t size)
{}
EXPORT_SYMBOL_GPL();


/* old GPIO managements implementation */
int smscore_configure_gpio(struct smscore_device_t *coredev, u32 pin,
			   struct smscore_config_gpio *pinconfig)
{}

int smscore_set_gpio(struct smscore_device_t *coredev, u32 pin, int level)
{}

/* new GPIO management implementation */
static int get_gpio_pin_params(u32 pin_num, u32 *p_translatedpin_num,
		u32 *p_group_num, u32 *p_group_cfg) {}

int smscore_gpio_configure(struct smscore_device_t *coredev, u8 pin_num,
		struct smscore_config_gpio *p_gpio_config) {}

int smscore_gpio_set_level(struct smscore_device_t *coredev, u8 pin_num,
		u8 new_level) {}

int smscore_gpio_get_level(struct smscore_device_t *coredev, u8 pin_num,
		u8 *level) {}

static int __init smscore_module_init(void)
{}

static void __exit smscore_module_exit(void)
{}

module_init();
module_exit(smscore_module_exit);

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

/* This should match what's defined at smscoreapi.h */
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();