linux/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
 */

#include <linux/gpio/driver.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/types.h>

#include <linux/pinctrl/pinconf-generic.h>
#include <linux/pinctrl/pinconf.h>
#include <linux/pinctrl/pinmux.h>

#include <dt-bindings/pinctrl/qcom,pmic-mpp.h>

#include "../core.h"
#include "../pinctrl-utils.h"

#define PMIC_MPP_ADDRESS_RANGE

/*
 * Pull Up Values - it indicates whether a pull-up should be
 * applied for bidirectional mode only. The hardware ignores the
 * configuration when operating in other modes.
 */
#define PMIC_MPP_PULL_UP_0P6KOHM
#define PMIC_MPP_PULL_UP_10KOHM
#define PMIC_MPP_PULL_UP_30KOHM
#define PMIC_MPP_PULL_UP_OPEN

/* type registers base address bases */
#define PMIC_MPP_REG_TYPE
#define PMIC_MPP_REG_SUBTYPE

/* mpp peripheral type and subtype values */
#define PMIC_MPP_TYPE
#define PMIC_MPP_SUBTYPE_4CH_NO_ANA_OUT
#define PMIC_MPP_SUBTYPE_ULT_4CH_NO_ANA_OUT
#define PMIC_MPP_SUBTYPE_4CH_NO_SINK
#define PMIC_MPP_SUBTYPE_ULT_4CH_NO_SINK
#define PMIC_MPP_SUBTYPE_4CH_FULL_FUNC
#define PMIC_MPP_SUBTYPE_8CH_FULL_FUNC

#define PMIC_MPP_REG_RT_STS
#define PMIC_MPP_REG_RT_STS_VAL_MASK

/* control register base address bases */
#define PMIC_MPP_REG_MODE_CTL
#define PMIC_MPP_REG_DIG_VIN_CTL
#define PMIC_MPP_REG_DIG_PULL_CTL
#define PMIC_MPP_REG_DIG_IN_CTL
#define PMIC_MPP_REG_EN_CTL
#define PMIC_MPP_REG_AOUT_CTL
#define PMIC_MPP_REG_AIN_CTL
#define PMIC_MPP_REG_SINK_CTL

/* PMIC_MPP_REG_MODE_CTL */
#define PMIC_MPP_REG_MODE_VALUE_MASK
#define PMIC_MPP_REG_MODE_FUNCTION_SHIFT
#define PMIC_MPP_REG_MODE_FUNCTION_MASK
#define PMIC_MPP_REG_MODE_DIR_SHIFT
#define PMIC_MPP_REG_MODE_DIR_MASK

/* PMIC_MPP_REG_DIG_VIN_CTL */
#define PMIC_MPP_REG_VIN_SHIFT
#define PMIC_MPP_REG_VIN_MASK

/* PMIC_MPP_REG_DIG_PULL_CTL */
#define PMIC_MPP_REG_PULL_SHIFT
#define PMIC_MPP_REG_PULL_MASK

/* PMIC_MPP_REG_EN_CTL */
#define PMIC_MPP_REG_MASTER_EN_SHIFT

/* PMIC_MPP_REG_AIN_CTL */
#define PMIC_MPP_REG_AIN_ROUTE_SHIFT
#define PMIC_MPP_REG_AIN_ROUTE_MASK

#define PMIC_MPP_MODE_DIGITAL_INPUT
#define PMIC_MPP_MODE_DIGITAL_OUTPUT
#define PMIC_MPP_MODE_DIGITAL_BIDIR
#define PMIC_MPP_MODE_ANALOG_BIDIR
#define PMIC_MPP_MODE_ANALOG_INPUT
#define PMIC_MPP_MODE_ANALOG_OUTPUT
#define PMIC_MPP_MODE_CURRENT_SINK

#define PMIC_MPP_SELECTOR_NORMAL
#define PMIC_MPP_SELECTOR_PAIRED
#define PMIC_MPP_SELECTOR_DTEST_FIRST

#define PMIC_MPP_PHYSICAL_OFFSET

/* Qualcomm specific pin configurations */
#define PMIC_MPP_CONF_AMUX_ROUTE
#define PMIC_MPP_CONF_ANALOG_LEVEL
#define PMIC_MPP_CONF_DTEST_SELECTOR
#define PMIC_MPP_CONF_PAIRED

/**
 * struct pmic_mpp_pad - keep current MPP settings
 * @base: Address base in SPMI device.
 * @is_enabled: Set to false when MPP should be put in high Z state.
 * @out_value: Cached pin output value.
 * @output_enabled: Set to true if MPP output logic is enabled.
 * @input_enabled: Set to true if MPP input buffer logic is enabled.
 * @paired: Pin operates in paired mode
 * @has_pullup: Pin has support to configure pullup
 * @num_sources: Number of power-sources supported by this MPP.
 * @power_source: Current power-source used.
 * @amux_input: Set the source for analog input.
 * @aout_level: Analog output level
 * @pullup: Pullup resistor value. Valid in Bidirectional mode only.
 * @function: See pmic_mpp_functions[].
 * @drive_strength: Amount of current in sink mode
 * @dtest: DTEST route selector
 */
struct pmic_mpp_pad {};

struct pmic_mpp_state {};

static const struct pinconf_generic_params pmic_mpp_bindings[] =;

#ifdef CONFIG_DEBUG_FS
static const struct pin_config_item pmic_conf_items[] =;
#endif

static const char *const pmic_mpp_groups[] =;

#define PMIC_MPP_DIGITAL
#define PMIC_MPP_ANALOG
#define PMIC_MPP_SINK

static const char *const pmic_mpp_functions[] =;

static int pmic_mpp_read(struct pmic_mpp_state *state,
			 struct pmic_mpp_pad *pad, unsigned int addr)
{}

static int pmic_mpp_write(struct pmic_mpp_state *state,
			  struct pmic_mpp_pad *pad, unsigned int addr,
			  unsigned int val)
{}

static int pmic_mpp_get_groups_count(struct pinctrl_dev *pctldev)
{}

static const char *pmic_mpp_get_group_name(struct pinctrl_dev *pctldev,
					   unsigned pin)
{}

static int pmic_mpp_get_group_pins(struct pinctrl_dev *pctldev,
				   unsigned pin,
				   const unsigned **pins, unsigned *num_pins)
{}

static const struct pinctrl_ops pmic_mpp_pinctrl_ops =;

static int pmic_mpp_get_functions_count(struct pinctrl_dev *pctldev)
{}

static const char *pmic_mpp_get_function_name(struct pinctrl_dev *pctldev,
					      unsigned function)
{}

static int pmic_mpp_get_function_groups(struct pinctrl_dev *pctldev,
					unsigned function,
					const char *const **groups,
					unsigned *const num_qgroups)
{}

static int pmic_mpp_write_mode_ctl(struct pmic_mpp_state *state,
				   struct pmic_mpp_pad *pad)
{}

static int pmic_mpp_set_mux(struct pinctrl_dev *pctldev, unsigned function,
				unsigned pin)
{}

static const struct pinmux_ops pmic_mpp_pinmux_ops =;

static int pmic_mpp_config_get(struct pinctrl_dev *pctldev,
			       unsigned int pin, unsigned long *config)
{}

static int pmic_mpp_config_set(struct pinctrl_dev *pctldev, unsigned int pin,
			       unsigned long *configs, unsigned nconfs)
{}

static void pmic_mpp_config_dbg_show(struct pinctrl_dev *pctldev,
				     struct seq_file *s, unsigned pin)
{}

static const struct pinconf_ops pmic_mpp_pinconf_ops =;

static int pmic_mpp_direction_input(struct gpio_chip *chip, unsigned pin)
{}

static int pmic_mpp_direction_output(struct gpio_chip *chip,
				     unsigned pin, int val)
{}

static int pmic_mpp_get(struct gpio_chip *chip, unsigned pin)
{}

static void pmic_mpp_set(struct gpio_chip *chip, unsigned pin, int value)
{}

static int pmic_mpp_of_xlate(struct gpio_chip *chip,
			     const struct of_phandle_args *gpio_desc,
			     u32 *flags)
{}

static void pmic_mpp_dbg_show(struct seq_file *s, struct gpio_chip *chip)
{}

static const struct gpio_chip pmic_mpp_gpio_template =;

static int pmic_mpp_populate(struct pmic_mpp_state *state,
			     struct pmic_mpp_pad *pad)
{}

static int pmic_mpp_domain_translate(struct irq_domain *domain,
				      struct irq_fwspec *fwspec,
				      unsigned long *hwirq,
				      unsigned int *type)
{}

static unsigned int pmic_mpp_child_offset_to_irq(struct gpio_chip *chip,
						  unsigned int offset)
{}

static int pmic_mpp_child_to_parent_hwirq(struct gpio_chip *chip,
					   unsigned int child_hwirq,
					   unsigned int child_type,
					   unsigned int *parent_hwirq,
					   unsigned int *parent_type)
{}

static void pmic_mpp_irq_mask(struct irq_data *d)
{}

static void pmic_mpp_irq_unmask(struct irq_data *d)
{}

static const struct irq_chip pmic_mpp_irq_chip =;

static int pmic_mpp_probe(struct platform_device *pdev)
{}

static void pmic_mpp_remove(struct platform_device *pdev)
{}

static const struct of_device_id pmic_mpp_of_match[] =;

MODULE_DEVICE_TABLE(of, pmic_mpp_of_match);

static struct platform_driver pmic_mpp_driver =;

module_platform_driver();

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