linux/drivers/greybus/interface.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Greybus interface code
 *
 * Copyright 2014 Google Inc.
 * Copyright 2014 Linaro Ltd.
 */

#include <linux/delay.h>
#include <linux/greybus.h>

#include "greybus_trace.h"

#define GB_INTERFACE_MODE_SWITCH_TIMEOUT

#define GB_INTERFACE_DEVICE_ID_BAD

#define GB_INTERFACE_AUTOSUSPEND_MS

/* Time required for interface to enter standby before disabling REFCLK */
#define GB_INTERFACE_SUSPEND_HIBERNATE_DELAY_MS

/* Don't-care selector index */
#define DME_SELECTOR_INDEX_NULL

/* DME attributes */
/* FIXME: remove ES2 support and DME_T_TST_SRC_INCREMENT */
#define DME_T_TST_SRC_INCREMENT

#define DME_DDBL1_MANUFACTURERID
#define DME_DDBL1_PRODUCTID

#define DME_TOSHIBA_GMP_VID
#define DME_TOSHIBA_GMP_PID
#define DME_TOSHIBA_GMP_SN0
#define DME_TOSHIBA_GMP_SN1
#define DME_TOSHIBA_GMP_INIT_STATUS

/* DDBL1 Manufacturer and Product ids */
#define TOSHIBA_DMID
#define TOSHIBA_ES2_BRIDGE_DPID
#define TOSHIBA_ES3_APBRIDGE_DPID
#define TOSHIBA_ES3_GBPHY_DPID

static int gb_interface_hibernate_link(struct gb_interface *intf);
static int gb_interface_refclk_set(struct gb_interface *intf, bool enable);

static int gb_interface_dme_attr_get(struct gb_interface *intf,
				     u16 attr, u32 *val)
{}

static int gb_interface_read_ara_dme(struct gb_interface *intf)
{}

static int gb_interface_read_dme(struct gb_interface *intf)
{}

static int gb_interface_route_create(struct gb_interface *intf)
{}

static void gb_interface_route_destroy(struct gb_interface *intf)
{}

/* Locking: Caller holds the interface mutex. */
static int gb_interface_legacy_mode_switch(struct gb_interface *intf)
{}

void gb_interface_mailbox_event(struct gb_interface *intf, u16 result,
				u32 mailbox)
{}

static void gb_interface_mode_switch_work(struct work_struct *work)
{}

int gb_interface_request_mode_switch(struct gb_interface *intf)
{}
EXPORT_SYMBOL_GPL();

/*
 * T_TstSrcIncrement is written by the module on ES2 as a stand-in for the
 * init-status attribute DME_TOSHIBA_INIT_STATUS. The AP needs to read and
 * clear it after reading a non-zero value from it.
 *
 * FIXME: This is module-hardware dependent and needs to be extended for every
 * type of module we want to support.
 */
static int gb_interface_read_and_clear_init_status(struct gb_interface *intf)
{}

/* interface sysfs attributes */
#define gb_interface_attr(field, type)

gb_interface_attr();
gb_interface_attr();
gb_interface_attr();
gb_interface_attr();
gb_interface_attr();
gb_interface_attr();

static ssize_t voltage_now_show(struct device *dev,
				struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(voltage_now);

static ssize_t current_now_show(struct device *dev,
				struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(current_now);

static ssize_t power_now_show(struct device *dev,
			      struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(power_now);

static ssize_t power_state_show(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

static ssize_t power_state_store(struct device *dev,
				 struct device_attribute *attr, const char *buf,
				 size_t len)
{}
static DEVICE_ATTR_RW(power_state);

static const char *gb_interface_type_string(struct gb_interface *intf)
{}

static ssize_t interface_type_show(struct device *dev,
				   struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(interface_type);

static struct attribute *interface_unipro_attrs[] =;

static struct attribute *interface_greybus_attrs[] =;

static struct attribute *interface_power_attrs[] =;

static struct attribute *interface_common_attrs[] =;

static umode_t interface_unipro_is_visible(struct kobject *kobj,
					   struct attribute *attr, int n)
{}

static umode_t interface_greybus_is_visible(struct kobject *kobj,
					    struct attribute *attr, int n)
{}

static umode_t interface_power_is_visible(struct kobject *kobj,
					  struct attribute *attr, int n)
{}

static const struct attribute_group interface_unipro_group =;

static const struct attribute_group interface_greybus_group =;

static const struct attribute_group interface_power_group =;

static const struct attribute_group interface_common_group =;

static const struct attribute_group *interface_groups[] =;

static void gb_interface_release(struct device *dev)
{}

#ifdef CONFIG_PM
static int gb_interface_suspend(struct device *dev)
{}

static int gb_interface_resume(struct device *dev)
{}

static int gb_interface_runtime_idle(struct device *dev)
{}
#endif

static const struct dev_pm_ops gb_interface_pm_ops =;

const struct device_type greybus_interface_type =;

/*
 * A Greybus module represents a user-replaceable component on a GMP
 * phone.  An interface is the physical connection on that module.  A
 * module may have more than one interface.
 *
 * Create a gb_interface structure to represent a discovered interface.
 * The position of interface within the Endo is encoded in "interface_id"
 * argument.
 *
 * Returns a pointer to the new interfce or a null pointer if a
 * failure occurs due to memory exhaustion.
 */
struct gb_interface *gb_interface_create(struct gb_module *module,
					 u8 interface_id)
{}

static int gb_interface_vsys_set(struct gb_interface *intf, bool enable)
{}

static int gb_interface_refclk_set(struct gb_interface *intf, bool enable)
{}

static int gb_interface_unipro_set(struct gb_interface *intf, bool enable)
{}

static int gb_interface_activate_operation(struct gb_interface *intf,
					   enum gb_interface_type *intf_type)
{}

static int gb_interface_hibernate_link(struct gb_interface *intf)
{}

static int _gb_interface_activate(struct gb_interface *intf,
				  enum gb_interface_type *type)
{}

/*
 * At present, we assume a UniPro-only module to be a Greybus module that
 * failed to send its mailbox poke. There is some reason to believe that this
 * is because of a bug in the ES3 bootrom.
 *
 * FIXME: Check if this is a Toshiba bridge before retrying?
 */
static int _gb_interface_activate_es3_hack(struct gb_interface *intf,
					   enum gb_interface_type *type)
{}

/*
 * Activate an interface.
 *
 * Locking: Caller holds the interface mutex.
 */
int gb_interface_activate(struct gb_interface *intf)
{}

/*
 * Deactivate an interface.
 *
 * Locking: Caller holds the interface mutex.
 */
void gb_interface_deactivate(struct gb_interface *intf)
{}

/*
 * Enable an interface by enabling its control connection, fetching the
 * manifest and other information over it, and finally registering its child
 * devices.
 *
 * Locking: Caller holds the interface mutex.
 */
int gb_interface_enable(struct gb_interface *intf)
{}

/*
 * Disable an interface and destroy its bundles.
 *
 * Locking: Caller holds the interface mutex.
 */
void gb_interface_disable(struct gb_interface *intf)
{}

/* Register an interface. */
int gb_interface_add(struct gb_interface *intf)
{}

/* Deregister an interface. */
void gb_interface_del(struct gb_interface *intf)
{}

void gb_interface_put(struct gb_interface *intf)
{}