linux/drivers/mfd/intel_pmc_bxt.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Driver for the Intel Broxton PMC
 *
 * (C) Copyright 2014 - 2020 Intel Corporation
 *
 * This driver is based on Intel SCU IPC driver (intel_scu_ipc.c) by
 * Sreedhara DS <[email protected]>
 *
 * The PMC (Power Management Controller) running on the ARC processor
 * communicates with another entity running in the IA (Intel Architecture)
 * core through an IPC (Intel Processor Communications) mechanism which in
 * turn sends messages between the IA and the PMC.
 */

#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/io-64-nonatomic-lo-hi.h>
#include <linux/mfd/core.h>
#include <linux/mfd/intel_pmc_bxt.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/platform_data/itco_wdt.h>

#include <asm/intel_scu_ipc.h>

/* Residency with clock rate at 19.2MHz to usecs */
#define S0IX_RESIDENCY_IN_USECS(d, s)

/* Resources exported from IFWI */
#define PLAT_RESOURCE_IPC_INDEX
#define PLAT_RESOURCE_IPC_SIZE
#define PLAT_RESOURCE_GCR_OFFSET
#define PLAT_RESOURCE_GCR_SIZE
#define PLAT_RESOURCE_BIOS_DATA_INDEX
#define PLAT_RESOURCE_BIOS_IFACE_INDEX
#define PLAT_RESOURCE_TELEM_SSRAM_INDEX
#define PLAT_RESOURCE_ISP_DATA_INDEX
#define PLAT_RESOURCE_ISP_IFACE_INDEX
#define PLAT_RESOURCE_GTD_DATA_INDEX
#define PLAT_RESOURCE_GTD_IFACE_INDEX
#define PLAT_RESOURCE_ACPI_IO_INDEX

/*
 * BIOS does not create an ACPI device for each PMC function, but
 * exports multiple resources from one ACPI device (IPC) for multiple
 * functions. This driver is responsible for creating a child device and
 * to export resources for those functions.
 */
#define SMI_EN_OFFSET
#define SMI_EN_SIZE
#define TCO_BASE_OFFSET
#define TCO_REGS_SIZE
#define TELEM_SSRAM_SIZE
#define TELEM_PMC_SSRAM_OFFSET
#define TELEM_PUNIT_SSRAM_OFFSET

/* Commands */
#define PMC_NORTHPEAK_CTRL

static inline bool is_gcr_valid(u32 offset)
{}

/**
 * intel_pmc_gcr_read64() - Read a 64-bit PMC GCR register
 * @pmc: PMC device pointer
 * @offset: offset of GCR register from GCR address base
 * @data: data pointer for storing the register output
 *
 * Reads the 64-bit PMC GCR register at given offset.
 *
 * Return: Negative value on error or 0 on success.
 */
int intel_pmc_gcr_read64(struct intel_pmc_dev *pmc, u32 offset, u64 *data)
{}
EXPORT_SYMBOL_GPL();

/**
 * intel_pmc_gcr_update() - Update PMC GCR register bits
 * @pmc: PMC device pointer
 * @offset: offset of GCR register from GCR address base
 * @mask: bit mask for update operation
 * @val: update value
 *
 * Updates the bits of given GCR register as specified by
 * @mask and @val.
 *
 * Return: Negative value on error or 0 on success.
 */
int intel_pmc_gcr_update(struct intel_pmc_dev *pmc, u32 offset, u32 mask, u32 val)
{}
EXPORT_SYMBOL_GPL();

/**
 * intel_pmc_s0ix_counter_read() - Read S0ix residency
 * @pmc: PMC device pointer
 * @data: Out param that contains current S0ix residency count.
 *
 * Writes to @data how many usecs the system has been in low-power S0ix
 * state.
 *
 * Return: An error code or 0 on success.
 */
int intel_pmc_s0ix_counter_read(struct intel_pmc_dev *pmc, u64 *data)
{}
EXPORT_SYMBOL_GPL();

/**
 * simplecmd_store() - Send a simple IPC command
 * @dev: Device under the attribute is
 * @attr: Attribute in question
 * @buf: Buffer holding data to be stored to the attribute
 * @count: Number of bytes in @buf
 *
 * Expects a string with two integers separated with space. These two
 * values hold command and subcommand that is send to PMC.
 *
 * Return: Number number of bytes written (@count) or negative errno in
 *	   case of error.
 */
static ssize_t simplecmd_store(struct device *dev, struct device_attribute *attr,
			       const char *buf, size_t count)
{}
static DEVICE_ATTR_WO(simplecmd);

/**
 * northpeak_store() - Enable or disable Northpeak
 * @dev: Device under the attribute is
 * @attr: Attribute in question
 * @buf: Buffer holding data to be stored to the attribute
 * @count: Number of bytes in @buf
 *
 * Expects an unsigned integer. Non-zero enables Northpeak and zero
 * disables it.
 *
 * Return: Number number of bytes written (@count) or negative errno in
 *	   case of error.
 */
static ssize_t northpeak_store(struct device *dev, struct device_attribute *attr,
			       const char *buf, size_t count)
{}
static DEVICE_ATTR_WO(northpeak);

static struct attribute *intel_pmc_attrs[] =;

static const struct attribute_group intel_pmc_group =;

static const struct attribute_group *intel_pmc_groups[] =;

static struct resource punit_res[6];

static struct mfd_cell punit =;

static struct itco_wdt_platform_data tco_pdata =;

static struct resource tco_res[2];

static const struct mfd_cell tco =;

static const struct resource telem_res[] =;

static const struct mfd_cell telem =;

static int intel_pmc_get_tco_resources(struct platform_device *pdev)
{}

static int intel_pmc_get_resources(struct platform_device *pdev,
				   struct intel_pmc_dev *pmc,
				   struct intel_scu_ipc_data *scu_data)
{}

static int intel_pmc_create_devices(struct intel_pmc_dev *pmc)
{}

static const struct acpi_device_id intel_pmc_acpi_ids[] =;
MODULE_DEVICE_TABLE(acpi, intel_pmc_acpi_ids);

static int intel_pmc_probe(struct platform_device *pdev)
{}

static struct platform_driver intel_pmc_driver =;
module_platform_driver();

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