linux/drivers/phy/ti/phy-tusb1210.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * tusb1210.c - TUSB1210 USB ULPI PHY driver
 *
 * Copyright (C) 2015 Intel Corporation
 *
 * Author: Heikki Krogerus <[email protected]>
 */
#include <linux/module.h>
#include <linux/bitfield.h>
#include <linux/delay.h>
#include <linux/ulpi/driver.h>
#include <linux/ulpi/regs.h>
#include <linux/gpio/consumer.h>
#include <linux/phy/ulpi_phy.h>
#include <linux/power_supply.h>
#include <linux/property.h>
#include <linux/workqueue.h>

#define TI_VENDOR_ID
#define TI_DEVICE_TUSB1210
#define TI_DEVICE_TUSB1211

#define TUSB1211_POWER_CONTROL
#define TUSB1211_POWER_CONTROL_SET
#define TUSB1211_POWER_CONTROL_CLEAR
#define TUSB1211_POWER_CONTROL_SW_CONTROL
#define TUSB1211_POWER_CONTROL_DET_COMP
#define TUSB1211_POWER_CONTROL_DP_VSRC_EN

#define TUSB1210_VENDOR_SPECIFIC2
#define TUSB1210_VENDOR_SPECIFIC2_IHSTX_MASK
#define TUSB1210_VENDOR_SPECIFIC2_ZHSDRV_MASK
#define TUSB1210_VENDOR_SPECIFIC2_DP_MASK

#define TUSB1211_VENDOR_SPECIFIC3
#define TUSB1211_VENDOR_SPECIFIC3_SET
#define TUSB1211_VENDOR_SPECIFIC3_CLEAR
#define TUSB1211_VENDOR_SPECIFIC3_SW_USB_DET
#define TUSB1211_VENDOR_SPECIFIC3_CHGD_IDP_SRC_EN

#define TUSB1210_RESET_TIME_MS

#define TUSB1210_CHG_DET_MAX_RETRIES

/* TUSB1210 charger detection work states */
enum tusb1210_chg_det_state {};

struct tusb1210 {};

static int tusb1210_ulpi_write(struct tusb1210 *tusb, u8 reg, u8 val)
{}

static int tusb1210_ulpi_read(struct tusb1210 *tusb, u8 reg, u8 *val)
{}

static int tusb1210_power_on(struct phy *phy)
{}

static int tusb1210_power_off(struct phy *phy)
{}

static int tusb1210_set_mode(struct phy *phy, enum phy_mode mode, int submode)
{}

#ifdef CONFIG_POWER_SUPPLY
static const char * const tusb1210_chg_det_states[] =;

static void tusb1210_reset(struct tusb1210 *tusb)
{}

static void tusb1210_chg_det_set_type(struct tusb1210 *tusb,
				      enum power_supply_usb_type type)
{}

static void tusb1210_chg_det_set_state(struct tusb1210 *tusb,
				       enum tusb1210_chg_det_state new_state,
				       int delay_ms)
{}

static void tusb1210_chg_det_handle_ulpi_error(struct tusb1210 *tusb)
{}

/*
 * Boards using a TUSB121x for charger-detection have 3 power_supply class devs:
 *
 * tusb1211-charger-detect(1) -> charger -> fuel-gauge
 *
 * To determine if an USB charger is connected to the board, the online prop of
 * the charger psy needs to be read. Since the tusb1211-charger-detect psy is
 * the start of the supplier -> supplied-to chain, power_supply_am_i_supplied()
 * cannot be used here.
 *
 * Instead, below is a list of the power_supply names of known chargers for
 * these boards and the charger psy is looked up by name from this list.
 *
 * (1) modelling the external USB charger
 */
static const char * const tusb1210_chargers[] =;

static bool tusb1210_get_online(struct tusb1210 *tusb)
{}

static void tusb1210_chg_det_work(struct work_struct *work)
{}

static int tusb1210_psy_notifier(struct notifier_block *nb,
	unsigned long event, void *ptr)
{}

static int tusb1210_psy_get_prop(struct power_supply *psy,
				 enum power_supply_property psp,
				 union power_supply_propval *val)
{}

static const enum power_supply_property tusb1210_psy_props[] =;

static const struct power_supply_desc tusb1210_psy_desc =;

/* Setup charger detection if requested, on errors continue without chg-det */
static void tusb1210_probe_charger_detect(struct tusb1210 *tusb)
{}

static void tusb1210_remove_charger_detect(struct tusb1210 *tusb)
{}
#else
static void tusb1210_probe_charger_detect(struct tusb1210 *tusb) { }
static void tusb1210_remove_charger_detect(struct tusb1210 *tusb) { }
#endif

static const struct phy_ops phy_ops =;

static int tusb1210_probe(struct ulpi *ulpi)
{}

static void tusb1210_remove(struct ulpi *ulpi)
{}

static const struct ulpi_device_id tusb1210_ulpi_id[] =;
MODULE_DEVICE_TABLE(ulpi, tusb1210_ulpi_id);

static struct ulpi_driver tusb1210_driver =;

module_ulpi_driver();

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