linux/drivers/extcon/extcon-max14577.c

// SPDX-License-Identifier: GPL-2.0+
//
// extcon-max14577.c - MAX14577/77836 extcon driver to support MUIC
//
// Copyright (C) 2013,2014 Samsung Electronics
// Chanwoo Choi <[email protected]>
// Krzysztof Kozlowski <[email protected]>

#include <linux/devm-helpers.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/mfd/max14577.h>
#include <linux/mfd/max14577-private.h>
#include <linux/extcon-provider.h>

#define DELAY_MS_DEFAULT

enum max14577_muic_adc_debounce_time {};

enum max14577_muic_status {};

/**
 * struct max14577_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 max14577_muic_irq {};

static struct max14577_muic_irq max14577_muic_irqs[] =;

static struct max14577_muic_irq max77836_muic_irqs[] =;

struct max14577_muic_info {};

enum max14577_muic_cable_group {};

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

static const unsigned int max14577_extcon_cable[] =;

/*
 * max14577_muic_set_debounce_time - Set the debounce time of ADC
 * @info: the instance including private data of max14577 MUIC
 * @time: the debounce time of ADC
 */
static int max14577_muic_set_debounce_time(struct max14577_muic_info *info,
		enum max14577_muic_adc_debounce_time time)
{
	u8 ret;

	switch (time) {
	case ADC_DEBOUNCE_TIME_5MS:
	case ADC_DEBOUNCE_TIME_10MS:
	case ADC_DEBOUNCE_TIME_25MS:
	case ADC_DEBOUNCE_TIME_38_62MS:
		ret = max14577_update_reg(info->max14577->regmap,
					  MAX14577_MUIC_REG_CONTROL3,
					  CTRL3_ADCDBSET_MASK,
					  time << CTRL3_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;
};

/*
 * max14577_muic_set_path - Set hardware line according to attached cable
 * @info: the instance including private data of max14577 MUIC
 * @value: the path according to attached cable
 * @attached: the state of cable (true:attached, false:detached)
 *
 * The max14577 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 max14577_muic_set_path(struct max14577_muic_info *info,
		u8 val, bool attached)
{}

/*
 * max14577_muic_get_cable_type - Return cable type and check cable state
 * @info: the instance including private data of max14577 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.
 *	- max14577_CABLE_GROUP_ADC
 *	- max14577_CABLE_GROUP_CHG
 */
static int max14577_muic_get_cable_type(struct max14577_muic_info *info,
		enum max14577_muic_cable_group group, bool *attached)
{}

static int max14577_muic_jig_handler(struct max14577_muic_info *info,
		int cable_type, bool attached)
{}

static int max14577_muic_adc_handler(struct max14577_muic_info *info)
{}

static int max14577_muic_chg_handler(struct max14577_muic_info *info)
{}

static void max14577_muic_irq_work(struct work_struct *work)
{}

/*
 * Sets irq_adc or irq_chg in max14577_muic_info and returns 1.
 * Returns 0 if irq_type does not match registered IRQ for this device type.
 */
static int max14577_parse_irq(struct max14577_muic_info *info, int irq_type)
{}

/*
 * Sets irq_adc or irq_chg in max14577_muic_info and returns 1.
 * Returns 0 if irq_type does not match registered IRQ for this device type.
 */
static int max77836_parse_irq(struct max14577_muic_info *info, int irq_type)
{}

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

static int max14577_muic_detect_accessory(struct max14577_muic_info *info)
{}

static void max14577_muic_detect_cable_wq(struct work_struct *work)
{}

static int max14577_muic_probe(struct platform_device *pdev)
{}

static const struct platform_device_id max14577_muic_id[] =;
MODULE_DEVICE_TABLE(platform, max14577_muic_id);

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

static struct platform_driver max14577_muic_driver =;

module_platform_driver();

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