linux/drivers/usb/misc/usb251xb.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Driver for Microchip USB251xB USB 2.0 Hi-Speed Hub Controller
 * Configuration via SMBus.
 *
 * Copyright (c) 2017 SKIDATA AG
 *
 * This work is based on the USB3503 driver by Dongjin Kim and
 * a not-accepted patch by Fabien Lahoudere, see:
 * https://patchwork.kernel.org/patch/9257715/
 */

#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/nls.h>
#include <linux/of.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>

/* Internal Register Set Addresses & Default Values acc. to DS00001692C */
#define USB251XB_ADDR_VENDOR_ID_LSB
#define USB251XB_ADDR_VENDOR_ID_MSB
#define USB251XB_DEF_VENDOR_ID

#define USB251XB_ADDR_PRODUCT_ID_LSB
#define USB251XB_ADDR_PRODUCT_ID_MSB

#define USB251XB_ADDR_DEVICE_ID_LSB
#define USB251XB_ADDR_DEVICE_ID_MSB
#define USB251XB_DEF_DEVICE_ID

#define USB251XB_ADDR_CONFIG_DATA_1
#define USB251XB_DEF_CONFIG_DATA_1
#define USB251XB_ADDR_CONFIG_DATA_2
#define USB251XB_DEF_CONFIG_DATA_2
#define USB251XB_ADDR_CONFIG_DATA_3
#define USB251XB_DEF_CONFIG_DATA_3

#define USB251XB_ADDR_NON_REMOVABLE_DEVICES
#define USB251XB_DEF_NON_REMOVABLE_DEVICES

#define USB251XB_ADDR_PORT_DISABLE_SELF
#define USB251XB_DEF_PORT_DISABLE_SELF
#define USB251XB_ADDR_PORT_DISABLE_BUS
#define USB251XB_DEF_PORT_DISABLE_BUS

#define USB251XB_ADDR_MAX_POWER_SELF
#define USB251XB_DEF_MAX_POWER_SELF
#define USB251XB_ADDR_MAX_POWER_BUS
#define USB251XB_DEF_MAX_POWER_BUS

#define USB251XB_ADDR_MAX_CURRENT_SELF
#define USB251XB_DEF_MAX_CURRENT_SELF
#define USB251XB_ADDR_MAX_CURRENT_BUS
#define USB251XB_DEF_MAX_CURRENT_BUS

#define USB251XB_ADDR_POWER_ON_TIME
#define USB251XB_DEF_POWER_ON_TIME

#define USB251XB_ADDR_LANGUAGE_ID_HIGH
#define USB251XB_ADDR_LANGUAGE_ID_LOW
#define USB251XB_DEF_LANGUAGE_ID

#define USB251XB_STRING_BUFSIZE
#define USB251XB_ADDR_MANUFACTURER_STRING_LEN
#define USB251XB_ADDR_MANUFACTURER_STRING
#define USB251XB_DEF_MANUFACTURER_STRING

#define USB251XB_ADDR_PRODUCT_STRING_LEN
#define USB251XB_ADDR_PRODUCT_STRING

#define USB251XB_ADDR_SERIAL_STRING_LEN
#define USB251XB_ADDR_SERIAL_STRING
#define USB251XB_DEF_SERIAL_STRING

#define USB251XB_ADDR_BATTERY_CHARGING_ENABLE
#define USB251XB_DEF_BATTERY_CHARGING_ENABLE

#define USB251XB_ADDR_BOOST_UP
#define USB251XB_DEF_BOOST_UP
#define USB251XB_ADDR_BOOST_57
#define USB251XB_DEF_BOOST_57
#define USB251XB_ADDR_BOOST_14
#define USB251XB_DEF_BOOST_14

#define USB251XB_ADDR_PORT_SWAP
#define USB251XB_DEF_PORT_SWAP

#define USB251XB_ADDR_PORT_MAP_12
#define USB251XB_DEF_PORT_MAP_12
#define USB251XB_ADDR_PORT_MAP_34
#define USB251XB_DEF_PORT_MAP_34
#define USB251XB_ADDR_PORT_MAP_56
#define USB251XB_DEF_PORT_MAP_56
#define USB251XB_ADDR_PORT_MAP_7
#define USB251XB_DEF_PORT_MAP_7

#define USB251XB_ADDR_STATUS_COMMAND
#define USB251XB_STATUS_COMMAND_SMBUS_DOWN
#define USB251XB_STATUS_COMMAND_RESET
#define USB251XB_STATUS_COMMAND_ATTACH

#define USB251XB_I2C_REG_SZ
#define USB251XB_I2C_WRITE_SZ

#define DRIVER_NAME
#define DRIVER_DESC

struct usb251xb {};

struct usb251xb_data {};

static const struct usb251xb_data usb2422_data =;

static const struct usb251xb_data usb2512b_data =;

static const struct usb251xb_data usb2512bi_data =;

static const struct usb251xb_data usb2513b_data =;

static const struct usb251xb_data usb2513bi_data =;

static const struct usb251xb_data usb2514b_data =;

static const struct usb251xb_data usb2514bi_data =;

static const struct usb251xb_data usb2517_data =;

static const struct usb251xb_data usb2517i_data =;

#ifdef CONFIG_GPIOLIB
static int usb251xb_check_dev_children(struct device *dev, void *child)
{}

static int usb251x_check_gpio_chip(struct usb251xb *hub)
{}
#else
static int usb251x_check_gpio_chip(struct usb251xb *hub)
{
	return 0;
}
#endif

static void usb251xb_reset(struct usb251xb *hub)
{}

static int usb251xb_connect(struct usb251xb *hub)
{}

static void usb251xb_get_ports_field(struct usb251xb *hub,
				    const char *prop_name, u8 port_cnt,
				    bool ds_only, u8 *fld)
{}

static int usb251xb_get_ofdata(struct usb251xb *hub,
			       const struct usb251xb_data *data)
{}

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

static void usb251xb_regulator_disable_action(void *data)
{}

static int usb251xb_probe(struct usb251xb *hub)
{}

static int usb251xb_i2c_probe(struct i2c_client *i2c)
{}

static int __maybe_unused usb251xb_suspend(struct device *dev)
{}

static int __maybe_unused usb251xb_resume(struct device *dev)
{}

static SIMPLE_DEV_PM_OPS(usb251xb_pm_ops, usb251xb_suspend, usb251xb_resume);

static const struct i2c_device_id usb251xb_id[] =;
MODULE_DEVICE_TABLE(i2c, usb251xb_id);

static struct i2c_driver usb251xb_i2c_driver =;

module_i2c_driver();

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