linux/drivers/extcon/extcon-max77693.c

// SPDX-License-Identifier: GPL-2.0+
//
// extcon-max77693.c - MAX77693 extcon driver to support MAX77693 MUIC
//
// Copyright (C) 2012 Samsung Electrnoics
// Chanwoo Choi <[email protected]>

#include <linux/devm-helpers.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/mfd/max77693.h>
#include <linux/mfd/max77693-common.h>
#include <linux/mfd/max77693-private.h>
#include <linux/extcon-provider.h>
#include <linux/regmap.h>
#include <linux/irqdomain.h>

#define DEV_NAME
#define DELAY_MS_DEFAULT

/*
 * Default value of MAX77693 register to bring up MUIC device.
 * If user don't set some initial value for MUIC device through platform data,
 * extcon-max77693 driver use 'default_init_data' to bring up base operation
 * of MAX77693 MUIC device.
 */
static struct max77693_reg_data default_init_data[] =;

enum max77693_muic_adc_debounce_time {};

struct max77693_muic_info {};

enum max77693_muic_cable_group {};

enum max77693_muic_charger_type {};

/**
 * struct max77693_muic_irq
 * @irq: the index of irq list of MUIC device.
 * @name: the name of irq.
 * @virq: the virtual irq to use irq domain
 */
struct max77693_muic_irq {};

static struct max77693_muic_irq muic_irqs[] =;

/* Define supported accessory type */
enum max77693_muic_acc_type {};

/*
 * MAX77693 MUIC device support below list of accessories(external connector)
 */
static const unsigned int max77693_extcon_cable[] =;

/*
 * max77693_muic_set_debounce_time - Set the debounce time of ADC
 * @info: the instance including private data of max77693 MUIC
 * @time: the debounce time of ADC
 */
static int max77693_muic_set_debounce_time(struct max77693_muic_info *info,
		enum max77693_muic_adc_debounce_time time)
{
	int ret;

	switch (time) {
	case ADC_DEBOUNCE_TIME_5MS:
	case ADC_DEBOUNCE_TIME_10MS:
	case ADC_DEBOUNCE_TIME_25MS:
	case ADC_DEBOUNCE_TIME_38_62MS:
		/*
		 * Don't touch BTLDset, JIGset when you want to change adc
		 * debounce time. If it writes other than 0 to BTLDset, JIGset
		 * muic device will be reset and loose current state.
		 */
		ret = regmap_write(info->max77693->regmap_muic,
				  MAX77693_MUIC_REG_CTRL3,
				  time << MAX77693_CONTROL3_ADCDBSET_SHIFT);
		if (ret) {
			dev_err(info->dev, "failed to set ADC debounce time\n");
			return ret;
		}
		break;
	default:
		dev_err(info->dev, "invalid ADC debounce time\n");
		return -EINVAL;
	}

	return 0;
};

/*
 * max77693_muic_set_path - Set hardware line according to attached cable
 * @info: the instance including private data of max77693 MUIC
 * @value: the path according to attached cable
 * @attached: the state of cable (true:attached, false:detached)
 *
 * The max77693 MUIC device share outside H/W line among a varity of cables
 * so, this function set internal path of H/W line according to the type of
 * attached cable.
 */
static int max77693_muic_set_path(struct max77693_muic_info *info,
		u8 val, bool attached)
{}

/*
 * max77693_muic_get_cable_type - Return cable type and check cable state
 * @info: the instance including private data of max77693 MUIC
 * @group: the path according to attached cable
 * @attached: store cable state and return
 *
 * This function check the cable state either attached or detached,
 * and then divide precise type of cable according to cable group.
 *	- MAX77693_CABLE_GROUP_ADC
 *	- MAX77693_CABLE_GROUP_ADC_GND
 *	- MAX77693_CABLE_GROUP_CHG
 *	- MAX77693_CABLE_GROUP_VBVOLT
 */
static int max77693_muic_get_cable_type(struct max77693_muic_info *info,
		enum max77693_muic_cable_group group, bool *attached)
{}

static int max77693_muic_dock_handler(struct max77693_muic_info *info,
		int cable_type, bool attached)
{}

static int max77693_muic_dock_button_handler(struct max77693_muic_info *info,
		int button_type, bool attached)
{}

static int max77693_muic_adc_ground_handler(struct max77693_muic_info *info)
{}

static int max77693_muic_jig_handler(struct max77693_muic_info *info,
		int cable_type, bool attached)
{}

static int max77693_muic_adc_handler(struct max77693_muic_info *info)
{}

static int max77693_muic_chg_handler(struct max77693_muic_info *info)
{}

static void max77693_muic_irq_work(struct work_struct *work)
{}

static irqreturn_t max77693_muic_irq_handler(int irq, void *data)
{}

static const struct regmap_config max77693_muic_regmap_config =;

static int max77693_muic_detect_accessory(struct max77693_muic_info *info)
{}

static void max77693_muic_detect_cable_wq(struct work_struct *work)
{}

static int max77693_muic_probe(struct platform_device *pdev)
{}

static const struct of_device_id of_max77693_muic_dt_match[] =;
MODULE_DEVICE_TABLE(of, of_max77693_muic_dt_match);

static struct platform_driver max77693_muic_driver =;

module_platform_driver();

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